Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/Pip.java +17 −5 Original line number Diff line number Diff line Loading @@ -43,11 +43,6 @@ public interface Pip { default void expandPip() { } /** * Hides the PIP menu. */ default void hidePipMenu(Runnable onStartCallback, Runnable onEndCallback) {} /** * Called when configuration is changed. */ Loading Loading @@ -124,6 +119,23 @@ public interface Pip { */ default void removePipExclusionBoundsChangeListener(Consumer<Rect> listener) { } /** * Called when the visibility of keyguard is changed. * @param showing {@code true} if keyguard is now showing, {@code false} otherwise. * @param animating {@code true} if system is animating between keyguard and surface behind, * this only makes sense when showing is {@code false}. */ default void onKeyguardVisibilityChanged(boolean showing, boolean animating) { } /** * Called when the dismissing animation keyguard and surfaces behind is finished. * See also {@link #onKeyguardVisibilityChanged(boolean, boolean)}. * * TODO(b/206741900) deprecate this path once we're able to animate the PiP window as part of * keyguard dismiss animation. */ default void onKeyguardDismissAnimationFinished() { } /** * Dump the current state and information if need. * Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +11 −0 Original line number Diff line number Diff line Loading @@ -965,6 +965,17 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, mDeferredAnimEndTransaction = null; } /** Explicitly set the visibility of PiP window. */ public void setPipVisibility(boolean visible) { if (!isInPip()) { return; } final SurfaceControl.Transaction tx = mSurfaceControlTransactionFactory.getTransaction(); mSurfaceTransactionHelper.alpha(tx, mLeash, visible ? 1f : 0f); tx.apply(); } @Override public void onDisplayConfigurationChanged(int displayId, Configuration newConfig) { mCurrentRotation = newConfig.windowConfiguration.getRotation(); Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +44 −8 Original line number Diff line number Diff line Loading @@ -129,6 +129,8 @@ public class PipController implements PipTransitionController.PipTransitionCallb protected PinnedStackListenerForwarder.PinnedTaskListener mPinnedTaskListener = new PipControllerPinnedTaskListener(); private boolean mIsKeyguardShowingOrAnimating; private interface PipAnimationListener { /** * Notifies the listener that the Pip animation is started. Loading Loading @@ -592,6 +594,33 @@ public class PipController implements PipTransitionController.PipTransitionCallb mTouchHandler.showPictureInPictureMenu(); } /** * If {@param keyguardShowing} is {@code false} and {@param animating} is {@code true}, * we would wait till the dismissing animation of keyguard and surfaces behind to be * finished first to reset the visibility of PiP window. * See also {@link #onKeyguardDismissAnimationFinished()} */ private void onKeyguardVisibilityChanged(boolean keyguardShowing, boolean animating) { if (!mPipTaskOrganizer.isInPip()) { return; } if (keyguardShowing) { mIsKeyguardShowingOrAnimating = true; hidePipMenu(null /* onStartCallback */, null /* onEndCallback */); mPipTaskOrganizer.setPipVisibility(false); } else if (!animating) { mIsKeyguardShowingOrAnimating = false; mPipTaskOrganizer.setPipVisibility(true); } } private void onKeyguardDismissAnimationFinished() { if (mPipTaskOrganizer.isInPip()) { mIsKeyguardShowingOrAnimating = false; mPipTaskOrganizer.setPipVisibility(true); } } /** * Sets a customized touch gesture that replaces the default one. */ Loading @@ -603,8 +632,10 @@ public class PipController implements PipTransitionController.PipTransitionCallb * Sets both shelf visibility and its height. */ private void setShelfHeight(boolean visible, int height) { if (!mIsKeyguardShowingOrAnimating) { setShelfHeightLocked(visible, height); } } private void setShelfHeightLocked(boolean visible, int height) { final int shelfHeight = visible ? height : 0; Loading Loading @@ -833,13 +864,6 @@ public class PipController implements PipTransitionController.PipTransitionCallb return mIPip; } @Override public void hidePipMenu(Runnable onStartCallback, Runnable onEndCallback) { mMainExecutor.execute(() -> { PipController.this.hidePipMenu(onStartCallback, onEndCallback); }); } @Override public void expandPip() { mMainExecutor.execute(() -> { Loading Loading @@ -917,6 +941,18 @@ public class PipController implements PipTransitionController.PipTransitionCallb }); } @Override public void onKeyguardVisibilityChanged(boolean showing, boolean animating) { mMainExecutor.execute(() -> { PipController.this.onKeyguardVisibilityChanged(showing, animating); }); } @Override public void onKeyguardDismissAnimationFinished() { mMainExecutor.execute(PipController.this::onKeyguardDismissAnimationFinished); } @Override public void dump(PrintWriter pw) { try { Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +24 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private static final int MSG_KEYGUARD_GOING_AWAY = 342; private static final int MSG_TIME_FORMAT_UPDATE = 344; private static final int MSG_REQUIRE_NFC_UNLOCK = 345; private static final int MSG_KEYGUARD_DISMISS_ANIMATION_FINISHED = 346; /** Biometric authentication state: Not listening. */ private static final int BIOMETRIC_STATE_STOPPED = 0; Loading Loading @@ -2005,6 +2006,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab case MSG_REQUIRE_NFC_UNLOCK: handleRequireUnlockForNfc(); break; case MSG_KEYGUARD_DISMISS_ANIMATION_FINISHED: handleKeyguardDismissAnimationFinished(); break; default: super.handleMessage(msg); break; Loading Loading @@ -3276,6 +3280,19 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab } } /** * Handle {@link #MSG_KEYGUARD_DISMISS_ANIMATION_FINISHED} */ private void handleKeyguardDismissAnimationFinished() { Assert.isMainThread(); for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onKeyguardDismissAnimationFinished(); } } } /** * Handle {@link #MSG_REPORT_EMERGENCY_CALL_ACTION} */ Loading Loading @@ -3614,6 +3631,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mHandler.sendMessage(mHandler.obtainMessage(MSG_KEYGUARD_GOING_AWAY, goingAway)); } /** * Sends a message to notify the keyguard dismiss animation is finished. */ public void dispatchKeyguardDismissAnimationFinished() { mHandler.sendEmptyMessage(MSG_KEYGUARD_DISMISS_ANIMATION_FINISHED); } public boolean isDeviceInteractive() { return mDeviceInteractive; } Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +8 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,14 @@ public class KeyguardUpdateMonitorCallback { */ public void onKeyguardBouncerFullyShowingChanged(boolean bouncerIsFullyShowing) { } /** * Called when the dismissing animation of keyguard and surfaces behind is finished. * If the surface behind is the Launcher, we may still be playing in-window animations * when this is called (since it's only called once we dismiss the keyguard and end the * remote animation). */ public void onKeyguardDismissAnimationFinished() { } /** * Called when visibility of lockscreen clock changes, such as when * obscured by a widget. Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/Pip.java +17 −5 Original line number Diff line number Diff line Loading @@ -43,11 +43,6 @@ public interface Pip { default void expandPip() { } /** * Hides the PIP menu. */ default void hidePipMenu(Runnable onStartCallback, Runnable onEndCallback) {} /** * Called when configuration is changed. */ Loading Loading @@ -124,6 +119,23 @@ public interface Pip { */ default void removePipExclusionBoundsChangeListener(Consumer<Rect> listener) { } /** * Called when the visibility of keyguard is changed. * @param showing {@code true} if keyguard is now showing, {@code false} otherwise. * @param animating {@code true} if system is animating between keyguard and surface behind, * this only makes sense when showing is {@code false}. */ default void onKeyguardVisibilityChanged(boolean showing, boolean animating) { } /** * Called when the dismissing animation keyguard and surfaces behind is finished. * See also {@link #onKeyguardVisibilityChanged(boolean, boolean)}. * * TODO(b/206741900) deprecate this path once we're able to animate the PiP window as part of * keyguard dismiss animation. */ default void onKeyguardDismissAnimationFinished() { } /** * Dump the current state and information if need. * Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +11 −0 Original line number Diff line number Diff line Loading @@ -965,6 +965,17 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, mDeferredAnimEndTransaction = null; } /** Explicitly set the visibility of PiP window. */ public void setPipVisibility(boolean visible) { if (!isInPip()) { return; } final SurfaceControl.Transaction tx = mSurfaceControlTransactionFactory.getTransaction(); mSurfaceTransactionHelper.alpha(tx, mLeash, visible ? 1f : 0f); tx.apply(); } @Override public void onDisplayConfigurationChanged(int displayId, Configuration newConfig) { mCurrentRotation = newConfig.windowConfiguration.getRotation(); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +44 −8 Original line number Diff line number Diff line Loading @@ -129,6 +129,8 @@ public class PipController implements PipTransitionController.PipTransitionCallb protected PinnedStackListenerForwarder.PinnedTaskListener mPinnedTaskListener = new PipControllerPinnedTaskListener(); private boolean mIsKeyguardShowingOrAnimating; private interface PipAnimationListener { /** * Notifies the listener that the Pip animation is started. Loading Loading @@ -592,6 +594,33 @@ public class PipController implements PipTransitionController.PipTransitionCallb mTouchHandler.showPictureInPictureMenu(); } /** * If {@param keyguardShowing} is {@code false} and {@param animating} is {@code true}, * we would wait till the dismissing animation of keyguard and surfaces behind to be * finished first to reset the visibility of PiP window. * See also {@link #onKeyguardDismissAnimationFinished()} */ private void onKeyguardVisibilityChanged(boolean keyguardShowing, boolean animating) { if (!mPipTaskOrganizer.isInPip()) { return; } if (keyguardShowing) { mIsKeyguardShowingOrAnimating = true; hidePipMenu(null /* onStartCallback */, null /* onEndCallback */); mPipTaskOrganizer.setPipVisibility(false); } else if (!animating) { mIsKeyguardShowingOrAnimating = false; mPipTaskOrganizer.setPipVisibility(true); } } private void onKeyguardDismissAnimationFinished() { if (mPipTaskOrganizer.isInPip()) { mIsKeyguardShowingOrAnimating = false; mPipTaskOrganizer.setPipVisibility(true); } } /** * Sets a customized touch gesture that replaces the default one. */ Loading @@ -603,8 +632,10 @@ public class PipController implements PipTransitionController.PipTransitionCallb * Sets both shelf visibility and its height. */ private void setShelfHeight(boolean visible, int height) { if (!mIsKeyguardShowingOrAnimating) { setShelfHeightLocked(visible, height); } } private void setShelfHeightLocked(boolean visible, int height) { final int shelfHeight = visible ? height : 0; Loading Loading @@ -833,13 +864,6 @@ public class PipController implements PipTransitionController.PipTransitionCallb return mIPip; } @Override public void hidePipMenu(Runnable onStartCallback, Runnable onEndCallback) { mMainExecutor.execute(() -> { PipController.this.hidePipMenu(onStartCallback, onEndCallback); }); } @Override public void expandPip() { mMainExecutor.execute(() -> { Loading Loading @@ -917,6 +941,18 @@ public class PipController implements PipTransitionController.PipTransitionCallb }); } @Override public void onKeyguardVisibilityChanged(boolean showing, boolean animating) { mMainExecutor.execute(() -> { PipController.this.onKeyguardVisibilityChanged(showing, animating); }); } @Override public void onKeyguardDismissAnimationFinished() { mMainExecutor.execute(PipController.this::onKeyguardDismissAnimationFinished); } @Override public void dump(PrintWriter pw) { try { Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +24 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private static final int MSG_KEYGUARD_GOING_AWAY = 342; private static final int MSG_TIME_FORMAT_UPDATE = 344; private static final int MSG_REQUIRE_NFC_UNLOCK = 345; private static final int MSG_KEYGUARD_DISMISS_ANIMATION_FINISHED = 346; /** Biometric authentication state: Not listening. */ private static final int BIOMETRIC_STATE_STOPPED = 0; Loading Loading @@ -2005,6 +2006,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab case MSG_REQUIRE_NFC_UNLOCK: handleRequireUnlockForNfc(); break; case MSG_KEYGUARD_DISMISS_ANIMATION_FINISHED: handleKeyguardDismissAnimationFinished(); break; default: super.handleMessage(msg); break; Loading Loading @@ -3276,6 +3280,19 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab } } /** * Handle {@link #MSG_KEYGUARD_DISMISS_ANIMATION_FINISHED} */ private void handleKeyguardDismissAnimationFinished() { Assert.isMainThread(); for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onKeyguardDismissAnimationFinished(); } } } /** * Handle {@link #MSG_REPORT_EMERGENCY_CALL_ACTION} */ Loading Loading @@ -3614,6 +3631,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mHandler.sendMessage(mHandler.obtainMessage(MSG_KEYGUARD_GOING_AWAY, goingAway)); } /** * Sends a message to notify the keyguard dismiss animation is finished. */ public void dispatchKeyguardDismissAnimationFinished() { mHandler.sendEmptyMessage(MSG_KEYGUARD_DISMISS_ANIMATION_FINISHED); } public boolean isDeviceInteractive() { return mDeviceInteractive; } Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +8 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,14 @@ public class KeyguardUpdateMonitorCallback { */ public void onKeyguardBouncerFullyShowingChanged(boolean bouncerIsFullyShowing) { } /** * Called when the dismissing animation of keyguard and surfaces behind is finished. * If the surface behind is the Launcher, we may still be playing in-window animations * when this is called (since it's only called once we dismiss the keyguard and end the * remote animation). */ public void onKeyguardDismissAnimationFinished() { } /** * Called when visibility of lockscreen clock changes, such as when * obscured by a widget. Loading