Merge "Wait OCCLUDE transition until screen turning on activity becomes ready." into sc-dev

This commit is contained in:
Issei Suzuki
2021-04-14 10:00:02 +00:00
committed by Android (Google) Code Review
8 changed files with 37 additions and 14 deletions

View File

@@ -4492,8 +4492,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
} }
@Override @Override
public boolean okToAnimate() { public boolean okToAnimate(boolean ignoreScreenOn) {
return mDefaultDisplayPolicy.isAwake() && !mDeviceGoingToSleep; return (ignoreScreenOn || mDefaultDisplayPolicy.isAwake()) && !mDeviceGoingToSleep;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */

View File

@@ -897,12 +897,13 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
public boolean isScreenOn(); public boolean isScreenOn();
/** /**
* @param ignoreScreenOn {@code true} if screen state should be ignored.
* @return whether the device is currently allowed to animate. * @return whether the device is currently allowed to animate.
* *
* Note: this can be true even if it is not appropriate to animate for reasons that are outside * Note: this can be true even if it is not appropriate to animate for reasons that are outside
* of the policy's authority. * of the policy's authority.
*/ */
boolean okToAnimate(); boolean okToAnimate(boolean ignoreScreenOn);
/** /**
* Tell the policy that the lid switch has changed state. * Tell the policy that the lid switch has changed state.

View File

@@ -4655,7 +4655,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
// still check DC#okToAnimate again if the transition animation is fine to apply. // still check DC#okToAnimate again if the transition animation is fine to apply.
// TODO(new-app-transition): Rewrite this logic using WM Shell. // TODO(new-app-transition): Rewrite this logic using WM Shell.
final boolean recentsAnimating = isAnimating(PARENTS, ANIMATION_TYPE_RECENTS); final boolean recentsAnimating = isAnimating(PARENTS, ANIMATION_TYPE_RECENTS);
if (okToAnimate(true /* ignoreFrozen */) && (appTransition.isTransitionSet() if (okToAnimate(true /* ignoreFrozen */, canTurnScreenOn())
&& (appTransition.isTransitionSet()
|| (recentsAnimating && !isActivityTypeHome()))) { || (recentsAnimating && !isActivityTypeHome()))) {
if (visible) { if (visible) {
displayContent.mOpeningApps.add(this); displayContent.mOpeningApps.add(this);

View File

@@ -4436,9 +4436,14 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
} }
boolean okToDisplay(boolean ignoreFrozen) { boolean okToDisplay(boolean ignoreFrozen) {
return okToDisplay(ignoreFrozen, false /* ignoreScreenOn */);
}
boolean okToDisplay(boolean ignoreFrozen, boolean ignoreScreenOn) {
if (mDisplayId == DEFAULT_DISPLAY) { if (mDisplayId == DEFAULT_DISPLAY) {
return (!mWmService.mDisplayFrozen || ignoreFrozen) return (!mWmService.mDisplayFrozen || ignoreFrozen)
&& mWmService.mDisplayEnabled && mWmService.mPolicy.isScreenOn(); && mWmService.mDisplayEnabled
&& (ignoreScreenOn || mWmService.mPolicy.isScreenOn());
} }
return mDisplayInfo.state == Display.STATE_ON; return mDisplayInfo.state == Display.STATE_ON;
} }
@@ -4448,8 +4453,13 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
} }
boolean okToAnimate(boolean ignoreFrozen) { boolean okToAnimate(boolean ignoreFrozen) {
return okToDisplay(ignoreFrozen) && return okToAnimate(ignoreFrozen, false /* ignoreScreenOn */);
(mDisplayId != DEFAULT_DISPLAY || mWmService.mPolicy.okToAnimate()); }
boolean okToAnimate(boolean ignoreFrozen, boolean ignoreScreenOn) {
return okToDisplay(ignoreFrozen, ignoreScreenOn)
&& (mDisplayId != DEFAULT_DISPLAY
|| mWmService.mPolicy.okToAnimate(ignoreScreenOn));
} }
static final class TaskForResizePointSearchResult { static final class TaskForResizePointSearchResult {

View File

@@ -731,7 +731,7 @@ public class DisplayRotation {
private RotationAnimationPair selectRotationAnimation() { private RotationAnimationPair selectRotationAnimation() {
// If the screen is off or non-interactive, force a jumpcut. // If the screen is off or non-interactive, force a jumpcut.
final boolean forceJumpcut = !mDisplayPolicy.isScreenOnFully() final boolean forceJumpcut = !mDisplayPolicy.isScreenOnFully()
|| !mService.mPolicy.okToAnimate(); || !mService.mPolicy.okToAnimate(false /* ignoreScreenOn */);
final WindowState topFullscreen = mDisplayPolicy.getTopFullscreenOpaqueWindow(); final WindowState topFullscreen = mDisplayPolicy.getTopFullscreenOpaqueWindow();
if (DEBUG_ANIM) Slog.i(TAG, "selectRotationAnimation topFullscreen=" if (DEBUG_ANIM) Slog.i(TAG, "selectRotationAnimation topFullscreen="
+ topFullscreen + " rotationAnimation=" + topFullscreen + " rotationAnimation="

View File

@@ -341,11 +341,10 @@ class KeyguardController {
/** /**
* Called when occluded state changed. * Called when occluded state changed.
* *
* @param currentTaskControllingOcclusion the task that controls the state whether keyguard * @param topActivity the activity that controls the state whether keyguard should
* should be occluded. That is the task to be shown on top of keyguard if it requests so. * be occluded. That is the activity to be shown on top of keyguard if it requests so.
*/ */
private void handleOccludedChanged( private void handleOccludedChanged(int displayId, @Nullable ActivityRecord topActivity) {
int displayId, @Nullable Task currentTaskControllingOcclusion) {
// TODO(b/113840485): Handle app transition for individual display, and apply occluded // TODO(b/113840485): Handle app transition for individual display, and apply occluded
// state change to secondary displays. // state change to secondary displays.
// For now, only default display fully supports occluded change. Other displays only // For now, only default display fully supports occluded change. Other displays only
@@ -364,6 +363,13 @@ class KeyguardController {
isDisplayOccluded(DEFAULT_DISPLAY) isDisplayOccluded(DEFAULT_DISPLAY)
? TRANSIT_KEYGUARD_OCCLUDE ? TRANSIT_KEYGUARD_OCCLUDE
: TRANSIT_KEYGUARD_UNOCCLUDE); : TRANSIT_KEYGUARD_UNOCCLUDE);
// When the occluding activity also turns on the display, visibility of the activity
// can be committed before KEYGUARD_OCCLUDE transition is handled.
// Set mRequestForceTransition flag to make sure that the app transition animation
// is applied for such case.
if (topActivity != null) {
topActivity.mRequestForceTransition = true;
}
updateKeyguardSleepToken(DEFAULT_DISPLAY); updateKeyguardSleepToken(DEFAULT_DISPLAY);
mWindowManager.executeAppTransition(); mWindowManager.executeAppTransition();
} finally { } finally {
@@ -580,7 +586,7 @@ class KeyguardController {
if (lastOccluded != mOccluded) { if (lastOccluded != mOccluded) {
occludingChange = true; occludingChange = true;
controller.handleOccludedChanged(mDisplayId, task); controller.handleOccludedChanged(mDisplayId, mTopOccludesActivity);
} }
if (occludingChange || turningScreenOn) { if (occludingChange || turningScreenOn) {

View File

@@ -2796,6 +2796,11 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
return dc != null && dc.okToAnimate(ignoreFrozen); return dc != null && dc.okToAnimate(ignoreFrozen);
} }
boolean okToAnimate(boolean ignoreFrozen, boolean ignoreScreenOn) {
final DisplayContent dc = getDisplayContent();
return dc != null && dc.okToAnimate(ignoreFrozen, ignoreScreenOn);
}
@Override @Override
public void commitPendingTransaction() { public void commitPendingTransaction() {
scheduleAnimation(); scheduleAnimation();

View File

@@ -210,7 +210,7 @@ class TestWindowManagerPolicy implements WindowManagerPolicy {
} }
@Override @Override
public boolean okToAnimate() { public boolean okToAnimate(boolean ignoreScreenOn) {
return mOkToAnimate; return mOkToAnimate;
} }