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

Commit 83612737 authored by Benjamin Franz's avatar Benjamin Franz Committed by android-build-merger
Browse files

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

am: df88614d

Change-Id: I1490c123b60b05798584306af9c971a3411729cc
parents 48b5b445 df88614d
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
@@ -6645,6 +6645,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
@@ -23866,6 +23866,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) {