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

Commit 38f5a27c authored by Oli Thompson's avatar Oli Thompson
Browse files

Restrict quietModeCredentialBugFix to managed profiles

Bug: 332812630
Test: atest android.devicepolicy.cts.QuietModeTest
Change-Id: I2d2c138d887595cafc613cb83378627763ad2fa3
parent 377d85d8
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -247,3 +247,13 @@ flag {
    description: "Allow MAIN user to access blocked number provider"
    bug: "338579331"
}

flag {
    name: "restrict_quiet_mode_credential_bug_fix_to_managed_profiles"
    namespace: "profile_experiences"
    description: "Use user states to check the state of quiet mode for managed profiles only"
    bug: "332812630"
    metadata {
      purpose: PURPOSE_BUGFIX
    }
}
+14 −10
Original line number Diff line number Diff line
@@ -1946,18 +1946,22 @@ public class UserManagerService extends IUserManager.Stub {
    private void showConfirmCredentialToDisableQuietMode(
            @UserIdInt int userId, @Nullable IntentSender target, @Nullable String callingPackage) {
        if (android.app.admin.flags.Flags.quietModeCredentialBugFix()) {
            // TODO (b/308121702) It may be brittle to rely on user states to check profile state
            if (!android.multiuser.Flags.restrictQuietModeCredentialBugFixToManagedProfiles()
                    || getUserInfo(userId).isManagedProfile()) {
                // TODO (b/308121702) It may be brittle to rely on user states to check managed
                //  profile state
                int state;
                synchronized (mUserStates) {
                    state = mUserStates.get(userId, UserState.STATE_NONE);
                }
                if (state != UserState.STATE_NONE) {
                    Slog.i(LOG_TAG,
                        "showConfirmCredentialToDisableQuietMode() called too early, user " + userId
                                + " is still alive.");
                            "showConfirmCredentialToDisableQuietMode() called too early, managed "
                                    + "user " + userId + " is still alive.");
                    return;
                }
            }
        }
        // otherwise, we show a profile challenge to trigger decryption of the user
        final KeyguardManager km = (KeyguardManager) mContext.getSystemService(
                Context.KEYGUARD_SERVICE);