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

Commit a90d41ee authored by Felipe Leme's avatar Felipe Leme Committed by Automerger Merge Worker
Browse files

Merge "Restricts PersonalAppsSuspensionHelper.dump() to system user." into sc-dev am: 8ead8216

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13790636

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I57aec930b9536b385689521ef5fd4451fa0c3603
parents 0874802a 8ead8216
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -1604,10 +1604,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        void setDevicePolicySafetyChecker(DevicePolicySafetyChecker safetyChecker) {
            mSafetyChecker = safetyChecker;
        }
        void dumpPerUserData(IndentingPrintWriter pw, @UserIdInt int userId) {
            PersonalAppsSuspensionHelper.forUser(mContext, userId).dump(pw);
        }
    }
    /**
@@ -9254,15 +9250,23 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    private void dumpPerUserData(IndentingPrintWriter pw) {
        int userCount = mUserData.size();
        for (int userId = 0; userId < userCount; userId++) {
            DevicePolicyData policy = getUserData(mUserData.keyAt(userId));
        for (int i = 0; i < userCount; i++) {
            int userId = mUserData.keyAt(i);
            DevicePolicyData policy = getUserData(userId);
            policy.dump(pw);
            pw.println();
            if (userId == UserHandle.USER_SYSTEM) {
                pw.increaseIndent();
            mInjector.dumpPerUserData(pw, userId);
                PersonalAppsSuspensionHelper.forUser(mContext, userId).dump(pw);
                pw.decreaseIndent();
                pw.println();
            } else {
                // pm.getUnsuspendablePackages() will fail if it's called for a different user;
                // as this dump is mostly useful for system user anyways, we can just ignore the
                // others (rather than changing the permission check in the PM method)
                Slog.d(LOG_TAG, "skipping PersonalAppsSuspensionHelper.dump() for user " + userId);
            }
        }
    }