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

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I57aec930b9536b385689521ef5fd4451fa0c3603
This commit is contained in:
Felipe Leme
2021-03-09 19:16:44 +00:00
committed by Automerger Merge Worker

View File

@@ -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();
pw.increaseIndent();
mInjector.dumpPerUserData(pw, userId);
pw.decreaseIndent();
pw.println();
if (userId == UserHandle.USER_SYSTEM) {
pw.increaseIndent();
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);
}
}
}