diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2014-10-08 18:10:39 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-10-08 18:10:40 +0000 |
commit | 05700ad38f07d859f28a8e5d0cf65137c7c85d23 (patch) | |
tree | 7b914049e4958d5b525fac8afb74065ab9282797 /src/com/android/launcher3/Launcher.java | |
parent | de326d08d8764e7f9c610a5c9b755bfa78ae2eb9 (diff) | |
parent | 1a745e8f18e54aff152ff51743ae7595adde6927 (diff) | |
download | android_packages_apps_Trebuchet-05700ad38f07d859f28a8e5d0cf65137c7c85d23.tar.gz android_packages_apps_Trebuchet-05700ad38f07d859f28a8e5d0cf65137c7c85d23.tar.bz2 android_packages_apps_Trebuchet-05700ad38f07d859f28a8e5d0cf65137c7c85d23.zip |
Merge "Keeping icons in disabled state when SD-card is unmounted" into ub-now-queens
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 24e2d6a0b..6ead23123 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2590,6 +2590,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 @@ -4766,24 +4776,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 |