Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df88614d authored by Benjamin Franz's avatar Benjamin Franz Committed by Android (Google) Code Review
Browse files

Merge "Silently ignore force stop API for protected packages" into pi-dev

parents 2bc6f2e4 f81bf7fa
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -301,6 +301,12 @@ public abstract class PackageManagerInternal {
     */
    public abstract boolean isPackageDataProtected(int userId, String packageName);

    /**
     * Returns {@code true} if a given package's state is protected, e.g. it cannot be force
     * stopped, suspended, disabled or hidden. Otherwise, returns {@code false}.
     */
    public abstract boolean isPackageStateProtected(String packageName, int userId);

    /**
     * Returns {@code true} if a given package is installed as ephemeral. Otherwise, returns
     * {@code false}.
+7 −0
Original line number Diff line number Diff line
@@ -6771,6 +6771,13 @@ public class ActivityManagerService extends IActivityManager.Stub
                int[] users = userId == UserHandle.USER_ALL
                        ? mUserController.getUsers() : new int[] { userId };
                for (int user : users) {
                    if (getPackageManagerInternalLocked().isPackageStateProtected(
                            packageName, user)) {
                        Slog.w(TAG, "Ignoring request to force stop protected package "
                                + packageName + " u" + user);
                        return;
                    }
                    int pkgUid = -1;
                    try {
                        pkgUid = pm.getPackageUid(packageName, MATCH_DEBUG_TRIAGED_MISSING,
+5 −0
Original line number Diff line number Diff line
@@ -23855,6 +23855,11 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
            return mProtectedPackages.isPackageDataProtected(userId, packageName);
        }
        @Override
        public boolean isPackageStateProtected(String packageName, int userId) {
            return mProtectedPackages.isPackageStateProtected(userId, packageName);
        }
        @Override
        public boolean isPackageEphemeral(int userId, String packageName) {
            synchronized (mPackages) {