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

Commit 9e7c93bc authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Add ActivityOptions API for launching next Task as bubble" into main

parents 7506f7ba b54f2595
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -459,10 +459,15 @@ public class ActivityOptions extends ComponentOptions {
    /** See {@link #setRemoveWithTaskOrganizer(boolean)}. */
    private static final String KEY_REMOVE_WITH_TASK_ORGANIZER =
            "android.activity.removeWithTaskOrganizer";

    /** See {@link #setLaunchedFromBubble(boolean)}. */
    private static final String KEY_LAUNCHED_FROM_BUBBLE =
            "android.activity.launchTypeBubble";

    /** See {@link #setLaunchNextToBubble(boolean)} */
    private static final String KEY_LAUNCH_NEXT_TO_BUBBLE =
            "android.activity.launchNextToBubble";

    /** See {@link #setSplashScreenStyle(int)}. */
    private static final String KEY_SPLASH_SCREEN_STYLE =
            "android.activity.splashScreenStyle";
@@ -584,6 +589,7 @@ public class ActivityOptions extends ComponentOptions {
    private boolean mIsEligibleForLegacyPermissionPrompt;
    private boolean mRemoveWithTaskOrganizer;
    private boolean mLaunchedFromBubble;
    private boolean mLaunchNextToBubble;
    private boolean mTransientLaunch;
    private PictureInPictureParams mLaunchIntoPipParams;
    private boolean mDismissKeyguardIfInsecure;
@@ -1445,6 +1451,7 @@ public class ActivityOptions extends ComponentOptions {
        mSplashScreenThemeResName = opts.getString(KEY_SPLASH_SCREEN_THEME);
        mRemoveWithTaskOrganizer = opts.getBoolean(KEY_REMOVE_WITH_TASK_ORGANIZER);
        mLaunchedFromBubble = opts.getBoolean(KEY_LAUNCHED_FROM_BUBBLE);
        mLaunchNextToBubble = opts.getBoolean(KEY_LAUNCH_NEXT_TO_BUBBLE);
        mTransientLaunch = opts.getBoolean(KEY_TRANSIENT_LAUNCH);
        mSplashScreenStyle = opts.getInt(KEY_SPLASH_SCREEN_STYLE);
        mLaunchIntoPipParams = opts.getParcelable(KEY_LAUNCH_INTO_PIP_PARAMS, android.app.PictureInPictureParams.class);
@@ -2283,6 +2290,23 @@ public class ActivityOptions extends ComponentOptions {
        return mLaunchedFromBubble;
    }

    /**
     * Sets the policy of this launching Task that the new Tasks launched from it will be a Bubble.
     * @hide
     */
    public ActivityOptions setLaunchNextToBubble(boolean launchNextToBubble) {
        mLaunchNextToBubble = launchNextToBubble;
        return this;
    }

    /**
     * @return whether the new Tasks that are launched from this launching Task should be a Bubble.
     * @hide
     */
    public boolean getLaunchNextToBubble() {
        return mLaunchNextToBubble;
    }

    /**
     * Sets whether the activity launch is part of a transient operation. If it is, it will not
     * cause lifecycle changes in existing activities even if it were to occlude them (ie. other
@@ -2602,6 +2626,9 @@ public class ActivityOptions extends ComponentOptions {
        if (mLaunchedFromBubble) {
            b.putBoolean(KEY_LAUNCHED_FROM_BUBBLE, mLaunchedFromBubble);
        }
        if (mLaunchNextToBubble) {
            b.putBoolean(KEY_LAUNCH_NEXT_TO_BUBBLE, mLaunchNextToBubble);
        }
        if (mTransientLaunch) {
            b.putBoolean(KEY_TRANSIENT_LAUNCH, mTransientLaunch);
        }
+2 −1
Original line number Diff line number Diff line
@@ -361,7 +361,8 @@ public class SafeActivityOptions {
        }

        // If launched from bubble is specified, then ensure that the caller is system or sysui.
        if ((options.getLaunchedFromBubble() || options.getTaskAlwaysOnTop())
        if ((options.getLaunchedFromBubble() || options.getTaskAlwaysOnTop()
                || options.getLaunchNextToBubble())
                && !isSystemOrSystemUI(callingPid, callingUid)) {
            final String msg = "Permission Denial: starting " + getIntentString(intent)
                    + " from " + callerApp + " (pid=" + callingPid
+1 −0
Original line number Diff line number Diff line
@@ -301,6 +301,7 @@ public class ActivityOptionsTest {
                case "android:activity.overrideTaskTransition": // KEY_OVERRIDE_TASK_TRANSITION
                case "android.activity.removeWithTaskOrganizer": // KEY_REMOVE_WITH_TASK_ORGANIZER
                case "android.activity.launchTypeBubble": // KEY_LAUNCHED_FROM_BUBBLE
                case "android.activity.launchNextToBubble": // KEY_LAUNCH_NEXT_TO_BUBBLE
                case "android.activity.splashScreenStyle": // KEY_SPLASH_SCREEN_STYLE
                case "android.activity.launchIntoPipParams": // KEY_LAUNCH_INTO_PIP_PARAMS
                case "android.activity.dismissKeyguardIfInsecure": // KEY_DISMISS_KEYGUARD_IF_INSECURE