Suppress PRE_BOOT notifications for some profiles.

When a profile is unlocked as a side effect of it's parent user being
unlocked, it's confusing to see two sets of identical notifications,
so suppress the set belonging to the profile.

Profile notifications are still shown when the profile has a separate
authentication challenge.

Bug: 29931646
Change-Id: Id8d621451996c9e2f159560894596292ceb00f8d
This commit is contained in:
Jeff Sharkey
2016-07-07 12:33:48 -06:00
parent 400960a40e
commit 24d949138f
3 changed files with 11 additions and 3 deletions

View File

@@ -57,7 +57,7 @@ public abstract class PreBootBroadcaster extends IIntentReceiver.Stub {
private int mIndex = 0;
public PreBootBroadcaster(ActivityManagerService service, int userId,
ProgressReporter progress) {
ProgressReporter progress, boolean quiet) {
mService = service;
mUserId = userId;
mProgress = progress;
@@ -68,7 +68,9 @@ public abstract class PreBootBroadcaster extends IIntentReceiver.Stub {
mTargets = mService.mContext.getPackageManager().queryBroadcastReceiversAsUser(mIntent,
MATCH_SYSTEM_ONLY, UserHandle.of(userId));
mHandler.obtainMessage(MSG_SHOW).sendToTarget();
if (!quiet) {
mHandler.obtainMessage(MSG_SHOW).sendToTarget();
}
}
public void sendNext() {

View File

@@ -351,7 +351,11 @@ final class UserController {
// PRE_BOOT receivers are finished to avoid ANR'ing apps
final UserInfo info = getUserInfo(userId);
if (!Objects.equals(info.lastLoggedInFingerprint, Build.FINGERPRINT)) {
new PreBootBroadcaster(mService, userId, null) {
// 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;
new PreBootBroadcaster(mService, userId, null, quiet) {
@Override
public void onFinished() {
finishUserUnlockedCompleted(uss);
@@ -972,6 +976,7 @@ final class UserController {
return false;
} else {
uss.mUnlockProgress.addListener(listener);
uss.tokenProvided = (token != null);
}
finishUserUnlocking(uss);

View File

@@ -54,6 +54,7 @@ public final class UserState {
public int state = STATE_BOOTING;
public int lastState = STATE_BOOTING;
public boolean switching;
public boolean tokenProvided;
/**
* The last time that a provider was reported to usage stats as being brought to important