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

Commit 1ac8c7c4 authored by Aaron Liu's avatar Aaron Liu Committed by Android (Google) Code Review
Browse files

Merge "Destroy and reinflate bouncer before showing" into tm-qpr-dev

parents 103b7b48 20d4c6a6
Loading
Loading
Loading
Loading
+18 −15
Original line number Diff line number Diff line
@@ -206,6 +206,13 @@ public class KeyguardHostViewController extends ViewController<KeyguardHostView>
        mKeyguardSecurityContainerController.reset();
    }

    /**
     * Reinflate the view flipper child view.
     */
    public void reinflateViewFlipper() {
        mKeyguardSecurityContainerController.reinflateViewFlipper();
    }

    /**
     * Dismisses the keyguard by going to the next screen or making it gone.
     * @param targetUserId a user that needs to be the foreground user at the dismissal completion.
@@ -232,12 +239,9 @@ public class KeyguardHostViewController extends ViewController<KeyguardHostView>
    /**
     * Starts the animation when the Keyguard gets shown.
     */
    public void appear(int statusBarHeight) {
    public void appear() {
        // We might still be collapsed and the view didn't have time to layout yet or still
        // be small, let's wait on the predraw to do the animation in that case.
        if (mView.getHeight() != 0 && mView.getHeight() != statusBarHeight) {
            mKeyguardSecurityContainerController.startAppearAnimation();
        } else {
        mView.getViewTreeObserver().addOnPreDrawListener(
                new ViewTreeObserver.OnPreDrawListener() {
                    @Override
@@ -249,7 +253,6 @@ public class KeyguardHostViewController extends ViewController<KeyguardHostView>
                });
        mView.requestLayout();
    }
    }

    /**
     * Show a string explaining why the security view needs to be solved.
+6 −3
Original line number Diff line number Diff line
@@ -743,17 +743,20 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
    }

    private void reloadColors() {
        resetViewFlipper();
        reinflateViewFlipper();
        mView.reloadColors();
    }

    /** Handles density or font scale changes. */
    private void onDensityOrFontScaleChanged() {
        resetViewFlipper();
        reinflateViewFlipper();
        mView.onDensityOrFontScaleChanged();
    }

    private void resetViewFlipper() {
    /**
     * Reinflate the view flipper child view.
     */
    public void reinflateViewFlipper() {
        mSecurityViewFlipperController.clearViews();
        mSecurityViewFlipperController.getSecurityView(mCurrentSecurityMode,
                mKeyguardSecurityCallback);
+3 −13
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.view.ViewGroup
import android.window.OnBackAnimationCallback
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
import com.android.internal.policy.SystemBarUtils
import com.android.keyguard.KeyguardHostViewController
import com.android.keyguard.KeyguardSecurityModel
import com.android.keyguard.KeyguardUpdateMonitor
@@ -98,14 +97,14 @@ object KeyguardBouncerViewBinder {
                    viewModel.setBouncerViewDelegate(delegate)
                    launch {
                        viewModel.show.collect {
                            // Reset Security Container entirely.
                            hostViewController.reinflateViewFlipper()
                            hostViewController.showPromptReason(it.promptReason)
                            it.errorMessage?.let { errorMessage ->
                                hostViewController.showErrorMessage(errorMessage)
                            }
                            hostViewController.showPrimarySecurityScreen()
                            hostViewController.appear(
                                SystemBarUtils.getStatusBarHeight(view.context)
                            )
                            hostViewController.appear()
                            hostViewController.onResume()
                        }
                    }
@@ -159,15 +158,6 @@ object KeyguardBouncerViewBinder {
                        }
                    }

                    launch {
                        viewModel.isBouncerVisible
                            .filter { !it }
                            .collect {
                                // Remove existing input for security reasons.
                                hostViewController.resetSecurityContainer()
                            }
                    }

                    launch {
                        viewModel.keyguardPosition.collect { position ->
                            hostViewController.updateKeyguardPosition(position)
+8 −0
Original line number Diff line number Diff line
@@ -600,6 +600,14 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
                any(KeyguardSecurityCallback.class));
    }

    @Test
    public void testReinflateViewFlipper() {
        mKeyguardSecurityContainerController.reinflateViewFlipper();
        verify(mKeyguardSecurityViewFlipperController).clearViews();
        verify(mKeyguardSecurityViewFlipperController).getSecurityView(any(SecurityMode.class),
                any(KeyguardSecurityCallback.class));
    }

    private KeyguardSecurityContainer.SwipeListener getRegisteredSwipeListener() {
        mKeyguardSecurityContainerController.onViewAttached();
        verify(mView).setSwipeListener(mSwipeListenerArgumentCaptor.capture());