diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 3c42e930389bd..1e50d645e6d6d 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -2292,9 +2292,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; } @@ -2321,10 +2321,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); } } diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java index b9431a6968f9f..cffeaf3f47679 100644 --- a/services/core/java/com/android/server/policy/WindowManagerPolicy.java +++ b/services/core/java/com/android/server/policy/WindowManagerPolicy.java @@ -933,9 +933,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); + 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); /** * Set or clear a window which can behave as the keyguard. diff --git a/services/core/java/com/android/server/wm/SplashScreenStartingData.java b/services/core/java/com/android/server/wm/SplashScreenStartingData.java index 726b7dac69389..f77df2fc06c91 100644 --- a/services/core/java/com/android/server/wm/SplashScreenStartingData.java +++ b/services/core/java/com/android/server/wm/SplashScreenStartingData.java @@ -53,8 +53,8 @@ class SplashScreenStartingData extends StartingData { @Override StartingSurface createStartingSurface(ActivityRecord activity) { - return mService.mPolicy.addSplashScreen(activity.token, mPkg, mTheme, mCompatInfo, - mNonLocalizedLabel, mLabelRes, mIcon, mLogo, mWindowFlags, + return mService.mPolicy.addSplashScreen(activity.token, activity.mUserId, mPkg, mTheme, + mCompatInfo, mNonLocalizedLabel, mLabelRes, mIcon, mLogo, mWindowFlags, mMergedOverrideConfiguration, activity.getDisplayContent().getDisplayId()); } } diff --git a/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java b/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java index 4a8e8dafb57db..979bbdad250b2 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java +++ b/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java @@ -109,9 +109,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();