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

Commit 979393c4 authored by Lucas Dupin's avatar Lucas Dupin Committed by android-build-merger
Browse files

Merge "Remove lousy synchronization" into qt-dev

am: b8c25b40

Change-Id: I113651f0230f11b794fc0c788d1f12314f885ce3
parents 4b7a4225 b8c25b40
Loading
Loading
Loading
Loading
+13 −7
Original line number Original line Diff line number Diff line
@@ -1608,23 +1608,31 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
    }
    }


    private boolean shouldListenForFingerprint() {
    private boolean shouldListenForFingerprint() {
        final boolean switchingUsers;
        synchronized (this) {
            switchingUsers = mSwitchingUser;
        }
        // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
        // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
        // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
        // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
        final boolean shouldListen = (mKeyguardIsVisible || !mDeviceInteractive ||
        final boolean shouldListen = (mKeyguardIsVisible || !mDeviceInteractive ||
                (mBouncer && !mKeyguardGoingAway) || mGoingToSleep ||
                (mBouncer && !mKeyguardGoingAway) || mGoingToSleep ||
                shouldListenForFingerprintAssistant() || (mKeyguardOccluded && mIsDreaming))
                shouldListenForFingerprintAssistant() || (mKeyguardOccluded && mIsDreaming))
                && !mSwitchingUser && !isFingerprintDisabled(getCurrentUser())
                && !switchingUsers && !isFingerprintDisabled(getCurrentUser())
                && (!mKeyguardGoingAway || !mDeviceInteractive) && mIsPrimaryUser;
                && (!mKeyguardGoingAway || !mDeviceInteractive) && mIsPrimaryUser;
        return shouldListen;
        return shouldListen;
    }
    }


    private boolean shouldListenForFace() {
    private boolean shouldListenForFace() {
        final boolean switchingUsers;
        synchronized (this) {
            switchingUsers = mSwitchingUser;
        }
        final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive && !mGoingToSleep;
        final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive && !mGoingToSleep;
        final int user = getCurrentUser();
        final int user = getCurrentUser();
        // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
        // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
        // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
        // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
        return (mBouncer || mAuthInterruptActive || awakeKeyguard || shouldListenForFaceAssistant())
        return (mBouncer || mAuthInterruptActive || awakeKeyguard || shouldListenForFaceAssistant())
                && !mSwitchingUser && !getUserCanSkipBouncer(user) && !isFaceDisabled(user)
                && !switchingUsers && !getUserCanSkipBouncer(user) && !isFaceDisabled(user)
                && !mKeyguardGoingAway && mFaceSettingEnabledForUser
                && !mKeyguardGoingAway && mFaceSettingEnabledForUser
                && mUserManager.isUserUnlocked(user) && mIsPrimaryUser;
                && mUserManager.isUserUnlocked(user) && mIsPrimaryUser;
    }
    }
@@ -2180,13 +2188,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        sendUpdates(callback);
        sendUpdates(callback);
    }
    }


    public boolean isSwitchingUser() {
        return mSwitchingUser;
    }

    @AnyThread
    @AnyThread
    public void setSwitchingUser(boolean switching) {
    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
        // Since this comes in on a binder thread, we need to post if first
        mHandler.post(mUpdateBiometricListeningState);
        mHandler.post(mUpdateBiometricListeningState);
    }
    }
+2 −21
Original line number Original line Diff line number Diff line
@@ -41,7 +41,6 @@ import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.NotificationVisibility;
import com.android.internal.statusbar.NotificationVisibility;
import com.android.internal.widget.MessagingGroup;
import com.android.internal.widget.MessagingGroup;
import com.android.internal.widget.MessagingMessage;
import com.android.internal.widget.MessagingMessage;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.Dependency;
import com.android.systemui.Dependency;
import com.android.systemui.ForegroundServiceNotificationListener;
import com.android.systemui.ForegroundServiceNotificationListener;
import com.android.systemui.InitController;
import com.android.systemui.InitController;
@@ -122,8 +121,6 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
    private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
    private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
    private final int mMaxAllowedKeyguardNotifications;
    private final int mMaxAllowedKeyguardNotifications;
    private final IStatusBarService mBarService;
    private final IStatusBarService mBarService;
    private boolean mReinflateNotificationsOnUserSwitched;
    private boolean mDispatchUiModeChangeOnUserSwitched;
    private final UnlockMethodCache mUnlockMethodCache;
    private final UnlockMethodCache mUnlockMethodCache;
    private TextView mNotificationPanelDebugText;
    private TextView mNotificationPanelDebugText;


@@ -242,20 +239,12 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
    public void onDensityOrFontScaleChanged() {
    public void onDensityOrFontScaleChanged() {
        MessagingMessage.dropCache();
        MessagingMessage.dropCache();
        MessagingGroup.dropCache();
        MessagingGroup.dropCache();
        if (!KeyguardUpdateMonitor.getInstance(mContext).isSwitchingUser()) {
        updateNotificationsOnDensityOrFontScaleChanged();
        updateNotificationsOnDensityOrFontScaleChanged();
        } else {
            mReinflateNotificationsOnUserSwitched = true;
        }
    }
    }


    @Override
    @Override
    public void onUiModeChanged() {
    public void onUiModeChanged() {
        if (!KeyguardUpdateMonitor.getInstance(mContext).isSwitchingUser()) {
        updateNotificationOnUiModeChanged();
        updateNotificationOnUiModeChanged();
        } else {
            mDispatchUiModeChangeOnUserSwitched = true;
        }
    }
    }


    @Override
    @Override
@@ -385,14 +374,6 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
        // End old BaseStatusBar.userSwitched
        // End old BaseStatusBar.userSwitched
        if (MULTIUSER_DEBUG) mNotificationPanelDebugText.setText("USER " + newUserId);
        if (MULTIUSER_DEBUG) mNotificationPanelDebugText.setText("USER " + newUserId);
        mCommandQueue.animateCollapsePanels();
        mCommandQueue.animateCollapsePanels();
        if (mReinflateNotificationsOnUserSwitched) {
            updateNotificationsOnDensityOrFontScaleChanged();
            mReinflateNotificationsOnUserSwitched = false;
        }
        if (mDispatchUiModeChangeOnUserSwitched) {
            updateNotificationOnUiModeChanged();
            mDispatchUiModeChangeOnUserSwitched = false;
        }
        updateNotificationViews();
        updateNotificationViews();
        mMediaManager.clearCurrentMediaNotification();
        mMediaManager.clearCurrentMediaNotification();
        mShadeController.setLockscreenUser(newUserId);
        mShadeController.setLockscreenUser(newUserId);