Merge "Defer copy splash screen to client after transaction committed." into udc-qpr-dev

This commit is contained in:
Wei Sheng Shih
2023-08-17 09:31:14 +00:00
committed by Android (Google) Code Review
2 changed files with 33 additions and 6 deletions

View File

@@ -224,6 +224,9 @@ import static com.android.server.wm.IdentifierProto.TITLE;
import static com.android.server.wm.IdentifierProto.USER_ID;
import static com.android.server.wm.LetterboxConfiguration.DEFAULT_LETTERBOX_ASPECT_RATIO_FOR_MULTI_WINDOW;
import static com.android.server.wm.LetterboxConfiguration.MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO;
import static com.android.server.wm.StartingData.AFTER_TRANSACTION_COPY_TO_CLIENT;
import static com.android.server.wm.StartingData.AFTER_TRANSACTION_IDLE;
import static com.android.server.wm.StartingData.AFTER_TRANSACTION_REMOVE_DIRECTLY;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_PREDICT_BACK;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_RECENTS;
@@ -2684,6 +2687,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
if (isTransferringSplashScreen()) {
return true;
}
// Only do transfer after transaction has done when starting window exist.
if (mStartingData != null && mStartingData.mWaitForSyncTransactionCommit) {
mStartingData.mRemoveAfterTransaction = AFTER_TRANSACTION_COPY_TO_CLIENT;
return true;
}
requestCopySplashScreen();
return isTransferringSplashScreen();
}
@@ -2844,11 +2852,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
if (mStartingData == null) {
return;
}
mStartingData.mWaitForSyncTransactionCommit = false;
if (mStartingData.mRemoveAfterTransaction) {
mStartingData.mRemoveAfterTransaction = false;
removeStartingWindowAnimation(mStartingData.mPrepareRemoveAnimation);
final StartingData lastData = mStartingData;
lastData.mWaitForSyncTransactionCommit = false;
if (lastData.mRemoveAfterTransaction == AFTER_TRANSACTION_REMOVE_DIRECTLY) {
removeStartingWindowAnimation(lastData.mPrepareRemoveAnimation);
} else if (lastData.mRemoveAfterTransaction == AFTER_TRANSACTION_COPY_TO_CLIENT) {
removeStartingWindow();
}
lastData.mRemoveAfterTransaction = AFTER_TRANSACTION_IDLE;
}
void removeStartingWindowAnimation(boolean prepareAnimation) {
@@ -2875,7 +2886,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
if (mStartingData != null) {
if (mStartingData.mWaitForSyncTransactionCommit
|| mTransitionController.inCollectingTransition(startingWindow)) {
mStartingData.mRemoveAfterTransaction = true;
mStartingData.mRemoveAfterTransaction = AFTER_TRANSACTION_REMOVE_DIRECTLY;
mStartingData.mPrepareRemoveAnimation = prepareAnimation;
return;
}

View File

@@ -16,6 +16,8 @@
package com.android.server.wm;
import android.annotation.IntDef;
import com.android.server.wm.StartingSurfaceController.StartingSurface;
/**
@@ -23,6 +25,20 @@ import com.android.server.wm.StartingSurfaceController.StartingSurface;
*/
public abstract class StartingData {
/** Nothing need to do after transaction */
static final int AFTER_TRANSACTION_IDLE = 0;
/** Remove the starting window directly after transaction done. */
static final int AFTER_TRANSACTION_REMOVE_DIRECTLY = 1;
/** Do copy splash screen to client after transaction done. */
static final int AFTER_TRANSACTION_COPY_TO_CLIENT = 2;
@IntDef(prefix = { "AFTER_TRANSACTION" }, value = {
AFTER_TRANSACTION_IDLE,
AFTER_TRANSACTION_REMOVE_DIRECTLY,
AFTER_TRANSACTION_COPY_TO_CLIENT,
})
@interface AfterTransaction {}
protected final WindowManagerService mService;
protected final int mTypeParams;
@@ -60,7 +76,7 @@ public abstract class StartingData {
* This starting window should be removed after applying the start transaction of transition,
* which ensures the app window has shown.
*/
boolean mRemoveAfterTransaction;
@AfterTransaction int mRemoveAfterTransaction;
/** Whether to prepare the removal animation. */
boolean mPrepareRemoveAnimation;