Merge "Invoke keyguard going away when it is collecting for wake" into sc-v2-dev

This commit is contained in:
Chris Li
2021-08-12 18:32:53 +00:00
committed by Android (Google) Code Review
11 changed files with 123 additions and 28 deletions

View File

@@ -381,8 +381,11 @@ public interface WindowManager extends ViewManager {
int TRANSIT_CHANGE = 6; int TRANSIT_CHANGE = 6;
/** /**
* The keyguard was visible and has been dismissed. * The keyguard was visible and has been dismissed.
* @deprecated use {@link #TRANSIT_TO_BACK} + {@link #TRANSIT_FLAG_KEYGUARD_GOING_AWAY} for
* keyguard going away with Shell transition.
* @hide * @hide
*/ */
@Deprecated
int TRANSIT_KEYGUARD_GOING_AWAY = 7; int TRANSIT_KEYGUARD_GOING_AWAY = 7;
/** /**
* A window is appearing above a locked keyguard. * A window is appearing above a locked keyguard.
@@ -486,6 +489,12 @@ public interface WindowManager extends ViewManager {
*/ */
int TRANSIT_FLAG_IS_RECENTS = 0x80; int TRANSIT_FLAG_IS_RECENTS = 0x80;
/**
* Transition flag: Indicates that keyguard should go away with this transition.
* @hide
*/
int TRANSIT_FLAG_KEYGUARD_GOING_AWAY = 0x100;
/** /**
* @hide * @hide
*/ */
@@ -497,7 +506,8 @@ public interface WindowManager extends ViewManager {
TRANSIT_FLAG_APP_CRASHED, TRANSIT_FLAG_APP_CRASHED,
TRANSIT_FLAG_OPEN_BEHIND, TRANSIT_FLAG_OPEN_BEHIND,
TRANSIT_FLAG_KEYGUARD_LOCKED, TRANSIT_FLAG_KEYGUARD_LOCKED,
TRANSIT_FLAG_IS_RECENTS TRANSIT_FLAG_IS_RECENTS,
TRANSIT_FLAG_KEYGUARD_GOING_AWAY
}) })
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@interface TransitionFlags {} @interface TransitionFlags {}

View File

@@ -59,6 +59,9 @@ public final class TransitionFilter implements Parcelable {
/** All flags must be set on a transition. */ /** All flags must be set on a transition. */
public @WindowManager.TransitionFlags int mFlags = 0; public @WindowManager.TransitionFlags int mFlags = 0;
/** All flags must NOT be set on a transition. */
public @WindowManager.TransitionFlags int mNotFlags = 0;
/** /**
* A list of required changes. To pass, a transition must meet all requirements. * A list of required changes. To pass, a transition must meet all requirements.
*/ */
@@ -70,6 +73,7 @@ public final class TransitionFilter implements Parcelable {
private TransitionFilter(Parcel in) { private TransitionFilter(Parcel in) {
mTypeSet = in.createIntArray(); mTypeSet = in.createIntArray();
mFlags = in.readInt(); mFlags = in.readInt();
mNotFlags = in.readInt();
mRequirements = in.createTypedArray(Requirement.CREATOR); mRequirements = in.createTypedArray(Requirement.CREATOR);
} }
@@ -89,6 +93,9 @@ public final class TransitionFilter implements Parcelable {
if ((info.getFlags() & mFlags) != mFlags) { if ((info.getFlags() & mFlags) != mFlags) {
return false; return false;
} }
if ((info.getFlags() & mNotFlags) != 0) {
return false;
}
// Make sure info meets all of the requirements. // Make sure info meets all of the requirements.
if (mRequirements != null) { if (mRequirements != null) {
for (int i = 0; i < mRequirements.length; ++i) { for (int i = 0; i < mRequirements.length; ++i) {
@@ -106,6 +113,7 @@ public final class TransitionFilter implements Parcelable {
public void writeToParcel(@NonNull Parcel dest, int flags) { public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeIntArray(mTypeSet); dest.writeIntArray(mTypeSet);
dest.writeInt(mFlags); dest.writeInt(mFlags);
dest.writeInt(mNotFlags);
dest.writeTypedArray(mRequirements, flags); dest.writeTypedArray(mRequirements, flags);
} }
@@ -139,6 +147,7 @@ public final class TransitionFilter implements Parcelable {
} }
} }
sb.append("] flags=0x" + Integer.toHexString(mFlags)); sb.append("] flags=0x" + Integer.toHexString(mFlags));
sb.append("] notFlags=0x" + Integer.toHexString(mNotFlags));
sb.append(" checks=["); sb.append(" checks=[");
if (mRequirements != null) { if (mRequirements != null) {
for (int i = 0; i < mRequirements.length; ++i) { for (int i = 0; i < mRequirements.length; ++i) {

View File

@@ -26,6 +26,7 @@ import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED; import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED;
import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_NONE; import static android.view.WindowManager.TRANSIT_NONE;
import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_BACK;
@@ -249,6 +250,13 @@ public final class TransitionInfo implements Parcelable {
mChanges.add(change); mChanges.add(change);
} }
/**
* Whether this transition includes keyguard going away.
*/
public boolean isKeyguardGoingAway() {
return (mFlags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY) != 0;
}
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -29,7 +29,6 @@ import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLES
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED; import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED;
import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE; import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;
import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_RELAUNCH; import static android.view.WindowManager.TRANSIT_RELAUNCH;
@@ -249,10 +248,9 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
@NonNull Transitions.TransitionFinishCallback finishCallback) { @NonNull Transitions.TransitionFinishCallback finishCallback) {
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS,
"start default transition animation, info = %s", info); "start default transition animation, info = %s", info);
// If keyguard goes away, we should loadKeyguardExitAnimation. Otherwise this just
// Fallback for screen wake. This just immediately finishes since there is no // immediately finishes since there is no animation for screen-wake.
// animation for screen-wake. if (info.getType() == WindowManager.TRANSIT_WAKE && !info.isKeyguardGoingAway()) {
if (info.getType() == WindowManager.TRANSIT_WAKE) {
startTransaction.apply(); startTransaction.apply();
finishCallback.onTransitionFinished(null /* wct */, null /* wctCB */); finishCallback.onTransitionFinished(null /* wct */, null /* wctCB */);
return true; return true;
@@ -354,7 +352,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
final int overrideType = options != null ? options.getType() : ANIM_NONE; final int overrideType = options != null ? options.getType() : ANIM_NONE;
final boolean canCustomContainer = isTask ? !sDisableCustomTaskAnimationProperty : true; final boolean canCustomContainer = isTask ? !sDisableCustomTaskAnimationProperty : true;
if (type == TRANSIT_KEYGUARD_GOING_AWAY) { if (info.isKeyguardGoingAway()) {
a = mTransitionAnimation.loadKeyguardExitAnimation(flags, a = mTransitionAnimation.loadKeyguardExitAnimation(flags,
(changeFlags & FLAG_SHOW_WALLPAPER) != 0); (changeFlags & FLAG_SHOW_WALLPAPER) != 0);
} else if (type == TRANSIT_KEYGUARD_UNOCCLUDE) { } else if (type == TRANSIT_KEYGUARD_UNOCCLUDE) {

View File

@@ -19,6 +19,7 @@ package com.android.wm.shell.transition;
import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FIRST_CUSTOM; import static android.view.WindowManager.TRANSIT_FIRST_CUSTOM;
import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.view.WindowManager.TRANSIT_TO_FRONT;
@@ -230,7 +231,7 @@ public class Transitions implements RemoteCallable<Transitions> {
public static boolean isOpeningType(@WindowManager.TransitionType int type) { public static boolean isOpeningType(@WindowManager.TransitionType int type) {
return type == TRANSIT_OPEN return type == TRANSIT_OPEN
|| type == TRANSIT_TO_FRONT || type == TRANSIT_TO_FRONT
|| type == WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; || type == TRANSIT_KEYGUARD_GOING_AWAY;
} }
/** @return true if the transition was triggered by closing something vs opening something */ /** @return true if the transition was triggered by closing something vs opening something */

View File

@@ -27,6 +27,7 @@ import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECI
import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FIRST_CUSTOM; import static android.view.WindowManager.TRANSIT_FIRST_CUSTOM;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.view.WindowManager.TRANSIT_TO_FRONT;
@@ -89,6 +90,9 @@ import java.util.ArrayList;
/** /**
* Tests for the shell transitions. * Tests for the shell transitions.
*
* Build/Install/Run:
* atest WMShellUnitTests:ShellTransitionTests
*/ */
@SmallTest @SmallTest
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
@@ -304,6 +308,54 @@ public class ShellTransitionTests {
assertFalse(filter.matches(openAndTranslucent)); assertFalse(filter.matches(openAndTranslucent));
} }
@Test
public void testTransitionFilterChecksTypeSet() {
TransitionFilter filter = new TransitionFilter();
filter.mTypeSet = new int[]{TRANSIT_OPEN, TRANSIT_TO_FRONT};
final TransitionInfo openOnly = new TransitionInfoBuilder(TRANSIT_OPEN)
.addChange(TRANSIT_OPEN).build();
assertTrue(filter.matches(openOnly));
final TransitionInfo toFrontOnly = new TransitionInfoBuilder(TRANSIT_TO_FRONT)
.addChange(TRANSIT_TO_FRONT).build();
assertTrue(filter.matches(toFrontOnly));
final TransitionInfo closeOnly = new TransitionInfoBuilder(TRANSIT_CLOSE)
.addChange(TRANSIT_CLOSE).build();
assertFalse(filter.matches(closeOnly));
}
@Test
public void testTransitionFilterChecksFlags() {
TransitionFilter filter = new TransitionFilter();
filter.mFlags = TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
final TransitionInfo withFlag = new TransitionInfoBuilder(TRANSIT_TO_BACK,
TRANSIT_FLAG_KEYGUARD_GOING_AWAY)
.addChange(TRANSIT_TO_BACK).build();
assertTrue(filter.matches(withFlag));
final TransitionInfo withoutFlag = new TransitionInfoBuilder(TRANSIT_OPEN)
.addChange(TRANSIT_OPEN).build();
assertFalse(filter.matches(withoutFlag));
}
@Test
public void testTransitionFilterChecksNotFlags() {
TransitionFilter filter = new TransitionFilter();
filter.mNotFlags = TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
final TransitionInfo withFlag = new TransitionInfoBuilder(TRANSIT_TO_BACK,
TRANSIT_FLAG_KEYGUARD_GOING_AWAY)
.addChange(TRANSIT_TO_BACK).build();
assertFalse(filter.matches(withFlag));
final TransitionInfo withoutFlag = new TransitionInfoBuilder(TRANSIT_OPEN)
.addChange(TRANSIT_OPEN).build();
assertTrue(filter.matches(withoutFlag));
}
@Test @Test
public void testRegisteredRemoteTransition() { public void testRegisteredRemoteTransition() {
Transitions transitions = createTestTransitions(); Transitions transitions = createTestTransitions();
@@ -534,7 +586,12 @@ public class ShellTransitionTests {
final TransitionInfo mInfo; final TransitionInfo mInfo;
TransitionInfoBuilder(@WindowManager.TransitionType int type) { TransitionInfoBuilder(@WindowManager.TransitionType int type) {
mInfo = new TransitionInfo(type, 0 /* flags */); this(type, 0 /* flags */);
}
TransitionInfoBuilder(@WindowManager.TransitionType int type,
@WindowManager.TransitionFlags int flags) {
mInfo = new TransitionInfo(type, flags);
mInfo.setRootLeash(createMockSurface(true /* valid */), 0, 0); mInfo.setRootLeash(createMockSurface(true /* valid */), 0, 0);
} }

View File

@@ -19,6 +19,7 @@ package com.android.systemui.shared.system;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.view.WindowManager.TRANSIT_TO_FRONT;
@@ -172,6 +173,8 @@ public class RemoteTransitionCompat implements Parcelable {
if (mFilter == null) { if (mFilter == null) {
mFilter = new TransitionFilter(); mFilter = new TransitionFilter();
} }
// No need to handle the transition that also dismisses keyguard.
mFilter.mNotFlags = TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
mFilter.mRequirements = mFilter.mRequirements =
new TransitionFilter.Requirement[]{new TransitionFilter.Requirement(), new TransitionFilter.Requirement[]{new TransitionFilter.Requirement(),
new TransitionFilter.Requirement()}; new TransitionFilter.Requirement()};

View File

@@ -21,6 +21,7 @@ import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.RemoteAnimationTarget.MODE_CLOSING; import static android.view.RemoteAnimationTarget.MODE_CLOSING;
import static android.view.RemoteAnimationTarget.MODE_OPENING; import static android.view.RemoteAnimationTarget.MODE_OPENING;
import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_LOCKED; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_LOCKED;
import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE; import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE;
@@ -33,6 +34,7 @@ import static android.view.WindowManager.TRANSIT_OLD_NONE;
import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.view.WindowManager.TRANSIT_TO_FRONT;
import static android.view.WindowManager.TransitionFlags;
import static android.view.WindowManager.TransitionOldType; import static android.view.WindowManager.TransitionOldType;
import static android.view.WindowManager.TransitionType; import static android.view.WindowManager.TransitionType;
import static android.window.TransitionInfo.FLAG_OCCLUDES_KEYGUARD; import static android.window.TransitionInfo.FLAG_OCCLUDES_KEYGUARD;
@@ -170,8 +172,9 @@ public class KeyguardService extends Service {
} }
private static @TransitionOldType int getTransitionOldType(@TransitionType int type, private static @TransitionOldType int getTransitionOldType(@TransitionType int type,
RemoteAnimationTarget[] apps) { @TransitionFlags int flags, RemoteAnimationTarget[] apps) {
if (type == TRANSIT_KEYGUARD_GOING_AWAY) { if (type == TRANSIT_KEYGUARD_GOING_AWAY
|| (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY) != 0) {
return apps.length == 0 ? TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER return apps.length == 0 ? TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER
: TRANSIT_OLD_KEYGUARD_GOING_AWAY; : TRANSIT_OLD_KEYGUARD_GOING_AWAY;
} else if (type == TRANSIT_KEYGUARD_OCCLUDE) { } else if (type == TRANSIT_KEYGUARD_OCCLUDE) {
@@ -200,7 +203,7 @@ public class KeyguardService extends Service {
t.setAlpha(change.getLeash(), 1.0f); t.setAlpha(change.getLeash(), 1.0f);
} }
t.apply(); t.apply();
runner.onAnimationStart(getTransitionOldType(info.getType(), apps), runner.onAnimationStart(getTransitionOldType(info.getType(), info.getFlags(), apps),
apps, wallpapers, nonApps, apps, wallpapers, nonApps,
new IRemoteAnimationFinishedCallback.Stub() { new IRemoteAnimationFinishedCallback.Stub() {
@Override @Override
@@ -232,7 +235,7 @@ public class KeyguardService extends Service {
if (sEnableRemoteKeyguardGoingAwayAnimation) { if (sEnableRemoteKeyguardGoingAwayAnimation) {
Slog.d(TAG, "KeyguardService registerRemote: TRANSIT_KEYGUARD_GOING_AWAY"); Slog.d(TAG, "KeyguardService registerRemote: TRANSIT_KEYGUARD_GOING_AWAY");
TransitionFilter f = new TransitionFilter(); TransitionFilter f = new TransitionFilter();
f.mTypeSet = new int[]{TRANSIT_KEYGUARD_GOING_AWAY}; f.mFlags = TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
shellTransitions.registerRemote(f, wrap(mExitAnimationRunner)); shellTransitions.registerRemote(f, wrap(mExitAnimationRunner));
} }
if (sEnableRemoteKeyguardOccludeAnimation) { if (sEnableRemoteKeyguardOccludeAnimation) {

View File

@@ -20,6 +20,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE;
@@ -27,6 +28,7 @@ import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_W
import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE; import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE;
import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE; import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;
import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS; import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS;
import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_SUBTLE_WINDOW_ANIMATIONS; import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_SUBTLE_WINDOW_ANIMATIONS;
import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE; import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE;
@@ -235,8 +237,14 @@ class KeyguardController {
mAodShowing ? 1 : 0, mAodShowing ? 1 : 0,
1 /* keyguardGoingAway */, 1 /* keyguardGoingAway */,
"keyguardGoingAway"); "keyguardGoingAway");
mRootWindowContainer.getDefaultDisplay().requestTransitionAndLegacyPrepare( final int transitFlags = convertTransitFlags(flags);
TRANSIT_KEYGUARD_GOING_AWAY, convertTransitFlags(flags)); final DisplayContent dc = mRootWindowContainer.getDefaultDisplay();
dc.prepareAppTransition(TRANSIT_KEYGUARD_GOING_AWAY, transitFlags);
// We are deprecating TRANSIT_KEYGUARD_GOING_AWAY for Shell transition and use
// TRANSIT_FLAG_KEYGUARD_GOING_AWAY to indicate that it should animate keyguard going
// away.
dc.mAtmService.getTransitionController().requestTransitionIfNeeded(
TRANSIT_TO_BACK, transitFlags, null /* trigger */, dc);
updateKeyguardSleepToken(); updateKeyguardSleepToken();
// Some stack visibility might change (e.g. docked stack) // Some stack visibility might change (e.g. docked stack)
@@ -276,7 +284,7 @@ class KeyguardController {
} }
private int convertTransitFlags(int keyguardGoingAwayFlags) { private int convertTransitFlags(int keyguardGoingAwayFlags) {
int result = 0; int result = TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
if ((keyguardGoingAwayFlags & KEYGUARD_GOING_AWAY_FLAG_TO_SHADE) != 0) { if ((keyguardGoingAwayFlags & KEYGUARD_GOING_AWAY_FLAG_TO_SHADE) != 0) {
result |= TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE; result |= TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE;
} }

View File

@@ -25,6 +25,7 @@ import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECI
import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FLAG_IS_RECENTS; import static android.view.WindowManager.TRANSIT_FLAG_IS_RECENTS;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE;
@@ -622,13 +623,14 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
} }
private void handleNonAppWindowsInTransition(int displayId, private void handleNonAppWindowsInTransition(int displayId,
@TransitionType int transit, int flags) { @TransitionType int transit, @TransitionFlags int flags) {
final DisplayContent dc = final DisplayContent dc =
mController.mAtm.mRootWindowContainer.getDisplayContent(displayId); mController.mAtm.mRootWindowContainer.getDisplayContent(displayId);
if (dc == null) { if (dc == null) {
return; return;
} }
if (transit == TRANSIT_KEYGUARD_GOING_AWAY if ((transit == TRANSIT_KEYGUARD_GOING_AWAY
|| (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY) != 0)
&& !WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation) { && !WindowManagerService.sEnableRemoteKeyguardGoingAwayAnimation) {
if ((flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER) != 0 if ((flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER) != 0
&& (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION) == 0 && (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION) == 0

View File

@@ -18,11 +18,7 @@ package com.android.server.wm;
import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FLAG_IS_RECENTS; import static android.view.WindowManager.TRANSIT_FLAG_IS_RECENTS;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER;
import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_NONE; import static android.view.WindowManager.TRANSIT_NONE;
import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_OPEN;
@@ -230,6 +226,10 @@ class TransitionController {
if (isCollecting()) { if (isCollecting()) {
// Make the collecting transition wait until this request is ready. // Make the collecting transition wait until this request is ready.
mCollectingTransition.setReady(readyGroupRef, false); mCollectingTransition.setReady(readyGroupRef, false);
if ((flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY) != 0) {
// Add keyguard flag to dismiss keyguard
mCollectingTransition.addFlag(flags);
}
} else { } else {
newTransition = requestStartTransition(createTransition(type, flags), newTransition = requestStartTransition(createTransition(type, flags),
trigger != null ? trigger.asTask() : null, remoteTransition); trigger != null ? trigger.asTask() : null, remoteTransition);
@@ -354,11 +354,7 @@ class TransitionController {
} }
void dispatchLegacyAppTransitionStarting(TransitionInfo info) { void dispatchLegacyAppTransitionStarting(TransitionInfo info) {
final boolean keyguardGoingAway = info.getType() == TRANSIT_KEYGUARD_GOING_AWAY final boolean keyguardGoingAway = info.isKeyguardGoingAway();
|| (info.getFlags() & (TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE
| TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION
| TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER
| TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION)) != 0;
for (int i = 0; i < mLegacyListeners.size(); ++i) { for (int i = 0; i < mLegacyListeners.size(); ++i) {
mLegacyListeners.get(i).onAppTransitionStartingLocked(keyguardGoingAway, mLegacyListeners.get(i).onAppTransitionStartingLocked(keyguardGoingAway,
0 /* durationHint */, SystemClock.uptimeMillis(), 0 /* durationHint */, SystemClock.uptimeMillis(),