Merge "Bubble API: intent extra for bubbled activities" into sc-dev

This commit is contained in:
Mady Mellor
2021-02-11 00:35:56 +00:00
committed by Android (Google) Code Review
5 changed files with 32 additions and 1 deletions

View File

@@ -10980,6 +10980,7 @@ 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";

View File

@@ -9972,6 +9972,15 @@ public class Notification implements Parcelable
* <p>The shortcut activity will be used when the bubble is expanded. This will display
* the shortcut activity in a floating window over the existing foreground activity.</p>
*
* <p>When the shortcut is displayed in a bubble, there will be an intent
* extra set on the activity, {@link Intent#EXTRA_IS_BUBBLED}
* with {@code true}. You may check this in the onCreate of your activity via:
*
* <pre class="prettyprint">
* boolean isBubbled = getIntent().getBooleanExtra(Intent.EXTRA_IS_BUBBLED, false);
* </pre>
* </p>
*
* <p>If the shortcut has not been published when the bubble notification is sent,
* no bubble will be produced. If the shortcut is deleted while the bubble is active,
* the bubble will be removed.</p>
@@ -10000,6 +10009,15 @@ public class Notification implements Parcelable
* app content in a floating window over the existing foreground activity. The intent
* should point to a resizable activity. </p>
*
* <p>When the activity is displayed in a bubble, there will be an intent
* extra set on the activity, {@link Intent#EXTRA_IS_BUBBLED}
* with {@code true}. You may check this in the onCreate of your activity via:
*
* <pre class="prettyprint">
* boolean isBubbled = getIntent().getBooleanExtra(Intent.EXTRA_IS_BUBBLED, false);
* </pre>
* </p>
*
* @throws NullPointerException if intent is null.
* @throws NullPointerException if icon is null.
*/

View File

@@ -5718,7 +5718,7 @@ public class Intent implements Parcelable, Cloneable {
public static final String EXTRA_BUG_REPORT = "android.intent.extra.BUG_REPORT";
/**
* Used in the extra field in the remote intent. It's astring token passed with the
* Used in the extra field in the remote intent. It's a string token passed with the
* remote intent.
*/
public static final String EXTRA_REMOTE_INTENT_TOKEN =
@@ -6062,6 +6062,16 @@ public class Intent implements Parcelable, Cloneable {
*/
public static final String EXTRA_UNSTARTABLE_REASON = "android.intent.extra.UNSTARTABLE_REASON";
/**
* A boolean extra indicating whether an activity is bubbled. Set on the shortcut or
* pending intent provided for the bubble. If the extra is not present or false, then it is not
* bubbled.
*
* @see android.app.Notification.Builder#setBubbleMetadata(Notification.BubbleMetadata)
* @see android.app.Notification.BubbleMetadata.Builder#Builder(String)
*/
public static final String EXTRA_IS_BUBBLED = "android.intent.extra.IS_BUBBLED";
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Intent flags (see mFlags variable).

View File

@@ -163,6 +163,7 @@ public class BubbleExpandedView extends LinearLayout {
// Apply flags to make behaviour match documentLaunchMode=always.
fillInIntent.addFlags(FLAG_ACTIVITY_NEW_DOCUMENT);
fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK);
fillInIntent.putExtra(Intent.EXTRA_IS_BUBBLED, true);
if (mBubble != null) {
mBubble.setIntentActive();
}

View File

@@ -929,6 +929,7 @@ public class LauncherAppsService extends SystemService {
// Flag for bubble to make behaviour match documentLaunchMode=always.
intents[0].addFlags(FLAG_ACTIVITY_NEW_DOCUMENT);
intents[0].addFlags(FLAG_ACTIVITY_MULTIPLE_TASK);
intents[0].putExtra(Intent.EXTRA_IS_BUBBLED, true);
}
intents[0].addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);