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

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

Merge "Fix launching app from work profile cannot show splash screen." into sc-dev am: 3a84db48

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If73517c7c9b06335966324586c7f82deb115cef9
parents 2ebe0982 3a84db48
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.graphics.drawable.ColorDrawable;
import android.hardware.display.DisplayManager;
import android.os.IBinder;
import android.os.SystemClock;
import android.os.UserHandle;
import android.util.Slog;
import android.util.SparseArray;
import android.view.Display;
@@ -149,11 +150,12 @@ public class StartingSurfaceDrawer {
        context = displayContext;
        if (theme != context.getThemeResId() || labelRes != 0) {
            try {
                context = context.createPackageContext(
                        activityInfo.packageName, CONTEXT_RESTRICTED);
                context = context.createPackageContextAsUser(activityInfo.packageName,
                        CONTEXT_RESTRICTED, UserHandle.of(taskInfo.userId));
                context.setTheme(theme);
            } catch (PackageManager.NameNotFoundException e) {
                // Ignore
                Slog.w(TAG, "Failed creating package context with package name "
                        + activityInfo.packageName + " for user " + taskInfo.userId, e);
            }
        }

+7 −5
Original line number Diff line number Diff line
@@ -2235,9 +2235,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {

    /** {@inheritDoc} */
    @Override
    public StartingSurface addSplashScreen(IBinder appToken, String packageName, int theme,
            CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon,
            int logo, int windowFlags, Configuration overrideConfig, int displayId) {
    public StartingSurface addSplashScreen(IBinder appToken, int userId, String packageName,
            int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
            int icon, int logo, int windowFlags, Configuration overrideConfig, int displayId) {
        if (!SHOW_SPLASH_SCREENS) {
            return null;
        }
@@ -2264,10 +2264,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {

            if (theme != context.getThemeResId() || labelRes != 0) {
                try {
                    context = context.createPackageContext(packageName, CONTEXT_RESTRICTED);
                    context = context.createPackageContextAsUser(packageName, CONTEXT_RESTRICTED,
                            UserHandle.of(userId));
                    context.setTheme(theme);
                } catch (PackageManager.NameNotFoundException e) {
                    // Ignore
                    Slog.w(TAG, "Failed creating package context with package name "
                            + packageName + " for user " + userId, e);
                }
            }

+3 −3
Original line number Diff line number Diff line
@@ -714,9 +714,9 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
     * @return The starting surface.
     *
     */
    public StartingSurface addSplashScreen(IBinder appToken, String packageName, int theme,
            CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon,
            int logo, int windowFlags, Configuration overrideConfig, int displayId);
    StartingSurface addSplashScreen(IBinder appToken, int userId, String packageName,
            int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
            int icon, int logo, int windowFlags, Configuration overrideConfig, int displayId);

    /**
     * Set or clear a window which can behave as the keyguard.
+2 −2
Original line number Diff line number Diff line
@@ -52,8 +52,8 @@ public class StartingSurfaceController {
            int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
            int icon, int logo, int windowFlags, Configuration overrideConfig, int displayId) {
        if (!DEBUG_ENABLE_SHELL_DRAWER) {
            return mService.mPolicy.addSplashScreen(activity.token, packageName, theme,
                    compatInfo, nonLocalizedLabel, labelRes, icon, logo, windowFlags,
            return mService.mPolicy.addSplashScreen(activity.token, activity.mUserId, packageName,
                    theme, compatInfo, nonLocalizedLabel, labelRes, icon, logo, windowFlags,
                    overrideConfig, displayId);
        }

+3 −3
Original line number Diff line number Diff line
@@ -100,9 +100,9 @@ class TestWindowManagerPolicy implements WindowManagerPolicy {
    }

    @Override
    public StartingSurface addSplashScreen(IBinder appToken, String packageName, int theme,
            CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon,
            int logo, int windowFlags, Configuration overrideConfig, int displayId) {
    public StartingSurface addSplashScreen(IBinder appToken, int userId, String packageName,
            int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
            int icon, int logo, int windowFlags, Configuration overrideConfig, int displayId) {
        final com.android.server.wm.WindowState window;
        final ActivityRecord activity;
        final WindowManagerService wm = mWmSupplier.get();