diff options
Diffstat (limited to 'core/java/android')
4 files changed, 27 insertions, 23 deletions
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java index 1ce598b5fa18..8e1f263ebf03 100644 --- a/core/java/android/app/ActivityOptions.java +++ b/core/java/android/app/ActivityOptions.java @@ -419,7 +419,7 @@ public class ActivityOptions { private IBinder mLaunchCookie; private IRemoteTransition mRemoteTransition; private boolean mOverrideTaskTransition; - private int mSplashScreenThemeResId; + private String mSplashScreenThemeResName; @SplashScreen.SplashScreenStyle private int mSplashScreenStyle; private boolean mRemoveWithTaskOrganizer; @@ -1174,7 +1174,7 @@ public class ActivityOptions { mRemoteTransition = IRemoteTransition.Stub.asInterface(opts.getBinder( KEY_REMOTE_TRANSITION)); mOverrideTaskTransition = opts.getBoolean(KEY_OVERRIDE_TASK_TRANSITION); - mSplashScreenThemeResId = opts.getInt(KEY_SPLASH_SCREEN_THEME); + mSplashScreenThemeResName = opts.getString(KEY_SPLASH_SCREEN_THEME); mRemoveWithTaskOrganizer = opts.getBoolean(KEY_REMOVE_WITH_TASK_ORGANIZER); mLaunchedFromBubble = opts.getBoolean(KEY_LAUNCHED_FROM_BUBBLE); mTransientLaunch = opts.getBoolean(KEY_TRANSIENT_LAUNCH); @@ -1368,8 +1368,9 @@ public class ActivityOptions { * Gets whether the activity want to be launched as other theme for the splash screen. * @hide */ - public int getSplashScreenThemeResId() { - return mSplashScreenThemeResId; + @Nullable + public String getSplashScreenThemeResName() { + return mSplashScreenThemeResName; } /** @@ -1945,8 +1946,8 @@ public class ActivityOptions { if (mOverrideTaskTransition) { b.putBoolean(KEY_OVERRIDE_TASK_TRANSITION, mOverrideTaskTransition); } - if (mSplashScreenThemeResId != 0) { - b.putInt(KEY_SPLASH_SCREEN_THEME, mSplashScreenThemeResId); + if (mSplashScreenThemeResName != null && !mSplashScreenThemeResName.isEmpty()) { + b.putString(KEY_SPLASH_SCREEN_THEME, mSplashScreenThemeResName); } if (mRemoveWithTaskOrganizer) { b.putBoolean(KEY_REMOVE_WITH_TASK_ORGANIZER, mRemoveWithTaskOrganizer); diff --git a/core/java/android/content/pm/AppSearchShortcutInfo.java b/core/java/android/content/pm/AppSearchShortcutInfo.java index 63f93bfa24e5..806091e2158d 100644 --- a/core/java/android/content/pm/AppSearchShortcutInfo.java +++ b/core/java/android/content/pm/AppSearchShortcutInfo.java @@ -423,7 +423,7 @@ public class AppSearchShortcutInfo extends GenericDocument { shortLabelResName, longLabel, longLabelResId, longLabelResName, disabledMessage, disabledMessageResId, disabledMessageResName, categoriesSet, intents, rank, extras, getCreationTimestampMillis(), flags, iconResId, iconResName, bitmapPath, iconUri, - disabledReason, persons, locusId, 0); + disabledReason, persons, locusId, null); si.setImplicitRank(implicitRank); if ((implicitRank & ShortcutInfo.RANK_CHANGED_BIT) != 0) { si.setRankChanged(); diff --git a/core/java/android/content/pm/ShortcutInfo.java b/core/java/android/content/pm/ShortcutInfo.java index 76712b5ce2dc..a264bebb5d88 100644 --- a/core/java/android/content/pm/ShortcutInfo.java +++ b/core/java/android/content/pm/ShortcutInfo.java @@ -449,7 +449,7 @@ public final class ShortcutInfo implements Parcelable { private int mDisabledReason; - private int mStartingThemeResId; + @Nullable private String mStartingThemeResName; private ShortcutInfo(Builder b) { mUserId = b.mContext.getUserId(); @@ -478,8 +478,9 @@ public final class ShortcutInfo implements Parcelable { mExtras = b.mExtras; mLocusId = b.mLocusId; + mStartingThemeResName = b.mStartingThemeResId != 0 + ? b.mContext.getResources().getResourceName(b.mStartingThemeResId) : null; updateTimestamp(); - mStartingThemeResId = b.mStartingThemeResId; } /** @@ -626,7 +627,7 @@ public final class ShortcutInfo implements Parcelable { // Set this bit. mFlags |= FLAG_KEY_FIELDS_ONLY; } - mStartingThemeResId = source.mStartingThemeResId; + mStartingThemeResName = source.mStartingThemeResName; } /** @@ -950,8 +951,8 @@ public final class ShortcutInfo implements Parcelable { if (source.mLocusId != null) { mLocusId = source.mLocusId; } - if (source.mStartingThemeResId != 0) { - mStartingThemeResId = source.mStartingThemeResId; + if (source.mStartingThemeResName != null && !source.mStartingThemeResName.isEmpty()) { + mStartingThemeResName = source.mStartingThemeResName; } } @@ -1454,11 +1455,12 @@ public final class ShortcutInfo implements Parcelable { } /** - * Returns the theme resource id used for the splash screen. + * Returns the theme resource name used for the splash screen. * @hide */ - public int getStartingThemeResId() { - return mStartingThemeResId; + @Nullable + public String getStartingThemeResName() { + return mStartingThemeResName; } /** @hide -- old signature, the internal code still uses it. */ @@ -2182,7 +2184,7 @@ public final class ShortcutInfo implements Parcelable { mPersons = source.readParcelableArray(cl, Person.class); mLocusId = source.readParcelable(cl); mIconUri = source.readString8(); - mStartingThemeResId = source.readInt(); + mStartingThemeResName = source.readString8(); } @Override @@ -2234,7 +2236,7 @@ public final class ShortcutInfo implements Parcelable { dest.writeParcelableArray(mPersons, flags); dest.writeParcelable(mLocusId, flags); dest.writeString8(mIconUri); - dest.writeInt(mStartingThemeResId); + dest.writeString8(mStartingThemeResName); } public static final @NonNull Creator<ShortcutInfo> CREATOR = @@ -2391,10 +2393,10 @@ public final class ShortcutInfo implements Parcelable { sb.append("disabledReason="); sb.append(getDisabledReasonDebugString(mDisabledReason)); - if (mStartingThemeResId != 0) { + if (mStartingThemeResName != null && !mStartingThemeResName.isEmpty()) { addIndentOrComma(sb, indent); - sb.append("SplashScreenThemeResId="); - sb.append(Integer.toHexString(mStartingThemeResId)); + sb.append("SplashScreenThemeResName="); + sb.append(mStartingThemeResName); } addIndentOrComma(sb, indent); @@ -2482,7 +2484,8 @@ public final class ShortcutInfo implements Parcelable { Set<String> categories, Intent[] intentsWithExtras, int rank, PersistableBundle extras, long lastChangedTimestamp, int flags, int iconResId, String iconResName, String bitmapPath, String iconUri, - int disabledReason, Person[] persons, LocusId locusId, int startingThemeResId) { + int disabledReason, Person[] persons, LocusId locusId, + @Nullable String startingThemeResName) { mUserId = userId; mId = id; mPackageName = packageName; @@ -2511,6 +2514,6 @@ public final class ShortcutInfo implements Parcelable { mDisabledReason = disabledReason; mPersons = persons; mLocusId = locusId; - mStartingThemeResId = startingThemeResId; + mStartingThemeResName = startingThemeResName; } } diff --git a/core/java/android/content/pm/ShortcutServiceInternal.java b/core/java/android/content/pm/ShortcutServiceInternal.java index 233abf36131b..3ed5c6457fa5 100644 --- a/core/java/android/content/pm/ShortcutServiceInternal.java +++ b/core/java/android/content/pm/ShortcutServiceInternal.java @@ -74,7 +74,7 @@ public abstract class ShortcutServiceInternal { /** * Get the theme res ID of the starting window, it can be 0 if not specified. */ - public abstract int getShortcutStartingThemeResId(int launcherUserId, + public abstract @Nullable String getShortcutStartingThemeResName(int launcherUserId, @NonNull String callingPackage, @NonNull String packageName, @NonNull String shortcutId, int userId); |
