diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2014-10-02 15:58:31 -0700 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2015-09-27 15:44:28 -0700 |
commit | bedfa5e3c344273d8c45a603ba3456acbac801e9 (patch) | |
tree | 40caee9294fc229a80aeaef821381713e172f213 /src/com/android/launcher3/Launcher.java | |
parent | 6d5f97506bc6b93471d7e29bd2cbd996895cc0d7 (diff) | |
download | android_packages_apps_Trebuchet-bedfa5e3c344273d8c45a603ba3456acbac801e9.tar.gz android_packages_apps_Trebuchet-bedfa5e3c344273d8c45a603ba3456acbac801e9.tar.bz2 android_packages_apps_Trebuchet-bedfa5e3c344273d8c45a603ba3456acbac801e9.zip |
Keeping icons in disabled state when SD-card is unmounted
> changing shortcutInfo.isDisabled to be a flag based variable
> on received OnPackageUnavailable, icons are disabled from desktop
instead of being removed. Icons in all apps are removed
Bug: 15852084
Bug: 16238283
Change-Id: I126d23c709682a917d4bbb84de71032593dce8f9
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 382c24b61..20c923914 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -3089,6 +3089,16 @@ public class Launcher extends Activity // Open shortcut final ShortcutInfo shortcut = (ShortcutInfo) tag; + + if (shortcut.isDisabled != 0) { + int error = R.string.activity_not_available; + if ((shortcut.isDisabled & ShortcutInfo.FLAG_DISABLED_SAFEMODE) != 0) { + error = R.string.safemode_shortcut_error; + } + Toast.makeText(this, error, Toast.LENGTH_SHORT).show(); + return; + } + final Intent intent = shortcut.intent; // Check for special shortcuts @@ -5649,24 +5659,30 @@ public class Launcher extends Activity * we only remove specific components from the workspace, where as * package-removal should clear all items by package name. * + * @param reason if non-zero, the icons are not permanently removed, rather marked as disabled. * Implementation of the method from LauncherModel.Callbacks. */ + @Override public void bindComponentsRemoved(final ArrayList<String> packageNames, - final ArrayList<AppInfo> appInfos, final UserHandleCompat user) { + final ArrayList<AppInfo> appInfos, final UserHandleCompat user, final int reason) { Runnable r = new Runnable() { public void run() { - bindComponentsRemoved(packageNames, appInfos, user); + bindComponentsRemoved(packageNames, appInfos, user, reason); } }; if (waitUntilResume(r)) { return; } - if (!packageNames.isEmpty()) { - mWorkspace.removeItemsByPackageName(packageNames, user); - } - if (!appInfos.isEmpty()) { - mWorkspace.removeItemsByApplicationInfo(appInfos, user); + if (reason == 0) { + if (!packageNames.isEmpty()) { + mWorkspace.removeItemsByPackageName(packageNames, user); + } + if (!appInfos.isEmpty()) { + mWorkspace.removeItemsByApplicationInfo(appInfos, user); + } + } else { + mWorkspace.disableShortcutsByPackageName(packageNames, user, reason); } // Notify the drag controller |