Merge "Revert "Remove lousy synchronization"" into qt-dev
am: 1cc5f3175f
Change-Id: Id67f5acff7b85263bddd7e251612e81c3af3a8c0
This commit is contained in:
@@ -1608,31 +1608,23 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
}
|
||||
|
||||
private boolean shouldListenForFingerprint() {
|
||||
final boolean switchingUsers;
|
||||
synchronized (this) {
|
||||
switchingUsers = mSwitchingUser;
|
||||
}
|
||||
// Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
|
||||
// instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
|
||||
final boolean shouldListen = (mKeyguardIsVisible || !mDeviceInteractive ||
|
||||
(mBouncer && !mKeyguardGoingAway) || mGoingToSleep ||
|
||||
shouldListenForFingerprintAssistant() || (mKeyguardOccluded && mIsDreaming))
|
||||
&& !switchingUsers && !isFingerprintDisabled(getCurrentUser())
|
||||
&& !mSwitchingUser && !isFingerprintDisabled(getCurrentUser())
|
||||
&& (!mKeyguardGoingAway || !mDeviceInteractive) && mIsPrimaryUser;
|
||||
return shouldListen;
|
||||
}
|
||||
|
||||
private boolean shouldListenForFace() {
|
||||
final boolean switchingUsers;
|
||||
synchronized (this) {
|
||||
switchingUsers = mSwitchingUser;
|
||||
}
|
||||
final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive && !mGoingToSleep;
|
||||
final int user = getCurrentUser();
|
||||
// Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
|
||||
// instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
|
||||
return (mBouncer || mAuthInterruptActive || awakeKeyguard || shouldListenForFaceAssistant())
|
||||
&& !switchingUsers && !getUserCanSkipBouncer(user) && !isFaceDisabled(user)
|
||||
&& !mSwitchingUser && !getUserCanSkipBouncer(user) && !isFaceDisabled(user)
|
||||
&& !mKeyguardGoingAway && mFaceSettingEnabledForUser
|
||||
&& mUserManager.isUserUnlocked(user) && mIsPrimaryUser;
|
||||
}
|
||||
@@ -2188,11 +2180,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
sendUpdates(callback);
|
||||
}
|
||||
|
||||
public boolean isSwitchingUser() {
|
||||
return mSwitchingUser;
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
public void setSwitchingUser(boolean switching) {
|
||||
synchronized (this) {
|
||||
mSwitchingUser = switching;
|
||||
}
|
||||
mSwitchingUser = switching;
|
||||
// Since this comes in on a binder thread, we need to post if first
|
||||
mHandler.post(mUpdateBiometricListeningState);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.android.internal.statusbar.IStatusBarService;
|
||||
import com.android.internal.statusbar.NotificationVisibility;
|
||||
import com.android.internal.widget.MessagingGroup;
|
||||
import com.android.internal.widget.MessagingMessage;
|
||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||
import com.android.systemui.Dependency;
|
||||
import com.android.systemui.ForegroundServiceNotificationListener;
|
||||
import com.android.systemui.InitController;
|
||||
@@ -121,6 +122,8 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
|
||||
private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
|
||||
private final int mMaxAllowedKeyguardNotifications;
|
||||
private final IStatusBarService mBarService;
|
||||
private boolean mReinflateNotificationsOnUserSwitched;
|
||||
private boolean mDispatchUiModeChangeOnUserSwitched;
|
||||
private final UnlockMethodCache mUnlockMethodCache;
|
||||
private TextView mNotificationPanelDebugText;
|
||||
|
||||
@@ -239,12 +242,20 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
|
||||
public void onDensityOrFontScaleChanged() {
|
||||
MessagingMessage.dropCache();
|
||||
MessagingGroup.dropCache();
|
||||
updateNotificationsOnDensityOrFontScaleChanged();
|
||||
if (!KeyguardUpdateMonitor.getInstance(mContext).isSwitchingUser()) {
|
||||
updateNotificationsOnDensityOrFontScaleChanged();
|
||||
} else {
|
||||
mReinflateNotificationsOnUserSwitched = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUiModeChanged() {
|
||||
updateNotificationOnUiModeChanged();
|
||||
if (!KeyguardUpdateMonitor.getInstance(mContext).isSwitchingUser()) {
|
||||
updateNotificationOnUiModeChanged();
|
||||
} else {
|
||||
mDispatchUiModeChangeOnUserSwitched = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -374,6 +385,14 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
|
||||
// End old BaseStatusBar.userSwitched
|
||||
if (MULTIUSER_DEBUG) mNotificationPanelDebugText.setText("USER " + newUserId);
|
||||
mCommandQueue.animateCollapsePanels();
|
||||
if (mReinflateNotificationsOnUserSwitched) {
|
||||
updateNotificationsOnDensityOrFontScaleChanged();
|
||||
mReinflateNotificationsOnUserSwitched = false;
|
||||
}
|
||||
if (mDispatchUiModeChangeOnUserSwitched) {
|
||||
updateNotificationOnUiModeChanged();
|
||||
mDispatchUiModeChangeOnUserSwitched = false;
|
||||
}
|
||||
updateNotificationViews();
|
||||
mMediaManager.clearCurrentMediaNotification();
|
||||
mShadeController.setLockscreenUser(newUserId);
|
||||
|
||||
Reference in New Issue
Block a user