Merge "Fix the blank PiP window when unlock" into tm-dev am: 6e08678675
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18203211 Change-Id: I3956dfa05ffc8d00d5e1f854e289324c32ff98fa Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -43,11 +43,6 @@ public interface Pip {
|
|||||||
default void expandPip() {
|
default void expandPip() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hides the PIP menu.
|
|
||||||
*/
|
|
||||||
default void hidePipMenu(Runnable onStartCallback, Runnable onEndCallback) {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when configuration is changed.
|
* Called when configuration is changed.
|
||||||
*/
|
*/
|
||||||
@@ -124,6 +119,23 @@ public interface Pip {
|
|||||||
*/
|
*/
|
||||||
default void removePipExclusionBoundsChangeListener(Consumer<Rect> listener) { }
|
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.
|
* Dump the current state and information if need.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -965,6 +965,17 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
|
|||||||
mDeferredAnimEndTransaction = null;
|
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
|
@Override
|
||||||
public void onDisplayConfigurationChanged(int displayId, Configuration newConfig) {
|
public void onDisplayConfigurationChanged(int displayId, Configuration newConfig) {
|
||||||
mCurrentRotation = newConfig.windowConfiguration.getRotation();
|
mCurrentRotation = newConfig.windowConfiguration.getRotation();
|
||||||
|
|||||||
@@ -129,6 +129,8 @@ public class PipController implements PipTransitionController.PipTransitionCallb
|
|||||||
protected PinnedStackListenerForwarder.PinnedTaskListener mPinnedTaskListener =
|
protected PinnedStackListenerForwarder.PinnedTaskListener mPinnedTaskListener =
|
||||||
new PipControllerPinnedTaskListener();
|
new PipControllerPinnedTaskListener();
|
||||||
|
|
||||||
|
private boolean mIsKeyguardShowingOrAnimating;
|
||||||
|
|
||||||
private interface PipAnimationListener {
|
private interface PipAnimationListener {
|
||||||
/**
|
/**
|
||||||
* Notifies the listener that the Pip animation is started.
|
* Notifies the listener that the Pip animation is started.
|
||||||
@@ -592,6 +594,33 @@ public class PipController implements PipTransitionController.PipTransitionCallb
|
|||||||
mTouchHandler.showPictureInPictureMenu();
|
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.
|
* Sets a customized touch gesture that replaces the default one.
|
||||||
*/
|
*/
|
||||||
@@ -603,7 +632,9 @@ public class PipController implements PipTransitionController.PipTransitionCallb
|
|||||||
* Sets both shelf visibility and its height.
|
* Sets both shelf visibility and its height.
|
||||||
*/
|
*/
|
||||||
private void setShelfHeight(boolean visible, int height) {
|
private void setShelfHeight(boolean visible, int height) {
|
||||||
setShelfHeightLocked(visible, height);
|
if (!mIsKeyguardShowingOrAnimating) {
|
||||||
|
setShelfHeightLocked(visible, height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setShelfHeightLocked(boolean visible, int height) {
|
private void setShelfHeightLocked(boolean visible, int height) {
|
||||||
@@ -833,13 +864,6 @@ public class PipController implements PipTransitionController.PipTransitionCallb
|
|||||||
return mIPip;
|
return mIPip;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void hidePipMenu(Runnable onStartCallback, Runnable onEndCallback) {
|
|
||||||
mMainExecutor.execute(() -> {
|
|
||||||
PipController.this.hidePipMenu(onStartCallback, onEndCallback);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void expandPip() {
|
public void expandPip() {
|
||||||
mMainExecutor.execute(() -> {
|
mMainExecutor.execute(() -> {
|
||||||
@@ -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
|
@Override
|
||||||
public void dump(PrintWriter pw) {
|
public void dump(PrintWriter pw) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -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_KEYGUARD_GOING_AWAY = 342;
|
||||||
private static final int MSG_TIME_FORMAT_UPDATE = 344;
|
private static final int MSG_TIME_FORMAT_UPDATE = 344;
|
||||||
private static final int MSG_REQUIRE_NFC_UNLOCK = 345;
|
private static final int MSG_REQUIRE_NFC_UNLOCK = 345;
|
||||||
|
private static final int MSG_KEYGUARD_DISMISS_ANIMATION_FINISHED = 346;
|
||||||
|
|
||||||
/** Biometric authentication state: Not listening. */
|
/** Biometric authentication state: Not listening. */
|
||||||
private static final int BIOMETRIC_STATE_STOPPED = 0;
|
private static final int BIOMETRIC_STATE_STOPPED = 0;
|
||||||
@@ -2025,6 +2026,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
case MSG_REQUIRE_NFC_UNLOCK:
|
case MSG_REQUIRE_NFC_UNLOCK:
|
||||||
handleRequireUnlockForNfc();
|
handleRequireUnlockForNfc();
|
||||||
break;
|
break;
|
||||||
|
case MSG_KEYGUARD_DISMISS_ANIMATION_FINISHED:
|
||||||
|
handleKeyguardDismissAnimationFinished();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
super.handleMessage(msg);
|
super.handleMessage(msg);
|
||||||
break;
|
break;
|
||||||
@@ -3296,6 +3300,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}
|
* Handle {@link #MSG_REPORT_EMERGENCY_CALL_ACTION}
|
||||||
*/
|
*/
|
||||||
@@ -3634,6 +3651,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
mHandler.sendMessage(mHandler.obtainMessage(MSG_KEYGUARD_GOING_AWAY, goingAway));
|
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() {
|
public boolean isDeviceInteractive() {
|
||||||
return mDeviceInteractive;
|
return mDeviceInteractive;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,6 +108,14 @@ public class KeyguardUpdateMonitorCallback {
|
|||||||
*/
|
*/
|
||||||
public void onKeyguardBouncerFullyShowingChanged(boolean bouncerIsFullyShowing) { }
|
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
|
* Called when visibility of lockscreen clock changes, such as when
|
||||||
* obscured by a widget.
|
* obscured by a widget.
|
||||||
|
|||||||
@@ -856,6 +856,13 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
|||||||
return KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation
|
return KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the RemoteAnimation on the app/launcher surface behind the keyguard is 'running'.
|
||||||
|
*/
|
||||||
|
fun isAnimatingBetweenKeyguardAndSurfaceBehind(): Boolean {
|
||||||
|
return keyguardViewMediator.get().isAnimatingBetweenKeyguardAndSurfaceBehind
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether we are playing a canned unlock animation, vs. unlocking from a touch gesture such as
|
* Whether we are playing a canned unlock animation, vs. unlocking from a touch gesture such as
|
||||||
* a swipe.
|
* a swipe.
|
||||||
|
|||||||
@@ -2625,6 +2625,9 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
|
|||||||
|
|
||||||
// The remote animation is over, so we're not going away anymore.
|
// The remote animation is over, so we're not going away anymore.
|
||||||
mKeyguardStateController.notifyKeyguardGoingAway(false);
|
mKeyguardStateController.notifyKeyguardGoingAway(false);
|
||||||
|
|
||||||
|
// Dispatch the callback on animation finishes.
|
||||||
|
mUpdateMonitor.dispatchKeyguardDismissAnimationFinished();
|
||||||
});
|
});
|
||||||
|
|
||||||
mKeyguardUnlockAnimationControllerLazy.get().notifyFinishedKeyguardExitAnimation(
|
mKeyguardUnlockAnimationControllerLazy.get().notifyFinishedKeyguardExitAnimation(
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.policy;
|
|||||||
|
|
||||||
import android.app.IActivityTaskManager;
|
import android.app.IActivityTaskManager;
|
||||||
|
|
||||||
|
import com.android.systemui.keyguard.KeyguardViewMediator;
|
||||||
import com.android.systemui.statusbar.StatusBarState;
|
import com.android.systemui.statusbar.StatusBarState;
|
||||||
import com.android.systemui.statusbar.policy.KeyguardStateController.Callback;
|
import com.android.systemui.statusbar.policy.KeyguardStateController.Callback;
|
||||||
|
|
||||||
@@ -93,6 +94,15 @@ public interface KeyguardStateController extends CallbackController<Callback> {
|
|||||||
*/
|
*/
|
||||||
boolean isKeyguardGoingAway();
|
boolean isKeyguardGoingAway();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether we're currently animating between the keyguard and the app/launcher surface behind
|
||||||
|
* it, or will be shortly (which happens if we started a fling to dismiss the keyguard).
|
||||||
|
* @see {@link KeyguardViewMediator#isAnimatingBetweenKeyguardAndSurfaceBehind()}
|
||||||
|
*/
|
||||||
|
default boolean isAnimatingBetweenKeyguardAndSurfaceBehind() {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a shortened fading away duration similar to
|
* @return a shortened fading away duration similar to
|
||||||
* {{@link #getKeyguardFadingAwayDuration()}} which may only span half of the duration, unless
|
* {{@link #getKeyguardFadingAwayDuration()}} which may only span half of the duration, unless
|
||||||
|
|||||||
@@ -278,6 +278,11 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
|
|||||||
return mKeyguardGoingAway;
|
return mKeyguardGoingAway;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAnimatingBetweenKeyguardAndSurfaceBehind() {
|
||||||
|
return mUnlockAnimationControllerLazy.get().isAnimatingBetweenKeyguardAndSurfaceBehind();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBypassFadingAnimation() {
|
public boolean isBypassFadingAnimation() {
|
||||||
return mBypassFadingAnimation;
|
return mBypassFadingAnimation;
|
||||||
|
|||||||
@@ -200,9 +200,13 @@ public final class WMShell extends CoreStartable
|
|||||||
mPipKeyguardCallback = new KeyguardUpdateMonitorCallback() {
|
mPipKeyguardCallback = new KeyguardUpdateMonitorCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||||
if (showing) {
|
pip.onKeyguardVisibilityChanged(showing,
|
||||||
pip.hidePipMenu(null, null);
|
mKeyguardStateController.isAnimatingBetweenKeyguardAndSurfaceBehind());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onKeyguardDismissAnimationFinished() {
|
||||||
|
pip.onKeyguardDismissAnimationFinished();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mKeyguardUpdateMonitor.registerCallback(mPipKeyguardCallback);
|
mKeyguardUpdateMonitor.registerCallback(mPipKeyguardCallback);
|
||||||
|
|||||||
Reference in New Issue
Block a user