[RESTRICT AUTOMERGE]Fix launching app from work profile cannot show splash screen.
Unable to find resource if the application is installed from work profile, which cause the splash screen window cannot build up normally. Bug: 179819075 Test: atest ActivityRecordTests Change-Id: I1bfd48fc32d549feee687c56fe9cdbcae789813f
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user