summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Pawan Wagh <waghpawan@google.com> 2025-02-24 22:39:44 +0000
committer Pawan Wagh <waghpawan@google.com> 2025-02-28 01:26:12 +0000
commit425fa132e78cc1dfa70e824b9ca0432fdf60920f (patch)
treedfff5a54632ab73f7b48e9f3b711e45bcfb9f45f
parent82f044c59edcfcf32246ec07af993844147c6376 (diff)
Expose stopAppForUser in ActivityManger
Adding wrapper function to call stopAppForUser from ActivityManagerService. It can be used stop app when full scale 'force stop' is not required. Flag: EXEMPT bug_fix Test: m && boot device Test: m Settings && adb install -r $ANDROID_PRODUCT_OUT/system_ext/priv-app/Settings/Settings.apk Bug: 389696304 Change-Id: I34e8720e2f227c7f93e2e9e1df7db993aa81c607
-rw-r--r--core/java/android/app/ActivityManager.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 69d3e8d4c0d2..a6e603042416 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -4975,6 +4975,25 @@ public class ActivityManager {
}
/**
+ * Fully stop the given app's processes without restoring service starts or
+ * bindings, but without the other durable effects of the full-scale
+ * "force stop" intervention.
+ *
+ * @param packageName The name of the package to be stopped.
+ *
+ * @hide This is not available to third party applications due to
+ * it allowing them to break other applications by stopping their
+ * services.
+ */
+ public void stopPackageForUser(String packageName) {
+ try {
+ getService().stopAppForUser(packageName, mContext.getUserId());
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Sets the current locales of the device. Calling app must have the permission
* {@code android.permission.CHANGE_CONFIGURATION} and
* {@code android.permission.WRITE_SETTINGS}.