Pass keyguard occluded status in onAnimationCancelled. am: c77d9bda04

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18918932

Change-Id: I519ff40b8fcfe4005428a14f2ffe33108aabc738
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Issei Suzuki
2022-06-29 18:41:14 +00:00
committed by Automerger Merge Worker
19 changed files with 44 additions and 34 deletions

View File

@@ -46,5 +46,5 @@ oneway interface IRemoteAnimationRunner {
* won't have any effect anymore.
*/
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
void onAnimationCancelled();
void onAnimationCancelled(boolean isKeyguardOccluded);
}

View File

@@ -83,9 +83,9 @@ class TaskFragmentAnimationRunner extends IRemoteAnimationRunner.Stub {
}
@Override
public void onAnimationCancelled() {
public void onAnimationCancelled(boolean isKeyguardOccluded) {
if (TaskFragmentAnimationController.DEBUG) {
Log.v(TAG, "onAnimationCancelled");
Log.v(TAG, "onAnimationCancelled: isKeyguardOccluded=" + isKeyguardOccluded);
}
mHandler.post(this::cancelAnimation);
}

View File

@@ -456,10 +456,10 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
}
@Override
public void onAnimationCancelled() {
public void onAnimationCancelled(boolean isKeyguardOccluded) {
onRemoteAnimationFinishedOrCancelled(evictWct);
try {
adapter.getRunner().onAnimationCancelled();
adapter.getRunner().onAnimationCancelled(isKeyguardOccluded);
} catch (RemoteException e) {
Slog.e(TAG, "Error starting remote animation", e);
}

View File

@@ -345,9 +345,9 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
}
@Override
public void onAnimationCancelled() {
public void onAnimationCancelled(boolean isKeyguardOccluded) {
try {
adapter.getRunner().onAnimationCancelled();
adapter.getRunner().onAnimationCancelled(isKeyguardOccluded);
} catch (RemoteException e) {
Slog.e(TAG, "Error starting remote animation", e);
}

View File

@@ -107,7 +107,7 @@ public class LegacyTransitions {
}
@Override
public void onAnimationCancelled() throws RemoteException {
public void onAnimationCancelled(boolean isKeyguardOccluded) throws RemoteException {
mCancelled = true;
mApps = mWallpapers = mNonApps = null;
checkApply();

View File

@@ -596,7 +596,7 @@ class ActivityLaunchAnimator(
controller.onLaunchAnimationCancelled()
}
override fun onAnimationCancelled() {
override fun onAnimationCancelled(isKeyguardOccluded: Boolean) {
if (timedOut) {
return
}

View File

@@ -105,7 +105,7 @@ public class RemoteAnimationAdapterCompat {
}
@Override
public void onAnimationCancelled() {
public void onAnimationCancelled(boolean isKeyguardOccluded) {
remoteAnimationAdapter.onAnimationCancelled();
}
};

View File

@@ -220,7 +220,6 @@ public class KeyguardService extends Service {
public void mergeAnimation(IBinder transition, TransitionInfo info,
SurfaceControl.Transaction t, IBinder mergeTarget,
IRemoteTransitionFinishedCallback finishCallback) {
}
};
}
@@ -349,7 +348,7 @@ public class KeyguardService extends Service {
}
@Override // Binder interface
public void onAnimationCancelled() {
public void onAnimationCancelled(boolean isKeyguardOccluded) {
mKeyguardViewMediator.cancelKeyguardExitAnimation();
}
};

View File

@@ -910,12 +910,12 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
private final Matrix mUnoccludeMatrix = new Matrix();
@Override
public void onAnimationCancelled() {
public void onAnimationCancelled(boolean isKeyguardOccluded) {
if (mUnoccludeAnimator != null) {
mUnoccludeAnimator.cancel();
}
setOccluded(false /* isOccluded */, false /* animate */);
setOccluded(isKeyguardOccluded, false /* animate */);
Log.d(TAG, "Unocclude animation cancelled. Occluded state is now: "
+ mOccluded);
}
@@ -3160,9 +3160,9 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
}
@Override
public void onAnimationCancelled() throws RemoteException {
public void onAnimationCancelled(boolean isKeyguardOccluded) throws RemoteException {
if (mRunner != null) {
mRunner.onAnimationCancelled();
mRunner.onAnimationCancelled(isKeyguardOccluded);
}
}
@@ -3203,8 +3203,8 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
}
@Override
public void onAnimationCancelled() throws RemoteException {
super.onAnimationCancelled();
public void onAnimationCancelled(boolean isKeyguardOccluded) throws RemoteException {
super.onAnimationCancelled(isKeyguardOccluded);
Log.d(TAG, "Occlude launch animation cancelled. Occluded state is now: " + mOccluded);
}
}

View File

@@ -142,7 +142,7 @@ public class ScreenshotController {
}
@Override
public void onAnimationCancelled() {
public void onAnimationCancelled(boolean isKeyguardOccluded) {
}
};

View File

@@ -159,7 +159,7 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() {
@Test
fun doesNotStartIfAnimationIsCancelled() {
val runner = activityLaunchAnimator.createRunner(controller)
runner.onAnimationCancelled()
runner.onAnimationCancelled(false /* isKeyguardOccluded */)
runner.onAnimationStart(0, emptyArray(), emptyArray(), emptyArray(), iCallback)
waitForIdleSync()

View File

@@ -6175,6 +6175,14 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
.getKeyguardController().isAodShowing(mDisplayId);
}
/**
* @return whether the keyguard is occluded on this display
*/
boolean isKeyguardOccluded() {
return mRootWindowContainer.mTaskSupervisor
.getKeyguardController().isDisplayOccluded(mDisplayId);
}
@VisibleForTesting
void removeAllTasks() {
forAllTasks((t) -> { t.getRootTask().removeChild(t, "removeAllTasks"); });

View File

@@ -316,8 +316,10 @@ class RemoteAnimationController implements DeathRecipient {
private void invokeAnimationCancelled(String reason) {
ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "cancelAnimation(): reason=%s", reason);
final boolean isKeyguardOccluded = mDisplayContent.isKeyguardOccluded();
try {
mRemoteAnimationAdapter.getRunner().onAnimationCancelled();
mRemoteAnimationAdapter.getRunner().onAnimationCancelled(isKeyguardOccluded);
} catch (RemoteException e) {
Slog.e(TAG, "Failed to notify cancel", e);
}

View File

@@ -779,7 +779,7 @@ public class ActivityRecordTests extends WindowTestsBase {
}
@Override
public void onAnimationCancelled() {
public void onAnimationCancelled(boolean isKeyguardOccluded) {
}
}, 0, 0));
activity.updateOptionsLocked(opts);

View File

@@ -87,7 +87,7 @@ public class AppChangeTransitionTests extends WindowTestsBase {
}
@Override
public void onAnimationCancelled() {
public void onAnimationCancelled(boolean isKeyguardOccluded) {
}
@Override

View File

@@ -777,7 +777,7 @@ public class AppTransitionControllerTest extends WindowTestsBase {
}
@Override
public void onAnimationCancelled() throws RemoteException {
public void onAnimationCancelled(boolean isKeyguardOccluded) throws RemoteException {
mFinishedCallback = null;
}

View File

@@ -522,7 +522,7 @@ public class AppTransitionTests extends WindowTestsBase {
}
@Override
public void onAnimationCancelled() {
public void onAnimationCancelled(boolean isKeyguardOccluded) {
mCancelled = true;
}

View File

@@ -43,6 +43,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyFloat;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
@@ -168,7 +169,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
mController.goodToGo(TRANSIT_OLD_ACTIVITY_OPEN);
adapter.onAnimationCancelled(mMockLeash);
verify(mMockRunner).onAnimationCancelled();
verify(mMockRunner).onAnimationCancelled(anyBoolean());
}
@Test
@@ -183,7 +184,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
mClock.fastForward(10500);
mHandler.timeAdvance();
verify(mMockRunner).onAnimationCancelled();
verify(mMockRunner).onAnimationCancelled(anyBoolean());
verify(mFinishedCallback).onAnimationFinished(eq(ANIMATION_TYPE_APP_TRANSITION),
eq(adapter));
}
@@ -204,12 +205,12 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
mClock.fastForward(10500);
mHandler.timeAdvance();
verify(mMockRunner, never()).onAnimationCancelled();
verify(mMockRunner, never()).onAnimationCancelled(anyBoolean());
mClock.fastForward(52500);
mHandler.timeAdvance();
verify(mMockRunner).onAnimationCancelled();
verify(mMockRunner).onAnimationCancelled(anyBoolean());
verify(mFinishedCallback).onAnimationFinished(eq(ANIMATION_TYPE_APP_TRANSITION),
eq(adapter));
} finally {
@@ -221,7 +222,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
public void testZeroAnimations() throws Exception {
mController.goodToGo(TRANSIT_OLD_NONE);
verify(mMockRunner, never()).onAnimationStart(anyInt(), any(), any(), any(), any());
verify(mMockRunner).onAnimationCancelled();
verify(mMockRunner).onAnimationCancelled(anyBoolean());
}
@Test
@@ -231,7 +232,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
new Point(50, 100), null, new Rect(50, 100, 150, 150), null);
mController.goodToGo(TRANSIT_OLD_ACTIVITY_OPEN);
verify(mMockRunner, never()).onAnimationStart(anyInt(), any(), any(), any(), any());
verify(mMockRunner).onAnimationCancelled();
verify(mMockRunner).onAnimationCancelled(anyBoolean());
}
@Test
@@ -271,7 +272,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
win.mActivityRecord.removeImmediately();
mController.goodToGo(TRANSIT_OLD_ACTIVITY_OPEN);
verify(mMockRunner, never()).onAnimationStart(anyInt(), any(), any(), any(), any());
verify(mMockRunner).onAnimationCancelled();
verify(mMockRunner).onAnimationCancelled(anyBoolean());
verify(mFinishedCallback).onAnimationFinished(eq(ANIMATION_TYPE_APP_TRANSITION),
eq(adapter));
}
@@ -527,7 +528,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
// Cancel the wallpaper window animator and ensure the runner is not canceled
wallpaperWindowToken.cancelAnimation();
verify(mMockRunner, never()).onAnimationCancelled();
verify(mMockRunner, never()).onAnimationCancelled(anyBoolean());
} finally {
mDisplayContent.mOpeningApps.clear();
}

View File

@@ -979,7 +979,7 @@ public class WindowContainerTests extends WindowTestsBase {
}
@Override
public void onAnimationCancelled() {
public void onAnimationCancelled(boolean isKeyguardOccluded) {
}
}, 0, 0, false);
adapter.setCallingPidUid(123, 456);