Merge "Always report keyguard-going-away even if empty" into udc-dev am: 26994f4d2e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22236190 Change-Id: Id7a7788ec4c92c782dcb17fd9b9f51d622c8d711 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -19,6 +19,7 @@ package com.android.wm.shell.transition;
|
||||
import static android.view.WindowManager.TRANSIT_CHANGE;
|
||||
import static android.view.WindowManager.TRANSIT_CLOSE;
|
||||
import static android.view.WindowManager.TRANSIT_FIRST_CUSTOM;
|
||||
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
|
||||
import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;
|
||||
import static android.view.WindowManager.TRANSIT_OPEN;
|
||||
import static android.view.WindowManager.TRANSIT_SLEEP;
|
||||
@@ -541,9 +542,7 @@ public class Transitions implements RemoteCallable<Transitions> {
|
||||
}
|
||||
}
|
||||
|
||||
// Allow to notify keyguard un-occluding state to KeyguardService, which can happen while
|
||||
// screen-off, so there might no visibility change involved.
|
||||
if (info.getRootCount() == 0 && info.getType() != TRANSIT_KEYGUARD_UNOCCLUDE) {
|
||||
if (info.getRootCount() == 0 && !alwaysReportToKeyguard(info)) {
|
||||
// No root-leashes implies that the transition is empty/no-op, so just do
|
||||
// housekeeping and return.
|
||||
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "No transition roots (%s): %s",
|
||||
@@ -589,6 +588,23 @@ public class Transitions implements RemoteCallable<Transitions> {
|
||||
processReadyQueue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Some transitions we always need to report to keyguard even if they are empty.
|
||||
* TODO (b/274954192): Remove this once keyguard dispatching moves to Shell.
|
||||
*/
|
||||
private static boolean alwaysReportToKeyguard(TransitionInfo info) {
|
||||
// occlusion status of activities can change while screen is off so there will be no
|
||||
// visibility change but we still need keyguardservice to be notified.
|
||||
if (info.getType() == TRANSIT_KEYGUARD_UNOCCLUDE) return true;
|
||||
|
||||
// It's possible for some activities to stop with bad timing (esp. since we can't yet
|
||||
// queue activity transitions initiated by apps) that results in an empty transition for
|
||||
// keyguard going-away. In general, we should should always report Keyguard-going-away.
|
||||
if ((info.getFlags() & TRANSIT_FLAG_KEYGUARD_GOING_AWAY) != 0) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void processReadyQueue() {
|
||||
if (mReadyTransitions.isEmpty()) {
|
||||
// Check if idle.
|
||||
|
||||
@@ -38,8 +38,15 @@ public class TransitionInfoBuilder {
|
||||
|
||||
public TransitionInfoBuilder(@WindowManager.TransitionType int type,
|
||||
@WindowManager.TransitionFlags int flags) {
|
||||
this(type, flags, false /* asNoOp */);
|
||||
}
|
||||
|
||||
public TransitionInfoBuilder(@WindowManager.TransitionType int type,
|
||||
@WindowManager.TransitionFlags int flags, boolean asNoOp) {
|
||||
mInfo = new TransitionInfo(type, flags);
|
||||
mInfo.addRootLeash(DISPLAY_ID, createMockSurface(true /* valid */), 0, 0);
|
||||
if (!asNoOp) {
|
||||
mInfo.addRootLeash(DISPLAY_ID, createMockSurface(true /* valid */), 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public TransitionInfoBuilder addChange(@WindowManager.TransitionType int mode,
|
||||
|
||||
@@ -1039,6 +1039,25 @@ public class ShellTransitionTests extends ShellTestCase {
|
||||
verify(observer, times(0)).onTransitionFinished(eq(transitToken3), anyBoolean());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyTransitionStillReportsKeyguardGoingAway() {
|
||||
Transitions transitions = createTestTransitions();
|
||||
transitions.replaceDefaultHandlerForTest(mDefaultHandler);
|
||||
|
||||
IBinder transitToken = new Binder();
|
||||
transitions.requestStartTransition(transitToken,
|
||||
new TransitionRequestInfo(TRANSIT_OPEN, null /* trigger */, null /* remote */));
|
||||
|
||||
// Make a no-op transition
|
||||
TransitionInfo info = new TransitionInfoBuilder(
|
||||
TRANSIT_OPEN, TRANSIT_FLAG_KEYGUARD_GOING_AWAY, true /* noOp */).build();
|
||||
transitions.onTransitionReady(transitToken, info, mock(SurfaceControl.Transaction.class),
|
||||
mock(SurfaceControl.Transaction.class));
|
||||
|
||||
// If keyguard-going-away flag set, then it shouldn't be aborted.
|
||||
assertEquals(1, mDefaultHandler.activeCount());
|
||||
}
|
||||
|
||||
class ChangeBuilder {
|
||||
final TransitionInfo.Change mChange;
|
||||
|
||||
|
||||
@@ -2690,6 +2690,17 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
|
||||
mInteractionJankMonitor.end(CUJ_LOCKSCREEN_UNLOCK_ANIMATION);
|
||||
return;
|
||||
}
|
||||
if (apps == null || apps.length == 0) {
|
||||
Slog.e(TAG, "Keyguard exit without a corresponding app to show.");
|
||||
try {
|
||||
finishedCallback.onAnimationFinished();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "RemoteException");
|
||||
} finally {
|
||||
mInteractionJankMonitor.end(CUJ_LOCKSCREEN_UNLOCK_ANIMATION);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO(bc-unlock): Sample animation, just to apply alpha animation on the app.
|
||||
final SyncRtSurfaceTransactionApplier applier =
|
||||
|
||||
Reference in New Issue
Block a user