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

Commit 2488811d authored by Aaron Liu's avatar Aaron Liu Committed by Automerger Merge Worker
Browse files

Merge changes I5a5714fc,Ib45034ea,I9e4bc66d,Ie341c5d8,I1f40e8b7 into udc-dev...

Merge changes I5a5714fc,Ib45034ea,I9e4bc66d,Ie341c5d8,I1f40e8b7 into udc-dev am: 5ba92513 am: e61501ed

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22431824



Change-Id: Ie358ce8e1ae324f97db5077a915e78c82e6035c6
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 52d3483b e61501ed
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -219,12 +219,12 @@ object Flags {
    /** Whether to inflate the bouncer view on a background thread. */
    /** Whether to inflate the bouncer view on a background thread. */
    // TODO(b/272091103): Tracking Bug
    // TODO(b/272091103): Tracking Bug
    @JvmField
    @JvmField
    val ASYNC_INFLATE_BOUNCER = unreleasedFlag(229, "async_inflate_bouncer", teamfood = true)
    val ASYNC_INFLATE_BOUNCER = releasedFlag(229, "async_inflate_bouncer")


    /** Whether to inflate the bouncer view on a background thread. */
    /** Whether to inflate the bouncer view on a background thread. */
    // TODO(b/273341787): Tracking Bug
    // TODO(b/273341787): Tracking Bug
    @JvmField
    @JvmField
    val PREVENT_BYPASS_KEYGUARD = unreleasedFlag(230, "prevent_bypass_keyguard", teamfood = true)
    val PREVENT_BYPASS_KEYGUARD = releasedFlag(230, "prevent_bypass_keyguard")


    /** Whether to use a new data source for intents to run on keyguard dismissal. */
    /** Whether to use a new data source for intents to run on keyguard dismissal. */
    @JvmField
    @JvmField
+5 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ import com.android.systemui.common.coroutine.ChannelExt.trySendWithFailureLoggin
import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow
import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow
import com.android.systemui.common.shared.model.Position
import com.android.systemui.common.shared.model.Position
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.doze.DozeHost
import com.android.systemui.doze.DozeHost
import com.android.systemui.doze.DozeMachine
import com.android.systemui.doze.DozeMachine
import com.android.systemui.doze.DozeTransitionCallback
import com.android.systemui.doze.DozeTransitionCallback
@@ -43,12 +44,14 @@ import com.android.systemui.statusbar.phone.BiometricUnlockController.WakeAndUnl
import com.android.systemui.statusbar.phone.DozeParameters
import com.android.systemui.statusbar.phone.DozeParameters
import com.android.systemui.statusbar.policy.KeyguardStateController
import com.android.systemui.statusbar.policy.KeyguardStateController
import javax.inject.Inject
import javax.inject.Inject
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flowOn


/** Defines interface for classes that encapsulate application state for the keyguard. */
/** Defines interface for classes that encapsulate application state for the keyguard. */
interface KeyguardRepository {
interface KeyguardRepository {
@@ -195,6 +198,7 @@ constructor(
    private val dozeParameters: DozeParameters,
    private val dozeParameters: DozeParameters,
    private val authController: AuthController,
    private val authController: AuthController,
    private val dreamOverlayCallbackController: DreamOverlayCallbackController,
    private val dreamOverlayCallbackController: DreamOverlayCallbackController,
    @Main private val mainDispatcher: CoroutineDispatcher
) : KeyguardRepository {
) : KeyguardRepository {
    private val _animateBottomAreaDozingTransitions = MutableStateFlow(false)
    private val _animateBottomAreaDozingTransitions = MutableStateFlow(false)
    override val animateBottomAreaDozingTransitions =
    override val animateBottomAreaDozingTransitions =
@@ -387,6 +391,7 @@ constructor(


                awaitClose { keyguardUpdateMonitor.removeCallback(callback) }
                awaitClose { keyguardUpdateMonitor.removeCallback(callback) }
            }
            }
            .flowOn(mainDispatcher)
            .distinctUntilChanged()
            .distinctUntilChanged()


    override val linearDozeAmount: Flow<Float> = conflatedCallbackFlow {
    override val linearDozeAmount: Flow<Float> = conflatedCallbackFlow {
+4 −8
Original line number Original line Diff line number Diff line
@@ -142,22 +142,18 @@ constructor(
            (isBouncerShowing() || repository.primaryBouncerShowingSoon.value) &&
            (isBouncerShowing() || repository.primaryBouncerShowingSoon.value) &&
                needsFullscreenBouncer()
                needsFullscreenBouncer()


        if (!resumeBouncer && isBouncerShowing()) {
            // If bouncer is visible, the bouncer is already showing.
            return
        }

        Trace.beginSection("KeyguardBouncer#show")
        Trace.beginSection("KeyguardBouncer#show")
        repository.setPrimaryScrimmed(isScrimmed)
        repository.setPrimaryScrimmed(isScrimmed)
        if (isScrimmed) {
        if (isScrimmed) {
            setPanelExpansion(KeyguardBouncerConstants.EXPANSION_VISIBLE)
            setPanelExpansion(KeyguardBouncerConstants.EXPANSION_VISIBLE)
        }
        }


        // In this special case, we want to hide the bouncer and show it again. We want to emit
        // show(true) again so that we can reinflate the new view.
        if (resumeBouncer) {
        if (resumeBouncer) {
            primaryBouncerView.delegate?.resume()
            repository.setPrimaryShow(false)
            // Bouncer is showing the next security screen and we just need to prompt a resume.
            return
        }
        }

        if (primaryBouncerView.delegate?.showNextSecurityScreenOrFinish() == true) {
        if (primaryBouncerView.delegate?.showNextSecurityScreenOrFinish() == true) {
            // Keyguard is done.
            // Keyguard is done.
            return
            return
+1 −0
Original line number Original line Diff line number Diff line
@@ -113,6 +113,7 @@ object KeyguardBouncerViewBinder {
                            view.visibility = if (isShowing) View.VISIBLE else View.INVISIBLE
                            view.visibility = if (isShowing) View.VISIBLE else View.INVISIBLE
                            if (isShowing) {
                            if (isShowing) {
                                // Reset Security Container entirely.
                                // Reset Security Container entirely.
                                view.visibility = View.VISIBLE
                                securityContainerController.reinflateViewFlipper {
                                securityContainerController.reinflateViewFlipper {
                                    // Reset Security Container entirely.
                                    // Reset Security Container entirely.
                                    securityContainerController.onBouncerVisibilityChanged(
                                    securityContainerController.onBouncerVisibilityChanged(
+9 −11
Original line number Original line Diff line number Diff line
@@ -163,8 +163,6 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
    @Captor
    @Captor
    private ArgumentCaptor<KeyguardSecurityContainer.SwipeListener> mSwipeListenerArgumentCaptor;
    private ArgumentCaptor<KeyguardSecurityContainer.SwipeListener> mSwipeListenerArgumentCaptor;


    private Configuration mConfiguration;

    private KeyguardSecurityContainerController mKeyguardSecurityContainerController;
    private KeyguardSecurityContainerController mKeyguardSecurityContainerController;
    private KeyguardPasswordViewController mKeyguardPasswordViewController;
    private KeyguardPasswordViewController mKeyguardPasswordViewController;
    private KeyguardPasswordView mKeyguardPasswordView;
    private KeyguardPasswordView mKeyguardPasswordView;
@@ -172,12 +170,12 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {


    @Before
    @Before
    public void setup() {
    public void setup() {
        mConfiguration = new Configuration();
        mConfiguration.setToDefaults(); // Defaults to ORIENTATION_UNDEFINED.
        mTestableResources = mContext.getOrCreateTestableResources();
        mTestableResources = mContext.getOrCreateTestableResources();
        mTestableResources.getResources().getConfiguration().orientation =
                Configuration.ORIENTATION_UNDEFINED;


        when(mView.getContext()).thenReturn(mContext);
        when(mView.getContext()).thenReturn(mContext);
        when(mView.getResources()).thenReturn(mContext.getResources());
        when(mView.getResources()).thenReturn(mTestableResources.getResources());
        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(/* width=  */ 0, /* height= */
        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(/* width=  */ 0, /* height= */
                0);
                0);
        lp.gravity = 0;
        lp.gravity = 0;
@@ -254,6 +252,8 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {


    @Test
    @Test
    public void onResourcesUpdate_callsThroughOnRotationChange() {
    public void onResourcesUpdate_callsThroughOnRotationChange() {
        clearInvocations(mView);

        // Rotation is the same, shouldn't cause an update
        // Rotation is the same, shouldn't cause an update
        mKeyguardSecurityContainerController.updateResources();
        mKeyguardSecurityContainerController.updateResources();
        verify(mView, never()).initMode(eq(MODE_DEFAULT), eq(mGlobalSettings), eq(mFalsingManager),
        verify(mView, never()).initMode(eq(MODE_DEFAULT), eq(mGlobalSettings), eq(mFalsingManager),
@@ -620,12 +620,12 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
        // Set initial gravity
        // Set initial gravity
        mTestableResources.addOverride(R.integer.keyguard_host_view_gravity,
        mTestableResources.addOverride(R.integer.keyguard_host_view_gravity,
                Gravity.CENTER);
                Gravity.CENTER);
        mTestableResources.addOverride(
                R.bool.can_use_one_handed_bouncer, false);


        // Kick off the initial pass...
        // Kick off the initial pass...
        mKeyguardSecurityContainerController.onInit();
        mKeyguardSecurityContainerController.onInit();
        verify(mView).setLayoutParams(argThat(
        verify(mView).setLayoutParams(any());
                (ArgumentMatcher<FrameLayout.LayoutParams>) argument ->
                        argument.gravity == Gravity.CENTER));
        clearInvocations(mView);
        clearInvocations(mView);


        // Now simulate a config change
        // Now simulate a config change
@@ -633,9 +633,7 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
                Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);
                Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);


        mKeyguardSecurityContainerController.updateResources();
        mKeyguardSecurityContainerController.updateResources();
        verify(mView).setLayoutParams(argThat(
        verify(mView).setLayoutParams(any());
                (ArgumentMatcher<FrameLayout.LayoutParams>) argument ->
                        argument.gravity == (Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM)));
    }
    }


    @Test
    @Test
Loading