Merge changes from topic "RemoteAnimationCanceled_with_Occluded-tm-dev" into tm-dev
* changes: Set occluded state on remote animation cancel. Pass keyguard occluded status in onAnimationCancelled.
This commit is contained in:
@@ -46,5 +46,5 @@ oneway interface IRemoteAnimationRunner {
|
||||
* won't have any effect anymore.
|
||||
*/
|
||||
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
|
||||
void onAnimationCancelled();
|
||||
void onAnimationCancelled(boolean isKeyguardOccluded);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -596,7 +596,7 @@ class ActivityLaunchAnimator(
|
||||
controller.onLaunchAnimationCancelled()
|
||||
}
|
||||
|
||||
override fun onAnimationCancelled() {
|
||||
override fun onAnimationCancelled(isKeyguardOccluded: Boolean) {
|
||||
if (timedOut) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class RemoteAnimationAdapterCompat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancelled() {
|
||||
public void onAnimationCancelled(boolean isKeyguardOccluded) {
|
||||
remoteAnimationAdapter.onAnimationCancelled();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -842,7 +842,6 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
|
||||
|
||||
@Override
|
||||
public void onLaunchAnimationCancelled() {
|
||||
setOccluded(true /* occluded */, false /* animate */);
|
||||
Log.d(TAG, "Occlude launch animation cancelled. Occluded state is now: "
|
||||
+ mOccluded);
|
||||
}
|
||||
@@ -910,12 +909,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 /* isOccluded */, false /* animate */);
|
||||
Log.d(TAG, "Unocclude animation cancelled. Occluded state is now: "
|
||||
+ mOccluded);
|
||||
}
|
||||
@@ -3150,9 +3149,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3193,9 +3192,12 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancelled() throws RemoteException {
|
||||
super.onAnimationCancelled();
|
||||
Log.d(TAG, "Occlude launch animation cancelled. Occluded state is now: " + mOccluded);
|
||||
public void onAnimationCancelled(boolean isKeyguardOccluded) throws RemoteException {
|
||||
super.onAnimationCancelled(isKeyguardOccluded);
|
||||
setOccluded(isKeyguardOccluded /* occluded */, false /* animate */);
|
||||
|
||||
Log.d(TAG, "Occlude animation cancelled by WM. "
|
||||
+ "Setting occluded state to: " + mOccluded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class ScreenshotController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancelled() {
|
||||
public void onAnimationCancelled(boolean isKeyguardOccluded) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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"); });
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -779,7 +779,7 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancelled() {
|
||||
public void onAnimationCancelled(boolean isKeyguardOccluded) {
|
||||
}
|
||||
}, 0, 0));
|
||||
activity.updateOptionsLocked(opts);
|
||||
|
||||
@@ -87,7 +87,7 @@ public class AppChangeTransitionTests extends WindowTestsBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancelled() {
|
||||
public void onAnimationCancelled(boolean isKeyguardOccluded) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -777,7 +777,7 @@ public class AppTransitionControllerTest extends WindowTestsBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancelled() throws RemoteException {
|
||||
public void onAnimationCancelled(boolean isKeyguardOccluded) throws RemoteException {
|
||||
mFinishedCallback = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -522,7 +522,7 @@ public class AppTransitionTests extends WindowTestsBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancelled() {
|
||||
public void onAnimationCancelled(boolean isKeyguardOccluded) {
|
||||
mCancelled = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user