Include user handle for uninstall intents.
Add support for uninstalling apps from other profiles. Bug: 14127299 Change-Id: I1a3724a45c95cf93b958d23a57829efcedfc4291
This commit is contained in:
1 parent
e639d6b67c
commit
d31df54073
3 files changed
+25
-16
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user