private int mIndex = 0;
public PreBootBroadcaster(ActivityManagerService service, int userId,
- ProgressReporter progress) {
+ ProgressReporter progress, boolean quiet) {
mService = service;
mUserId = userId;
mProgress = progress;
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() {
// 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);
return false;
} else {
uss.mUnlockProgress.addListener(listener);
+ uss.tokenProvided = (token != null);
}
finishUserUnlocking(uss);
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