summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/applications
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-10-31 17:15:58 -0700
committerDianne Hackborn <hackbod@google.com>2012-10-31 18:12:03 -0700
commit4de4061c8bb9475cbc5d98f83bf3b2c8ec222407 (patch)
treec474de5758309dc73b4ac7aad9059d748f9ebd07 /src/com/android/settings/applications
parent0b2bd8d11d6947a6ce71db0691ba341aec7a2964 (diff)
downloadpackages_apps_settings-4de4061c8bb9475cbc5d98f83bf3b2c8ec222407.zip
packages_apps_settings-4de4061c8bb9475cbc5d98f83bf3b2c8ec222407.tar.gz
packages_apps_settings-4de4061c8bb9475cbc5d98f83bf3b2c8ec222407.tar.bz2
Fix issue #7448596: Can't uninstall app that was installed by another user
Change-Id: I6614346f8da80ffedd71645ee2920cf85b92c87c
Diffstat (limited to 'src/com/android/settings/applications')
-rw-r--r--src/com/android/settings/applications/InstalledAppDetails.java24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index acb669e..7241fdc 100644
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -358,7 +358,10 @@ public class InstalledAppDetails extends Fragment
if ((mAppEntry.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
enabled = handleDisableable(mUninstallButton);
} else if ((mPackageInfo.applicationInfo.flags
- & ApplicationInfo.FLAG_INSTALLED) == 0) {
+ & ApplicationInfo.FLAG_INSTALLED) == 0
+ && mUserManager.getUsers().size() >= 2) {
+ // When we have multiple users, there is a separate menu
+ // to uninstall for all users.
mUninstallButton.setText(R.string.uninstall_text);
enabled = false;
} else {
@@ -811,14 +814,19 @@ public class InstalledAppDetails extends Fragment
// First time init: are we displaying an uninstalled app?
mInitialized = true;
mShowUninstalled = (mAppEntry.info.flags&ApplicationInfo.FLAG_INSTALLED) == 0;
- } else if (!mShowUninstalled) {
- // All other times: if we did not start out with the app uninstalled,
- // then if it becomes uninstalled we want to go away.
+ } else {
+ // All other times: if the app no longer exists then we want
+ // to go away.
try {
ApplicationInfo ainfo = getActivity().getPackageManager().getApplicationInfo(
mAppEntry.info.packageName, PackageManager.GET_UNINSTALLED_PACKAGES
| PackageManager.GET_DISABLED_COMPONENTS);
- return (ainfo.flags&ApplicationInfo.FLAG_INSTALLED) != 0;
+ if (!mShowUninstalled) {
+ // If we did not start out with the app uninstalled, then
+ // it transitioning to the uninstalled state for the current
+ // user means we should go away as well.
+ return (ainfo.flags&ApplicationInfo.FLAG_INSTALLED) != 0;
+ }
} catch (NameNotFoundException e) {
return false;
}
@@ -1286,11 +1294,7 @@ public class InstalledAppDetails extends Fragment
.execute((Object)null);
}
} else if ((mAppEntry.info.flags & ApplicationInfo.FLAG_INSTALLED) == 0) {
- try {
- mPm.installExistingPackage(packageName);
- refreshUi();
- } catch (NameNotFoundException e) {
- }
+ uninstallPkg(packageName, true, false);
} else {
uninstallPkg(packageName, false, false);
}