Review of suspend/unsuspend APIs
Clarified the package extras bundle returned from
getSuspendedPackageAppExtras.
Moved the bundle arg to the last in LauncherApps.onPackagesSuspended and
clarified the contents of the Bundle.
isPackageSuspended(String) now throws a NameNotFoundException if the
package is not found.
Also, removed a permission check from isPackageSuspendedForUser.
Test: builds, boots, existing tests:
atest com.android.server.pm.SuspendPackagesTest
Bug: 77518983, 77517955, 77507744, 77801528
Change-Id: I06b5f69f8f8a079c206863cb6122e90be58366cd
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index 2e93d88..1084b42 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -2187,8 +2187,12 @@
/** @hide */
@Override
- public boolean isPackageSuspended(String packageName) {
- return isPackageSuspendedForUser(packageName, mContext.getUserId());
+ public boolean isPackageSuspended(String packageName) throws NameNotFoundException {
+ try {
+ return isPackageSuspendedForUser(packageName, mContext.getUserId());
+ } catch (IllegalArgumentException ie) {
+ throw new NameNotFoundException(packageName);
+ }
}
@Override