summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-09-16 18:26:11 -0700
committerDianne Hackborn <hackbod@google.com>2012-09-16 18:26:11 -0700
commit3e0c22f98f61d8570c14c6f7ce49a05c1804d1f9 (patch)
tree288b66adbe06b45870f66e5a2839d2104283a07b
parent8ec226e8c778a3d1b4268edc33cd7c515d88ab31 (diff)
downloadandroid_packages_apps_PackageInstaller-3e0c22f98f61d8570c14c6f7ce49a05c1804d1f9.zip
android_packages_apps_PackageInstaller-3e0c22f98f61d8570c14c6f7ce49a05c1804d1f9.tar.gz
android_packages_apps_PackageInstaller-3e0c22f98f61d8570c14c6f7ce49a05c1804d1f9.tar.bz2
Implement new option for uninstalling over all users.
This API is hidden, but we don't try to protect with a permission here because we always go through a UI for the user to verify the operation. Change-Id: I5580bcbe7ca00b8613c0d8523f348ce83b2d5031
-rw-r--r--res/values/strings.xml2
-rwxr-xr-xsrc/com/android/packageinstaller/UninstallAppProgress.java5
-rwxr-xr-xsrc/com/android/packageinstaller/UninstallerActivity.java10
3 files changed, 15 insertions, 2 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d5d1ab5..db43792 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -111,6 +111,8 @@
<string name="uninstall_update_title">Uninstall update</string>
<string name="uninstall_activity_text"><xliff:g id="activity_name">%1$s</xliff:g> is part of the following app:</string>
<string name="uninstall_application_text">Do you want to uninstall this app?</string>
+ <string name="uninstall_application_text_all_users">Do you want to uninstall this app for <b>all</b>
+ users? The application and its data will be removed from <b>all</b> users on the device.</string>
<string name="uninstall_update_text">Do you want to replace this app with the factory version?</string>
<string name="uninstalling">Uninstalling\u2026</string>
<string name="uninstall_done">Uninstall finished.</string>
diff --git a/src/com/android/packageinstaller/UninstallAppProgress.java b/src/com/android/packageinstaller/UninstallAppProgress.java
index 92822b8..7aa0a2e 100755
--- a/src/com/android/packageinstaller/UninstallAppProgress.java
+++ b/src/com/android/packageinstaller/UninstallAppProgress.java
@@ -45,6 +45,7 @@ public class UninstallAppProgress extends Activity implements OnClickListener {
private final String TAG="UninstallAppProgress";
private boolean localLOGV = false;
private ApplicationInfo mAppInfo;
+ private boolean mAllUsers;
private TextView mStatusTextView;
private Button mOkButton;
private Button mDeviceManagerButton;
@@ -110,6 +111,7 @@ public class UninstallAppProgress extends Activity implements OnClickListener {
super.onCreate(icicle);
Intent intent = getIntent();
mAppInfo = intent.getParcelableExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO);
+ mAllUsers = intent.getBooleanExtra(Intent.EXTRA_UNINSTALL_ALL_USERS, false);
initView();
}
@@ -158,7 +160,8 @@ public class UninstallAppProgress extends Activity implements OnClickListener {
mOkButton.setOnClickListener(this);
mOkPanel.setVisibility(View.INVISIBLE);
PackageDeleteObserver observer = new PackageDeleteObserver();
- getPackageManager().deletePackage(mAppInfo.packageName, observer, 0);
+ getPackageManager().deletePackage(mAppInfo.packageName, observer,
+ mAllUsers ? PackageManager.DELETE_ALL_USERS : 0);
}
public void onClick(View v) {
diff --git a/src/com/android/packageinstaller/UninstallerActivity.java b/src/com/android/packageinstaller/UninstallerActivity.java
index 5a31297..93e096e 100755
--- a/src/com/android/packageinstaller/UninstallerActivity.java
+++ b/src/com/android/packageinstaller/UninstallerActivity.java
@@ -52,6 +52,7 @@ public class UninstallerActivity extends Activity implements OnClickListener,
private boolean localLOGV = false;
PackageManager mPm;
private ApplicationInfo mAppInfo;
+ private boolean mAllUsers;
private Button mOk;
private Button mCancel;
@@ -100,6 +101,7 @@ public class UninstallerActivity extends Activity implements OnClickListener,
Intent newIntent = new Intent(Intent.ACTION_VIEW);
newIntent.putExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO,
mAppInfo);
+ newIntent.putExtra(Intent.EXTRA_UNINSTALL_ALL_USERS, mAllUsers);
if (getIntent().getBooleanExtra(Intent.EXTRA_RETURN_RESULT, false)) {
newIntent.putExtra(Intent.EXTRA_RETURN_RESULT, true);
newIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
@@ -132,6 +134,8 @@ public class UninstallerActivity extends Activity implements OnClickListener,
errFlag = true;
}
+ mAllUsers = intent.getBooleanExtra(Intent.EXTRA_UNINSTALL_ALL_USERS, false);
+
// The class name may have been specified (e.g. when deleting an app from all apps)
String className = packageURI.getFragment();
ActivityInfo activityInfo = null;
@@ -157,7 +161,11 @@ public class UninstallerActivity extends Activity implements OnClickListener,
confirm.setText(R.string.uninstall_update_text);
} else {
setTitle(R.string.uninstall_application_title);
- confirm.setText(R.string.uninstall_application_text);
+ if (mAllUsers) {
+ confirm.setText(R.string.uninstall_application_text_all_users);
+ } else {
+ confirm.setText(R.string.uninstall_application_text);
+ }
}
// If an activity was specified (e.g. when dragging from All Apps to trash can),