Merge "Fix switch task flicker from reveal animation." into sc-dev

This commit is contained in:
Wei Sheng Shih
2021-07-01 06:27:59 +00:00
committed by Android (Google) Code Review
5 changed files with 18 additions and 1 deletions

View File

@@ -2252,6 +2252,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
}
final WindowManagerPolicy.StartingSurface surface;
final StartingData startingData = mStartingData;
if (mStartingData != null) {
surface = mStartingSurface;
mStartingData = null;
@@ -2278,7 +2279,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
final Runnable removeSurface = () -> {
ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Removing startingView=%s", surface);
try {
surface.remove(prepareAnimation);
surface.remove(prepareAnimation && startingData.needRevealAnimation());
} catch (Exception e) {
Slog.w(TAG_WM, "Exception when removing starting window", e);
}

View File

@@ -40,6 +40,11 @@ class SnapshotStartingData extends StartingData {
mSnapshot);
}
@Override
boolean needRevealAnimation() {
return false;
}
@Override
boolean hasImeSurface() {
return mSnapshot.hasImeSurface();

View File

@@ -58,4 +58,9 @@ class SplashScreenStartingData extends StartingData {
mLogo, mWindowFlags, mMergedOverrideConfiguration,
activity.getDisplayContent().getDisplayId());
}
@Override
boolean needRevealAnimation() {
return true;
}
}

View File

@@ -47,6 +47,11 @@ public abstract class StartingData {
*/
abstract StartingSurface createStartingSurface(ActivityRecord activity);
/**
* @return Whether to apply reveal animation when exiting the starting window.
*/
abstract boolean needRevealAnimation();
/** @see android.window.TaskSnapshot#hasImeSurface() */
boolean hasImeSurface() {
return false;

View File

@@ -197,6 +197,7 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
ANIMATION_TYPE_STARTING_REVEAL);
windowAnimationLeash = adaptor.mAnimationLeash;
mainFrame = mainWindow.getRelativeFrame();
t.setPosition(windowAnimationLeash, mainFrame.left, mainFrame.top);
}
}
}