Follow-up to multiple intents support am: 0eed441c0c
am: b6ed7b7552
Change-Id: I1034eaa7670c7fa983ddffcce295979ec86bde89
This commit is contained in:
@@ -941,7 +941,8 @@ public final class ShortcutInfo implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the intent of a shortcut.
|
||||
* Sets the intent of a shortcut. Alternatively, {@link #setIntents(Intent[])} can be used
|
||||
* to launch an activity with other activities in the back stack.
|
||||
*
|
||||
* <p>This is a mandatory field when publishing a new shortcut with
|
||||
* {@link ShortcutManager#addDynamicShortcuts(List)} or
|
||||
@@ -965,7 +966,9 @@ public final class ShortcutInfo implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets multiple intents instead of a single intent.
|
||||
* Sets multiple intents instead of a single intent, in order to launch an activity with
|
||||
* other activities in back stack. Use {@link TaskStackBuilder} to build intents.
|
||||
* See the {@link ShortcutManager} javadoc for details.
|
||||
*
|
||||
* @see Builder#setIntent(Intent)
|
||||
* @see ShortcutInfo#getIntents()
|
||||
|
||||
@@ -18,6 +18,7 @@ package android.content.pm;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.TestApi;
|
||||
import android.annotation.UserIdInt;
|
||||
import android.app.Activity;
|
||||
import android.app.usage.UsageStatsManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -30,7 +31,7 @@ import com.android.internal.annotations.VisibleForTesting;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ShortcutManager manages "launcher shortcuts" (or simply "shortcuts"). Shortcuts provide user
|
||||
* ShortcutManager manages "launcher shortcuts" (or simply "shortcuts"). Shortcuts provide users
|
||||
* with quick
|
||||
* ways to access activities other than the main activity from the launcher to users. For example,
|
||||
* an email application may publish the "compose new email" action which will directly open the
|
||||
@@ -183,6 +184,7 @@ import java.util.List;
|
||||
* android:action="android.intent.action.VIEW"
|
||||
* android:targetPackage="com.example.myapplication"
|
||||
* android:targetClass="com.example.myapplication.ComposeActivity" />
|
||||
* <!-- more intents can go here; see below -->
|
||||
* <categories android:name="android.shortcut.conversation" />
|
||||
* </shortcut>
|
||||
* <!-- more shortcut can go here -->
|
||||
@@ -209,9 +211,37 @@ import java.util.List;
|
||||
*
|
||||
* <li>{@code intent} Intent to launch. {@code android:action} is mandatory.
|
||||
* See <a href="{@docRoot}guide/topics/ui/settings.html#Intents">Using intents</a> for the
|
||||
* other supported tags.
|
||||
* other supported tags. Multiple intents can be provided for a single shortcut, so that
|
||||
* an activity will be launched with other activities in the back stack.
|
||||
* See {@link android.app.TaskStackBuilder} for details.
|
||||
* </ul>
|
||||
*
|
||||
* <h3>Shortcut Intents</h3>
|
||||
* Dynamic shortcuts can be published with any {@link Intent#addFlags Intent flags}. Typically,
|
||||
* {@link Intent#FLAG_ACTIVITY_CLEAR_TASK} is specified possibly with other flags; otherwise,
|
||||
* if the application is already running, the application is simply brought to the foreground
|
||||
* and the target activity may not show up.
|
||||
*
|
||||
* <p>{@link ShortcutInfo.Builder#setIntents(Intent[])} can be used (instead of
|
||||
* {@link ShortcutInfo.Builder#setIntent(Intent)}) with
|
||||
* {@link android.app.TaskStackBuilder} in order to launch an activity with other activities
|
||||
* in the back stack, so that when the user presses the back key, a "parent" activity will be shown
|
||||
* instead of the user being navigated back to the launcher.
|
||||
*
|
||||
* <p>Manifest shortcuts can have multiple intents too to achieve the same effect. In order to
|
||||
* specify multiple {@link Intent}s to a shortcut, simply list multiple <intent>s within
|
||||
* a single <shortcut>. The last intent is what the user will see when a shortcut is
|
||||
* launched.
|
||||
*
|
||||
* <p>Manifest shortcuts <b>cannot</b> have custom intent flags. The first intent of a manifest
|
||||
* shortcut will always have {@link Intent#FLAG_ACTIVITY_NEW_TASK} and
|
||||
* {@link Intent#FLAG_ACTIVITY_CLEAR_TASK} set. This means, when the application is already
|
||||
* running, all the existing activities will be destroyed when a manifest shortcut is launched.
|
||||
* If this behavior is not desirable, one can use a "trampoline" activity (an activity
|
||||
* that starts another activity in {@link Activity#onCreate} and then calls
|
||||
* {@link Activity#finish()}) with {@code android:taskAffinity=""} in AndroidManifest.xml and point
|
||||
* at this activity in a manifest shortcut's intent.
|
||||
*
|
||||
* <h3>Updating Shortcuts v.s. Re-publishing New One with Different ID</h3>
|
||||
* In order to avoid users' confusion, {@link #updateShortcuts(List)} should not be used to update
|
||||
* a shortcut to something that is conceptually different.
|
||||
@@ -267,6 +297,8 @@ import java.util.List;
|
||||
* <li>When the user performs "inline reply" on a notification.
|
||||
* </ul>
|
||||
*
|
||||
* <p>When rate-limiting is active, {@link #isRateLimitingActive()} returns {@code true}.
|
||||
*
|
||||
* <h4>Resetting rate-limiting for testing</h4>
|
||||
*
|
||||
* If your application is rate-limited during development or testing, you can use the
|
||||
|
||||
Reference in New Issue
Block a user