diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-09-16 18:26:11 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2012-09-16 18:26:11 -0700 |
commit | 3e0c22f98f61d8570c14c6f7ce49a05c1804d1f9 (patch) | |
tree | 288b66adbe06b45870f66e5a2839d2104283a07b /src/com/android | |
parent | 8ec226e8c778a3d1b4268edc33cd7c515d88ab31 (diff) | |
download | packages_apps_packageinstaller-3e0c22f98f61d8570c14c6f7ce49a05c1804d1f9.zip packages_apps_packageinstaller-3e0c22f98f61d8570c14c6f7ce49a05c1804d1f9.tar.gz 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
Diffstat (limited to 'src/com/android')
-rwxr-xr-x | src/com/android/packageinstaller/UninstallAppProgress.java | 5 | ||||
-rwxr-xr-x | src/com/android/packageinstaller/UninstallerActivity.java | 10 |
2 files changed, 13 insertions, 2 deletions
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), |