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

Commit 7c63532f authored by Ben Lin's avatar Ben Lin
Browse files

PiP: Hide Menu when Keyguard is showing.

This used to be done relying on activity lifecycle, which is no longer
the case. We will instead use Keyguard listener callbacks to hide the
menu.

Bug: 169086834
Test: Open PiP, show menu, lock screen - don't see menu on AOD anymore
Change-Id: If98158ae69f0155c22e0a88d3e47f95d15ddfa0f
parent ef35e18c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -254,7 +254,9 @@ public class PipMenuActivityController {
        if (isMenuVisible()) {
            // If the menu is visible in either the closed or full state, then hide the menu and
            // trigger the animation trigger afterwards
            if (onStartCallback != null) {
                onStartCallback.run();
            }
            mPipMenuView.hideMenu(onEndCallback);
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -316,7 +316,7 @@ public class PipMenuView extends FrameLayout {
    }

    void hideMenu(Runnable animationEndCallback) {
        hideMenu(animationEndCallback, true /* notifyMenuVisibility */, false);
        hideMenu(animationEndCallback, true /* notifyMenuVisibility */, true /* animate */);
    }

    private void hideMenu(final Runnable animationFinishedRunnable, boolean notifyMenuVisibility,
+10 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ public final class WMShell extends SystemUI
    private final ProtoTracer mProtoTracer;

    private KeyguardUpdateMonitorCallback mSplitScreenKeyguardCallback;
    private KeyguardUpdateMonitorCallback mPipKeyguardCallback;
    private KeyguardUpdateMonitorCallback mOneHandedKeyguardCallback;

    @Inject
@@ -140,6 +141,15 @@ public final class WMShell extends SystemUI
                pip.showPictureInPictureMenu();
            }
        });
        mPipKeyguardCallback = new KeyguardUpdateMonitorCallback() {
            @Override
            public void onKeyguardVisibilityChanged(boolean showing) {
                if (showing) {
                    pip.hidePipMenu(null, null);
                }
            }
        };
        mKeyguardUpdateMonitor.registerCallback(mPipKeyguardCallback);
    }

    @VisibleForTesting