From ba0665705bd29b505484da7c0324398d780d7bfb Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Mon, 18 Jul 2016 10:11:36 -0600 Subject: [PATCH] Handle auto-unlocked managed profiles. There are cases where a managed profile provides an auth challenge which is really an automatic unlock as a side effect from the parent profile being unlocked. Detect this case and suppress PRE_BOOT notifications. Bug: 29931646 Change-Id: I801605b0b59a7924bfe7f433415d9704664a5cbc --- .../java/com/android/server/am/UserController.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java index 4de09bd5318ee..9c22be724bbcb 100644 --- a/services/core/java/com/android/server/am/UserController.java +++ b/services/core/java/com/android/server/am/UserController.java @@ -352,9 +352,15 @@ final class UserController { final UserInfo info = getUserInfo(userId); if (!Objects.equals(info.lastLoggedInFingerprint, Build.FINGERPRINT)) { // Suppress double notifications for managed profiles that - // were unlocked automatically (no challenge token required) - // as part of their parent user being unlocked. - final boolean quiet = info.isManagedProfile() && !uss.tokenProvided; + // were unlocked automatically as part of their parent user + // being unlocked. + final boolean quiet; + if (info.isManagedProfile()) { + quiet = !uss.tokenProvided + || !mLockPatternUtils.isSeparateProfileChallengeEnabled(userId); + } else { + quiet = false; + } new PreBootBroadcaster(mService, userId, null, quiet) { @Override public void onFinished() {