summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-10-31 17:16:35 -0700
committerDianne Hackborn <hackbod@google.com>2012-10-31 17:16:35 -0700
commit8124c242d390b283c2623c24a93fe9756658571a (patch)
treeb012d7678c9ba215c95a9c3b7b116efa3cc8d13f
parent03347bac6c91b8a8371b05783f6b23ef883b8c9a (diff)
downloadpackages_apps_packageinstaller-8124c242d390b283c2623c24a93fe9756658571a.zip
packages_apps_packageinstaller-8124c242d390b283c2623c24a93fe9756658571a.tar.gz
packages_apps_packageinstaller-8124c242d390b283c2623c24a93fe9756658571a.tar.bz2
Fix issue #7448596: Can't uninstall app that was installed by another user
Change-Id: I80a07a30cb452eee61e0838b5133559bb1f10d6f
-rw-r--r--AndroidManifest.xml1
-rwxr-xr-xsrc/com/android/packageinstaller/UninstallerActivity.java5
2 files changed, 5 insertions, 1 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index dfc1a6d..de11795 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -10,6 +10,7 @@
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CLEAR_APP_USER_DATA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.MANAGE_USERS" />
<application android:label="@string/app_name"
android:allowBackup="false"
android:theme="@android:style/Theme.DeviceDefault.DialogWhenLarge.NoActionBar">
diff --git a/src/com/android/packageinstaller/UninstallerActivity.java b/src/com/android/packageinstaller/UninstallerActivity.java
index 93e096e..1b9bdce 100755
--- a/src/com/android/packageinstaller/UninstallerActivity.java
+++ b/src/com/android/packageinstaller/UninstallerActivity.java
@@ -20,6 +20,7 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ComponentName;
+import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
@@ -30,6 +31,7 @@ import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
+import android.os.UserManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -161,7 +163,8 @@ public class UninstallerActivity extends Activity implements OnClickListener,
confirm.setText(R.string.uninstall_update_text);
} else {
setTitle(R.string.uninstall_application_title);
- if (mAllUsers) {
+ if (mAllUsers && ((UserManager)getSystemService(
+ Context.USER_SERVICE)).getUsers().size() >= 2) {
confirm.setText(R.string.uninstall_application_text_all_users);
} else {
confirm.setText(R.string.uninstall_application_text);