Pass ActivityOptions when endDeferAddStartingWindow
The AR#mPendingOptions would be removed while resume top activity, if the app is launching to fullscreen mode, resume top activity would happen after all other activities are paused. However, this condition won't skip resume when launching an app to freeform window. To preventing the mPendingOptions from cleared while startActivites, pass the activity options when start activities to creating the starting window for top most activity. Bug: 215768214 Test: atest SplashscreenTests ActivityRecordTests Test: run above test on aosp_cf_x86_64_pc-userdebug Test: enable freeform, run above test again. Change-Id: I6351a12862f39069c7248de920ee1e317c2c221d
This commit is contained in:
@@ -6568,7 +6568,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean shouldUseEmptySplashScreen(ActivityRecord sourceRecord, boolean startActivity) {
|
||||
private boolean shouldUseEmptySplashScreen(ActivityRecord sourceRecord, boolean startActivity,
|
||||
ActivityOptions options) {
|
||||
if (sourceRecord == null && !startActivity) {
|
||||
// Use empty style if this activity is not top activity. This could happen when adding
|
||||
// a splash screen window to the warm start activity which is re-create because top is
|
||||
@@ -6578,8 +6579,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (mPendingOptions != null) {
|
||||
final int optionsStyle = mPendingOptions.getSplashScreenStyle();
|
||||
if (options != null) {
|
||||
final int optionsStyle = options.getSplashScreenStyle();
|
||||
if (optionsStyle == SplashScreen.SPLASH_SCREEN_STYLE_EMPTY) {
|
||||
return true;
|
||||
} else if (optionsStyle == SplashScreen.SPLASH_SCREEN_STYLE_ICON) {
|
||||
@@ -6608,11 +6609,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
|| mLaunchSourceType == LAUNCH_SOURCE_TYPE_HOME);
|
||||
}
|
||||
|
||||
private int getSplashscreenTheme() {
|
||||
private int getSplashscreenTheme(ActivityOptions options) {
|
||||
// Find the splash screen theme. User can override the persisted theme by
|
||||
// ActivityOptions.
|
||||
String splashScreenThemeResName = mPendingOptions != null
|
||||
? mPendingOptions.getSplashScreenThemeResName() : null;
|
||||
String splashScreenThemeResName = options != null
|
||||
? options.getSplashScreenThemeResName() : null;
|
||||
if (splashScreenThemeResName == null || splashScreenThemeResName.isEmpty()) {
|
||||
try {
|
||||
splashScreenThemeResName = mAtmService.getPackageManager()
|
||||
@@ -6639,7 +6640,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
void showStartingWindow(ActivityRecord prev, boolean newTask, boolean taskSwitch,
|
||||
boolean startActivity, ActivityRecord sourceRecord) {
|
||||
showStartingWindow(prev, newTask, taskSwitch, isProcessRunning(), startActivity,
|
||||
sourceRecord);
|
||||
sourceRecord, null /* candidateOptions */);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6647,22 +6648,27 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
* @param processRunning Whether the client process is running.
|
||||
* @param startActivity Whether this activity is just created from starter.
|
||||
* @param sourceRecord The source activity which start this activity.
|
||||
* @param candidateOptions The options for the style of starting window.
|
||||
*/
|
||||
void showStartingWindow(ActivityRecord prev, boolean newTask, boolean taskSwitch,
|
||||
boolean processRunning, boolean startActivity, ActivityRecord sourceRecord) {
|
||||
boolean processRunning, boolean startActivity, ActivityRecord sourceRecord,
|
||||
ActivityOptions candidateOptions) {
|
||||
if (mTaskOverlay) {
|
||||
// We don't show starting window for overlay activities.
|
||||
return;
|
||||
}
|
||||
if (mPendingOptions != null
|
||||
&& mPendingOptions.getAnimationType() == ActivityOptions.ANIM_SCENE_TRANSITION) {
|
||||
final ActivityOptions startOptions = candidateOptions != null
|
||||
? candidateOptions : mPendingOptions;
|
||||
if (startOptions != null
|
||||
&& startOptions.getAnimationType() == ActivityOptions.ANIM_SCENE_TRANSITION) {
|
||||
// Don't show starting window when using shared element transition.
|
||||
return;
|
||||
}
|
||||
|
||||
mSplashScreenStyleEmpty = shouldUseEmptySplashScreen(sourceRecord, startActivity);
|
||||
mSplashScreenStyleEmpty = shouldUseEmptySplashScreen(
|
||||
sourceRecord, startActivity, startOptions);
|
||||
|
||||
final int splashScreenTheme = startActivity ? getSplashscreenTheme() : 0;
|
||||
final int splashScreenTheme = startActivity ? getSplashscreenTheme(startOptions) : 0;
|
||||
final int resolvedTheme = evaluateStartingWindowTheme(prev, packageName, theme,
|
||||
splashScreenTheme);
|
||||
|
||||
|
||||
@@ -484,7 +484,8 @@ public class ActivityStartController {
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
mService.mWindowManager.mStartingSurfaceController.endDeferAddStartingWindow();
|
||||
mService.mWindowManager.mStartingSurfaceController.endDeferAddStartingWindow(
|
||||
options != null ? options.getOriginalOptions() : null);
|
||||
mService.continueWindowLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.compat.CompatChanges;
|
||||
import android.compat.annotation.ChangeId;
|
||||
import android.compat.annotation.EnabledSince;
|
||||
@@ -215,12 +216,12 @@ public class StartingSurfaceController {
|
||||
deferring, prev, source));
|
||||
}
|
||||
|
||||
private void showStartingWindowFromDeferringActivities() {
|
||||
private void showStartingWindowFromDeferringActivities(ActivityOptions topOptions) {
|
||||
// Attempt to add starting window from the top-most activity.
|
||||
for (int i = mDeferringAddStartActivities.size() - 1; i >= 0; --i) {
|
||||
final DeferringStartingWindowRecord next = mDeferringAddStartActivities.get(i);
|
||||
next.mDeferring.showStartingWindow(next.mPrev, mInitNewTask, mInitTaskSwitch,
|
||||
mInitProcessRunning, true /* startActivity */, next.mSource);
|
||||
mInitProcessRunning, true /* startActivity */, next.mSource, topOptions);
|
||||
// If one succeeds, it is done.
|
||||
if (next.mDeferring.mStartingData != null) {
|
||||
break;
|
||||
@@ -243,9 +244,9 @@ public class StartingSurfaceController {
|
||||
/**
|
||||
* End deferring add starting window.
|
||||
*/
|
||||
void endDeferAddStartingWindow() {
|
||||
void endDeferAddStartingWindow(ActivityOptions topOptions) {
|
||||
mDeferringAddStartingWindow = false;
|
||||
showStartingWindowFromDeferringActivities();
|
||||
showStartingWindowFromDeferringActivities(topOptions);
|
||||
}
|
||||
|
||||
final class StartingSurface {
|
||||
|
||||
Reference in New Issue
Block a user