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

Commit 02b75bb4 authored by Mady Mellor's avatar Mady Mellor Committed by Android (Google) Code Review
Browse files

Merge "API Update: extra_is_bubbled -> Activity#isLaunchedFromBubble" into sc-dev

parents 7d9605d7 8693eabf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3960,6 +3960,7 @@ package android.app {
    method public boolean isImmersive();
    method public boolean isInMultiWindowMode();
    method public boolean isInPictureInPictureMode();
    method public boolean isLaunchedFromBubble();
    method public boolean isLocalVoiceInteractionSupported();
    method public boolean isTaskRoot();
    method public boolean isVoiceInteraction();
@@ -11222,7 +11223,6 @@ package android.content {
    field public static final String EXTRA_INITIAL_INTENTS = "android.intent.extra.INITIAL_INTENTS";
    field public static final String EXTRA_INSTALLER_PACKAGE_NAME = "android.intent.extra.INSTALLER_PACKAGE_NAME";
    field public static final String EXTRA_INTENT = "android.intent.extra.INTENT";
    field public static final String EXTRA_IS_BUBBLED = "android.intent.extra.IS_BUBBLED";
    field public static final String EXTRA_KEY_EVENT = "android.intent.extra.KEY_EVENT";
    field public static final String EXTRA_LOCAL_ONLY = "android.intent.extra.LOCAL_ONLY";
    field public static final String EXTRA_LOCUS_ID = "android.intent.extra.LOCUS_ID";
+1 −0
Original line number Diff line number Diff line
@@ -137,6 +137,7 @@ package android.app {
    method public void setLaunchActivityType(int);
    method public void setLaunchTaskId(int);
    method public void setLaunchWindowingMode(int);
    method public void setLaunchedFromBubble(boolean);
    method public void setTaskAlwaysOnTop(boolean);
    method public void setTaskOverlay(boolean, boolean);
  }
+22 −0
Original line number Diff line number Diff line
@@ -899,6 +899,9 @@ public class Activity extends ContextThemeWrapper
    /** The options for scene transition. */
    ActivityOptions mPendingOptions;

    /** Whether this activity was launched from a bubble. **/
    boolean mLaunchedFromBubble;

    private static final class ManagedCursor {
        ManagedCursor(Cursor cursor) {
            mCursor = cursor;
@@ -6790,6 +6793,25 @@ public class Activity extends ContextThemeWrapper
        return getSharedPreferences(getLocalClassName(), mode);
    }

    /**
     * Indicates whether this activity is launched from a bubble. A bubble is a floating shortcut
     * on the screen that expands to show an activity.
     *
     * If your activity can be used normally or as a bubble, you might use this method to check
     * if the activity is bubbled to modify any behaviour that might be different between the
     * normal activity and the bubbled activity. For example, if you normally cancel the
     * notification associated with the activity when you open the activity, you might not want to
     * do that when you're bubbled as that would remove the bubble.
     *
     * @return {@code true} if the activity is launched from a bubble.
     *
     * @see Notification.Builder#setBubbleMetadata(Notification.BubbleMetadata)
     * @see Notification.BubbleMetadata.Builder#Builder(String)
     */
    public boolean isLaunchedFromBubble() {
        return mLaunchedFromBubble;
    }

    private void ensureSearchManager() {
        if (mSearchManager != null) {
            return;
+25 −0
Original line number Diff line number Diff line
@@ -323,6 +323,9 @@ public class ActivityOptions {
    /** 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 #setLaunchCookie
@@ -410,6 +413,7 @@ public class ActivityOptions {
    private boolean mOverrideTaskTransition;
    private int mSplashScreenThemeResId;
    private boolean mRemoveWithTaskOrganizer;
    private boolean mLaunchedFromBubble;

    /**
     * Create an ActivityOptions specifying a custom animation to run when
@@ -1161,6 +1165,7 @@ public class ActivityOptions {
        mOverrideTaskTransition = opts.getBoolean(KEY_OVERRIDE_TASK_TRANSITION);
        mSplashScreenThemeResId = opts.getInt(KEY_SPLASH_SCREEN_THEME);
        mRemoveWithTaskOrganizer = opts.getBoolean(KEY_REMOVE_WITH_TASK_ORGANIZER);
        mLaunchedFromBubble = opts.getBoolean(KEY_LAUNCHED_FROM_BUBBLE);
    }

    /**
@@ -1646,6 +1651,23 @@ public class ActivityOptions {
        return mRemoveWithTaskOrganizer;
    }

    /**
     * Sets whether this activity is launched from a bubble.
     * @hide
     */
    @TestApi
    public void setLaunchedFromBubble(boolean fromBubble) {
        mLaunchedFromBubble = fromBubble;
    }

    /**
     * @return whether the activity was launched from a bubble.
     * @hide
     */
    public boolean getLaunchedFromBubble() {
        return mLaunchedFromBubble;
    }

    /**
     * Update the current values in this ActivityOptions from those supplied
     * in <var>otherOptions</var>.  Any values
@@ -1883,6 +1905,9 @@ public class ActivityOptions {
        if (mRemoveWithTaskOrganizer) {
            b.putBoolean(KEY_REMOVE_WITH_TASK_ORGANIZER, mRemoveWithTaskOrganizer);
        }
        if (mLaunchedFromBubble) {
            b.putBoolean(KEY_LAUNCHED_FROM_BUBBLE, mLaunchedFromBubble);
        }
        return b;
    }

+6 −1
Original line number Diff line number Diff line
@@ -594,6 +594,9 @@ public final class ActivityThread extends ClientTransactionHandler
         */
        FixedRotationAdjustments mPendingFixedRotationAdjustments;

        /** Whether this activiy was launched from a bubble. */
        boolean mLaunchedFromBubble;

        @LifecycleState
        private int mLifecycleState = PRE_ON_CREATE;

@@ -613,7 +616,7 @@ public final class ActivityThread extends ClientTransactionHandler
                List<ReferrerIntent> pendingNewIntents, ActivityOptions activityOptions,
                boolean isForward, ProfilerInfo profilerInfo, ClientTransactionHandler client,
                IBinder assistToken, FixedRotationAdjustments fixedRotationAdjustments,
                IBinder shareableActivityToken) {
                IBinder shareableActivityToken, boolean launchedFromBubble) {
            this.token = token;
            this.assistToken = assistToken;
            this.shareableActivityToken = shareableActivityToken;
@@ -634,6 +637,7 @@ public final class ActivityThread extends ClientTransactionHandler
                    compatInfo);
            mActivityOptions = activityOptions;
            mPendingFixedRotationAdjustments = fixedRotationAdjustments;
            mLaunchedFromBubble = launchedFromBubble;
            init();
        }

@@ -3549,6 +3553,7 @@ public final class ActivityThread extends ClientTransactionHandler
                    activity.mPendingOptions = r.mActivityOptions;
                    r.mActivityOptions = null;
                }
                activity.mLaunchedFromBubble = r.mLaunchedFromBubble;
                activity.mCalled = false;
                if (r.isPersistable()) {
                    mInstrumentation.callActivityOnCreate(activity, r.state, r.persistentState);
Loading