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

Commit 41e7f367 authored by Issei Suzuki's avatar Issei Suzuki Committed by Android (Google) Code Review
Browse files

Merge "Persist Theme name instead of ID for ShortcutInfo" into sc-dev

parents 04350c57 42d42335
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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();
+18 −15
Original line number Diff line number Diff line
@@ -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;
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -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);

+4 −5
Original line number Diff line number Diff line
@@ -1000,16 +1000,15 @@ public class LauncherAppsService extends SystemService {
            intents[0].setSourceBounds(sourceBounds);

            // Replace theme for splash screen
            final int splashScreenThemeResId =
                    mShortcutServiceInternal.getShortcutStartingThemeResId(getCallingUserId(),
            final String splashScreenThemeResName =
                    mShortcutServiceInternal.getShortcutStartingThemeResName(getCallingUserId(),
                            callingPackage, packageName, shortcutId, targetUserId);
            if (splashScreenThemeResId != 0) {
            if (splashScreenThemeResName != null && !splashScreenThemeResName.isEmpty()) {
                if (startActivityOptions == null) {
                    startActivityOptions = new Bundle();
                }
                startActivityOptions.putInt(KEY_SPLASH_SCREEN_THEME, splashScreenThemeResId);
                startActivityOptions.putString(KEY_SPLASH_SCREEN_THEME, splashScreenThemeResName);
            }

            return startShortcutIntentsAsPublisher(
                    intents, packageName, featureId, startActivityOptions, targetUserId);
        }
Loading