Skip to content

Commit 6760eb5

Browse files
author
Android Build Coastguard Worker
committed
Merge cherrypicks of ['googleplex-android-review.googlesource.com/22381002', 'googleplex-android-review.googlesource.com/23661867'] into sparse-10317220-L65500000961600299.
SPARSE_CHANGE: I7b3dcd06e7483fde745a1d56dfee7c4efc262ed7 SPARSE_CHANGE: Ifcdac241bfe33f44f5f03f1a6db682c57f0cd388 Change-Id: I1bb3331bf5553f9a1984dd7eb2c29d94651e8a14
2 parents 7c8d5d5 + a7e27bc commit 6760eb5

3 files changed

Lines changed: 32 additions & 28 deletions

File tree

packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -260,22 +260,20 @@ public void onAnimationFinished() throws RemoteException {
260260
);
261261
}
262262

263-
public void mergeAnimation(IBinder transition, TransitionInfo info,
264-
SurfaceControl.Transaction t, IBinder mergeTarget,
265-
IRemoteTransitionFinishedCallback finishCallback) {
263+
public void mergeAnimation(IBinder candidateTransition, TransitionInfo candidateInfo,
264+
SurfaceControl.Transaction candidateT, IBinder currentTransition,
265+
IRemoteTransitionFinishedCallback candidateFinishCallback) {
266266
try {
267-
final IRemoteTransitionFinishedCallback origFinishCB;
267+
final IRemoteTransitionFinishedCallback currentFinishCB;
268268
synchronized (mFinishCallbacks) {
269-
origFinishCB = mFinishCallbacks.remove(transition);
269+
currentFinishCB = mFinishCallbacks.remove(currentTransition);
270270
}
271-
info.releaseAllSurfaces();
272-
t.close();
273-
if (origFinishCB == null) {
274-
// already finished (or not started yet), so do nothing.
271+
if (currentFinishCB == null) {
272+
Slog.e(TAG, "Called mergeAnimation, but finish callback is missing");
275273
return;
276274
}
277275
runner.onAnimationCancelled(false /* isKeyguardOccluded */);
278-
origFinishCB.onTransitionFinished(null /* wct */, null /* t */);
276+
currentFinishCB.onTransitionFinished(null /* wct */, null /* t */);
279277
} catch (RemoteException e) {
280278
// nothing, we'll just let it finish on its own I guess.
281279
}

packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -958,14 +958,12 @@ public LaunchAnimator.State createAnimatorState() {
958958

959959
@Override
960960
public void onAnimationCancelled(boolean isKeyguardOccluded) {
961-
if (mOccludeByDreamAnimator != null) {
962-
mOccludeByDreamAnimator.cancel();
963-
}
964-
setOccluded(isKeyguardOccluded /* isOccluded */, false /* animate */);
965-
if (DEBUG) {
966-
Log.d(TAG, "Occlude by Dream animation cancelled. Occluded state is now: "
967-
+ mOccluded);
968-
}
961+
mContext.getMainExecutor().execute(() -> {
962+
if (mOccludeByDreamAnimator != null) {
963+
mOccludeByDreamAnimator.cancel();
964+
}
965+
});
966+
Log.d(TAG, "Occlude by Dream animation cancelled.");
969967
}
970968

971969
@Override
@@ -1071,10 +1069,7 @@ public void onAnimationCancelled(boolean isKeyguardOccluded) {
10711069
}
10721070
});
10731071

1074-
setOccluded(isKeyguardOccluded /* isOccluded */, false /* animate */);
1075-
Log.d(TAG, "Unocclude animation cancelled. Occluded state is now: "
1076-
+ mOccluded);
1077-
1072+
Log.d(TAG, "Unocclude animation cancelled.");
10781073
mInteractionJankMonitor.cancel(CUJ_LOCKSCREEN_OCCLUSION);
10791074
}
10801075

@@ -3441,10 +3436,7 @@ public void onAnimationStart(int transit, RemoteAnimationTarget[] apps,
34413436
public void onAnimationCancelled(boolean isKeyguardOccluded) throws RemoteException {
34423437
super.onAnimationCancelled(isKeyguardOccluded);
34433438

3444-
Log.d(TAG, "Occlude animation cancelled by WM. "
3445-
+ "Setting occluded state to: " + isKeyguardOccluded);
3446-
setOccluded(isKeyguardOccluded /* occluded */, false /* animate */);
3447-
3439+
Log.d(TAG, "Occlude animation cancelled by WM.");
34483440
mInteractionJankMonitor.cancel(CUJ_LOCKSCREEN_OCCLUSION);
34493441
}
34503442
}

services/core/java/com/android/server/policy/PhoneWindowManager.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,10 +2134,14 @@ public void init(Context context, WindowManagerFuncs windowManagerFuncs) {
21342134
}
21352135

21362136
mWindowManagerInternal.registerAppTransitionListener(new AppTransitionListener() {
2137+
private boolean mOccludeChangingInTransition = false;
2138+
21372139
@Override
21382140
public int onAppTransitionStartingLocked(boolean keyguardGoingAway,
21392141
boolean keyguardOccluding, long duration, long statusBarAnimationStartTime,
21402142
long statusBarAnimationDuration) {
2143+
mOccludeChangingInTransition = keyguardGoingAway || keyguardOccluding;
2144+
21412145
// When remote animation is enabled for KEYGUARD_GOING_AWAY transition, SysUI
21422146
// receives IRemoteAnimationRunner#onAnimationStart to start animation, so we don't
21432147
// need to call IKeyguardService#keyguardGoingAway here.
@@ -2153,19 +2157,28 @@ public void onAppTransitionCancelledLocked(boolean keyguardGoingAway) {
21532157
0 /* duration */);
21542158

21552159
synchronized (mLock) {
2160+
if (mOccludeChangingInTransition) {
2161+
mKeyguardOccludedChanged = true;
2162+
mOccludeChangingInTransition = false;
2163+
}
2164+
applyKeyguardOcclusionChange(false);
21562165
mLockAfterAppTransitionFinished = false;
21572166
}
21582167
}
21592168

21602169
@Override
21612170
public void onAppTransitionFinishedLocked(IBinder token) {
21622171
synchronized (mLock) {
2172+
if (mOccludeChangingInTransition) {
2173+
mKeyguardOccludedChanged = true;
2174+
mOccludeChangingInTransition = false;
2175+
}
2176+
applyKeyguardOcclusionChange(false /* transitionStarted */);
21632177
if (!mLockAfterAppTransitionFinished) {
21642178
return;
21652179
}
21662180
mLockAfterAppTransitionFinished = false;
21672181
}
2168-
21692182
lockNow(null);
21702183
}
21712184
});
@@ -3355,7 +3368,7 @@ public int applyKeyguardOcclusionChange(boolean transitionStarted) {
33553368
if (mKeyguardOccludedChanged) {
33563369
if (DEBUG_KEYGUARD) Slog.d(TAG, "transition/occluded changed occluded="
33573370
+ mPendingKeyguardOccluded);
3358-
if (setKeyguardOccludedLw(mPendingKeyguardOccluded, false /* force */,
3371+
if (setKeyguardOccludedLw(mPendingKeyguardOccluded, true /* force */,
33593372
transitionStarted)) {
33603373
return FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_WALLPAPER;
33613374
}
@@ -3616,6 +3629,7 @@ public void setNavBarVirtualKeyHapticFeedbackEnabledLw(boolean enabled) {
36163629
private boolean setKeyguardOccludedLw(boolean isOccluded, boolean force,
36173630
boolean transitionStarted) {
36183631
if (DEBUG_KEYGUARD) Slog.d(TAG, "setKeyguardOccluded occluded=" + isOccluded);
3632+
mPendingKeyguardOccluded = isOccluded;
36193633
mKeyguardOccludedChanged = false;
36203634
if (isKeyguardOccluded() == isOccluded && !force) {
36213635
return false;

0 commit comments

Comments
 (0)