From 3271b5918654d8d3a7656de78df6f39276502da6 Mon Sep 17 00:00:00 2001 From: Adam Bookatz Date: Fri, 8 May 2020 12:30:37 -0700 Subject: UserTypeDetails.dump restrictions for SYSTEM The SYSTEM user does not get its default restrictions from UserTypeDetails.mDefaultRestrictions; rather it gets it from config_defaultFirstUserRestrictions. Therefore, we now dump those restrictions from the latter (instead of the former) for the SYSTEM user. Fixes: 146793707 Test: manual check of: adb shell dumpsys user Change-Id: I5cf04d20fe9edd748803634ec80336b267695ce6 Merged-In: I5cf04d20fe9edd748803634ec80336b267695ce6 --- .../com/android/server/pm/UserTypeDetails.java | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/pm/UserTypeDetails.java b/services/core/java/com/android/server/pm/UserTypeDetails.java index 826cd3f75222..717737f831da 100644 --- a/services/core/java/com/android/server/pm/UserTypeDetails.java +++ b/services/core/java/com/android/server/pm/UserTypeDetails.java @@ -255,8 +255,27 @@ public final class UserTypeDetails { pw.print(prefix); pw.print("mDefaultUserInfoFlags: "); pw.println(UserInfo.flagsToString(mDefaultUserInfoPropertyFlags)); pw.print(prefix); pw.print("mLabel: "); pw.println(mLabel); - pw.print(prefix); pw.println("mDefaultRestrictions: "); - UserRestrictionsUtils.dumpRestrictions(pw, prefix + " ", mDefaultRestrictions); + + if (isSystem()) { + pw.print(prefix); pw.println("config_defaultFirstUserRestrictions: "); + try { + final Bundle restrictions = new Bundle(); + final String[] defaultFirstUserRestrictions = Resources.getSystem().getStringArray( + com.android.internal.R.array.config_defaultFirstUserRestrictions); + for (String userRestriction : defaultFirstUserRestrictions) { + if (UserRestrictionsUtils.isValidRestriction(userRestriction)) { + restrictions.putBoolean(userRestriction, true); + } + } + UserRestrictionsUtils.dumpRestrictions(pw, prefix + " ", restrictions); + } catch (Resources.NotFoundException e) { + pw.print(prefix); pw.println(" none - resource not found"); + } + } else { + pw.print(prefix); pw.println("mDefaultRestrictions: "); + UserRestrictionsUtils.dumpRestrictions(pw, prefix + " ", mDefaultRestrictions); + } + pw.print(prefix); pw.print("mIconBadge: "); pw.println(mIconBadge); pw.print(prefix); pw.print("mBadgePlain: "); pw.println(mBadgePlain); pw.print(prefix); pw.print("mBadgeNoBackground: "); pw.println(mBadgeNoBackground); -- cgit v1.2.3-59-g8ed1b