Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc9ef142 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Automerger Merge Worker
Browse files

Merge "Allow transfer starting window to windowDisableStarting activity." into...

Merge "Allow transfer starting window to windowDisableStarting activity." into sc-dev am: 9df91d3d

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

Change-Id: I11fd0b5a8b08fd7164f587b4a922f1bd948f54d4
parents 9a085869 9df91d3d
Loading
Loading
Loading
Loading
+13 −6
Original line number Original line Diff line number Diff line
@@ -38,6 +38,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
@@ -1786,17 +1787,19 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A


    /**
    /**
     * Evaluate the theme for a starting window.
     * Evaluate the theme for a starting window.
     * @param prev Previous activity which may have a starting window.
     * @param originalTheme The original theme which read from activity or application.
     * @param originalTheme The original theme which read from activity or application.
     * @param replaceTheme The replace theme which requested from starter.
     * @param replaceTheme The replace theme which requested from starter.
     * @return Resolved theme.
     * @return Resolved theme.
     */
     */
    private int evaluateStartingWindowTheme(String pkg, int originalTheme, int replaceTheme) {
    private int evaluateStartingWindowTheme(ActivityRecord prev, String pkg, int originalTheme,
            int replaceTheme) {
        // Skip if the package doesn't want a starting window.
        // Skip if the package doesn't want a starting window.
        if (!validateStartingWindowTheme(pkg, originalTheme)) {
        if (!validateStartingWindowTheme(prev, pkg, originalTheme)) {
            return 0;
            return 0;
        }
        }
        int selectedTheme = originalTheme;
        int selectedTheme = originalTheme;
        if (replaceTheme != 0 && validateStartingWindowTheme(pkg, replaceTheme)) {
        if (replaceTheme != 0 && validateStartingWindowTheme(prev, pkg, replaceTheme)) {
            // allow to replace theme
            // allow to replace theme
            selectedTheme = replaceTheme;
            selectedTheme = replaceTheme;
        }
        }
@@ -1833,7 +1836,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        return LAUNCH_SOURCE_TYPE_APPLICATION;
        return LAUNCH_SOURCE_TYPE_APPLICATION;
    }
    }


    private boolean validateStartingWindowTheme(String pkg, int theme) {
    private boolean validateStartingWindowTheme(ActivityRecord prev, String pkg, int theme) {
        // If this is a translucent window, then don't show a starting window -- the current
        // If this is a translucent window, then don't show a starting window -- the current
        // effect (a full-screen opaque starting window that fades away to the real contents
        // effect (a full-screen opaque starting window that fades away to the real contents
        // when it is ready) does not work for this.
        // when it is ready) does not work for this.
@@ -1870,7 +1873,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            return false;
            return false;
        }
        }
        if (windowDisableStarting && !launchedFromSystemSurface()) {
        if (windowDisableStarting && !launchedFromSystemSurface()) {
            return false;
            // Check if previous activity can transfer the starting window to this activity.
            return prev != null && prev.getActivityType() == ACTIVITY_TYPE_STANDARD
                    && prev.mTransferringSplashScreenState == TRANSFER_SPLASH_SCREEN_IDLE
                    && (prev.mStartingData != null
                    || (prev.mStartingWindow != null && prev.mStartingSurface != null));
        }
        }
        return true;
        return true;
    }
    }
@@ -6276,7 +6283,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A


        mSplashScreenStyleEmpty = shouldUseEmptySplashScreen(sourceRecord);
        mSplashScreenStyleEmpty = shouldUseEmptySplashScreen(sourceRecord);


        final int resolvedTheme = evaluateStartingWindowTheme(packageName, theme,
        final int resolvedTheme = evaluateStartingWindowTheme(prev, packageName, theme,
                splashScreenTheme);
                splashScreenTheme);


        final boolean shown = addStartingWindow(packageName, resolvedTheme,
        final boolean shown = addStartingWindow(packageName, resolvedTheme,