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

Commit fb0168a8 authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

[flexiglass] Change to Lockscreen scene when legacy system says to.

StatusBarKeyguardViewManager.show(...) calls
SceneInteractor.changeScene(Lockscreen), allowing the legacy system to
show the lockscreen scene when it would otherwise show the keyguard.

This change was made in support for the attached bug, to make sure that
we show the lockscreen scene when told to by KeyguardService (through
KeyguardViewMediator) because we folded the device to its closed
position.

While it would be much cleaner to have Flexiglass automatically switch
to the Lockscreen scene when told to by KeyguardService (and/or
KeyguardViewMediator), there are many side-effects along the call path
that ends in StatusBarKeyguardViewManager.show (and in that method and
in hide also) that mean that hooking it up properly is not
straightforward. b/328109797 was created to clean this up later.

Fix: 324646158
Test: manually verified that folding the device to its closed position
correctly shows or doesn't show the lockscreen scene based on the
current setting in Settings > Display > Continue using apps on fold and
based on whether the device was previously unlocked or not.
Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT

Change-Id: I5a9b2cf319636f192750731a0106a4f4d48fedf3
parent b7b8a8cf
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ constructor(
     * desired scene. Once enough of the transition has occurred, the [currentScene] will become
     * [toScene] (unless the transition is canceled by user action or another call to this method).
     */
    @JvmOverloads
    fun changeScene(
        toScene: SceneKey,
        loggingReason: String,
+12 −3
Original line number Diff line number Diff line
@@ -81,6 +81,9 @@ import com.android.systemui.navigationbar.NavigationModeController;
import com.android.systemui.navigationbar.TaskbarDelegate;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.scene.domain.interactor.SceneInteractor;
import com.android.systemui.scene.shared.flag.SceneContainerFlag;
import com.android.systemui.scene.shared.model.Scenes;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeExpansionChangeEvent;
import com.android.systemui.shade.ShadeExpansionListener;
@@ -157,6 +160,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
    private final AlternateBouncerInteractor mAlternateBouncerInteractor;
    private final BouncerView mPrimaryBouncerView;
    private final Lazy<ShadeController> mShadeController;
    private final Lazy<SceneInteractor> mSceneInteractorLazy;

    // Local cache of expansion events, to avoid duplicates
    private float mFraction = -1f;
@@ -381,7 +385,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
            Lazy<KeyguardDismissActionInteractor> keyguardDismissActionInteractorLazy,
            SelectedUserInteractor selectedUserInteractor,
            Lazy<KeyguardSurfaceBehindInteractor> surfaceBehindInteractor,
            JavaAdapter javaAdapter
            JavaAdapter javaAdapter,
            Lazy<SceneInteractor> sceneInteractorLazy
    ) {
        mContext = context;
        mViewMediatorCallback = callback;
@@ -415,6 +420,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        mSelectedUserInteractor = selectedUserInteractor;
        mSurfaceBehindInteractor = surfaceBehindInteractor;
        mJavaAdapter = javaAdapter;
        mSceneInteractorLazy = sceneInteractorLazy;
    }

    KeyguardTransitionInteractor mKeyguardTransitionInteractor;
@@ -633,8 +639,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
    public void show(Bundle options) {
        Trace.beginSection("StatusBarKeyguardViewManager#show");
        mNotificationShadeWindowController.setKeyguardShowing(true);
        mKeyguardStateController.notifyKeyguardState(true,
                mKeyguardStateController.isOccluded());
        if (SceneContainerFlag.isEnabled()) {
            mSceneInteractorLazy.get().changeScene(
                    Scenes.Lockscreen, "StatusBarKeyguardViewManager.show");
        }
        mKeyguardStateController.notifyKeyguardState(true, mKeyguardStateController.isOccluded());
        reset(true /* hideBouncerWhenShowing */);
        SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_STATE_CHANGED,
                SysUiStatsLog.KEYGUARD_STATE_CHANGED__STATE__SHOWN);
+5 −2
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ import com.android.systemui.navigationbar.NavigationModeController;
import com.android.systemui.navigationbar.TaskbarDelegate;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.ActivityStarter.OnDismissAction;
import com.android.systemui.scene.domain.interactor.SceneInteractor;
import com.android.systemui.shade.NotificationShadeWindowView;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeExpansionChangeEvent;
@@ -224,7 +225,8 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
                        () -> mock(KeyguardDismissActionInteractor.class),
                        mSelectedUserInteractor,
                        () -> mock(KeyguardSurfaceBehindInteractor.class),
                        mock(JavaAdapter.class)) {
                        mock(JavaAdapter.class),
                        () -> mock(SceneInteractor.class)) {
                    @Override
                    public ViewRootImpl getViewRootImpl() {
                        return mViewRootImpl;
@@ -733,7 +735,8 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
                        () -> mock(KeyguardDismissActionInteractor.class),
                        mSelectedUserInteractor,
                        () -> mock(KeyguardSurfaceBehindInteractor.class),
                        mock(JavaAdapter.class)) {
                        mock(JavaAdapter.class),
                        () -> mock(SceneInteractor.class)) {
                    @Override
                    public ViewRootImpl getViewRootImpl() {
                        return mViewRootImpl;