summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Birg <roman@cyngn.com>2015-04-16 11:24:53 -0700
committerRoman Birg <roman@cyngn.com>2015-04-16 18:33:14 +0000
commit60046217f7508a70f0b83a2fcba551f75fc67f2c (patch)
treef00e2e51d8f539369e0e05263d19ba09c98053dd
parentc4326d489d5e8e252417a5edadc9e413c355d471 (diff)
downloadandroid_packages_apps_Trebuchet-60046217f7508a70f0b83a2fcba551f75fc67f2c.tar.gz
android_packages_apps_Trebuchet-60046217f7508a70f0b83a2fcba551f75fc67f2c.tar.bz2
android_packages_apps_Trebuchet-60046217f7508a70f0b83a2fcba551f75fc67f2c.zip
Trebuchet: fix Protected apps issue with folders
When there's a folder of shortcuts where all of the items have been set to protected, the first item in the folder sometimes does not get removed from the workspace allowing access to the protected application. When the second-to-last item in a folder is being removed, it was being replaced with the shortcut automatically, and we were checking against the folder contents, which was off the workspace at this time, but still had the shortcut. We need to check whether the last shortcut we are re-adding back to the workspace is actually protected before adding it. Change-Id: I9c7dbbd8562ae3e71e198747e6cb1c10417d1f46 Signed-off-by: Roman Birg <roman@cyngn.com> (cherry picked from commit d06291251703ce19968625742438c03351203d37)
-rw-r--r--src/com/android/launcher3/LauncherModel.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index e0ad4615f..a8bcb2c66 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -2747,10 +2747,13 @@ public class LauncherModel extends BroadcastReceiver
ShortcutInfo finalItem = folder.contents.get(0);
finalItem.container = folder.container;
LauncherModel.deleteItemFromDatabase(mContext, folder);
- LauncherModel.addOrMoveItemInDatabase(mContext, finalItem, folder.container,
- folder.screenId, folder.cellX, folder.cellY);
+ // only replace this item back on the workspace if it's not protected
+ if (!mHiddenApps.contains(finalItem.intent.getComponent())) {
+ LauncherModel.addOrMoveItemInDatabase(mContext, finalItem, folder.container,
+ folder.screenId, folder.cellX, folder.cellY);
+ workspaceItems.add(finalItem);
+ }
workspaceItems.remove(i);
- workspaceItems.add(finalItem);
folders.remove(Long.valueOf(item.id));
} else if (folder.contents.size() == 0 /*&& !(folder instanceof LiveFolderInfo)*/) {
LauncherModel.deleteFolderContentsFromDatabase(mContext, folder);