diff options
author | Kenny Guy <kennyguy@google.com> | 2014-06-30 15:12:11 +0100 |
---|---|---|
committer | Kenny Guy <kennyguy@google.com> | 2014-07-16 16:49:00 +0100 |
commit | d31df54073fbd80a9db9d277dde8c0e7421ffa14 (patch) | |
tree | 02ef365fd9e45ca7b4108e35f2b3921631222605 /src/com/android/launcher3/DeleteDropTarget.java | |
parent | e639d6b67c4ec16dbce8a8e0099a50c98e34c858 (diff) | |
download | android_packages_apps_Trebuchet-d31df54073fbd80a9db9d277dde8c0e7421ffa14.tar.gz android_packages_apps_Trebuchet-d31df54073fbd80a9db9d277dde8c0e7421ffa14.tar.bz2 android_packages_apps_Trebuchet-d31df54073fbd80a9db9d277dde8c0e7421ffa14.zip |
Include user handle for uninstall intents.
Add support for uninstalling apps from other profiles.
Bug: 14127299
Change-Id: I1a3724a45c95cf93b958d23a57829efcedfc4291
Diffstat (limited to 'src/com/android/launcher3/DeleteDropTarget.java')
-rw-r--r-- | src/com/android/launcher3/DeleteDropTarget.java | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java index 20546b8d8..3d45432c2 100644 --- a/src/com/android/launcher3/DeleteDropTarget.java +++ b/src/com/android/launcher3/DeleteDropTarget.java @@ -187,11 +187,6 @@ public class DeleteDropTarget extends ButtonDropTarget { if (!willAcceptDrop(info) || isAllAppsWidget(source, info)) { isVisible = false; } - if (useUninstallLabel && - !(((ItemInfo) info).user.equals(UserHandleCompat.myUserHandle()))) { - // Don't support uninstall for apps from other profiles. - isVisible = false; - } if (useUninstallLabel) { setCompoundDrawablesRelativeWithIntrinsicBounds(mUninstallDrawable, null, null, null); @@ -287,19 +282,16 @@ public class DeleteDropTarget extends ButtonDropTarget { if (isAllAppsApplication(d.dragSource, item)) { // Uninstall the application if it is being dragged from AppsCustomize AppInfo appInfo = (AppInfo) item; - // We don't support uninstalling apps from other profiles. - if (item.user.equals(UserHandleCompat.myUserHandle())) { - mLauncher.startApplicationUninstallActivity(appInfo.componentName, appInfo.flags); - } + mLauncher.startApplicationUninstallActivity(appInfo.componentName, appInfo.flags, + appInfo.user); } else if (isUninstallFromWorkspace(d)) { ShortcutInfo shortcut = (ShortcutInfo) item; - // We don't support uninstalling apps from other profiles. - if (shortcut.intent != null && shortcut.intent.getComponent() != null && - shortcut.user.equals(UserHandleCompat.myUserHandle())) { + if (shortcut.intent != null && shortcut.intent.getComponent() != null) { final ComponentName componentName = shortcut.intent.getComponent(); final DragSource dragSource = d.dragSource; - mWaitingForUninstall = - mLauncher.startApplicationUninstallActivity(componentName, shortcut.flags); + final UserHandleCompat user = shortcut.user; + mWaitingForUninstall = mLauncher.startApplicationUninstallActivity( + componentName, shortcut.flags, user); if (mWaitingForUninstall) { final Runnable checkIfUninstallWasSuccess = new Runnable() { @Override @@ -307,7 +299,7 @@ public class DeleteDropTarget extends ButtonDropTarget { mWaitingForUninstall = false; String packageName = componentName.getPackageName(); boolean uninstallSuccessful = !AllAppsList.packageHasActivities( - getContext(), packageName, UserHandleCompat.myUserHandle()); + getContext(), packageName, user); if (dragSource instanceof Folder) { ((Folder) dragSource). onUninstallActivityReturned(uninstallSuccessful); |