From d31df54073fbd80a9db9d277dde8c0e7421ffa14 Mon Sep 17 00:00:00 2001 From: Kenny Guy Date: Mon, 30 Jun 2014 15:12:11 +0100 Subject: Include user handle for uninstall intents. Add support for uninstalling apps from other profiles. Bug: 14127299 Change-Id: I1a3724a45c95cf93b958d23a57829efcedfc4291 --- src/com/android/launcher3/DeleteDropTarget.java | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'src/com/android/launcher3/DeleteDropTarget.java') 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); -- cgit v1.2.3