/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.content; import android.annotation.AnyRes; import android.annotation.IntDef; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SystemApi; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.ComponentInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Rect; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.IBinder; import android.os.Parcel; import android.os.Parcelable; import android.os.Process; import android.os.ResultReceiver; import android.os.ShellCommand; import android.os.StrictMode; import android.os.UserHandle; import android.provider.DocumentsContract; import android.provider.DocumentsProvider; import android.provider.MediaStore; import android.provider.OpenableColumns; import android.util.ArraySet; import android.util.AttributeSet; import android.util.Log; import com.android.internal.util.XmlUtils; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; import java.io.IOException; import java.io.PrintWriter; import java.io.Serializable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Objects; import java.util.Set; import static android.content.ContentProvider.maybeAddUserId; /** * An intent is an abstract description of an operation to be performed. It * can be used with {@link Context#startActivity(Intent) startActivity} to * launch an {@link android.app.Activity}, * {@link android.content.Context#sendBroadcast(Intent) broadcastIntent} to * send it to any interested {@link BroadcastReceiver BroadcastReceiver} components, * and {@link android.content.Context#startService} or * {@link android.content.Context#bindService} to communicate with a * background {@link android.app.Service}. * *
An Intent provides a facility for performing late runtime binding between the code in * different applications. Its most significant use is in the launching of activities, where it * can be thought of as the glue between activities. It is basically a passive data structure * holding an abstract description of an action to be performed.
* *For information about how to create and resolve intents, read the * Intents and Intent Filters * developer guide.
*The primary pieces of information in an intent are:
* *action -- The general action to be performed, such as * {@link #ACTION_VIEW}, {@link #ACTION_EDIT}, {@link #ACTION_MAIN}, * etc.
*data -- The data to operate on, such as a person record * in the contacts database, expressed as a {@link android.net.Uri}.
*Some examples of action/data pairs are:
* *{@link #ACTION_VIEW} content://contacts/people/1 -- Display * information about the person whose identifier is "1".
*{@link #ACTION_DIAL} content://contacts/people/1 -- Display * the phone dialer with the person filled in.
*{@link #ACTION_VIEW} tel:123 -- Display * the phone dialer with the given number filled in. Note how the * VIEW action does what is considered the most reasonable thing for * a particular URI.
*{@link #ACTION_DIAL} tel:123 -- Display * the phone dialer with the given number filled in.
*{@link #ACTION_EDIT} content://contacts/people/1 -- Edit * information about the person whose identifier is "1".
*{@link #ACTION_VIEW} content://contacts/people/ -- Display * a list of people, which the user can browse through. This example is a * typical top-level entry into the Contacts application, showing you the * list of people. Selecting a particular person to view would result in a * new intent { {@link #ACTION_VIEW} content://contacts/N } * being used to start an activity to display that person.
*In addition to these primary attributes, there are a number of secondary * attributes that you can also include with an intent:
* *category -- Gives additional information about the action * to execute. For example, {@link #CATEGORY_LAUNCHER} means it should * appear in the Launcher as a top-level application, while * {@link #CATEGORY_ALTERNATIVE} means it should be included in a list * of alternative actions the user can perform on a piece of data.
*type -- Specifies an explicit type (a MIME type) of the * intent data. Normally the type is inferred from the data itself. * By setting this attribute, you disable that evaluation and force * an explicit type.
*component -- Specifies an explicit name of a component * class to use for the intent. Normally this is determined by looking * at the other information in the intent (the action, data/type, and * categories) and matching that with a component that can handle it. * If this attribute is set then none of the evaluation is performed, * and this component is used exactly as is. By specifying this attribute, * all of the other Intent attributes become optional.
*extras -- This is a {@link Bundle} of any additional information. * This can be used to provide extended information to the component. * For example, if we have a action to send an e-mail message, we could * also include extra pieces of data here to supply a subject, body, * etc.
*Here are some examples of other operations you can specify as intents * using these additional parameters:
* *{@link #ACTION_MAIN} with category {@link #CATEGORY_HOME} -- * Launch the home screen.
*{@link #ACTION_GET_CONTENT} with MIME type * {@link android.provider.Contacts.Phones#CONTENT_URI * vnd.android.cursor.item/phone} * -- Display the list of people's phone numbers, allowing the user to * browse through them and pick one and return it to the parent activity.
*{@link #ACTION_GET_CONTENT} with MIME type * *{@literal /}* and category {@link #CATEGORY_OPENABLE} * -- Display all pickers for data that can be opened with * {@link ContentResolver#openInputStream(Uri) ContentResolver.openInputStream()}, * allowing the user to pick one of them and then some data inside of it * and returning the resulting URI to the caller. This can be used, * for example, in an e-mail application to allow the user to pick some * data to include as an attachment.
*There are a variety of standard Intent action and category constants * defined in the Intent class, but applications can also define their own. * These strings use Java-style scoping, to ensure they are unique -- for * example, the standard {@link #ACTION_VIEW} is called * "android.intent.action.VIEW".
* *Put together, the set of actions, data types, categories, and extra data * defines a language for the system allowing for the expression of phrases * such as "call john smith's cell". As applications are added to the system, * they can extend this language by adding new actions, types, and categories, or * they can modify the behavior of existing phrases by supplying their own * activities that handle them.
* * *There are two primary forms of intents you will use. * *
Explicit Intents have specified a component (via * {@link #setComponent} or {@link #setClass}), which provides the exact * class to be run. Often these will not include any other information, * simply being a way for an application to launch various internal * activities it has as the user interacts with the application. * *
Implicit Intents have not specified a component; * instead, they must include enough information for the system to * determine which of the available components is best to run for that * intent. *
When using implicit intents, given such an arbitrary intent we need to * know what to do with it. This is handled by the process of Intent * resolution, which maps an Intent to an {@link android.app.Activity}, * {@link BroadcastReceiver}, or {@link android.app.Service} (or sometimes two or * more activities/receivers) that can handle it.
* *The intent resolution mechanism basically revolves around matching an * Intent against all of the <intent-filter> descriptions in the * installed application packages. (Plus, in the case of broadcasts, any {@link BroadcastReceiver} * objects explicitly registered with {@link Context#registerReceiver}.) More * details on this can be found in the documentation on the {@link * IntentFilter} class.
* *There are three pieces of information in the Intent that are used for
* resolution: the action, type, and category. Using this information, a query
* is done on the {@link PackageManager} for a component that can handle the
* intent. The appropriate component is determined based on the intent
* information supplied in the AndroidManifest.xml
file as
* follows:
The action, if given, must be listed by the component as * one it handles.
*The type is retrieved from the Intent's data, if not * already supplied in the Intent. Like the action, if a type is * included in the intent (either explicitly or implicitly in its * data), then this must be listed by the component as one it handles.
*content:
URI and where no explicit
* type is included in the Intent, instead the scheme of the
* intent data (such as http:
or mailto:
) is
* considered. Again like the action, if we are matching a scheme it
* must be listed by the component as one it can handle.
* The categories, if supplied, must all be listed * by the activity as categories it handles. That is, if you include * the categories {@link #CATEGORY_LAUNCHER} and * {@link #CATEGORY_ALTERNATIVE}, then you will only resolve to components * with an intent that lists both of those categories. * Activities will very often need to support the * {@link #CATEGORY_DEFAULT} so that they can be found by * {@link Context#startActivity Context.startActivity()}.
*For example, consider the Note Pad sample application that * allows user to browse through a list of notes data and view details about * individual items. Text in italics indicate places were you would replace a * name with one specific to your own package.
* *<manifest xmlns:android="http://schemas.android.com/apk/res/android" * package="com.android.notepad"> * <application android:icon="@drawable/app_notes" * android:label="@string/app_name"> * * <provider class=".NotePadProvider" * android:authorities="com.google.provider.NotePad" /> * * <activity class=".NotesList" android:label="@string/title_notes_list"> * <intent-filter> * <action android:name="android.intent.action.MAIN" /> * <category android:name="android.intent.category.LAUNCHER" /> * </intent-filter> * <intent-filter> * <action android:name="android.intent.action.VIEW" /> * <action android:name="android.intent.action.EDIT" /> * <action android:name="android.intent.action.PICK" /> * <category android:name="android.intent.category.DEFAULT" /> * <data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /> * </intent-filter> * <intent-filter> * <action android:name="android.intent.action.GET_CONTENT" /> * <category android:name="android.intent.category.DEFAULT" /> * <data android:mimeType="vnd.android.cursor.item/vnd.google.note" /> * </intent-filter> * </activity> * * <activity class=".NoteEditor" android:label="@string/title_note"> * <intent-filter android:label="@string/resolve_edit"> * <action android:name="android.intent.action.VIEW" /> * <action android:name="android.intent.action.EDIT" /> * <category android:name="android.intent.category.DEFAULT" /> * <data android:mimeType="vnd.android.cursor.item/vnd.google.note" /> * </intent-filter> * * <intent-filter> * <action android:name="android.intent.action.INSERT" /> * <category android:name="android.intent.category.DEFAULT" /> * <data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /> * </intent-filter> * * </activity> * * <activity class=".TitleEditor" android:label="@string/title_edit_title" * android:theme="@android:style/Theme.Dialog"> * <intent-filter android:label="@string/resolve_title"> * <action android:name="com.android.notepad.action.EDIT_TITLE" /> * <category android:name="android.intent.category.DEFAULT" /> * <category android:name="android.intent.category.ALTERNATIVE" /> * <category android:name="android.intent.category.SELECTED_ALTERNATIVE" /> * <data android:mimeType="vnd.android.cursor.item/vnd.google.note" /> * </intent-filter> * </activity> * * </application> * </manifest>* *
The first activity,
* com.android.notepad.NotesList
, serves as our main
* entry into the app. It can do three things as described by its three intent
* templates:
*
* <intent-filter> * <action android:name="{@link #ACTION_MAIN android.intent.action.MAIN}" /> * <category android:name="{@link #CATEGORY_LAUNCHER android.intent.category.LAUNCHER}" /> * </intent-filter>*
This provides a top-level entry into the NotePad application: the standard * MAIN action is a main entry point (not requiring any other information in * the Intent), and the LAUNCHER category says that this entry point should be * listed in the application launcher.
** <intent-filter> * <action android:name="{@link #ACTION_VIEW android.intent.action.VIEW}" /> * <action android:name="{@link #ACTION_EDIT android.intent.action.EDIT}" /> * <action android:name="{@link #ACTION_PICK android.intent.action.PICK}" /> * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> * <data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /> * </intent-filter>*
This declares the things that the activity can do on a directory of
* notes. The type being supported is given with the <type> tag, where
* vnd.android.cursor.dir/vnd.google.note
is a URI from which
* a Cursor of zero or more items (vnd.android.cursor.dir
) can
* be retrieved which holds our note pad data (vnd.google.note
).
* The activity allows the user to view or edit the directory of data (via
* the VIEW and EDIT actions), or to pick a particular note and return it
* to the caller (via the PICK action). Note also the DEFAULT category
* supplied here: this is required for the
* {@link Context#startActivity Context.startActivity} method to resolve your
* activity when its component name is not explicitly specified.
* <intent-filter> * <action android:name="{@link #ACTION_GET_CONTENT android.intent.action.GET_CONTENT}" /> * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> * <data android:mimeType="vnd.android.cursor.item/vnd.google.note" /> * </intent-filter>*
This filter describes the ability to return to the caller a note selected by
* the user without needing to know where it came from. The data type
* vnd.android.cursor.item/vnd.google.note
is a URI from which
* a Cursor of exactly one (vnd.android.cursor.item
) item can
* be retrieved which contains our note pad data (vnd.google.note
).
* The GET_CONTENT action is similar to the PICK action, where the activity
* will return to its caller a piece of data selected by the user. Here,
* however, the caller specifies the type of data they desire instead of
* the type of data the user will be picking from.
Given these capabilities, the following intents will resolve to the * NotesList activity:
* *{ action=android.app.action.MAIN } matches all of the * activities that can be used as top-level entry points into an * application.
*{ action=android.app.action.MAIN, * category=android.app.category.LAUNCHER } is the actual intent * used by the Launcher to populate its top-level list.
*{ action=android.intent.action.VIEW * data=content://com.google.provider.NotePad/notes } * displays a list of all the notes under * "content://com.google.provider.NotePad/notes", which * the user can browse through and see the details on.
*{ action=android.app.action.PICK * data=content://com.google.provider.NotePad/notes } * provides a list of the notes under * "content://com.google.provider.NotePad/notes", from which * the user can pick a note whose data URL is returned back to the caller.
*{ action=android.app.action.GET_CONTENT * type=vnd.android.cursor.item/vnd.google.note } * is similar to the pick action, but allows the caller to specify the * kind of data they want back so that the system can find the appropriate * activity to pick something of that data type.
*The second activity,
* com.android.notepad.NoteEditor
, shows the user a single
* note entry and allows them to edit it. It can do two things as described
* by its two intent templates:
*
* <intent-filter android:label="@string/resolve_edit"> * <action android:name="{@link #ACTION_VIEW android.intent.action.VIEW}" /> * <action android:name="{@link #ACTION_EDIT android.intent.action.EDIT}" /> * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> * <data android:mimeType="vnd.android.cursor.item/vnd.google.note" /> * </intent-filter>*
The first, primary, purpose of this activity is to let the user interact
* with a single note, as decribed by the MIME type
* vnd.android.cursor.item/vnd.google.note
. The activity can
* either VIEW a note or allow the user to EDIT it. Again we support the
* DEFAULT category to allow the activity to be launched without explicitly
* specifying its component.
* <intent-filter> * <action android:name="{@link #ACTION_INSERT android.intent.action.INSERT}" /> * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> * <data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /> * </intent-filter>*
The secondary use of this activity is to insert a new note entry into * an existing directory of notes. This is used when the user creates a new * note: the INSERT action is executed on the directory of notes, causing * this activity to run and have the user create the new note data which * it then adds to the content provider.
*Given these capabilities, the following intents will resolve to the * NoteEditor activity:
* *{ action=android.intent.action.VIEW * data=content://com.google.provider.NotePad/notes/{ID} } * shows the user the content of note {ID}.
*{ action=android.app.action.EDIT * data=content://com.google.provider.NotePad/notes/{ID} } * allows the user to edit the content of note {ID}.
*{ action=android.app.action.INSERT * data=content://com.google.provider.NotePad/notes } * creates a new, empty note in the notes list at * "content://com.google.provider.NotePad/notes" * and allows the user to edit it. If they keep their changes, the URI * of the newly created note is returned to the caller.
*The last activity,
* com.android.notepad.TitleEditor
, allows the user to
* edit the title of a note. This could be implemented as a class that the
* application directly invokes (by explicitly setting its component in
* the Intent), but here we show a way you can publish alternative
* operations on existing data:
* <intent-filter android:label="@string/resolve_title"> * <action android:name="com.android.notepad.action.EDIT_TITLE" /> * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> * <category android:name="{@link #CATEGORY_ALTERNATIVE android.intent.category.ALTERNATIVE}" /> * <category android:name="{@link #CATEGORY_SELECTED_ALTERNATIVE android.intent.category.SELECTED_ALTERNATIVE}" /> * <data android:mimeType="vnd.android.cursor.item/vnd.google.note" /> * </intent-filter>* *
In the single intent template here, we
* have created our own private action called
* com.android.notepad.action.EDIT_TITLE
which means to
* edit the title of a note. It must be invoked on a specific note
* (data type vnd.android.cursor.item/vnd.google.note
) like the previous
* view and edit actions, but here displays and edits the title contained
* in the note data.
*
*
In addition to supporting the default category as usual, our title editor
* also supports two other standard categories: ALTERNATIVE and
* SELECTED_ALTERNATIVE. Implementing
* these categories allows others to find the special action it provides
* without directly knowing about it, through the
* {@link android.content.pm.PackageManager#queryIntentActivityOptions} method, or
* more often to build dynamic menu items with
* {@link android.view.Menu#addIntentOptions}. Note that in the intent
* template here was also supply an explicit name for the template
* (via android:label="@string/resolve_title"
) to better control
* what the user sees when presented with this activity as an alternative
* action to the data they are viewing.
*
*
Given these capabilities, the following intent will resolve to the * TitleEditor activity:
* *{ action=com.android.notepad.action.EDIT_TITLE * data=content://com.google.provider.NotePad/notes/{ID} } * displays and allows the user to edit the title associated * with note {ID}.
*These are the current standard actions that Intent defines for launching * activities (usually through {@link Context#startActivity}. The most * important, and by far most frequently used, are {@link #ACTION_MAIN} and * {@link #ACTION_EDIT}. * *
These are the current standard actions that Intent defines for receiving * broadcasts (usually through {@link Context#registerReceiver} or a * <receiver> tag in a manifest). * *
These are the current standard categories that can be used to further * clarify an Intent via {@link #addCategory}. * *
These are the current standard fields that can be used as extra data via * {@link #putExtra}. * *
These are the possible flags that can be used in the Intent via * {@link #setFlags} and {@link #addFlags}. See {@link #setFlags} for a list * of all possible flags. */ public class Intent implements Parcelable, Cloneable { private static final String ATTR_ACTION = "action"; private static final String TAG_CATEGORIES = "categories"; private static final String ATTR_CATEGORY = "category"; private static final String TAG_EXTRA = "extra"; private static final String ATTR_TYPE = "type"; private static final String ATTR_COMPONENT = "component"; private static final String ATTR_DATA = "data"; private static final String ATTR_FLAGS = "flags"; // --------------------------------------------------------------------- // --------------------------------------------------------------------- // Standard intent activity actions (see action variable). /** * Activity Action: Start as a main entry point, does not expect to * receive data. *
Input: nothing *
Output: nothing */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_MAIN = "android.intent.action.MAIN"; /** * Activity Action: Display the data to the user. This is the most common * action performed on data -- it is the generic action you can use on * a piece of data to get the most reasonable thing to occur. For example, * when used on a contacts entry it will view the entry; when used on a * mailto: URI it will bring up a compose window filled with the information * supplied by the URI; when used with a tel: URI it will invoke the * dialer. *
Input: {@link #getData} is URI from which to retrieve data. *
Output: nothing. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_VIEW = "android.intent.action.VIEW"; /** * A synonym for {@link #ACTION_VIEW}, the "standard" action that is * performed on a piece of data. */ public static final String ACTION_DEFAULT = ACTION_VIEW; /** * Activity Action: Quick view the data. Launches a quick viewer for * a URI or a list of URIs. *
Activities handling this intent action should handle the vast majority of * MIME types rather than only specific ones. *
Input: {@link #getData} is a mandatory content URI of the item to * preview. {@link #getClipData} contains an optional list of content URIs * if there is more than one item to preview. {@link #EXTRA_INDEX} is an * optional index of the URI in the clip data to show first. *
Output: nothing. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_QUICK_VIEW = "android.intent.action.QUICK_VIEW"; /** * Used to indicate that some piece of data should be attached to some other * place. For example, image data could be attached to a contact. It is up * to the recipient to decide where the data should be attached; the intent * does not specify the ultimate destination. *
Input: {@link #getData} is URI of data to be attached. *
Output: nothing. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_ATTACH_DATA = "android.intent.action.ATTACH_DATA"; /** * Activity Action: Provide explicit editable access to the given data. *
Input: {@link #getData} is URI of data to be edited. *
Output: nothing. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_EDIT = "android.intent.action.EDIT"; /** * Activity Action: Pick an existing item, or insert a new item, and then edit it. *
Input: {@link #getType} is the desired MIME type of the item to create or edit. * The extras can contain type specific data to pass through to the editing/creating * activity. *
Output: The URI of the item that was picked. This must be a content: * URI so that any receiver can access it. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_INSERT_OR_EDIT = "android.intent.action.INSERT_OR_EDIT"; /** * Activity Action: Pick an item from the data, returning what was selected. *
Input: {@link #getData} is URI containing a directory of data * (vnd.android.cursor.dir/*) from which to pick an item. *
Output: The URI of the item that was picked. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_PICK = "android.intent.action.PICK"; /** * Activity Action: Creates a shortcut. *
Input: Nothing.
*Output: An Intent representing the shortcut. The intent must contain three * extras: SHORTCUT_INTENT (value: Intent), SHORTCUT_NAME (value: String), * and SHORTCUT_ICON (value: Bitmap) or SHORTCUT_ICON_RESOURCE * (value: ShortcutIconResource).
* * @see #EXTRA_SHORTCUT_INTENT * @see #EXTRA_SHORTCUT_NAME * @see #EXTRA_SHORTCUT_ICON * @see #EXTRA_SHORTCUT_ICON_RESOURCE * @see android.content.Intent.ShortcutIconResource */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_CREATE_SHORTCUT = "android.intent.action.CREATE_SHORTCUT"; /** * The name of the extra used to define the Intent of a shortcut. * * @see #ACTION_CREATE_SHORTCUT */ public static final String EXTRA_SHORTCUT_INTENT = "android.intent.extra.shortcut.INTENT"; /** * The name of the extra used to define the name of a shortcut. * * @see #ACTION_CREATE_SHORTCUT */ public static final String EXTRA_SHORTCUT_NAME = "android.intent.extra.shortcut.NAME"; /** * The name of the extra used to define the icon, as a Bitmap, of a shortcut. * * @see #ACTION_CREATE_SHORTCUT */ public static final String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON"; /** * The name of the extra used to define the icon, as a ShortcutIconResource, of a shortcut. * * @see #ACTION_CREATE_SHORTCUT * @see android.content.Intent.ShortcutIconResource */ public static final String EXTRA_SHORTCUT_ICON_RESOURCE = "android.intent.extra.shortcut.ICON_RESOURCE"; /** * An activity that provides a user interface for adjusting application preferences. * Optional but recommended settings for all applications which have settings. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_APPLICATION_PREFERENCES = "android.intent.action.APPLICATION_PREFERENCES"; /** * Activity Action: Launch an activity showing the app information. * For applications which install other applications (such as app stores), it is recommended * to handle this action for providing the app information to the user. * *Input: {@link #EXTRA_PACKAGE_NAME} specifies the package whose information needs * to be displayed. *
Output: Nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_SHOW_APP_INFO
= "android.intent.action.SHOW_APP_INFO";
/**
* Represents a shortcut/live folder icon resource.
*
* @see Intent#ACTION_CREATE_SHORTCUT
* @see Intent#EXTRA_SHORTCUT_ICON_RESOURCE
* @see android.provider.LiveFolders#ACTION_CREATE_LIVE_FOLDER
* @see android.provider.LiveFolders#EXTRA_LIVE_FOLDER_ICON
*/
public static class ShortcutIconResource implements Parcelable {
/**
* The package name of the application containing the icon.
*/
public String packageName;
/**
* The resource name of the icon, including package, name and type.
*/
public String resourceName;
/**
* Creates a new ShortcutIconResource for the specified context and resource
* identifier.
*
* @param context The context of the application.
* @param resourceId The resource identifier for the icon.
* @return A new ShortcutIconResource with the specified's context package name
* and icon resource identifier.``
*/
public static ShortcutIconResource fromContext(Context context, @AnyRes int resourceId) {
ShortcutIconResource icon = new ShortcutIconResource();
icon.packageName = context.getPackageName();
icon.resourceName = context.getResources().getResourceName(resourceId);
return icon;
}
/**
* Used to read a ShortcutIconResource from a Parcel.
*/
public static final Parcelable.Creator
* This action should be used when the user will naturally expect to
* select an activity in order to proceed. An example if when not to use
* it is when the user clicks on a "mailto:" link. They would naturally
* expect to go directly to their mail app, so startActivity() should be
* called directly: it will
* either launch the current preferred app, or put up a dialog allowing the
* user to pick an app to use and optionally marking that as preferred.
*
* In contrast, if the user is selecting a menu item to send a picture
* they are viewing to someone else, there are many different things they
* may want to do at this point: send it through e-mail, upload it to a
* web service, etc. In this case the CHOOSER action should be used, to
* always present to the user a list of the things they can do, with a
* nice title given by the caller such as "Send this photo with:".
*
* If you need to grant URI permissions through a chooser, you must specify
* the permissions to be granted on the ACTION_CHOOSER Intent
* in addition to the EXTRA_INTENT inside. This means using
* {@link #setClipData} to specify the URIs to be granted as well as
* {@link #FLAG_GRANT_READ_URI_PERMISSION} and/or
* {@link #FLAG_GRANT_WRITE_URI_PERMISSION} as appropriate.
*
* As a convenience, an Intent of this form can be created with the
* {@link #createChooser} function.
*
* Input: No data should be specified. get*Extra must have
* a {@link #EXTRA_INTENT} field containing the Intent being executed,
* and can optionally have a {@link #EXTRA_TITLE} field containing the
* title text to display in the chooser.
*
* Output: Depends on the protocol of {@link #EXTRA_INTENT}.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_CHOOSER = "android.intent.action.CHOOSER";
/**
* Convenience function for creating a {@link #ACTION_CHOOSER} Intent.
*
* Builds a new {@link #ACTION_CHOOSER} Intent that wraps the given
* target intent, also optionally supplying a title. If the target
* intent has specified {@link #FLAG_GRANT_READ_URI_PERMISSION} or
* {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, then these flags will also be
* set in the returned chooser intent, with its ClipData set appropriately:
* either a direct reflection of {@link #getClipData()} if that is non-null,
* or a new ClipData built from {@link #getData()}.
*
* @param target The Intent that the user will be selecting an activity
* to perform.
* @param title Optional title that will be displayed in the chooser.
* @return Return a new Intent object that you can hand to
* {@link Context#startActivity(Intent) Context.startActivity()} and
* related methods.
*/
public static Intent createChooser(Intent target, CharSequence title) {
return createChooser(target, title, null);
}
/**
* Convenience function for creating a {@link #ACTION_CHOOSER} Intent.
*
* Builds a new {@link #ACTION_CHOOSER} Intent that wraps the given
* target intent, also optionally supplying a title. If the target
* intent has specified {@link #FLAG_GRANT_READ_URI_PERMISSION} or
* {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, then these flags will also be
* set in the returned chooser intent, with its ClipData set appropriately:
* either a direct reflection of {@link #getClipData()} if that is non-null,
* or a new ClipData built from {@link #getData()}. The caller may optionally supply an {@link IntentSender} to receive a callback
* when the user makes a choice. This can be useful if the calling application wants
* to remember the last chosen target and surface it as a more prominent or one-touch
* affordance elsewhere in the UI for next time.
* There are two main ways to use this action: if you want a specific kind
* of data, such as a person contact, you set the MIME type to the kind of
* data you want and launch it with {@link Context#startActivity(Intent)}.
* The system will then launch the best application to select that kind
* of data for you.
*
* You may also be interested in any of a set of types of content the user
* can pick. For example, an e-mail application that wants to allow the
* user to add an attachment to an e-mail message can use this action to
* bring up a list of all of the types of content the user can attach.
*
* In this case, you should wrap the GET_CONTENT intent with a chooser
* (through {@link #createChooser}), which will give the proper interface
* for the user to pick how to send your data and allow you to specify
* a prompt indicating what they are doing. You will usually specify a
* broad MIME type (such as image/* or {@literal *}/*), resulting in a
* broad range of content types the user can select from.
*
* When using such a broad GET_CONTENT action, it is often desirable to
* only pick from data that can be represented as a stream. This is
* accomplished by requiring the {@link #CATEGORY_OPENABLE} in the Intent.
*
* Callers can optionally specify {@link #EXTRA_LOCAL_ONLY} to request that
* the launched content chooser only returns results representing data that
* is locally available on the device. For example, if this extra is set
* to true then an image picker should not show any pictures that are available
* from a remote server but not already on the local device (thus requiring
* they be downloaded when opened).
*
* If the caller can handle multiple returned items (the user performing
* multiple selection), then it can specify {@link #EXTRA_ALLOW_MULTIPLE}
* to indicate this.
*
* Input: {@link #getType} is the desired MIME type to retrieve. Note
* that no URI is supplied in the intent, as there are no constraints on
* where the returned data originally comes from. You may also include the
* {@link #CATEGORY_OPENABLE} if you can only accept data that can be
* opened as a stream. You may use {@link #EXTRA_LOCAL_ONLY} to limit content
* selection to local data. You may use {@link #EXTRA_ALLOW_MULTIPLE} to
* allow the user to select multiple items.
*
* Output: The URI of the item that was picked. This must be a content:
* URI so that any receiver can access it.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT";
/**
* Activity Action: Dial a number as specified by the data. This shows a
* UI with the number being dialed, allowing the user to explicitly
* initiate the call.
* Input: If nothing, an empty dialer is started; else {@link #getData}
* is URI of a phone number to be dialed or a tel: URI of an explicit phone
* number.
* Output: nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_DIAL = "android.intent.action.DIAL";
/**
* Activity Action: Perform a call to someone specified by the data.
* Input: If nothing, an empty dialer is started; else {@link #getData}
* is URI of a phone number to be dialed or a tel: URI of an explicit phone
* number.
* Output: nothing.
*
* Note: there will be restrictions on which applications can initiate a
* call; most applications should use the {@link #ACTION_DIAL}.
* Note: this Intent cannot be used to call emergency
* numbers. Applications can dial emergency numbers using
* {@link #ACTION_DIAL}, however.
*
* Note: if you app targets {@link android.os.Build.VERSION_CODES#M M}
* and above and declares as using the {@link android.Manifest.permission#CALL_PHONE}
* permission which is not granted, then attempting to use this action will
* result in a {@link java.lang.SecurityException}.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_CALL = "android.intent.action.CALL";
/**
* Activity Action: Perform a call to an emergency number specified by the
* data.
* Input: {@link #getData} is URI of a phone number to be dialed or a
* tel: URI of an explicit phone number.
* Output: nothing.
* @hide
*/
public static final String ACTION_CALL_EMERGENCY = "android.intent.action.CALL_EMERGENCY";
/**
* Activity action: Perform a call to any number (emergency or not)
* specified by the data.
* Input: {@link #getData} is URI of a phone number to be dialed or a
* tel: URI of an explicit phone number.
* Output: nothing.
* @hide
*/
public static final String ACTION_CALL_PRIVILEGED = "android.intent.action.CALL_PRIVILEGED";
/**
* Activity action: Activate the current SIM card. If SIM cards do not require activation,
* sending this intent is a no-op.
* Input: No data should be specified. get*Extra may have an optional
* {@link #EXTRA_SIM_ACTIVATION_RESPONSE} field containing a PendingIntent through which to
* send the activation result.
* Output: nothing.
* @hide
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_SIM_ACTIVATION_REQUEST =
"android.intent.action.SIM_ACTIVATION_REQUEST";
/**
* Activity Action: Send a message to someone specified by the data.
* Input: {@link #getData} is URI describing the target.
* Output: nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_SENDTO = "android.intent.action.SENDTO";
/**
* Activity Action: Deliver some data to someone else. Who the data is
* being delivered to is not specified; it is up to the receiver of this
* action to ask the user where the data should be sent.
*
* When launching a SEND intent, you should usually wrap it in a chooser
* (through {@link #createChooser}), which will give the proper interface
* for the user to pick how to send your data and allow you to specify
* a prompt indicating what they are doing.
*
* Input: {@link #getType} is the MIME type of the data being sent.
* get*Extra can have either a {@link #EXTRA_TEXT}
* or {@link #EXTRA_STREAM} field, containing the data to be sent. If
* using EXTRA_TEXT, the MIME type should be "text/plain"; otherwise it
* should be the MIME type of the data in EXTRA_STREAM. Use {@literal *}/*
* if the MIME type is unknown (this will only allow senders that can
* handle generic data streams). If using {@link #EXTRA_TEXT}, you can
* also optionally supply {@link #EXTRA_HTML_TEXT} for clients to retrieve
* your text with HTML formatting.
*
* As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, the data
* being sent can be supplied through {@link #setClipData(ClipData)}. This
* allows you to use {@link #FLAG_GRANT_READ_URI_PERMISSION} when sharing
* content: URIs and other advanced features of {@link ClipData}. If
* using this approach, you still must supply the same data through the
* {@link #EXTRA_TEXT} or {@link #EXTRA_STREAM} fields described below
* for compatibility with old applications. If you don't set a ClipData,
* it will be copied there for you when calling {@link Context#startActivity(Intent)}.
*
* Optional standard extras, which may be interpreted by some recipients as
* appropriate, are: {@link #EXTRA_EMAIL}, {@link #EXTRA_CC},
* {@link #EXTRA_BCC}, {@link #EXTRA_SUBJECT}.
*
* Output: nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_SEND = "android.intent.action.SEND";
/**
* Activity Action: Deliver multiple data to someone else.
*
* Like {@link #ACTION_SEND}, except the data is multiple.
*
* Input: {@link #getType} is the MIME type of the data being sent.
* get*ArrayListExtra can have either a {@link #EXTRA_TEXT} or {@link
* #EXTRA_STREAM} field, containing the data to be sent. If using
* {@link #EXTRA_TEXT}, you can also optionally supply {@link #EXTRA_HTML_TEXT}
* for clients to retrieve your text with HTML formatting.
*
* Multiple types are supported, and receivers should handle mixed types
* whenever possible. The right way for the receiver to check them is to
* use the content resolver on each URI. The intent sender should try to
* put the most concrete mime type in the intent type, but it can fall
* back to {@literal
* e.g. if you are sending image/jpg and image/jpg, the intent's type can
* be image/jpg, but if you are sending image/jpg and image/png, then the
* intent's type should be image/*.
*
* As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, the data
* being sent can be supplied through {@link #setClipData(ClipData)}. This
* allows you to use {@link #FLAG_GRANT_READ_URI_PERMISSION} when sharing
* content: URIs and other advanced features of {@link ClipData}. If
* using this approach, you still must supply the same data through the
* {@link #EXTRA_TEXT} or {@link #EXTRA_STREAM} fields described below
* for compatibility with old applications. If you don't set a ClipData,
* it will be copied there for you when calling {@link Context#startActivity(Intent)}.
*
* Optional standard extras, which may be interpreted by some recipients as
* appropriate, are: {@link #EXTRA_EMAIL}, {@link #EXTRA_CC},
* {@link #EXTRA_BCC}, {@link #EXTRA_SUBJECT}.
*
* Output: nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_SEND_MULTIPLE = "android.intent.action.SEND_MULTIPLE";
/**
* Activity Action: Handle an incoming phone call.
* Input: nothing.
* Output: nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_ANSWER = "android.intent.action.ANSWER";
/**
* Activity Action: Insert an empty item into the given container.
* Input: {@link #getData} is URI of the directory (vnd.android.cursor.dir/*)
* in which to place the data.
* Output: URI of the new data that was created.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_INSERT = "android.intent.action.INSERT";
/**
* Activity Action: Create a new item in the given container, initializing it
* from the current contents of the clipboard.
* Input: {@link #getData} is URI of the directory (vnd.android.cursor.dir/*)
* in which to place the data.
* Output: URI of the new data that was created.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_PASTE = "android.intent.action.PASTE";
/**
* Activity Action: Delete the given data from its container.
* Input: {@link #getData} is URI of data to be deleted.
* Output: nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_DELETE = "android.intent.action.DELETE";
/**
* Activity Action: Run the data, whatever that means.
* Input: ? (Note: this is currently specific to the test harness.)
* Output: nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_RUN = "android.intent.action.RUN";
/**
* Activity Action: Perform a data synchronization.
* Input: ?
* Output: ?
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_SYNC = "android.intent.action.SYNC";
/**
* Activity Action: Pick an activity given an intent, returning the class
* selected.
* Input: get*Extra field {@link #EXTRA_INTENT} is an Intent
* used with {@link PackageManager#queryIntentActivities} to determine the
* set of activities from which to pick.
* Output: Class name of the activity that was selected.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_PICK_ACTIVITY = "android.intent.action.PICK_ACTIVITY";
/**
* Activity Action: Perform a search.
* Input: {@link android.app.SearchManager#QUERY getStringExtra(SearchManager.QUERY)}
* is the text to search for. If empty, simply
* enter your search results Activity with the search UI activated.
* Output: nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_SEARCH = "android.intent.action.SEARCH";
/**
* Activity Action: Start the platform-defined tutorial
* Input: {@link android.app.SearchManager#QUERY getStringExtra(SearchManager.QUERY)}
* is the text to search for. If empty, simply
* enter your search results Activity with the search UI activated.
* Output: nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_SYSTEM_TUTORIAL = "android.intent.action.SYSTEM_TUTORIAL";
/**
* Activity Action: Perform a web search.
*
* Input: {@link android.app.SearchManager#QUERY
* getStringExtra(SearchManager.QUERY)} is the text to search for. If it is
* a url starts with http or https, the site will be opened. If it is plain
* text, Google search will be applied.
*
* Output: nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH";
/**
* Activity Action: Perform assist action.
*
* Input: {@link #EXTRA_ASSIST_PACKAGE}, {@link #EXTRA_ASSIST_CONTEXT}, can provide
* additional optional contextual information about where the user was when they
* requested the assist; {@link #EXTRA_REFERRER} may be set with additional referrer
* information.
* Output: nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_ASSIST = "android.intent.action.ASSIST";
/**
* Activity Action: Perform voice assist action.
*
* Input: {@link #EXTRA_ASSIST_PACKAGE}, {@link #EXTRA_ASSIST_CONTEXT}, can provide
* additional optional contextual information about where the user was when they
* requested the voice assist.
* Output: nothing.
* @hide
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_VOICE_ASSIST = "android.intent.action.VOICE_ASSIST";
/**
* An optional field on {@link #ACTION_ASSIST} containing the name of the current foreground
* application package at the time the assist was invoked.
*/
public static final String EXTRA_ASSIST_PACKAGE
= "android.intent.extra.ASSIST_PACKAGE";
/**
* An optional field on {@link #ACTION_ASSIST} containing the uid of the current foreground
* application package at the time the assist was invoked.
*/
public static final String EXTRA_ASSIST_UID
= "android.intent.extra.ASSIST_UID";
/**
* An optional field on {@link #ACTION_ASSIST} and containing additional contextual
* information supplied by the current foreground app at the time of the assist request.
* This is a {@link Bundle} of additional data.
*/
public static final String EXTRA_ASSIST_CONTEXT
= "android.intent.extra.ASSIST_CONTEXT";
/**
* An optional field on {@link #ACTION_ASSIST} suggesting that the user will likely use a
* keyboard as the primary input device for assistance.
*/
public static final String EXTRA_ASSIST_INPUT_HINT_KEYBOARD =
"android.intent.extra.ASSIST_INPUT_HINT_KEYBOARD";
/**
* An optional field on {@link #ACTION_ASSIST} containing the InputDevice id
* that was used to invoke the assist.
*/
public static final String EXTRA_ASSIST_INPUT_DEVICE_ID =
"android.intent.extra.ASSIST_INPUT_DEVICE_ID";
/**
* Activity Action: List all available applications.
* Input: Nothing.
* Output: nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_ALL_APPS = "android.intent.action.ALL_APPS";
/**
* Activity Action: Show settings for choosing wallpaper.
* Input: Nothing.
* Output: Nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_SET_WALLPAPER = "android.intent.action.SET_WALLPAPER";
/**
* Activity Action: Show activity for reporting a bug.
* Input: Nothing.
* Output: Nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_BUG_REPORT = "android.intent.action.BUG_REPORT";
/**
* Activity Action: Main entry point for factory tests. Only used when
* the device is booting in factory test node. The implementing package
* must be installed in the system image.
* Input: nothing
* Output: nothing
*/
public static final String ACTION_FACTORY_TEST = "android.intent.action.FACTORY_TEST";
/**
* Activity Action: The user pressed the "call" button to go to the dialer
* or other appropriate UI for placing a call.
* Input: Nothing.
* Output: Nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_CALL_BUTTON = "android.intent.action.CALL_BUTTON";
/**
* Activity Action: Start Voice Command.
* Input: Nothing.
* Output: Nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND";
/**
* Activity Action: Start action associated with long pressing on the
* search key.
* Input: Nothing.
* Output: Nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_SEARCH_LONG_PRESS = "android.intent.action.SEARCH_LONG_PRESS";
/**
* Activity Action: The user pressed the "Report" button in the crash/ANR dialog.
* This intent is delivered to the package which installed the application, usually
* Google Play.
* Input: No data is specified. The bug report is passed in using
* an {@link #EXTRA_BUG_REPORT} field.
* Output: Nothing.
*
* @see #EXTRA_BUG_REPORT
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_APP_ERROR = "android.intent.action.APP_ERROR";
/**
* Activity Action: Show power usage information to the user.
* Input: Nothing.
* Output: Nothing.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_POWER_USAGE_SUMMARY = "android.intent.action.POWER_USAGE_SUMMARY";
/**
* Activity Action: Setup wizard to launch after a platform update. This
* activity should have a string meta-data field associated with it,
* {@link #METADATA_SETUP_VERSION}, which defines the current version of
* the platform for setup. The activity will be launched only if
* {@link android.provider.Settings.Secure#LAST_SETUP_SHOWN} is not the
* same value.
* Input: Nothing.
* Output: Nothing.
* @hide
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_UPGRADE_SETUP = "android.intent.action.UPGRADE_SETUP";
/**
* Activity Action: Start the Keyboard Shortcuts Helper screen.
* Input: Nothing.
* Output: Nothing.
* @hide
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_SHOW_KEYBOARD_SHORTCUTS =
"android.intent.action.SHOW_KEYBOARD_SHORTCUTS";
/**
* Activity Action: Dismiss the Keyboard Shortcuts Helper screen.
* Input: Nothing.
* Output: Nothing.
* @hide
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_DISMISS_KEYBOARD_SHORTCUTS =
"android.intent.action.DISMISS_KEYBOARD_SHORTCUTS";
/**
* Activity Action: Show settings for managing network data usage of a
* specific application. Applications should define an activity that offers
* options to control data usage.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_MANAGE_NETWORK_USAGE =
"android.intent.action.MANAGE_NETWORK_USAGE";
/**
* Activity Action: Launch application installer.
*
* Input: The data must be a content: or file: URI at which the application
* can be retrieved. As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1},
* you can also use "package:
* Output: If {@link #EXTRA_RETURN_RESULT}, returns whether the install
* succeeded.
*
* Note:If your app is targeting API level higher than 22 you
* need to hold {@link android.Manifest.permission#REQUEST_INSTALL_PACKAGES}
* in order to launch the application installer.
*
* Input: The data must be a http: URI that the ephemeral application is registered
* to handle.
*
* This is a protected intent that can only be sent by the system.
*
* The system will have a persistent connection to this service.
* This is a protected intent that can only be sent by the system.
* To retrieve this value in a client, use {@link android.app.Activity#getReferrer}
* instead of directly retrieving the extra. It is also valid for applications to
* instead supply {@link #EXTRA_REFERRER_NAME} for cases where they can only create
* a string, not a Uri; the field here, if supplied, will always take precedence,
* however.
* Input: The data must be a package: URI whose scheme specific part is
* the package name of the current installed package to be uninstalled.
* You can optionally supply {@link #EXTRA_RETURN_RESULT}.
*
* Output: If {@link #EXTRA_RETURN_RESULT}, returns whether the install
* succeeded.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_UNINSTALL_PACKAGE = "android.intent.action.UNINSTALL_PACKAGE";
/**
* Specify whether the package should be uninstalled for all users.
* @hide because these should not be part of normal application flow.
*/
public static final String EXTRA_UNINSTALL_ALL_USERS
= "android.intent.extra.UNINSTALL_ALL_USERS";
/**
* A string associated with a {@link #ACTION_UPGRADE_SETUP} activity
* describing the last run version of the platform that was setup.
* @hide
*/
public static final String METADATA_SETUP_VERSION = "android.SETUP_VERSION";
/**
* Activity action: Launch UI to manage the permissions of an app.
*
* Input: {@link #EXTRA_PACKAGE_NAME} specifies the package whose permissions
* will be managed by the launched UI.
*
* Output: Nothing.
*
* Input: Nothing.
*
* Output: Nothing.
*
* Input: {@link #EXTRA_PACKAGE_NAME} specifies the package whose
* permissions will be reviewed (mandatory).
*
* Input: {@link #EXTRA_INTENT} specifies a pending intent to
* be fired after the permission review (optional).
*
* Input: {@link #EXTRA_REMOTE_CALLBACK} specifies a callback to
* be invoked after the permission review (optional).
*
* Input: {@link #EXTRA_RESULT_NEEDED} specifies whether the intent
* passed via {@link #EXTRA_INTENT} needs a result (optional).
*
* Output: Nothing.
*
* Type: IRemoteCallback
*
* Type: String
*
* Type: boolean
*
* Input: {@link #EXTRA_PERMISSION_NAME} specifies the permission access
* to which will be managed by the launched UI.
*
* Output: Nothing.
*
* Type: String
*
* For historical reasons, the name of this broadcast action refers to the power
* state of the screen but it is actually sent in response to changes in the
* overall interactive state of the device.
*
* This broadcast is sent when the device becomes non-interactive which may have
* nothing to do with the screen turning off. To determine the
* actual state of the screen, use {@link android.view.Display#getState}.
*
* See {@link android.os.PowerManager#isInteractive} for details.
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_SCREEN_OFF = "android.intent.action.SCREEN_OFF";
/**
* Broadcast Action: Sent when the device wakes up and becomes interactive.
*
* For historical reasons, the name of this broadcast action refers to the power
* state of the screen but it is actually sent in response to changes in the
* overall interactive state of the device.
*
* This broadcast is sent when the device becomes interactive which may have
* nothing to do with the screen turning on. To determine the
* actual state of the screen, use {@link android.view.Display#getState}.
*
* See {@link android.os.PowerManager#isInteractive} for details.
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_SCREEN_ON = "android.intent.action.SCREEN_ON";
/**
* Broadcast Action: Sent after the system stops dreaming.
*
* This is a protected intent that can only be sent by the system.
* It is only sent to registered receivers. This is a protected intent that can only be sent by the system.
* It is only sent to registered receivers. This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_USER_PRESENT = "android.intent.action.USER_PRESENT";
/**
* Broadcast Action: The current time has changed. Sent every
* minute. You cannot receive this through components declared
* in manifests, only by explicitly registering for it with
* {@link Context#registerReceiver(BroadcastReceiver, IntentFilter)
* Context.registerReceiver()}.
*
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_TIME_TICK = "android.intent.action.TIME_TICK";
/**
* Broadcast Action: The time was set.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_TIME_CHANGED = "android.intent.action.TIME_SET";
/**
* Broadcast Action: The date has changed.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_DATE_CHANGED = "android.intent.action.DATE_CHANGED";
/**
* Broadcast Action: The timezone has changed. The intent will have the following extra values: This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_TIMEZONE_CHANGED = "android.intent.action.TIMEZONE_CHANGED";
/**
* Clear DNS Cache Action: This is broadcast when networks have changed and old
* DNS entries should be tossed.
* @hide
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_CLEAR_DNS_CACHE = "android.intent.action.CLEAR_DNS_CACHE";
/**
* Alarm Changed Action: This is broadcast when the AlarmClock
* application's alarm is set or unset. It is used by the
* AlarmClock application and the StatusBar service.
* @hide
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_ALARM_CHANGED = "android.intent.action.ALARM_CHANGED";
/**
* Broadcast Action: This is broadcast once, after the user has finished
* booting, but while still in the "locked" state. It can be used to perform
* application-specific initialization, such as installing alarms. You must
* hold the {@link android.Manifest.permission#RECEIVE_BOOT_COMPLETED}
* permission in order to receive this broadcast.
*
* This broadcast is sent immediately at boot by all devices (regardless of
* direct boot support) running {@link android.os.Build.VERSION_CODES#N} or
* higher. Upon receipt of this broadcast, the user is still locked and only
* device-protected storage can be accessed safely. If you want to access
* credential-protected storage, you need to wait for the user to be
* unlocked (typically by entering their lock pattern or PIN for the first
* time), after which the {@link #ACTION_USER_UNLOCKED} and
* {@link #ACTION_BOOT_COMPLETED} broadcasts are sent.
*
* To receive this broadcast, your receiver component must be marked as
* being {@link ComponentInfo#directBootAware}.
*
* This is a protected intent that can only be sent by the system.
*
* @see Context#createDeviceProtectedStorageContext()
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_LOCKED_BOOT_COMPLETED = "android.intent.action.LOCKED_BOOT_COMPLETED";
/**
* Broadcast Action: This is broadcast once, after the user has finished
* booting. It can be used to perform application-specific initialization,
* such as installing alarms. You must hold the
* {@link android.Manifest.permission#RECEIVE_BOOT_COMPLETED} permission in
* order to receive this broadcast.
*
* This broadcast is sent at boot by all devices (both with and without
* direct boot support). Upon receipt of this broadcast, the user is
* unlocked and both device-protected and credential-protected storage can
* accessed safely.
*
* If you need to run while the user is still locked (before they've entered
* their lock pattern or PIN for the first time), you can listen for the
* {@link #ACTION_LOCKED_BOOT_COMPLETED} broadcast.
*
* This is a protected intent that can only be sent by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_BOOT_COMPLETED = "android.intent.action.BOOT_COMPLETED";
/**
* Broadcast Action: This is broadcast when a user action should request a
* temporary system dialog to dismiss. Some examples of temporary system
* dialogs are the notification window-shade and the recent tasks dialog.
*/
public static final String ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS";
/**
* Broadcast Action: Trigger the download and eventual installation
* of a package.
* Input: {@link #getData} is the URI of the package file to download.
*
* This is a protected intent that can only be sent
* by the system.
*
* @deprecated This constant has never been used.
*/
@Deprecated
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PACKAGE_INSTALL = "android.intent.action.PACKAGE_INSTALL";
/**
* Broadcast Action: A new application package has been installed on the
* device. The data contains the name of the package. Note that the
* newly installed package does not receive this broadcast.
* May include the following extras:
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PACKAGE_ADDED = "android.intent.action.PACKAGE_ADDED";
/**
* Broadcast Action: A new version of an application package has been
* installed, replacing an existing version that was previously installed.
* The data contains the name of the package.
* May include the following extras:
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED";
/**
* Broadcast Action: A new version of your application has been installed
* over an existing one. This is only sent to the application that was
* replaced. It does not contain any additional data; to receive it, just
* use an intent filter for this action.
*
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MY_PACKAGE_REPLACED = "android.intent.action.MY_PACKAGE_REPLACED";
/**
* Broadcast Action: An existing application package has been removed from
* the device. The data contains the name of the package. The package
* that is being removed does not receive this Intent.
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED";
/**
* Broadcast Action: An existing application package has been completely
* removed from the device. The data contains the name of the package.
* This is like {@link #ACTION_PACKAGE_REMOVED}, but only set when
* {@link #EXTRA_DATA_REMOVED} is true and
* {@link #EXTRA_REPLACING} is false of that broadcast.
*
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PACKAGE_FULLY_REMOVED
= "android.intent.action.PACKAGE_FULLY_REMOVED";
/**
* Broadcast Action: An existing application package has been changed (for
* example, a component has been enabled or disabled). The data contains
* the name of the package.
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PACKAGE_CHANGED = "android.intent.action.PACKAGE_CHANGED";
/**
* @hide
* Broadcast Action: Ask system services if there is any reason to
* restart the given package. The data contains the name of the
* package.
* This is a protected intent that can only be sent
* by the system.
*/
@SystemApi
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_QUERY_PACKAGE_RESTART = "android.intent.action.QUERY_PACKAGE_RESTART";
/**
* Broadcast Action: The user has restarted a package, and all of its
* processes have been killed. All runtime state
* associated with it (processes, alarms, notifications, etc) should
* be removed. Note that the restarted package does not
* receive this broadcast.
* The data contains the name of the package.
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED";
/**
* Broadcast Action: The user has cleared the data of a package. This should
* be preceded by {@link #ACTION_PACKAGE_RESTARTED}, after which all of
* its persistent data is erased and this broadcast sent.
* Note that the cleared package does not
* receive this broadcast. The data contains the name of the package.
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PACKAGE_DATA_CLEARED = "android.intent.action.PACKAGE_DATA_CLEARED";
/**
* Broadcast Action: Packages have been suspended.
* Includes the following extras:
* This is a protected intent that can only be sent
* by the system. It is only sent to registered receivers.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PACKAGES_SUSPENDED = "android.intent.action.PACKAGES_SUSPENDED";
/**
* Broadcast Action: Packages have been unsuspended.
* Includes the following extras:
* This is a protected intent that can only be sent
* by the system. It is only sent to registered receivers.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PACKAGES_UNSUSPENDED = "android.intent.action.PACKAGES_UNSUSPENDED";
/**
* Broadcast Action: A user ID has been removed from the system. The user
* ID number is stored in the extra data under {@link #EXTRA_UID}.
*
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_UID_REMOVED = "android.intent.action.UID_REMOVED";
/**
* Broadcast Action: Sent to the installer package of an application when
* that application is first launched (that is the first time it is moved
* out of the stopped state). The data contains the name of the package.
*
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PACKAGE_FIRST_LAUNCH = "android.intent.action.PACKAGE_FIRST_LAUNCH";
/**
* Broadcast Action: Sent to the system package verifier when a package
* needs to be verified. The data contains the package URI.
*
* This is a protected intent that can only be sent by the system.
*
* This is a protected intent that can only be sent by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PACKAGE_VERIFIED = "android.intent.action.PACKAGE_VERIFIED";
/**
* Broadcast Action: Sent to the system intent filter verifier when an
* intent filter needs to be verified. The data contains the filter data
* hosts to be verified against.
*
* This is a protected intent that can only be sent by the system.
* Includes the following extras:
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE =
"android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE";
/**
* Broadcast Action: Resources for a set of packages are currently
* unavailable since the media on which they exist is unavailable.
* The extra data {@link #EXTRA_CHANGED_PACKAGE_LIST} contains a
* list of packages whose availability changed.
* The extra data {@link #EXTRA_CHANGED_UID_LIST} contains a
* list of uids of packages whose availability changed.
* The specified set of packages can no longer be
* launched and are practically unavailable on the system.
* Inclues the following extras:
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE =
"android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE";
/**
* Broadcast Action: The current system wallpaper has changed. See
* {@link android.app.WallpaperManager} for retrieving the new wallpaper.
* This should only be used to determine when the wallpaper
* has changed to show the new wallpaper to the user. You should certainly
* never, in response to this, change the wallpaper or other attributes of
* it such as the suggested size. That would be crazy, right? You'd cause
* all kinds of loops, especially if other apps are doing similar things,
* right? Of course. So please don't do this.
*
* @deprecated Modern applications should use
* {@link android.view.WindowManager.LayoutParams#FLAG_SHOW_WALLPAPER
* WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER} to have the wallpaper
* shown behind their UI, rather than watching for this broadcast and
* rendering the wallpaper on their own.
*/
@Deprecated @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED";
/**
* Broadcast Action: The current device {@link android.content.res.Configuration}
* (orientation, locale, etc) has changed. When such a change happens, the
* UIs (view hierarchy) will need to be rebuilt based on this new
* information; for the most part, applications don't need to worry about
* this, because the system will take care of stopping and restarting the
* application to make sure it sees the new changes. Some system code that
* can not be restarted will need to watch for this action and handle it
* appropriately.
*
*
* You cannot receive this through components declared
* in manifests, only by explicitly registering for it with
* {@link Context#registerReceiver(BroadcastReceiver, IntentFilter)
* Context.registerReceiver()}.
*
* This is a protected intent that can only be sent
* by the system.
*
* @see android.content.res.Configuration
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_CONFIGURATION_CHANGED = "android.intent.action.CONFIGURATION_CHANGED";
/**
* Broadcast Action: The current device's locale has changed.
*
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_LOCALE_CHANGED = "android.intent.action.LOCALE_CHANGED";
/**
* Broadcast Action: This is a sticky broadcast containing the
* charging state, level, and other information about the battery.
* See {@link android.os.BatteryManager} for documentation on the
* contents of the Intent.
*
*
* You cannot receive this through components declared
* in manifests, only by explicitly registering for it with
* {@link Context#registerReceiver(BroadcastReceiver, IntentFilter)
* Context.registerReceiver()}. See {@link #ACTION_BATTERY_LOW},
* {@link #ACTION_BATTERY_OKAY}, {@link #ACTION_POWER_CONNECTED},
* and {@link #ACTION_POWER_DISCONNECTED} for distinct battery-related
* broadcasts that are sent and can be received through manifest
* receivers.
*
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_BATTERY_CHANGED = "android.intent.action.BATTERY_CHANGED";
/**
* Broadcast Action: Indicates low battery condition on the device.
* This broadcast corresponds to the "Low battery warning" system dialog.
*
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_BATTERY_LOW = "android.intent.action.BATTERY_LOW";
/**
* Broadcast Action: Indicates the battery is now okay after being low.
* This will be sent after {@link #ACTION_BATTERY_LOW} once the battery has
* gone back up to an okay state.
*
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_BATTERY_OKAY = "android.intent.action.BATTERY_OKAY";
/**
* Broadcast Action: External power has been connected to the device.
* This is intended for applications that wish to register specifically to this notification.
* Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to
* stay active to receive this notification. This action can be used to implement actions
* that wait until power is available to trigger.
*
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_POWER_CONNECTED = "android.intent.action.ACTION_POWER_CONNECTED";
/**
* Broadcast Action: External power has been removed from the device.
* This is intended for applications that wish to register specifically to this notification.
* Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to
* stay active to receive this notification. This action can be used to implement actions
* that wait until power is available to trigger.
*
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_POWER_DISCONNECTED =
"android.intent.action.ACTION_POWER_DISCONNECTED";
/**
* Broadcast Action: Device is shutting down.
* This is broadcast when the device is being shut down (completely turned
* off, not sleeping). Once the broadcast is complete, the final shutdown
* will proceed and all unsaved data lost. Apps will not normally need
* to handle this, since the foreground activity will be paused as well.
*
* This is a protected intent that can only be sent
* by the system.
* May include the following extras:
* This is a protected intent that can only be sent
* by the system.
*
* {@hide}
*/
public static final String ACTION_REQUEST_SHUTDOWN = "android.intent.action.ACTION_REQUEST_SHUTDOWN";
/**
* Broadcast Action: A sticky broadcast that indicates low memory
* condition on the device
*
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_DEVICE_STORAGE_LOW = "android.intent.action.DEVICE_STORAGE_LOW";
/**
* Broadcast Action: Indicates low memory condition on the device no longer exists
*
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_DEVICE_STORAGE_OK = "android.intent.action.DEVICE_STORAGE_OK";
/**
* Broadcast Action: A sticky broadcast that indicates a memory full
* condition on the device. This is intended for activities that want
* to be able to fill the data partition completely, leaving only
* enough free space to prevent system-wide SQLite failures.
*
* This is a protected intent that can only be sent
* by the system.
*
* {@hide}
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_DEVICE_STORAGE_FULL = "android.intent.action.DEVICE_STORAGE_FULL";
/**
* Broadcast Action: Indicates memory full condition on the device
* no longer exists.
*
* This is a protected intent that can only be sent
* by the system.
*
* {@hide}
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_DEVICE_STORAGE_NOT_FULL = "android.intent.action.DEVICE_STORAGE_NOT_FULL";
/**
* Broadcast Action: Indicates low memory condition notification acknowledged by user
* and package management should be started.
* This is triggered by the user from the ACTION_DEVICE_STORAGE_LOW
* notification.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MANAGE_PACKAGE_STORAGE = "android.intent.action.MANAGE_PACKAGE_STORAGE";
/**
* Broadcast Action: The device has entered USB Mass Storage mode.
* This is used mainly for the USB Settings panel.
* Apps should listen for ACTION_MEDIA_MOUNTED and ACTION_MEDIA_UNMOUNTED broadcasts to be notified
* when the SD card file system is mounted or unmounted
* @deprecated replaced by android.os.storage.StorageEventListener
*/
@Deprecated
public static final String ACTION_UMS_CONNECTED = "android.intent.action.UMS_CONNECTED";
/**
* Broadcast Action: The device has exited USB Mass Storage mode.
* This is used mainly for the USB Settings panel.
* Apps should listen for ACTION_MEDIA_MOUNTED and ACTION_MEDIA_UNMOUNTED broadcasts to be notified
* when the SD card file system is mounted or unmounted
* @deprecated replaced by android.os.storage.StorageEventListener
*/
@Deprecated
public static final String ACTION_UMS_DISCONNECTED = "android.intent.action.UMS_DISCONNECTED";
/**
* Broadcast Action: External media has been removed.
* The path to the mount point for the removed media is contained in the Intent.mData field.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MEDIA_REMOVED = "android.intent.action.MEDIA_REMOVED";
/**
* Broadcast Action: External media is present, but not mounted at its mount point.
* The path to the mount point for the unmounted media is contained in the Intent.mData field.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MEDIA_UNMOUNTED = "android.intent.action.MEDIA_UNMOUNTED";
/**
* Broadcast Action: External media is present, and being disk-checked
* The path to the mount point for the checking media is contained in the Intent.mData field.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MEDIA_CHECKING = "android.intent.action.MEDIA_CHECKING";
/**
* Broadcast Action: External media is present, but is using an incompatible fs (or is blank)
* The path to the mount point for the checking media is contained in the Intent.mData field.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MEDIA_NOFS = "android.intent.action.MEDIA_NOFS";
/**
* Broadcast Action: External media is present and mounted at its mount point.
* The path to the mount point for the mounted media is contained in the Intent.mData field.
* The Intent contains an extra with name "read-only" and Boolean value to indicate if the
* media was mounted read only.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MEDIA_MOUNTED = "android.intent.action.MEDIA_MOUNTED";
/**
* Broadcast Action: External media is unmounted because it is being shared via USB mass storage.
* The path to the mount point for the shared media is contained in the Intent.mData field.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MEDIA_SHARED = "android.intent.action.MEDIA_SHARED";
/**
* Broadcast Action: External media is no longer being shared via USB mass storage.
* The path to the mount point for the previously shared media is contained in the Intent.mData field.
*
* @hide
*/
public static final String ACTION_MEDIA_UNSHARED = "android.intent.action.MEDIA_UNSHARED";
/**
* Broadcast Action: External media was removed from SD card slot, but mount point was not unmounted.
* The path to the mount point for the removed media is contained in the Intent.mData field.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MEDIA_BAD_REMOVAL = "android.intent.action.MEDIA_BAD_REMOVAL";
/**
* Broadcast Action: External media is present but cannot be mounted.
* The path to the mount point for the unmountable media is contained in the Intent.mData field.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MEDIA_UNMOUNTABLE = "android.intent.action.MEDIA_UNMOUNTABLE";
/**
* Broadcast Action: User has expressed the desire to remove the external storage media.
* Applications should close all files they have open within the mount point when they receive this intent.
* The path to the mount point for the media to be ejected is contained in the Intent.mData field.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MEDIA_EJECT = "android.intent.action.MEDIA_EJECT";
/**
* Broadcast Action: The media scanner has started scanning a directory.
* The path to the directory being scanned is contained in the Intent.mData field.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MEDIA_SCANNER_STARTED = "android.intent.action.MEDIA_SCANNER_STARTED";
/**
* Broadcast Action: The media scanner has finished scanning a directory.
* The path to the scanned directory is contained in the Intent.mData field.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MEDIA_SCANNER_FINISHED = "android.intent.action.MEDIA_SCANNER_FINISHED";
/**
* Broadcast Action: Request the media scanner to scan a file and add it to the media database.
* The path to the file is contained in the Intent.mData field.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MEDIA_SCANNER_SCAN_FILE = "android.intent.action.MEDIA_SCANNER_SCAN_FILE";
/**
* Broadcast Action: The "Media Button" was pressed. Includes a single
* extra field, {@link #EXTRA_KEY_EVENT}, containing the key event that
* caused the broadcast.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_MEDIA_BUTTON = "android.intent.action.MEDIA_BUTTON";
/**
* Broadcast Action: The "Camera Button" was pressed. Includes a single
* extra field, {@link #EXTRA_KEY_EVENT}, containing the key event that
* caused the broadcast.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_CAMERA_BUTTON = "android.intent.action.CAMERA_BUTTON";
// *** NOTE: @todo(*) The following really should go into a more domain-specific
// location; they are not general-purpose actions.
/**
* Broadcast Action: A GTalk connection has been established.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_GTALK_SERVICE_CONNECTED =
"android.intent.action.GTALK_CONNECTED";
/**
* Broadcast Action: A GTalk connection has been disconnected.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_GTALK_SERVICE_DISCONNECTED =
"android.intent.action.GTALK_DISCONNECTED";
/**
* Broadcast Action: An input method has been changed.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_INPUT_METHOD_CHANGED =
"android.intent.action.INPUT_METHOD_CHANGED";
/**
* Broadcast Action: The user has switched the phone into or out of Airplane Mode. One or
* more radios have been turned off or on. The intent will have the following extra value: This is a protected intent that can only be sent by the system. The data of the intent identifies which part of which provider
* changed. When queried through the content resolver, the data URI will
* return the data set in question.
*
* The intent will have the following extra values:
* If the minimum SDK version of your application is
* {@link android.os.Build.VERSION_CODES#LOLLIPOP}, it is recommended to refer
* to the Broadcast Action: The user has switched on advanced settings in the settings app: This is a protected intent that can only be sent
* by the system.
*
* @hide
*/
//@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_ADVANCED_SETTINGS_CHANGED
= "android.intent.action.ADVANCED_SETTINGS";
/**
* Broadcast Action: Sent after application restrictions are changed.
*
* This is a protected intent that can only be sent
* by the system. The Intent will have the following extra value: Once the broadcast is finished, the resultData is used as the actual
* number to call. If It is perfectly acceptable for multiple receivers to process the
* outgoing call in turn: for example, a parental control application
* might verify that the user is authorized to place the call at that
* time, then a number-rewriting application might add an area code if
* one was not specified. For consistency, any receiver whose purpose is to prohibit phone
* calls should have a priority of 0, to ensure it will see the final
* phone number to be dialed.
* Any receiver whose purpose is to rewrite phone numbers to be called
* should have a positive priority.
* Negative priorities are reserved for the system for this broadcast;
* using them may cause problems. Any BroadcastReceiver receiving this Intent must not
* abort the broadcast. Emergency calls cannot be intercepted using this mechanism, and
* other calls cannot be modified to call emergency numbers using this
* mechanism.
* Some apps (such as VoIP apps) may want to redirect the outgoing
* call to use their own service instead. Those apps should first prevent
* the call from being placed by setting resultData to You must hold the
* {@link android.Manifest.permission#PROCESS_OUTGOING_CALLS}
* permission to receive this Intent. This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_NEW_OUTGOING_CALL =
"android.intent.action.NEW_OUTGOING_CALL";
/**
* Broadcast Action: Have the device reboot. This is only for use by
* system code.
*
* This is a protected intent that can only be sent
* by the system.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_REBOOT =
"android.intent.action.REBOOT";
/**
* Broadcast Action: A sticky broadcast for changes in the physical
* docking state of the device.
*
* The intent will have the following extra values:
* This is intended for monitoring the current physical dock state.
* See {@link android.app.UiModeManager} for the normal API dealing with
* dock mode changes.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_DOCK_EVENT =
"android.intent.action.DOCK_EVENT";
/**
* Broadcast Action: A broadcast when idle maintenance can be started.
* This means that the user is not interacting with the device and is
* not expected to do so soon. Typical use of the idle maintenance is
* to perform somehow expensive tasks that can be postponed at a moment
* when they will not degrade user experience.
*
* In order to keep the device responsive in case of an
* unexpected user interaction, implementations of a maintenance task
* should be interruptible. In such a scenario a broadcast with action
* {@link #ACTION_IDLE_MAINTENANCE_END} will be sent. In other words, you
* should not do the maintenance work in
* {@link BroadcastReceiver#onReceive(Context, Intent)}, rather start a
* maintenance service by {@link Context#startService(Intent)}. Also
* you should hold a wake lock while your maintenance service is running
* to prevent the device going to sleep.
*
* This is a protected intent that can only be sent by
* the system.
*
* In order to keep the device responsive in case of an
* unexpected user interaction, implementations of a maintenance task
* should be interruptible. Hence, on receiving a broadcast with this
* action, the maintenance task should be interrupted as soon as possible.
* In other words, you should not do the maintenance work in
* {@link BroadcastReceiver#onReceive(Context, Intent)}, rather stop the
* maintenance service that was started on receiving of
* {@link #ACTION_IDLE_MAINTENANCE_START}.Also you should release the wake
* lock you acquired when your maintenance service started.
* This is a protected intent that can only be sent
* by the system.
*
* @see #ACTION_IDLE_MAINTENANCE_START
*
* @hide
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_IDLE_MAINTENANCE_END =
"android.intent.action.ACTION_IDLE_MAINTENANCE_END";
/**
* Broadcast Action: a remote intent is to be broadcasted.
*
* A remote intent is used for remote RPC between devices. The remote intent
* is serialized and sent from one device to another device. The receiving
* device parses the remote intent and broadcasts it. Note that anyone can
* broadcast a remote intent. However, if the intent receiver of the remote intent
* does not trust intent broadcasts from arbitrary intent senders, it should require
* the sender to hold certain permissions so only trusted sender's broadcast will be
* let through.
* @hide
*/
public static final String ACTION_REMOTE_INTENT =
"com.google.android.c2dm.intent.RECEIVE";
/**
* Broadcast Action: This is broadcast once when the user is booting after a
* system update. It can be used to perform cleanup or upgrades after a
* system update.
*
* This broadcast is sent after the {@link #ACTION_LOCKED_BOOT_COMPLETED}
* broadcast but before the {@link #ACTION_BOOT_COMPLETED} broadcast. It's
* only sent when the {@link Build#FINGERPRINT} has changed, and it's only
* sent to receivers in the system image.
*
* @hide
*/
public static final String ACTION_PRE_BOOT_COMPLETED =
"android.intent.action.PRE_BOOT_COMPLETED";
/**
* Broadcast to a specific application to query any supported restrictions to impose
* on restricted users. The broadcast intent contains an extra
* {@link #EXTRA_RESTRICTIONS_BUNDLE} with the currently persisted
* restrictions as a Bundle of key/value pairs. The value types can be Boolean, String or
* String[] depending on the restriction type.
* {@link #EXTRA_PACKAGES} specifies the packages on the process holding the media resource
* granted.
*
* This is a protected intent that can only be sent by the system.
*
* This requires {@link android.Manifest.permission#RECEIVE_MEDIA_RESOURCE_USAGE} permission.
*
* Each document is represented as a {@code content://} URI backed by a
* {@link DocumentsProvider}, which can be opened as a stream with
* {@link ContentResolver#openFileDescriptor(Uri, String)}, or queried for
* {@link android.provider.DocumentsContract.Document} metadata.
*
* All selected documents are returned to the calling application with
* persistable read and write permission grants. If you want to maintain
* access to the documents across device reboots, you need to explicitly
* take the persistable permissions using
* {@link ContentResolver#takePersistableUriPermission(Uri, int)}.
*
* Callers must indicate the acceptable document MIME types through
* {@link #setType(String)}. For example, to select photos, use
* {@code image/*}. If multiple disjoint MIME types are acceptable, define
* them in {@link #EXTRA_MIME_TYPES} and {@link #setType(String)} to
* {@literal *}/*.
*
* If the caller can handle multiple returned items (the user performing
* multiple selection), then you can specify {@link #EXTRA_ALLOW_MULTIPLE}
* to indicate this.
*
* Callers must include {@link #CATEGORY_OPENABLE} in the Intent to obtain
* URIs that can be opened with
* {@link ContentResolver#openFileDescriptor(Uri, String)}.
*
* Output: The URI of the item that was picked, returned in
* {@link #getData()}. This must be a {@code content://} URI so that any
* receiver can access it. If multiple documents were selected, they are
* returned in {@link #getClipData()}.
*
* @see DocumentsContract
* @see #ACTION_OPEN_DOCUMENT_TREE
* @see #ACTION_CREATE_DOCUMENT
* @see #FLAG_GRANT_PERSISTABLE_URI_PERMISSION
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_OPEN_DOCUMENT = "android.intent.action.OPEN_DOCUMENT";
/**
* Activity Action: Allow the user to create a new document. When invoked,
* the system will display the various {@link DocumentsProvider} instances
* installed on the device, letting the user navigate through them. The
* returned document may be a newly created document with no content, or it
* may be an existing document with the requested MIME type.
*
* Each document is represented as a {@code content://} URI backed by a
* {@link DocumentsProvider}, which can be opened as a stream with
* {@link ContentResolver#openFileDescriptor(Uri, String)}, or queried for
* {@link android.provider.DocumentsContract.Document} metadata.
*
* Callers must indicate the concrete MIME type of the document being
* created by setting {@link #setType(String)}. This MIME type cannot be
* changed after the document is created.
*
* Callers can provide an initial display name through {@link #EXTRA_TITLE},
* but the user may change this value before creating the file.
*
* Callers must include {@link #CATEGORY_OPENABLE} in the Intent to obtain
* URIs that can be opened with
* {@link ContentResolver#openFileDescriptor(Uri, String)}.
*
* Output: The URI of the item that was created. This must be a
* {@code content://} URI so that any receiver can access it.
*
* @see DocumentsContract
* @see #ACTION_OPEN_DOCUMENT
* @see #ACTION_OPEN_DOCUMENT_TREE
* @see #FLAG_GRANT_PERSISTABLE_URI_PERMISSION
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_CREATE_DOCUMENT = "android.intent.action.CREATE_DOCUMENT";
/**
* Activity Action: Allow the user to pick a directory subtree. When
* invoked, the system will display the various {@link DocumentsProvider}
* instances installed on the device, letting the user navigate through
* them. Apps can fully manage documents within the returned directory.
*
* To gain access to descendant (child, grandchild, etc) documents, use
* {@link DocumentsContract#buildDocumentUriUsingTree(Uri, String)} and
* {@link DocumentsContract#buildChildDocumentsUriUsingTree(Uri, String)}
* with the returned URI.
*
* Output: The URI representing the selected directory tree.
*
* @see DocumentsContract
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String
ACTION_OPEN_DOCUMENT_TREE = "android.intent.action.OPEN_DOCUMENT_TREE";
/**
* Broadcast Action: List of dynamic sensor is changed due to new sensor being connected or
* exisiting sensor being disconnected.
*
* This is a protected intent that can only be sent by the system. This broadcast is sent only for settings provider entries known to require special handling
* around restore time. These entries are found in the BROADCAST_ON_RESTORE table within
* the provider's backup agent implementation.
*
* @see #EXTRA_SETTING_NAME
* @see #EXTRA_SETTING_PREVIOUS_VALUE
* @see #EXTRA_SETTING_NEW_VALUE
* {@hide}
*/
public static final String ACTION_SETTING_RESTORED = "android.os.action.SETTING_RESTORED";
/** {@hide} */
public static final String EXTRA_SETTING_NAME = "setting_name";
/** {@hide} */
public static final String EXTRA_SETTING_PREVIOUS_VALUE = "previous_value";
/** {@hide} */
public static final String EXTRA_SETTING_NEW_VALUE = "new_value";
/**
* Activity Action: Process a piece of text.
* Input: {@link #EXTRA_PROCESS_TEXT} contains the text to be processed.
* {@link #EXTRA_PROCESS_TEXT_READONLY} states if the resulting text will be read-only. Output: {@link #EXTRA_PROCESS_TEXT} contains the processed text. Supporting this category means that you would like your activity to be
* displayed in the set of alternative things the user can do, usually as
* part of the current activity's options menu. You will usually want to
* include a specific label in the <intent-filter> of this action
* describing to the user what it does.
*
* The action of IntentFilter with this category is important in that it
* describes the specific action the target will perform. This generally
* should not be a generic action (such as {@link #ACTION_VIEW}, but rather
* a specific name such as "com.android.camera.action.CROP. Only one
* alternative of any particular action will be shown to the user, so using
* a specific action like this makes sure that your alternative will be
* displayed while also allowing other applications to provide their own
* overrides of that particular action.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_ALTERNATIVE = "android.intent.category.ALTERNATIVE";
/**
* Set if the activity should be considered as an alternative selection
* action to the data the user has currently selected. This is like
* {@link #CATEGORY_ALTERNATIVE}, but is used in activities showing a list
* of items from which the user can select, giving them alternatives to the
* default action that will be performed on it.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_SELECTED_ALTERNATIVE = "android.intent.category.SELECTED_ALTERNATIVE";
/**
* Intended to be used as a tab inside of a containing TabActivity.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_TAB = "android.intent.category.TAB";
/**
* Should be displayed in the top-level launcher.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_LAUNCHER = "android.intent.category.LAUNCHER";
/**
* Indicates an activity optimized for Leanback mode, and that should
* be displayed in the Leanback launcher.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_LEANBACK_LAUNCHER = "android.intent.category.LEANBACK_LAUNCHER";
/**
* Indicates a Leanback settings activity to be displayed in the Leanback launcher.
* @hide
*/
@SystemApi
public static final String CATEGORY_LEANBACK_SETTINGS = "android.intent.category.LEANBACK_SETTINGS";
/**
* Provides information about the package it is in; typically used if
* a package does not contain a {@link #CATEGORY_LAUNCHER} to provide
* a front-door to the user without having to be shown in the all apps list.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_INFO = "android.intent.category.INFO";
/**
* This is the home activity, that is the first activity that is displayed
* when the device boots.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_HOME = "android.intent.category.HOME";
/**
* This is the home activity that is displayed when the device is finished setting up and ready
* for use.
* @hide
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_HOME_MAIN = "android.intent.category.HOME_MAIN";
/**
* This is the setup wizard activity, that is the first activity that is displayed
* when the user sets up the device for the first time.
* @hide
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_SETUP_WIZARD = "android.intent.category.SETUP_WIZARD";
/**
* This activity is a preference panel.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_PREFERENCE = "android.intent.category.PREFERENCE";
/**
* This activity is a development preference panel.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_DEVELOPMENT_PREFERENCE = "android.intent.category.DEVELOPMENT_PREFERENCE";
/**
* Capable of running inside a parent activity container.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_EMBED = "android.intent.category.EMBED";
/**
* This activity allows the user to browse and download new applications.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_APP_MARKET = "android.intent.category.APP_MARKET";
/**
* This activity may be exercised by the monkey or other automated test tools.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_MONKEY = "android.intent.category.MONKEY";
/**
* To be used as a test (not part of the normal user experience).
*/
public static final String CATEGORY_TEST = "android.intent.category.TEST";
/**
* To be used as a unit test (run through the Test Harness).
*/
public static final String CATEGORY_UNIT_TEST = "android.intent.category.UNIT_TEST";
/**
* To be used as a sample code example (not part of the normal user
* experience).
*/
public static final String CATEGORY_SAMPLE_CODE = "android.intent.category.SAMPLE_CODE";
/**
* Used to indicate that an intent only wants URIs that can be opened with
* {@link ContentResolver#openFileDescriptor(Uri, String)}. Openable URIs
* must support at least the columns defined in {@link OpenableColumns} when
* queried.
*
* @see #ACTION_GET_CONTENT
* @see #ACTION_OPEN_DOCUMENT
* @see #ACTION_CREATE_DOCUMENT
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_OPENABLE = "android.intent.category.OPENABLE";
/**
* To be used as code under test for framework instrumentation tests.
*/
public static final String CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST =
"android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST";
/**
* An activity to run when device is inserted into a car dock.
* Used with {@link #ACTION_MAIN} to launch an activity. For more
* information, see {@link android.app.UiModeManager}.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_CAR_DOCK = "android.intent.category.CAR_DOCK";
/**
* An activity to run when device is inserted into a car dock.
* Used with {@link #ACTION_MAIN} to launch an activity. For more
* information, see {@link android.app.UiModeManager}.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_DESK_DOCK = "android.intent.category.DESK_DOCK";
/**
* An activity to run when device is inserted into a analog (low end) dock.
* Used with {@link #ACTION_MAIN} to launch an activity. For more
* information, see {@link android.app.UiModeManager}.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_LE_DESK_DOCK = "android.intent.category.LE_DESK_DOCK";
/**
* An activity to run when device is inserted into a digital (high end) dock.
* Used with {@link #ACTION_MAIN} to launch an activity. For more
* information, see {@link android.app.UiModeManager}.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_HE_DESK_DOCK = "android.intent.category.HE_DESK_DOCK";
/**
* Used to indicate that the activity can be used in a car environment.
*/
@SdkConstant(SdkConstantType.INTENT_CATEGORY)
public static final String CATEGORY_CAR_MODE = "android.intent.category.CAR_MODE";
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Application launch intent categories (see addCategory()).
/**
* Used with {@link #ACTION_MAIN} to launch the browser application.
* The activity should be able to browse the Internet.
* NOTE: This should not be used as the primary key of an Intent,
* since it will not result in the app launching with the correct
* action and category. Instead, use this with
* {@link #makeMainSelectorActivity(String, String)} to generate a main
* Intent with this category in the selector. NOTE: This should not be used as the primary key of an Intent,
* since it will not result in the app launching with the correct
* action and category. Instead, use this with
* {@link #makeMainSelectorActivity(String, String)} to generate a main
* Intent with this category in the selector. NOTE: This should not be used as the primary key of an Intent,
* since it will not result in the app launching with the correct
* action and category. Instead, use this with
* {@link #makeMainSelectorActivity(String, String)} to generate a main
* Intent with this category in the selector. NOTE: This should not be used as the primary key of an Intent,
* since it will not result in the app launching with the correct
* action and category. Instead, use this with
* {@link #makeMainSelectorActivity(String, String)} to generate a main
* Intent with this category in the selector. NOTE: This should not be used as the primary key of an Intent,
* since it will not result in the app launching with the correct
* action and category. Instead, use this with
* {@link #makeMainSelectorActivity(String, String)} to generate a main
* Intent with this category in the selector. NOTE: This should not be used as the primary key of an Intent,
* since it will not result in the app launching with the correct
* action and category. Instead, use this with
* {@link #makeMainSelectorActivity(String, String)} to generate a main
* Intent with this category in the selector. NOTE: This should not be used as the primary key of an Intent,
* since it will not result in the app launching with the correct
* action and category. Instead, use this with
* {@link #makeMainSelectorActivity(String, String)} to generate a main
* Intent with this category in the selector. NOTE: This should not be used as the primary key of an Intent,
* since it will not result in the app launching with the correct
* action and category. Instead, use this with
* {@link #makeMainSelectorActivity(String, String)} to generate a main
* Intent with this category in the selector. NOTE: This should not be used as the primary key of an Intent,
* since it will not result in the app launching with the correct
* action and category. Instead, use this with
* {@link #makeMainSelectorActivity(String, String)} to generate a main
* Intent with this category in the selector. An app may be capable of providing several different payload types to complete a
* user's intended action. For example, an app invoking {@link #ACTION_SEND} to share photos
* with another app may use EXTRA_ALTERNATE_INTENTS to have the chooser transparently offer
* several different supported sending mechanisms for sharing, such as the actual "image/*"
* photo data or a hosted link where the photos can be viewed. The intent present in {@link #EXTRA_INTENT} will be treated as the
* first/primary/preferred intent in the set. Additional intents specified in
* this extra are ordered; by default intents that appear earlier in the array will be
* preferred over intents that appear later in the array as matches for the same
* target component. To alter this preference, a calling app may also supply
* {@link #EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER}. When used with {@link #ACTION_CHOOSER}, the chooser will omit any of the components
* in this array if it otherwise would have shown them. Useful for omitting specific targets
* from your own package or other apps from your organization if the idea of sending to those
* targets would be redundant with other app functionality. Filtered components will not
* be able to present targets from an associated Targets provided in this way will be presented inline with all other targets provided
* by services from other apps. They will be prioritized before other service targets, but
* after those targets provided by sources that the user has manually pinned to the front. An app preparing an action for another app to complete may wish to allow the user to
* disambiguate between several options for completing the action based on the chosen target
* or otherwise refine the action before it is invoked.
* When sent, this IntentSender may be filled in with the following extras: Used to complete an app-specific
* {@link #EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER refinement} for {@link #ACTION_CHOOSER}. If {@link #EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER} is present in the intent
* used to start a {@link #ACTION_CHOOSER} activity this extra will be
* {@link #fillIn(Intent, int) filled in} to that {@link IntentSender} and sent
* when the user selects a target component from the chooser. It is up to the recipient
* to send a result to this ResultReceiver to signal that disambiguation is complete
* and that the chooser should invoke the user's choice. The disambiguator should provide a Bundle to the ResultReceiver with an intent
* assigned to the key {@link #EXTRA_INTENT}. This supplied intent will be used by the chooser
* to match and fill in the final Intent or ChooserTarget before starting it.
* The supplied intent must {@link #filterEquals(Intent) match} one of the intents from
* {@link #EXTRA_INTENT} or {@link #EXTRA_ALTERNATE_INTENTS} passed to
* {@link #EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER} to be accepted. The result code passed to the ResultReceiver should be
* {@link android.app.Activity#RESULT_OK} if the refinement succeeded and the supplied intent's
* target in the chooser should be started, or {@link android.app.Activity#RESULT_CANCELED} if
* the chooser should finish without starting a target. An application may choose to provide alternate extras for the case where a user
* selects an activity from a predetermined set of target packages. If the activity
* the user selects from the chooser belongs to a package with its package name as
* a key in this bundle, the corresponding extras for that package will be merged with
* the extras already present in the intent at {@link #EXTRA_INTENT}. If a replacement
* extra has the same key as an extra already present in the intent it will overwrite
* the extra from the intent. Examples:
* In some situations this callback may never come, for example if the user abandons
* the chooser, switches to another task or any number of other reasons. Apps should not
* be written assuming that this callback will always occur. The value must be an integer greater or equal to 0.
*/
public static final String EXTRA_INDEX = "android.intent.extra.INDEX";
/**
* Optional boolean extra indicating whether quiet mode has been switched on or off.
* When a profile goes into quiet mode, all apps in the profile are killed and the
* profile user is stopped. Widgets originating from the profile are masked, and app
* launcher icons are grayed out.
*/
public static final String EXTRA_QUIET_MODE = "android.intent.extra.QUIET_MODE";
/**
* Used as an int extra field in {@link #ACTION_MEDIA_RESOURCE_GRANTED}
* intents to specify the resource type granted. Possible values are
* {@link #EXTRA_MEDIA_RESOURCE_TYPE_VIDEO_CODEC} or
* {@link #EXTRA_MEDIA_RESOURCE_TYPE_AUDIO_CODEC}.
*
* @hide
*/
public static final String EXTRA_MEDIA_RESOURCE_TYPE =
"android.intent.extra.MEDIA_RESOURCE_TYPE";
/**
* Used as an int value for {@link #EXTRA_MEDIA_RESOURCE_TYPE}
* to represent that a video codec is allowed to use.
*
* @hide
*/
public static final int EXTRA_MEDIA_RESOURCE_TYPE_VIDEO_CODEC = 0;
/**
* Used as an int value for {@link #EXTRA_MEDIA_RESOURCE_TYPE}
* to represent that a audio codec is allowed to use.
*
* @hide
*/
public static final int EXTRA_MEDIA_RESOURCE_TYPE_AUDIO_CODEC = 1;
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Intent flags (see mFlags variable).
/** @hide */
@IntDef(flag = true, value = {
FLAG_GRANT_READ_URI_PERMISSION, FLAG_GRANT_WRITE_URI_PERMISSION,
FLAG_GRANT_PERSISTABLE_URI_PERMISSION, FLAG_GRANT_PREFIX_URI_PERMISSION })
@Retention(RetentionPolicy.SOURCE)
public @interface GrantUriMode {}
/** @hide */
@IntDef(flag = true, value = {
FLAG_GRANT_READ_URI_PERMISSION, FLAG_GRANT_WRITE_URI_PERMISSION })
@Retention(RetentionPolicy.SOURCE)
public @interface AccessUriMode {}
/**
* Test if given mode flags specify an access mode, which must be at least
* read and/or write.
*
* @hide
*/
public static boolean isAccessUriMode(int modeFlags) {
return (modeFlags & (Intent.FLAG_GRANT_READ_URI_PERMISSION
| Intent.FLAG_GRANT_WRITE_URI_PERMISSION)) != 0;
}
/**
* If set, the recipient of this Intent will be granted permission to
* perform read operations on the URI in the Intent's data and any URIs
* specified in its ClipData. When applying to an Intent's ClipData,
* all URIs as well as recursive traversals through data or other ClipData
* in Intent items will be granted; only the grant flags of the top-level
* Intent are used.
*/
public static final int FLAG_GRANT_READ_URI_PERMISSION = 0x00000001;
/**
* If set, the recipient of this Intent will be granted permission to
* perform write operations on the URI in the Intent's data and any URIs
* specified in its ClipData. When applying to an Intent's ClipData,
* all URIs as well as recursive traversals through data or other ClipData
* in Intent items will be granted; only the grant flags of the top-level
* Intent are used.
*/
public static final int FLAG_GRANT_WRITE_URI_PERMISSION = 0x00000002;
/**
* Can be set by the caller to indicate that this Intent is coming from
* a background operation, not from direct user interaction.
*/
public static final int FLAG_FROM_BACKGROUND = 0x00000004;
/**
* A flag you can enable for debugging: when set, log messages will be
* printed during the resolution of this intent to show you what has
* been found to create the final resolved list.
*/
public static final int FLAG_DEBUG_LOG_RESOLUTION = 0x00000008;
/**
* If set, this intent will not match any components in packages that
* are currently stopped. If this is not set, then the default behavior
* is to include such applications in the result.
*/
public static final int FLAG_EXCLUDE_STOPPED_PACKAGES = 0x00000010;
/**
* If set, this intent will always match any components in packages that
* are currently stopped. This is the default behavior when
* {@link #FLAG_EXCLUDE_STOPPED_PACKAGES} is not set. If both of these
* flags are set, this one wins (it allows overriding of exclude for
* places where the framework may automatically set the exclude flag).
*/
public static final int FLAG_INCLUDE_STOPPED_PACKAGES = 0x00000020;
/**
* When combined with {@link #FLAG_GRANT_READ_URI_PERMISSION} and/or
* {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, the URI permission grant can be
* persisted across device reboots until explicitly revoked with
* {@link Context#revokeUriPermission(Uri, int)}. This flag only offers the
* grant for possible persisting; the receiving application must call
* {@link ContentResolver#takePersistableUriPermission(Uri, int)} to
* actually persist.
*
* @see ContentResolver#takePersistableUriPermission(Uri, int)
* @see ContentResolver#releasePersistableUriPermission(Uri, int)
* @see ContentResolver#getPersistedUriPermissions()
* @see ContentResolver#getOutgoingPersistedUriPermissions()
*/
public static final int FLAG_GRANT_PERSISTABLE_URI_PERMISSION = 0x00000040;
/**
* When combined with {@link #FLAG_GRANT_READ_URI_PERMISSION} and/or
* {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, the URI permission grant
* applies to any URI that is a prefix match against the original granted
* URI. (Without this flag, the URI must match exactly for access to be
* granted.) Another URI is considered a prefix match only when scheme,
* authority, and all path segments defined by the prefix are an exact
* match.
*/
public static final int FLAG_GRANT_PREFIX_URI_PERMISSION = 0x00000080;
/**
* Internal flag used to indicate that a system component has done their
* homework and verified that they correctly handle packages and components
* that come and go over time. In particular:
* If set, {@link android.app.Activity#onActivityResult onActivityResult()}
* is never invoked when the current activity starts a new activity which
* sets a result and finishes.
*/
public static final int FLAG_ACTIVITY_NO_HISTORY = 0x40000000;
/**
* If set, the activity will not be launched if it is already running
* at the top of the history stack.
*/
public static final int FLAG_ACTIVITY_SINGLE_TOP = 0x20000000;
/**
* If set, this activity will become the start of a new task on this
* history stack. A task (from the activity that started it to the
* next task activity) defines an atomic group of activities that the
* user can move to. Tasks can be moved to the foreground and background;
* all of the activities inside of a particular task always remain in
* the same order. See
* Tasks and Back
* Stack for more information about tasks.
*
* This flag is generally used by activities that want
* to present a "launcher" style behavior: they give the user a list of
* separate things that can be done, which otherwise run completely
* independently of the activity launching them.
*
* When using this flag, if a task is already running for the activity
* you are now starting, then a new activity will not be started; instead,
* the current task will simply be brought to the front of the screen with
* the state it was last in. See {@link #FLAG_ACTIVITY_MULTIPLE_TASK} for a flag
* to disable this behavior.
*
* This flag can not be used when the caller is requesting a result from
* the activity being launched.
*/
public static final int FLAG_ACTIVITY_NEW_TASK = 0x10000000;
/**
* This flag is used to create a new task and launch an activity into it.
* This flag is always paired with either {@link #FLAG_ACTIVITY_NEW_DOCUMENT}
* or {@link #FLAG_ACTIVITY_NEW_TASK}. In both cases these flags alone would
* search through existing tasks for ones matching this Intent. Only if no such
* task is found would a new task be created. When paired with
* FLAG_ACTIVITY_MULTIPLE_TASK both of these behaviors are modified to skip
* the search for a matching task and unconditionally start a new task.
*
* When used with {@link #FLAG_ACTIVITY_NEW_TASK} do not use this
* flag unless you are implementing your own
* top-level application launcher. Used in conjunction with
* {@link #FLAG_ACTIVITY_NEW_TASK} to disable the
* behavior of bringing an existing task to the foreground. When set,
* a new task is always started to host the Activity for the
* Intent, regardless of whether there is already an existing task running
* the same thing.
*
* Because the default system does not include graphical task management,
* you should not use this flag unless you provide some way for a user to
* return back to the tasks you have launched.
*
* See {@link #FLAG_ACTIVITY_NEW_DOCUMENT} for details of this flag's use for
* creating new document tasks.
*
* This flag is ignored if one of {@link #FLAG_ACTIVITY_NEW_TASK} or
* {@link #FLAG_ACTIVITY_NEW_DOCUMENT} is not also set.
*
* See
* Tasks and Back
* Stack for more information about tasks.
*
* @see #FLAG_ACTIVITY_NEW_DOCUMENT
* @see #FLAG_ACTIVITY_NEW_TASK
*/
public static final int FLAG_ACTIVITY_MULTIPLE_TASK = 0x08000000;
/**
* If set, and the activity being launched is already running in the
* current task, then instead of launching a new instance of that activity,
* all of the other activities on top of it will be closed and this Intent
* will be delivered to the (now on top) old activity as a new Intent.
*
* For example, consider a task consisting of the activities: A, B, C, D.
* If D calls startActivity() with an Intent that resolves to the component
* of activity B, then C and D will be finished and B receive the given
* Intent, resulting in the stack now being: A, B.
*
* The currently running instance of activity B in the above example will
* either receive the new intent you are starting here in its
* onNewIntent() method, or be itself finished and restarted with the
* new intent. If it has declared its launch mode to be "multiple" (the
* default) and you have not set {@link #FLAG_ACTIVITY_SINGLE_TOP} in
* the same intent, then it will be finished and re-created; for all other
* launch modes or if {@link #FLAG_ACTIVITY_SINGLE_TOP} is set then this
* Intent will be delivered to the current instance's onNewIntent().
*
* This launch mode can also be used to good effect in conjunction with
* {@link #FLAG_ACTIVITY_NEW_TASK}: if used to start the root activity
* of a task, it will bring any currently running instance of that task
* to the foreground, and then clear it to its root state. This is
* especially useful, for example, when launching an activity from the
* notification manager.
*
* See
* Tasks and Back
* Stack for more information about tasks.
*/
public static final int FLAG_ACTIVITY_CLEAR_TOP = 0x04000000;
/**
* If set and this intent is being used to launch a new activity from an
* existing one, then the reply target of the existing activity will be
* transfered to the new activity. This way the new activity can call
* {@link android.app.Activity#setResult} and have that result sent back to
* the reply target of the original activity.
*/
public static final int FLAG_ACTIVITY_FORWARD_RESULT = 0x02000000;
/**
* If set and this intent is being used to launch a new activity from an
* existing one, the current activity will not be counted as the top
* activity for deciding whether the new intent should be delivered to
* the top instead of starting a new one. The previous activity will
* be used as the top, with the assumption being that the current activity
* will finish itself immediately.
*/
public static final int FLAG_ACTIVITY_PREVIOUS_IS_TOP = 0x01000000;
/**
* If set, the new activity is not kept in the list of recently launched
* activities.
*/
public static final int FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS = 0x00800000;
/**
* This flag is not normally set by application code, but set for you by
* the system as described in the
* {@link android.R.styleable#AndroidManifestActivity_launchMode
* launchMode} documentation for the singleTask mode.
*/
public static final int FLAG_ACTIVITY_BROUGHT_TO_FRONT = 0x00400000;
/**
* If set, and this activity is either being started in a new task or
* bringing to the top an existing task, then it will be launched as
* the front door of the task. This will result in the application of
* any affinities needed to have that task in the proper state (either
* moving activities to or from it), or simply resetting that task to
* its initial state if needed.
*/
public static final int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED = 0x00200000;
/**
* This flag is not normally set by application code, but set for you by
* the system if this activity is being launched from history
* (longpress home key).
*/
public static final int FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY = 0x00100000;
/**
* @deprecated As of API 21 this performs identically to
* {@link #FLAG_ACTIVITY_NEW_DOCUMENT} which should be used instead of this.
*/
public static final int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET = 0x00080000;
/**
* This flag is used to open a document into a new task rooted at the activity launched
* by this Intent. Through the use of this flag, or its equivalent attribute,
* {@link android.R.attr#documentLaunchMode} multiple instances of the same activity
* containing different documents will appear in the recent tasks list.
*
* The use of the activity attribute form of this,
* {@link android.R.attr#documentLaunchMode}, is
* preferred over the Intent flag described here. The attribute form allows the
* Activity to specify multiple document behavior for all launchers of the Activity
* whereas using this flag requires each Intent that launches the Activity to specify it.
*
* Note that the default semantics of this flag w.r.t. whether the recents entry for
* it is kept after the activity is finished is different than the use of
* {@link #FLAG_ACTIVITY_NEW_TASK} and {@link android.R.attr#documentLaunchMode} -- if
* this flag is being used to create a new recents entry, then by default that entry
* will be removed once the activity is finished. You can modify this behavior with
* {@link #FLAG_ACTIVITY_RETAIN_IN_RECENTS}.
*
* FLAG_ACTIVITY_NEW_DOCUMENT may be used in conjunction with {@link
* #FLAG_ACTIVITY_MULTIPLE_TASK}. When used alone it is the
* equivalent of the Activity manifest specifying {@link
* android.R.attr#documentLaunchMode}="intoExisting". When used with
* FLAG_ACTIVITY_MULTIPLE_TASK it is the equivalent of the Activity manifest specifying
* {@link android.R.attr#documentLaunchMode}="always".
*
* Refer to {@link android.R.attr#documentLaunchMode} for more information.
*
* @see android.R.attr#documentLaunchMode
* @see #FLAG_ACTIVITY_MULTIPLE_TASK
*/
public static final int FLAG_ACTIVITY_NEW_DOCUMENT = FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET;
/**
* If set, this flag will prevent the normal {@link android.app.Activity#onUserLeaveHint}
* callback from occurring on the current frontmost activity before it is
* paused as the newly-started activity is brought to the front.
*
* Typically, an activity can rely on that callback to indicate that an
* explicit user action has caused their activity to be moved out of the
* foreground. The callback marks an appropriate point in the activity's
* lifecycle for it to dismiss any notifications that it intends to display
* "until the user has seen them," such as a blinking LED.
*
* If an activity is ever started via any non-user-driven events such as
* phone-call receipt or an alarm handler, this flag should be passed to {@link
* Context#startActivity Context.startActivity}, ensuring that the pausing
* activity does not think the user has acknowledged its notification.
*/
public static final int FLAG_ACTIVITY_NO_USER_ACTION = 0x00040000;
/**
* If set in an Intent passed to {@link Context#startActivity Context.startActivity()},
* this flag will cause the launched activity to be brought to the front of its
* task's history stack if it is already running.
*
* For example, consider a task consisting of four activities: A, B, C, D.
* If D calls startActivity() with an Intent that resolves to the component
* of activity B, then B will be brought to the front of the history stack,
* with this resulting order: A, C, D, B.
*
* This flag will be ignored if {@link #FLAG_ACTIVITY_CLEAR_TOP} is also
* specified.
*/
public static final int FLAG_ACTIVITY_REORDER_TO_FRONT = 0X00020000;
/**
* If set in an Intent passed to {@link Context#startActivity Context.startActivity()},
* this flag will prevent the system from applying an activity transition
* animation to go to the next activity state. This doesn't mean an
* animation will never run -- if another activity change happens that doesn't
* specify this flag before the activity started here is displayed, then
* that transition will be used. This flag can be put to good use
* when you are going to do a series of activity operations but the
* animation seen by the user shouldn't be driven by the first activity
* change but rather a later one.
*/
public static final int FLAG_ACTIVITY_NO_ANIMATION = 0X00010000;
/**
* If set in an Intent passed to {@link Context#startActivity Context.startActivity()},
* this flag will cause any existing task that would be associated with the
* activity to be cleared before the activity is started. That is, the activity
* becomes the new root of an otherwise empty task, and any old activities
* are finished. This can only be used in conjunction with {@link #FLAG_ACTIVITY_NEW_TASK}.
*/
public static final int FLAG_ACTIVITY_CLEAR_TASK = 0X00008000;
/**
* If set in an Intent passed to {@link Context#startActivity Context.startActivity()},
* this flag will cause a newly launching task to be placed on top of the current
* home activity task (if there is one). That is, pressing back from the task
* will always return the user to home even if that was not the last activity they
* saw. This can only be used in conjunction with {@link #FLAG_ACTIVITY_NEW_TASK}.
*/
public static final int FLAG_ACTIVITY_TASK_ON_HOME = 0X00004000;
/**
* By default a document created by {@link #FLAG_ACTIVITY_NEW_DOCUMENT} will
* have its entry in recent tasks removed when the user closes it (with back
* or however else it may finish()). If you would like to instead allow the
* document to be kept in recents so that it can be re-launched, you can use
* this flag. When set and the task's activity is finished, the recents
* entry will remain in the interface for the user to re-launch it, like a
* recents entry for a top-level application.
*
* The receiving activity can override this request with
* {@link android.R.attr#autoRemoveFromRecents} or by explcitly calling
* {@link android.app.Activity#finishAndRemoveTask()
* Activity.finishAndRemoveTask()}.
*/
public static final int FLAG_ACTIVITY_RETAIN_IN_RECENTS = 0x00002000;
/**
* This flag is only used in split-screen multi-window mode. The new activity will be displayed
* adjacent to the one launching it. This can only be used in conjunction with
* {@link #FLAG_ACTIVITY_NEW_TASK}. Also, setting {@link #FLAG_ACTIVITY_MULTIPLE_TASK} is
* required if you want a new instance of an existing activity to be created.
*/
public static final int FLAG_ACTIVITY_LAUNCH_ADJACENT = 0x00001000;
/**
* If set, when sending a broadcast only registered receivers will be
* called -- no BroadcastReceiver components will be launched.
*/
public static final int FLAG_RECEIVER_REGISTERED_ONLY = 0x40000000;
/**
* If set, when sending a broadcast the new broadcast will replace
* any existing pending broadcast that matches it. Matching is defined
* by {@link Intent#filterEquals(Intent) Intent.filterEquals} returning
* true for the intents of the two broadcasts. When a match is found,
* the new broadcast (and receivers associated with it) will replace the
* existing one in the pending broadcast list, remaining at the same
* position in the list.
*
* This flag is most typically used with sticky broadcasts, which
* only care about delivering the most recent values of the broadcast
* to their receivers.
*/
public static final int FLAG_RECEIVER_REPLACE_PENDING = 0x20000000;
/**
* If set, when sending a broadcast the recipient is allowed to run at
* foreground priority, with a shorter timeout interval. During normal
* broadcasts the receivers are not automatically hoisted out of the
* background priority class.
*/
public static final int FLAG_RECEIVER_FOREGROUND = 0x10000000;
/**
* If this is an ordered broadcast, don't allow receivers to abort the broadcast.
* They can still propagate results through to later receivers, but they can not prevent
* later receivers from seeing the broadcast.
*/
public static final int FLAG_RECEIVER_NO_ABORT = 0x08000000;
/**
* If set, when sending a broadcast before boot has completed only
* registered receivers will be called -- no BroadcastReceiver components
* will be launched. Sticky intent state will be recorded properly even
* if no receivers wind up being called. If {@link #FLAG_RECEIVER_REGISTERED_ONLY}
* is specified in the broadcast intent, this flag is unnecessary.
*
* This flag is only for use by system sevices as a convenience to
* avoid having to implement a more complex mechanism around detection
* of boot completion.
*
* @hide
*/
public static final int FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT = 0x04000000;
/**
* Set when this broadcast is for a boot upgrade, a special mode that
* allows the broadcast to be sent before the system is ready and launches
* the app process with no providers running in it.
* @hide
*/
public static final int FLAG_RECEIVER_BOOT_UPGRADE = 0x02000000;
/**
* If set, the broadcast will always go to manifest receivers in background (cached
* or not running) apps, regardless of whether that would be done by default. By
* default they will only receive broadcasts if the broadcast has specified an
* explicit component or package name.
* @hide
*/
public static final int FLAG_RECEIVER_INCLUDE_BACKGROUND = 0x01000000;
/**
* If set, the broadcast will never go to manifest receivers in background (cached
* or not running) apps, regardless of whether that would be done by default. By
* default they will receive broadcasts if the broadcast has specified an
* explicit component or package name.
* @hide
*/
public static final int FLAG_RECEIVER_EXCLUDE_BACKGROUND = 0x00800000;
/**
* @hide Flags that can't be changed with PendingIntent.
*/
public static final int IMMUTABLE_FLAGS = FLAG_GRANT_READ_URI_PERMISSION
| FLAG_GRANT_WRITE_URI_PERMISSION | FLAG_GRANT_PERSISTABLE_URI_PERMISSION
| FLAG_GRANT_PREFIX_URI_PERMISSION;
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// toUri() and parseUri() options.
/**
* Flag for use with {@link #toUri} and {@link #parseUri}: the URI string
* always has the "intent:" scheme. This syntax can be used when you want
* to later disambiguate between URIs that are intended to describe an
* Intent vs. all others that should be treated as raw URIs. When used
* with {@link #parseUri}, any other scheme will result in a generic
* VIEW action for that raw URI.
*/
public static final int URI_INTENT_SCHEME = 1<<0;
/**
* Flag for use with {@link #toUri} and {@link #parseUri}: the URI string
* always has the "android-app:" scheme. This is a variation of
* {@link #URI_INTENT_SCHEME} whose format is simpler for the case of an
* http/https URI being delivered to a specific package name. The format
* is:
*
* In this scheme, only the Some examples of how this scheme maps to Intent objects: If you do not trust the source of the URI being parsed, you should still do further
* processing to protect yourself from it. In particular, when using it to start an
* activity you should usually add in {@link #CATEGORY_BROWSABLE} to limit the activities
* that can handle it. Note: scheme and host name matching in the Android framework is
* case-sensitive, unlike the formal RFC. As a result,
* you should always ensure that you write your Uri with these elements
* using lower case letters, and normalize any Uris you receive from
* outside of Android to ensure the scheme and host is lower case. Note: scheme and host name matching in the Android framework is
* case-sensitive, unlike the formal RFC. As a result,
* you should always ensure that you write your Uri with these elements
* using lower case letters, and normalize any Uris you receive from
* outside of Android to ensure the scheme and host is lower case. The returned Intent has the given Activity component as its explicit
* component, {@link #ACTION_MAIN} as its action, and includes the
* category {@link #CATEGORY_LAUNCHER}. This does not have
* {@link #FLAG_ACTIVITY_NEW_TASK} set, though typically you will want
* to do that through {@link #addFlags(int)} on the returned Intent.
*
* @param mainActivity The main activity component that this Intent will
* launch.
* @return Returns a newly created Intent that can be used to launch the
* activity as a main application entry.
*
* @see #setClass
* @see #setComponent
*/
public static Intent makeMainActivity(ComponentName mainActivity) {
Intent intent = new Intent(ACTION_MAIN);
intent.setComponent(mainActivity);
intent.addCategory(CATEGORY_LAUNCHER);
return intent;
}
/**
* Make an Intent for the main activity of an application, without
* specifying a specific activity to run but giving a selector to find
* the activity. This results in a final Intent that is structured
* the same as when the application is launched from
* Home. For anything else that wants to launch an application in the
* same way, it is important that they use an Intent structured the same
* way, and can use this function to ensure this is the case.
*
* The returned Intent has {@link #ACTION_MAIN} as its action, and includes the
* category {@link #CATEGORY_LAUNCHER}. This does not have
* {@link #FLAG_ACTIVITY_NEW_TASK} set, though typically you will want
* to do that through {@link #addFlags(int)} on the returned Intent.
*
* @param selectorAction The action name of the Intent's selector.
* @param selectorCategory The name of a category to add to the Intent's
* selector.
* @return Returns a newly created Intent that can be used to launch the
* activity as a main application entry.
*
* @see #setSelector(Intent)
*/
public static Intent makeMainSelectorActivity(String selectorAction,
String selectorCategory) {
Intent intent = new Intent(ACTION_MAIN);
intent.addCategory(CATEGORY_LAUNCHER);
Intent selector = new Intent();
selector.setAction(selectorAction);
selector.addCategory(selectorCategory);
intent.setSelector(selector);
return intent;
}
/**
* Make an Intent that can be used to re-launch an application's task
* in its base state. This is like {@link #makeMainActivity(ComponentName)},
* but also sets the flags {@link #FLAG_ACTIVITY_NEW_TASK} and
* {@link #FLAG_ACTIVITY_CLEAR_TASK}.
*
* @param mainActivity The activity component that is the root of the
* task; this is the activity that has been published in the application's
* manifest as the main launcher icon.
*
* @return Returns a newly created Intent that can be used to relaunch the
* activity's task in its root state.
*/
public static Intent makeRestartActivityTask(ComponentName mainActivity) {
Intent intent = makeMainActivity(mainActivity);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK);
return intent;
}
/**
* Call {@link #parseUri} with 0 flags.
* @deprecated Use {@link #parseUri} instead.
*/
@Deprecated
public static Intent getIntent(String uri) throws URISyntaxException {
return parseUri(uri, 0);
}
/**
* Create an intent from a URI. This URI may encode the action,
* category, and other intent fields, if it was returned by
* {@link #toUri}. If the Intent was not generate by toUri(), its data
* will be the entire URI and its action will be ACTION_VIEW.
*
* The URI given here must not be relative -- that is, it must include
* the scheme and full path.
*
* @param uri The URI to turn into an Intent.
* @param flags Additional processing flags. Either 0,
* {@link #URI_INTENT_SCHEME}, or {@link #URI_ANDROID_APP_SCHEME}.
*
* @return Intent The newly created Intent object.
*
* @throws URISyntaxException Throws URISyntaxError if the basic URI syntax
* it bad (as parsed by the Uri class) or the Intent data within the
* URI is invalid.
*
* @see #toUri
*/
public static Intent parseUri(String uri, int flags) throws URISyntaxException {
int i = 0;
try {
final boolean androidApp = uri.startsWith("android-app:");
// Validate intent scheme if requested.
if ((flags&(URI_INTENT_SCHEME|URI_ANDROID_APP_SCHEME)) != 0) {
if (!uri.startsWith("intent:") && !androidApp) {
Intent intent = new Intent(ACTION_VIEW);
try {
intent.setData(Uri.parse(uri));
} catch (IllegalArgumentException e) {
throw new URISyntaxException(uri, e.getMessage());
}
return intent;
}
}
i = uri.lastIndexOf("#");
// simple case
if (i == -1) {
if (!androidApp) {
return new Intent(ACTION_VIEW, Uri.parse(uri));
}
// old format Intent URI
} else if (!uri.startsWith("#Intent;", i)) {
if (!androidApp) {
return getIntentOld(uri, flags);
} else {
i = -1;
}
}
// new format
Intent intent = new Intent(ACTION_VIEW);
Intent baseIntent = intent;
boolean explicitAction = false;
boolean inSelector = false;
// fetch data part, if present
String scheme = null;
String data;
if (i >= 0) {
data = uri.substring(0, i);
i += 8; // length of "#Intent;"
} else {
data = uri;
}
// loop over contents of Intent, all name=value;
while (i >= 0 && !uri.startsWith("end", i)) {
int eq = uri.indexOf('=', i);
if (eq < 0) eq = i-1;
int semi = uri.indexOf(';', i);
String value = eq < semi ? Uri.decode(uri.substring(eq + 1, semi)) : "";
// action
if (uri.startsWith("action=", i)) {
intent.setAction(value);
if (!inSelector) {
explicitAction = true;
}
}
// categories
else if (uri.startsWith("category=", i)) {
intent.addCategory(value);
}
// type
else if (uri.startsWith("type=", i)) {
intent.mType = value;
}
// launch flags
else if (uri.startsWith("launchFlags=", i)) {
intent.mFlags = Integer.decode(value).intValue();
if ((flags& URI_ALLOW_UNSAFE) == 0) {
intent.mFlags &= ~IMMUTABLE_FLAGS;
}
}
// package
else if (uri.startsWith("package=", i)) {
intent.mPackage = value;
}
// component
else if (uri.startsWith("component=", i)) {
intent.mComponent = ComponentName.unflattenFromString(value);
}
// scheme
else if (uri.startsWith("scheme=", i)) {
if (inSelector) {
intent.mData = Uri.parse(value + ":");
} else {
scheme = value;
}
}
// source bounds
else if (uri.startsWith("sourceBounds=", i)) {
intent.mSourceBounds = Rect.unflattenFromString(value);
}
// selector
else if (semi == (i+3) && uri.startsWith("SEL", i)) {
intent = new Intent();
inSelector = true;
}
// extra
else {
String key = Uri.decode(uri.substring(i + 2, eq));
// create Bundle if it doesn't already exist
if (intent.mExtras == null) intent.mExtras = new Bundle();
Bundle b = intent.mExtras;
// add EXTRA
if (uri.startsWith("S.", i)) b.putString(key, value);
else if (uri.startsWith("B.", i)) b.putBoolean(key, Boolean.parseBoolean(value));
else if (uri.startsWith("b.", i)) b.putByte(key, Byte.parseByte(value));
else if (uri.startsWith("c.", i)) b.putChar(key, value.charAt(0));
else if (uri.startsWith("d.", i)) b.putDouble(key, Double.parseDouble(value));
else if (uri.startsWith("f.", i)) b.putFloat(key, Float.parseFloat(value));
else if (uri.startsWith("i.", i)) b.putInt(key, Integer.parseInt(value));
else if (uri.startsWith("l.", i)) b.putLong(key, Long.parseLong(value));
else if (uri.startsWith("s.", i)) b.putShort(key, Short.parseShort(value));
else throw new URISyntaxException(uri, "unknown EXTRA type", i);
}
// move to the next item
i = semi + 1;
}
if (inSelector) {
// The Intent had a selector; fix it up.
if (baseIntent.mPackage == null) {
baseIntent.setSelector(intent);
}
intent = baseIntent;
}
if (data != null) {
if (data.startsWith("intent:")) {
data = data.substring(7);
if (scheme != null) {
data = scheme + ':' + data;
}
} else if (data.startsWith("android-app:")) {
if (data.charAt(12) == '/' && data.charAt(13) == '/') {
// Correctly formed android-app, first part is package name.
int end = data.indexOf('/', 14);
if (end < 0) {
// All we have is a package name.
intent.mPackage = data.substring(14);
if (!explicitAction) {
intent.setAction(ACTION_MAIN);
}
data = "";
} else {
// Target the Intent at the given package name always.
String authority = null;
intent.mPackage = data.substring(14, end);
int newEnd;
if ((end+1) < data.length()) {
if ((newEnd=data.indexOf('/', end+1)) >= 0) {
// Found a scheme, remember it.
scheme = data.substring(end+1, newEnd);
end = newEnd;
if (end < data.length() && (newEnd=data.indexOf('/', end+1)) >= 0) {
// Found a authority, remember it.
authority = data.substring(end+1, newEnd);
end = newEnd;
}
} else {
// All we have is a scheme.
scheme = data.substring(end+1);
}
}
if (scheme == null) {
// If there was no scheme, then this just targets the package.
if (!explicitAction) {
intent.setAction(ACTION_MAIN);
}
data = "";
} else if (authority == null) {
data = scheme + ":";
} else {
data = scheme + "://" + authority + data.substring(end);
}
}
} else {
data = "";
}
}
if (data.length() > 0) {
try {
intent.mData = Uri.parse(data);
} catch (IllegalArgumentException e) {
throw new URISyntaxException(uri, e.getMessage());
}
}
}
return intent;
} catch (IndexOutOfBoundsException e) {
throw new URISyntaxException(uri, "illegal Intent URI format", i);
}
}
public static Intent getIntentOld(String uri) throws URISyntaxException {
return getIntentOld(uri, 0);
}
private static Intent getIntentOld(String uri, int flags) throws URISyntaxException {
Intent intent;
int i = uri.lastIndexOf('#');
if (i >= 0) {
String action = null;
final int intentFragmentStart = i;
boolean isIntentFragment = false;
i++;
if (uri.regionMatches(i, "action(", 0, 7)) {
isIntentFragment = true;
i += 7;
int j = uri.indexOf(')', i);
action = uri.substring(i, j);
i = j + 1;
}
intent = new Intent(action);
if (uri.regionMatches(i, "categories(", 0, 11)) {
isIntentFragment = true;
i += 11;
int j = uri.indexOf(')', i);
while (i < j) {
int sep = uri.indexOf('!', i);
if (sep < 0 || sep > j) sep = j;
if (i < sep) {
intent.addCategory(uri.substring(i, sep));
}
i = sep + 1;
}
i = j + 1;
}
if (uri.regionMatches(i, "type(", 0, 5)) {
isIntentFragment = true;
i += 5;
int j = uri.indexOf(')', i);
intent.mType = uri.substring(i, j);
i = j + 1;
}
if (uri.regionMatches(i, "launchFlags(", 0, 12)) {
isIntentFragment = true;
i += 12;
int j = uri.indexOf(')', i);
intent.mFlags = Integer.decode(uri.substring(i, j)).intValue();
if ((flags& URI_ALLOW_UNSAFE) == 0) {
intent.mFlags &= ~IMMUTABLE_FLAGS;
}
i = j + 1;
}
if (uri.regionMatches(i, "component(", 0, 10)) {
isIntentFragment = true;
i += 10;
int j = uri.indexOf(')', i);
int sep = uri.indexOf('!', i);
if (sep >= 0 && sep < j) {
String pkg = uri.substring(i, sep);
String cls = uri.substring(sep + 1, j);
intent.mComponent = new ComponentName(pkg, cls);
}
i = j + 1;
}
if (uri.regionMatches(i, "extras(", 0, 7)) {
isIntentFragment = true;
i += 7;
final int closeParen = uri.indexOf(')', i);
if (closeParen == -1) throw new URISyntaxException(uri,
"EXTRA missing trailing ')'", i);
while (i < closeParen) {
// fetch the key value
int j = uri.indexOf('=', i);
if (j <= i + 1 || i >= closeParen) {
throw new URISyntaxException(uri, "EXTRA missing '='", i);
}
char type = uri.charAt(i);
i++;
String key = uri.substring(i, j);
i = j + 1;
// get type-value
j = uri.indexOf('!', i);
if (j == -1 || j >= closeParen) j = closeParen;
if (i >= j) throw new URISyntaxException(uri, "EXTRA missing '!'", i);
String value = uri.substring(i, j);
i = j;
// create Bundle if it doesn't already exist
if (intent.mExtras == null) intent.mExtras = new Bundle();
// add item to bundle
try {
switch (type) {
case 'S':
intent.mExtras.putString(key, Uri.decode(value));
break;
case 'B':
intent.mExtras.putBoolean(key, Boolean.parseBoolean(value));
break;
case 'b':
intent.mExtras.putByte(key, Byte.parseByte(value));
break;
case 'c':
intent.mExtras.putChar(key, Uri.decode(value).charAt(0));
break;
case 'd':
intent.mExtras.putDouble(key, Double.parseDouble(value));
break;
case 'f':
intent.mExtras.putFloat(key, Float.parseFloat(value));
break;
case 'i':
intent.mExtras.putInt(key, Integer.parseInt(value));
break;
case 'l':
intent.mExtras.putLong(key, Long.parseLong(value));
break;
case 's':
intent.mExtras.putShort(key, Short.parseShort(value));
break;
default:
throw new URISyntaxException(uri, "EXTRA has unknown type", i);
}
} catch (NumberFormatException e) {
throw new URISyntaxException(uri, "EXTRA value can't be parsed", i);
}
char ch = uri.charAt(i);
if (ch == ')') break;
if (ch != '!') throw new URISyntaxException(uri, "EXTRA missing '!'", i);
i++;
}
}
if (isIntentFragment) {
intent.mData = Uri.parse(uri.substring(0, intentFragmentStart));
} else {
intent.mData = Uri.parse(uri);
}
if (intent.mAction == null) {
// By default, if no action is specified, then use VIEW.
intent.mAction = ACTION_VIEW;
}
} else {
intent = new Intent(ACTION_VIEW, Uri.parse(uri));
}
return intent;
}
/** @hide */
public interface CommandOptionHandler {
boolean handleOption(String opt, ShellCommand cmd);
}
/** @hide */
public static Intent parseCommandArgs(ShellCommand cmd, CommandOptionHandler optionHandler)
throws URISyntaxException {
Intent intent = new Intent();
Intent baseIntent = intent;
boolean hasIntentInfo = false;
Uri data = null;
String type = null;
String opt;
while ((opt=cmd.getNextOption()) != null) {
switch (opt) {
case "-a":
intent.setAction(cmd.getNextArgRequired());
if (intent == baseIntent) {
hasIntentInfo = true;
}
break;
case "-d":
data = Uri.parse(cmd.getNextArgRequired());
if (intent == baseIntent) {
hasIntentInfo = true;
}
break;
case "-t":
type = cmd.getNextArgRequired();
if (intent == baseIntent) {
hasIntentInfo = true;
}
break;
case "-c":
intent.addCategory(cmd.getNextArgRequired());
if (intent == baseIntent) {
hasIntentInfo = true;
}
break;
case "-e":
case "--es": {
String key = cmd.getNextArgRequired();
String value = cmd.getNextArgRequired();
intent.putExtra(key, value);
}
break;
case "--esn": {
String key = cmd.getNextArgRequired();
intent.putExtra(key, (String) null);
}
break;
case "--ei": {
String key = cmd.getNextArgRequired();
String value = cmd.getNextArgRequired();
intent.putExtra(key, Integer.decode(value));
}
break;
case "--eu": {
String key = cmd.getNextArgRequired();
String value = cmd.getNextArgRequired();
intent.putExtra(key, Uri.parse(value));
}
break;
case "--ecn": {
String key = cmd.getNextArgRequired();
String value = cmd.getNextArgRequired();
ComponentName cn = ComponentName.unflattenFromString(value);
if (cn == null)
throw new IllegalArgumentException("Bad component name: " + value);
intent.putExtra(key, cn);
}
break;
case "--eia": {
String key = cmd.getNextArgRequired();
String value = cmd.getNextArgRequired();
String[] strings = value.split(",");
int[] list = new int[strings.length];
for (int i = 0; i < strings.length; i++) {
list[i] = Integer.decode(strings[i]);
}
intent.putExtra(key, list);
}
break;
case "--eial": {
String key = cmd.getNextArgRequired();
String value = cmd.getNextArgRequired();
String[] strings = value.split(",");
ArrayList This is the same as calling getData().getScheme() (and checking for
* null data).
*
* @return The scheme of this intent.
*
* @see #getData
*/
public String getScheme() {
return mData != null ? mData.getScheme() : null;
}
/**
* Retrieve any explicit MIME type included in the intent. This is usually
* null, as the type is determined by the intent data.
*
* @return If a type was manually set, it is returned; else null is
* returned.
*
* @see #resolveType(ContentResolver)
* @see #setType
*/
public String getType() {
return mType;
}
/**
* Return the MIME data type of this intent. If the type field is
* explicitly set, that is simply returned. Otherwise, if the data is set,
* the type of that data is returned. If neither fields are set, a null is
* returned.
*
* @return The MIME type of this intent.
*
* @see #getType
* @see #resolveType(ContentResolver)
*/
public String resolveType(Context context) {
return resolveType(context.getContentResolver());
}
/**
* Return the MIME data type of this intent. If the type field is
* explicitly set, that is simply returned. Otherwise, if the data is set,
* the type of that data is returned. If neither fields are set, a null is
* returned.
*
* @param resolver A ContentResolver that can be used to determine the MIME
* type of the intent's data.
*
* @return The MIME type of this intent.
*
* @see #getType
* @see #resolveType(Context)
*/
public String resolveType(ContentResolver resolver) {
if (mType != null) {
return mType;
}
if (mData != null) {
if ("content".equals(mData.getScheme())) {
return resolver.getType(mData);
}
}
return null;
}
/**
* Return the MIME data type of this intent, only if it will be needed for
* intent resolution. This is not generally useful for application code;
* it is used by the frameworks for communicating with back-end system
* services.
*
* @param resolver A ContentResolver that can be used to determine the MIME
* type of the intent's data.
*
* @return The MIME type of this intent, or null if it is unknown or not
* needed.
*/
public String resolveTypeIfNeeded(ContentResolver resolver) {
if (mComponent != null) {
return mType;
}
return resolveType(resolver);
}
/**
* Check if a category exists in the intent.
*
* @param category The category to check.
*
* @return boolean True if the intent contains the category, else false.
*
* @see #getCategories
* @see #addCategory
*/
public boolean hasCategory(String category) {
return mCategories != null && mCategories.contains(category);
}
/**
* Return the set of all categories in the intent. If there are no categories,
* returns NULL.
*
* @return The set of categories you can examine. Do not modify!
*
* @see #hasCategory
* @see #addCategory
*/
public Set If {@link #getComponent} returns an explicit class, that is returned
* without any further consideration.
*
* The activity must handle the {@link Intent#CATEGORY_DEFAULT} Intent
* category to be considered.
*
* If {@link #getAction} is non-NULL, the activity must handle this
* action.
*
* If {@link #resolveType} returns non-NULL, the activity must handle
* this type.
*
* If {@link #addCategory} has added any categories, the activity must
* handle ALL of the categories specified.
*
* If {@link #getPackage} is non-NULL, only activity components in
* that application package will be considered.
*
* If there are no activities that satisfy all of these conditions, a
* null string is returned.
*
* If multiple activities are found to satisfy the intent, the one with
* the highest priority will be used. If there are multiple activities
* with the same priority, the system will either pick the best activity
* based on user preference, or resolve to a system class that will allow
* the user to pick an activity and forward from there.
*
* This method is implemented simply by calling
* {@link PackageManager#resolveActivity} with the "defaultOnly" parameter
* true. This API is called for you as part of starting an activity from an
* intent. You do not normally need to call it yourself. This method automatically clears any type that was
* previously set (for example, by {@link #setType}).
*
* The data Uri is normalized using
* {@link android.net.Uri#normalizeScheme} before it is set,
* so really this is just a convenience method for
* This is used to create intents that only specify a type and not data,
* for example to indicate the type of data to return.
*
* This method automatically clears any data that was
* previously set (for example by {@link #setData}).
*
* Note: MIME type matching in the Android framework is
* case-sensitive, unlike formal RFC MIME types. As a result,
* you should always write your MIME types with lower case letters,
* or use {@link #normalizeMimeType} or {@link #setTypeAndNormalize}
* to ensure that it is converted to lower case.
*
* @param type The MIME type of the data being handled by this intent.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #getType
* @see #setTypeAndNormalize
* @see #setDataAndType
* @see #normalizeMimeType
*/
public Intent setType(String type) {
mData = null;
mType = type;
return this;
}
/**
* Normalize and set an explicit MIME data type.
*
* This is used to create intents that only specify a type and not data,
* for example to indicate the type of data to return.
*
* This method automatically clears any data that was
* previously set (for example by {@link #setData}).
*
* The MIME type is normalized using
* {@link #normalizeMimeType} before it is set,
* so really this is just a convenience method for
* Note: MIME type and Uri scheme matching in the
* Android framework is case-sensitive, unlike the formal RFC definitions.
* As a result, you should always write these elements with lower case letters,
* or use {@link #normalizeMimeType} or {@link android.net.Uri#normalizeScheme} or
* {@link #setDataAndTypeAndNormalize}
* to ensure that they are converted to lower case.
*
* @param data The Uri of the data this intent is now targeting.
* @param type The MIME type of the data being handled by this intent.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #setType
* @see #setData
* @see #normalizeMimeType
* @see android.net.Uri#normalizeScheme
* @see #setDataAndTypeAndNormalize
*/
public Intent setDataAndType(Uri data, String type) {
mData = data;
mType = type;
return this;
}
/**
* (Usually optional) Normalize and set both the data Uri and an explicit
* MIME data type. This method should very rarely be used -- it allows you
* to override the MIME type that would ordinarily be inferred from the
* data with your own type given here.
*
* The data Uri and the MIME type are normalize using
* {@link android.net.Uri#normalizeScheme} and {@link #normalizeMimeType}
* before they are set, so really this is just a convenience method for
* An example of where this may be used is with things like
* {@link #CATEGORY_APP_BROWSER}. This category allows you to build an
* Intent that will launch the Browser application. However, the correct
* main entry point of an application is actually {@link #ACTION_MAIN}
* {@link #CATEGORY_LAUNCHER} with {@link #setComponent(ComponentName)}
* used to specify the actual Activity to launch. If you launch the browser
* with something different, undesired behavior may happen if the user has
* previously or later launches it the normal way, since they do not match.
* Instead, you can build an Intent with the MAIN action (but no ComponentName
* yet specified) and set a selector with {@link #ACTION_MAIN} and
* {@link #CATEGORY_APP_BROWSER} to point it specifically to the browser activity.
*
* Setting a selector does not impact the behavior of
* {@link #filterEquals(Intent)} and {@link #filterHashCode()}. This is part of the
* desired behavior of a selector -- it does not impact the base meaning
* of the Intent, just what kinds of things will be matched against it
* when determining who can handle it. You can not use both a selector and {@link #setPackage(String)} on
* the same base Intent. The ClipData in an intent is not used for Intent matching or other
* such operations. Semantically it is like extras, used to transmit
* additional data with the Intent. The main feature of using this over
* the extras for data is that {@link #FLAG_GRANT_READ_URI_PERMISSION}
* and {@link #FLAG_GRANT_WRITE_URI_PERMISSION} will operate on any URI
* items included in the clip data. This is useful, in particular, if
* you want to transmit an Intent containing multiple If the ClipData contains items that are themselves Intents, any
* grant flags in those Intents will be ignored. Only the top-level flags
* of the main Intent are respected, and will be applied to all Uri or
* Intent items in the clip (or sub-items of the clip).
*
* The MIME type, label, and icon in the ClipData object are not
* directly used by Intent. Applications should generally rely on the
* MIME type of the Intent itself, not what it may find in the ClipData.
* A common practice is to construct a ClipData for use with an Intent
* with a MIME type of "*/*".
*
* @param clip The new clip to set. May be null to clear the current clip.
*/
public void setClipData(ClipData clip) {
mClipData = clip;
}
/**
* This is NOT a secure mechanism to identify the user who sent the intent.
* When the intent is sent to a different user, it is used to fix uris by adding the userId
* who sent the intent.
* @hide
*/
public void prepareToLeaveUser(int userId) {
// If mContentUserHint is not UserHandle.USER_CURRENT, the intent has already left a user.
// We want mContentUserHint to refer to the original user, so don't do anything.
if (mContentUserHint == UserHandle.USER_CURRENT) {
mContentUserHint = userId;
}
}
/**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
*
* @param name The name of the extra data, with package prefix.
* @param value The boolean data value.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #putExtras
* @see #removeExtra
* @see #getBooleanExtra(String, boolean)
*/
public Intent putExtra(String name, boolean value) {
if (mExtras == null) {
mExtras = new Bundle();
}
mExtras.putBoolean(name, value);
return this;
}
/**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
*
* @param name The name of the extra data, with package prefix.
* @param value The byte data value.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #putExtras
* @see #removeExtra
* @see #getByteExtra(String, byte)
*/
public Intent putExtra(String name, byte value) {
if (mExtras == null) {
mExtras = new Bundle();
}
mExtras.putByte(name, value);
return this;
}
/**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
*
* @param name The name of the extra data, with package prefix.
* @param value The char data value.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #putExtras
* @see #removeExtra
* @see #getCharExtra(String, char)
*/
public Intent putExtra(String name, char value) {
if (mExtras == null) {
mExtras = new Bundle();
}
mExtras.putChar(name, value);
return this;
}
/**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
*
* @param name The name of the extra data, with package prefix.
* @param value The short data value.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #putExtras
* @see #removeExtra
* @see #getShortExtra(String, short)
*/
public Intent putExtra(String name, short value) {
if (mExtras == null) {
mExtras = new Bundle();
}
mExtras.putShort(name, value);
return this;
}
/**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
*
* @param name The name of the extra data, with package prefix.
* @param value The integer data value.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #putExtras
* @see #removeExtra
* @see #getIntExtra(String, int)
*/
public Intent putExtra(String name, int value) {
if (mExtras == null) {
mExtras = new Bundle();
}
mExtras.putInt(name, value);
return this;
}
/**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
*
* @param name The name of the extra data, with package prefix.
* @param value The long data value.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #putExtras
* @see #removeExtra
* @see #getLongExtra(String, long)
*/
public Intent putExtra(String name, long value) {
if (mExtras == null) {
mExtras = new Bundle();
}
mExtras.putLong(name, value);
return this;
}
/**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
*
* @param name The name of the extra data, with package prefix.
* @param value The float data value.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #putExtras
* @see #removeExtra
* @see #getFloatExtra(String, float)
*/
public Intent putExtra(String name, float value) {
if (mExtras == null) {
mExtras = new Bundle();
}
mExtras.putFloat(name, value);
return this;
}
/**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
*
* @param name The name of the extra data, with package prefix.
* @param value The double data value.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #putExtras
* @see #removeExtra
* @see #getDoubleExtra(String, double)
*/
public Intent putExtra(String name, double value) {
if (mExtras == null) {
mExtras = new Bundle();
}
mExtras.putDouble(name, value);
return this;
}
/**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
*
* @param name The name of the extra data, with package prefix.
* @param value The String data value.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #putExtras
* @see #removeExtra
* @see #getStringExtra(String)
*/
public Intent putExtra(String name, String value) {
if (mExtras == null) {
mExtras = new Bundle();
}
mExtras.putString(name, value);
return this;
}
/**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
*
* @param name The name of the extra data, with package prefix.
* @param value The CharSequence data value.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #putExtras
* @see #removeExtra
* @see #getCharSequenceExtra(String)
*/
public Intent putExtra(String name, CharSequence value) {
if (mExtras == null) {
mExtras = new Bundle();
}
mExtras.putCharSequence(name, value);
return this;
}
/**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
*
* @param name The name of the extra data, with package prefix.
* @param value The Parcelable data value.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #putExtras
* @see #removeExtra
* @see #getParcelableExtra(String)
*/
public Intent putExtra(String name, Parcelable value) {
if (mExtras == null) {
mExtras = new Bundle();
}
mExtras.putParcelable(name, value);
return this;
}
/**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
*
* @param name The name of the extra data, with package prefix.
* @param value The Parcelable[] data value.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #putExtras
* @see #removeExtra
* @see #getParcelableArrayExtra(String)
*/
public Intent putExtra(String name, Parcelable[] value) {
if (mExtras == null) {
mExtras = new Bundle();
}
mExtras.putParcelableArray(name, value);
return this;
}
/**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
*
* @param name The name of the extra data, with package prefix.
* @param value The ArrayList See the
* Tasks and Back
* Stack documentation for important information on how some of these options impact
* the behavior of your application.
*
* @param flags The desired flags.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #getFlags
* @see #addFlags
*
* @see #FLAG_GRANT_READ_URI_PERMISSION
* @see #FLAG_GRANT_WRITE_URI_PERMISSION
* @see #FLAG_GRANT_PERSISTABLE_URI_PERMISSION
* @see #FLAG_GRANT_PREFIX_URI_PERMISSION
* @see #FLAG_DEBUG_LOG_RESOLUTION
* @see #FLAG_FROM_BACKGROUND
* @see #FLAG_ACTIVITY_BROUGHT_TO_FRONT
* @see #FLAG_ACTIVITY_CLEAR_TASK
* @see #FLAG_ACTIVITY_CLEAR_TOP
* @see #FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
* @see #FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
* @see #FLAG_ACTIVITY_FORWARD_RESULT
* @see #FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
* @see #FLAG_ACTIVITY_MULTIPLE_TASK
* @see #FLAG_ACTIVITY_NEW_DOCUMENT
* @see #FLAG_ACTIVITY_NEW_TASK
* @see #FLAG_ACTIVITY_NO_ANIMATION
* @see #FLAG_ACTIVITY_NO_HISTORY
* @see #FLAG_ACTIVITY_NO_USER_ACTION
* @see #FLAG_ACTIVITY_PREVIOUS_IS_TOP
* @see #FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
* @see #FLAG_ACTIVITY_REORDER_TO_FRONT
* @see #FLAG_ACTIVITY_SINGLE_TOP
* @see #FLAG_ACTIVITY_TASK_ON_HOME
* @see #FLAG_RECEIVER_REGISTERED_ONLY
*/
public Intent setFlags(int flags) {
mFlags = flags;
return this;
}
/**
* Add additional flags to the intent (or with existing flags
* value).
*
* @param flags The new flags to set.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #setFlags
*/
public Intent addFlags(int flags) {
mFlags |= flags;
return this;
}
/**
* (Usually optional) Set an explicit application package name that limits
* the components this Intent will resolve to. If left to the default
* value of null, all components in all applications will considered.
* If non-null, the Intent can only match the components in the given
* application package.
*
* @param packageName The name of the application package to handle the
* intent, or null to allow any application package.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #getPackage
* @see #resolveActivity
*/
public Intent setPackage(String packageName) {
if (packageName != null && mSelector != null) {
throw new IllegalArgumentException(
"Can't set package name when selector is already set");
}
mPackage = packageName;
return this;
}
/**
* (Usually optional) Explicitly set the component to handle the intent.
* If left with the default value of null, the system will determine the
* appropriate class to use based on the other fields (action, data,
* type, categories) in the Intent. If this class is defined, the
* specified class will always be used regardless of the other fields. You
* should only set this value when you know you absolutely want a specific
* class to be used; otherwise it is better to let the system find the
* appropriate class so that you will respect the installed applications
* and user preferences.
*
* @param component The name of the application component to handle the
* intent, or null to let the system find one for you.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #setClass
* @see #setClassName(Context, String)
* @see #setClassName(String, String)
* @see #getComponent
* @see #resolveActivity
*/
public Intent setComponent(ComponentName component) {
mComponent = component;
return this;
}
/**
* Convenience for calling {@link #setComponent} with an
* explicit class name.
*
* @param packageContext A Context of the application package implementing
* this class.
* @param className The name of a class inside of the application package
* that will be used as the component for this Intent.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #setComponent
* @see #setClass
*/
public Intent setClassName(Context packageContext, String className) {
mComponent = new ComponentName(packageContext, className);
return this;
}
/**
* Convenience for calling {@link #setComponent} with an
* explicit application package name and class name.
*
* @param packageName The name of the package implementing the desired
* component.
* @param className The name of a class inside of the application package
* that will be used as the component for this Intent.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #setComponent
* @see #setClass
*/
public Intent setClassName(String packageName, String className) {
mComponent = new ComponentName(packageName, className);
return this;
}
/**
* Convenience for calling {@link #setComponent(ComponentName)} with the
* name returned by a {@link Class} object.
*
* @param packageContext A Context of the application package implementing
* this class.
* @param cls The class name to set, equivalent to
* In addition, you can use the {@link #FILL_IN_ACTION},
* {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE},
* {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS},
* {@link #FILL_IN_SELECTOR}, and {@link #FILL_IN_CLIP_DATA} to override
* the restriction where the corresponding field will not be replaced if
* it is already set.
*
* Note: The component field will only be copied if {@link #FILL_IN_COMPONENT}
* is explicitly specified. The selector will only be copied if
* {@link #FILL_IN_SELECTOR} is explicitly specified.
*
* For example, consider Intent A with {data="foo", categories="bar"}
* and Intent B with {action="gotit", data-type="some/thing",
* categories="one","two"}.
*
* Calling A.fillIn(B, Intent.FILL_IN_DATA) will result in A now
* containing: {action="gotit", data-type="some/thing",
* categories="bar"}.
*
* @param other Another Intent whose values are to be used to fill in
* the current one.
* @param flags Options to control which fields can be filled in.
*
* @return Returns a bit mask of {@link #FILL_IN_ACTION},
* {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE},
* {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS},
* {@link #FILL_IN_SELECTOR} and {@link #FILL_IN_CLIP_DATA indicating which fields were
* changed.
*/
@FillInFlags
public int fillIn(Intent other, @FillInFlags int flags) {
int changes = 0;
boolean mayHaveCopiedUris = false;
if (other.mAction != null
&& (mAction == null || (flags&FILL_IN_ACTION) != 0)) {
mAction = other.mAction;
changes |= FILL_IN_ACTION;
}
if ((other.mData != null || other.mType != null)
&& ((mData == null && mType == null)
|| (flags&FILL_IN_DATA) != 0)) {
mData = other.mData;
mType = other.mType;
changes |= FILL_IN_DATA;
mayHaveCopiedUris = true;
}
if (other.mCategories != null
&& (mCategories == null || (flags&FILL_IN_CATEGORIES) != 0)) {
if (other.mCategories != null) {
mCategories = new ArraySet You can convert the returned string back to an Intent with
* {@link #getIntent}.
*
* @param flags Additional operating flags. Either 0,
* {@link #URI_INTENT_SCHEME}, or {@link #URI_ANDROID_APP_SCHEME}.
*
* @return Returns a URI encoding URI string describing the entire contents
* of the Intent.
*/
public String toUri(int flags) {
StringBuilder uri = new StringBuilder(128);
if ((flags&URI_ANDROID_APP_SCHEME) != 0) {
if (mPackage == null) {
throw new IllegalArgumentException(
"Intent must include an explicit package name to build an android-app: "
+ this);
}
uri.append("android-app://");
uri.append(mPackage);
String scheme = null;
if (mData != null) {
scheme = mData.getScheme();
if (scheme != null) {
uri.append('/');
uri.append(scheme);
String authority = mData.getEncodedAuthority();
if (authority != null) {
uri.append('/');
uri.append(authority);
String path = mData.getEncodedPath();
if (path != null) {
uri.append(path);
}
String queryParams = mData.getEncodedQuery();
if (queryParams != null) {
uri.append('?');
uri.append(queryParams);
}
String fragment = mData.getEncodedFragment();
if (fragment != null) {
uri.append('#');
uri.append(fragment);
}
}
}
}
toUriFragment(uri, null, scheme == null ? Intent.ACTION_MAIN : Intent.ACTION_VIEW,
mPackage, flags);
return uri.toString();
}
String scheme = null;
if (mData != null) {
String data = mData.toString();
if ((flags&URI_INTENT_SCHEME) != 0) {
final int N = data.length();
for (int i=0; i A normalized MIME type has white-space trimmed,
* content-type parameters removed, and is lower-case.
* This aligns the type with Android best practices for
* intent filtering.
*
* For example, "text/plain; charset=utf-8" becomes "text/plain".
* "text/x-vCard" becomes "text/x-vcard".
*
* All MIME types received from outside Android (such as user input,
* or external sources like Bluetooth, NFC, or the Internet) should
* be normalized before they are used to create an Intent.
*
* @param type MIME data type to normalize
* @return normalized MIME data type, or null if the input was null
* @see #setType
* @see #setTypeAndNormalize
*/
public static String normalizeMimeType(String type) {
if (type == null) {
return null;
}
type = type.trim().toLowerCase(Locale.ROOT);
final int semicolonIndex = type.indexOf(';');
if (semicolonIndex != -1) {
type = type.substring(0, semicolonIndex);
}
return type;
}
/**
* Prepare this {@link Intent} to leave an app process.
*
* @hide
*/
public void prepareToLeaveProcess(Context context) {
final boolean leavingPackage = (mComponent == null)
|| !Objects.equals(mComponent.getPackageName(), context.getPackageName());
prepareToLeaveProcess(leavingPackage);
}
/**
* Prepare this {@link Intent} to leave an app process.
*
* @hide
*/
public void prepareToLeaveProcess(boolean leavingPackage) {
setAllowFds(false);
if (mSelector != null) {
mSelector.prepareToLeaveProcess(leavingPackage);
}
if (mClipData != null) {
mClipData.prepareToLeaveProcess(leavingPackage);
}
if (mAction != null && mData != null && StrictMode.vmFileUriExposureEnabled()
&& leavingPackage) {
switch (mAction) {
case ACTION_MEDIA_REMOVED:
case ACTION_MEDIA_UNMOUNTED:
case ACTION_MEDIA_CHECKING:
case ACTION_MEDIA_NOFS:
case ACTION_MEDIA_MOUNTED:
case ACTION_MEDIA_SHARED:
case ACTION_MEDIA_UNSHARED:
case ACTION_MEDIA_BAD_REMOVAL:
case ACTION_MEDIA_UNMOUNTABLE:
case ACTION_MEDIA_EJECT:
case ACTION_MEDIA_SCANNER_STARTED:
case ACTION_MEDIA_SCANNER_FINISHED:
case ACTION_MEDIA_SCANNER_SCAN_FILE:
case ACTION_PACKAGE_NEEDS_VERIFICATION:
case ACTION_PACKAGE_VERIFIED:
// Ignore legacy actions
break;
default:
mData.checkFileUriExposed("Intent.getData()");
}
}
}
/**
* @hide
*/
public void prepareToEnterProcess() {
// We just entered destination process, so we should be able to read all
// parcelables inside.
setDefusable(true);
if (mSelector != null) {
mSelector.prepareToEnterProcess();
}
if (mClipData != null) {
mClipData.prepareToEnterProcess();
}
if (mContentUserHint != UserHandle.USER_CURRENT) {
if (UserHandle.getAppId(Process.myUid()) != Process.SYSTEM_UID) {
fixUris(mContentUserHint);
mContentUserHint = UserHandle.USER_CURRENT;
}
}
}
/**
* @hide
*/
public void fixUris(int contentUserHint) {
Uri data = getData();
if (data != null) {
mData = maybeAddUserId(data, contentUserHint);
}
if (mClipData != null) {
mClipData.fixUris(contentUserHint);
}
String action = getAction();
if (ACTION_SEND.equals(action)) {
final Uri stream = getParcelableExtra(EXTRA_STREAM);
if (stream != null) {
putExtra(EXTRA_STREAM, maybeAddUserId(stream, contentUserHint));
}
} else if (ACTION_SEND_MULTIPLE.equals(action)) {
final ArrayList
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_SHUTDOWN = "android.intent.action.ACTION_SHUTDOWN";
/**
* Activity Action: Start this activity to request system shutdown.
* The optional boolean extra field {@link #EXTRA_KEY_CONFIRM} can be set to true
* to request confirmation from the user before shutting down. The optional boolean
* extra field {@link #EXTRA_USER_REQUESTED_SHUTDOWN} can be set to true to
* indicate that the shutdown is requested by the user.
*
*
*
*
*
*
*
* This intent will be sent at boot (if the count is non-zero) and when the
* data set changes. It is possible for the data set to change without the
* count changing (for example, if a new unread message arrives in the same
* sync operation in which a message is archived). The phone should still
* ring/vibrate/etc as normal in this case.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PROVIDER_CHANGED =
"android.intent.action.PROVIDER_CHANGED";
/**
* Broadcast Action: Wired Headset plugged in or unplugged.
*
* Same as {@link android.media.AudioManager#ACTION_HEADSET_PLUG}, to be consulted for value
* and documentation.
* AudioManager
constant in your receiver registration code instead.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_HEADSET_PLUG = android.media.AudioManager.ACTION_HEADSET_PLUG;
/**
*
*
*
*
*
* null
, no call will be placed.null
* and then start their own app to make the call.
*
*
* ArrayList<RestrictionEntry>
. It can also
* contain an extra {@link #EXTRA_RESTRICTIONS_INTENT}, which is of type Intent
.
* The activity specified by that intent will be launched for a result which must contain
* one of the extras {@link #EXTRA_RESTRICTIONS_LIST} or {@link #EXTRA_RESTRICTIONS_BUNDLE}.
* The keys and values of the returned restrictions will be persisted.
* @see RestrictionEntry
*/
public static final String ACTION_GET_RESTRICTION_ENTRIES =
"android.intent.action.GET_RESTRICTION_ENTRIES";
/**
* Sent the first time a user is starting, to allow system apps to
* perform one time initialization. (This will not be seen by third
* party applications because a newly initialized user does not have any
* third party applications installed for it.) This is sent early in
* starting the user, around the time the home app is started, before
* {@link #ACTION_BOOT_COMPLETED} is sent. This is sent as a foreground
* broadcast, since it is part of a visible user interaction; be as quick
* as possible when handling it.
*/
public static final String ACTION_USER_INITIALIZE =
"android.intent.action.USER_INITIALIZE";
/**
* Sent when a user switch is happening, causing the process's user to be
* brought to the foreground. This is only sent to receivers registered
* through {@link Context#registerReceiver(BroadcastReceiver, IntentFilter)
* Context.registerReceiver}. It is sent to the user that is going to the
* foreground. This is sent as a foreground
* broadcast, since it is part of a visible user interaction; be as quick
* as possible when handling it.
*/
public static final String ACTION_USER_FOREGROUND =
"android.intent.action.USER_FOREGROUND";
/**
* Sent when a user switch is happening, causing the process's user to be
* sent to the background. This is only sent to receivers registered
* through {@link Context#registerReceiver(BroadcastReceiver, IntentFilter)
* Context.registerReceiver}. It is sent to the user that is going to the
* background. This is sent as a foreground
* broadcast, since it is part of a visible user interaction; be as quick
* as possible when handling it.
*/
public static final String ACTION_USER_BACKGROUND =
"android.intent.action.USER_BACKGROUND";
/**
* Broadcast sent to the system when a user is added. Carries an extra
* EXTRA_USER_HANDLE that has the userHandle of the new user. It is sent to
* all running users. You must hold
* {@link android.Manifest.permission#MANAGE_USERS} to receive this broadcast.
* @hide
*/
public static final String ACTION_USER_ADDED =
"android.intent.action.USER_ADDED";
/**
* Broadcast sent by the system when a user is started. Carries an extra
* EXTRA_USER_HANDLE that has the userHandle of the user. This is only sent to
* registered receivers, not manifest receivers. It is sent to the user
* that has been started. This is sent as a foreground
* broadcast, since it is part of a visible user interaction; be as quick
* as possible when handling it.
* @hide
*/
public static final String ACTION_USER_STARTED =
"android.intent.action.USER_STARTED";
/**
* Broadcast sent when a user is in the process of starting. Carries an extra
* EXTRA_USER_HANDLE that has the userHandle of the user. This is only
* sent to registered receivers, not manifest receivers. It is sent to all
* users (including the one that is being started). You must hold
* {@link android.Manifest.permission#INTERACT_ACROSS_USERS} to receive
* this broadcast. This is sent as a background broadcast, since
* its result is not part of the primary UX flow; to safely keep track of
* started/stopped state of a user you can use this in conjunction with
* {@link #ACTION_USER_STOPPING}. It is not generally safe to use with
* other user state broadcasts since those are foreground broadcasts so can
* execute in a different order.
* @hide
*/
public static final String ACTION_USER_STARTING =
"android.intent.action.USER_STARTING";
/**
* Broadcast sent when a user is going to be stopped. Carries an extra
* EXTRA_USER_HANDLE that has the userHandle of the user. This is only
* sent to registered receivers, not manifest receivers. It is sent to all
* users (including the one that is being stopped). You must hold
* {@link android.Manifest.permission#INTERACT_ACROSS_USERS} to receive
* this broadcast. The user will not stop until all receivers have
* handled the broadcast. This is sent as a background broadcast, since
* its result is not part of the primary UX flow; to safely keep track of
* started/stopped state of a user you can use this in conjunction with
* {@link #ACTION_USER_STARTING}. It is not generally safe to use with
* other user state broadcasts since those are foreground broadcasts so can
* execute in a different order.
* @hide
*/
public static final String ACTION_USER_STOPPING =
"android.intent.action.USER_STOPPING";
/**
* Broadcast sent to the system when a user is stopped. Carries an extra
* EXTRA_USER_HANDLE that has the userHandle of the user. This is similar to
* {@link #ACTION_PACKAGE_RESTARTED}, but for an entire user instead of a
* specific package. This is only sent to registered receivers, not manifest
* receivers. It is sent to all running users except the one that
* has just been stopped (which is no longer running).
* @hide
*/
public static final String ACTION_USER_STOPPED =
"android.intent.action.USER_STOPPED";
/**
* Broadcast sent to the system when a user is removed. Carries an extra EXTRA_USER_HANDLE that has
* the userHandle of the user. It is sent to all running users except the
* one that has been removed. The user will not be completely removed until all receivers have
* handled the broadcast. You must hold
* {@link android.Manifest.permission#MANAGE_USERS} to receive this broadcast.
* @hide
*/
public static final String ACTION_USER_REMOVED =
"android.intent.action.USER_REMOVED";
/**
* Broadcast sent to the system when the user switches. Carries an extra EXTRA_USER_HANDLE that has
* the userHandle of the user to become the current one. This is only sent to
* registered receivers, not manifest receivers. It is sent to all running users.
* You must hold
* {@link android.Manifest.permission#MANAGE_USERS} to receive this broadcast.
* @hide
*/
public static final String ACTION_USER_SWITCHED =
"android.intent.action.USER_SWITCHED";
/**
* Broadcast Action: Sent when the credential-encrypted private storage has
* become unlocked for the target user. This is only sent to registered
* receivers, not manifest receivers.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_USER_UNLOCKED = "android.intent.action.USER_UNLOCKED";
/**
* Broadcast sent to the system when a user's information changes. Carries an extra
* {@link #EXTRA_USER_HANDLE} to indicate which user's information changed.
* This is only sent to registered receivers, not manifest receivers. It is sent to all users.
* @hide
*/
public static final String ACTION_USER_INFO_CHANGED =
"android.intent.action.USER_INFO_CHANGED";
/**
* Broadcast sent to the primary user when an associated managed profile is added (the profile
* was created and is ready to be used). Carries an extra {@link #EXTRA_USER} that specifies
* the UserHandle of the profile that was added. Only applications (for example Launchers)
* that need to display merged content across both primary and managed profiles need to
* worry about this broadcast. This is only sent to registered receivers,
* not manifest receivers.
*/
public static final String ACTION_MANAGED_PROFILE_ADDED =
"android.intent.action.MANAGED_PROFILE_ADDED";
/**
* Broadcast sent to the primary user when an associated managed profile is removed. Carries an
* extra {@link #EXTRA_USER} that specifies the UserHandle of the profile that was removed.
* Only applications (for example Launchers) that need to display merged content across both
* primary and managed profiles need to worry about this broadcast. This is only sent to
* registered receivers, not manifest receivers.
*/
public static final String ACTION_MANAGED_PROFILE_REMOVED =
"android.intent.action.MANAGED_PROFILE_REMOVED";
/**
* Broadcast sent to the primary user when the credential-encrypted private storage for
* an associated managed profile is unlocked. Carries an extra {@link #EXTRA_USER} that
* specifies the UserHandle of the profile that was unlocked. Only applications (for example
* Launchers) that need to display merged content across both primary and managed profiles
* need to worry about this broadcast. This is only sent to registered receivers,
* not manifest receivers.
*/
public static final String ACTION_MANAGED_PROFILE_UNLOCKED =
"android.intent.action.MANAGED_PROFILE_UNLOCKED";
/**
* Broadcast sent to the primary user when an associated managed profile has become available.
* Currently this includes when the user disables quiet mode for the profile. Carries an extra
* {@link #EXTRA_USER} that specifies the UserHandle of the profile. When quiet mode is changed,
* this broadcast will carry a boolean extra {@link #EXTRA_QUIET_MODE} indicating the new state
* of quiet mode. This is only sent to registered receivers, not manifest receivers.
*/
public static final String ACTION_MANAGED_PROFILE_AVAILABLE =
"android.intent.action.MANAGED_PROFILE_AVAILABLE";
/**
* Broadcast sent to the primary user when an associated managed profile has become unavailable.
* Currently this includes when the user enables quiet mode for the profile. Carries an extra
* {@link #EXTRA_USER} that specifies the UserHandle of the profile. When quiet mode is changed,
* this broadcast will carry a boolean extra {@link #EXTRA_QUIET_MODE} indicating the new state
* of quiet mode. This is only sent to registered receivers, not manifest receivers.
*/
public static final String ACTION_MANAGED_PROFILE_UNAVAILABLE =
"android.intent.action.MANAGED_PROFILE_UNAVAILABLE";
/**
* Sent when the user taps on the clock widget in the system's "quick settings" area.
*/
public static final String ACTION_QUICK_CLOCK =
"android.intent.action.QUICK_CLOCK";
/**
* Activity Action: Shows the brightness setting dialog.
* @hide
*/
public static final String ACTION_SHOW_BRIGHTNESS_DIALOG =
"android.intent.action.SHOW_BRIGHTNESS_DIALOG";
/**
* Broadcast Action: A global button was pressed. Includes a single
* extra field, {@link #EXTRA_KEY_EVENT}, containing the key event that
* caused the broadcast.
* @hide
*/
public static final String ACTION_GLOBAL_BUTTON = "android.intent.action.GLOBAL_BUTTON";
/**
* Broadcast Action: Sent when media resource is granted.
* ChooserTargetService
.
*
*/
public static final String EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER
= "android.intent.extra.CHOOSER_REFINEMENT_INTENT_SENDER";
/**
* A {@link ResultReceiver} used to return data back to the sender.
*
*
*
ArrayList<RestrictionEntry>
.
*/
public static final String EXTRA_RESTRICTIONS_LIST = "android.intent.extra.restrictions_list";
/**
* Extra sent in the intent to the BroadcastReceiver that handles
* {@link #ACTION_GET_RESTRICTION_ENTRIES}. The type of the extra is a Bundle containing
* the restrictions as key/value pairs.
*/
public static final String EXTRA_RESTRICTIONS_BUNDLE =
"android.intent.extra.restrictions_bundle";
/**
* Extra used in the response from a BroadcastReceiver that handles
* {@link #ACTION_GET_RESTRICTION_ENTRIES}.
*/
public static final String EXTRA_RESTRICTIONS_INTENT =
"android.intent.extra.restrictions_intent";
/**
* Extra used to communicate a set of acceptable MIME types. The type of the
* extra is {@code String[]}. Values may be a combination of concrete MIME
* types (such as "image/png") and/or partial MIME types (such as
* "audio/*").
*
* @see #ACTION_GET_CONTENT
* @see #ACTION_OPEN_DOCUMENT
*/
public static final String EXTRA_MIME_TYPES = "android.intent.extra.MIME_TYPES";
/**
* Optional extra for {@link #ACTION_SHUTDOWN} that allows the sender to qualify that
* this shutdown is only for the user space of the system, not a complete shutdown.
* When this is true, hardware devices can use this information to determine that
* they shouldn't do a complete shutdown of their device since this is not a
* complete shutdown down to the kernel, but only user space restarting.
* The default if not supplied is false.
*/
public static final String EXTRA_SHUTDOWN_USERSPACE_ONLY
= "android.intent.extra.SHUTDOWN_USERSPACE_ONLY";
/**
* Optional boolean extra for {@link #ACTION_TIME_CHANGED} that indicates the
* user has set their time format preferences to the 24 hour format.
*
* @hide for internal use only.
*/
public static final String EXTRA_TIME_PREF_24_HOUR_FORMAT =
"android.intent.extra.TIME_PREF_24_HOUR_FORMAT";
/** {@hide} */
public static final String EXTRA_REASON = "android.intent.extra.REASON";
/** {@hide} */
public static final String EXTRA_WIPE_EXTERNAL_STORAGE = "android.intent.extra.WIPE_EXTERNAL_STORAGE";
/**
* Optional {@link android.app.PendingIntent} extra used to deliver the result of the SIM
* activation request.
* TODO: Add information about the structure and response data used with the pending intent.
* @hide
*/
public static final String EXTRA_SIM_ACTIVATION_RESPONSE =
"android.intent.extra.SIM_ACTIVATION_RESPONSE";
/**
* Optional index with semantics depending on the intent action.
*
*
*
*
* @hide
*/
public static final int FLAG_DEBUG_TRIAGED_MISSING = 0x00000100;
/**
* If set, the new activity is not kept in the history stack. As soon as
* the user navigates away from it, the activity is finished. This may also
* be set with the {@link android.R.styleable#AndroidManifestActivity_noHistory
* noHistory} attribute.
*
*
* android-app://{package_id}[/{scheme}[/{host}[/{path}]]][#Intent;{...}]
*
* package_id
is required. If you include a host,
* you must also include a scheme; including a path also requires both a host and a scheme.
* The final #Intent; fragment can be used without a scheme, host, or path.
* Note that this can not be
* used with intents that have a {@link #setSelector}, since the base intent
* will always have an explicit package name.
*
*/
public static final int URI_ANDROID_APP_SCHEME = 1<<1;
/**
* Flag for use with {@link #toUri} and {@link #parseUri}: allow parsing
* of unsafe information. In particular, the flags {@link #FLAG_GRANT_READ_URI_PERMISSION},
* {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, {@link #FLAG_GRANT_PERSISTABLE_URI_PERMISSION},
* and {@link #FLAG_GRANT_PREFIX_URI_PERMISSION} flags can not be set, so that the
* generated Intent can not cause unexpected data access to happen.
*
*
*
*
*
* URI Intent
*
* android-app://com.example.app
*
*
* Action: {@link #ACTION_MAIN}
* Package: com.example.app
*
* android-app://com.example.app/http/example.com
*
*
* Action: {@link #ACTION_VIEW}
* Data: http://example.com/
* Package: com.example.app
*
* android-app://com.example.app/http/example.com/foo?1234
*
*
* Action: {@link #ACTION_VIEW}
* Data: http://example.com/foo?1234
* Package: com.example.app
*
* android-app://com.example.app/
#Intent;action=com.example.MY_ACTION;end
*
*
* Action: com.example.MY_ACTION
* Package: com.example.app
*
* android-app://com.example.app/http/example.com/foo?1234
#Intent;action=com.example.MY_ACTION;end
*
*
* Action: com.example.MY_ACTION
* Data: http://example.com/foo?1234
* Package: com.example.app
*
*
* android-app://com.example.app/
#Intent;action=com.example.MY_ACTION;
i.some_int=100;S.some_str=hello;end
*
*
* Action: com.example.MY_ACTION
* Package: com.example.app
* Extras: some_int=(int)100
some_str=(String)hello
* setData(data.normalize())
*
*
* @param data The Uri of the data this intent is now targeting.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #getData
* @see #setType
* @see android.net.Uri#normalizeScheme
*/
public Intent setDataAndNormalize(Uri data) {
return setData(data.normalizeScheme());
}
/**
* Set an explicit MIME data type.
*
*
* setType(Intent.normalizeMimeType(type))
*
*
* @param type The MIME type of the data being handled by this intent.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #getType
* @see #setData
* @see #normalizeMimeType
*/
public Intent setTypeAndNormalize(String type) {
return setType(normalizeMimeType(type));
}
/**
* (Usually optional) Set the data for the intent along with an explicit
* MIME data type. This method should very rarely be used -- it allows you
* to override the MIME type that would ordinarily be inferred from the
* data with your own type given here.
*
*
* setDataAndType(data.normalize(), Intent.normalizeMimeType(type))
*
*
* @param data The Uri of the data this intent is now targeting.
* @param type The MIME type of the data being handled by this intent.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #setType
* @see #setData
* @see #setDataAndType
* @see #normalizeMimeType
* @see android.net.Uri#normalizeScheme
*/
public Intent setDataAndTypeAndNormalize(Uri data, String type) {
return setDataAndType(data.normalizeScheme(), normalizeMimeType(type));
}
/**
* Add a new category to the intent. Categories provide additional detail
* about the action the intent performs. When resolving an intent, only
* activities that provide all of the requested categories will be
* used.
*
* @param category The desired category. This can be either one of the
* predefined Intent categories, or a custom category in your own
* namespace.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #hasCategory
* @see #removeCategory
*/
public Intent addCategory(String category) {
if (mCategories == null) {
mCategories = new ArraySetcontent:
* URIs for which the recipient may not have global permission to access the
* content provider.
*
* setClassName(context, cls.getName())
.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #setComponent
*/
public Intent setClass(Context packageContext, Class> cls) {
mComponent = new ComponentName(packageContext, cls);
return this;
}
/**
* Set the bounds of the sender of this intent, in screen coordinates. This can be
* used as a hint to the receiver for animations and the like. Null means that there
* is no source bounds.
*/
public void setSourceBounds(Rect r) {
if (r != null) {
mSourceBounds = new Rect(r);
} else {
mSourceBounds = null;
}
}
/** @hide */
@IntDef(flag = true,
value = {
FILL_IN_ACTION,
FILL_IN_DATA,
FILL_IN_CATEGORIES,
FILL_IN_COMPONENT,
FILL_IN_PACKAGE,
FILL_IN_SOURCE_BOUNDS,
FILL_IN_SELECTOR,
FILL_IN_CLIP_DATA
})
@Retention(RetentionPolicy.SOURCE)
public @interface FillInFlags {}
/**
* Use with {@link #fillIn} to allow the current action value to be
* overwritten, even if it is already set.
*/
public static final int FILL_IN_ACTION = 1<<0;
/**
* Use with {@link #fillIn} to allow the current data or type value
* overwritten, even if it is already set.
*/
public static final int FILL_IN_DATA = 1<<1;
/**
* Use with {@link #fillIn} to allow the current categories to be
* overwritten, even if they are already set.
*/
public static final int FILL_IN_CATEGORIES = 1<<2;
/**
* Use with {@link #fillIn} to allow the current component value to be
* overwritten, even if it is already set.
*/
public static final int FILL_IN_COMPONENT = 1<<3;
/**
* Use with {@link #fillIn} to allow the current package value to be
* overwritten, even if it is already set.
*/
public static final int FILL_IN_PACKAGE = 1<<4;
/**
* Use with {@link #fillIn} to allow the current bounds rectangle to be
* overwritten, even if it is already set.
*/
public static final int FILL_IN_SOURCE_BOUNDS = 1<<5;
/**
* Use with {@link #fillIn} to allow the current selector to be
* overwritten, even if it is already set.
*/
public static final int FILL_IN_SELECTOR = 1<<6;
/**
* Use with {@link #fillIn} to allow the current ClipData to be
* overwritten, even if it is already set.
*/
public static final int FILL_IN_CLIP_DATA = 1<<7;
/**
* Copy the contents of other in to this object, but only
* where fields are not defined by this object. For purposes of a field
* being defined, the following pieces of data in the Intent are
* considered to be separate fields:
*
*
*
*
*