The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.content; |
| 18 | |
Makoto Onuki | 7d1911f | 2017-06-09 12:30:09 -0700 | [diff] [blame] | 19 | import static android.content.ContentProvider.maybeAddUserId; |
| 20 | |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 21 | import android.annotation.AnyRes; |
Jeff Sharkey | 32ee8ee | 2017-03-08 20:17:51 -0700 | [diff] [blame] | 22 | import android.annotation.BroadcastBehavior; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 23 | import android.annotation.IntDef; |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 24 | import android.annotation.NonNull; |
| 25 | import android.annotation.Nullable; |
Joel Galenson | 78ec58d | 2018-10-24 10:06:25 -0700 | [diff] [blame] | 26 | import android.annotation.RequiresPermission; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 27 | import android.annotation.SdkConstant; |
| 28 | import android.annotation.SdkConstant.SdkConstantType; |
Jason Monk | 2f68e8a | 2016-02-23 17:57:28 -0500 | [diff] [blame] | 29 | import android.annotation.SystemApi; |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 30 | import android.annotation.UnsupportedAppUsage; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 31 | import android.content.pm.ActivityInfo; |
Jason Monk | 2f68e8a | 2016-02-23 17:57:28 -0500 | [diff] [blame] | 32 | import android.content.pm.ApplicationInfo; |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 33 | import android.content.pm.ComponentInfo; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 34 | import android.content.pm.PackageManager; |
| 35 | import android.content.pm.ResolveInfo; |
| 36 | import android.content.res.Resources; |
| 37 | import android.content.res.TypedArray; |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 38 | import android.graphics.Rect; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 39 | import android.net.Uri; |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 40 | import android.os.Build; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 41 | import android.os.Bundle; |
| 42 | import android.os.IBinder; |
| 43 | import android.os.Parcel; |
| 44 | import android.os.Parcelable; |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 45 | import android.os.PersistableBundle; |
Nicolas Prevot | c4fc00a | 2014-10-31 12:01:32 +0000 | [diff] [blame] | 46 | import android.os.Process; |
Jason Monk | 2f68e8a | 2016-02-23 17:57:28 -0500 | [diff] [blame] | 47 | import android.os.ResultReceiver; |
| 48 | import android.os.ShellCommand; |
Jeff Sharkey | a14acd2 | 2013-04-02 18:27:45 -0700 | [diff] [blame] | 49 | import android.os.StrictMode; |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 50 | import android.os.UserHandle; |
Makoto Onuki | 7d1911f | 2017-06-09 12:30:09 -0700 | [diff] [blame] | 51 | import android.provider.ContactsContract.QuickContact; |
Jeff Sharkey | bd3b902 | 2013-08-20 15:20:04 -0700 | [diff] [blame] | 52 | import android.provider.DocumentsContract; |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 53 | import android.provider.DocumentsProvider; |
Jason Monk | 2f68e8a | 2016-02-23 17:57:28 -0500 | [diff] [blame] | 54 | import android.provider.MediaStore; |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 55 | import android.provider.OpenableColumns; |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 56 | import android.text.TextUtils; |
Jason Monk | 2f68e8a | 2016-02-23 17:57:28 -0500 | [diff] [blame] | 57 | import android.util.ArraySet; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 58 | import android.util.AttributeSet; |
| 59 | import android.util.Log; |
Yi Jin | 129fc6c | 2017-09-28 15:48:38 -0700 | [diff] [blame] | 60 | import android.util.proto.ProtoOutputStream; |
Makoto Onuki | 7d1911f | 2017-06-09 12:30:09 -0700 | [diff] [blame] | 61 | |
Dianne Hackborn | 2269d157 | 2010-02-24 19:54:22 -0800 | [diff] [blame] | 62 | import com.android.internal.util.XmlUtils; |
Makoto Onuki | 7d1911f | 2017-06-09 12:30:09 -0700 | [diff] [blame] | 63 | |
Jason Monk | 2f68e8a | 2016-02-23 17:57:28 -0500 | [diff] [blame] | 64 | import org.xmlpull.v1.XmlPullParser; |
| 65 | import org.xmlpull.v1.XmlPullParserException; |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 66 | import org.xmlpull.v1.XmlSerializer; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 67 | |
| 68 | import java.io.IOException; |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 69 | import java.io.PrintWriter; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 70 | import java.io.Serializable; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 71 | import java.lang.annotation.Retention; |
| 72 | import java.lang.annotation.RetentionPolicy; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 73 | import java.net.URISyntaxException; |
| 74 | import java.util.ArrayList; |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 75 | import java.util.HashSet; |
Dianne Hackborn | 221ea89 | 2013-08-04 16:50:16 -0700 | [diff] [blame] | 76 | import java.util.List; |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 77 | import java.util.Locale; |
Christopher Tate | 63d9ae1 | 2014-06-19 19:07:26 -0700 | [diff] [blame] | 78 | import java.util.Objects; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 79 | import java.util.Set; |
| 80 | |
| 81 | /** |
| 82 | * An intent is an abstract description of an operation to be performed. It |
| 83 | * can be used with {@link Context#startActivity(Intent) startActivity} to |
| 84 | * launch an {@link android.app.Activity}, |
| 85 | * {@link android.content.Context#sendBroadcast(Intent) broadcastIntent} to |
| 86 | * send it to any interested {@link BroadcastReceiver BroadcastReceiver} components, |
| 87 | * and {@link android.content.Context#startService} or |
| 88 | * {@link android.content.Context#bindService} to communicate with a |
| 89 | * background {@link android.app.Service}. |
| 90 | * |
Joe Fernandez | b54e7a3 | 2011-10-03 15:09:50 -0700 | [diff] [blame] | 91 | * <p>An Intent provides a facility for performing late runtime binding between the code in |
| 92 | * different applications. Its most significant use is in the launching of activities, where it |
Daniel Lehmann | a5b58df | 2011-10-12 16:24:22 -0700 | [diff] [blame] | 93 | * can be thought of as the glue between activities. It is basically a passive data structure |
| 94 | * holding an abstract description of an action to be performed.</p> |
Joe Fernandez | b54e7a3 | 2011-10-03 15:09:50 -0700 | [diff] [blame] | 95 | * |
| 96 | * <div class="special reference"> |
| 97 | * <h3>Developer Guides</h3> |
| 98 | * <p>For information about how to create and resolve intents, read the |
| 99 | * <a href="{@docRoot}guide/topics/intents/intents-filters.html">Intents and Intent Filters</a> |
| 100 | * developer guide.</p> |
| 101 | * </div> |
| 102 | * |
| 103 | * <a name="IntentStructure"></a> |
| 104 | * <h3>Intent Structure</h3> |
| 105 | * <p>The primary pieces of information in an intent are:</p> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 106 | * |
| 107 | * <ul> |
| 108 | * <li> <p><b>action</b> -- The general action to be performed, such as |
| 109 | * {@link #ACTION_VIEW}, {@link #ACTION_EDIT}, {@link #ACTION_MAIN}, |
| 110 | * etc.</p> |
| 111 | * </li> |
| 112 | * <li> <p><b>data</b> -- The data to operate on, such as a person record |
| 113 | * in the contacts database, expressed as a {@link android.net.Uri}.</p> |
| 114 | * </li> |
| 115 | * </ul> |
| 116 | * |
| 117 | * |
| 118 | * <p>Some examples of action/data pairs are:</p> |
| 119 | * |
| 120 | * <ul> |
Yusuf T. Mobile | 8ecb36e | 2009-07-10 14:13:29 -0700 | [diff] [blame] | 121 | * <li> <p><b>{@link #ACTION_VIEW} <i>content://contacts/people/1</i></b> -- Display |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 122 | * information about the person whose identifier is "1".</p> |
| 123 | * </li> |
Yusuf T. Mobile | 8ecb36e | 2009-07-10 14:13:29 -0700 | [diff] [blame] | 124 | * <li> <p><b>{@link #ACTION_DIAL} <i>content://contacts/people/1</i></b> -- Display |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 125 | * the phone dialer with the person filled in.</p> |
| 126 | * </li> |
| 127 | * <li> <p><b>{@link #ACTION_VIEW} <i>tel:123</i></b> -- Display |
| 128 | * the phone dialer with the given number filled in. Note how the |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 129 | * VIEW action does what is considered the most reasonable thing for |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 130 | * a particular URI.</p> |
| 131 | * </li> |
| 132 | * <li> <p><b>{@link #ACTION_DIAL} <i>tel:123</i></b> -- Display |
| 133 | * the phone dialer with the given number filled in.</p> |
| 134 | * </li> |
Yusuf T. Mobile | 8ecb36e | 2009-07-10 14:13:29 -0700 | [diff] [blame] | 135 | * <li> <p><b>{@link #ACTION_EDIT} <i>content://contacts/people/1</i></b> -- Edit |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 136 | * information about the person whose identifier is "1".</p> |
| 137 | * </li> |
Yusuf T. Mobile | 8ecb36e | 2009-07-10 14:13:29 -0700 | [diff] [blame] | 138 | * <li> <p><b>{@link #ACTION_VIEW} <i>content://contacts/people/</i></b> -- Display |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 139 | * a list of people, which the user can browse through. This example is a |
| 140 | * typical top-level entry into the Contacts application, showing you the |
| 141 | * list of people. Selecting a particular person to view would result in a |
Kevin Hufnagle | aedfd75 | 2016-09-08 21:56:25 -0700 | [diff] [blame] | 142 | * new intent { <b>{@link #ACTION_VIEW} <i>content://contacts/people/N</i></b> } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 143 | * being used to start an activity to display that person.</p> |
| 144 | * </li> |
| 145 | * </ul> |
| 146 | * |
| 147 | * <p>In addition to these primary attributes, there are a number of secondary |
| 148 | * attributes that you can also include with an intent:</p> |
| 149 | * |
| 150 | * <ul> |
| 151 | * <li> <p><b>category</b> -- Gives additional information about the action |
| 152 | * to execute. For example, {@link #CATEGORY_LAUNCHER} means it should |
| 153 | * appear in the Launcher as a top-level application, while |
| 154 | * {@link #CATEGORY_ALTERNATIVE} means it should be included in a list |
| 155 | * of alternative actions the user can perform on a piece of data.</p> |
| 156 | * <li> <p><b>type</b> -- Specifies an explicit type (a MIME type) of the |
| 157 | * intent data. Normally the type is inferred from the data itself. |
| 158 | * By setting this attribute, you disable that evaluation and force |
| 159 | * an explicit type.</p> |
| 160 | * <li> <p><b>component</b> -- Specifies an explicit name of a component |
| 161 | * class to use for the intent. Normally this is determined by looking |
| 162 | * at the other information in the intent (the action, data/type, and |
| 163 | * categories) and matching that with a component that can handle it. |
| 164 | * If this attribute is set then none of the evaluation is performed, |
| 165 | * and this component is used exactly as is. By specifying this attribute, |
| 166 | * all of the other Intent attributes become optional.</p> |
| 167 | * <li> <p><b>extras</b> -- This is a {@link Bundle} of any additional information. |
| 168 | * This can be used to provide extended information to the component. |
| 169 | * For example, if we have a action to send an e-mail message, we could |
| 170 | * also include extra pieces of data here to supply a subject, body, |
| 171 | * etc.</p> |
| 172 | * </ul> |
| 173 | * |
| 174 | * <p>Here are some examples of other operations you can specify as intents |
| 175 | * using these additional parameters:</p> |
| 176 | * |
| 177 | * <ul> |
| 178 | * <li> <p><b>{@link #ACTION_MAIN} with category {@link #CATEGORY_HOME}</b> -- |
| 179 | * Launch the home screen.</p> |
| 180 | * </li> |
| 181 | * <li> <p><b>{@link #ACTION_GET_CONTENT} with MIME type |
| 182 | * <i>{@link android.provider.Contacts.Phones#CONTENT_URI |
| 183 | * vnd.android.cursor.item/phone}</i></b> |
| 184 | * -- Display the list of people's phone numbers, allowing the user to |
| 185 | * browse through them and pick one and return it to the parent activity.</p> |
| 186 | * </li> |
| 187 | * <li> <p><b>{@link #ACTION_GET_CONTENT} with MIME type |
| 188 | * <i>*{@literal /}*</i> and category {@link #CATEGORY_OPENABLE}</b> |
| 189 | * -- Display all pickers for data that can be opened with |
| 190 | * {@link ContentResolver#openInputStream(Uri) ContentResolver.openInputStream()}, |
| 191 | * allowing the user to pick one of them and then some data inside of it |
| 192 | * and returning the resulting URI to the caller. This can be used, |
| 193 | * for example, in an e-mail application to allow the user to pick some |
| 194 | * data to include as an attachment.</p> |
| 195 | * </li> |
| 196 | * </ul> |
| 197 | * |
| 198 | * <p>There are a variety of standard Intent action and category constants |
| 199 | * defined in the Intent class, but applications can also define their own. |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 200 | * These strings use Java-style scoping, to ensure they are unique -- for |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 201 | * example, the standard {@link #ACTION_VIEW} is called |
Yusuf T. Mobile | 8ecb36e | 2009-07-10 14:13:29 -0700 | [diff] [blame] | 202 | * "android.intent.action.VIEW".</p> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 203 | * |
| 204 | * <p>Put together, the set of actions, data types, categories, and extra data |
| 205 | * defines a language for the system allowing for the expression of phrases |
| 206 | * such as "call john smith's cell". As applications are added to the system, |
| 207 | * they can extend this language by adding new actions, types, and categories, or |
| 208 | * they can modify the behavior of existing phrases by supplying their own |
| 209 | * activities that handle them.</p> |
| 210 | * |
| 211 | * <a name="IntentResolution"></a> |
| 212 | * <h3>Intent Resolution</h3> |
| 213 | * |
| 214 | * <p>There are two primary forms of intents you will use. |
| 215 | * |
| 216 | * <ul> |
| 217 | * <li> <p><b>Explicit Intents</b> have specified a component (via |
| 218 | * {@link #setComponent} or {@link #setClass}), which provides the exact |
| 219 | * class to be run. Often these will not include any other information, |
| 220 | * simply being a way for an application to launch various internal |
| 221 | * activities it has as the user interacts with the application. |
| 222 | * |
| 223 | * <li> <p><b>Implicit Intents</b> have not specified a component; |
| 224 | * instead, they must include enough information for the system to |
| 225 | * determine which of the available components is best to run for that |
| 226 | * intent. |
| 227 | * </ul> |
| 228 | * |
| 229 | * <p>When using implicit intents, given such an arbitrary intent we need to |
| 230 | * know what to do with it. This is handled by the process of <em>Intent |
| 231 | * resolution</em>, which maps an Intent to an {@link android.app.Activity}, |
| 232 | * {@link BroadcastReceiver}, or {@link android.app.Service} (or sometimes two or |
| 233 | * more activities/receivers) that can handle it.</p> |
| 234 | * |
| 235 | * <p>The intent resolution mechanism basically revolves around matching an |
| 236 | * Intent against all of the <intent-filter> descriptions in the |
| 237 | * installed application packages. (Plus, in the case of broadcasts, any {@link BroadcastReceiver} |
| 238 | * objects explicitly registered with {@link Context#registerReceiver}.) More |
| 239 | * details on this can be found in the documentation on the {@link |
| 240 | * IntentFilter} class.</p> |
| 241 | * |
| 242 | * <p>There are three pieces of information in the Intent that are used for |
| 243 | * resolution: the action, type, and category. Using this information, a query |
| 244 | * is done on the {@link PackageManager} for a component that can handle the |
| 245 | * intent. The appropriate component is determined based on the intent |
| 246 | * information supplied in the <code>AndroidManifest.xml</code> file as |
| 247 | * follows:</p> |
| 248 | * |
| 249 | * <ul> |
| 250 | * <li> <p>The <b>action</b>, if given, must be listed by the component as |
| 251 | * one it handles.</p> |
| 252 | * <li> <p>The <b>type</b> is retrieved from the Intent's data, if not |
| 253 | * already supplied in the Intent. Like the action, if a type is |
| 254 | * included in the intent (either explicitly or implicitly in its |
| 255 | * data), then this must be listed by the component as one it handles.</p> |
| 256 | * <li> For data that is not a <code>content:</code> URI and where no explicit |
| 257 | * type is included in the Intent, instead the <b>scheme</b> of the |
| 258 | * intent data (such as <code>http:</code> or <code>mailto:</code>) is |
| 259 | * considered. Again like the action, if we are matching a scheme it |
| 260 | * must be listed by the component as one it can handle. |
| 261 | * <li> <p>The <b>categories</b>, if supplied, must <em>all</em> be listed |
| 262 | * by the activity as categories it handles. That is, if you include |
| 263 | * the categories {@link #CATEGORY_LAUNCHER} and |
| 264 | * {@link #CATEGORY_ALTERNATIVE}, then you will only resolve to components |
| 265 | * with an intent that lists <em>both</em> of those categories. |
| 266 | * Activities will very often need to support the |
| 267 | * {@link #CATEGORY_DEFAULT} so that they can be found by |
| 268 | * {@link Context#startActivity Context.startActivity()}.</p> |
| 269 | * </ul> |
| 270 | * |
| 271 | * <p>For example, consider the Note Pad sample application that |
Joshua Baxter | 9a841a6 | 2018-03-27 14:42:03 -0700 | [diff] [blame] | 272 | * allows a user to browse through a list of notes data and view details about |
| 273 | * individual items. Text in italics indicates places where you would replace a |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 274 | * name with one specific to your own package.</p> |
| 275 | * |
| 276 | * <pre> <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| 277 | * package="<i>com.android.notepad</i>"> |
| 278 | * <application android:icon="@drawable/app_notes" |
| 279 | * android:label="@string/app_name"> |
| 280 | * |
| 281 | * <provider class=".NotePadProvider" |
| 282 | * android:authorities="<i>com.google.provider.NotePad</i>" /> |
| 283 | * |
| 284 | * <activity class=".NotesList" android:label="@string/title_notes_list"> |
| 285 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 286 | * <action android:name="android.intent.action.MAIN" /> |
| 287 | * <category android:name="android.intent.category.LAUNCHER" /> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 288 | * </intent-filter> |
| 289 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 290 | * <action android:name="android.intent.action.VIEW" /> |
| 291 | * <action android:name="android.intent.action.EDIT" /> |
| 292 | * <action android:name="android.intent.action.PICK" /> |
| 293 | * <category android:name="android.intent.category.DEFAULT" /> |
| 294 | * <data android:mimeType="vnd.android.cursor.dir/<i>vnd.google.note</i>" /> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 295 | * </intent-filter> |
| 296 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 297 | * <action android:name="android.intent.action.GET_CONTENT" /> |
| 298 | * <category android:name="android.intent.category.DEFAULT" /> |
| 299 | * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 300 | * </intent-filter> |
| 301 | * </activity> |
| 302 | * |
| 303 | * <activity class=".NoteEditor" android:label="@string/title_note"> |
| 304 | * <intent-filter android:label="@string/resolve_edit"> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 305 | * <action android:name="android.intent.action.VIEW" /> |
| 306 | * <action android:name="android.intent.action.EDIT" /> |
| 307 | * <category android:name="android.intent.category.DEFAULT" /> |
| 308 | * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 309 | * </intent-filter> |
| 310 | * |
| 311 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 312 | * <action android:name="android.intent.action.INSERT" /> |
| 313 | * <category android:name="android.intent.category.DEFAULT" /> |
| 314 | * <data android:mimeType="vnd.android.cursor.dir/<i>vnd.google.note</i>" /> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 315 | * </intent-filter> |
| 316 | * |
| 317 | * </activity> |
| 318 | * |
| 319 | * <activity class=".TitleEditor" android:label="@string/title_edit_title" |
| 320 | * android:theme="@android:style/Theme.Dialog"> |
| 321 | * <intent-filter android:label="@string/resolve_title"> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 322 | * <action android:name="<i>com.android.notepad.action.EDIT_TITLE</i>" /> |
| 323 | * <category android:name="android.intent.category.DEFAULT" /> |
| 324 | * <category android:name="android.intent.category.ALTERNATIVE" /> |
| 325 | * <category android:name="android.intent.category.SELECTED_ALTERNATIVE" /> |
| 326 | * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 327 | * </intent-filter> |
| 328 | * </activity> |
| 329 | * |
| 330 | * </application> |
| 331 | * </manifest></pre> |
| 332 | * |
| 333 | * <p>The first activity, |
| 334 | * <code>com.android.notepad.NotesList</code>, serves as our main |
| 335 | * entry into the app. It can do three things as described by its three intent |
| 336 | * templates: |
| 337 | * <ol> |
| 338 | * <li><pre> |
| 339 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 340 | * <action android:name="{@link #ACTION_MAIN android.intent.action.MAIN}" /> |
| 341 | * <category android:name="{@link #CATEGORY_LAUNCHER android.intent.category.LAUNCHER}" /> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 342 | * </intent-filter></pre> |
| 343 | * <p>This provides a top-level entry into the NotePad application: the standard |
| 344 | * MAIN action is a main entry point (not requiring any other information in |
| 345 | * the Intent), and the LAUNCHER category says that this entry point should be |
| 346 | * listed in the application launcher.</p> |
| 347 | * <li><pre> |
| 348 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 349 | * <action android:name="{@link #ACTION_VIEW android.intent.action.VIEW}" /> |
| 350 | * <action android:name="{@link #ACTION_EDIT android.intent.action.EDIT}" /> |
| 351 | * <action android:name="{@link #ACTION_PICK android.intent.action.PICK}" /> |
| 352 | * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 353 | * <data android:mimeType="vnd.android.cursor.dir/<i>vnd.google.note</i>" /> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 354 | * </intent-filter></pre> |
| 355 | * <p>This declares the things that the activity can do on a directory of |
| 356 | * notes. The type being supported is given with the <type> tag, where |
| 357 | * <code>vnd.android.cursor.dir/vnd.google.note</code> is a URI from which |
| 358 | * a Cursor of zero or more items (<code>vnd.android.cursor.dir</code>) can |
| 359 | * be retrieved which holds our note pad data (<code>vnd.google.note</code>). |
| 360 | * The activity allows the user to view or edit the directory of data (via |
| 361 | * the VIEW and EDIT actions), or to pick a particular note and return it |
| 362 | * to the caller (via the PICK action). Note also the DEFAULT category |
| 363 | * supplied here: this is <em>required</em> for the |
| 364 | * {@link Context#startActivity Context.startActivity} method to resolve your |
| 365 | * activity when its component name is not explicitly specified.</p> |
| 366 | * <li><pre> |
| 367 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 368 | * <action android:name="{@link #ACTION_GET_CONTENT android.intent.action.GET_CONTENT}" /> |
| 369 | * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> |
| 370 | * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 371 | * </intent-filter></pre> |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 372 | * <p>This filter describes the ability to return to the caller a note selected by |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 373 | * the user without needing to know where it came from. The data type |
| 374 | * <code>vnd.android.cursor.item/vnd.google.note</code> is a URI from which |
| 375 | * a Cursor of exactly one (<code>vnd.android.cursor.item</code>) item can |
| 376 | * be retrieved which contains our note pad data (<code>vnd.google.note</code>). |
| 377 | * The GET_CONTENT action is similar to the PICK action, where the activity |
| 378 | * will return to its caller a piece of data selected by the user. Here, |
| 379 | * however, the caller specifies the type of data they desire instead of |
| 380 | * the type of data the user will be picking from.</p> |
| 381 | * </ol> |
| 382 | * |
| 383 | * <p>Given these capabilities, the following intents will resolve to the |
| 384 | * NotesList activity:</p> |
| 385 | * |
| 386 | * <ul> |
| 387 | * <li> <p><b>{ action=android.app.action.MAIN }</b> matches all of the |
| 388 | * activities that can be used as top-level entry points into an |
| 389 | * application.</p> |
| 390 | * <li> <p><b>{ action=android.app.action.MAIN, |
| 391 | * category=android.app.category.LAUNCHER }</b> is the actual intent |
| 392 | * used by the Launcher to populate its top-level list.</p> |
Yusuf T. Mobile | 8ecb36e | 2009-07-10 14:13:29 -0700 | [diff] [blame] | 393 | * <li> <p><b>{ action=android.intent.action.VIEW |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 394 | * data=content://com.google.provider.NotePad/notes }</b> |
| 395 | * displays a list of all the notes under |
| 396 | * "content://com.google.provider.NotePad/notes", which |
| 397 | * the user can browse through and see the details on.</p> |
| 398 | * <li> <p><b>{ action=android.app.action.PICK |
| 399 | * data=content://com.google.provider.NotePad/notes }</b> |
| 400 | * provides a list of the notes under |
| 401 | * "content://com.google.provider.NotePad/notes", from which |
| 402 | * the user can pick a note whose data URL is returned back to the caller.</p> |
| 403 | * <li> <p><b>{ action=android.app.action.GET_CONTENT |
| 404 | * type=vnd.android.cursor.item/vnd.google.note }</b> |
| 405 | * is similar to the pick action, but allows the caller to specify the |
| 406 | * kind of data they want back so that the system can find the appropriate |
| 407 | * activity to pick something of that data type.</p> |
| 408 | * </ul> |
| 409 | * |
| 410 | * <p>The second activity, |
| 411 | * <code>com.android.notepad.NoteEditor</code>, shows the user a single |
| 412 | * note entry and allows them to edit it. It can do two things as described |
| 413 | * by its two intent templates: |
| 414 | * <ol> |
| 415 | * <li><pre> |
| 416 | * <intent-filter android:label="@string/resolve_edit"> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 417 | * <action android:name="{@link #ACTION_VIEW android.intent.action.VIEW}" /> |
| 418 | * <action android:name="{@link #ACTION_EDIT android.intent.action.EDIT}" /> |
| 419 | * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> |
| 420 | * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 421 | * </intent-filter></pre> |
| 422 | * <p>The first, primary, purpose of this activity is to let the user interact |
| 423 | * with a single note, as decribed by the MIME type |
| 424 | * <code>vnd.android.cursor.item/vnd.google.note</code>. The activity can |
| 425 | * either VIEW a note or allow the user to EDIT it. Again we support the |
| 426 | * DEFAULT category to allow the activity to be launched without explicitly |
| 427 | * specifying its component.</p> |
| 428 | * <li><pre> |
| 429 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 430 | * <action android:name="{@link #ACTION_INSERT android.intent.action.INSERT}" /> |
| 431 | * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> |
| 432 | * <data android:mimeType="vnd.android.cursor.dir/<i>vnd.google.note</i>" /> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 433 | * </intent-filter></pre> |
| 434 | * <p>The secondary use of this activity is to insert a new note entry into |
| 435 | * an existing directory of notes. This is used when the user creates a new |
| 436 | * note: the INSERT action is executed on the directory of notes, causing |
| 437 | * this activity to run and have the user create the new note data which |
| 438 | * it then adds to the content provider.</p> |
| 439 | * </ol> |
| 440 | * |
| 441 | * <p>Given these capabilities, the following intents will resolve to the |
| 442 | * NoteEditor activity:</p> |
| 443 | * |
| 444 | * <ul> |
Yusuf T. Mobile | 8ecb36e | 2009-07-10 14:13:29 -0700 | [diff] [blame] | 445 | * <li> <p><b>{ action=android.intent.action.VIEW |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 446 | * data=content://com.google.provider.NotePad/notes/<var>{ID}</var> }</b> |
| 447 | * shows the user the content of note <var>{ID}</var>.</p> |
| 448 | * <li> <p><b>{ action=android.app.action.EDIT |
| 449 | * data=content://com.google.provider.NotePad/notes/<var>{ID}</var> }</b> |
| 450 | * allows the user to edit the content of note <var>{ID}</var>.</p> |
| 451 | * <li> <p><b>{ action=android.app.action.INSERT |
| 452 | * data=content://com.google.provider.NotePad/notes }</b> |
| 453 | * creates a new, empty note in the notes list at |
| 454 | * "content://com.google.provider.NotePad/notes" |
| 455 | * and allows the user to edit it. If they keep their changes, the URI |
| 456 | * of the newly created note is returned to the caller.</p> |
| 457 | * </ul> |
| 458 | * |
| 459 | * <p>The last activity, |
| 460 | * <code>com.android.notepad.TitleEditor</code>, allows the user to |
| 461 | * edit the title of a note. This could be implemented as a class that the |
| 462 | * application directly invokes (by explicitly setting its component in |
| 463 | * the Intent), but here we show a way you can publish alternative |
| 464 | * operations on existing data:</p> |
| 465 | * |
| 466 | * <pre> |
| 467 | * <intent-filter android:label="@string/resolve_title"> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 468 | * <action android:name="<i>com.android.notepad.action.EDIT_TITLE</i>" /> |
| 469 | * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> |
| 470 | * <category android:name="{@link #CATEGORY_ALTERNATIVE android.intent.category.ALTERNATIVE}" /> |
| 471 | * <category android:name="{@link #CATEGORY_SELECTED_ALTERNATIVE android.intent.category.SELECTED_ALTERNATIVE}" /> |
| 472 | * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 473 | * </intent-filter></pre> |
| 474 | * |
| 475 | * <p>In the single intent template here, we |
| 476 | * have created our own private action called |
| 477 | * <code>com.android.notepad.action.EDIT_TITLE</code> which means to |
| 478 | * edit the title of a note. It must be invoked on a specific note |
| 479 | * (data type <code>vnd.android.cursor.item/vnd.google.note</code>) like the previous |
| 480 | * view and edit actions, but here displays and edits the title contained |
| 481 | * in the note data. |
| 482 | * |
| 483 | * <p>In addition to supporting the default category as usual, our title editor |
| 484 | * also supports two other standard categories: ALTERNATIVE and |
| 485 | * SELECTED_ALTERNATIVE. Implementing |
| 486 | * these categories allows others to find the special action it provides |
| 487 | * without directly knowing about it, through the |
| 488 | * {@link android.content.pm.PackageManager#queryIntentActivityOptions} method, or |
| 489 | * more often to build dynamic menu items with |
| 490 | * {@link android.view.Menu#addIntentOptions}. Note that in the intent |
| 491 | * template here was also supply an explicit name for the template |
| 492 | * (via <code>android:label="@string/resolve_title"</code>) to better control |
| 493 | * what the user sees when presented with this activity as an alternative |
| 494 | * action to the data they are viewing. |
| 495 | * |
| 496 | * <p>Given these capabilities, the following intent will resolve to the |
| 497 | * TitleEditor activity:</p> |
| 498 | * |
| 499 | * <ul> |
| 500 | * <li> <p><b>{ action=com.android.notepad.action.EDIT_TITLE |
| 501 | * data=content://com.google.provider.NotePad/notes/<var>{ID}</var> }</b> |
| 502 | * displays and allows the user to edit the title associated |
| 503 | * with note <var>{ID}</var>.</p> |
| 504 | * </ul> |
| 505 | * |
| 506 | * <h3>Standard Activity Actions</h3> |
| 507 | * |
| 508 | * <p>These are the current standard actions that Intent defines for launching |
| 509 | * activities (usually through {@link Context#startActivity}. The most |
| 510 | * important, and by far most frequently used, are {@link #ACTION_MAIN} and |
| 511 | * {@link #ACTION_EDIT}. |
| 512 | * |
| 513 | * <ul> |
| 514 | * <li> {@link #ACTION_MAIN} |
| 515 | * <li> {@link #ACTION_VIEW} |
| 516 | * <li> {@link #ACTION_ATTACH_DATA} |
| 517 | * <li> {@link #ACTION_EDIT} |
| 518 | * <li> {@link #ACTION_PICK} |
| 519 | * <li> {@link #ACTION_CHOOSER} |
| 520 | * <li> {@link #ACTION_GET_CONTENT} |
| 521 | * <li> {@link #ACTION_DIAL} |
| 522 | * <li> {@link #ACTION_CALL} |
| 523 | * <li> {@link #ACTION_SEND} |
| 524 | * <li> {@link #ACTION_SENDTO} |
| 525 | * <li> {@link #ACTION_ANSWER} |
| 526 | * <li> {@link #ACTION_INSERT} |
| 527 | * <li> {@link #ACTION_DELETE} |
| 528 | * <li> {@link #ACTION_RUN} |
| 529 | * <li> {@link #ACTION_SYNC} |
| 530 | * <li> {@link #ACTION_PICK_ACTIVITY} |
| 531 | * <li> {@link #ACTION_SEARCH} |
| 532 | * <li> {@link #ACTION_WEB_SEARCH} |
| 533 | * <li> {@link #ACTION_FACTORY_TEST} |
| 534 | * </ul> |
| 535 | * |
| 536 | * <h3>Standard Broadcast Actions</h3> |
| 537 | * |
| 538 | * <p>These are the current standard actions that Intent defines for receiving |
| 539 | * broadcasts (usually through {@link Context#registerReceiver} or a |
| 540 | * <receiver> tag in a manifest). |
| 541 | * |
| 542 | * <ul> |
| 543 | * <li> {@link #ACTION_TIME_TICK} |
| 544 | * <li> {@link #ACTION_TIME_CHANGED} |
| 545 | * <li> {@link #ACTION_TIMEZONE_CHANGED} |
| 546 | * <li> {@link #ACTION_BOOT_COMPLETED} |
| 547 | * <li> {@link #ACTION_PACKAGE_ADDED} |
| 548 | * <li> {@link #ACTION_PACKAGE_CHANGED} |
| 549 | * <li> {@link #ACTION_PACKAGE_REMOVED} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 550 | * <li> {@link #ACTION_PACKAGE_RESTARTED} |
| 551 | * <li> {@link #ACTION_PACKAGE_DATA_CLEARED} |
Andrei Stingaceanu | 69d5ebc | 2016-01-14 12:59:03 +0000 | [diff] [blame] | 552 | * <li> {@link #ACTION_PACKAGES_SUSPENDED} |
| 553 | * <li> {@link #ACTION_PACKAGES_UNSUSPENDED} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 554 | * <li> {@link #ACTION_UID_REMOVED} |
| 555 | * <li> {@link #ACTION_BATTERY_CHANGED} |
Cliff Spradlin | fda6fae | 2008-10-22 20:29:16 -0700 | [diff] [blame] | 556 | * <li> {@link #ACTION_POWER_CONNECTED} |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 557 | * <li> {@link #ACTION_POWER_DISCONNECTED} |
| 558 | * <li> {@link #ACTION_SHUTDOWN} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 559 | * </ul> |
| 560 | * |
| 561 | * <h3>Standard Categories</h3> |
| 562 | * |
| 563 | * <p>These are the current standard categories that can be used to further |
| 564 | * clarify an Intent via {@link #addCategory}. |
| 565 | * |
| 566 | * <ul> |
| 567 | * <li> {@link #CATEGORY_DEFAULT} |
| 568 | * <li> {@link #CATEGORY_BROWSABLE} |
| 569 | * <li> {@link #CATEGORY_TAB} |
| 570 | * <li> {@link #CATEGORY_ALTERNATIVE} |
| 571 | * <li> {@link #CATEGORY_SELECTED_ALTERNATIVE} |
| 572 | * <li> {@link #CATEGORY_LAUNCHER} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 573 | * <li> {@link #CATEGORY_INFO} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 574 | * <li> {@link #CATEGORY_HOME} |
| 575 | * <li> {@link #CATEGORY_PREFERENCE} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 576 | * <li> {@link #CATEGORY_TEST} |
Mike Lockwood | 9092ab4 | 2009-09-16 13:01:32 -0400 | [diff] [blame] | 577 | * <li> {@link #CATEGORY_CAR_DOCK} |
| 578 | * <li> {@link #CATEGORY_DESK_DOCK} |
Praveen Bharathi | 21e941b | 2010-10-06 15:23:14 -0500 | [diff] [blame] | 579 | * <li> {@link #CATEGORY_LE_DESK_DOCK} |
| 580 | * <li> {@link #CATEGORY_HE_DESK_DOCK} |
Bernd Holzhey | aea4b67 | 2010-03-31 09:46:13 +0200 | [diff] [blame] | 581 | * <li> {@link #CATEGORY_CAR_MODE} |
Patrick Dubroy | 6dabe24 | 2010-08-30 10:43:47 -0700 | [diff] [blame] | 582 | * <li> {@link #CATEGORY_APP_MARKET} |
Zak Cohen | db6ca49 | 2017-01-26 14:09:00 -0800 | [diff] [blame] | 583 | * <li> {@link #CATEGORY_VR_HOME} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 584 | * </ul> |
| 585 | * |
| 586 | * <h3>Standard Extra Data</h3> |
| 587 | * |
| 588 | * <p>These are the current standard fields that can be used as extra data via |
| 589 | * {@link #putExtra}. |
| 590 | * |
| 591 | * <ul> |
Trevor Johns | d59fb6e | 2009-11-20 12:54:57 -0800 | [diff] [blame] | 592 | * <li> {@link #EXTRA_ALARM_COUNT} |
| 593 | * <li> {@link #EXTRA_BCC} |
| 594 | * <li> {@link #EXTRA_CC} |
| 595 | * <li> {@link #EXTRA_CHANGED_COMPONENT_NAME} |
| 596 | * <li> {@link #EXTRA_DATA_REMOVED} |
| 597 | * <li> {@link #EXTRA_DOCK_STATE} |
Praveen Bharathi | 21e941b | 2010-10-06 15:23:14 -0500 | [diff] [blame] | 598 | * <li> {@link #EXTRA_DOCK_STATE_HE_DESK} |
| 599 | * <li> {@link #EXTRA_DOCK_STATE_LE_DESK} |
Trevor Johns | d59fb6e | 2009-11-20 12:54:57 -0800 | [diff] [blame] | 600 | * <li> {@link #EXTRA_DOCK_STATE_CAR} |
| 601 | * <li> {@link #EXTRA_DOCK_STATE_DESK} |
| 602 | * <li> {@link #EXTRA_DOCK_STATE_UNDOCKED} |
| 603 | * <li> {@link #EXTRA_DONT_KILL_APP} |
| 604 | * <li> {@link #EXTRA_EMAIL} |
| 605 | * <li> {@link #EXTRA_INITIAL_INTENTS} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 606 | * <li> {@link #EXTRA_INTENT} |
Trevor Johns | d59fb6e | 2009-11-20 12:54:57 -0800 | [diff] [blame] | 607 | * <li> {@link #EXTRA_KEY_EVENT} |
rich cannings | 706e8ba | 2012-08-20 13:20:14 -0700 | [diff] [blame] | 608 | * <li> {@link #EXTRA_ORIGINATING_URI} |
Trevor Johns | d59fb6e | 2009-11-20 12:54:57 -0800 | [diff] [blame] | 609 | * <li> {@link #EXTRA_PHONE_NUMBER} |
rich cannings | 368ed01 | 2012-06-07 15:37:57 -0700 | [diff] [blame] | 610 | * <li> {@link #EXTRA_REFERRER} |
Trevor Johns | d59fb6e | 2009-11-20 12:54:57 -0800 | [diff] [blame] | 611 | * <li> {@link #EXTRA_REMOTE_INTENT_TOKEN} |
| 612 | * <li> {@link #EXTRA_REPLACING} |
| 613 | * <li> {@link #EXTRA_SHORTCUT_ICON} |
| 614 | * <li> {@link #EXTRA_SHORTCUT_ICON_RESOURCE} |
| 615 | * <li> {@link #EXTRA_SHORTCUT_INTENT} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 616 | * <li> {@link #EXTRA_STREAM} |
Trevor Johns | d59fb6e | 2009-11-20 12:54:57 -0800 | [diff] [blame] | 617 | * <li> {@link #EXTRA_SHORTCUT_NAME} |
| 618 | * <li> {@link #EXTRA_SUBJECT} |
| 619 | * <li> {@link #EXTRA_TEMPLATE} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 620 | * <li> {@link #EXTRA_TEXT} |
Trevor Johns | d59fb6e | 2009-11-20 12:54:57 -0800 | [diff] [blame] | 621 | * <li> {@link #EXTRA_TITLE} |
| 622 | * <li> {@link #EXTRA_UID} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 623 | * </ul> |
| 624 | * |
| 625 | * <h3>Flags</h3> |
| 626 | * |
| 627 | * <p>These are the possible flags that can be used in the Intent via |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 628 | * {@link #setFlags} and {@link #addFlags}. See {@link #setFlags} for a list |
| 629 | * of all possible flags. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 630 | */ |
Dianne Hackborn | ee0511d | 2009-12-21 18:08:13 -0800 | [diff] [blame] | 631 | public class Intent implements Parcelable, Cloneable { |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 632 | private static final String ATTR_ACTION = "action"; |
| 633 | private static final String TAG_CATEGORIES = "categories"; |
| 634 | private static final String ATTR_CATEGORY = "category"; |
| 635 | private static final String TAG_EXTRA = "extra"; |
| 636 | private static final String ATTR_TYPE = "type"; |
| 637 | private static final String ATTR_COMPONENT = "component"; |
| 638 | private static final String ATTR_DATA = "data"; |
| 639 | private static final String ATTR_FLAGS = "flags"; |
| 640 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 641 | // --------------------------------------------------------------------- |
| 642 | // --------------------------------------------------------------------- |
| 643 | // Standard intent activity actions (see action variable). |
| 644 | |
| 645 | /** |
| 646 | * Activity Action: Start as a main entry point, does not expect to |
| 647 | * receive data. |
| 648 | * <p>Input: nothing |
| 649 | * <p>Output: nothing |
| 650 | */ |
| 651 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 652 | public static final String ACTION_MAIN = "android.intent.action.MAIN"; |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 653 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 654 | /** |
| 655 | * Activity Action: Display the data to the user. This is the most common |
| 656 | * action performed on data -- it is the generic action you can use on |
| 657 | * a piece of data to get the most reasonable thing to occur. For example, |
| 658 | * when used on a contacts entry it will view the entry; when used on a |
| 659 | * mailto: URI it will bring up a compose window filled with the information |
| 660 | * supplied by the URI; when used with a tel: URI it will invoke the |
| 661 | * dialer. |
| 662 | * <p>Input: {@link #getData} is URI from which to retrieve data. |
| 663 | * <p>Output: nothing. |
| 664 | */ |
| 665 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 666 | public static final String ACTION_VIEW = "android.intent.action.VIEW"; |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 667 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 668 | /** |
Dianne Hackborn | a320f01 | 2017-04-07 13:57:48 -0700 | [diff] [blame] | 669 | * Extra that can be included on activity intents coming from the storage UI |
| 670 | * when it launches sub-activities to manage various types of storage. For example, |
| 671 | * it may use {@link #ACTION_VIEW} with a "image/*" MIME type to have an app show |
| 672 | * the images on the device, and in that case also include this extra to tell the |
| 673 | * app it is coming from the storage UI so should help the user manage storage of |
| 674 | * this type. |
| 675 | */ |
| 676 | public static final String EXTRA_FROM_STORAGE = "android.intent.extra.FROM_STORAGE"; |
| 677 | |
| 678 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 679 | * A synonym for {@link #ACTION_VIEW}, the "standard" action that is |
| 680 | * performed on a piece of data. |
| 681 | */ |
| 682 | public static final String ACTION_DEFAULT = ACTION_VIEW; |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 683 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 684 | /** |
Tomasz Mikolajewski | 319fb49 | 2016-01-20 12:24:01 +0900 | [diff] [blame] | 685 | * Activity Action: Quick view the data. Launches a quick viewer for |
| 686 | * a URI or a list of URIs. |
Tomasz Mikolajewski | fe02313 | 2016-03-10 17:42:35 +0900 | [diff] [blame] | 687 | * <p>Activities handling this intent action should handle the vast majority of |
| 688 | * MIME types rather than only specific ones. |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 689 | * <p>Quick viewers must render the quick view image locally, and must not send |
| 690 | * file content outside current device. |
Tomasz Mikolajewski | 319fb49 | 2016-01-20 12:24:01 +0900 | [diff] [blame] | 691 | * <p>Input: {@link #getData} is a mandatory content URI of the item to |
| 692 | * preview. {@link #getClipData} contains an optional list of content URIs |
| 693 | * if there is more than one item to preview. {@link #EXTRA_INDEX} is an |
| 694 | * optional index of the URI in the clip data to show first. |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 695 | * {@link #EXTRA_QUICK_VIEW_FEATURES} is an optional extra indicating the features |
| 696 | * that can be shown in the quick view UI. |
Steve McKay | c78bcb8 | 2015-07-31 14:35:22 -0700 | [diff] [blame] | 697 | * <p>Output: nothing. |
Tomasz Mikolajewski | 867addf | 2017-02-01 14:16:39 +0900 | [diff] [blame] | 698 | * @see #EXTRA_INDEX |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 699 | * @see #EXTRA_QUICK_VIEW_FEATURES |
Steve McKay | c78bcb8 | 2015-07-31 14:35:22 -0700 | [diff] [blame] | 700 | */ |
| 701 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 702 | public static final String ACTION_QUICK_VIEW = "android.intent.action.QUICK_VIEW"; |
| 703 | |
| 704 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 705 | * Used to indicate that some piece of data should be attached to some other |
| 706 | * place. For example, image data could be attached to a contact. It is up |
| 707 | * to the recipient to decide where the data should be attached; the intent |
| 708 | * does not specify the ultimate destination. |
| 709 | * <p>Input: {@link #getData} is URI of data to be attached. |
| 710 | * <p>Output: nothing. |
| 711 | */ |
| 712 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 713 | public static final String ACTION_ATTACH_DATA = "android.intent.action.ATTACH_DATA"; |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 714 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 715 | /** |
| 716 | * Activity Action: Provide explicit editable access to the given data. |
| 717 | * <p>Input: {@link #getData} is URI of data to be edited. |
| 718 | * <p>Output: nothing. |
| 719 | */ |
| 720 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 721 | public static final String ACTION_EDIT = "android.intent.action.EDIT"; |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 722 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 723 | /** |
| 724 | * Activity Action: Pick an existing item, or insert a new item, and then edit it. |
| 725 | * <p>Input: {@link #getType} is the desired MIME type of the item to create or edit. |
| 726 | * The extras can contain type specific data to pass through to the editing/creating |
| 727 | * activity. |
| 728 | * <p>Output: The URI of the item that was picked. This must be a content: |
| 729 | * URI so that any receiver can access it. |
| 730 | */ |
| 731 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 732 | public static final String ACTION_INSERT_OR_EDIT = "android.intent.action.INSERT_OR_EDIT"; |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 733 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 734 | /** |
| 735 | * Activity Action: Pick an item from the data, returning what was selected. |
| 736 | * <p>Input: {@link #getData} is URI containing a directory of data |
| 737 | * (vnd.android.cursor.dir/*) from which to pick an item. |
| 738 | * <p>Output: The URI of the item that was picked. |
| 739 | */ |
| 740 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 741 | public static final String ACTION_PICK = "android.intent.action.PICK"; |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 742 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 743 | /** |
| 744 | * Activity Action: Creates a shortcut. |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 745 | * <p>Input: Nothing.</p> |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 746 | * <p>Output: An Intent representing the {@link android.content.pm.ShortcutInfo} result.</p> |
| 747 | * <p>For compatibility with older versions of android the intent may also contain three |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 748 | * extras: SHORTCUT_INTENT (value: Intent), SHORTCUT_NAME (value: String), |
| 749 | * and SHORTCUT_ICON (value: Bitmap) or SHORTCUT_ICON_RESOURCE |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 750 | * (value: ShortcutIconResource).</p> |
| 751 | * |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 752 | * @see android.content.pm.ShortcutManager#createShortcutResultIntent |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 753 | * @see #EXTRA_SHORTCUT_INTENT |
| 754 | * @see #EXTRA_SHORTCUT_NAME |
| 755 | * @see #EXTRA_SHORTCUT_ICON |
| 756 | * @see #EXTRA_SHORTCUT_ICON_RESOURCE |
| 757 | * @see android.content.Intent.ShortcutIconResource |
| 758 | */ |
| 759 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 760 | public static final String ACTION_CREATE_SHORTCUT = "android.intent.action.CREATE_SHORTCUT"; |
| 761 | |
| 762 | /** |
| 763 | * The name of the extra used to define the Intent of a shortcut. |
| 764 | * |
| 765 | * @see #ACTION_CREATE_SHORTCUT |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 766 | * @deprecated Replaced with {@link android.content.pm.ShortcutManager#createShortcutResultIntent} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 767 | */ |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 768 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 769 | public static final String EXTRA_SHORTCUT_INTENT = "android.intent.extra.shortcut.INTENT"; |
| 770 | /** |
| 771 | * The name of the extra used to define the name of a shortcut. |
| 772 | * |
| 773 | * @see #ACTION_CREATE_SHORTCUT |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 774 | * @deprecated Replaced with {@link android.content.pm.ShortcutManager#createShortcutResultIntent} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 775 | */ |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 776 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 777 | public static final String EXTRA_SHORTCUT_NAME = "android.intent.extra.shortcut.NAME"; |
| 778 | /** |
| 779 | * The name of the extra used to define the icon, as a Bitmap, of a shortcut. |
| 780 | * |
| 781 | * @see #ACTION_CREATE_SHORTCUT |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 782 | * @deprecated Replaced with {@link android.content.pm.ShortcutManager#createShortcutResultIntent} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 783 | */ |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 784 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 785 | public static final String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON"; |
| 786 | /** |
| 787 | * The name of the extra used to define the icon, as a ShortcutIconResource, of a shortcut. |
| 788 | * |
| 789 | * @see #ACTION_CREATE_SHORTCUT |
| 790 | * @see android.content.Intent.ShortcutIconResource |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 791 | * @deprecated Replaced with {@link android.content.pm.ShortcutManager#createShortcutResultIntent} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 792 | */ |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 793 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 794 | public static final String EXTRA_SHORTCUT_ICON_RESOURCE = |
| 795 | "android.intent.extra.shortcut.ICON_RESOURCE"; |
| 796 | |
| 797 | /** |
Jason Monk | 2f68e8a | 2016-02-23 17:57:28 -0500 | [diff] [blame] | 798 | * An activity that provides a user interface for adjusting application preferences. |
| 799 | * Optional but recommended settings for all applications which have settings. |
| 800 | */ |
| 801 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 802 | public static final String ACTION_APPLICATION_PREFERENCES |
| 803 | = "android.intent.action.APPLICATION_PREFERENCES"; |
| 804 | |
| 805 | /** |
Sudheer Shanka | 80b6641 | 2016-04-06 18:31:10 -0700 | [diff] [blame] | 806 | * Activity Action: Launch an activity showing the app information. |
| 807 | * For applications which install other applications (such as app stores), it is recommended |
| 808 | * to handle this action for providing the app information to the user. |
| 809 | * |
| 810 | * <p>Input: {@link #EXTRA_PACKAGE_NAME} specifies the package whose information needs |
| 811 | * to be displayed. |
| 812 | * <p>Output: Nothing. |
| 813 | */ |
| 814 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 815 | public static final String ACTION_SHOW_APP_INFO |
| 816 | = "android.intent.action.SHOW_APP_INFO"; |
| 817 | |
| 818 | /** |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 819 | * Represents a shortcut/live folder icon resource. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 820 | * |
| 821 | * @see Intent#ACTION_CREATE_SHORTCUT |
| 822 | * @see Intent#EXTRA_SHORTCUT_ICON_RESOURCE |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 823 | * @see android.provider.LiveFolders#ACTION_CREATE_LIVE_FOLDER |
| 824 | * @see android.provider.LiveFolders#EXTRA_LIVE_FOLDER_ICON |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 825 | */ |
| 826 | public static class ShortcutIconResource implements Parcelable { |
| 827 | /** |
| 828 | * The package name of the application containing the icon. |
| 829 | */ |
| 830 | public String packageName; |
| 831 | |
| 832 | /** |
| 833 | * The resource name of the icon, including package, name and type. |
| 834 | */ |
| 835 | public String resourceName; |
| 836 | |
| 837 | /** |
| 838 | * Creates a new ShortcutIconResource for the specified context and resource |
| 839 | * identifier. |
| 840 | * |
| 841 | * @param context The context of the application. |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 842 | * @param resourceId The resource identifier for the icon. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 843 | * @return A new ShortcutIconResource with the specified's context package name |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 844 | * and icon resource identifier.`` |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 845 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 846 | public static ShortcutIconResource fromContext(Context context, @AnyRes int resourceId) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 847 | ShortcutIconResource icon = new ShortcutIconResource(); |
| 848 | icon.packageName = context.getPackageName(); |
| 849 | icon.resourceName = context.getResources().getResourceName(resourceId); |
| 850 | return icon; |
| 851 | } |
| 852 | |
| 853 | /** |
| 854 | * Used to read a ShortcutIconResource from a Parcel. |
| 855 | */ |
| 856 | public static final Parcelable.Creator<ShortcutIconResource> CREATOR = |
| 857 | new Parcelable.Creator<ShortcutIconResource>() { |
| 858 | |
| 859 | public ShortcutIconResource createFromParcel(Parcel source) { |
| 860 | ShortcutIconResource icon = new ShortcutIconResource(); |
| 861 | icon.packageName = source.readString(); |
| 862 | icon.resourceName = source.readString(); |
| 863 | return icon; |
| 864 | } |
| 865 | |
| 866 | public ShortcutIconResource[] newArray(int size) { |
| 867 | return new ShortcutIconResource[size]; |
| 868 | } |
| 869 | }; |
| 870 | |
| 871 | /** |
| 872 | * No special parcel contents. |
| 873 | */ |
| 874 | public int describeContents() { |
| 875 | return 0; |
| 876 | } |
| 877 | |
| 878 | public void writeToParcel(Parcel dest, int flags) { |
| 879 | dest.writeString(packageName); |
| 880 | dest.writeString(resourceName); |
| 881 | } |
| 882 | |
| 883 | @Override |
| 884 | public String toString() { |
| 885 | return resourceName; |
| 886 | } |
| 887 | } |
| 888 | |
| 889 | /** |
| 890 | * Activity Action: Display an activity chooser, allowing the user to pick |
| 891 | * what they want to before proceeding. This can be used as an alternative |
| 892 | * to the standard activity picker that is displayed by the system when |
| 893 | * you try to start an activity with multiple possible matches, with these |
| 894 | * differences in behavior: |
| 895 | * <ul> |
| 896 | * <li>You can specify the title that will appear in the activity chooser. |
| 897 | * <li>The user does not have the option to make one of the matching |
| 898 | * activities a preferred activity, and all possible activities will |
| 899 | * always be shown even if one of them is currently marked as the |
| 900 | * preferred activity. |
| 901 | * </ul> |
| 902 | * <p> |
| 903 | * This action should be used when the user will naturally expect to |
| 904 | * select an activity in order to proceed. An example if when not to use |
| 905 | * it is when the user clicks on a "mailto:" link. They would naturally |
| 906 | * expect to go directly to their mail app, so startActivity() should be |
| 907 | * called directly: it will |
| 908 | * either launch the current preferred app, or put up a dialog allowing the |
| 909 | * user to pick an app to use and optionally marking that as preferred. |
| 910 | * <p> |
| 911 | * In contrast, if the user is selecting a menu item to send a picture |
| 912 | * they are viewing to someone else, there are many different things they |
| 913 | * may want to do at this point: send it through e-mail, upload it to a |
| 914 | * web service, etc. In this case the CHOOSER action should be used, to |
| 915 | * always present to the user a list of the things they can do, with a |
| 916 | * nice title given by the caller such as "Send this photo with:". |
| 917 | * <p> |
Dianne Hackborn | e302a16 | 2012-05-15 14:58:32 -0700 | [diff] [blame] | 918 | * If you need to grant URI permissions through a chooser, you must specify |
| 919 | * the permissions to be granted on the ACTION_CHOOSER Intent |
| 920 | * <em>in addition</em> to the EXTRA_INTENT inside. This means using |
| 921 | * {@link #setClipData} to specify the URIs to be granted as well as |
| 922 | * {@link #FLAG_GRANT_READ_URI_PERMISSION} and/or |
| 923 | * {@link #FLAG_GRANT_WRITE_URI_PERMISSION} as appropriate. |
| 924 | * <p> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 925 | * As a convenience, an Intent of this form can be created with the |
| 926 | * {@link #createChooser} function. |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 927 | * <p> |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 928 | * Input: No data should be specified. get*Extra must have |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 929 | * a {@link #EXTRA_INTENT} field containing the Intent being executed, |
| 930 | * and can optionally have a {@link #EXTRA_TITLE} field containing the |
| 931 | * title text to display in the chooser. |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 932 | * <p> |
| 933 | * Output: Depends on the protocol of {@link #EXTRA_INTENT}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 934 | */ |
| 935 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 936 | public static final String ACTION_CHOOSER = "android.intent.action.CHOOSER"; |
| 937 | |
| 938 | /** |
| 939 | * Convenience function for creating a {@link #ACTION_CHOOSER} Intent. |
| 940 | * |
Dianne Hackborn | e302a16 | 2012-05-15 14:58:32 -0700 | [diff] [blame] | 941 | * <p>Builds a new {@link #ACTION_CHOOSER} Intent that wraps the given |
| 942 | * target intent, also optionally supplying a title. If the target |
| 943 | * intent has specified {@link #FLAG_GRANT_READ_URI_PERMISSION} or |
| 944 | * {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, then these flags will also be |
| 945 | * set in the returned chooser intent, with its ClipData set appropriately: |
| 946 | * either a direct reflection of {@link #getClipData()} if that is non-null, |
John Spurlock | 3390018 | 2014-01-02 11:04:18 -0500 | [diff] [blame] | 947 | * or a new ClipData built from {@link #getData()}. |
Dianne Hackborn | e302a16 | 2012-05-15 14:58:32 -0700 | [diff] [blame] | 948 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 949 | * @param target The Intent that the user will be selecting an activity |
| 950 | * to perform. |
| 951 | * @param title Optional title that will be displayed in the chooser. |
| 952 | * @return Return a new Intent object that you can hand to |
| 953 | * {@link Context#startActivity(Intent) Context.startActivity()} and |
| 954 | * related methods. |
| 955 | */ |
| 956 | public static Intent createChooser(Intent target, CharSequence title) { |
Adam Powell | 0b3c112 | 2014-10-09 12:50:14 -0700 | [diff] [blame] | 957 | return createChooser(target, title, null); |
| 958 | } |
| 959 | |
| 960 | /** |
| 961 | * Convenience function for creating a {@link #ACTION_CHOOSER} Intent. |
| 962 | * |
| 963 | * <p>Builds a new {@link #ACTION_CHOOSER} Intent that wraps the given |
| 964 | * target intent, also optionally supplying a title. If the target |
| 965 | * intent has specified {@link #FLAG_GRANT_READ_URI_PERMISSION} or |
| 966 | * {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, then these flags will also be |
| 967 | * set in the returned chooser intent, with its ClipData set appropriately: |
| 968 | * either a direct reflection of {@link #getClipData()} if that is non-null, |
| 969 | * or a new ClipData built from {@link #getData()}.</p> |
| 970 | * |
| 971 | * <p>The caller may optionally supply an {@link IntentSender} to receive a callback |
| 972 | * when the user makes a choice. This can be useful if the calling application wants |
| 973 | * to remember the last chosen target and surface it as a more prominent or one-touch |
| 974 | * affordance elsewhere in the UI for next time.</p> |
| 975 | * |
| 976 | * @param target The Intent that the user will be selecting an activity |
| 977 | * to perform. |
| 978 | * @param title Optional title that will be displayed in the chooser. |
| 979 | * @param sender Optional IntentSender to be called when a choice is made. |
| 980 | * @return Return a new Intent object that you can hand to |
| 981 | * {@link Context#startActivity(Intent) Context.startActivity()} and |
| 982 | * related methods. |
| 983 | */ |
| 984 | public static Intent createChooser(Intent target, CharSequence title, IntentSender sender) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 985 | Intent intent = new Intent(ACTION_CHOOSER); |
| 986 | intent.putExtra(EXTRA_INTENT, target); |
| 987 | if (title != null) { |
| 988 | intent.putExtra(EXTRA_TITLE, title); |
| 989 | } |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 990 | |
Adam Powell | 0b3c112 | 2014-10-09 12:50:14 -0700 | [diff] [blame] | 991 | if (sender != null) { |
| 992 | intent.putExtra(EXTRA_CHOSEN_COMPONENT_INTENT_SENDER, sender); |
| 993 | } |
| 994 | |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 995 | // Migrate any clip data and flags from target. |
Jeff Sharkey | 846318a | 2014-04-04 12:12:41 -0700 | [diff] [blame] | 996 | int permFlags = target.getFlags() & (FLAG_GRANT_READ_URI_PERMISSION |
| 997 | | FLAG_GRANT_WRITE_URI_PERMISSION | FLAG_GRANT_PERSISTABLE_URI_PERMISSION |
| 998 | | FLAG_GRANT_PREFIX_URI_PERMISSION); |
Dianne Hackborn | e302a16 | 2012-05-15 14:58:32 -0700 | [diff] [blame] | 999 | if (permFlags != 0) { |
| 1000 | ClipData targetClipData = target.getClipData(); |
| 1001 | if (targetClipData == null && target.getData() != null) { |
| 1002 | ClipData.Item item = new ClipData.Item(target.getData()); |
| 1003 | String[] mimeTypes; |
| 1004 | if (target.getType() != null) { |
| 1005 | mimeTypes = new String[] { target.getType() }; |
| 1006 | } else { |
| 1007 | mimeTypes = new String[] { }; |
| 1008 | } |
| 1009 | targetClipData = new ClipData(null, mimeTypes, item); |
| 1010 | } |
| 1011 | if (targetClipData != null) { |
| 1012 | intent.setClipData(targetClipData); |
| 1013 | intent.addFlags(permFlags); |
| 1014 | } |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 1015 | } |
Dianne Hackborn | e302a16 | 2012-05-15 14:58:32 -0700 | [diff] [blame] | 1016 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1017 | return intent; |
| 1018 | } |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 1019 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1020 | /** |
| 1021 | * Activity Action: Allow the user to select a particular kind of data and |
| 1022 | * return it. This is different than {@link #ACTION_PICK} in that here we |
| 1023 | * just say what kind of data is desired, not a URI of existing data from |
Dianne Hackborn | fdb3f09 | 2013-01-28 15:10:48 -0800 | [diff] [blame] | 1024 | * which the user can pick. An ACTION_GET_CONTENT could allow the user to |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1025 | * create the data as it runs (for example taking a picture or recording a |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 1026 | * sound), let them browse over the web and download the desired data, |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1027 | * etc. |
| 1028 | * <p> |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 1029 | * There are two main ways to use this action: if you want a specific kind |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1030 | * of data, such as a person contact, you set the MIME type to the kind of |
| 1031 | * data you want and launch it with {@link Context#startActivity(Intent)}. |
| 1032 | * The system will then launch the best application to select that kind |
| 1033 | * of data for you. |
| 1034 | * <p> |
| 1035 | * You may also be interested in any of a set of types of content the user |
| 1036 | * can pick. For example, an e-mail application that wants to allow the |
| 1037 | * user to add an attachment to an e-mail message can use this action to |
| 1038 | * bring up a list of all of the types of content the user can attach. |
| 1039 | * <p> |
| 1040 | * In this case, you should wrap the GET_CONTENT intent with a chooser |
| 1041 | * (through {@link #createChooser}), which will give the proper interface |
| 1042 | * for the user to pick how to send your data and allow you to specify |
| 1043 | * a prompt indicating what they are doing. You will usually specify a |
| 1044 | * broad MIME type (such as image/* or {@literal *}/*), resulting in a |
| 1045 | * broad range of content types the user can select from. |
| 1046 | * <p> |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 1047 | * When using such a broad GET_CONTENT action, it is often desirable to |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1048 | * only pick from data that can be represented as a stream. This is |
| 1049 | * accomplished by requiring the {@link #CATEGORY_OPENABLE} in the Intent. |
| 1050 | * <p> |
Dianne Hackborn | c4d0e6f | 2011-01-25 14:55:06 -0800 | [diff] [blame] | 1051 | * Callers can optionally specify {@link #EXTRA_LOCAL_ONLY} to request that |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 1052 | * the launched content chooser only returns results representing data that |
Dianne Hackborn | c4d0e6f | 2011-01-25 14:55:06 -0800 | [diff] [blame] | 1053 | * is locally available on the device. For example, if this extra is set |
| 1054 | * to true then an image picker should not show any pictures that are available |
| 1055 | * from a remote server but not already on the local device (thus requiring |
| 1056 | * they be downloaded when opened). |
| 1057 | * <p> |
Dianne Hackborn | fdb3f09 | 2013-01-28 15:10:48 -0800 | [diff] [blame] | 1058 | * If the caller can handle multiple returned items (the user performing |
| 1059 | * multiple selection), then it can specify {@link #EXTRA_ALLOW_MULTIPLE} |
| 1060 | * to indicate this. |
| 1061 | * <p> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1062 | * Input: {@link #getType} is the desired MIME type to retrieve. Note |
| 1063 | * that no URI is supplied in the intent, as there are no constraints on |
| 1064 | * where the returned data originally comes from. You may also include the |
| 1065 | * {@link #CATEGORY_OPENABLE} if you can only accept data that can be |
Dianne Hackborn | c4d0e6f | 2011-01-25 14:55:06 -0800 | [diff] [blame] | 1066 | * opened as a stream. You may use {@link #EXTRA_LOCAL_ONLY} to limit content |
Dianne Hackborn | fdb3f09 | 2013-01-28 15:10:48 -0800 | [diff] [blame] | 1067 | * selection to local data. You may use {@link #EXTRA_ALLOW_MULTIPLE} to |
| 1068 | * allow the user to select multiple items. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1069 | * <p> |
| 1070 | * Output: The URI of the item that was picked. This must be a content: |
| 1071 | * URI so that any receiver can access it. |
| 1072 | */ |
| 1073 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1074 | public static final String ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT"; |
| 1075 | /** |
| 1076 | * Activity Action: Dial a number as specified by the data. This shows a |
| 1077 | * UI with the number being dialed, allowing the user to explicitly |
| 1078 | * initiate the call. |
| 1079 | * <p>Input: If nothing, an empty dialer is started; else {@link #getData} |
| 1080 | * is URI of a phone number to be dialed or a tel: URI of an explicit phone |
| 1081 | * number. |
| 1082 | * <p>Output: nothing. |
| 1083 | */ |
| 1084 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1085 | public static final String ACTION_DIAL = "android.intent.action.DIAL"; |
| 1086 | /** |
| 1087 | * Activity Action: Perform a call to someone specified by the data. |
| 1088 | * <p>Input: If nothing, an empty dialer is started; else {@link #getData} |
| 1089 | * is URI of a phone number to be dialed or a tel: URI of an explicit phone |
| 1090 | * number. |
| 1091 | * <p>Output: nothing. |
| 1092 | * |
| 1093 | * <p>Note: there will be restrictions on which applications can initiate a |
| 1094 | * call; most applications should use the {@link #ACTION_DIAL}. |
| 1095 | * <p>Note: this Intent <strong>cannot</strong> be used to call emergency |
| 1096 | * numbers. Applications can <strong>dial</strong> emergency numbers using |
| 1097 | * {@link #ACTION_DIAL}, however. |
Svetoslav | 7008b51 | 2015-06-24 18:47:07 -0700 | [diff] [blame] | 1098 | * |
Dianne Hackborn | 0e3de6c | 2015-07-29 15:20:21 -0700 | [diff] [blame] | 1099 | * <p>Note: if you app targets {@link android.os.Build.VERSION_CODES#M M} |
Svetoslav | 7008b51 | 2015-06-24 18:47:07 -0700 | [diff] [blame] | 1100 | * and above and declares as using the {@link android.Manifest.permission#CALL_PHONE} |
Svet Ganov | 7121e18 | 2015-07-13 22:38:12 -0700 | [diff] [blame] | 1101 | * permission which is not granted, then attempting to use this action will |
Svetoslav | 7008b51 | 2015-06-24 18:47:07 -0700 | [diff] [blame] | 1102 | * result in a {@link java.lang.SecurityException}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1103 | */ |
| 1104 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1105 | public static final String ACTION_CALL = "android.intent.action.CALL"; |
| 1106 | /** |
| 1107 | * Activity Action: Perform a call to an emergency number specified by the |
| 1108 | * data. |
| 1109 | * <p>Input: {@link #getData} is URI of a phone number to be dialed or a |
| 1110 | * tel: URI of an explicit phone number. |
| 1111 | * <p>Output: nothing. |
| 1112 | * @hide |
| 1113 | */ |
Brad Ebinger | 7a8d352 | 2017-03-31 10:21:09 -0700 | [diff] [blame] | 1114 | @SystemApi |
| 1115 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1116 | public static final String ACTION_CALL_EMERGENCY = "android.intent.action.CALL_EMERGENCY"; |
| 1117 | /** |
| 1118 | * Activity action: Perform a call to any number (emergency or not) |
| 1119 | * specified by the data. |
| 1120 | * <p>Input: {@link #getData} is URI of a phone number to be dialed or a |
| 1121 | * tel: URI of an explicit phone number. |
| 1122 | * <p>Output: nothing. |
| 1123 | * @hide |
| 1124 | */ |
Brad Ebinger | 7a8d352 | 2017-03-31 10:21:09 -0700 | [diff] [blame] | 1125 | @SystemApi |
| 1126 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1127 | public static final String ACTION_CALL_PRIVILEGED = "android.intent.action.CALL_PRIVILEGED"; |
fionaxu | 77a744c | 2017-03-17 14:35:39 -0700 | [diff] [blame] | 1128 | |
Santos Cordon | 15a1378 | 2015-03-31 18:32:31 -0700 | [diff] [blame] | 1129 | /** |
fionaxu | adfe700 | 2017-02-17 17:20:46 -0800 | [diff] [blame] | 1130 | * Activity Action: Main entry point for carrier setup apps. |
| 1131 | * <p>Carrier apps that provide an implementation for this action may be invoked to configure |
| 1132 | * carrier service and typically require |
| 1133 | * {@link android.telephony.TelephonyManager#hasCarrierPrivileges() carrier privileges} to |
| 1134 | * fulfill their duties. |
| 1135 | */ |
| 1136 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1137 | public static final String ACTION_CARRIER_SETUP = "android.intent.action.CARRIER_SETUP"; |
| 1138 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1139 | * Activity Action: Send a message to someone specified by the data. |
| 1140 | * <p>Input: {@link #getData} is URI describing the target. |
| 1141 | * <p>Output: nothing. |
| 1142 | */ |
| 1143 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1144 | public static final String ACTION_SENDTO = "android.intent.action.SENDTO"; |
| 1145 | /** |
| 1146 | * Activity Action: Deliver some data to someone else. Who the data is |
| 1147 | * being delivered to is not specified; it is up to the receiver of this |
| 1148 | * action to ask the user where the data should be sent. |
| 1149 | * <p> |
| 1150 | * When launching a SEND intent, you should usually wrap it in a chooser |
| 1151 | * (through {@link #createChooser}), which will give the proper interface |
| 1152 | * for the user to pick how to send your data and allow you to specify |
| 1153 | * a prompt indicating what they are doing. |
| 1154 | * <p> |
| 1155 | * Input: {@link #getType} is the MIME type of the data being sent. |
| 1156 | * get*Extra can have either a {@link #EXTRA_TEXT} |
| 1157 | * or {@link #EXTRA_STREAM} field, containing the data to be sent. If |
| 1158 | * using EXTRA_TEXT, the MIME type should be "text/plain"; otherwise it |
| 1159 | * should be the MIME type of the data in EXTRA_STREAM. Use {@literal *}/* |
| 1160 | * if the MIME type is unknown (this will only allow senders that can |
Dianne Hackborn | acb69bb | 2012-04-13 15:36:06 -0700 | [diff] [blame] | 1161 | * handle generic data streams). If using {@link #EXTRA_TEXT}, you can |
| 1162 | * also optionally supply {@link #EXTRA_HTML_TEXT} for clients to retrieve |
| 1163 | * your text with HTML formatting. |
| 1164 | * <p> |
| 1165 | * As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, the data |
| 1166 | * being sent can be supplied through {@link #setClipData(ClipData)}. This |
| 1167 | * allows you to use {@link #FLAG_GRANT_READ_URI_PERMISSION} when sharing |
| 1168 | * content: URIs and other advanced features of {@link ClipData}. If |
| 1169 | * using this approach, you still must supply the same data through the |
| 1170 | * {@link #EXTRA_TEXT} or {@link #EXTRA_STREAM} fields described below |
| 1171 | * for compatibility with old applications. If you don't set a ClipData, |
| 1172 | * it will be copied there for you when calling {@link Context#startActivity(Intent)}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1173 | * <p> |
Tomasz Mikolajewski | d8a2e19 | 2016-12-15 16:10:46 +0900 | [diff] [blame] | 1174 | * Starting from {@link android.os.Build.VERSION_CODES#O}, if |
| 1175 | * {@link #CATEGORY_TYPED_OPENABLE} is passed, then the Uris passed in |
| 1176 | * either {@link #EXTRA_STREAM} or via {@link #setClipData(ClipData)} may |
| 1177 | * be openable only as asset typed files using |
| 1178 | * {@link ContentResolver#openTypedAssetFileDescriptor(Uri, String, Bundle)}. |
| 1179 | * <p> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1180 | * Optional standard extras, which may be interpreted by some recipients as |
| 1181 | * appropriate, are: {@link #EXTRA_EMAIL}, {@link #EXTRA_CC}, |
| 1182 | * {@link #EXTRA_BCC}, {@link #EXTRA_SUBJECT}. |
| 1183 | * <p> |
| 1184 | * Output: nothing. |
| 1185 | */ |
| 1186 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1187 | public static final String ACTION_SEND = "android.intent.action.SEND"; |
| 1188 | /** |
Wu-cheng Li | 649f99e | 2009-06-17 14:29:57 +0800 | [diff] [blame] | 1189 | * Activity Action: Deliver multiple data to someone else. |
| 1190 | * <p> |
Dianne Hackborn | acb69bb | 2012-04-13 15:36:06 -0700 | [diff] [blame] | 1191 | * Like {@link #ACTION_SEND}, except the data is multiple. |
Wu-cheng Li | 649f99e | 2009-06-17 14:29:57 +0800 | [diff] [blame] | 1192 | * <p> |
| 1193 | * Input: {@link #getType} is the MIME type of the data being sent. |
| 1194 | * get*ArrayListExtra can have either a {@link #EXTRA_TEXT} or {@link |
Dianne Hackborn | acb69bb | 2012-04-13 15:36:06 -0700 | [diff] [blame] | 1195 | * #EXTRA_STREAM} field, containing the data to be sent. If using |
| 1196 | * {@link #EXTRA_TEXT}, you can also optionally supply {@link #EXTRA_HTML_TEXT} |
| 1197 | * for clients to retrieve your text with HTML formatting. |
Wu-cheng Li | 649f99e | 2009-06-17 14:29:57 +0800 | [diff] [blame] | 1198 | * <p> |
Chih-Chung Chang | 5962d27 | 2009-09-04 14:36:01 +0800 | [diff] [blame] | 1199 | * Multiple types are supported, and receivers should handle mixed types |
| 1200 | * whenever possible. The right way for the receiver to check them is to |
| 1201 | * use the content resolver on each URI. The intent sender should try to |
| 1202 | * put the most concrete mime type in the intent type, but it can fall |
| 1203 | * back to {@literal <type>/*} or {@literal *}/* as needed. |
| 1204 | * <p> |
| 1205 | * e.g. if you are sending image/jpg and image/jpg, the intent's type can |
| 1206 | * be image/jpg, but if you are sending image/jpg and image/png, then the |
| 1207 | * intent's type should be image/*. |
| 1208 | * <p> |
Dianne Hackborn | acb69bb | 2012-04-13 15:36:06 -0700 | [diff] [blame] | 1209 | * As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, the data |
| 1210 | * being sent can be supplied through {@link #setClipData(ClipData)}. This |
| 1211 | * allows you to use {@link #FLAG_GRANT_READ_URI_PERMISSION} when sharing |
| 1212 | * content: URIs and other advanced features of {@link ClipData}. If |
| 1213 | * using this approach, you still must supply the same data through the |
| 1214 | * {@link #EXTRA_TEXT} or {@link #EXTRA_STREAM} fields described below |
| 1215 | * for compatibility with old applications. If you don't set a ClipData, |
| 1216 | * it will be copied there for you when calling {@link Context#startActivity(Intent)}. |
| 1217 | * <p> |
Tomasz Mikolajewski | d8a2e19 | 2016-12-15 16:10:46 +0900 | [diff] [blame] | 1218 | * Starting from {@link android.os.Build.VERSION_CODES#O}, if |
| 1219 | * {@link #CATEGORY_TYPED_OPENABLE} is passed, then the Uris passed in |
| 1220 | * either {@link #EXTRA_STREAM} or via {@link #setClipData(ClipData)} may |
| 1221 | * be openable only as asset typed files using |
| 1222 | * {@link ContentResolver#openTypedAssetFileDescriptor(Uri, String, Bundle)}. |
| 1223 | * <p> |
Wu-cheng Li | 649f99e | 2009-06-17 14:29:57 +0800 | [diff] [blame] | 1224 | * Optional standard extras, which may be interpreted by some recipients as |
| 1225 | * appropriate, are: {@link #EXTRA_EMAIL}, {@link #EXTRA_CC}, |
| 1226 | * {@link #EXTRA_BCC}, {@link #EXTRA_SUBJECT}. |
| 1227 | * <p> |
| 1228 | * Output: nothing. |
| 1229 | */ |
| 1230 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1231 | public static final String ACTION_SEND_MULTIPLE = "android.intent.action.SEND_MULTIPLE"; |
| 1232 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1233 | * Activity Action: Handle an incoming phone call. |
| 1234 | * <p>Input: nothing. |
| 1235 | * <p>Output: nothing. |
| 1236 | */ |
| 1237 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1238 | public static final String ACTION_ANSWER = "android.intent.action.ANSWER"; |
| 1239 | /** |
| 1240 | * Activity Action: Insert an empty item into the given container. |
| 1241 | * <p>Input: {@link #getData} is URI of the directory (vnd.android.cursor.dir/*) |
| 1242 | * in which to place the data. |
| 1243 | * <p>Output: URI of the new data that was created. |
| 1244 | */ |
| 1245 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1246 | public static final String ACTION_INSERT = "android.intent.action.INSERT"; |
| 1247 | /** |
Dianne Hackborn | 23fdaf6 | 2010-08-06 12:16:55 -0700 | [diff] [blame] | 1248 | * Activity Action: Create a new item in the given container, initializing it |
| 1249 | * from the current contents of the clipboard. |
| 1250 | * <p>Input: {@link #getData} is URI of the directory (vnd.android.cursor.dir/*) |
| 1251 | * in which to place the data. |
| 1252 | * <p>Output: URI of the new data that was created. |
| 1253 | */ |
| 1254 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1255 | public static final String ACTION_PASTE = "android.intent.action.PASTE"; |
| 1256 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1257 | * Activity Action: Delete the given data from its container. |
| 1258 | * <p>Input: {@link #getData} is URI of data to be deleted. |
| 1259 | * <p>Output: nothing. |
| 1260 | */ |
| 1261 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1262 | public static final String ACTION_DELETE = "android.intent.action.DELETE"; |
| 1263 | /** |
| 1264 | * Activity Action: Run the data, whatever that means. |
| 1265 | * <p>Input: ? (Note: this is currently specific to the test harness.) |
| 1266 | * <p>Output: nothing. |
| 1267 | */ |
| 1268 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1269 | public static final String ACTION_RUN = "android.intent.action.RUN"; |
| 1270 | /** |
| 1271 | * Activity Action: Perform a data synchronization. |
| 1272 | * <p>Input: ? |
| 1273 | * <p>Output: ? |
| 1274 | */ |
| 1275 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1276 | public static final String ACTION_SYNC = "android.intent.action.SYNC"; |
| 1277 | /** |
| 1278 | * Activity Action: Pick an activity given an intent, returning the class |
| 1279 | * selected. |
| 1280 | * <p>Input: get*Extra field {@link #EXTRA_INTENT} is an Intent |
| 1281 | * used with {@link PackageManager#queryIntentActivities} to determine the |
| 1282 | * set of activities from which to pick. |
| 1283 | * <p>Output: Class name of the activity that was selected. |
| 1284 | */ |
| 1285 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1286 | public static final String ACTION_PICK_ACTIVITY = "android.intent.action.PICK_ACTIVITY"; |
| 1287 | /** |
| 1288 | * Activity Action: Perform a search. |
| 1289 | * <p>Input: {@link android.app.SearchManager#QUERY getStringExtra(SearchManager.QUERY)} |
| 1290 | * is the text to search for. If empty, simply |
| 1291 | * enter your search results Activity with the search UI activated. |
| 1292 | * <p>Output: nothing. |
| 1293 | */ |
| 1294 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1295 | public static final String ACTION_SEARCH = "android.intent.action.SEARCH"; |
| 1296 | /** |
Jim Miller | 7e4ad35 | 2009-03-25 18:16:41 -0700 | [diff] [blame] | 1297 | * Activity Action: Start the platform-defined tutorial |
| 1298 | * <p>Input: {@link android.app.SearchManager#QUERY getStringExtra(SearchManager.QUERY)} |
| 1299 | * is the text to search for. If empty, simply |
| 1300 | * enter your search results Activity with the search UI activated. |
| 1301 | * <p>Output: nothing. |
| 1302 | */ |
| 1303 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1304 | public static final String ACTION_SYSTEM_TUTORIAL = "android.intent.action.SYSTEM_TUTORIAL"; |
| 1305 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1306 | * Activity Action: Perform a web search. |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 1307 | * <p> |
| 1308 | * Input: {@link android.app.SearchManager#QUERY |
| 1309 | * getStringExtra(SearchManager.QUERY)} is the text to search for. If it is |
| 1310 | * a url starts with http or https, the site will be opened. If it is plain |
| 1311 | * text, Google search will be applied. |
| 1312 | * <p> |
| 1313 | * Output: nothing. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1314 | */ |
| 1315 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1316 | public static final String ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH"; |
Dianne Hackborn | f9c5e0f | 2013-01-23 14:39:13 -0800 | [diff] [blame] | 1317 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1318 | /** |
Jim Miller | 0799440 | 2012-05-02 14:22:27 -0700 | [diff] [blame] | 1319 | * Activity Action: Perform assist action. |
| 1320 | * <p> |
Adam Skory | 7140a25 | 2013-09-11 12:04:58 +0100 | [diff] [blame] | 1321 | * Input: {@link #EXTRA_ASSIST_PACKAGE}, {@link #EXTRA_ASSIST_CONTEXT}, can provide |
| 1322 | * additional optional contextual information about where the user was when they |
Dianne Hackborn | a3acdb3 | 2015-06-08 17:07:40 -0700 | [diff] [blame] | 1323 | * requested the assist; {@link #EXTRA_REFERRER} may be set with additional referrer |
| 1324 | * information. |
Jim Miller | 0799440 | 2012-05-02 14:22:27 -0700 | [diff] [blame] | 1325 | * Output: nothing. |
| 1326 | */ |
| 1327 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1328 | public static final String ACTION_ASSIST = "android.intent.action.ASSIST"; |
Dianne Hackborn | f9c5e0f | 2013-01-23 14:39:13 -0800 | [diff] [blame] | 1329 | |
| 1330 | /** |
Bjorn Bringert | bc08686 | 2013-03-01 12:59:24 +0000 | [diff] [blame] | 1331 | * Activity Action: Perform voice assist action. |
| 1332 | * <p> |
Adam Skory | 7140a25 | 2013-09-11 12:04:58 +0100 | [diff] [blame] | 1333 | * Input: {@link #EXTRA_ASSIST_PACKAGE}, {@link #EXTRA_ASSIST_CONTEXT}, can provide |
| 1334 | * additional optional contextual information about where the user was when they |
Adam Skory | dfc7fd7 | 2013-08-05 19:23:41 -0700 | [diff] [blame] | 1335 | * requested the voice assist. |
Bjorn Bringert | bc08686 | 2013-03-01 12:59:24 +0000 | [diff] [blame] | 1336 | * Output: nothing. |
Adam Skory | 7140a25 | 2013-09-11 12:04:58 +0100 | [diff] [blame] | 1337 | * @hide |
Bjorn Bringert | bc08686 | 2013-03-01 12:59:24 +0000 | [diff] [blame] | 1338 | */ |
Amith Yamasani | 1645203 | 2017-03-03 10:15:57 -0800 | [diff] [blame] | 1339 | @SystemApi |
Bjorn Bringert | bc08686 | 2013-03-01 12:59:24 +0000 | [diff] [blame] | 1340 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1341 | public static final String ACTION_VOICE_ASSIST = "android.intent.action.VOICE_ASSIST"; |
| 1342 | |
| 1343 | /** |
Adam Skory | 7140a25 | 2013-09-11 12:04:58 +0100 | [diff] [blame] | 1344 | * An optional field on {@link #ACTION_ASSIST} containing the name of the current foreground |
| 1345 | * application package at the time the assist was invoked. |
Dianne Hackborn | f9c5e0f | 2013-01-23 14:39:13 -0800 | [diff] [blame] | 1346 | */ |
| 1347 | public static final String EXTRA_ASSIST_PACKAGE |
| 1348 | = "android.intent.extra.ASSIST_PACKAGE"; |
| 1349 | |
| 1350 | /** |
Dianne Hackborn | a83ce1d | 2015-03-11 15:16:13 -0700 | [diff] [blame] | 1351 | * An optional field on {@link #ACTION_ASSIST} containing the uid of the current foreground |
| 1352 | * application package at the time the assist was invoked. |
| 1353 | */ |
| 1354 | public static final String EXTRA_ASSIST_UID |
| 1355 | = "android.intent.extra.ASSIST_UID"; |
| 1356 | |
| 1357 | /** |
Adam Skory | 7140a25 | 2013-09-11 12:04:58 +0100 | [diff] [blame] | 1358 | * An optional field on {@link #ACTION_ASSIST} and containing additional contextual |
| 1359 | * information supplied by the current foreground app at the time of the assist request. |
| 1360 | * This is a {@link Bundle} of additional data. |
Dianne Hackborn | f9c5e0f | 2013-01-23 14:39:13 -0800 | [diff] [blame] | 1361 | */ |
| 1362 | public static final String EXTRA_ASSIST_CONTEXT |
| 1363 | = "android.intent.extra.ASSIST_CONTEXT"; |
| 1364 | |
Jim Miller | 0799440 | 2012-05-02 14:22:27 -0700 | [diff] [blame] | 1365 | /** |
Michael Wright | 8ab940a | 2014-09-01 11:01:27 -0700 | [diff] [blame] | 1366 | * An optional field on {@link #ACTION_ASSIST} suggesting that the user will likely use a |
| 1367 | * keyboard as the primary input device for assistance. |
| 1368 | */ |
| 1369 | public static final String EXTRA_ASSIST_INPUT_HINT_KEYBOARD = |
| 1370 | "android.intent.extra.ASSIST_INPUT_HINT_KEYBOARD"; |
| 1371 | |
| 1372 | /** |
Tim Kilbourn | 0e5f110 | 2015-06-05 16:18:09 -0700 | [diff] [blame] | 1373 | * An optional field on {@link #ACTION_ASSIST} containing the InputDevice id |
| 1374 | * that was used to invoke the assist. |
| 1375 | */ |
| 1376 | public static final String EXTRA_ASSIST_INPUT_DEVICE_ID = |
| 1377 | "android.intent.extra.ASSIST_INPUT_DEVICE_ID"; |
| 1378 | |
| 1379 | /** |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 1380 | * Activity Action: List all available applications. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1381 | * <p>Input: Nothing. |
| 1382 | * <p>Output: nothing. |
| 1383 | */ |
| 1384 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1385 | public static final String ACTION_ALL_APPS = "android.intent.action.ALL_APPS"; |
| 1386 | /** |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 1387 | * Activity Action: Show settings for choosing wallpaper. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1388 | * <p>Input: Nothing. |
| 1389 | * <p>Output: Nothing. |
| 1390 | */ |
| 1391 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1392 | public static final String ACTION_SET_WALLPAPER = "android.intent.action.SET_WALLPAPER"; |
| 1393 | |
| 1394 | /** |
| 1395 | * Activity Action: Show activity for reporting a bug. |
| 1396 | * <p>Input: Nothing. |
| 1397 | * <p>Output: Nothing. |
| 1398 | */ |
| 1399 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1400 | public static final String ACTION_BUG_REPORT = "android.intent.action.BUG_REPORT"; |
| 1401 | |
| 1402 | /** |
| 1403 | * Activity Action: Main entry point for factory tests. Only used when |
| 1404 | * the device is booting in factory test node. The implementing package |
| 1405 | * must be installed in the system image. |
| 1406 | * <p>Input: nothing |
| 1407 | * <p>Output: nothing |
| 1408 | */ |
Jeff Sharkey | 0f3f60b | 2017-04-24 18:06:20 -0600 | [diff] [blame] | 1409 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1410 | public static final String ACTION_FACTORY_TEST = "android.intent.action.FACTORY_TEST"; |
| 1411 | |
| 1412 | /** |
| 1413 | * Activity Action: The user pressed the "call" button to go to the dialer |
| 1414 | * or other appropriate UI for placing a call. |
| 1415 | * <p>Input: Nothing. |
| 1416 | * <p>Output: Nothing. |
| 1417 | */ |
| 1418 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1419 | public static final String ACTION_CALL_BUTTON = "android.intent.action.CALL_BUTTON"; |
| 1420 | |
| 1421 | /** |
| 1422 | * Activity Action: Start Voice Command. |
| 1423 | * <p>Input: Nothing. |
| 1424 | * <p>Output: Nothing. |
Christopher Tate | 72da1e6 | 2018-05-10 13:09:48 -0700 | [diff] [blame] | 1425 | * <p class="note"> |
| 1426 | * In some cases, a matching Activity may not exist, so ensure you |
| 1427 | * safeguard against this. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1428 | */ |
| 1429 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1430 | public static final String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND"; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 1431 | |
| 1432 | /** |
| 1433 | * Activity Action: Start action associated with long pressing on the |
| 1434 | * search key. |
| 1435 | * <p>Input: Nothing. |
| 1436 | * <p>Output: Nothing. |
| 1437 | */ |
| 1438 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1439 | public static final String ACTION_SEARCH_LONG_PRESS = "android.intent.action.SEARCH_LONG_PRESS"; |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 1440 | |
Jacek Surazski | 86b6c53 | 2009-05-13 14:38:28 +0200 | [diff] [blame] | 1441 | /** |
| 1442 | * Activity Action: The user pressed the "Report" button in the crash/ANR dialog. |
| 1443 | * This intent is delivered to the package which installed the application, usually |
Dirk Dougherty | 4d7bc655 | 2012-01-27 17:56:49 -0800 | [diff] [blame] | 1444 | * Google Play. |
Jacek Surazski | 86b6c53 | 2009-05-13 14:38:28 +0200 | [diff] [blame] | 1445 | * <p>Input: No data is specified. The bug report is passed in using |
| 1446 | * an {@link #EXTRA_BUG_REPORT} field. |
| 1447 | * <p>Output: Nothing. |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1448 | * |
| 1449 | * @see #EXTRA_BUG_REPORT |
Jacek Surazski | 86b6c53 | 2009-05-13 14:38:28 +0200 | [diff] [blame] | 1450 | */ |
| 1451 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1452 | public static final String ACTION_APP_ERROR = "android.intent.action.APP_ERROR"; |
Dianne Hackborn | 3d74bb4 | 2009-06-19 10:35:21 -0700 | [diff] [blame] | 1453 | |
| 1454 | /** |
| 1455 | * Activity Action: Show power usage information to the user. |
| 1456 | * <p>Input: Nothing. |
| 1457 | * <p>Output: Nothing. |
| 1458 | */ |
| 1459 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1460 | public static final String ACTION_POWER_USAGE_SUMMARY = "android.intent.action.POWER_USAGE_SUMMARY"; |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 1461 | |
Dianne Hackborn | d7cd29d | 2009-07-01 11:22:45 -0700 | [diff] [blame] | 1462 | /** |
Russell Brenner | 4cd32e5 | 2017-02-24 11:11:47 -0800 | [diff] [blame] | 1463 | * Activity Action: Setup wizard action provided for OTA provisioning to determine if it needs |
| 1464 | * to run. |
| 1465 | * <p>Input: Nothing. |
| 1466 | * <p>Output: Nothing. |
| 1467 | * @deprecated As of {@link android.os.Build.VERSION_CODES#M}, setup wizard can be identified |
| 1468 | * using {@link #ACTION_MAIN} and {@link #CATEGORY_SETUP_WIZARD} |
| 1469 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 1470 | * @removed |
Russell Brenner | 4cd32e5 | 2017-02-24 11:11:47 -0800 | [diff] [blame] | 1471 | */ |
| 1472 | @Deprecated |
| 1473 | @SystemApi |
| 1474 | public static final String ACTION_DEVICE_INITIALIZATION_WIZARD = |
| 1475 | "android.intent.action.DEVICE_INITIALIZATION_WIZARD"; |
| 1476 | |
| 1477 | /** |
Dianne Hackborn | d7cd29d | 2009-07-01 11:22:45 -0700 | [diff] [blame] | 1478 | * Activity Action: Setup wizard to launch after a platform update. This |
| 1479 | * activity should have a string meta-data field associated with it, |
| 1480 | * {@link #METADATA_SETUP_VERSION}, which defines the current version of |
| 1481 | * the platform for setup. The activity will be launched only if |
| 1482 | * {@link android.provider.Settings.Secure#LAST_SETUP_SHOWN} is not the |
| 1483 | * same value. |
| 1484 | * <p>Input: Nothing. |
| 1485 | * <p>Output: Nothing. |
| 1486 | * @hide |
| 1487 | */ |
Russell Brenner | 4cd32e5 | 2017-02-24 11:11:47 -0800 | [diff] [blame] | 1488 | @SystemApi |
Dianne Hackborn | d7cd29d | 2009-07-01 11:22:45 -0700 | [diff] [blame] | 1489 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1490 | public static final String ACTION_UPGRADE_SETUP = "android.intent.action.UPGRADE_SETUP"; |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 1491 | |
Dianne Hackborn | d7cd29d | 2009-07-01 11:22:45 -0700 | [diff] [blame] | 1492 | /** |
Clara Bayarri | eb3c2d3 | 2016-04-01 14:37:32 +0100 | [diff] [blame] | 1493 | * Activity Action: Start the Keyboard Shortcuts Helper screen. |
| 1494 | * <p>Input: Nothing. |
| 1495 | * <p>Output: Nothing. |
| 1496 | * @hide |
| 1497 | */ |
| 1498 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1499 | public static final String ACTION_SHOW_KEYBOARD_SHORTCUTS = |
Clara Bayarri | 847d868 | 2017-03-06 16:48:44 +0000 | [diff] [blame] | 1500 | "com.android.intent.action.SHOW_KEYBOARD_SHORTCUTS"; |
Clara Bayarri | eb3c2d3 | 2016-04-01 14:37:32 +0100 | [diff] [blame] | 1501 | |
| 1502 | /** |
Andrei Stingaceanu | 0bf096f | 2016-04-14 18:11:57 +0100 | [diff] [blame] | 1503 | * Activity Action: Dismiss the Keyboard Shortcuts Helper screen. |
| 1504 | * <p>Input: Nothing. |
| 1505 | * <p>Output: Nothing. |
| 1506 | * @hide |
| 1507 | */ |
| 1508 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1509 | public static final String ACTION_DISMISS_KEYBOARD_SHORTCUTS = |
Clara Bayarri | 847d868 | 2017-03-06 16:48:44 +0000 | [diff] [blame] | 1510 | "com.android.intent.action.DISMISS_KEYBOARD_SHORTCUTS"; |
Andrei Stingaceanu | 0bf096f | 2016-04-14 18:11:57 +0100 | [diff] [blame] | 1511 | |
| 1512 | /** |
Jeff Sharkey | 7f86827 | 2011-06-05 16:05:02 -0700 | [diff] [blame] | 1513 | * Activity Action: Show settings for managing network data usage of a |
| 1514 | * specific application. Applications should define an activity that offers |
| 1515 | * options to control data usage. |
| 1516 | */ |
| 1517 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1518 | public static final String ACTION_MANAGE_NETWORK_USAGE = |
| 1519 | "android.intent.action.MANAGE_NETWORK_USAGE"; |
| 1520 | |
| 1521 | /** |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1522 | * Activity Action: Launch application installer. |
| 1523 | * <p> |
Todd Kennedy | 9cc589a | 2016-08-18 16:23:17 -0700 | [diff] [blame] | 1524 | * Input: The data must be a content: URI at which the application |
Dianne Hackborn | eba784ff | 2012-09-19 12:42:37 -0700 | [diff] [blame] | 1525 | * can be retrieved. As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}, |
| 1526 | * you can also use "package:<package-name>" to install an application for the |
| 1527 | * current user that is already installed for another user. You can optionally supply |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1528 | * {@link #EXTRA_INSTALLER_PACKAGE_NAME}, {@link #EXTRA_NOT_UNKNOWN_SOURCE}, |
| 1529 | * {@link #EXTRA_ALLOW_REPLACE}, and {@link #EXTRA_RETURN_RESULT}. |
| 1530 | * <p> |
| 1531 | * Output: If {@link #EXTRA_RETURN_RESULT}, returns whether the install |
| 1532 | * succeeded. |
Svet Ganov | 86877e4 | 2015-05-28 08:19:48 -0700 | [diff] [blame] | 1533 | * <p> |
Suprabh Shukla | 54a10e6 | 2017-04-14 18:17:23 -0700 | [diff] [blame] | 1534 | * <strong>Note:</strong>If your app is targeting API level higher than 25 you |
Svet Ganov | 86877e4 | 2015-05-28 08:19:48 -0700 | [diff] [blame] | 1535 | * need to hold {@link android.Manifest.permission#REQUEST_INSTALL_PACKAGES} |
| 1536 | * in order to launch the application installer. |
| 1537 | * </p> |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1538 | * |
| 1539 | * @see #EXTRA_INSTALLER_PACKAGE_NAME |
| 1540 | * @see #EXTRA_NOT_UNKNOWN_SOURCE |
| 1541 | * @see #EXTRA_RETURN_RESULT |
Philip P. Moltmann | fe46010 | 2018-09-25 10:22:32 -0700 | [diff] [blame] | 1542 | * |
| 1543 | * @deprecated use {@link android.content.pm.PackageInstaller} instead |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1544 | */ |
Philip P. Moltmann | fe46010 | 2018-09-25 10:22:32 -0700 | [diff] [blame] | 1545 | @Deprecated |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1546 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1547 | public static final String ACTION_INSTALL_PACKAGE = "android.intent.action.INSTALL_PACKAGE"; |
| 1548 | |
| 1549 | /** |
Todd Kennedy | d0084f7 | 2017-07-28 13:56:14 -0700 | [diff] [blame] | 1550 | * Activity Action: Activity to handle split installation failures. |
| 1551 | * <p>Splits may be installed dynamically. This happens when an Activity is launched, |
| 1552 | * but the split that contains the application isn't installed. When a split is |
| 1553 | * installed in this manner, the containing package usually doesn't know this is |
| 1554 | * happening. However, if an error occurs during installation, the containing |
| 1555 | * package can define a single activity handling this action to deal with such |
| 1556 | * failures. |
| 1557 | * <p>The activity handling this action must be in the base package. |
| 1558 | * <p> |
| 1559 | * Input: {@link #EXTRA_INTENT} the original intent that started split installation. |
| 1560 | * {@link #EXTRA_SPLIT_NAME} the name of the split that failed to be installed. |
| 1561 | */ |
| 1562 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1563 | public static final String ACTION_INSTALL_FAILURE = "android.intent.action.INSTALL_FAILURE"; |
| 1564 | |
| 1565 | /** |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1566 | * Activity Action: Launch instant application installer. |
Todd Kennedy | b8a279e | 2015-11-18 09:59:47 -0800 | [diff] [blame] | 1567 | * <p class="note"> |
| 1568 | * This is a protected intent that can only be sent by the system. |
| 1569 | * </p> |
| 1570 | * |
| 1571 | * @hide |
| 1572 | */ |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1573 | @SystemApi |
Todd Kennedy | b8a279e | 2015-11-18 09:59:47 -0800 | [diff] [blame] | 1574 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1575 | public static final String ACTION_INSTALL_INSTANT_APP_PACKAGE |
| 1576 | = "android.intent.action.INSTALL_INSTANT_APP_PACKAGE"; |
Todd Kennedy | b8a279e | 2015-11-18 09:59:47 -0800 | [diff] [blame] | 1577 | |
| 1578 | /** |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1579 | * Service Action: Resolve instant application. |
Todd Kennedy | b8a279e | 2015-11-18 09:59:47 -0800 | [diff] [blame] | 1580 | * <p> |
| 1581 | * The system will have a persistent connection to this service. |
| 1582 | * This is a protected intent that can only be sent by the system. |
| 1583 | * </p> |
| 1584 | * |
| 1585 | * @hide |
| 1586 | */ |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1587 | @SystemApi |
Todd Kennedy | b8a279e | 2015-11-18 09:59:47 -0800 | [diff] [blame] | 1588 | @SdkConstant(SdkConstantType.SERVICE_ACTION) |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1589 | public static final String ACTION_RESOLVE_INSTANT_APP_PACKAGE |
| 1590 | = "android.intent.action.RESOLVE_INSTANT_APP_PACKAGE"; |
Todd Kennedy | b8a279e | 2015-11-18 09:59:47 -0800 | [diff] [blame] | 1591 | |
| 1592 | /** |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1593 | * Activity Action: Launch instant app settings. |
Chad Brubaker | 336ae5b | 2017-03-24 15:53:09 -0700 | [diff] [blame] | 1594 | * |
| 1595 | * <p class="note"> |
| 1596 | * This is a protected intent that can only be sent by the system. |
| 1597 | * </p> |
| 1598 | * |
| 1599 | * @hide |
| 1600 | */ |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1601 | @SystemApi |
Chad Brubaker | 336ae5b | 2017-03-24 15:53:09 -0700 | [diff] [blame] | 1602 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1603 | public static final String ACTION_INSTANT_APP_RESOLVER_SETTINGS |
| 1604 | = "android.intent.action.INSTANT_APP_RESOLVER_SETTINGS"; |
Chad Brubaker | 336ae5b | 2017-03-24 15:53:09 -0700 | [diff] [blame] | 1605 | |
| 1606 | /** |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1607 | * Used as a string extra field with {@link #ACTION_INSTALL_PACKAGE} to install a |
| 1608 | * package. Specifies the installer package name; this package will receive the |
| 1609 | * {@link #ACTION_APP_ERROR} intent. |
| 1610 | */ |
| 1611 | public static final String EXTRA_INSTALLER_PACKAGE_NAME |
| 1612 | = "android.intent.extra.INSTALLER_PACKAGE_NAME"; |
| 1613 | |
| 1614 | /** |
| 1615 | * Used as a boolean extra field with {@link #ACTION_INSTALL_PACKAGE} to install a |
| 1616 | * package. Specifies that the application being installed should not be |
| 1617 | * treated as coming from an unknown source, but as coming from the app |
| 1618 | * invoking the Intent. For this to work you must start the installer with |
| 1619 | * startActivityForResult(). |
| 1620 | */ |
| 1621 | public static final String EXTRA_NOT_UNKNOWN_SOURCE |
| 1622 | = "android.intent.extra.NOT_UNKNOWN_SOURCE"; |
| 1623 | |
| 1624 | /** |
rich cannings | 706e8ba | 2012-08-20 13:20:14 -0700 | [diff] [blame] | 1625 | * Used as a URI extra field with {@link #ACTION_INSTALL_PACKAGE} and |
| 1626 | * {@link #ACTION_VIEW} to indicate the URI from which the local APK in the Intent |
rich cannings | 368ed01 | 2012-06-07 15:37:57 -0700 | [diff] [blame] | 1627 | * data field originated from. |
| 1628 | */ |
rich cannings | 706e8ba | 2012-08-20 13:20:14 -0700 | [diff] [blame] | 1629 | public static final String EXTRA_ORIGINATING_URI |
| 1630 | = "android.intent.extra.ORIGINATING_URI"; |
rich cannings | 368ed01 | 2012-06-07 15:37:57 -0700 | [diff] [blame] | 1631 | |
| 1632 | /** |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 1633 | * This extra can be used with any Intent used to launch an activity, supplying information |
| 1634 | * about who is launching that activity. This field contains a {@link android.net.Uri} |
| 1635 | * object, typically an http: or https: URI of the web site that the referral came from; |
| 1636 | * it can also use the {@link #URI_ANDROID_APP_SCHEME android-app:} scheme to identify |
| 1637 | * a native application that it came from. |
| 1638 | * |
| 1639 | * <p>To retrieve this value in a client, use {@link android.app.Activity#getReferrer} |
| 1640 | * instead of directly retrieving the extra. It is also valid for applications to |
| 1641 | * instead supply {@link #EXTRA_REFERRER_NAME} for cases where they can only create |
| 1642 | * a string, not a Uri; the field here, if supplied, will always take precedence, |
| 1643 | * however.</p> |
| 1644 | * |
| 1645 | * @see #EXTRA_REFERRER_NAME |
rich cannings | 368ed01 | 2012-06-07 15:37:57 -0700 | [diff] [blame] | 1646 | */ |
| 1647 | public static final String EXTRA_REFERRER |
| 1648 | = "android.intent.extra.REFERRER"; |
| 1649 | |
| 1650 | /** |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 1651 | * Alternate version of {@link #EXTRA_REFERRER} that supplies the URI as a String rather |
| 1652 | * than a {@link android.net.Uri} object. Only for use in cases where Uri objects can |
| 1653 | * not be created, in particular when Intent extras are supplied through the |
| 1654 | * {@link #URI_INTENT_SCHEME intent:} or {@link #URI_ANDROID_APP_SCHEME android-app:} |
| 1655 | * schemes. |
| 1656 | * |
| 1657 | * @see #EXTRA_REFERRER |
| 1658 | */ |
| 1659 | public static final String EXTRA_REFERRER_NAME |
| 1660 | = "android.intent.extra.REFERRER_NAME"; |
| 1661 | |
| 1662 | /** |
Ben Gruver | 37d83a3 | 2012-09-27 13:02:06 -0700 | [diff] [blame] | 1663 | * Used as an int extra field with {@link #ACTION_INSTALL_PACKAGE} and |
Gina Dimino | 98ad888 | 2016-05-31 17:25:48 -0700 | [diff] [blame] | 1664 | * {@link #ACTION_VIEW} to indicate the uid of the package that initiated the install |
Suprabh Shukla | 54a10e6 | 2017-04-14 18:17:23 -0700 | [diff] [blame] | 1665 | * Currently only a system app that hosts the provider authority "downloads" or holds the |
| 1666 | * permission {@link android.Manifest.permission.MANAGE_DOCUMENTS} can use this. |
Ben Gruver | 37d83a3 | 2012-09-27 13:02:06 -0700 | [diff] [blame] | 1667 | * @hide |
| 1668 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 1669 | @SystemApi |
Ben Gruver | 37d83a3 | 2012-09-27 13:02:06 -0700 | [diff] [blame] | 1670 | public static final String EXTRA_ORIGINATING_UID |
| 1671 | = "android.intent.extra.ORIGINATING_UID"; |
| 1672 | |
| 1673 | /** |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1674 | * Used as a boolean extra field with {@link #ACTION_INSTALL_PACKAGE} to install a |
| 1675 | * package. Tells the installer UI to skip the confirmation with the user |
| 1676 | * if the .apk is replacing an existing one. |
Dianne Hackborn | 0e128bb | 2012-05-01 14:40:15 -0700 | [diff] [blame] | 1677 | * @deprecated As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, Android |
| 1678 | * will no longer show an interstitial message about updating existing |
| 1679 | * applications so this is no longer needed. |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1680 | */ |
Dianne Hackborn | 0e128bb | 2012-05-01 14:40:15 -0700 | [diff] [blame] | 1681 | @Deprecated |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1682 | public static final String EXTRA_ALLOW_REPLACE |
| 1683 | = "android.intent.extra.ALLOW_REPLACE"; |
| 1684 | |
| 1685 | /** |
| 1686 | * Used as a boolean extra field with {@link #ACTION_INSTALL_PACKAGE} or |
| 1687 | * {@link #ACTION_UNINSTALL_PACKAGE}. Specifies that the installer UI should |
| 1688 | * return to the application the result code of the install/uninstall. The returned result |
| 1689 | * code will be {@link android.app.Activity#RESULT_OK} on success or |
| 1690 | * {@link android.app.Activity#RESULT_FIRST_USER} on failure. |
| 1691 | */ |
| 1692 | public static final String EXTRA_RETURN_RESULT |
| 1693 | = "android.intent.extra.RETURN_RESULT"; |
| 1694 | |
| 1695 | /** |
| 1696 | * Package manager install result code. @hide because result codes are not |
| 1697 | * yet ready to be exposed. |
| 1698 | */ |
| 1699 | public static final String EXTRA_INSTALL_RESULT |
| 1700 | = "android.intent.extra.INSTALL_RESULT"; |
| 1701 | |
| 1702 | /** |
| 1703 | * Activity Action: Launch application uninstaller. |
| 1704 | * <p> |
| 1705 | * Input: The data must be a package: URI whose scheme specific part is |
| 1706 | * the package name of the current installed package to be uninstalled. |
| 1707 | * You can optionally supply {@link #EXTRA_RETURN_RESULT}. |
| 1708 | * <p> |
| 1709 | * Output: If {@link #EXTRA_RETURN_RESULT}, returns whether the install |
| 1710 | * succeeded. |
Philip P. Moltmann | d9bb39a | 2017-09-05 12:41:15 -0700 | [diff] [blame] | 1711 | * <p> |
| 1712 | * Requires {@link android.Manifest.permission#REQUEST_DELETE_PACKAGES} |
| 1713 | * since {@link Build.VERSION_CODES#P}. |
Philip P. Moltmann | fe46010 | 2018-09-25 10:22:32 -0700 | [diff] [blame] | 1714 | * |
| 1715 | * @deprecated Use {@link android.content.pm.PackageInstaller#uninstall(String, IntentSender)} |
| 1716 | * instead |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1717 | */ |
Philip P. Moltmann | fe46010 | 2018-09-25 10:22:32 -0700 | [diff] [blame] | 1718 | @Deprecated |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1719 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1720 | public static final String ACTION_UNINSTALL_PACKAGE = "android.intent.action.UNINSTALL_PACKAGE"; |
| 1721 | |
| 1722 | /** |
Dianne Hackborn | 6d235d8 | 2012-09-16 18:25:40 -0700 | [diff] [blame] | 1723 | * Specify whether the package should be uninstalled for all users. |
| 1724 | * @hide because these should not be part of normal application flow. |
| 1725 | */ |
| 1726 | public static final String EXTRA_UNINSTALL_ALL_USERS |
| 1727 | = "android.intent.extra.UNINSTALL_ALL_USERS"; |
| 1728 | |
| 1729 | /** |
Varun Shah | b9fd6be | 2018-10-22 19:16:33 -0700 | [diff] [blame] | 1730 | * A string that associates with a metadata entry, indicating the last run version of the |
| 1731 | * platform that was setup. |
| 1732 | * |
| 1733 | * @see #ACTION_UPGRADE_SETUP |
| 1734 | * |
Dianne Hackborn | d7cd29d | 2009-07-01 11:22:45 -0700 | [diff] [blame] | 1735 | * @hide |
| 1736 | */ |
Varun Shah | b9fd6be | 2018-10-22 19:16:33 -0700 | [diff] [blame] | 1737 | @SystemApi |
Dianne Hackborn | d7cd29d | 2009-07-01 11:22:45 -0700 | [diff] [blame] | 1738 | public static final String METADATA_SETUP_VERSION = "android.SETUP_VERSION"; |
| 1739 | |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1740 | /** |
| 1741 | * Activity action: Launch UI to manage the permissions of an app. |
| 1742 | * <p> |
| 1743 | * Input: {@link #EXTRA_PACKAGE_NAME} specifies the package whose permissions |
| 1744 | * will be managed by the launched UI. |
| 1745 | * </p> |
| 1746 | * <p> |
| 1747 | * Output: Nothing. |
| 1748 | * </p> |
| 1749 | * |
| 1750 | * @see #EXTRA_PACKAGE_NAME |
| 1751 | * |
| 1752 | * @hide |
| 1753 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 1754 | @SystemApi |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1755 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1756 | public static final String ACTION_MANAGE_APP_PERMISSIONS = |
| 1757 | "android.intent.action.MANAGE_APP_PERMISSIONS"; |
| 1758 | |
| 1759 | /** |
Philip P. Moltmann | ed98828 | 2018-11-07 16:19:42 -0800 | [diff] [blame] | 1760 | * Activity action: Launch UI to manage a specific permissions of an app. |
| 1761 | * <p> |
| 1762 | * Input: {@link #EXTRA_PACKAGE_NAME} specifies the package whose permission |
| 1763 | * will be managed by the launched UI. |
| 1764 | * </p> |
| 1765 | * <p> |
| 1766 | * Input: {@link #EXTRA_PERMISSION_NAME} specifies the (individual) permission |
| 1767 | * that should be managed by the launched UI. |
| 1768 | * </p> |
| 1769 | * <p> |
| 1770 | * Output: Nothing. |
| 1771 | * </p> |
| 1772 | * |
| 1773 | * @see #EXTRA_PACKAGE_NAME |
| 1774 | * @see #EXTRA_PERMISSION_NAME |
| 1775 | * |
| 1776 | * @hide |
| 1777 | */ |
| 1778 | @SystemApi |
| 1779 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1780 | public static final String ACTION_MANAGE_APP_PERMISSION = |
| 1781 | "android.intent.action.MANAGE_APP_PERMISSION"; |
| 1782 | |
| 1783 | /** |
Svet Ganov | 321f015 | 2015-05-16 22:51:50 -0700 | [diff] [blame] | 1784 | * Activity action: Launch UI to manage permissions. |
| 1785 | * <p> |
| 1786 | * Input: Nothing. |
| 1787 | * </p> |
| 1788 | * <p> |
| 1789 | * Output: Nothing. |
| 1790 | * </p> |
| 1791 | * |
| 1792 | * @hide |
| 1793 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 1794 | @SystemApi |
Svet Ganov | 321f015 | 2015-05-16 22:51:50 -0700 | [diff] [blame] | 1795 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1796 | public static final String ACTION_MANAGE_PERMISSIONS = |
| 1797 | "android.intent.action.MANAGE_PERMISSIONS"; |
| 1798 | |
| 1799 | /** |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 1800 | * Activity action: Launch UI to review permissions for an app. |
| 1801 | * The system uses this intent if permission review for apps not |
| 1802 | * supporting the new runtime permissions model is enabled. In |
| 1803 | * this mode a permission review is required before any of the |
| 1804 | * app components can run. |
| 1805 | * <p> |
| 1806 | * Input: {@link #EXTRA_PACKAGE_NAME} specifies the package whose |
| 1807 | * permissions will be reviewed (mandatory). |
| 1808 | * </p> |
| 1809 | * <p> |
| 1810 | * Input: {@link #EXTRA_INTENT} specifies a pending intent to |
| 1811 | * be fired after the permission review (optional). |
| 1812 | * </p> |
| 1813 | * <p> |
| 1814 | * Input: {@link #EXTRA_REMOTE_CALLBACK} specifies a callback to |
| 1815 | * be invoked after the permission review (optional). |
| 1816 | * </p> |
| 1817 | * <p> |
| 1818 | * Input: {@link #EXTRA_RESULT_NEEDED} specifies whether the intent |
| 1819 | * passed via {@link #EXTRA_INTENT} needs a result (optional). |
| 1820 | * </p> |
| 1821 | * <p> |
| 1822 | * Output: Nothing. |
| 1823 | * </p> |
| 1824 | * |
| 1825 | * @see #EXTRA_PACKAGE_NAME |
| 1826 | * @see #EXTRA_INTENT |
| 1827 | * @see #EXTRA_REMOTE_CALLBACK |
| 1828 | * @see #EXTRA_RESULT_NEEDED |
| 1829 | * |
| 1830 | * @hide |
| 1831 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 1832 | @SystemApi |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 1833 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1834 | public static final String ACTION_REVIEW_PERMISSIONS = |
| 1835 | "android.intent.action.REVIEW_PERMISSIONS"; |
| 1836 | |
| 1837 | /** |
| 1838 | * Intent extra: A callback for reporting remote result as a bundle. |
| 1839 | * <p> |
| 1840 | * Type: IRemoteCallback |
| 1841 | * </p> |
| 1842 | * |
| 1843 | * @hide |
| 1844 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 1845 | @SystemApi |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 1846 | public static final String EXTRA_REMOTE_CALLBACK = "android.intent.extra.REMOTE_CALLBACK"; |
| 1847 | |
| 1848 | /** |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1849 | * Intent extra: An app package name. |
| 1850 | * <p> |
| 1851 | * Type: String |
Svet Ganov | 0b31670 | 2015-05-23 13:25:11 -0700 | [diff] [blame] | 1852 | * </p> |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1853 | * |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1854 | */ |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1855 | public static final String EXTRA_PACKAGE_NAME = "android.intent.extra.PACKAGE_NAME"; |
| 1856 | |
| 1857 | /** |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 1858 | * Intent extra: A {@link Bundle} of extras for a package being suspended. Will be sent as an |
| 1859 | * extra with {@link #ACTION_MY_PACKAGE_SUSPENDED}. |
| 1860 | * |
| 1861 | * <p>The contents of this {@link Bundle} are a contract between the suspended app and the |
| 1862 | * suspending app, i.e. any app with the permission {@code android.permission.SUSPEND_APPS}. |
| 1863 | * This is meant to enable the suspended app to better handle the state of being suspended. |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 1864 | * |
| 1865 | * @see #ACTION_MY_PACKAGE_SUSPENDED |
| 1866 | * @see #ACTION_MY_PACKAGE_UNSUSPENDED |
| 1867 | * @see PackageManager#isPackageSuspended() |
| 1868 | * @see PackageManager#getSuspendedPackageAppExtras() |
| 1869 | */ |
| 1870 | public static final String EXTRA_SUSPENDED_PACKAGE_EXTRAS = "android.intent.extra.SUSPENDED_PACKAGE_EXTRAS"; |
| 1871 | |
| 1872 | /** |
Todd Kennedy | e5195dd | 2016-10-19 15:29:19 -0700 | [diff] [blame] | 1873 | * Intent extra: An app split name. |
| 1874 | * <p> |
| 1875 | * Type: String |
| 1876 | * </p> |
Todd Kennedy | e5195dd | 2016-10-19 15:29:19 -0700 | [diff] [blame] | 1877 | */ |
Todd Kennedy | e5195dd | 2016-10-19 15:29:19 -0700 | [diff] [blame] | 1878 | public static final String EXTRA_SPLIT_NAME = "android.intent.extra.SPLIT_NAME"; |
| 1879 | |
| 1880 | /** |
Jeff Sharkey | 1a74942 | 2017-04-28 14:19:50 -0600 | [diff] [blame] | 1881 | * Intent extra: A {@link ComponentName} value. |
| 1882 | * <p> |
| 1883 | * Type: String |
| 1884 | * </p> |
| 1885 | */ |
| 1886 | public static final String EXTRA_COMPONENT_NAME = "android.intent.extra.COMPONENT_NAME"; |
| 1887 | |
| 1888 | /** |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 1889 | * Intent extra: An extra for specifying whether a result is needed. |
| 1890 | * <p> |
| 1891 | * Type: boolean |
| 1892 | * </p> |
| 1893 | * |
| 1894 | * @hide |
| 1895 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 1896 | @SystemApi |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 1897 | public static final String EXTRA_RESULT_NEEDED = "android.intent.extra.RESULT_NEEDED"; |
| 1898 | |
| 1899 | /** |
Suprabh Shukla | 19b41f3 | 2018-03-26 22:35:13 -0700 | [diff] [blame] | 1900 | * Intent extra: A {@link Bundle} of extras supplied for the launcher when any packages on |
| 1901 | * device are suspended. Will be sent with {@link #ACTION_PACKAGES_SUSPENDED}. |
| 1902 | * |
| 1903 | * @see PackageManager#isPackageSuspended() |
| 1904 | * @see #ACTION_PACKAGES_SUSPENDED |
| 1905 | * |
| 1906 | * @hide |
| 1907 | */ |
| 1908 | public static final String EXTRA_LAUNCHER_EXTRAS = "android.intent.extra.LAUNCHER_EXTRAS"; |
| 1909 | |
| 1910 | /** |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1911 | * Activity action: Launch UI to manage which apps have a given permission. |
| 1912 | * <p> |
Philip P. Moltmann | ed98828 | 2018-11-07 16:19:42 -0800 | [diff] [blame] | 1913 | * Input: {@link #EXTRA_PERMISSION_NAME} specifies the permission group |
| 1914 | * which will be managed by the launched UI. |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1915 | * </p> |
| 1916 | * <p> |
| 1917 | * Output: Nothing. |
| 1918 | * </p> |
| 1919 | * |
| 1920 | * @see #EXTRA_PERMISSION_NAME |
| 1921 | * |
| 1922 | * @hide |
| 1923 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 1924 | @SystemApi |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1925 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1926 | public static final String ACTION_MANAGE_PERMISSION_APPS = |
| 1927 | "android.intent.action.MANAGE_PERMISSION_APPS"; |
| 1928 | |
| 1929 | /** |
| 1930 | * Intent extra: The name of a permission. |
| 1931 | * <p> |
| 1932 | * Type: String |
| 1933 | * </p> |
| 1934 | * |
| 1935 | * @hide |
| 1936 | */ |
| 1937 | @SystemApi |
| 1938 | public static final String EXTRA_PERMISSION_NAME = "android.intent.extra.PERMISSION_NAME"; |
| 1939 | |
Joel Galenson | 13096ea | 2018-09-27 11:18:44 -0700 | [diff] [blame] | 1940 | /** |
| 1941 | * Activity action: Launch UI to review app uses of permissions. |
| 1942 | * <p> |
| 1943 | * Input: Nothing |
| 1944 | * </p> |
| 1945 | * <p> |
| 1946 | * Output: Nothing. |
| 1947 | * </p> |
| 1948 | * |
| 1949 | * @hide |
| 1950 | */ |
| 1951 | @SystemApi |
| 1952 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1953 | public static final String ACTION_REVIEW_PERMISSION_USAGE = |
| 1954 | "android.intent.action.REVIEW_PERMISSION_USAGE"; |
| 1955 | |
Joel Galenson | 78ec58d | 2018-10-24 10:06:25 -0700 | [diff] [blame] | 1956 | /** |
| 1957 | * Activity action: Launch UI to review uses of permissions for a single app. |
| 1958 | * <p> |
| 1959 | * Input: {@link #EXTRA_PACKAGE_NAME} specifies the package whose |
| 1960 | * permissions will be reviewed (mandatory). |
| 1961 | * </p> |
| 1962 | * <p> |
| 1963 | * Output: Nothing. |
| 1964 | * </p> |
| 1965 | * <p class="note"> |
| 1966 | * This requires {@link android.Manifest.permission#GRANT_RUNTIME_PERMISSIONS} permission. |
| 1967 | * </p> |
| 1968 | * |
| 1969 | * @see #EXTRA_PACKAGE_NAME |
| 1970 | * |
| 1971 | * @hide |
| 1972 | */ |
| 1973 | @SystemApi |
| 1974 | @RequiresPermission(android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS) |
| 1975 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1976 | public static final String ACTION_REVIEW_APP_PERMISSION_USAGE = |
| 1977 | "android.intent.action.REVIEW_APP_PERMISSION_USAGE"; |
| 1978 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1979 | // --------------------------------------------------------------------- |
| 1980 | // --------------------------------------------------------------------- |
| 1981 | // Standard intent broadcast actions (see action variable). |
| 1982 | |
| 1983 | /** |
Jeff Brown | 037c33e | 2014-04-09 00:31:55 -0700 | [diff] [blame] | 1984 | * Broadcast Action: Sent when the device goes to sleep and becomes non-interactive. |
| 1985 | * <p> |
| 1986 | * For historical reasons, the name of this broadcast action refers to the power |
| 1987 | * state of the screen but it is actually sent in response to changes in the |
| 1988 | * overall interactive state of the device. |
| 1989 | * </p><p> |
| 1990 | * This broadcast is sent when the device becomes non-interactive which may have |
| 1991 | * nothing to do with the screen turning off. To determine the |
| 1992 | * actual state of the screen, use {@link android.view.Display#getState}. |
| 1993 | * </p><p> |
| 1994 | * See {@link android.os.PowerManager#isInteractive} for details. |
| 1995 | * </p> |
Casey Ho | dbf6785c | 2015-03-17 15:59:39 -0700 | [diff] [blame] | 1996 | * You <em>cannot</em> receive this through components declared in |
| 1997 | * manifests, only by explicitly registering for it with |
| 1998 | * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
| 1999 | * Context.registerReceiver()}. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2000 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2001 | * <p class="note">This is a protected intent that can only be sent |
| 2002 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2003 | */ |
| 2004 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2005 | public static final String ACTION_SCREEN_OFF = "android.intent.action.SCREEN_OFF"; |
Jeff Brown | 037c33e | 2014-04-09 00:31:55 -0700 | [diff] [blame] | 2006 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2007 | /** |
Jeff Brown | 037c33e | 2014-04-09 00:31:55 -0700 | [diff] [blame] | 2008 | * Broadcast Action: Sent when the device wakes up and becomes interactive. |
| 2009 | * <p> |
| 2010 | * For historical reasons, the name of this broadcast action refers to the power |
| 2011 | * state of the screen but it is actually sent in response to changes in the |
| 2012 | * overall interactive state of the device. |
| 2013 | * </p><p> |
| 2014 | * This broadcast is sent when the device becomes interactive which may have |
| 2015 | * nothing to do with the screen turning on. To determine the |
| 2016 | * actual state of the screen, use {@link android.view.Display#getState}. |
| 2017 | * </p><p> |
| 2018 | * See {@link android.os.PowerManager#isInteractive} for details. |
| 2019 | * </p> |
Casey Ho | dbf6785c | 2015-03-17 15:59:39 -0700 | [diff] [blame] | 2020 | * You <em>cannot</em> receive this through components declared in |
| 2021 | * manifests, only by explicitly registering for it with |
| 2022 | * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
| 2023 | * Context.registerReceiver()}. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2024 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2025 | * <p class="note">This is a protected intent that can only be sent |
| 2026 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2027 | */ |
| 2028 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2029 | public static final String ACTION_SCREEN_ON = "android.intent.action.SCREEN_ON"; |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 2030 | |
| 2031 | /** |
Dianne Hackborn | be87e2f | 2012-09-28 16:31:34 -0700 | [diff] [blame] | 2032 | * Broadcast Action: Sent after the system stops dreaming. |
| 2033 | * |
| 2034 | * <p class="note">This is a protected intent that can only be sent by the system. |
| 2035 | * It is only sent to registered receivers.</p> |
| 2036 | */ |
| 2037 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2038 | public static final String ACTION_DREAMING_STOPPED = "android.intent.action.DREAMING_STOPPED"; |
| 2039 | |
| 2040 | /** |
| 2041 | * Broadcast Action: Sent after the system starts dreaming. |
| 2042 | * |
| 2043 | * <p class="note">This is a protected intent that can only be sent by the system. |
| 2044 | * It is only sent to registered receivers.</p> |
| 2045 | */ |
| 2046 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2047 | public static final String ACTION_DREAMING_STARTED = "android.intent.action.DREAMING_STARTED"; |
| 2048 | |
| 2049 | /** |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 2050 | * Broadcast Action: Sent when the user is present after device wakes up (e.g when the |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 2051 | * keyguard is gone). |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2052 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2053 | * <p class="note">This is a protected intent that can only be sent |
| 2054 | * by the system. |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 2055 | */ |
| 2056 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Dianne Hackborn | 1c633fc | 2009-12-08 19:45:14 -0800 | [diff] [blame] | 2057 | public static final String ACTION_USER_PRESENT = "android.intent.action.USER_PRESENT"; |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 2058 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2059 | /** |
| 2060 | * Broadcast Action: The current time has changed. Sent every |
Casey Ho | dbf6785c | 2015-03-17 15:59:39 -0700 | [diff] [blame] | 2061 | * minute. You <em>cannot</em> receive this through components declared |
John Spurlock | 6098c5d | 2013-06-17 10:32:46 -0400 | [diff] [blame] | 2062 | * in manifests, only by explicitly registering for it with |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2063 | * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
| 2064 | * Context.registerReceiver()}. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2065 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2066 | * <p class="note">This is a protected intent that can only be sent |
| 2067 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2068 | */ |
| 2069 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2070 | public static final String ACTION_TIME_TICK = "android.intent.action.TIME_TICK"; |
| 2071 | /** |
| 2072 | * Broadcast Action: The time was set. |
| 2073 | */ |
| 2074 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2075 | public static final String ACTION_TIME_CHANGED = "android.intent.action.TIME_SET"; |
| 2076 | /** |
| 2077 | * Broadcast Action: The date has changed. |
| 2078 | */ |
| 2079 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2080 | public static final String ACTION_DATE_CHANGED = "android.intent.action.DATE_CHANGED"; |
| 2081 | /** |
| 2082 | * Broadcast Action: The timezone has changed. The intent will have the following extra values:</p> |
| 2083 | * <ul> |
| 2084 | * <li><em>time-zone</em> - The java.util.TimeZone.getID() value identifying the new time zone.</li> |
| 2085 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2086 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2087 | * <p class="note">This is a protected intent that can only be sent |
| 2088 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2089 | */ |
| 2090 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2091 | public static final String ACTION_TIMEZONE_CHANGED = "android.intent.action.TIMEZONE_CHANGED"; |
| 2092 | /** |
Robert Greenwalt | 03595d0 | 2010-11-02 14:08:23 -0700 | [diff] [blame] | 2093 | * Clear DNS Cache Action: This is broadcast when networks have changed and old |
| 2094 | * DNS entries should be tossed. |
| 2095 | * @hide |
| 2096 | */ |
| 2097 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2098 | public static final String ACTION_CLEAR_DNS_CACHE = "android.intent.action.CLEAR_DNS_CACHE"; |
| 2099 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2100 | * Alarm Changed Action: This is broadcast when the AlarmClock |
| 2101 | * application's alarm is set or unset. It is used by the |
| 2102 | * AlarmClock application and the StatusBar service. |
| 2103 | * @hide |
| 2104 | */ |
| 2105 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 2106 | @UnsupportedAppUsage |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2107 | public static final String ACTION_ALARM_CHANGED = "android.intent.action.ALARM_CHANGED"; |
Jeff Sharkey | bedbaa9 | 2015-12-02 16:42:25 -0700 | [diff] [blame] | 2108 | |
| 2109 | /** |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 2110 | * Broadcast Action: This is broadcast once, after the user has finished |
| 2111 | * booting, but while still in the "locked" state. It can be used to perform |
| 2112 | * application-specific initialization, such as installing alarms. You must |
| 2113 | * hold the {@link android.Manifest.permission#RECEIVE_BOOT_COMPLETED} |
| 2114 | * permission in order to receive this broadcast. |
Jeff Sharkey | bedbaa9 | 2015-12-02 16:42:25 -0700 | [diff] [blame] | 2115 | * <p> |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 2116 | * This broadcast is sent immediately at boot by all devices (regardless of |
| 2117 | * direct boot support) running {@link android.os.Build.VERSION_CODES#N} or |
| 2118 | * higher. Upon receipt of this broadcast, the user is still locked and only |
| 2119 | * device-protected storage can be accessed safely. If you want to access |
| 2120 | * credential-protected storage, you need to wait for the user to be |
| 2121 | * unlocked (typically by entering their lock pattern or PIN for the first |
| 2122 | * time), after which the {@link #ACTION_USER_UNLOCKED} and |
| 2123 | * {@link #ACTION_BOOT_COMPLETED} broadcasts are sent. |
| 2124 | * <p> |
| 2125 | * To receive this broadcast, your receiver component must be marked as |
| 2126 | * being {@link ComponentInfo#directBootAware}. |
Jeff Sharkey | bedbaa9 | 2015-12-02 16:42:25 -0700 | [diff] [blame] | 2127 | * <p class="note"> |
| 2128 | * This is a protected intent that can only be sent by the system. |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 2129 | * |
| 2130 | * @see Context#createDeviceProtectedStorageContext() |
Jeff Sharkey | bedbaa9 | 2015-12-02 16:42:25 -0700 | [diff] [blame] | 2131 | */ |
| 2132 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2133 | public static final String ACTION_LOCKED_BOOT_COMPLETED = "android.intent.action.LOCKED_BOOT_COMPLETED"; |
| 2134 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2135 | /** |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 2136 | * Broadcast Action: This is broadcast once, after the user has finished |
| 2137 | * booting. It can be used to perform application-specific initialization, |
| 2138 | * such as installing alarms. You must hold the |
| 2139 | * {@link android.Manifest.permission#RECEIVE_BOOT_COMPLETED} permission in |
| 2140 | * order to receive this broadcast. |
| 2141 | * <p> |
| 2142 | * This broadcast is sent at boot by all devices (both with and without |
| 2143 | * direct boot support). Upon receipt of this broadcast, the user is |
| 2144 | * unlocked and both device-protected and credential-protected storage can |
| 2145 | * accessed safely. |
| 2146 | * <p> |
| 2147 | * If you need to run while the user is still locked (before they've entered |
| 2148 | * their lock pattern or PIN for the first time), you can listen for the |
| 2149 | * {@link #ACTION_LOCKED_BOOT_COMPLETED} broadcast. |
| 2150 | * <p class="note"> |
| 2151 | * This is a protected intent that can only be sent by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2152 | */ |
| 2153 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Jeff Sharkey | 32ee8ee | 2017-03-08 20:17:51 -0700 | [diff] [blame] | 2154 | @BroadcastBehavior(includeBackground = true) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2155 | public static final String ACTION_BOOT_COMPLETED = "android.intent.action.BOOT_COMPLETED"; |
Jeff Sharkey | bedbaa9 | 2015-12-02 16:42:25 -0700 | [diff] [blame] | 2156 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2157 | /** |
| 2158 | * Broadcast Action: This is broadcast when a user action should request a |
| 2159 | * temporary system dialog to dismiss. Some examples of temporary system |
| 2160 | * dialogs are the notification window-shade and the recent tasks dialog. |
| 2161 | */ |
Jeff Sharkey | 0f3f60b | 2017-04-24 18:06:20 -0600 | [diff] [blame] | 2162 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2163 | public static final String ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS"; |
| 2164 | /** |
| 2165 | * Broadcast Action: Trigger the download and eventual installation |
| 2166 | * of a package. |
| 2167 | * <p>Input: {@link #getData} is the URI of the package file to download. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2168 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2169 | * <p class="note">This is a protected intent that can only be sent |
| 2170 | * by the system. |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 2171 | * |
| 2172 | * @deprecated This constant has never been used. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2173 | */ |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 2174 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2175 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2176 | public static final String ACTION_PACKAGE_INSTALL = "android.intent.action.PACKAGE_INSTALL"; |
| 2177 | /** |
Christopher Tate | 94b91db | 2017-04-19 15:49:17 -0700 | [diff] [blame] | 2178 | * Broadcast Action: A new application package has been installed on the |
The Android Open Source Project | c2ad241 | 2009-03-19 23:08:54 -0700 | [diff] [blame] | 2179 | * device. The data contains the name of the package. Note that the |
| 2180 | * newly installed package does <em>not</em> receive this broadcast. |
Jeff Sharkey | d0c6ccb | 2012-09-14 16:26:37 -0700 | [diff] [blame] | 2181 | * <p>May include the following extras: |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2182 | * <ul> |
Christopher Tate | 94b91db | 2017-04-19 15:49:17 -0700 | [diff] [blame] | 2183 | * <li> {@link #EXTRA_UID} containing the integer uid assigned to the new package. |
| 2184 | * <li> {@link #EXTRA_REPLACING} is set to true if this is following |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2185 | * an {@link #ACTION_PACKAGE_REMOVED} broadcast for the same package. |
| 2186 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2187 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2188 | * <p class="note">This is a protected intent that can only be sent |
| 2189 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2190 | */ |
| 2191 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2192 | public static final String ACTION_PACKAGE_ADDED = "android.intent.action.PACKAGE_ADDED"; |
| 2193 | /** |
The Android Open Source Project | c2ad241 | 2009-03-19 23:08:54 -0700 | [diff] [blame] | 2194 | * Broadcast Action: A new version of an application package has been |
| 2195 | * installed, replacing an existing version that was previously installed. |
| 2196 | * The data contains the name of the package. |
Jeff Sharkey | d0c6ccb | 2012-09-14 16:26:37 -0700 | [diff] [blame] | 2197 | * <p>May include the following extras: |
The Android Open Source Project | c2ad241 | 2009-03-19 23:08:54 -0700 | [diff] [blame] | 2198 | * <ul> |
| 2199 | * <li> {@link #EXTRA_UID} containing the integer uid assigned to the new package. |
| 2200 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2201 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2202 | * <p class="note">This is a protected intent that can only be sent |
| 2203 | * by the system. |
The Android Open Source Project | c2ad241 | 2009-03-19 23:08:54 -0700 | [diff] [blame] | 2204 | */ |
| 2205 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2206 | public static final String ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED"; |
| 2207 | /** |
Dianne Hackborn | e7f9721 | 2011-02-24 14:40:20 -0800 | [diff] [blame] | 2208 | * Broadcast Action: A new version of your application has been installed |
| 2209 | * over an existing one. This is only sent to the application that was |
| 2210 | * replaced. It does not contain any additional data; to receive it, just |
| 2211 | * use an intent filter for this action. |
| 2212 | * |
| 2213 | * <p class="note">This is a protected intent that can only be sent |
| 2214 | * by the system. |
| 2215 | */ |
| 2216 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2217 | public static final String ACTION_MY_PACKAGE_REPLACED = "android.intent.action.MY_PACKAGE_REPLACED"; |
| 2218 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2219 | * Broadcast Action: An existing application package has been removed from |
| 2220 | * the device. The data contains the name of the package. The package |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 2221 | * that is being removed does <em>not</em> receive this Intent. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2222 | * <ul> |
| 2223 | * <li> {@link #EXTRA_UID} containing the integer uid previously assigned |
| 2224 | * to the package. |
| 2225 | * <li> {@link #EXTRA_DATA_REMOVED} is set to true if the entire |
| 2226 | * application -- data and code -- is being removed. |
| 2227 | * <li> {@link #EXTRA_REPLACING} is set to true if this will be followed |
| 2228 | * by an {@link #ACTION_PACKAGE_ADDED} broadcast for the same package. |
| 2229 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2230 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2231 | * <p class="note">This is a protected intent that can only be sent |
| 2232 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2233 | */ |
| 2234 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2235 | public static final String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED"; |
| 2236 | /** |
Dianne Hackborn | f9abb40 | 2011-08-10 15:00:59 -0700 | [diff] [blame] | 2237 | * Broadcast Action: An existing application package has been completely |
| 2238 | * removed from the device. The data contains the name of the package. |
| 2239 | * This is like {@link #ACTION_PACKAGE_REMOVED}, but only set when |
| 2240 | * {@link #EXTRA_DATA_REMOVED} is true and |
| 2241 | * {@link #EXTRA_REPLACING} is false of that broadcast. |
| 2242 | * |
| 2243 | * <ul> |
| 2244 | * <li> {@link #EXTRA_UID} containing the integer uid previously assigned |
| 2245 | * to the package. |
| 2246 | * </ul> |
| 2247 | * |
| 2248 | * <p class="note">This is a protected intent that can only be sent |
| 2249 | * by the system. |
| 2250 | */ |
| 2251 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2252 | public static final String ACTION_PACKAGE_FULLY_REMOVED |
| 2253 | = "android.intent.action.PACKAGE_FULLY_REMOVED"; |
| 2254 | /** |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 2255 | * Broadcast Action: An existing application package has been changed (for |
| 2256 | * example, a component has been enabled or disabled). The data contains |
| 2257 | * the name of the package. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2258 | * <ul> |
| 2259 | * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. |
Dianne Hackborn | 86a72da | 2009-11-11 20:12:41 -0800 | [diff] [blame] | 2260 | * <li> {@link #EXTRA_CHANGED_COMPONENT_NAME_LIST} containing the class name |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 2261 | * of the changed components (or the package name itself). |
Dianne Hackborn | 86a72da | 2009-11-11 20:12:41 -0800 | [diff] [blame] | 2262 | * <li> {@link #EXTRA_DONT_KILL_APP} containing boolean field to override the |
| 2263 | * default action of restarting the application. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2264 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2265 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2266 | * <p class="note">This is a protected intent that can only be sent |
| 2267 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2268 | */ |
| 2269 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2270 | public static final String ACTION_PACKAGE_CHANGED = "android.intent.action.PACKAGE_CHANGED"; |
| 2271 | /** |
Dianne Hackborn | 21f1bd1 | 2010-02-19 17:02:21 -0800 | [diff] [blame] | 2272 | * @hide |
| 2273 | * Broadcast Action: Ask system services if there is any reason to |
| 2274 | * restart the given package. The data contains the name of the |
| 2275 | * package. |
| 2276 | * <ul> |
| 2277 | * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. |
| 2278 | * <li> {@link #EXTRA_PACKAGES} String array of all packages to check. |
| 2279 | * </ul> |
| 2280 | * |
| 2281 | * <p class="note">This is a protected intent that can only be sent |
| 2282 | * by the system. |
| 2283 | */ |
Soonil Nagarkar | 0e8fd09 | 2015-02-10 10:37:36 -0800 | [diff] [blame] | 2284 | @SystemApi |
Dianne Hackborn | 21f1bd1 | 2010-02-19 17:02:21 -0800 | [diff] [blame] | 2285 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2286 | public static final String ACTION_QUERY_PACKAGE_RESTART = "android.intent.action.QUERY_PACKAGE_RESTART"; |
| 2287 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2288 | * Broadcast Action: The user has restarted a package, and all of its |
| 2289 | * processes have been killed. All runtime state |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2290 | * associated with it (processes, alarms, notifications, etc) should |
The Android Open Source Project | c2ad241 | 2009-03-19 23:08:54 -0700 | [diff] [blame] | 2291 | * be removed. Note that the restarted package does <em>not</em> |
| 2292 | * receive this broadcast. |
| 2293 | * The data contains the name of the package. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2294 | * <ul> |
| 2295 | * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. |
| 2296 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2297 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2298 | * <p class="note">This is a protected intent that can only be sent |
| 2299 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2300 | */ |
| 2301 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2302 | public static final String ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED"; |
| 2303 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2304 | * Broadcast Action: The user has cleared the data of a package. This should |
| 2305 | * be preceded by {@link #ACTION_PACKAGE_RESTARTED}, after which all of |
The Android Open Source Project | c2ad241 | 2009-03-19 23:08:54 -0700 | [diff] [blame] | 2306 | * its persistent data is erased and this broadcast sent. |
| 2307 | * Note that the cleared package does <em>not</em> |
| 2308 | * receive this broadcast. The data contains the name of the package. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2309 | * <ul> |
Svet Ganov | f935a70 | 2017-08-22 12:15:58 -0700 | [diff] [blame] | 2310 | * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. If the |
| 2311 | * package whose data was cleared is an uninstalled instant app, then the UID |
| 2312 | * will be -1. The platform keeps some meta-data associated with instant apps |
| 2313 | * after they are uninstalled. |
| 2314 | * <li> {@link #EXTRA_PACKAGE_NAME} containing the package name only if the cleared |
| 2315 | * data was for an instant app. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2316 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2317 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2318 | * <p class="note">This is a protected intent that can only be sent |
| 2319 | * by the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2320 | */ |
| 2321 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2322 | public static final String ACTION_PACKAGE_DATA_CLEARED = "android.intent.action.PACKAGE_DATA_CLEARED"; |
| 2323 | /** |
Andrei Stingaceanu | 69d5ebc | 2016-01-14 12:59:03 +0000 | [diff] [blame] | 2324 | * Broadcast Action: Packages have been suspended. |
| 2325 | * <p>Includes the following extras: |
| 2326 | * <ul> |
| 2327 | * <li> {@link #EXTRA_CHANGED_PACKAGE_LIST} is the set of packages which have been suspended |
Julia Reynolds | 4bc42b9 | 2018-08-14 11:27:35 -0400 | [diff] [blame] | 2328 | * <li> {@link #EXTRA_CHANGED_UID_LIST} is the set of uids which have been suspended |
Andrei Stingaceanu | 69d5ebc | 2016-01-14 12:59:03 +0000 | [diff] [blame] | 2329 | * </ul> |
| 2330 | * |
| 2331 | * <p class="note">This is a protected intent that can only be sent |
| 2332 | * by the system. It is only sent to registered receivers. |
| 2333 | */ |
| 2334 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2335 | public static final String ACTION_PACKAGES_SUSPENDED = "android.intent.action.PACKAGES_SUSPENDED"; |
| 2336 | /** |
| 2337 | * Broadcast Action: Packages have been unsuspended. |
| 2338 | * <p>Includes the following extras: |
| 2339 | * <ul> |
| 2340 | * <li> {@link #EXTRA_CHANGED_PACKAGE_LIST} is the set of packages which have been unsuspended |
Julia Reynolds | 4bc42b9 | 2018-08-14 11:27:35 -0400 | [diff] [blame] | 2341 | * <li> {@link #EXTRA_CHANGED_UID_LIST} is the set of uids which have been unsuspended |
Andrei Stingaceanu | 69d5ebc | 2016-01-14 12:59:03 +0000 | [diff] [blame] | 2342 | * </ul> |
| 2343 | * |
| 2344 | * <p class="note">This is a protected intent that can only be sent |
| 2345 | * by the system. It is only sent to registered receivers. |
| 2346 | */ |
| 2347 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2348 | public static final String ACTION_PACKAGES_UNSUSPENDED = "android.intent.action.PACKAGES_UNSUSPENDED"; |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 2349 | |
| 2350 | /** |
| 2351 | * Broadcast Action: Sent to a package that has been suspended by the system. This is sent |
Suprabh Shukla | 19b41f3 | 2018-03-26 22:35:13 -0700 | [diff] [blame] | 2352 | * whenever a package is put into a suspended state or any of its app extras change while in the |
| 2353 | * suspended state. |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 2354 | * <p> Optionally includes the following extras: |
| 2355 | * <ul> |
| 2356 | * <li> {@link #EXTRA_SUSPENDED_PACKAGE_EXTRAS} which is a {@link Bundle} which will contain |
| 2357 | * useful information for the app being suspended. |
| 2358 | * </ul> |
| 2359 | * <p class="note">This is a protected intent that can only be sent |
| 2360 | * by the system. <em>This will be delivered to {@link BroadcastReceiver} components declared in |
| 2361 | * the manifest.</em> |
| 2362 | * |
| 2363 | * @see #ACTION_MY_PACKAGE_UNSUSPENDED |
| 2364 | * @see #EXTRA_SUSPENDED_PACKAGE_EXTRAS |
| 2365 | * @see PackageManager#isPackageSuspended() |
| 2366 | * @see PackageManager#getSuspendedPackageAppExtras() |
| 2367 | */ |
| 2368 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2369 | public static final String ACTION_MY_PACKAGE_SUSPENDED = "android.intent.action.MY_PACKAGE_SUSPENDED"; |
| 2370 | |
| 2371 | /** |
Suprabh Shukla | 3c3af14 | 2018-03-30 00:28:37 -0700 | [diff] [blame] | 2372 | * Activity Action: Started to show more details about why an application was suspended. |
| 2373 | * |
Suprabh Shukla | 3e03ab9 | 2018-04-11 16:03:49 -0700 | [diff] [blame] | 2374 | * <p>Whenever the system detects an activity launch for a suspended app, this action can |
| 2375 | * be used to show more details about the reason for suspension. |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 2376 | * |
Suprabh Shukla | 3c3af14 | 2018-03-30 00:28:37 -0700 | [diff] [blame] | 2377 | * <p>Apps holding {@link android.Manifest.permission#SUSPEND_APPS} must declare an activity |
| 2378 | * handling this intent and protect it with |
| 2379 | * {@link android.Manifest.permission#SEND_SHOW_SUSPENDED_APP_DETAILS}. |
| 2380 | * |
| 2381 | * <p>Includes an extra {@link #EXTRA_PACKAGE_NAME} which is the name of the suspended package. |
| 2382 | * |
| 2383 | * <p class="note">This is a protected intent that can only be sent |
| 2384 | * by the system. |
| 2385 | * |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 2386 | * @see PackageManager#setPackagesSuspended(String[], boolean, PersistableBundle, |
| 2387 | * PersistableBundle, String) |
Suprabh Shukla | 3c3af14 | 2018-03-30 00:28:37 -0700 | [diff] [blame] | 2388 | * @see PackageManager#isPackageSuspended() |
| 2389 | * @see #ACTION_PACKAGES_SUSPENDED |
| 2390 | * |
| 2391 | * @hide |
| 2392 | */ |
| 2393 | @SystemApi |
| 2394 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 2395 | public static final String ACTION_SHOW_SUSPENDED_APP_DETAILS = |
| 2396 | "android.intent.action.SHOW_SUSPENDED_APP_DETAILS"; |
| 2397 | |
| 2398 | /** |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 2399 | * Broadcast Action: Sent to a package that has been unsuspended. |
| 2400 | * |
| 2401 | * <p class="note">This is a protected intent that can only be sent |
| 2402 | * by the system. <em>This will be delivered to {@link BroadcastReceiver} components declared in |
| 2403 | * the manifest.</em> |
| 2404 | * |
| 2405 | * @see #ACTION_MY_PACKAGE_SUSPENDED |
| 2406 | * @see #EXTRA_SUSPENDED_PACKAGE_EXTRAS |
| 2407 | * @see PackageManager#isPackageSuspended() |
| 2408 | * @see PackageManager#getSuspendedPackageAppExtras() |
| 2409 | */ |
| 2410 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2411 | public static final String ACTION_MY_PACKAGE_UNSUSPENDED = "android.intent.action.MY_PACKAGE_UNSUSPENDED"; |
| 2412 | |
Andrei Stingaceanu | 69d5ebc | 2016-01-14 12:59:03 +0000 | [diff] [blame] | 2413 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2414 | * Broadcast Action: A user ID has been removed from the system. The user |
| 2415 | * ID number is stored in the extra data under {@link #EXTRA_UID}. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2416 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2417 | * <p class="note">This is a protected intent that can only be sent |
| 2418 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2419 | */ |
| 2420 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2421 | public static final String ACTION_UID_REMOVED = "android.intent.action.UID_REMOVED"; |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 2422 | |
| 2423 | /** |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 2424 | * Broadcast Action: Sent to the installer package of an application when |
| 2425 | * that application is first launched (that is the first time it is moved |
| 2426 | * out of the stopped state). The data contains the name of the package. |
Dianne Hackborn | e7f9721 | 2011-02-24 14:40:20 -0800 | [diff] [blame] | 2427 | * |
| 2428 | * <p class="note">This is a protected intent that can only be sent |
| 2429 | * by the system. |
| 2430 | */ |
| 2431 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2432 | public static final String ACTION_PACKAGE_FIRST_LAUNCH = "android.intent.action.PACKAGE_FIRST_LAUNCH"; |
| 2433 | |
| 2434 | /** |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 2435 | * Broadcast Action: Sent to the system package verifier when a package |
| 2436 | * needs to be verified. The data contains the package URI. |
| 2437 | * <p class="note"> |
| 2438 | * This is a protected intent that can only be sent by the system. |
| 2439 | * </p> |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 2440 | */ |
| 2441 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2442 | public static final String ACTION_PACKAGE_NEEDS_VERIFICATION = "android.intent.action.PACKAGE_NEEDS_VERIFICATION"; |
| 2443 | |
| 2444 | /** |
rich cannings | d1b5cfc | 2012-08-29 14:49:51 -0700 | [diff] [blame] | 2445 | * Broadcast Action: Sent to the system package verifier when a package is |
| 2446 | * verified. The data contains the package URI. |
| 2447 | * <p class="note"> |
| 2448 | * This is a protected intent that can only be sent by the system. |
| 2449 | */ |
| 2450 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2451 | public static final String ACTION_PACKAGE_VERIFIED = "android.intent.action.PACKAGE_VERIFIED"; |
| 2452 | |
| 2453 | /** |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 2454 | * Broadcast Action: Sent to the system intent filter verifier when an |
| 2455 | * intent filter needs to be verified. The data contains the filter data |
| 2456 | * hosts to be verified against. |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 2457 | * <p class="note"> |
| 2458 | * This is a protected intent that can only be sent by the system. |
| 2459 | * </p> |
| 2460 | * |
| 2461 | * @hide |
| 2462 | */ |
| 2463 | @SystemApi |
| 2464 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2465 | public static final String ACTION_INTENT_FILTER_NEEDS_VERIFICATION = "android.intent.action.INTENT_FILTER_NEEDS_VERIFICATION"; |
| 2466 | |
| 2467 | /** |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 2468 | * Broadcast Action: Resources for a set of packages (which were |
| 2469 | * previously unavailable) are currently |
| 2470 | * available since the media on which they exist is available. |
| 2471 | * The extra data {@link #EXTRA_CHANGED_PACKAGE_LIST} contains a |
| 2472 | * list of packages whose availability changed. |
| 2473 | * The extra data {@link #EXTRA_CHANGED_UID_LIST} contains a |
| 2474 | * list of uids of packages whose availability changed. |
| 2475 | * Note that the |
| 2476 | * packages in this list do <em>not</em> receive this broadcast. |
| 2477 | * The specified set of packages are now available on the system. |
| 2478 | * <p>Includes the following extras: |
| 2479 | * <ul> |
| 2480 | * <li> {@link #EXTRA_CHANGED_PACKAGE_LIST} is the set of packages |
| 2481 | * whose resources(were previously unavailable) are currently available. |
| 2482 | * {@link #EXTRA_CHANGED_UID_LIST} is the set of uids of the |
| 2483 | * packages whose resources(were previously unavailable) |
| 2484 | * are currently available. |
| 2485 | * </ul> |
| 2486 | * |
| 2487 | * <p class="note">This is a protected intent that can only be sent |
| 2488 | * by the system. |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 2489 | */ |
| 2490 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 2491 | public static final String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE = |
| 2492 | "android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE"; |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 2493 | |
| 2494 | /** |
| 2495 | * Broadcast Action: Resources for a set of packages are currently |
| 2496 | * unavailable since the media on which they exist is unavailable. |
| 2497 | * The extra data {@link #EXTRA_CHANGED_PACKAGE_LIST} contains a |
| 2498 | * list of packages whose availability changed. |
| 2499 | * The extra data {@link #EXTRA_CHANGED_UID_LIST} contains a |
| 2500 | * list of uids of packages whose availability changed. |
| 2501 | * The specified set of packages can no longer be |
| 2502 | * launched and are practically unavailable on the system. |
| 2503 | * <p>Inclues the following extras: |
| 2504 | * <ul> |
| 2505 | * <li> {@link #EXTRA_CHANGED_PACKAGE_LIST} is the set of packages |
| 2506 | * whose resources are no longer available. |
| 2507 | * {@link #EXTRA_CHANGED_UID_LIST} is the set of packages |
| 2508 | * whose resources are no longer available. |
| 2509 | * </ul> |
| 2510 | * |
| 2511 | * <p class="note">This is a protected intent that can only be sent |
| 2512 | * by the system. |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 2513 | */ |
| 2514 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 2515 | public static final String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE = |
Joe Onorato | 8a051a4 | 2010-03-04 15:54:50 -0500 | [diff] [blame] | 2516 | "android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE"; |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 2517 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2518 | /** |
Makoto Onuki | 1030520 | 2016-07-14 18:14:08 -0700 | [diff] [blame] | 2519 | * Broadcast Action: preferred activities have changed *explicitly*. |
| 2520 | * |
| 2521 | * <p>Note there are cases where a preferred activity is invalidated *implicitly*, e.g. |
| 2522 | * when an app is installed or uninstalled, but in such cases this broadcast will *not* |
| 2523 | * be sent. |
| 2524 | * |
| 2525 | * {@link #EXTRA_USER_HANDLE} contains the user ID in question. |
| 2526 | * |
| 2527 | * @hide |
| 2528 | */ |
| 2529 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2530 | public static final String ACTION_PREFERRED_ACTIVITY_CHANGED = |
| 2531 | "android.intent.action.ACTION_PREFERRED_ACTIVITY_CHANGED"; |
| 2532 | |
| 2533 | |
| 2534 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2535 | * Broadcast Action: The current system wallpaper has changed. See |
Scott Main | 8b2e000 | 2009-09-29 18:17:31 -0700 | [diff] [blame] | 2536 | * {@link android.app.WallpaperManager} for retrieving the new wallpaper. |
Dianne Hackborn | c5bf758 | 2012-04-25 19:12:07 -0700 | [diff] [blame] | 2537 | * This should <em>only</em> be used to determine when the wallpaper |
| 2538 | * has changed to show the new wallpaper to the user. You should certainly |
| 2539 | * never, in response to this, change the wallpaper or other attributes of |
| 2540 | * it such as the suggested size. That would be crazy, right? You'd cause |
| 2541 | * all kinds of loops, especially if other apps are doing similar things, |
| 2542 | * right? Of course. So please don't do this. |
| 2543 | * |
| 2544 | * @deprecated Modern applications should use |
| 2545 | * {@link android.view.WindowManager.LayoutParams#FLAG_SHOW_WALLPAPER |
| 2546 | * WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER} to have the wallpaper |
| 2547 | * shown behind their UI, rather than watching for this broadcast and |
| 2548 | * rendering the wallpaper on their own. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2549 | */ |
Dianne Hackborn | c5bf758 | 2012-04-25 19:12:07 -0700 | [diff] [blame] | 2550 | @Deprecated @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2551 | public static final String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED"; |
| 2552 | /** |
| 2553 | * Broadcast Action: The current device {@link android.content.res.Configuration} |
| 2554 | * (orientation, locale, etc) has changed. When such a change happens, the |
| 2555 | * UIs (view hierarchy) will need to be rebuilt based on this new |
| 2556 | * information; for the most part, applications don't need to worry about |
| 2557 | * this, because the system will take care of stopping and restarting the |
| 2558 | * application to make sure it sees the new changes. Some system code that |
| 2559 | * can not be restarted will need to watch for this action and handle it |
| 2560 | * appropriately. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2561 | * |
Dianne Hackborn | 362d5b9 | 2009-11-11 18:04:39 -0800 | [diff] [blame] | 2562 | * <p class="note"> |
Casey Ho | dbf6785c | 2015-03-17 15:59:39 -0700 | [diff] [blame] | 2563 | * You <em>cannot</em> receive this through components declared |
Dianne Hackborn | 362d5b9 | 2009-11-11 18:04:39 -0800 | [diff] [blame] | 2564 | * in manifests, only by explicitly registering for it with |
| 2565 | * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
| 2566 | * Context.registerReceiver()}. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2567 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2568 | * <p class="note">This is a protected intent that can only be sent |
| 2569 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2570 | * |
| 2571 | * @see android.content.res.Configuration |
| 2572 | */ |
| 2573 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2574 | public static final String ACTION_CONFIGURATION_CHANGED = "android.intent.action.CONFIGURATION_CHANGED"; |
Adam Lesinski | 57fccd6 | 2018-01-25 13:03:57 -0800 | [diff] [blame] | 2575 | |
| 2576 | /** |
| 2577 | * Broadcast Action: The current device {@link android.content.res.Configuration} has changed |
| 2578 | * such that the device may be eligible for the installation of additional configuration splits. |
| 2579 | * Configuration properties that can trigger this broadcast include locale and display density. |
| 2580 | * |
| 2581 | * <p class="note"> |
| 2582 | * Unlike {@link #ACTION_CONFIGURATION_CHANGED}, you <em>can</em> receive this through |
| 2583 | * components declared in manifests. However, the receiver <em>must</em> hold the |
| 2584 | * {@link android.Manifest.permission#INSTALL_PACKAGES} permission. |
| 2585 | * |
| 2586 | * <p class="note"> |
| 2587 | * This is a protected intent that can only be sent by the system. |
| 2588 | * |
| 2589 | * @hide |
| 2590 | */ |
| 2591 | @SystemApi |
| 2592 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2593 | public static final String ACTION_SPLIT_CONFIGURATION_CHANGED = |
| 2594 | "android.intent.action.SPLIT_CONFIGURATION_CHANGED"; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2595 | /** |
Dianne Hackborn | 362d5b9 | 2009-11-11 18:04:39 -0800 | [diff] [blame] | 2596 | * Broadcast Action: The current device's locale has changed. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2597 | * |
Dianne Hackborn | 362d5b9 | 2009-11-11 18:04:39 -0800 | [diff] [blame] | 2598 | * <p class="note">This is a protected intent that can only be sent |
| 2599 | * by the system. |
| 2600 | */ |
| 2601 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2602 | public static final String ACTION_LOCALE_CHANGED = "android.intent.action.LOCALE_CHANGED"; |
| 2603 | /** |
Dianne Hackborn | edd9316 | 2009-09-19 14:03:05 -0700 | [diff] [blame] | 2604 | * Broadcast Action: This is a <em>sticky broadcast</em> containing the |
| 2605 | * charging state, level, and other information about the battery. |
| 2606 | * See {@link android.os.BatteryManager} for documentation on the |
| 2607 | * contents of the Intent. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 2608 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2609 | * <p class="note"> |
Casey Ho | dbf6785c | 2015-03-17 15:59:39 -0700 | [diff] [blame] | 2610 | * You <em>cannot</em> receive this through components declared |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2611 | * in manifests, only by explicitly registering for it with |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2612 | * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
Dianne Hackborn | edd9316 | 2009-09-19 14:03:05 -0700 | [diff] [blame] | 2613 | * Context.registerReceiver()}. See {@link #ACTION_BATTERY_LOW}, |
| 2614 | * {@link #ACTION_BATTERY_OKAY}, {@link #ACTION_POWER_CONNECTED}, |
| 2615 | * and {@link #ACTION_POWER_DISCONNECTED} for distinct battery-related |
| 2616 | * broadcasts that are sent and can be received through manifest |
| 2617 | * receivers. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2618 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2619 | * <p class="note">This is a protected intent that can only be sent |
| 2620 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2621 | */ |
| 2622 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2623 | public static final String ACTION_BATTERY_CHANGED = "android.intent.action.BATTERY_CHANGED"; |
Fyodor Kupolov | 70e7543 | 2018-03-01 18:29:06 -0800 | [diff] [blame] | 2624 | |
| 2625 | |
| 2626 | /** |
| 2627 | * Broadcast Action: Sent when the current battery level changes. |
| 2628 | * |
| 2629 | * It has {@link android.os.BatteryManager#EXTRA_EVENTS} that carries a list of {@link Bundle} |
| 2630 | * instances representing individual battery level changes with associated |
| 2631 | * extras from {@link #ACTION_BATTERY_CHANGED}. |
| 2632 | * |
| 2633 | * <p class="note"> |
| 2634 | * This broadcast requires {@link android.Manifest.permission#BATTERY_STATS} permission. |
| 2635 | * |
| 2636 | * @hide |
| 2637 | */ |
| 2638 | @SystemApi |
| 2639 | public static final String ACTION_BATTERY_LEVEL_CHANGED = |
| 2640 | "android.intent.action.BATTERY_LEVEL_CHANGED"; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2641 | /** |
| 2642 | * Broadcast Action: Indicates low battery condition on the device. |
| 2643 | * This broadcast corresponds to the "Low battery warning" system dialog. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2644 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2645 | * <p class="note">This is a protected intent that can only be sent |
| 2646 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2647 | */ |
| 2648 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2649 | public static final String ACTION_BATTERY_LOW = "android.intent.action.BATTERY_LOW"; |
| 2650 | /** |
Dianne Hackborn | 1dac277 | 2009-06-26 18:16:48 -0700 | [diff] [blame] | 2651 | * Broadcast Action: Indicates the battery is now okay after being low. |
| 2652 | * This will be sent after {@link #ACTION_BATTERY_LOW} once the battery has |
| 2653 | * gone back up to an okay state. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2654 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2655 | * <p class="note">This is a protected intent that can only be sent |
| 2656 | * by the system. |
Dianne Hackborn | 1dac277 | 2009-06-26 18:16:48 -0700 | [diff] [blame] | 2657 | */ |
| 2658 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2659 | public static final String ACTION_BATTERY_OKAY = "android.intent.action.BATTERY_OKAY"; |
| 2660 | /** |
Cliff Spradlin | fda6fae | 2008-10-22 20:29:16 -0700 | [diff] [blame] | 2661 | * Broadcast Action: External power has been connected to the device. |
| 2662 | * This is intended for applications that wish to register specifically to this notification. |
| 2663 | * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to |
| 2664 | * stay active to receive this notification. This action can be used to implement actions |
| 2665 | * that wait until power is available to trigger. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2666 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2667 | * <p class="note">This is a protected intent that can only be sent |
| 2668 | * by the system. |
Cliff Spradlin | fda6fae | 2008-10-22 20:29:16 -0700 | [diff] [blame] | 2669 | */ |
| 2670 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Dianne Hackborn | fe240ec | 2009-08-27 12:51:11 -0700 | [diff] [blame] | 2671 | public static final String ACTION_POWER_CONNECTED = "android.intent.action.ACTION_POWER_CONNECTED"; |
Cliff Spradlin | fda6fae | 2008-10-22 20:29:16 -0700 | [diff] [blame] | 2672 | /** |
| 2673 | * Broadcast Action: External power has been removed from the device. |
| 2674 | * This is intended for applications that wish to register specifically to this notification. |
| 2675 | * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to |
| 2676 | * stay active to receive this notification. This action can be used to implement actions |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 2677 | * that wait until power is available to trigger. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2678 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2679 | * <p class="note">This is a protected intent that can only be sent |
| 2680 | * by the system. |
Cliff Spradlin | fda6fae | 2008-10-22 20:29:16 -0700 | [diff] [blame] | 2681 | */ |
| 2682 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Jean-Baptiste Queru | 1ef4564 | 2008-10-24 11:49:25 -0700 | [diff] [blame] | 2683 | public static final String ACTION_POWER_DISCONNECTED = |
Dianne Hackborn | fe240ec | 2009-08-27 12:51:11 -0700 | [diff] [blame] | 2684 | "android.intent.action.ACTION_POWER_DISCONNECTED"; |
Cliff Spradlin | fda6fae | 2008-10-22 20:29:16 -0700 | [diff] [blame] | 2685 | /** |
Dianne Hackborn | 55280a9 | 2009-05-07 15:53:46 -0700 | [diff] [blame] | 2686 | * Broadcast Action: Device is shutting down. |
| 2687 | * This is broadcast when the device is being shut down (completely turned |
| 2688 | * off, not sleeping). Once the broadcast is complete, the final shutdown |
| 2689 | * will proceed and all unsaved data lost. Apps will not normally need |
Dianne Hackborn | fe240ec | 2009-08-27 12:51:11 -0700 | [diff] [blame] | 2690 | * to handle this, since the foreground activity will be paused as well. |
Fyodor Kupolov | 1fc6260 | 2018-02-01 15:48:53 -0800 | [diff] [blame] | 2691 | * <p>As of {@link Build.VERSION_CODES#P} this broadcast is only sent to receivers registered |
| 2692 | * through {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
| 2693 | * Context.registerReceiver}. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2694 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2695 | * <p class="note">This is a protected intent that can only be sent |
| 2696 | * by the system. |
Dianne Hackborn | 57a7f59 | 2013-07-22 18:21:32 -0700 | [diff] [blame] | 2697 | * <p>May include the following extras: |
| 2698 | * <ul> |
| 2699 | * <li> {@link #EXTRA_SHUTDOWN_USERSPACE_ONLY} a boolean that is set to true if this |
| 2700 | * shutdown is only for userspace processes. If not set, assumed to be false. |
| 2701 | * </ul> |
Dianne Hackborn | 55280a9 | 2009-05-07 15:53:46 -0700 | [diff] [blame] | 2702 | */ |
| 2703 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 2704 | public static final String ACTION_SHUTDOWN = "android.intent.action.ACTION_SHUTDOWN"; |
Dianne Hackborn | 55280a9 | 2009-05-07 15:53:46 -0700 | [diff] [blame] | 2705 | /** |
Mike Lockwood | bad80e0 | 2009-07-30 01:21:08 -0700 | [diff] [blame] | 2706 | * Activity Action: Start this activity to request system shutdown. |
| 2707 | * The optional boolean extra field {@link #EXTRA_KEY_CONFIRM} can be set to true |
Yusuke Sato | 705ffd1 | 2015-07-21 15:52:11 -0700 | [diff] [blame] | 2708 | * to request confirmation from the user before shutting down. The optional boolean |
| 2709 | * extra field {@link #EXTRA_USER_REQUESTED_SHUTDOWN} can be set to true to |
| 2710 | * indicate that the shutdown is requested by the user. |
Mike Lockwood | bad80e0 | 2009-07-30 01:21:08 -0700 | [diff] [blame] | 2711 | * |
| 2712 | * <p class="note">This is a protected intent that can only be sent |
| 2713 | * by the system. |
| 2714 | * |
| 2715 | * {@hide} |
| 2716 | */ |
Sudheer Shanka | 218190a | 2017-03-30 16:07:54 -0700 | [diff] [blame] | 2717 | public static final String ACTION_REQUEST_SHUTDOWN |
| 2718 | = "com.android.internal.intent.action.REQUEST_SHUTDOWN"; |
Mike Lockwood | bad80e0 | 2009-07-30 01:21:08 -0700 | [diff] [blame] | 2719 | /** |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2720 | * Broadcast Action: A sticky broadcast that indicates low storage space |
Dianne Hackborn | edd9316 | 2009-09-19 14:03:05 -0700 | [diff] [blame] | 2721 | * condition on the device |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2722 | * <p class="note"> |
| 2723 | * This is a protected intent that can only be sent by the system. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2724 | * |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2725 | * @deprecated if your app targets {@link android.os.Build.VERSION_CODES#O} |
| 2726 | * or above, this broadcast will no longer be delivered to any |
| 2727 | * {@link BroadcastReceiver} defined in your manifest. Instead, |
| 2728 | * apps are strongly encouraged to use the improved |
| 2729 | * {@link Context#getCacheDir()} behavior so the system can |
| 2730 | * automatically free up storage when needed. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2731 | */ |
| 2732 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2733 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2734 | public static final String ACTION_DEVICE_STORAGE_LOW = "android.intent.action.DEVICE_STORAGE_LOW"; |
| 2735 | /** |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2736 | * Broadcast Action: Indicates low storage space condition on the device no |
| 2737 | * longer exists |
| 2738 | * <p class="note"> |
| 2739 | * This is a protected intent that can only be sent by the system. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2740 | * |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2741 | * @deprecated if your app targets {@link android.os.Build.VERSION_CODES#O} |
| 2742 | * or above, this broadcast will no longer be delivered to any |
| 2743 | * {@link BroadcastReceiver} defined in your manifest. Instead, |
| 2744 | * apps are strongly encouraged to use the improved |
| 2745 | * {@link Context#getCacheDir()} behavior so the system can |
| 2746 | * automatically free up storage when needed. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2747 | */ |
| 2748 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2749 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2750 | public static final String ACTION_DEVICE_STORAGE_OK = "android.intent.action.DEVICE_STORAGE_OK"; |
| 2751 | /** |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2752 | * Broadcast Action: A sticky broadcast that indicates a storage space full |
| 2753 | * condition on the device. This is intended for activities that want to be |
| 2754 | * able to fill the data partition completely, leaving only enough free |
| 2755 | * space to prevent system-wide SQLite failures. |
| 2756 | * <p class="note"> |
| 2757 | * This is a protected intent that can only be sent by the system. |
Jake Hamby | bb37163 | 2010-08-23 18:16:48 -0700 | [diff] [blame] | 2758 | * |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2759 | * @deprecated if your app targets {@link android.os.Build.VERSION_CODES#O} |
| 2760 | * or above, this broadcast will no longer be delivered to any |
| 2761 | * {@link BroadcastReceiver} defined in your manifest. Instead, |
| 2762 | * apps are strongly encouraged to use the improved |
| 2763 | * {@link Context#getCacheDir()} behavior so the system can |
| 2764 | * automatically free up storage when needed. |
| 2765 | * @hide |
Jake Hamby | bb37163 | 2010-08-23 18:16:48 -0700 | [diff] [blame] | 2766 | */ |
| 2767 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2768 | @Deprecated |
Jake Hamby | bb37163 | 2010-08-23 18:16:48 -0700 | [diff] [blame] | 2769 | public static final String ACTION_DEVICE_STORAGE_FULL = "android.intent.action.DEVICE_STORAGE_FULL"; |
| 2770 | /** |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2771 | * Broadcast Action: Indicates storage space full condition on the device no |
| 2772 | * longer exists. |
| 2773 | * <p class="note"> |
| 2774 | * This is a protected intent that can only be sent by the system. |
Jake Hamby | bb37163 | 2010-08-23 18:16:48 -0700 | [diff] [blame] | 2775 | * |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2776 | * @deprecated if your app targets {@link android.os.Build.VERSION_CODES#O} |
| 2777 | * or above, this broadcast will no longer be delivered to any |
| 2778 | * {@link BroadcastReceiver} defined in your manifest. Instead, |
| 2779 | * apps are strongly encouraged to use the improved |
| 2780 | * {@link Context#getCacheDir()} behavior so the system can |
| 2781 | * automatically free up storage when needed. |
| 2782 | * @hide |
Jake Hamby | bb37163 | 2010-08-23 18:16:48 -0700 | [diff] [blame] | 2783 | */ |
| 2784 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2785 | @Deprecated |
Jake Hamby | bb37163 | 2010-08-23 18:16:48 -0700 | [diff] [blame] | 2786 | public static final String ACTION_DEVICE_STORAGE_NOT_FULL = "android.intent.action.DEVICE_STORAGE_NOT_FULL"; |
| 2787 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2788 | * Broadcast Action: Indicates low memory condition notification acknowledged by user |
| 2789 | * and package management should be started. |
| 2790 | * This is triggered by the user from the ACTION_DEVICE_STORAGE_LOW |
| 2791 | * notification. |
| 2792 | */ |
| 2793 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2794 | public static final String ACTION_MANAGE_PACKAGE_STORAGE = "android.intent.action.MANAGE_PACKAGE_STORAGE"; |
| 2795 | /** |
| 2796 | * Broadcast Action: The device has entered USB Mass Storage mode. |
| 2797 | * This is used mainly for the USB Settings panel. |
| 2798 | * Apps should listen for ACTION_MEDIA_MOUNTED and ACTION_MEDIA_UNMOUNTED broadcasts to be notified |
| 2799 | * when the SD card file system is mounted or unmounted |
Mike Lockwood | 7e4db37 | 2011-06-07 11:23:44 -0700 | [diff] [blame] | 2800 | * @deprecated replaced by android.os.storage.StorageEventListener |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2801 | */ |
Mike Lockwood | da85e52 | 2011-06-07 09:08:34 -0700 | [diff] [blame] | 2802 | @Deprecated |
Jeff Sharkey | 0f3f60b | 2017-04-24 18:06:20 -0600 | [diff] [blame] | 2803 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2804 | public static final String ACTION_UMS_CONNECTED = "android.intent.action.UMS_CONNECTED"; |
| 2805 | |
| 2806 | /** |
| 2807 | * Broadcast Action: The device has exited USB Mass Storage mode. |
| 2808 | * This is used mainly for the USB Settings panel. |
| 2809 | * Apps should listen for ACTION_MEDIA_MOUNTED and ACTION_MEDIA_UNMOUNTED broadcasts to be notified |
| 2810 | * when the SD card file system is mounted or unmounted |
Mike Lockwood | 7e4db37 | 2011-06-07 11:23:44 -0700 | [diff] [blame] | 2811 | * @deprecated replaced by android.os.storage.StorageEventListener |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2812 | */ |
Mike Lockwood | da85e52 | 2011-06-07 09:08:34 -0700 | [diff] [blame] | 2813 | @Deprecated |
Jeff Sharkey | 0f3f60b | 2017-04-24 18:06:20 -0600 | [diff] [blame] | 2814 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2815 | public static final String ACTION_UMS_DISCONNECTED = "android.intent.action.UMS_DISCONNECTED"; |
| 2816 | |
| 2817 | /** |
| 2818 | * Broadcast Action: External media has been removed. |
| 2819 | * The path to the mount point for the removed media is contained in the Intent.mData field. |
| 2820 | */ |
| 2821 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2822 | public static final String ACTION_MEDIA_REMOVED = "android.intent.action.MEDIA_REMOVED"; |
| 2823 | |
| 2824 | /** |
| 2825 | * Broadcast Action: External media is present, but not mounted at its mount point. |
suyi Yuan | be7af83 | 2013-01-04 21:21:59 +0800 | [diff] [blame] | 2826 | * The path to the mount point for the unmounted media is contained in the Intent.mData field. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2827 | */ |
| 2828 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2829 | public static final String ACTION_MEDIA_UNMOUNTED = "android.intent.action.MEDIA_UNMOUNTED"; |
| 2830 | |
| 2831 | /** |
The Android Open Source Project | f1e484a | 2009-01-22 00:13:42 -0800 | [diff] [blame] | 2832 | * Broadcast Action: External media is present, and being disk-checked |
| 2833 | * The path to the mount point for the checking media is contained in the Intent.mData field. |
The Android Open Source Project | f1e484a | 2009-01-22 00:13:42 -0800 | [diff] [blame] | 2834 | */ |
| 2835 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2836 | public static final String ACTION_MEDIA_CHECKING = "android.intent.action.MEDIA_CHECKING"; |
| 2837 | |
| 2838 | /** |
| 2839 | * Broadcast Action: External media is present, but is using an incompatible fs (or is blank) |
| 2840 | * The path to the mount point for the checking media is contained in the Intent.mData field. |
The Android Open Source Project | f1e484a | 2009-01-22 00:13:42 -0800 | [diff] [blame] | 2841 | */ |
| 2842 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2843 | public static final String ACTION_MEDIA_NOFS = "android.intent.action.MEDIA_NOFS"; |
| 2844 | |
| 2845 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2846 | * Broadcast Action: External media is present and mounted at its mount point. |
suyi Yuan | be7af83 | 2013-01-04 21:21:59 +0800 | [diff] [blame] | 2847 | * The path to the mount point for the mounted media is contained in the Intent.mData field. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2848 | * The Intent contains an extra with name "read-only" and Boolean value to indicate if the |
| 2849 | * media was mounted read only. |
| 2850 | */ |
| 2851 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2852 | public static final String ACTION_MEDIA_MOUNTED = "android.intent.action.MEDIA_MOUNTED"; |
| 2853 | |
| 2854 | /** |
| 2855 | * Broadcast Action: External media is unmounted because it is being shared via USB mass storage. |
Mike Lockwood | bf2dd44 | 2010-03-03 06:16:52 -0500 | [diff] [blame] | 2856 | * The path to the mount point for the shared media is contained in the Intent.mData field. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2857 | */ |
| 2858 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2859 | public static final String ACTION_MEDIA_SHARED = "android.intent.action.MEDIA_SHARED"; |
| 2860 | |
| 2861 | /** |
Mike Lockwood | bf2dd44 | 2010-03-03 06:16:52 -0500 | [diff] [blame] | 2862 | * Broadcast Action: External media is no longer being shared via USB mass storage. |
| 2863 | * The path to the mount point for the previously shared media is contained in the Intent.mData field. |
| 2864 | * |
| 2865 | * @hide |
| 2866 | */ |
| 2867 | public static final String ACTION_MEDIA_UNSHARED = "android.intent.action.MEDIA_UNSHARED"; |
| 2868 | |
| 2869 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2870 | * Broadcast Action: External media was removed from SD card slot, but mount point was not unmounted. |
| 2871 | * The path to the mount point for the removed media is contained in the Intent.mData field. |
| 2872 | */ |
| 2873 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2874 | public static final String ACTION_MEDIA_BAD_REMOVAL = "android.intent.action.MEDIA_BAD_REMOVAL"; |
| 2875 | |
| 2876 | /** |
| 2877 | * Broadcast Action: External media is present but cannot be mounted. |
suyi Yuan | be7af83 | 2013-01-04 21:21:59 +0800 | [diff] [blame] | 2878 | * The path to the mount point for the unmountable media is contained in the Intent.mData field. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2879 | */ |
| 2880 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2881 | public static final String ACTION_MEDIA_UNMOUNTABLE = "android.intent.action.MEDIA_UNMOUNTABLE"; |
| 2882 | |
| 2883 | /** |
| 2884 | * Broadcast Action: User has expressed the desire to remove the external storage media. |
| 2885 | * Applications should close all files they have open within the mount point when they receive this intent. |
| 2886 | * The path to the mount point for the media to be ejected is contained in the Intent.mData field. |
| 2887 | */ |
| 2888 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2889 | public static final String ACTION_MEDIA_EJECT = "android.intent.action.MEDIA_EJECT"; |
| 2890 | |
| 2891 | /** |
| 2892 | * Broadcast Action: The media scanner has started scanning a directory. |
| 2893 | * The path to the directory being scanned is contained in the Intent.mData field. |
| 2894 | */ |
| 2895 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2896 | public static final String ACTION_MEDIA_SCANNER_STARTED = "android.intent.action.MEDIA_SCANNER_STARTED"; |
| 2897 | |
| 2898 | /** |
| 2899 | * Broadcast Action: The media scanner has finished scanning a directory. |
| 2900 | * The path to the scanned directory is contained in the Intent.mData field. |
| 2901 | */ |
| 2902 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2903 | public static final String ACTION_MEDIA_SCANNER_FINISHED = "android.intent.action.MEDIA_SCANNER_FINISHED"; |
| 2904 | |
| 2905 | /** |
| 2906 | * Broadcast Action: Request the media scanner to scan a file and add it to the media database. |
| 2907 | * The path to the file is contained in the Intent.mData field. |
| 2908 | */ |
| 2909 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2910 | public static final String ACTION_MEDIA_SCANNER_SCAN_FILE = "android.intent.action.MEDIA_SCANNER_SCAN_FILE"; |
| 2911 | |
| 2912 | /** |
| 2913 | * Broadcast Action: The "Media Button" was pressed. Includes a single |
| 2914 | * extra field, {@link #EXTRA_KEY_EVENT}, containing the key event that |
| 2915 | * caused the broadcast. |
| 2916 | */ |
| 2917 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2918 | public static final String ACTION_MEDIA_BUTTON = "android.intent.action.MEDIA_BUTTON"; |
| 2919 | |
| 2920 | /** |
| 2921 | * Broadcast Action: The "Camera Button" was pressed. Includes a single |
| 2922 | * extra field, {@link #EXTRA_KEY_EVENT}, containing the key event that |
| 2923 | * caused the broadcast. |
| 2924 | */ |
| 2925 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2926 | public static final String ACTION_CAMERA_BUTTON = "android.intent.action.CAMERA_BUTTON"; |
| 2927 | |
| 2928 | // *** NOTE: @todo(*) The following really should go into a more domain-specific |
| 2929 | // location; they are not general-purpose actions. |
| 2930 | |
| 2931 | /** |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 2932 | * Broadcast Action: A GTalk connection has been established. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2933 | */ |
| 2934 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2935 | public static final String ACTION_GTALK_SERVICE_CONNECTED = |
| 2936 | "android.intent.action.GTALK_CONNECTED"; |
| 2937 | |
| 2938 | /** |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 2939 | * Broadcast Action: A GTalk connection has been disconnected. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2940 | */ |
| 2941 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2942 | public static final String ACTION_GTALK_SERVICE_DISCONNECTED = |
| 2943 | "android.intent.action.GTALK_DISCONNECTED"; |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 2944 | |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 2945 | /** |
| 2946 | * Broadcast Action: An input method has been changed. |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 2947 | */ |
| 2948 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2949 | public static final String ACTION_INPUT_METHOD_CHANGED = |
| 2950 | "android.intent.action.INPUT_METHOD_CHANGED"; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2951 | |
| 2952 | /** |
| 2953 | * <p>Broadcast Action: The user has switched the phone into or out of Airplane Mode. One or |
| 2954 | * more radios have been turned off or on. The intent will have the following extra value:</p> |
| 2955 | * <ul> |
| 2956 | * <li><em>state</em> - A boolean value indicating whether Airplane Mode is on. If true, |
| 2957 | * then cell radio and possibly other radios such as bluetooth or WiFi may have also been |
| 2958 | * turned off</li> |
| 2959 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2960 | * |
Peng Xu | a35b553 | 2016-01-20 00:05:45 -0800 | [diff] [blame] | 2961 | * <p class="note">This is a protected intent that can only be sent by the system.</p> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2962 | */ |
| 2963 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2964 | public static final String ACTION_AIRPLANE_MODE_CHANGED = "android.intent.action.AIRPLANE_MODE"; |
| 2965 | |
| 2966 | /** |
| 2967 | * Broadcast Action: Some content providers have parts of their namespace |
| 2968 | * where they publish new events or items that the user may be especially |
| 2969 | * interested in. For these things, they may broadcast this action when the |
| 2970 | * set of interesting items change. |
| 2971 | * |
| 2972 | * For example, GmailProvider sends this notification when the set of unread |
| 2973 | * mail in the inbox changes. |
| 2974 | * |
| 2975 | * <p>The data of the intent identifies which part of which provider |
| 2976 | * changed. When queried through the content resolver, the data URI will |
| 2977 | * return the data set in question. |
| 2978 | * |
| 2979 | * <p>The intent will have the following extra values: |
| 2980 | * <ul> |
| 2981 | * <li><em>count</em> - The number of items in the data set. This is the |
| 2982 | * same as the number of items in the cursor returned by querying the |
| 2983 | * data URI. </li> |
| 2984 | * </ul> |
| 2985 | * |
| 2986 | * This intent will be sent at boot (if the count is non-zero) and when the |
| 2987 | * data set changes. It is possible for the data set to change without the |
| 2988 | * count changing (for example, if a new unread message arrives in the same |
| 2989 | * sync operation in which a message is archived). The phone should still |
| 2990 | * ring/vibrate/etc as normal in this case. |
| 2991 | */ |
| 2992 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2993 | public static final String ACTION_PROVIDER_CHANGED = |
| 2994 | "android.intent.action.PROVIDER_CHANGED"; |
| 2995 | |
| 2996 | /** |
| 2997 | * Broadcast Action: Wired Headset plugged in or unplugged. |
| 2998 | * |
Jean-Michel Trivi | c525843 | 2014-08-27 15:46:54 -0700 | [diff] [blame] | 2999 | * Same as {@link android.media.AudioManager#ACTION_HEADSET_PLUG}, to be consulted for value |
| 3000 | * and documentation. |
| 3001 | * <p>If the minimum SDK version of your application is |
Dianne Hackborn | 955d8d6 | 2014-10-07 20:17:19 -0700 | [diff] [blame] | 3002 | * {@link android.os.Build.VERSION_CODES#LOLLIPOP}, it is recommended to refer |
Jean-Michel Trivi | c525843 | 2014-08-27 15:46:54 -0700 | [diff] [blame] | 3003 | * to the <code>AudioManager</code> constant in your receiver registration code instead. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 3004 | */ |
| 3005 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Jean-Michel Trivi | c525843 | 2014-08-27 15:46:54 -0700 | [diff] [blame] | 3006 | public static final String ACTION_HEADSET_PLUG = android.media.AudioManager.ACTION_HEADSET_PLUG; |
Eric Laurent | 59f4827 | 2012-04-05 19:42:21 -0700 | [diff] [blame] | 3007 | |
| 3008 | /** |
Joe Onorato | 9cdffa1 | 2011-04-06 18:27:27 -0700 | [diff] [blame] | 3009 | * <p>Broadcast Action: The user has switched on advanced settings in the settings app:</p> |
| 3010 | * <ul> |
| 3011 | * <li><em>state</em> - A boolean value indicating whether the settings is on or off.</li> |
| 3012 | * </ul> |
| 3013 | * |
| 3014 | * <p class="note">This is a protected intent that can only be sent |
| 3015 | * by the system. |
| 3016 | * |
| 3017 | * @hide |
| 3018 | */ |
| 3019 | //@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3020 | public static final String ACTION_ADVANCED_SETTINGS_CHANGED |
| 3021 | = "android.intent.action.ADVANCED_SETTINGS"; |
| 3022 | |
| 3023 | /** |
Robin Lee | 66e5d96 | 2014-04-09 16:44:21 +0100 | [diff] [blame] | 3024 | * Broadcast Action: Sent after application restrictions are changed. |
| 3025 | * |
| 3026 | * <p class="note">This is a protected intent that can only be sent |
| 3027 | * by the system.</p> |
| 3028 | */ |
| 3029 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3030 | public static final String ACTION_APPLICATION_RESTRICTIONS_CHANGED = |
| 3031 | "android.intent.action.APPLICATION_RESTRICTIONS_CHANGED"; |
| 3032 | |
| 3033 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 3034 | * Broadcast Action: An outgoing call is about to be placed. |
| 3035 | * |
Dirk Dougherty | 367ce90 | 2013-05-28 17:37:12 -0700 | [diff] [blame] | 3036 | * <p>The Intent will have the following extra value:</p> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 3037 | * <ul> |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 3038 | * <li><em>{@link android.content.Intent#EXTRA_PHONE_NUMBER}</em> - |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 3039 | * the phone number originally intended to be dialed.</li> |
| 3040 | * </ul> |
| 3041 | * <p>Once the broadcast is finished, the resultData is used as the actual |
| 3042 | * number to call. If <code>null</code>, no call will be placed.</p> |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 3043 | * <p>It is perfectly acceptable for multiple receivers to process the |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 3044 | * outgoing call in turn: for example, a parental control application |
| 3045 | * might verify that the user is authorized to place the call at that |
| 3046 | * time, then a number-rewriting application might add an area code if |
| 3047 | * one was not specified.</p> |
| 3048 | * <p>For consistency, any receiver whose purpose is to prohibit phone |
| 3049 | * calls should have a priority of 0, to ensure it will see the final |
| 3050 | * phone number to be dialed. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 3051 | * Any receiver whose purpose is to rewrite phone numbers to be called |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 3052 | * should have a positive priority. |
| 3053 | * Negative priorities are reserved for the system for this broadcast; |
| 3054 | * using them may cause problems.</p> |
Dirk Dougherty | 932fbcc | 2013-05-29 15:19:14 -0700 | [diff] [blame] | 3055 | * <p>Any BroadcastReceiver receiving this Intent <em>must not</em> |
| 3056 | * abort the broadcast.</p> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 3057 | * <p>Emergency calls cannot be intercepted using this mechanism, and |
| 3058 | * other calls cannot be modified to call emergency numbers using this |
| 3059 | * mechanism. |
Santos Cordon | ba70136 | 2013-05-17 14:48:54 -0700 | [diff] [blame] | 3060 | * <p>Some apps (such as VoIP apps) may want to redirect the outgoing |
| 3061 | * call to use their own service instead. Those apps should first prevent |
| 3062 | * the call from being placed by setting resultData to <code>null</code> |
| 3063 | * and then start their own app to make the call. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 3064 | * <p>You must hold the |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 3065 | * {@link android.Manifest.permission#PROCESS_OUTGOING_CALLS} |
| 3066 | * permission to receive this Intent.</p> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 3067 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 3068 | * <p class="note">This is a protected intent that can only be sent |
| 3069 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 3070 | */ |
| 3071 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3072 | public static final String ACTION_NEW_OUTGOING_CALL = |
| 3073 | "android.intent.action.NEW_OUTGOING_CALL"; |
| 3074 | |
| 3075 | /** |
| 3076 | * Broadcast Action: Have the device reboot. This is only for use by |
| 3077 | * system code. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 3078 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 3079 | * <p class="note">This is a protected intent that can only be sent |
| 3080 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 3081 | */ |
| 3082 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3083 | public static final String ACTION_REBOOT = |
| 3084 | "android.intent.action.REBOOT"; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3085 | |
Wei Huang | 97ecc9c | 2009-05-11 17:44:20 -0700 | [diff] [blame] | 3086 | /** |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 3087 | * Broadcast Action: A sticky broadcast for changes in the physical |
| 3088 | * docking state of the device. |
Tobias Haamel | 154f7a1 | 2010-02-17 11:56:39 -0800 | [diff] [blame] | 3089 | * |
| 3090 | * <p>The intent will have the following extra values: |
| 3091 | * <ul> |
| 3092 | * <li><em>{@link #EXTRA_DOCK_STATE}</em> - the current dock |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 3093 | * state, indicating which dock the device is physically in.</li> |
Tobias Haamel | 154f7a1 | 2010-02-17 11:56:39 -0800 | [diff] [blame] | 3094 | * </ul> |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 3095 | * <p>This is intended for monitoring the current physical dock state. |
| 3096 | * See {@link android.app.UiModeManager} for the normal API dealing with |
| 3097 | * dock mode changes. |
Dianne Hackborn | edd9316 | 2009-09-19 14:03:05 -0700 | [diff] [blame] | 3098 | */ |
| 3099 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3100 | public static final String ACTION_DOCK_EVENT = |
| 3101 | "android.intent.action.DOCK_EVENT"; |
| 3102 | |
| 3103 | /** |
Svetoslav | b3038ec | 2013-02-13 14:39:30 -0800 | [diff] [blame] | 3104 | * Broadcast Action: A broadcast when idle maintenance can be started. |
| 3105 | * This means that the user is not interacting with the device and is |
| 3106 | * not expected to do so soon. Typical use of the idle maintenance is |
| 3107 | * to perform somehow expensive tasks that can be postponed at a moment |
| 3108 | * when they will not degrade user experience. |
| 3109 | * <p> |
| 3110 | * <p class="note">In order to keep the device responsive in case of an |
| 3111 | * unexpected user interaction, implementations of a maintenance task |
| 3112 | * should be interruptible. In such a scenario a broadcast with action |
| 3113 | * {@link #ACTION_IDLE_MAINTENANCE_END} will be sent. In other words, you |
| 3114 | * should not do the maintenance work in |
| 3115 | * {@link BroadcastReceiver#onReceive(Context, Intent)}, rather start a |
| 3116 | * maintenance service by {@link Context#startService(Intent)}. Also |
| 3117 | * you should hold a wake lock while your maintenance service is running |
| 3118 | * to prevent the device going to sleep. |
| 3119 | * </p> |
| 3120 | * <p> |
| 3121 | * <p class="note">This is a protected intent that can only be sent by |
| 3122 | * the system. |
| 3123 | * </p> |
| 3124 | * |
| 3125 | * @see #ACTION_IDLE_MAINTENANCE_END |
Svetoslav | 6a08a12 | 2013-05-03 11:24:26 -0700 | [diff] [blame] | 3126 | * |
| 3127 | * @hide |
Svetoslav | b3038ec | 2013-02-13 14:39:30 -0800 | [diff] [blame] | 3128 | */ |
| 3129 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3130 | public static final String ACTION_IDLE_MAINTENANCE_START = |
| 3131 | "android.intent.action.ACTION_IDLE_MAINTENANCE_START"; |
| 3132 | |
| 3133 | /** |
| 3134 | * Broadcast Action: A broadcast when idle maintenance should be stopped. |
| 3135 | * This means that the user was not interacting with the device as a result |
| 3136 | * of which a broadcast with action {@link #ACTION_IDLE_MAINTENANCE_START} |
| 3137 | * was sent and now the user started interacting with the device. Typical |
| 3138 | * use of the idle maintenance is to perform somehow expensive tasks that |
| 3139 | * can be postponed at a moment when they will not degrade user experience. |
| 3140 | * <p> |
| 3141 | * <p class="note">In order to keep the device responsive in case of an |
| 3142 | * unexpected user interaction, implementations of a maintenance task |
| 3143 | * should be interruptible. Hence, on receiving a broadcast with this |
| 3144 | * action, the maintenance task should be interrupted as soon as possible. |
| 3145 | * In other words, you should not do the maintenance work in |
| 3146 | * {@link BroadcastReceiver#onReceive(Context, Intent)}, rather stop the |
| 3147 | * maintenance service that was started on receiving of |
| 3148 | * {@link #ACTION_IDLE_MAINTENANCE_START}.Also you should release the wake |
| 3149 | * lock you acquired when your maintenance service started. |
| 3150 | * </p> |
| 3151 | * <p class="note">This is a protected intent that can only be sent |
| 3152 | * by the system. |
| 3153 | * |
| 3154 | * @see #ACTION_IDLE_MAINTENANCE_START |
Svetoslav | 6a08a12 | 2013-05-03 11:24:26 -0700 | [diff] [blame] | 3155 | * |
| 3156 | * @hide |
Svetoslav | b3038ec | 2013-02-13 14:39:30 -0800 | [diff] [blame] | 3157 | */ |
| 3158 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3159 | public static final String ACTION_IDLE_MAINTENANCE_END = |
| 3160 | "android.intent.action.ACTION_IDLE_MAINTENANCE_END"; |
| 3161 | |
| 3162 | /** |
Wei Huang | 97ecc9c | 2009-05-11 17:44:20 -0700 | [diff] [blame] | 3163 | * Broadcast Action: a remote intent is to be broadcasted. |
| 3164 | * |
| 3165 | * A remote intent is used for remote RPC between devices. The remote intent |
| 3166 | * is serialized and sent from one device to another device. The receiving |
| 3167 | * device parses the remote intent and broadcasts it. Note that anyone can |
| 3168 | * broadcast a remote intent. However, if the intent receiver of the remote intent |
| 3169 | * does not trust intent broadcasts from arbitrary intent senders, it should require |
| 3170 | * the sender to hold certain permissions so only trusted sender's broadcast will be |
| 3171 | * let through. |
Dianne Hackborn | edd9316 | 2009-09-19 14:03:05 -0700 | [diff] [blame] | 3172 | * @hide |
Wei Huang | 97ecc9c | 2009-05-11 17:44:20 -0700 | [diff] [blame] | 3173 | */ |
| 3174 | public static final String ACTION_REMOTE_INTENT = |
Costin Manolache | 8d83f9e | 2010-05-12 16:04:10 -0700 | [diff] [blame] | 3175 | "com.google.android.c2dm.intent.RECEIVE"; |
Wei Huang | 97ecc9c | 2009-05-11 17:44:20 -0700 | [diff] [blame] | 3176 | |
Dianne Hackborn | 9acc030 | 2009-08-25 00:27:12 -0700 | [diff] [blame] | 3177 | /** |
Jeff Sharkey | bd91e2f | 2016-03-22 15:32:31 -0600 | [diff] [blame] | 3178 | * Broadcast Action: This is broadcast once when the user is booting after a |
| 3179 | * system update. It can be used to perform cleanup or upgrades after a |
| 3180 | * system update. |
| 3181 | * <p> |
| 3182 | * This broadcast is sent after the {@link #ACTION_LOCKED_BOOT_COMPLETED} |
| 3183 | * broadcast but before the {@link #ACTION_BOOT_COMPLETED} broadcast. It's |
| 3184 | * only sent when the {@link Build#FINGERPRINT} has changed, and it's only |
| 3185 | * sent to receivers in the system image. |
Dianne Hackborn | 9acc030 | 2009-08-25 00:27:12 -0700 | [diff] [blame] | 3186 | * |
Dianne Hackborn | 9acc030 | 2009-08-25 00:27:12 -0700 | [diff] [blame] | 3187 | * @hide |
| 3188 | */ |
Amith Yamasani | cbabb8d | 2017-02-17 16:50:05 -0800 | [diff] [blame] | 3189 | @SystemApi |
Dianne Hackborn | 9acc030 | 2009-08-25 00:27:12 -0700 | [diff] [blame] | 3190 | public static final String ACTION_PRE_BOOT_COMPLETED = |
| 3191 | "android.intent.action.PRE_BOOT_COMPLETED"; |
| 3192 | |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 3193 | /** |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 3194 | * Broadcast to a specific application to query any supported restrictions to impose |
Amith Yamasani | 7e99bc0 | 2013-04-16 18:24:51 -0700 | [diff] [blame] | 3195 | * on restricted users. The broadcast intent contains an extra |
| 3196 | * {@link #EXTRA_RESTRICTIONS_BUNDLE} with the currently persisted |
| 3197 | * restrictions as a Bundle of key/value pairs. The value types can be Boolean, String or |
| 3198 | * String[] depending on the restriction type.<p/> |
| 3199 | * The response should contain an extra {@link #EXTRA_RESTRICTIONS_LIST}, |
Amith Yamasani | 86118ba | 2013-03-28 14:33:16 -0700 | [diff] [blame] | 3200 | * which is of type <code>ArrayList<RestrictionEntry></code>. It can also |
| 3201 | * contain an extra {@link #EXTRA_RESTRICTIONS_INTENT}, which is of type <code>Intent</code>. |
| 3202 | * The activity specified by that intent will be launched for a result which must contain |
Amith Yamasani | 3b458ad | 2013-04-18 18:40:07 -0700 | [diff] [blame] | 3203 | * one of the extras {@link #EXTRA_RESTRICTIONS_LIST} or {@link #EXTRA_RESTRICTIONS_BUNDLE}. |
| 3204 | * The keys and values of the returned restrictions will be persisted. |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 3205 | * @see RestrictionEntry |
| 3206 | */ |
| 3207 | public static final String ACTION_GET_RESTRICTION_ENTRIES = |
| 3208 | "android.intent.action.GET_RESTRICTION_ENTRIES"; |
| 3209 | |
| 3210 | /** |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3211 | * Sent the first time a user is starting, to allow system apps to |
| 3212 | * perform one time initialization. (This will not be seen by third |
| 3213 | * party applications because a newly initialized user does not have any |
| 3214 | * third party applications installed for it.) This is sent early in |
| 3215 | * starting the user, around the time the home app is started, before |
Dianne Hackborn | 36d337a | 2012-10-08 14:33:47 -0700 | [diff] [blame] | 3216 | * {@link #ACTION_BOOT_COMPLETED} is sent. This is sent as a foreground |
| 3217 | * broadcast, since it is part of a visible user interaction; be as quick |
| 3218 | * as possible when handling it. |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3219 | */ |
| 3220 | public static final String ACTION_USER_INITIALIZE = |
| 3221 | "android.intent.action.USER_INITIALIZE"; |
| 3222 | |
| 3223 | /** |
| 3224 | * Sent when a user switch is happening, causing the process's user to be |
| 3225 | * brought to the foreground. This is only sent to receivers registered |
| 3226 | * through {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
| 3227 | * Context.registerReceiver}. It is sent to the user that is going to the |
Dianne Hackborn | 36d337a | 2012-10-08 14:33:47 -0700 | [diff] [blame] | 3228 | * foreground. This is sent as a foreground |
| 3229 | * broadcast, since it is part of a visible user interaction; be as quick |
| 3230 | * as possible when handling it. |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3231 | */ |
| 3232 | public static final String ACTION_USER_FOREGROUND = |
| 3233 | "android.intent.action.USER_FOREGROUND"; |
| 3234 | |
| 3235 | /** |
| 3236 | * Sent when a user switch is happening, causing the process's user to be |
| 3237 | * sent to the background. This is only sent to receivers registered |
| 3238 | * through {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
| 3239 | * Context.registerReceiver}. It is sent to the user that is going to the |
Dianne Hackborn | 36d337a | 2012-10-08 14:33:47 -0700 | [diff] [blame] | 3240 | * background. This is sent as a foreground |
| 3241 | * broadcast, since it is part of a visible user interaction; be as quick |
| 3242 | * as possible when handling it. |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3243 | */ |
| 3244 | public static final String ACTION_USER_BACKGROUND = |
| 3245 | "android.intent.action.USER_BACKGROUND"; |
| 3246 | |
| 3247 | /** |
Dianne Hackborn | 36d337a | 2012-10-08 14:33:47 -0700 | [diff] [blame] | 3248 | * Broadcast sent to the system when a user is added. Carries an extra |
| 3249 | * EXTRA_USER_HANDLE that has the userHandle of the new user. It is sent to |
| 3250 | * all running users. You must hold |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3251 | * {@link android.Manifest.permission#MANAGE_USERS} to receive this broadcast. |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 3252 | * @hide |
| 3253 | */ |
| 3254 | public static final String ACTION_USER_ADDED = |
| 3255 | "android.intent.action.USER_ADDED"; |
| 3256 | |
| 3257 | /** |
Dianne Hackborn | 36d337a | 2012-10-08 14:33:47 -0700 | [diff] [blame] | 3258 | * Broadcast sent by the system when a user is started. Carries an extra |
| 3259 | * EXTRA_USER_HANDLE that has the userHandle of the user. This is only sent to |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3260 | * registered receivers, not manifest receivers. It is sent to the user |
Dianne Hackborn | 36d337a | 2012-10-08 14:33:47 -0700 | [diff] [blame] | 3261 | * that has been started. This is sent as a foreground |
| 3262 | * broadcast, since it is part of a visible user interaction; be as quick |
| 3263 | * as possible when handling it. |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3264 | * @hide |
| 3265 | */ |
| 3266 | public static final String ACTION_USER_STARTED = |
| 3267 | "android.intent.action.USER_STARTED"; |
| 3268 | |
| 3269 | /** |
Dianne Hackborn | 36d337a | 2012-10-08 14:33:47 -0700 | [diff] [blame] | 3270 | * Broadcast sent when a user is in the process of starting. Carries an extra |
| 3271 | * EXTRA_USER_HANDLE that has the userHandle of the user. This is only |
| 3272 | * sent to registered receivers, not manifest receivers. It is sent to all |
| 3273 | * users (including the one that is being started). You must hold |
| 3274 | * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} to receive |
| 3275 | * this broadcast. This is sent as a background broadcast, since |
| 3276 | * its result is not part of the primary UX flow; to safely keep track of |
| 3277 | * started/stopped state of a user you can use this in conjunction with |
| 3278 | * {@link #ACTION_USER_STOPPING}. It is <b>not</b> generally safe to use with |
| 3279 | * other user state broadcasts since those are foreground broadcasts so can |
| 3280 | * execute in a different order. |
| 3281 | * @hide |
| 3282 | */ |
| 3283 | public static final String ACTION_USER_STARTING = |
| 3284 | "android.intent.action.USER_STARTING"; |
| 3285 | |
| 3286 | /** |
| 3287 | * Broadcast sent when a user is going to be stopped. Carries an extra |
| 3288 | * EXTRA_USER_HANDLE that has the userHandle of the user. This is only |
| 3289 | * sent to registered receivers, not manifest receivers. It is sent to all |
| 3290 | * users (including the one that is being stopped). You must hold |
| 3291 | * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} to receive |
| 3292 | * this broadcast. The user will not stop until all receivers have |
| 3293 | * handled the broadcast. This is sent as a background broadcast, since |
| 3294 | * its result is not part of the primary UX flow; to safely keep track of |
| 3295 | * started/stopped state of a user you can use this in conjunction with |
| 3296 | * {@link #ACTION_USER_STARTING}. It is <b>not</b> generally safe to use with |
| 3297 | * other user state broadcasts since those are foreground broadcasts so can |
| 3298 | * execute in a different order. |
| 3299 | * @hide |
| 3300 | */ |
| 3301 | public static final String ACTION_USER_STOPPING = |
| 3302 | "android.intent.action.USER_STOPPING"; |
| 3303 | |
| 3304 | /** |
| 3305 | * Broadcast sent to the system when a user is stopped. Carries an extra |
| 3306 | * EXTRA_USER_HANDLE that has the userHandle of the user. This is similar to |
| 3307 | * {@link #ACTION_PACKAGE_RESTARTED}, but for an entire user instead of a |
| 3308 | * specific package. This is only sent to registered receivers, not manifest |
| 3309 | * receivers. It is sent to all running users <em>except</em> the one that |
| 3310 | * has just been stopped (which is no longer running). |
Dianne Hackborn | 80a4af2 | 2012-08-27 19:18:31 -0700 | [diff] [blame] | 3311 | * @hide |
| 3312 | */ |
| 3313 | public static final String ACTION_USER_STOPPED = |
| 3314 | "android.intent.action.USER_STOPPED"; |
| 3315 | |
| 3316 | /** |
Amith Yamasani | 2a00329 | 2012-08-14 18:25:45 -0700 | [diff] [blame] | 3317 | * Broadcast sent to the system when a user is removed. Carries an extra EXTRA_USER_HANDLE that has |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3318 | * the userHandle of the user. It is sent to all running users except the |
Amith Yamasani | db6a14c | 2012-10-17 21:16:52 -0700 | [diff] [blame] | 3319 | * one that has been removed. The user will not be completely removed until all receivers have |
| 3320 | * handled the broadcast. You must hold |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3321 | * {@link android.Manifest.permission#MANAGE_USERS} to receive this broadcast. |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 3322 | * @hide |
| 3323 | */ |
Sudheer Shanka | 166a81b | 2017-03-30 15:42:51 -0700 | [diff] [blame] | 3324 | @SystemApi |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 3325 | public static final String ACTION_USER_REMOVED = |
| 3326 | "android.intent.action.USER_REMOVED"; |
| 3327 | |
| 3328 | /** |
Amith Yamasani | 2a00329 | 2012-08-14 18:25:45 -0700 | [diff] [blame] | 3329 | * Broadcast sent to the system when the user switches. Carries an extra EXTRA_USER_HANDLE that has |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3330 | * the userHandle of the user to become the current one. This is only sent to |
| 3331 | * registered receivers, not manifest receivers. It is sent to all running users. |
| 3332 | * You must hold |
| 3333 | * {@link android.Manifest.permission#MANAGE_USERS} to receive this broadcast. |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 3334 | * @hide |
| 3335 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 3336 | @UnsupportedAppUsage |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 3337 | public static final String ACTION_USER_SWITCHED = |
| 3338 | "android.intent.action.USER_SWITCHED"; |
| 3339 | |
Amith Yamasani | e928d7d | 2012-09-17 21:46:51 -0700 | [diff] [blame] | 3340 | /** |
Jeff Sharkey | 8924e87 | 2015-11-30 12:52:10 -0700 | [diff] [blame] | 3341 | * Broadcast Action: Sent when the credential-encrypted private storage has |
| 3342 | * become unlocked for the target user. This is only sent to registered |
| 3343 | * receivers, not manifest receivers. |
| 3344 | */ |
| 3345 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3346 | public static final String ACTION_USER_UNLOCKED = "android.intent.action.USER_UNLOCKED"; |
| 3347 | |
| 3348 | /** |
Amith Yamasani | e928d7d | 2012-09-17 21:46:51 -0700 | [diff] [blame] | 3349 | * Broadcast sent to the system when a user's information changes. Carries an extra |
| 3350 | * {@link #EXTRA_USER_HANDLE} to indicate which user's information changed. |
Amith Yamasani | 6fc1d4e | 2013-05-08 16:43:58 -0700 | [diff] [blame] | 3351 | * This is only sent to registered receivers, not manifest receivers. It is sent to all users. |
Amith Yamasani | e928d7d | 2012-09-17 21:46:51 -0700 | [diff] [blame] | 3352 | * @hide |
| 3353 | */ |
| 3354 | public static final String ACTION_USER_INFO_CHANGED = |
| 3355 | "android.intent.action.USER_INFO_CHANGED"; |
| 3356 | |
Daniel Sandler | 2e7d25b | 2012-10-01 16:43:26 -0400 | [diff] [blame] | 3357 | /** |
Alexandra Gherghina | c17d7e0 | 2014-04-04 16:27:28 +0100 | [diff] [blame] | 3358 | * Broadcast sent to the primary user when an associated managed profile is added (the profile |
| 3359 | * was created and is ready to be used). Carries an extra {@link #EXTRA_USER} that specifies |
Adam Connors | d4b584e | 2014-06-09 13:55:47 +0100 | [diff] [blame] | 3360 | * the UserHandle of the profile that was added. Only applications (for example Launchers) |
| 3361 | * that need to display merged content across both primary and managed profiles need to |
| 3362 | * worry about this broadcast. This is only sent to registered receivers, |
Alexandra Gherghina | c17d7e0 | 2014-04-04 16:27:28 +0100 | [diff] [blame] | 3363 | * not manifest receivers. |
| 3364 | */ |
| 3365 | public static final String ACTION_MANAGED_PROFILE_ADDED = |
| 3366 | "android.intent.action.MANAGED_PROFILE_ADDED"; |
| 3367 | |
| 3368 | /** |
| 3369 | * Broadcast sent to the primary user when an associated managed profile is removed. Carries an |
Adam Connors | d4b584e | 2014-06-09 13:55:47 +0100 | [diff] [blame] | 3370 | * extra {@link #EXTRA_USER} that specifies the UserHandle of the profile that was removed. |
| 3371 | * Only applications (for example Launchers) that need to display merged content across both |
| 3372 | * primary and managed profiles need to worry about this broadcast. This is only sent to |
| 3373 | * registered receivers, not manifest receivers. |
Alexandra Gherghina | c17d7e0 | 2014-04-04 16:27:28 +0100 | [diff] [blame] | 3374 | */ |
| 3375 | public static final String ACTION_MANAGED_PROFILE_REMOVED = |
| 3376 | "android.intent.action.MANAGED_PROFILE_REMOVED"; |
| 3377 | |
| 3378 | /** |
Kenny Guy | b1b3026 | 2016-02-09 16:02:35 +0000 | [diff] [blame] | 3379 | * Broadcast sent to the primary user when the credential-encrypted private storage for |
| 3380 | * an associated managed profile is unlocked. Carries an extra {@link #EXTRA_USER} that |
| 3381 | * specifies the UserHandle of the profile that was unlocked. Only applications (for example |
| 3382 | * Launchers) that need to display merged content across both primary and managed profiles |
| 3383 | * need to worry about this broadcast. This is only sent to registered receivers, |
| 3384 | * not manifest receivers. |
| 3385 | */ |
| 3386 | public static final String ACTION_MANAGED_PROFILE_UNLOCKED = |
| 3387 | "android.intent.action.MANAGED_PROFILE_UNLOCKED"; |
| 3388 | |
| 3389 | /** |
Rubin Xu | e95057a | 2016-04-01 16:49:25 +0100 | [diff] [blame] | 3390 | * Broadcast sent to the primary user when an associated managed profile has become available. |
| 3391 | * Currently this includes when the user disables quiet mode for the profile. Carries an extra |
Rubin Xu | f13c980 | 2016-01-21 18:06:00 +0000 | [diff] [blame] | 3392 | * {@link #EXTRA_USER} that specifies the UserHandle of the profile. When quiet mode is changed, |
| 3393 | * this broadcast will carry a boolean extra {@link #EXTRA_QUIET_MODE} indicating the new state |
| 3394 | * of quiet mode. This is only sent to registered receivers, not manifest receivers. |
Rubin Xu | 0a29ecd | 2015-11-04 15:11:48 +0000 | [diff] [blame] | 3395 | */ |
Rubin Xu | e95057a | 2016-04-01 16:49:25 +0100 | [diff] [blame] | 3396 | public static final String ACTION_MANAGED_PROFILE_AVAILABLE = |
| 3397 | "android.intent.action.MANAGED_PROFILE_AVAILABLE"; |
| 3398 | |
| 3399 | /** |
| 3400 | * Broadcast sent to the primary user when an associated managed profile has become unavailable. |
| 3401 | * Currently this includes when the user enables quiet mode for the profile. Carries an extra |
| 3402 | * {@link #EXTRA_USER} that specifies the UserHandle of the profile. When quiet mode is changed, |
| 3403 | * this broadcast will carry a boolean extra {@link #EXTRA_QUIET_MODE} indicating the new state |
| 3404 | * of quiet mode. This is only sent to registered receivers, not manifest receivers. |
| 3405 | */ |
| 3406 | public static final String ACTION_MANAGED_PROFILE_UNAVAILABLE = |
| 3407 | "android.intent.action.MANAGED_PROFILE_UNAVAILABLE"; |
Rubin Xu | 0a29ecd | 2015-11-04 15:11:48 +0000 | [diff] [blame] | 3408 | |
| 3409 | /** |
Robin Lee | 92b83c6 | 2016-08-31 13:27:51 +0100 | [diff] [blame] | 3410 | * Broadcast sent to the system user when the 'device locked' state changes for any user. |
| 3411 | * Carries an extra {@link #EXTRA_USER_HANDLE} that specifies the ID of the user for which |
| 3412 | * the device was locked or unlocked. |
| 3413 | * |
| 3414 | * This is only sent to registered receivers. |
| 3415 | * |
| 3416 | * @hide |
| 3417 | */ |
| 3418 | public static final String ACTION_DEVICE_LOCKED_CHANGED = |
| 3419 | "android.intent.action.DEVICE_LOCKED_CHANGED"; |
| 3420 | |
| 3421 | /** |
Daniel Sandler | 2e7d25b | 2012-10-01 16:43:26 -0400 | [diff] [blame] | 3422 | * Sent when the user taps on the clock widget in the system's "quick settings" area. |
| 3423 | */ |
| 3424 | public static final String ACTION_QUICK_CLOCK = |
| 3425 | "android.intent.action.QUICK_CLOCK"; |
| 3426 | |
Michael Wright | 0087a14 | 2013-02-05 16:29:39 -0800 | [diff] [blame] | 3427 | /** |
Alan Viverette | 5a39949 | 2014-07-14 16:19:38 -0700 | [diff] [blame] | 3428 | * Activity Action: Shows the brightness setting dialog. |
Michael Wright | 0087a14 | 2013-02-05 16:29:39 -0800 | [diff] [blame] | 3429 | * @hide |
| 3430 | */ |
| 3431 | public static final String ACTION_SHOW_BRIGHTNESS_DIALOG = |
Clara Bayarri | 847d868 | 2017-03-06 16:48:44 +0000 | [diff] [blame] | 3432 | "com.android.intent.action.SHOW_BRIGHTNESS_DIALOG"; |
Michael Wright | 0087a14 | 2013-02-05 16:29:39 -0800 | [diff] [blame] | 3433 | |
Justin Koh | d378ad7 | 2013-04-01 12:18:26 -0700 | [diff] [blame] | 3434 | /** |
| 3435 | * Broadcast Action: A global button was pressed. Includes a single |
| 3436 | * extra field, {@link #EXTRA_KEY_EVENT}, containing the key event that |
| 3437 | * caused the broadcast. |
| 3438 | * @hide |
| 3439 | */ |
Sujith Ramakrishnan | 48e19c8 | 2017-04-24 15:57:58 -0700 | [diff] [blame] | 3440 | @SystemApi |
Justin Koh | d378ad7 | 2013-04-01 12:18:26 -0700 | [diff] [blame] | 3441 | public static final String ACTION_GLOBAL_BUTTON = "android.intent.action.GLOBAL_BUTTON"; |
| 3442 | |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3443 | /** |
Dongwon Kang | 2034a4c | 2015-12-14 21:57:34 +0900 | [diff] [blame] | 3444 | * Broadcast Action: Sent when media resource is granted. |
| 3445 | * <p> |
| 3446 | * {@link #EXTRA_PACKAGES} specifies the packages on the process holding the media resource |
| 3447 | * granted. |
| 3448 | * </p> |
| 3449 | * <p class="note"> |
| 3450 | * This is a protected intent that can only be sent by the system. |
| 3451 | * </p> |
| 3452 | * <p class="note"> |
Dongwon Kang | 32cb9ab | 2016-01-13 18:11:10 -0800 | [diff] [blame] | 3453 | * This requires {@link android.Manifest.permission#RECEIVE_MEDIA_RESOURCE_USAGE} permission. |
Dongwon Kang | 2034a4c | 2015-12-14 21:57:34 +0900 | [diff] [blame] | 3454 | * </p> |
| 3455 | * |
| 3456 | * @hide |
| 3457 | */ |
| 3458 | public static final String ACTION_MEDIA_RESOURCE_GRANTED = |
| 3459 | "android.intent.action.MEDIA_RESOURCE_GRANTED"; |
| 3460 | |
| 3461 | /** |
MÃ¥rten Kongstad | eabc9e9 | 2015-12-15 16:40:23 +0100 | [diff] [blame] | 3462 | * Broadcast Action: An overlay package has changed. The data contains the |
| 3463 | * name of the overlay package which has changed. This is broadcast on all |
| 3464 | * changes to the OverlayInfo returned by {@link |
| 3465 | * android.content.om.IOverlayManager#getOverlayInfo(String, int)}. The |
| 3466 | * most common change is a state change that will change whether the |
| 3467 | * overlay is enabled or not. |
| 3468 | * @hide |
| 3469 | */ |
| 3470 | public static final String ACTION_OVERLAY_CHANGED = "android.intent.action.OVERLAY_CHANGED"; |
| 3471 | |
| 3472 | /** |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3473 | * Activity Action: Allow the user to select and return one or more existing |
| 3474 | * documents. When invoked, the system will display the various |
| 3475 | * {@link DocumentsProvider} instances installed on the device, letting the |
| 3476 | * user interactively navigate through them. These documents include local |
| 3477 | * media, such as photos and video, and documents provided by installed |
| 3478 | * cloud storage providers. |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3479 | * <p> |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3480 | * Each document is represented as a {@code content://} URI backed by a |
| 3481 | * {@link DocumentsProvider}, which can be opened as a stream with |
| 3482 | * {@link ContentResolver#openFileDescriptor(Uri, String)}, or queried for |
| 3483 | * {@link android.provider.DocumentsContract.Document} metadata. |
| 3484 | * <p> |
| 3485 | * All selected documents are returned to the calling application with |
| 3486 | * persistable read and write permission grants. If you want to maintain |
| 3487 | * access to the documents across device reboots, you need to explicitly |
| 3488 | * take the persistable permissions using |
| 3489 | * {@link ContentResolver#takePersistableUriPermission(Uri, int)}. |
| 3490 | * <p> |
Jeff Sharkey | 21de56a | 2014-04-05 19:05:24 -0700 | [diff] [blame] | 3491 | * Callers must indicate the acceptable document MIME types through |
| 3492 | * {@link #setType(String)}. For example, to select photos, use |
| 3493 | * {@code image/*}. If multiple disjoint MIME types are acceptable, define |
| 3494 | * them in {@link #EXTRA_MIME_TYPES} and {@link #setType(String)} to |
| 3495 | * {@literal *}/*. |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3496 | * <p> |
| 3497 | * If the caller can handle multiple returned items (the user performing |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3498 | * multiple selection), then you can specify {@link #EXTRA_ALLOW_MULTIPLE} |
| 3499 | * to indicate this. |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3500 | * <p> |
Tomasz Mikolajewski | a8057a9 | 2015-11-16 11:41:28 +0900 | [diff] [blame] | 3501 | * Callers must include {@link #CATEGORY_OPENABLE} in the Intent to obtain |
| 3502 | * URIs that can be opened with |
Jeff Sharkey | bd3b902 | 2013-08-20 15:20:04 -0700 | [diff] [blame] | 3503 | * {@link ContentResolver#openFileDescriptor(Uri, String)}. |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3504 | * <p> |
Garfield Tan | b44ae61 | 2016-11-07 16:46:37 -0800 | [diff] [blame] | 3505 | * Callers can set a document URI through |
| 3506 | * {@link DocumentsContract#EXTRA_INITIAL_URI} to indicate the initial |
| 3507 | * location of documents navigator. System will do its best to launch the |
| 3508 | * navigator in the specified document if it's a folder, or the folder that |
| 3509 | * contains the specified document if not. |
Garfield Tan | 0b3cf66 | 2016-10-31 12:59:45 -0700 | [diff] [blame] | 3510 | * <p> |
Jeff Sharkey | 21de56a | 2014-04-05 19:05:24 -0700 | [diff] [blame] | 3511 | * Output: The URI of the item that was picked, returned in |
| 3512 | * {@link #getData()}. This must be a {@code content://} URI so that any |
| 3513 | * receiver can access it. If multiple documents were selected, they are |
| 3514 | * returned in {@link #getClipData()}. |
Jeff Sharkey | bd3b902 | 2013-08-20 15:20:04 -0700 | [diff] [blame] | 3515 | * |
| 3516 | * @see DocumentsContract |
Jeff Sharkey | b9fbb72 | 2014-06-04 16:42:47 -0700 | [diff] [blame] | 3517 | * @see #ACTION_OPEN_DOCUMENT_TREE |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3518 | * @see #ACTION_CREATE_DOCUMENT |
| 3519 | * @see #FLAG_GRANT_PERSISTABLE_URI_PERMISSION |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3520 | */ |
| 3521 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 3522 | public static final String ACTION_OPEN_DOCUMENT = "android.intent.action.OPEN_DOCUMENT"; |
| 3523 | |
| 3524 | /** |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3525 | * Activity Action: Allow the user to create a new document. When invoked, |
| 3526 | * the system will display the various {@link DocumentsProvider} instances |
| 3527 | * installed on the device, letting the user navigate through them. The |
| 3528 | * returned document may be a newly created document with no content, or it |
| 3529 | * may be an existing document with the requested MIME type. |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3530 | * <p> |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3531 | * Each document is represented as a {@code content://} URI backed by a |
| 3532 | * {@link DocumentsProvider}, which can be opened as a stream with |
| 3533 | * {@link ContentResolver#openFileDescriptor(Uri, String)}, or queried for |
| 3534 | * {@link android.provider.DocumentsContract.Document} metadata. |
| 3535 | * <p> |
| 3536 | * Callers must indicate the concrete MIME type of the document being |
| 3537 | * created by setting {@link #setType(String)}. This MIME type cannot be |
| 3538 | * changed after the document is created. |
| 3539 | * <p> |
| 3540 | * Callers can provide an initial display name through {@link #EXTRA_TITLE}, |
| 3541 | * but the user may change this value before creating the file. |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3542 | * <p> |
Tomasz Mikolajewski | a8057a9 | 2015-11-16 11:41:28 +0900 | [diff] [blame] | 3543 | * Callers must include {@link #CATEGORY_OPENABLE} in the Intent to obtain |
| 3544 | * URIs that can be opened with |
Jeff Sharkey | bd3b902 | 2013-08-20 15:20:04 -0700 | [diff] [blame] | 3545 | * {@link ContentResolver#openFileDescriptor(Uri, String)}. |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3546 | * <p> |
Garfield Tan | b44ae61 | 2016-11-07 16:46:37 -0800 | [diff] [blame] | 3547 | * Callers can set a document URI through |
| 3548 | * {@link DocumentsContract#EXTRA_INITIAL_URI} to indicate the initial |
| 3549 | * location of documents navigator. System will do its best to launch the |
| 3550 | * navigator in the specified document if it's a folder, or the folder that |
| 3551 | * contains the specified document if not. |
Garfield Tan | 0b3cf66 | 2016-10-31 12:59:45 -0700 | [diff] [blame] | 3552 | * <p> |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3553 | * Output: The URI of the item that was created. This must be a |
| 3554 | * {@code content://} URI so that any receiver can access it. |
Jeff Sharkey | bd3b902 | 2013-08-20 15:20:04 -0700 | [diff] [blame] | 3555 | * |
| 3556 | * @see DocumentsContract |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3557 | * @see #ACTION_OPEN_DOCUMENT |
Jeff Sharkey | b9fbb72 | 2014-06-04 16:42:47 -0700 | [diff] [blame] | 3558 | * @see #ACTION_OPEN_DOCUMENT_TREE |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3559 | * @see #FLAG_GRANT_PERSISTABLE_URI_PERMISSION |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3560 | */ |
| 3561 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 3562 | public static final String ACTION_CREATE_DOCUMENT = "android.intent.action.CREATE_DOCUMENT"; |
| 3563 | |
Jeff Sharkey | 21de56a | 2014-04-05 19:05:24 -0700 | [diff] [blame] | 3564 | /** |
Jeff Sharkey | b9fbb72 | 2014-06-04 16:42:47 -0700 | [diff] [blame] | 3565 | * Activity Action: Allow the user to pick a directory subtree. When |
| 3566 | * invoked, the system will display the various {@link DocumentsProvider} |
| 3567 | * instances installed on the device, letting the user navigate through |
| 3568 | * them. Apps can fully manage documents within the returned directory. |
Jeff Sharkey | 21de56a | 2014-04-05 19:05:24 -0700 | [diff] [blame] | 3569 | * <p> |
| 3570 | * To gain access to descendant (child, grandchild, etc) documents, use |
Jeff Sharkey | b9fbb72 | 2014-06-04 16:42:47 -0700 | [diff] [blame] | 3571 | * {@link DocumentsContract#buildDocumentUriUsingTree(Uri, String)} and |
| 3572 | * {@link DocumentsContract#buildChildDocumentsUriUsingTree(Uri, String)} |
| 3573 | * with the returned URI. |
Jeff Sharkey | 21de56a | 2014-04-05 19:05:24 -0700 | [diff] [blame] | 3574 | * <p> |
Garfield Tan | b44ae61 | 2016-11-07 16:46:37 -0800 | [diff] [blame] | 3575 | * Callers can set a document URI through |
| 3576 | * {@link DocumentsContract#EXTRA_INITIAL_URI} to indicate the initial |
| 3577 | * location of documents navigator. System will do its best to launch the |
| 3578 | * navigator in the specified document if it's a folder, or the folder that |
| 3579 | * contains the specified document if not. |
Garfield Tan | 0b3cf66 | 2016-10-31 12:59:45 -0700 | [diff] [blame] | 3580 | * <p> |
Jeff Sharkey | b9fbb72 | 2014-06-04 16:42:47 -0700 | [diff] [blame] | 3581 | * Output: The URI representing the selected directory tree. |
Jeff Sharkey | 21de56a | 2014-04-05 19:05:24 -0700 | [diff] [blame] | 3582 | * |
| 3583 | * @see DocumentsContract |
| 3584 | */ |
| 3585 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
Jeff Sharkey | b9fbb72 | 2014-06-04 16:42:47 -0700 | [diff] [blame] | 3586 | public static final String |
| 3587 | ACTION_OPEN_DOCUMENT_TREE = "android.intent.action.OPEN_DOCUMENT_TREE"; |
Jeff Sharkey | 21de56a | 2014-04-05 19:05:24 -0700 | [diff] [blame] | 3588 | |
Felipe Leme | c7b1f89 | 2016-01-15 15:02:31 -0800 | [diff] [blame] | 3589 | /** |
Peng Xu | a35b553 | 2016-01-20 00:05:45 -0800 | [diff] [blame] | 3590 | * Broadcast Action: List of dynamic sensor is changed due to new sensor being connected or |
| 3591 | * exisiting sensor being disconnected. |
| 3592 | * |
| 3593 | * <p class="note">This is a protected intent that can only be sent by the system.</p> |
| 3594 | * |
| 3595 | * {@hide} |
| 3596 | */ |
| 3597 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3598 | public static final String |
| 3599 | ACTION_DYNAMIC_SENSOR_CHANGED = "android.intent.action.DYNAMIC_SENSOR_CHANGED"; |
| 3600 | |
Lenka Trochtova | 73aeea2 | 2016-11-18 17:34:34 +0100 | [diff] [blame] | 3601 | /** |
Sam Lin | e707f83 | 2017-04-13 17:00:55 -0700 | [diff] [blame] | 3602 | * Deprecated - use ACTION_FACTORY_RESET instead. |
Amith Yamasani | e99757e4 | 2017-04-14 14:41:45 -0700 | [diff] [blame] | 3603 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3604 | * @removed |
Lenka Trochtova | 73aeea2 | 2016-11-18 17:34:34 +0100 | [diff] [blame] | 3605 | */ |
| 3606 | @Deprecated |
Amith Yamasani | e99757e4 | 2017-04-14 14:41:45 -0700 | [diff] [blame] | 3607 | @SystemApi |
Jeff Sharkey | 004a4b2 | 2014-09-24 11:45:24 -0700 | [diff] [blame] | 3608 | public static final String ACTION_MASTER_CLEAR = "android.intent.action.MASTER_CLEAR"; |
| 3609 | |
Christopher Tate | 6597e34 | 2015-02-17 12:15:25 -0800 | [diff] [blame] | 3610 | /** |
Amith Yamasani | cbabb8d | 2017-02-17 16:50:05 -0800 | [diff] [blame] | 3611 | * Broadcast intent sent by the RecoverySystem to inform listeners that a master clear (wipe) |
| 3612 | * is about to be performed. |
| 3613 | * @hide |
| 3614 | */ |
| 3615 | @SystemApi |
| 3616 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3617 | public static final String ACTION_MASTER_CLEAR_NOTIFICATION |
| 3618 | = "android.intent.action.MASTER_CLEAR_NOTIFICATION"; |
| 3619 | |
| 3620 | /** |
Lenka Trochtova | 73aeea2 | 2016-11-18 17:34:34 +0100 | [diff] [blame] | 3621 | * Boolean intent extra to be used with {@link #ACTION_MASTER_CLEAR} in order to force a factory |
| 3622 | * reset even if {@link android.os.UserManager#DISALLOW_FACTORY_RESET} is set. |
| 3623 | * |
| 3624 | * <p>Deprecated - use {@link #EXTRA_FORCE_FACTORY_RESET} instead. |
| 3625 | * |
Benjamin Franz | f9d5e6a | 2016-05-26 14:24:29 +0100 | [diff] [blame] | 3626 | * @hide |
| 3627 | */ |
Lenka Trochtova | 73aeea2 | 2016-11-18 17:34:34 +0100 | [diff] [blame] | 3628 | @Deprecated |
Benjamin Franz | f9d5e6a | 2016-05-26 14:24:29 +0100 | [diff] [blame] | 3629 | public static final String EXTRA_FORCE_MASTER_CLEAR = |
| 3630 | "android.intent.extra.FORCE_MASTER_CLEAR"; |
| 3631 | |
| 3632 | /** |
Lenka Trochtova | 73aeea2 | 2016-11-18 17:34:34 +0100 | [diff] [blame] | 3633 | * A broadcast action to trigger a factory reset. |
| 3634 | * |
Jeff Davidson | a0c7d1f | 2017-11-01 17:41:41 -0700 | [diff] [blame] | 3635 | * <p>The sender must hold the {@link android.Manifest.permission#MASTER_CLEAR} permission. The |
| 3636 | * reason for the factory reset should be specified as {@link #EXTRA_REASON}. |
Lenka Trochtova | 73aeea2 | 2016-11-18 17:34:34 +0100 | [diff] [blame] | 3637 | * |
| 3638 | * <p>Not for use by third-party applications. |
| 3639 | * |
Jeff Davidson | a0c7d1f | 2017-11-01 17:41:41 -0700 | [diff] [blame] | 3640 | * @see #EXTRA_FORCE_FACTORY_RESET |
Lenka Trochtova | 73aeea2 | 2016-11-18 17:34:34 +0100 | [diff] [blame] | 3641 | * |
| 3642 | * {@hide} |
| 3643 | */ |
| 3644 | @SystemApi |
| 3645 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3646 | public static final String ACTION_FACTORY_RESET = "android.intent.action.FACTORY_RESET"; |
| 3647 | |
| 3648 | /** |
| 3649 | * Boolean intent extra to be used with {@link #ACTION_MASTER_CLEAR} in order to force a factory |
| 3650 | * reset even if {@link android.os.UserManager#DISALLOW_FACTORY_RESET} is set. |
| 3651 | * |
| 3652 | * <p>Not for use by third-party applications. |
| 3653 | * |
| 3654 | * @hide |
| 3655 | */ |
| 3656 | @SystemApi |
| 3657 | public static final String EXTRA_FORCE_FACTORY_RESET = |
| 3658 | "android.intent.extra.FORCE_FACTORY_RESET"; |
| 3659 | |
| 3660 | /** |
Michal Karpinski | 6135a26 | 2017-08-11 10:45:58 +0100 | [diff] [blame] | 3661 | * Broadcast action: report that a settings element is being restored from backup. The intent |
| 3662 | * contains four extras: EXTRA_SETTING_NAME is a string naming the restored setting, |
| 3663 | * EXTRA_SETTING_NEW_VALUE is the value being restored, EXTRA_SETTING_PREVIOUS_VALUE |
| 3664 | * is the value of that settings entry prior to the restore operation, and |
| 3665 | * EXTRA_SETTING_RESTORED_FROM_SDK_INT is the version of the SDK that the setting has been |
| 3666 | * restored from (corresponds to {@link android.os.Build.VERSION#SDK_INT}). The first three |
| 3667 | * values are represented as strings, the fourth one as int. |
Christopher Tate | 6597e34 | 2015-02-17 12:15:25 -0800 | [diff] [blame] | 3668 | * |
| 3669 | * <p>This broadcast is sent only for settings provider entries known to require special handling |
| 3670 | * around restore time. These entries are found in the BROADCAST_ON_RESTORE table within |
| 3671 | * the provider's backup agent implementation. |
| 3672 | * |
| 3673 | * @see #EXTRA_SETTING_NAME |
| 3674 | * @see #EXTRA_SETTING_PREVIOUS_VALUE |
| 3675 | * @see #EXTRA_SETTING_NEW_VALUE |
Michal Karpinski | 6135a26 | 2017-08-11 10:45:58 +0100 | [diff] [blame] | 3676 | * @see #EXTRA_SETTING_RESTORED_FROM_SDK_INT |
Christopher Tate | 6597e34 | 2015-02-17 12:15:25 -0800 | [diff] [blame] | 3677 | * {@hide} |
| 3678 | */ |
| 3679 | public static final String ACTION_SETTING_RESTORED = "android.os.action.SETTING_RESTORED"; |
| 3680 | |
| 3681 | /** {@hide} */ |
| 3682 | public static final String EXTRA_SETTING_NAME = "setting_name"; |
| 3683 | /** {@hide} */ |
| 3684 | public static final String EXTRA_SETTING_PREVIOUS_VALUE = "previous_value"; |
| 3685 | /** {@hide} */ |
| 3686 | public static final String EXTRA_SETTING_NEW_VALUE = "new_value"; |
Michal Karpinski | 6135a26 | 2017-08-11 10:45:58 +0100 | [diff] [blame] | 3687 | /** {@hide} */ |
| 3688 | public static final String EXTRA_SETTING_RESTORED_FROM_SDK_INT = "restored_from_sdk_int"; |
Christopher Tate | 6597e34 | 2015-02-17 12:15:25 -0800 | [diff] [blame] | 3689 | |
Clara Bayarri | 0a26157a | 2015-03-26 18:38:55 +0000 | [diff] [blame] | 3690 | /** |
| 3691 | * Activity Action: Process a piece of text. |
| 3692 | * <p>Input: {@link #EXTRA_PROCESS_TEXT} contains the text to be processed. |
| 3693 | * {@link #EXTRA_PROCESS_TEXT_READONLY} states if the resulting text will be read-only.</p> |
| 3694 | * <p>Output: {@link #EXTRA_PROCESS_TEXT} contains the processed text.</p> |
| 3695 | */ |
| 3696 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 3697 | public static final String ACTION_PROCESS_TEXT = "android.intent.action.PROCESS_TEXT"; |
Amith Yamasani | cbabb8d | 2017-02-17 16:50:05 -0800 | [diff] [blame] | 3698 | |
| 3699 | /** |
| 3700 | * Broadcast Action: The sim card state has changed. |
| 3701 | * For more details see TelephonyIntents.ACTION_SIM_STATE_CHANGED. This is here |
| 3702 | * because TelephonyIntents is an internal class. |
| 3703 | * @hide |
Amit Mahajan | 052e1e2 | 2018-01-12 17:40:29 -0800 | [diff] [blame] | 3704 | * @deprecated Use {@link #ACTION_SIM_CARD_STATE_CHANGED} or |
| 3705 | * {@link #ACTION_SIM_APPLICATION_STATE_CHANGED} |
Amith Yamasani | cbabb8d | 2017-02-17 16:50:05 -0800 | [diff] [blame] | 3706 | */ |
Amit Mahajan | 052e1e2 | 2018-01-12 17:40:29 -0800 | [diff] [blame] | 3707 | @Deprecated |
Amith Yamasani | cbabb8d | 2017-02-17 16:50:05 -0800 | [diff] [blame] | 3708 | @SystemApi |
| 3709 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3710 | public static final String ACTION_SIM_STATE_CHANGED = "android.intent.action.SIM_STATE_CHANGED"; |
| 3711 | |
Clara Bayarri | 0a26157a | 2015-03-26 18:38:55 +0000 | [diff] [blame] | 3712 | /** |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3713 | * Broadcast Action: indicate that the phone service state has changed. |
| 3714 | * The intent will have the following extra values:</p> |
| 3715 | * <p> |
| 3716 | * @see #EXTRA_VOICE_REG_STATE |
| 3717 | * @see #EXTRA_DATA_REG_STATE |
| 3718 | * @see #EXTRA_VOICE_ROAMING_TYPE |
| 3719 | * @see #EXTRA_DATA_ROAMING_TYPE |
| 3720 | * @see #EXTRA_OPERATOR_ALPHA_LONG |
| 3721 | * @see #EXTRA_OPERATOR_ALPHA_SHORT |
| 3722 | * @see #EXTRA_OPERATOR_NUMERIC |
| 3723 | * @see #EXTRA_DATA_OPERATOR_ALPHA_LONG |
| 3724 | * @see #EXTRA_DATA_OPERATOR_ALPHA_SHORT |
| 3725 | * @see #EXTRA_DATA_OPERATOR_NUMERIC |
| 3726 | * @see #EXTRA_MANUAL |
| 3727 | * @see #EXTRA_VOICE_RADIO_TECH |
| 3728 | * @see #EXTRA_DATA_RADIO_TECH |
| 3729 | * @see #EXTRA_CSS_INDICATOR |
| 3730 | * @see #EXTRA_NETWORK_ID |
| 3731 | * @see #EXTRA_SYSTEM_ID |
| 3732 | * @see #EXTRA_CDMA_ROAMING_INDICATOR |
| 3733 | * @see #EXTRA_CDMA_DEFAULT_ROAMING_INDICATOR |
| 3734 | * @see #EXTRA_EMERGENCY_ONLY |
| 3735 | * @see #EXTRA_IS_DATA_ROAMING_FROM_REGISTRATION |
| 3736 | * @see #EXTRA_IS_USING_CARRIER_AGGREGATION |
| 3737 | * @see #EXTRA_LTE_EARFCN_RSRP_BOOST |
| 3738 | * |
| 3739 | * <p class="note"> |
| 3740 | * Requires the READ_PHONE_STATE permission. |
| 3741 | * |
| 3742 | * <p class="note">This is a protected intent that can only be sent by the system. |
| 3743 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3744 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3745 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable} and the helper |
| 3746 | * functions {@code ServiceStateTable.getUriForSubscriptionIdAndField} and |
| 3747 | * {@code ServiceStateTable.getUriForSubscriptionId} to subscribe to changes to the ServiceState |
| 3748 | * for a given subscription id and field with a ContentObserver or using JobScheduler. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3749 | */ |
| 3750 | @Deprecated |
| 3751 | @SystemApi |
| 3752 | @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3753 | public static final String ACTION_SERVICE_STATE = "android.intent.action.SERVICE_STATE"; |
| 3754 | |
| 3755 | /** |
| 3756 | * An int extra used with {@link #ACTION_SERVICE_STATE} which indicates voice registration |
| 3757 | * state. |
| 3758 | * @see android.telephony.ServiceState#STATE_EMERGENCY_ONLY |
| 3759 | * @see android.telephony.ServiceState#STATE_IN_SERVICE |
| 3760 | * @see android.telephony.ServiceState#STATE_OUT_OF_SERVICE |
| 3761 | * @see android.telephony.ServiceState#STATE_POWER_OFF |
| 3762 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3763 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3764 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#VOICE_REG_STATE}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3765 | */ |
| 3766 | @Deprecated |
| 3767 | @SystemApi |
| 3768 | public static final String EXTRA_VOICE_REG_STATE = "voiceRegState"; |
| 3769 | |
| 3770 | /** |
| 3771 | * An int extra used with {@link #ACTION_SERVICE_STATE} which indicates data registration state. |
| 3772 | * @see android.telephony.ServiceState#STATE_EMERGENCY_ONLY |
| 3773 | * @see android.telephony.ServiceState#STATE_IN_SERVICE |
| 3774 | * @see android.telephony.ServiceState#STATE_OUT_OF_SERVICE |
| 3775 | * @see android.telephony.ServiceState#STATE_POWER_OFF |
| 3776 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3777 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3778 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#DATA_REG_STATE}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3779 | */ |
| 3780 | @Deprecated |
| 3781 | @SystemApi |
| 3782 | public static final String EXTRA_DATA_REG_STATE = "dataRegState"; |
| 3783 | |
| 3784 | /** |
| 3785 | * An integer extra used with {@link #ACTION_SERVICE_STATE} which indicates the voice roaming |
| 3786 | * type. |
| 3787 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3788 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3789 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#VOICE_ROAMING_TYPE}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3790 | */ |
| 3791 | @Deprecated |
| 3792 | @SystemApi |
| 3793 | public static final String EXTRA_VOICE_ROAMING_TYPE = "voiceRoamingType"; |
| 3794 | |
| 3795 | /** |
| 3796 | * An integer extra used with {@link #ACTION_SERVICE_STATE} which indicates the data roaming |
| 3797 | * type. |
| 3798 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3799 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3800 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#DATA_ROAMING_TYPE}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3801 | */ |
| 3802 | @Deprecated |
| 3803 | @SystemApi |
| 3804 | public static final String EXTRA_DATA_ROAMING_TYPE = "dataRoamingType"; |
| 3805 | |
| 3806 | /** |
| 3807 | * A string extra used with {@link #ACTION_SERVICE_STATE} which represents the current |
| 3808 | * registered voice operator name in long alphanumeric format. |
| 3809 | * {@code null} if the operator name is not known or unregistered. |
| 3810 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3811 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3812 | * @deprecated Use |
| 3813 | * {@link android.provider.Telephony.ServiceStateTable#VOICE_OPERATOR_ALPHA_LONG}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3814 | */ |
| 3815 | @Deprecated |
| 3816 | @SystemApi |
| 3817 | public static final String EXTRA_OPERATOR_ALPHA_LONG = "operator-alpha-long"; |
| 3818 | |
| 3819 | /** |
| 3820 | * A string extra used with {@link #ACTION_SERVICE_STATE} which represents the current |
| 3821 | * registered voice operator name in short alphanumeric format. |
| 3822 | * {@code null} if the operator name is not known or unregistered. |
| 3823 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3824 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3825 | * @deprecated Use |
| 3826 | * {@link android.provider.Telephony.ServiceStateTable#VOICE_OPERATOR_ALPHA_SHORT}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3827 | */ |
| 3828 | @Deprecated |
| 3829 | @SystemApi |
| 3830 | public static final String EXTRA_OPERATOR_ALPHA_SHORT = "operator-alpha-short"; |
| 3831 | |
| 3832 | /** |
| 3833 | * A string extra used with {@link #ACTION_SERVICE_STATE} containing the MCC |
| 3834 | * (Mobile Country Code, 3 digits) and MNC (Mobile Network code, 2-3 digits) for the mobile |
| 3835 | * network. |
| 3836 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3837 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3838 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#VOICE_OPERATOR_NUMERIC}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3839 | */ |
| 3840 | @Deprecated |
| 3841 | @SystemApi |
| 3842 | public static final String EXTRA_OPERATOR_NUMERIC = "operator-numeric"; |
| 3843 | |
| 3844 | /** |
| 3845 | * A string extra used with {@link #ACTION_SERVICE_STATE} which represents the current |
| 3846 | * registered data operator name in long alphanumeric format. |
| 3847 | * {@code null} if the operator name is not known or unregistered. |
| 3848 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3849 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3850 | * @deprecated Use |
| 3851 | * {@link android.provider.Telephony.ServiceStateTable#DATA_OPERATOR_ALPHA_LONG}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3852 | */ |
| 3853 | @Deprecated |
| 3854 | @SystemApi |
| 3855 | public static final String EXTRA_DATA_OPERATOR_ALPHA_LONG = "data-operator-alpha-long"; |
| 3856 | |
| 3857 | /** |
| 3858 | * A string extra used with {@link #ACTION_SERVICE_STATE} which represents the current |
| 3859 | * registered data operator name in short alphanumeric format. |
| 3860 | * {@code null} if the operator name is not known or unregistered. |
| 3861 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3862 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3863 | * @deprecated Use |
| 3864 | * {@link android.provider.Telephony.ServiceStateTable#DATA_OPERATOR_ALPHA_SHORT}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3865 | */ |
| 3866 | @Deprecated |
| 3867 | @SystemApi |
| 3868 | public static final String EXTRA_DATA_OPERATOR_ALPHA_SHORT = "data-operator-alpha-short"; |
| 3869 | |
| 3870 | /** |
| 3871 | * A string extra used with {@link #ACTION_SERVICE_STATE} containing the MCC |
| 3872 | * (Mobile Country Code, 3 digits) and MNC (Mobile Network code, 2-3 digits) for the |
| 3873 | * data operator. |
| 3874 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3875 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3876 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#DATA_OPERATOR_NUMERIC}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3877 | */ |
| 3878 | @Deprecated |
| 3879 | @SystemApi |
| 3880 | public static final String EXTRA_DATA_OPERATOR_NUMERIC = "data-operator-numeric"; |
| 3881 | |
| 3882 | /** |
| 3883 | * A boolean extra used with {@link #ACTION_SERVICE_STATE} which indicates whether the current |
| 3884 | * network selection mode is manual. |
| 3885 | * Will be {@code true} if manual mode, {@code false} if automatic mode. |
| 3886 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3887 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3888 | * @deprecated Use |
| 3889 | * {@link android.provider.Telephony.ServiceStateTable#IS_MANUAL_NETWORK_SELECTION}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3890 | */ |
| 3891 | @Deprecated |
| 3892 | @SystemApi |
| 3893 | public static final String EXTRA_MANUAL = "manual"; |
| 3894 | |
| 3895 | /** |
| 3896 | * An integer extra used with {@link #ACTION_SERVICE_STATE} which represents the current voice |
| 3897 | * radio technology. |
| 3898 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3899 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3900 | * @deprecated Use |
| 3901 | * {@link android.provider.Telephony.ServiceStateTable#RIL_VOICE_RADIO_TECHNOLOGY}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3902 | */ |
| 3903 | @Deprecated |
| 3904 | @SystemApi |
| 3905 | public static final String EXTRA_VOICE_RADIO_TECH = "radioTechnology"; |
| 3906 | |
| 3907 | /** |
| 3908 | * An integer extra used with {@link #ACTION_SERVICE_STATE} which represents the current data |
| 3909 | * radio technology. |
| 3910 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3911 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3912 | * @deprecated Use |
| 3913 | * {@link android.provider.Telephony.ServiceStateTable#RIL_DATA_RADIO_TECHNOLOGY}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3914 | */ |
| 3915 | @Deprecated |
| 3916 | @SystemApi |
| 3917 | public static final String EXTRA_DATA_RADIO_TECH = "dataRadioTechnology"; |
| 3918 | |
| 3919 | /** |
| 3920 | * A boolean extra used with {@link #ACTION_SERVICE_STATE} which represents concurrent service |
| 3921 | * support on CDMA network. |
| 3922 | * Will be {@code true} if support, {@code false} otherwise. |
| 3923 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3924 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3925 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#CSS_INDICATOR}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3926 | */ |
| 3927 | @Deprecated |
| 3928 | @SystemApi |
| 3929 | public static final String EXTRA_CSS_INDICATOR = "cssIndicator"; |
| 3930 | |
| 3931 | /** |
| 3932 | * An integer extra used with {@link #ACTION_SERVICE_STATE} which represents the CDMA network |
| 3933 | * id. {@code Integer.MAX_VALUE} if unknown. |
| 3934 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3935 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3936 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#NETWORK_ID}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3937 | */ |
| 3938 | @Deprecated |
| 3939 | @SystemApi |
| 3940 | public static final String EXTRA_NETWORK_ID = "networkId"; |
| 3941 | |
| 3942 | /** |
| 3943 | * An integer extra used with {@link #ACTION_SERVICE_STATE} which represents the CDMA system id. |
| 3944 | * {@code Integer.MAX_VALUE} if unknown. |
| 3945 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3946 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3947 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#SYSTEM_ID}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3948 | */ |
| 3949 | @Deprecated |
| 3950 | @SystemApi |
| 3951 | public static final String EXTRA_SYSTEM_ID = "systemId"; |
| 3952 | |
| 3953 | /** |
| 3954 | * An integer extra used with {@link #ACTION_SERVICE_STATE} represents the TSB-58 roaming |
| 3955 | * indicator if registered on a CDMA or EVDO system or {@code -1} if not. |
| 3956 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3957 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3958 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#CDMA_ROAMING_INDICATOR}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3959 | */ |
| 3960 | @Deprecated |
| 3961 | @SystemApi |
| 3962 | public static final String EXTRA_CDMA_ROAMING_INDICATOR = "cdmaRoamingIndicator"; |
| 3963 | |
| 3964 | /** |
| 3965 | * An integer extra used with {@link #ACTION_SERVICE_STATE} represents the default roaming |
| 3966 | * indicator from the PRL if registered on a CDMA or EVDO system {@code -1} if not. |
| 3967 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3968 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3969 | * @deprecated Use |
| 3970 | * {@link android.provider.Telephony.ServiceStateTable#CDMA_DEFAULT_ROAMING_INDICATOR}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3971 | */ |
| 3972 | @Deprecated |
| 3973 | @SystemApi |
| 3974 | public static final String EXTRA_CDMA_DEFAULT_ROAMING_INDICATOR = "cdmaDefaultRoamingIndicator"; |
| 3975 | |
| 3976 | /** |
| 3977 | * A boolean extra used with {@link #ACTION_SERVICE_STATE} which indicates if under emergency |
| 3978 | * only mode. |
| 3979 | * {@code true} if in emergency only mode, {@code false} otherwise. |
| 3980 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3981 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3982 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#IS_EMERGENCY_ONLY}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3983 | */ |
| 3984 | @Deprecated |
| 3985 | @SystemApi |
| 3986 | public static final String EXTRA_EMERGENCY_ONLY = "emergencyOnly"; |
| 3987 | |
| 3988 | /** |
| 3989 | * A boolean extra used with {@link #ACTION_SERVICE_STATE} which indicates whether data network |
| 3990 | * registration state is roaming. |
| 3991 | * {@code true} if registration indicates roaming, {@code false} otherwise |
| 3992 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3993 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3994 | * @deprecated Use |
| 3995 | * {@link android.provider.Telephony.ServiceStateTable#IS_DATA_ROAMING_FROM_REGISTRATION}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3996 | */ |
| 3997 | @Deprecated |
| 3998 | @SystemApi |
| 3999 | public static final String EXTRA_IS_DATA_ROAMING_FROM_REGISTRATION = |
| 4000 | "isDataRoamingFromRegistration"; |
| 4001 | |
| 4002 | /** |
| 4003 | * A boolean extra used with {@link #ACTION_SERVICE_STATE} which indicates if carrier |
| 4004 | * aggregation is in use. |
| 4005 | * {@code true} if carrier aggregation is in use, {@code false} otherwise. |
| 4006 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 4007 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 4008 | * @deprecated Use |
| 4009 | * {@link android.provider.Telephony.ServiceStateTable#IS_USING_CARRIER_AGGREGATION}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 4010 | */ |
| 4011 | @Deprecated |
| 4012 | @SystemApi |
| 4013 | public static final String EXTRA_IS_USING_CARRIER_AGGREGATION = "isUsingCarrierAggregation"; |
| 4014 | |
| 4015 | /** |
| 4016 | * An integer extra used with {@link #ACTION_SERVICE_STATE} representing the offset which |
| 4017 | * is reduced from the rsrp threshold while calculating signal strength level. |
| 4018 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 4019 | * @removed |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 4020 | */ |
| 4021 | @Deprecated |
| 4022 | @SystemApi |
| 4023 | public static final String EXTRA_LTE_EARFCN_RSRP_BOOST = "LteEarfcnRsrpBoost"; |
| 4024 | |
| 4025 | /** |
chen xu | 0281169 | 2018-10-03 19:07:09 -0700 | [diff] [blame] | 4026 | * An parcelable extra used with {@link #ACTION_SERVICE_STATE} representing the service state. |
| 4027 | * @hide |
| 4028 | */ |
| 4029 | public static final String EXTRA_SERVICE_STATE = "android.intent.extra.SERVICE_STATE"; |
| 4030 | |
| 4031 | /** |
Clara Bayarri | 92c8e6f | 2015-05-21 17:50:08 +0100 | [diff] [blame] | 4032 | * The name of the extra used to define the text to be processed, as a |
| 4033 | * CharSequence. Note that this may be a styled CharSequence, so you must use |
| 4034 | * {@link Bundle#getCharSequence(String) Bundle.getCharSequence()} to retrieve it. |
Clara Bayarri | 0a26157a | 2015-03-26 18:38:55 +0000 | [diff] [blame] | 4035 | */ |
| 4036 | public static final String EXTRA_PROCESS_TEXT = "android.intent.extra.PROCESS_TEXT"; |
| 4037 | /** |
Clara Bayarri | 92c8e6f | 2015-05-21 17:50:08 +0100 | [diff] [blame] | 4038 | * The name of the boolean extra used to define if the processed text will be used as read-only. |
Clara Bayarri | 0a26157a | 2015-03-26 18:38:55 +0000 | [diff] [blame] | 4039 | */ |
| 4040 | public static final String EXTRA_PROCESS_TEXT_READONLY = |
| 4041 | "android.intent.extra.PROCESS_TEXT_READONLY"; |
| 4042 | |
Bryce Lee | bc58f59 | 2015-09-25 16:43:01 -0700 | [diff] [blame] | 4043 | /** |
| 4044 | * Broadcast action: reports when a new thermal event has been reached. When the device |
| 4045 | * is reaching its maximum temperatue, the thermal level reported |
| 4046 | * {@hide} |
| 4047 | */ |
| 4048 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 4049 | public static final String ACTION_THERMAL_EVENT = "android.intent.action.THERMAL_EVENT"; |
| 4050 | |
| 4051 | /** {@hide} */ |
| 4052 | public static final String EXTRA_THERMAL_STATE = "android.intent.extra.THERMAL_STATE"; |
| 4053 | |
| 4054 | /** |
| 4055 | * Thermal state when the device is normal. This state is sent in the |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 4056 | * {@link #ACTION_THERMAL_EVENT} broadcast as {@link #EXTRA_THERMAL_STATE}. |
Bryce Lee | bc58f59 | 2015-09-25 16:43:01 -0700 | [diff] [blame] | 4057 | * {@hide} |
| 4058 | */ |
| 4059 | public static final int EXTRA_THERMAL_STATE_NORMAL = 0; |
| 4060 | |
| 4061 | /** |
| 4062 | * Thermal state where the device is approaching its maximum threshold. This state is sent in |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 4063 | * the {@link #ACTION_THERMAL_EVENT} broadcast as {@link #EXTRA_THERMAL_STATE}. |
Bryce Lee | bc58f59 | 2015-09-25 16:43:01 -0700 | [diff] [blame] | 4064 | * {@hide} |
| 4065 | */ |
| 4066 | public static final int EXTRA_THERMAL_STATE_WARNING = 1; |
| 4067 | |
| 4068 | /** |
| 4069 | * Thermal state where the device has reached its maximum threshold. This state is sent in the |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 4070 | * {@link #ACTION_THERMAL_EVENT} broadcast as {@link #EXTRA_THERMAL_STATE}. |
Bryce Lee | bc58f59 | 2015-09-25 16:43:01 -0700 | [diff] [blame] | 4071 | * {@hide} |
| 4072 | */ |
| 4073 | public static final int EXTRA_THERMAL_STATE_EXCEEDED = 2; |
| 4074 | |
lpeter | 318abc9 | 2018-05-04 16:13:14 +0800 | [diff] [blame] | 4075 | /** |
| 4076 | * Broadcast Action: Indicates the dock in idle state while device is docked. |
| 4077 | * |
| 4078 | * <p class="note">This is a protected intent that can only be sent |
| 4079 | * by the system. |
| 4080 | * |
| 4081 | * @hide |
| 4082 | */ |
| 4083 | public static final String ACTION_DOCK_IDLE = "android.intent.action.DOCK_IDLE"; |
| 4084 | |
| 4085 | /** |
| 4086 | * Broadcast Action: Indicates the dock in active state while device is docked. |
| 4087 | * |
| 4088 | * <p class="note">This is a protected intent that can only be sent |
| 4089 | * by the system. |
| 4090 | * |
| 4091 | * @hide |
| 4092 | */ |
| 4093 | public static final String ACTION_DOCK_ACTIVE = "android.intent.action.DOCK_ACTIVE"; |
| 4094 | |
Bryce Lee | bc58f59 | 2015-09-25 16:43:01 -0700 | [diff] [blame] | 4095 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4096 | // --------------------------------------------------------------------- |
| 4097 | // --------------------------------------------------------------------- |
| 4098 | // Standard intent categories (see addCategory()). |
| 4099 | |
| 4100 | /** |
| 4101 | * Set if the activity should be an option for the default action |
| 4102 | * (center press) to perform on a piece of data. Setting this will |
| 4103 | * hide from the user any activities without it set when performing an |
John Spurlock | 6098c5d | 2013-06-17 10:32:46 -0400 | [diff] [blame] | 4104 | * action on some data. Note that this is normally -not- set in the |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4105 | * Intent when initiating an action -- it is for use in intent filters |
| 4106 | * specified in packages. |
| 4107 | */ |
| 4108 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4109 | public static final String CATEGORY_DEFAULT = "android.intent.category.DEFAULT"; |
| 4110 | /** |
| 4111 | * Activities that can be safely invoked from a browser must support this |
| 4112 | * category. For example, if the user is viewing a web page or an e-mail |
| 4113 | * and clicks on a link in the text, the Intent generated execute that |
| 4114 | * link will require the BROWSABLE category, so that only activities |
| 4115 | * supporting this category will be considered as possible actions. By |
| 4116 | * supporting this category, you are promising that there is nothing |
| 4117 | * damaging (without user intervention) that can happen by invoking any |
| 4118 | * matching Intent. |
| 4119 | */ |
| 4120 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4121 | public static final String CATEGORY_BROWSABLE = "android.intent.category.BROWSABLE"; |
| 4122 | /** |
Dianne Hackborn | 91097de | 2014-04-04 18:02:06 -0700 | [diff] [blame] | 4123 | * Categories for activities that can participate in voice interaction. |
| 4124 | * An activity that supports this category must be prepared to run with |
| 4125 | * no UI shown at all (though in some case it may have a UI shown), and |
| 4126 | * rely on {@link android.app.VoiceInteractor} to interact with the user. |
| 4127 | */ |
| 4128 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4129 | public static final String CATEGORY_VOICE = "android.intent.category.VOICE"; |
| 4130 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4131 | * Set if the activity should be considered as an alternative action to |
| 4132 | * the data the user is currently viewing. See also |
| 4133 | * {@link #CATEGORY_SELECTED_ALTERNATIVE} for an alternative action that |
| 4134 | * applies to the selection in a list of items. |
| 4135 | * |
| 4136 | * <p>Supporting this category means that you would like your activity to be |
| 4137 | * displayed in the set of alternative things the user can do, usually as |
| 4138 | * part of the current activity's options menu. You will usually want to |
| 4139 | * include a specific label in the <intent-filter> of this action |
| 4140 | * describing to the user what it does. |
| 4141 | * |
| 4142 | * <p>The action of IntentFilter with this category is important in that it |
| 4143 | * describes the specific action the target will perform. This generally |
| 4144 | * should not be a generic action (such as {@link #ACTION_VIEW}, but rather |
| 4145 | * a specific name such as "com.android.camera.action.CROP. Only one |
| 4146 | * alternative of any particular action will be shown to the user, so using |
| 4147 | * a specific action like this makes sure that your alternative will be |
| 4148 | * displayed while also allowing other applications to provide their own |
| 4149 | * overrides of that particular action. |
| 4150 | */ |
| 4151 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4152 | public static final String CATEGORY_ALTERNATIVE = "android.intent.category.ALTERNATIVE"; |
| 4153 | /** |
| 4154 | * Set if the activity should be considered as an alternative selection |
| 4155 | * action to the data the user has currently selected. This is like |
| 4156 | * {@link #CATEGORY_ALTERNATIVE}, but is used in activities showing a list |
| 4157 | * of items from which the user can select, giving them alternatives to the |
| 4158 | * default action that will be performed on it. |
| 4159 | */ |
| 4160 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4161 | public static final String CATEGORY_SELECTED_ALTERNATIVE = "android.intent.category.SELECTED_ALTERNATIVE"; |
| 4162 | /** |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 4163 | * Intended to be used as a tab inside of a containing TabActivity. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4164 | */ |
| 4165 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4166 | public static final String CATEGORY_TAB = "android.intent.category.TAB"; |
| 4167 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4168 | * Should be displayed in the top-level launcher. |
| 4169 | */ |
| 4170 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4171 | public static final String CATEGORY_LAUNCHER = "android.intent.category.LAUNCHER"; |
| 4172 | /** |
Jose Lima | 38b75b6 | 2014-03-11 10:41:39 -0700 | [diff] [blame] | 4173 | * Indicates an activity optimized for Leanback mode, and that should |
| 4174 | * be displayed in the Leanback launcher. |
| 4175 | */ |
| 4176 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4177 | public static final String CATEGORY_LEANBACK_LAUNCHER = "android.intent.category.LEANBACK_LAUNCHER"; |
| 4178 | /** |
Roberto Perez | 7ee1a7a | 2017-12-04 17:14:33 -0800 | [diff] [blame] | 4179 | * Indicates the preferred entry-point activity when an application is launched from a Car |
| 4180 | * launcher. If not present, Car launcher can optionally use {@link #CATEGORY_LAUNCHER} as a |
| 4181 | * fallback, or exclude the application entirely. |
| 4182 | * @hide |
| 4183 | */ |
| 4184 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4185 | public static final String CATEGORY_CAR_LAUNCHER = "android.intent.category.CAR_LAUNCHER"; |
| 4186 | /** |
Jose Lima | 73915cf | 2014-07-29 17:16:31 -0700 | [diff] [blame] | 4187 | * Indicates a Leanback settings activity to be displayed in the Leanback launcher. |
| 4188 | * @hide |
| 4189 | */ |
| 4190 | @SystemApi |
| 4191 | public static final String CATEGORY_LEANBACK_SETTINGS = "android.intent.category.LEANBACK_SETTINGS"; |
| 4192 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4193 | * Provides information about the package it is in; typically used if |
| 4194 | * a package does not contain a {@link #CATEGORY_LAUNCHER} to provide |
| 4195 | * a front-door to the user without having to be shown in the all apps list. |
| 4196 | */ |
| 4197 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4198 | public static final String CATEGORY_INFO = "android.intent.category.INFO"; |
| 4199 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4200 | * This is the home activity, that is the first activity that is displayed |
| 4201 | * when the device boots. |
| 4202 | */ |
| 4203 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4204 | public static final String CATEGORY_HOME = "android.intent.category.HOME"; |
| 4205 | /** |
Anthony Hugh | 979b81a | 2015-09-29 16:50:35 -0700 | [diff] [blame] | 4206 | * This is the home activity that is displayed when the device is finished setting up and ready |
| 4207 | * for use. |
| 4208 | * @hide |
| 4209 | */ |
| 4210 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4211 | public static final String CATEGORY_HOME_MAIN = "android.intent.category.HOME_MAIN"; |
| 4212 | /** |
Svet Ganov | 50a8bf4 | 2015-07-15 11:04:18 -0700 | [diff] [blame] | 4213 | * This is the setup wizard activity, that is the first activity that is displayed |
| 4214 | * when the user sets up the device for the first time. |
| 4215 | * @hide |
| 4216 | */ |
| 4217 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4218 | public static final String CATEGORY_SETUP_WIZARD = "android.intent.category.SETUP_WIZARD"; |
| 4219 | /** |
Svet Ganov | 5bb6bc6 | 2017-08-28 12:39:35 -0700 | [diff] [blame] | 4220 | * This is the home activity, that is the activity that serves as the launcher app |
| 4221 | * from there the user can start other apps. Often components with lower/higher |
| 4222 | * priority intent filters handle the home intent, for example SetupWizard, to |
| 4223 | * setup the device and we need to be able to distinguish the home app from these |
| 4224 | * setup helpers. |
| 4225 | * @hide |
| 4226 | */ |
| 4227 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4228 | public static final String CATEGORY_LAUNCHER_APP = "android.intent.category.LAUNCHER_APP"; |
| 4229 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4230 | * This activity is a preference panel. |
| 4231 | */ |
| 4232 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4233 | public static final String CATEGORY_PREFERENCE = "android.intent.category.PREFERENCE"; |
| 4234 | /** |
| 4235 | * This activity is a development preference panel. |
| 4236 | */ |
| 4237 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4238 | public static final String CATEGORY_DEVELOPMENT_PREFERENCE = "android.intent.category.DEVELOPMENT_PREFERENCE"; |
| 4239 | /** |
| 4240 | * Capable of running inside a parent activity container. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4241 | */ |
| 4242 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4243 | public static final String CATEGORY_EMBED = "android.intent.category.EMBED"; |
| 4244 | /** |
Patrick Dubroy | 6dabe24 | 2010-08-30 10:43:47 -0700 | [diff] [blame] | 4245 | * This activity allows the user to browse and download new applications. |
| 4246 | */ |
| 4247 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4248 | public static final String CATEGORY_APP_MARKET = "android.intent.category.APP_MARKET"; |
| 4249 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4250 | * This activity may be exercised by the monkey or other automated test tools. |
| 4251 | */ |
| 4252 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4253 | public static final String CATEGORY_MONKEY = "android.intent.category.MONKEY"; |
| 4254 | /** |
| 4255 | * To be used as a test (not part of the normal user experience). |
| 4256 | */ |
| 4257 | public static final String CATEGORY_TEST = "android.intent.category.TEST"; |
| 4258 | /** |
| 4259 | * To be used as a unit test (run through the Test Harness). |
| 4260 | */ |
| 4261 | public static final String CATEGORY_UNIT_TEST = "android.intent.category.UNIT_TEST"; |
| 4262 | /** |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 4263 | * To be used as a sample code example (not part of the normal user |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4264 | * experience). |
| 4265 | */ |
| 4266 | public static final String CATEGORY_SAMPLE_CODE = "android.intent.category.SAMPLE_CODE"; |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 4267 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4268 | /** |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 4269 | * Used to indicate that an intent only wants URIs that can be opened with |
| 4270 | * {@link ContentResolver#openFileDescriptor(Uri, String)}. Openable URIs |
| 4271 | * must support at least the columns defined in {@link OpenableColumns} when |
| 4272 | * queried. |
| 4273 | * |
| 4274 | * @see #ACTION_GET_CONTENT |
| 4275 | * @see #ACTION_OPEN_DOCUMENT |
| 4276 | * @see #ACTION_CREATE_DOCUMENT |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4277 | */ |
| 4278 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4279 | public static final String CATEGORY_OPENABLE = "android.intent.category.OPENABLE"; |
| 4280 | |
| 4281 | /** |
Tomasz Mikolajewski | 28a815c | 2016-10-28 15:54:11 +0900 | [diff] [blame] | 4282 | * Used to indicate that an intent filter can accept files which are not necessarily |
| 4283 | * openable by {@link ContentResolver#openFileDescriptor(Uri, String)}, but |
| 4284 | * at least streamable via |
| 4285 | * {@link ContentResolver#openTypedAssetFileDescriptor(Uri, String, Bundle)} |
| 4286 | * using one of the stream types exposed via |
| 4287 | * {@link ContentResolver#getStreamTypes(Uri, String)}. |
| 4288 | * |
| 4289 | * @see #ACTION_SEND |
| 4290 | * @see #ACTION_SEND_MULTIPLE |
| 4291 | */ |
| 4292 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4293 | public static final String CATEGORY_TYPED_OPENABLE = |
| 4294 | "android.intent.category.TYPED_OPENABLE"; |
| 4295 | |
| 4296 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4297 | * To be used as code under test for framework instrumentation tests. |
| 4298 | */ |
| 4299 | public static final String CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST = |
| 4300 | "android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST"; |
Mike Lockwood | 9092ab4 | 2009-09-16 13:01:32 -0400 | [diff] [blame] | 4301 | /** |
| 4302 | * An activity to run when device is inserted into a car dock. |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 4303 | * Used with {@link #ACTION_MAIN} to launch an activity. For more |
| 4304 | * information, see {@link android.app.UiModeManager}. |
Mike Lockwood | 9092ab4 | 2009-09-16 13:01:32 -0400 | [diff] [blame] | 4305 | */ |
| 4306 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4307 | public static final String CATEGORY_CAR_DOCK = "android.intent.category.CAR_DOCK"; |
| 4308 | /** |
| 4309 | * An activity to run when device is inserted into a car dock. |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 4310 | * Used with {@link #ACTION_MAIN} to launch an activity. For more |
| 4311 | * information, see {@link android.app.UiModeManager}. |
Mike Lockwood | 9092ab4 | 2009-09-16 13:01:32 -0400 | [diff] [blame] | 4312 | */ |
| 4313 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4314 | public static final String CATEGORY_DESK_DOCK = "android.intent.category.DESK_DOCK"; |
Praveen Bharathi | 21e941b | 2010-10-06 15:23:14 -0500 | [diff] [blame] | 4315 | /** |
| 4316 | * An activity to run when device is inserted into a analog (low end) dock. |
| 4317 | * Used with {@link #ACTION_MAIN} to launch an activity. For more |
| 4318 | * information, see {@link android.app.UiModeManager}. |
| 4319 | */ |
| 4320 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4321 | public static final String CATEGORY_LE_DESK_DOCK = "android.intent.category.LE_DESK_DOCK"; |
| 4322 | |
| 4323 | /** |
| 4324 | * An activity to run when device is inserted into a digital (high end) dock. |
| 4325 | * Used with {@link #ACTION_MAIN} to launch an activity. For more |
| 4326 | * information, see {@link android.app.UiModeManager}. |
| 4327 | */ |
| 4328 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4329 | public static final String CATEGORY_HE_DESK_DOCK = "android.intent.category.HE_DESK_DOCK"; |
Dan Murphy | c9f4eaf | 2009-08-12 15:15:43 -0500 | [diff] [blame] | 4330 | |
Bernd Holzhey | aea4b67 | 2010-03-31 09:46:13 +0200 | [diff] [blame] | 4331 | /** |
| 4332 | * Used to indicate that the activity can be used in a car environment. |
| 4333 | */ |
| 4334 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4335 | public static final String CATEGORY_CAR_MODE = "android.intent.category.CAR_MODE"; |
| 4336 | |
Zak Cohen | db6ca49 | 2017-01-26 14:09:00 -0800 | [diff] [blame] | 4337 | /** |
| 4338 | * An activity to use for the launcher when the device is placed in a VR Headset viewer. |
| 4339 | * Used with {@link #ACTION_MAIN} to launch an activity. For more |
| 4340 | * information, see {@link android.app.UiModeManager}. |
| 4341 | */ |
| 4342 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4343 | public static final String CATEGORY_VR_HOME = "android.intent.category.VR_HOME"; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4344 | // --------------------------------------------------------------------- |
| 4345 | // --------------------------------------------------------------------- |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4346 | // Application launch intent categories (see addCategory()). |
| 4347 | |
| 4348 | /** |
| 4349 | * Used with {@link #ACTION_MAIN} to launch the browser application. |
| 4350 | * The activity should be able to browse the Internet. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4351 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4352 | * since it will not result in the app launching with the correct |
| 4353 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4354 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4355 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4356 | */ |
| 4357 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4358 | public static final String CATEGORY_APP_BROWSER = "android.intent.category.APP_BROWSER"; |
| 4359 | |
| 4360 | /** |
| 4361 | * Used with {@link #ACTION_MAIN} to launch the calculator application. |
| 4362 | * The activity should be able to perform standard arithmetic operations. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4363 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4364 | * since it will not result in the app launching with the correct |
| 4365 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4366 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4367 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4368 | */ |
| 4369 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4370 | public static final String CATEGORY_APP_CALCULATOR = "android.intent.category.APP_CALCULATOR"; |
| 4371 | |
| 4372 | /** |
| 4373 | * Used with {@link #ACTION_MAIN} to launch the calendar application. |
| 4374 | * The activity should be able to view and manipulate calendar entries. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4375 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4376 | * since it will not result in the app launching with the correct |
| 4377 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4378 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4379 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4380 | */ |
| 4381 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4382 | public static final String CATEGORY_APP_CALENDAR = "android.intent.category.APP_CALENDAR"; |
| 4383 | |
| 4384 | /** |
| 4385 | * Used with {@link #ACTION_MAIN} to launch the contacts application. |
| 4386 | * The activity should be able to view and manipulate address book entries. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4387 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4388 | * since it will not result in the app launching with the correct |
| 4389 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4390 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4391 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4392 | */ |
| 4393 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4394 | public static final String CATEGORY_APP_CONTACTS = "android.intent.category.APP_CONTACTS"; |
| 4395 | |
| 4396 | /** |
| 4397 | * Used with {@link #ACTION_MAIN} to launch the email application. |
| 4398 | * The activity should be able to send and receive email. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4399 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4400 | * since it will not result in the app launching with the correct |
| 4401 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4402 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4403 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4404 | */ |
| 4405 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4406 | public static final String CATEGORY_APP_EMAIL = "android.intent.category.APP_EMAIL"; |
| 4407 | |
| 4408 | /** |
| 4409 | * Used with {@link #ACTION_MAIN} to launch the gallery application. |
| 4410 | * The activity should be able to view and manipulate image and video files |
| 4411 | * stored on the device. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4412 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4413 | * since it will not result in the app launching with the correct |
| 4414 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4415 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4416 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4417 | */ |
| 4418 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4419 | public static final String CATEGORY_APP_GALLERY = "android.intent.category.APP_GALLERY"; |
| 4420 | |
| 4421 | /** |
| 4422 | * Used with {@link #ACTION_MAIN} to launch the maps application. |
| 4423 | * The activity should be able to show the user's current location and surroundings. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4424 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4425 | * since it will not result in the app launching with the correct |
| 4426 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4427 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4428 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4429 | */ |
| 4430 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4431 | public static final String CATEGORY_APP_MAPS = "android.intent.category.APP_MAPS"; |
| 4432 | |
| 4433 | /** |
| 4434 | * Used with {@link #ACTION_MAIN} to launch the messaging application. |
| 4435 | * The activity should be able to send and receive text messages. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4436 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4437 | * since it will not result in the app launching with the correct |
| 4438 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4439 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4440 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4441 | */ |
| 4442 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4443 | public static final String CATEGORY_APP_MESSAGING = "android.intent.category.APP_MESSAGING"; |
| 4444 | |
| 4445 | /** |
| 4446 | * Used with {@link #ACTION_MAIN} to launch the music application. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4447 | * The activity should be able to play, browse, or manipulate music files |
| 4448 | * stored on the device. |
| 4449 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4450 | * since it will not result in the app launching with the correct |
| 4451 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4452 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4453 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4454 | */ |
| 4455 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4456 | public static final String CATEGORY_APP_MUSIC = "android.intent.category.APP_MUSIC"; |
| 4457 | |
| 4458 | // --------------------------------------------------------------------- |
| 4459 | // --------------------------------------------------------------------- |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4460 | // Standard extra data keys. |
| 4461 | |
| 4462 | /** |
| 4463 | * The initial data to place in a newly created record. Use with |
| 4464 | * {@link #ACTION_INSERT}. The data here is a Map containing the same |
| 4465 | * fields as would be given to the underlying ContentProvider.insert() |
| 4466 | * call. |
| 4467 | */ |
| 4468 | public static final String EXTRA_TEMPLATE = "android.intent.extra.TEMPLATE"; |
| 4469 | |
| 4470 | /** |
| 4471 | * A constant CharSequence that is associated with the Intent, used with |
| 4472 | * {@link #ACTION_SEND} to supply the literal data to be sent. Note that |
| 4473 | * this may be a styled CharSequence, so you must use |
| 4474 | * {@link Bundle#getCharSequence(String) Bundle.getCharSequence()} to |
| 4475 | * retrieve it. |
| 4476 | */ |
| 4477 | public static final String EXTRA_TEXT = "android.intent.extra.TEXT"; |
| 4478 | |
| 4479 | /** |
Dianne Hackborn | acb69bb | 2012-04-13 15:36:06 -0700 | [diff] [blame] | 4480 | * A constant String that is associated with the Intent, used with |
| 4481 | * {@link #ACTION_SEND} to supply an alternative to {@link #EXTRA_TEXT} |
| 4482 | * as HTML formatted text. Note that you <em>must</em> also supply |
| 4483 | * {@link #EXTRA_TEXT}. |
| 4484 | */ |
| 4485 | public static final String EXTRA_HTML_TEXT = "android.intent.extra.HTML_TEXT"; |
| 4486 | |
| 4487 | /** |
Jeff Sharkey | 81aebe7 | 2017-04-03 20:14:10 +0000 | [diff] [blame] | 4488 | * A content: URI holding a stream of data associated with the Intent, |
| 4489 | * used with {@link #ACTION_SEND} to supply the data being sent. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4490 | */ |
| 4491 | public static final String EXTRA_STREAM = "android.intent.extra.STREAM"; |
| 4492 | |
| 4493 | /** |
| 4494 | * A String[] holding e-mail addresses that should be delivered to. |
| 4495 | */ |
| 4496 | public static final String EXTRA_EMAIL = "android.intent.extra.EMAIL"; |
| 4497 | |
| 4498 | /** |
| 4499 | * A String[] holding e-mail addresses that should be carbon copied. |
| 4500 | */ |
| 4501 | public static final String EXTRA_CC = "android.intent.extra.CC"; |
| 4502 | |
| 4503 | /** |
| 4504 | * A String[] holding e-mail addresses that should be blind carbon copied. |
| 4505 | */ |
| 4506 | public static final String EXTRA_BCC = "android.intent.extra.BCC"; |
| 4507 | |
| 4508 | /** |
| 4509 | * A constant string holding the desired subject line of a message. |
| 4510 | */ |
| 4511 | public static final String EXTRA_SUBJECT = "android.intent.extra.SUBJECT"; |
| 4512 | |
| 4513 | /** |
| 4514 | * An Intent describing the choices you would like shown with |
Adam Powell | 2ed547e | 2015-04-29 18:45:04 -0700 | [diff] [blame] | 4515 | * {@link #ACTION_PICK_ACTIVITY} or {@link #ACTION_CHOOSER}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4516 | */ |
| 4517 | public static final String EXTRA_INTENT = "android.intent.extra.INTENT"; |
| 4518 | |
| 4519 | /** |
Clara Bayarri | f7fea16 | 2015-10-22 16:09:52 +0100 | [diff] [blame] | 4520 | * An int representing the user id to be used. |
| 4521 | * |
| 4522 | * @hide |
| 4523 | */ |
| 4524 | public static final String EXTRA_USER_ID = "android.intent.extra.USER_ID"; |
| 4525 | |
| 4526 | /** |
Clara Bayarri | ea9b10e | 2015-12-04 15:36:26 +0000 | [diff] [blame] | 4527 | * An int representing the task id to be retrieved. This is used when a launch from recents is |
| 4528 | * intercepted by another action such as credentials confirmation to remember which task should |
| 4529 | * be resumed when complete. |
| 4530 | * |
| 4531 | * @hide |
| 4532 | */ |
| 4533 | public static final String EXTRA_TASK_ID = "android.intent.extra.TASK_ID"; |
| 4534 | |
| 4535 | /** |
Adam Powell | 2ed547e | 2015-04-29 18:45:04 -0700 | [diff] [blame] | 4536 | * An Intent[] describing additional, alternate choices you would like shown with |
| 4537 | * {@link #ACTION_CHOOSER}. |
| 4538 | * |
| 4539 | * <p>An app may be capable of providing several different payload types to complete a |
| 4540 | * user's intended action. For example, an app invoking {@link #ACTION_SEND} to share photos |
| 4541 | * with another app may use EXTRA_ALTERNATE_INTENTS to have the chooser transparently offer |
| 4542 | * several different supported sending mechanisms for sharing, such as the actual "image/*" |
| 4543 | * photo data or a hosted link where the photos can be viewed.</p> |
| 4544 | * |
| 4545 | * <p>The intent present in {@link #EXTRA_INTENT} will be treated as the |
| 4546 | * first/primary/preferred intent in the set. Additional intents specified in |
| 4547 | * this extra are ordered; by default intents that appear earlier in the array will be |
| 4548 | * preferred over intents that appear later in the array as matches for the same |
| 4549 | * target component. To alter this preference, a calling app may also supply |
| 4550 | * {@link #EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER}.</p> |
| 4551 | */ |
| 4552 | public static final String EXTRA_ALTERNATE_INTENTS = "android.intent.extra.ALTERNATE_INTENTS"; |
| 4553 | |
| 4554 | /** |
Adam Powell | 52c3921 | 2016-04-07 15:14:18 -0700 | [diff] [blame] | 4555 | * A {@link ComponentName ComponentName[]} describing components that should be filtered out |
| 4556 | * and omitted from a list of components presented to the user. |
| 4557 | * |
| 4558 | * <p>When used with {@link #ACTION_CHOOSER}, the chooser will omit any of the components |
| 4559 | * in this array if it otherwise would have shown them. Useful for omitting specific targets |
| 4560 | * from your own package or other apps from your organization if the idea of sending to those |
| 4561 | * targets would be redundant with other app functionality. Filtered components will not |
| 4562 | * be able to present targets from an associated <code>ChooserTargetService</code>.</p> |
| 4563 | */ |
| 4564 | public static final String EXTRA_EXCLUDE_COMPONENTS |
| 4565 | = "android.intent.extra.EXCLUDE_COMPONENTS"; |
| 4566 | |
| 4567 | /** |
| 4568 | * A {@link android.service.chooser.ChooserTarget ChooserTarget[]} for {@link #ACTION_CHOOSER} |
| 4569 | * describing additional high-priority deep-link targets for the chooser to present to the user. |
| 4570 | * |
| 4571 | * <p>Targets provided in this way will be presented inline with all other targets provided |
| 4572 | * by services from other apps. They will be prioritized before other service targets, but |
| 4573 | * after those targets provided by sources that the user has manually pinned to the front.</p> |
| 4574 | * |
| 4575 | * @see #ACTION_CHOOSER |
| 4576 | */ |
| 4577 | public static final String EXTRA_CHOOSER_TARGETS = "android.intent.extra.CHOOSER_TARGETS"; |
| 4578 | |
| 4579 | /** |
Adam Powell | 2ed547e | 2015-04-29 18:45:04 -0700 | [diff] [blame] | 4580 | * An {@link IntentSender} for an Activity that will be invoked when the user makes a selection |
| 4581 | * from the chooser activity presented by {@link #ACTION_CHOOSER}. |
| 4582 | * |
| 4583 | * <p>An app preparing an action for another app to complete may wish to allow the user to |
| 4584 | * disambiguate between several options for completing the action based on the chosen target |
| 4585 | * or otherwise refine the action before it is invoked. |
| 4586 | * </p> |
| 4587 | * |
| 4588 | * <p>When sent, this IntentSender may be filled in with the following extras:</p> |
| 4589 | * <ul> |
| 4590 | * <li>{@link #EXTRA_INTENT} The first intent that matched the user's chosen target</li> |
| 4591 | * <li>{@link #EXTRA_ALTERNATE_INTENTS} Any additional intents that also matched the user's |
| 4592 | * chosen target beyond the first</li> |
| 4593 | * <li>{@link #EXTRA_RESULT_RECEIVER} A {@link ResultReceiver} that the refinement activity |
| 4594 | * should fill in and send once the disambiguation is complete</li> |
| 4595 | * </ul> |
| 4596 | */ |
| 4597 | public static final String EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER |
| 4598 | = "android.intent.extra.CHOOSER_REFINEMENT_INTENT_SENDER"; |
| 4599 | |
| 4600 | /** |
Kang Li | 9fa2a2c | 2017-01-06 13:33:24 -0800 | [diff] [blame] | 4601 | * An {@code ArrayList} of {@code String} annotations describing content for |
| 4602 | * {@link #ACTION_CHOOSER}. |
| 4603 | * |
| 4604 | * <p>If {@link #EXTRA_CONTENT_ANNOTATIONS} is present in an intent used to start a |
| 4605 | * {@link #ACTION_CHOOSER} activity, the first three annotations will be used to rank apps.</p> |
| 4606 | * |
| 4607 | * <p>Annotations should describe the major components or topics of the content. It is up to |
| 4608 | * apps initiating {@link #ACTION_CHOOSER} to learn and add annotations. Annotations should be |
| 4609 | * learned in advance, e.g., when creating or saving content, to avoid increasing latency to |
Kang Li | 2f85e8a | 2017-04-26 09:19:54 -0700 | [diff] [blame] | 4610 | * start {@link #ACTION_CHOOSER}. Names of customized annotations should not contain the colon |
| 4611 | * character. Performance on customized annotations can suffer, if they are rarely used for |
| 4612 | * {@link #ACTION_CHOOSER} in the past 14 days. Therefore, it is recommended to use the |
| 4613 | * following annotations when applicable.</p> |
Kang Li | 9fa2a2c | 2017-01-06 13:33:24 -0800 | [diff] [blame] | 4614 | * <ul> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4615 | * <li>"product" represents that the topic of the content is mainly about products, e.g., |
Kang Li | 9fa2a2c | 2017-01-06 13:33:24 -0800 | [diff] [blame] | 4616 | * health & beauty, and office supplies.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4617 | * <li>"emotion" represents that the topic of the content is mainly about emotions, e.g., |
Kang Li | 9fa2a2c | 2017-01-06 13:33:24 -0800 | [diff] [blame] | 4618 | * happy, and sad.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4619 | * <li>"person" represents that the topic of the content is mainly about persons, e.g., |
Kang Li | 9fa2a2c | 2017-01-06 13:33:24 -0800 | [diff] [blame] | 4620 | * face, finger, standing, and walking.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4621 | * <li>"child" represents that the topic of the content is mainly about children, e.g., |
Kang Li | 9fa2a2c | 2017-01-06 13:33:24 -0800 | [diff] [blame] | 4622 | * child, and baby.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4623 | * <li>"selfie" represents that the topic of the content is mainly about selfies.</li> |
| 4624 | * <li>"crowd" represents that the topic of the content is mainly about crowds.</li> |
| 4625 | * <li>"party" represents that the topic of the content is mainly about parties.</li> |
| 4626 | * <li>"animal" represent that the topic of the content is mainly about animals.</li> |
| 4627 | * <li>"plant" represents that the topic of the content is mainly about plants, e.g., |
Kang Li | 9fa2a2c | 2017-01-06 13:33:24 -0800 | [diff] [blame] | 4628 | * flowers.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4629 | * <li>"vacation" represents that the topic of the content is mainly about vacations.</li> |
| 4630 | * <li>"fashion" represents that the topic of the content is mainly about fashion, e.g. |
Kang Li | 9fa2a2c | 2017-01-06 13:33:24 -0800 | [diff] [blame] | 4631 | * sunglasses, jewelry, handbags and clothing.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4632 | * <li>"material" represents that the topic of the content is mainly about materials, e.g., |
Kang Li | 9fa2a2c | 2017-01-06 13:33:24 -0800 | [diff] [blame] | 4633 | * paper, and silk.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4634 | * <li>"vehicle" represents that the topic of the content is mainly about vehicles, like |
Kang Li | 9fa2a2c | 2017-01-06 13:33:24 -0800 | [diff] [blame] | 4635 | * cars, and boats.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4636 | * <li>"document" represents that the topic of the content is mainly about documents, e.g. |
Kang Li | 9fa2a2c | 2017-01-06 13:33:24 -0800 | [diff] [blame] | 4637 | * posters.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4638 | * <li>"design" represents that the topic of the content is mainly about design, e.g. arts |
Kang Li | 9fa2a2c | 2017-01-06 13:33:24 -0800 | [diff] [blame] | 4639 | * and designs of houses.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4640 | * <li>"holiday" represents that the topic of the content is mainly about holidays, e.g., |
Kang Li | 9fa2a2c | 2017-01-06 13:33:24 -0800 | [diff] [blame] | 4641 | * Christmas and Thanksgiving.</li> |
| 4642 | * </ul> |
| 4643 | */ |
| 4644 | public static final String EXTRA_CONTENT_ANNOTATIONS |
| 4645 | = "android.intent.extra.CONTENT_ANNOTATIONS"; |
| 4646 | |
| 4647 | /** |
Adam Powell | 2ed547e | 2015-04-29 18:45:04 -0700 | [diff] [blame] | 4648 | * A {@link ResultReceiver} used to return data back to the sender. |
| 4649 | * |
| 4650 | * <p>Used to complete an app-specific |
| 4651 | * {@link #EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER refinement} for {@link #ACTION_CHOOSER}.</p> |
| 4652 | * |
| 4653 | * <p>If {@link #EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER} is present in the intent |
| 4654 | * used to start a {@link #ACTION_CHOOSER} activity this extra will be |
| 4655 | * {@link #fillIn(Intent, int) filled in} to that {@link IntentSender} and sent |
| 4656 | * when the user selects a target component from the chooser. It is up to the recipient |
| 4657 | * to send a result to this ResultReceiver to signal that disambiguation is complete |
| 4658 | * and that the chooser should invoke the user's choice.</p> |
| 4659 | * |
| 4660 | * <p>The disambiguator should provide a Bundle to the ResultReceiver with an intent |
| 4661 | * assigned to the key {@link #EXTRA_INTENT}. This supplied intent will be used by the chooser |
| 4662 | * to match and fill in the final Intent or ChooserTarget before starting it. |
| 4663 | * The supplied intent must {@link #filterEquals(Intent) match} one of the intents from |
| 4664 | * {@link #EXTRA_INTENT} or {@link #EXTRA_ALTERNATE_INTENTS} passed to |
| 4665 | * {@link #EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER} to be accepted.</p> |
| 4666 | * |
| 4667 | * <p>The result code passed to the ResultReceiver should be |
| 4668 | * {@link android.app.Activity#RESULT_OK} if the refinement succeeded and the supplied intent's |
| 4669 | * target in the chooser should be started, or {@link android.app.Activity#RESULT_CANCELED} if |
| 4670 | * the chooser should finish without starting a target.</p> |
| 4671 | */ |
| 4672 | public static final String EXTRA_RESULT_RECEIVER |
| 4673 | = "android.intent.extra.RESULT_RECEIVER"; |
| 4674 | |
| 4675 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4676 | * A CharSequence dialog title to provide to the user when used with a |
Jim Miller | 4d64746d | 2014-08-13 21:08:41 +0000 | [diff] [blame] | 4677 | * {@link #ACTION_CHOOSER}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4678 | */ |
| 4679 | public static final String EXTRA_TITLE = "android.intent.extra.TITLE"; |
| 4680 | |
| 4681 | /** |
Dianne Hackborn | eb03465 | 2009-09-07 00:49:58 -0700 | [diff] [blame] | 4682 | * A Parcelable[] of {@link Intent} or |
| 4683 | * {@link android.content.pm.LabeledIntent} objects as set with |
| 4684 | * {@link #putExtra(String, Parcelable[])} of additional activities to place |
| 4685 | * a the front of the list of choices, when shown to the user with a |
| 4686 | * {@link #ACTION_CHOOSER}. |
| 4687 | */ |
| 4688 | public static final String EXTRA_INITIAL_INTENTS = "android.intent.extra.INITIAL_INTENTS"; |
| 4689 | |
| 4690 | /** |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4691 | * A {@link IntentSender} to start after instant app installation success. |
Todd Kennedy | 7440f17 | 2015-12-09 14:31:22 -0800 | [diff] [blame] | 4692 | * @hide |
| 4693 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4694 | @SystemApi |
| 4695 | public static final String EXTRA_INSTANT_APP_SUCCESS = |
| 4696 | "android.intent.extra.INSTANT_APP_SUCCESS"; |
| 4697 | |
| 4698 | /** |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4699 | * A {@link IntentSender} to start after instant app installation failure. |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 4700 | * @hide |
| 4701 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4702 | @SystemApi |
| 4703 | public static final String EXTRA_INSTANT_APP_FAILURE = |
| 4704 | "android.intent.extra.INSTANT_APP_FAILURE"; |
| 4705 | |
| 4706 | /** |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4707 | * The host name that triggered an instant app resolution. |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 4708 | * @hide |
| 4709 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4710 | @SystemApi |
| 4711 | public static final String EXTRA_INSTANT_APP_HOSTNAME = |
| 4712 | "android.intent.extra.INSTANT_APP_HOSTNAME"; |
| 4713 | |
| 4714 | /** |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4715 | * An opaque token to track instant app resolution. |
| 4716 | * @hide |
| 4717 | */ |
| 4718 | @SystemApi |
| 4719 | public static final String EXTRA_INSTANT_APP_TOKEN = |
| 4720 | "android.intent.extra.INSTANT_APP_TOKEN"; |
| 4721 | |
| 4722 | /** |
Patrick Baumann | b4165d7 | 2017-12-04 11:29:24 -0800 | [diff] [blame] | 4723 | * The action that triggered an instant application resolution. |
| 4724 | * @hide |
| 4725 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4726 | @SystemApi |
Patrick Baumann | b4165d7 | 2017-12-04 11:29:24 -0800 | [diff] [blame] | 4727 | public static final String EXTRA_INSTANT_APP_ACTION = "android.intent.extra.INSTANT_APP_ACTION"; |
| 4728 | |
| 4729 | /** |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 4730 | * An array of {@link Bundle}s containing details about resolved instant apps.. |
| 4731 | * @hide |
| 4732 | */ |
| 4733 | @SystemApi |
| 4734 | public static final String EXTRA_INSTANT_APP_BUNDLES = |
| 4735 | "android.intent.extra.INSTANT_APP_BUNDLES"; |
| 4736 | |
| 4737 | /** |
| 4738 | * A {@link Bundle} of metadata that describes the instant application that needs to be |
Patrick Baumann | 709ee15 | 2017-12-04 16:12:52 -0800 | [diff] [blame] | 4739 | * installed. This data is populated from the response to |
| 4740 | * {@link android.content.pm.InstantAppResolveInfo#getExtras()} as provided by the registered |
| 4741 | * instant application resolver. |
| 4742 | * @hide |
| 4743 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4744 | @SystemApi |
Patrick Baumann | 709ee15 | 2017-12-04 16:12:52 -0800 | [diff] [blame] | 4745 | public static final String EXTRA_INSTANT_APP_EXTRAS = |
| 4746 | "android.intent.extra.INSTANT_APP_EXTRAS"; |
| 4747 | |
| 4748 | /** |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 4749 | * A boolean value indicating that the instant app resolver was unable to state with certainty |
| 4750 | * that it did or did not have an app for the sanitized {@link Intent} defined at |
| 4751 | * {@link #EXTRA_INTENT}. |
| 4752 | * @hide |
| 4753 | */ |
| 4754 | @SystemApi |
| 4755 | public static final String EXTRA_UNKNOWN_INSTANT_APP = |
| 4756 | "android.intent.extra.UNKNOWN_INSTANT_APP"; |
| 4757 | |
| 4758 | /** |
Todd Kennedy | 316c2f2 | 2017-01-23 15:40:07 -0800 | [diff] [blame] | 4759 | * The version code of the app to install components from. |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 4760 | * @deprecated Use {@link #EXTRA_LONG_VERSION_CODE). |
Todd Kennedy | 316c2f2 | 2017-01-23 15:40:07 -0800 | [diff] [blame] | 4761 | * @hide |
| 4762 | */ |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 4763 | @Deprecated |
Todd Kennedy | 316c2f2 | 2017-01-23 15:40:07 -0800 | [diff] [blame] | 4764 | public static final String EXTRA_VERSION_CODE = "android.intent.extra.VERSION_CODE"; |
| 4765 | |
| 4766 | /** |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 4767 | * The version code of the app to install components from. |
| 4768 | * @hide |
| 4769 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4770 | @SystemApi |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 4771 | public static final String EXTRA_LONG_VERSION_CODE = "android.intent.extra.LONG_VERSION_CODE"; |
| 4772 | |
| 4773 | /** |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4774 | * The app that triggered the instant app installation. |
Chad Brubaker | 0606861 | 2017-04-06 09:43:47 -0700 | [diff] [blame] | 4775 | * @hide |
| 4776 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4777 | @SystemApi |
Chad Brubaker | 0606861 | 2017-04-06 09:43:47 -0700 | [diff] [blame] | 4778 | public static final String EXTRA_CALLING_PACKAGE |
| 4779 | = "android.intent.extra.CALLING_PACKAGE"; |
| 4780 | |
| 4781 | /** |
| 4782 | * Optional calling app provided bundle containing additional launch information the |
| 4783 | * installer may use. |
| 4784 | * @hide |
| 4785 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4786 | @SystemApi |
Chad Brubaker | 0606861 | 2017-04-06 09:43:47 -0700 | [diff] [blame] | 4787 | public static final String EXTRA_VERIFICATION_BUNDLE |
| 4788 | = "android.intent.extra.VERIFICATION_BUNDLE"; |
| 4789 | |
| 4790 | /** |
Adam Powell | e49d939 | 2014-07-17 18:45:19 -0700 | [diff] [blame] | 4791 | * A Bundle forming a mapping of potential target package names to different extras Bundles |
| 4792 | * to add to the default intent extras in {@link #EXTRA_INTENT} when used with |
| 4793 | * {@link #ACTION_CHOOSER}. Each key should be a package name. The package need not |
| 4794 | * be currently installed on the device. |
| 4795 | * |
| 4796 | * <p>An application may choose to provide alternate extras for the case where a user |
| 4797 | * selects an activity from a predetermined set of target packages. If the activity |
| 4798 | * the user selects from the chooser belongs to a package with its package name as |
| 4799 | * a key in this bundle, the corresponding extras for that package will be merged with |
| 4800 | * the extras already present in the intent at {@link #EXTRA_INTENT}. If a replacement |
| 4801 | * extra has the same key as an extra already present in the intent it will overwrite |
| 4802 | * the extra from the intent.</p> |
| 4803 | * |
| 4804 | * <p><em>Examples:</em> |
| 4805 | * <ul> |
| 4806 | * <li>An application may offer different {@link #EXTRA_TEXT} to an application |
| 4807 | * when sharing with it via {@link #ACTION_SEND}, augmenting a link with additional query |
| 4808 | * parameters for that target.</li> |
| 4809 | * <li>An application may offer additional metadata for known targets of a given intent |
| 4810 | * to pass along information only relevant to that target such as account or content |
| 4811 | * identifiers already known to that application.</li> |
| 4812 | * </ul></p> |
| 4813 | */ |
| 4814 | public static final String EXTRA_REPLACEMENT_EXTRAS = |
| 4815 | "android.intent.extra.REPLACEMENT_EXTRAS"; |
| 4816 | |
| 4817 | /** |
Adam Powell | 0b3c112 | 2014-10-09 12:50:14 -0700 | [diff] [blame] | 4818 | * An {@link IntentSender} that will be notified if a user successfully chooses a target |
| 4819 | * component to handle an action in an {@link #ACTION_CHOOSER} activity. The IntentSender |
| 4820 | * will have the extra {@link #EXTRA_CHOSEN_COMPONENT} appended to it containing the |
| 4821 | * {@link ComponentName} of the chosen component. |
| 4822 | * |
| 4823 | * <p>In some situations this callback may never come, for example if the user abandons |
| 4824 | * the chooser, switches to another task or any number of other reasons. Apps should not |
| 4825 | * be written assuming that this callback will always occur.</p> |
| 4826 | */ |
| 4827 | public static final String EXTRA_CHOSEN_COMPONENT_INTENT_SENDER = |
| 4828 | "android.intent.extra.CHOSEN_COMPONENT_INTENT_SENDER"; |
| 4829 | |
| 4830 | /** |
| 4831 | * The {@link ComponentName} chosen by the user to complete an action. |
| 4832 | * |
| 4833 | * @see #EXTRA_CHOSEN_COMPONENT_INTENT_SENDER |
| 4834 | */ |
| 4835 | public static final String EXTRA_CHOSEN_COMPONENT = "android.intent.extra.CHOSEN_COMPONENT"; |
| 4836 | |
| 4837 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4838 | * A {@link android.view.KeyEvent} object containing the event that |
| 4839 | * triggered the creation of the Intent it is in. |
| 4840 | */ |
| 4841 | public static final String EXTRA_KEY_EVENT = "android.intent.extra.KEY_EVENT"; |
| 4842 | |
| 4843 | /** |
Mike Lockwood | bad80e0 | 2009-07-30 01:21:08 -0700 | [diff] [blame] | 4844 | * Set to true in {@link #ACTION_REQUEST_SHUTDOWN} to request confirmation from the user |
| 4845 | * before shutting down. |
| 4846 | * |
| 4847 | * {@hide} |
| 4848 | */ |
| 4849 | public static final String EXTRA_KEY_CONFIRM = "android.intent.extra.KEY_CONFIRM"; |
| 4850 | |
| 4851 | /** |
Yusuke Sato | 705ffd1 | 2015-07-21 15:52:11 -0700 | [diff] [blame] | 4852 | * Set to true in {@link #ACTION_REQUEST_SHUTDOWN} to indicate that the shutdown is |
| 4853 | * requested by the user. |
| 4854 | * |
| 4855 | * {@hide} |
| 4856 | */ |
| 4857 | public static final String EXTRA_USER_REQUESTED_SHUTDOWN = |
| 4858 | "android.intent.extra.USER_REQUESTED_SHUTDOWN"; |
| 4859 | |
| 4860 | /** |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 4861 | * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} or |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4862 | * {@link android.content.Intent#ACTION_PACKAGE_CHANGED} intents to override the default action |
| 4863 | * of restarting the application. |
| 4864 | */ |
| 4865 | public static final String EXTRA_DONT_KILL_APP = "android.intent.extra.DONT_KILL_APP"; |
| 4866 | |
| 4867 | /** |
| 4868 | * A String holding the phone number originally entered in |
| 4869 | * {@link android.content.Intent#ACTION_NEW_OUTGOING_CALL}, or the actual |
| 4870 | * number to call in a {@link android.content.Intent#ACTION_CALL}. |
| 4871 | */ |
| 4872 | public static final String EXTRA_PHONE_NUMBER = "android.intent.extra.PHONE_NUMBER"; |
Bernd Holzhey | aea4b67 | 2010-03-31 09:46:13 +0200 | [diff] [blame] | 4873 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4874 | /** |
| 4875 | * Used as an int extra field in {@link android.content.Intent#ACTION_UID_REMOVED} |
| 4876 | * intents to supply the uid the package had been assigned. Also an optional |
| 4877 | * extra in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} or |
| 4878 | * {@link android.content.Intent#ACTION_PACKAGE_CHANGED} for the same |
| 4879 | * purpose. |
| 4880 | */ |
| 4881 | public static final String EXTRA_UID = "android.intent.extra.UID"; |
| 4882 | |
| 4883 | /** |
Dianne Hackborn | 21f1bd1 | 2010-02-19 17:02:21 -0800 | [diff] [blame] | 4884 | * @hide String array of package names. |
| 4885 | */ |
Soonil Nagarkar | 0e8fd09 | 2015-02-10 10:37:36 -0800 | [diff] [blame] | 4886 | @SystemApi |
Dianne Hackborn | 21f1bd1 | 2010-02-19 17:02:21 -0800 | [diff] [blame] | 4887 | public static final String EXTRA_PACKAGES = "android.intent.extra.PACKAGES"; |
| 4888 | |
| 4889 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4890 | * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} |
| 4891 | * intents to indicate whether this represents a full uninstall (removing |
| 4892 | * both the code and its data) or a partial uninstall (leaving its data, |
| 4893 | * implying that this is an update). |
| 4894 | */ |
| 4895 | public static final String EXTRA_DATA_REMOVED = "android.intent.extra.DATA_REMOVED"; |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 4896 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4897 | /** |
Dianne Hackborn | c72fc67 | 2012-09-20 13:12:03 -0700 | [diff] [blame] | 4898 | * @hide |
| 4899 | * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} |
| 4900 | * intents to indicate that at this point the package has been removed for |
| 4901 | * all users on the device. |
| 4902 | */ |
| 4903 | public static final String EXTRA_REMOVED_FOR_ALL_USERS |
| 4904 | = "android.intent.extra.REMOVED_FOR_ALL_USERS"; |
| 4905 | |
| 4906 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4907 | * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} |
| 4908 | * intents to indicate that this is a replacement of the package, so this |
| 4909 | * broadcast will immediately be followed by an add broadcast for a |
| 4910 | * different version of the same package. |
| 4911 | */ |
| 4912 | public static final String EXTRA_REPLACING = "android.intent.extra.REPLACING"; |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 4913 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4914 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4915 | * Used as an int extra field in {@link android.app.AlarmManager} intents |
| 4916 | * to tell the application being invoked how many pending alarms are being |
| 4917 | * delievered with the intent. For one-shot alarms this will always be 1. |
| 4918 | * For recurring alarms, this might be greater than 1 if the device was |
| 4919 | * asleep or powered off at the time an earlier alarm would have been |
| 4920 | * delivered. |
| 4921 | */ |
| 4922 | public static final String EXTRA_ALARM_COUNT = "android.intent.extra.ALARM_COUNT"; |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 4923 | |
Jacek Surazski | 86b6c53 | 2009-05-13 14:38:28 +0200 | [diff] [blame] | 4924 | /** |
Dan Murphy | c9f4eaf | 2009-08-12 15:15:43 -0500 | [diff] [blame] | 4925 | * Used as an int extra field in {@link android.content.Intent#ACTION_DOCK_EVENT} |
| 4926 | * intents to request the dock state. Possible values are |
Mike Lockwood | 725fcbf | 2009-08-24 13:09:20 -0700 | [diff] [blame] | 4927 | * {@link android.content.Intent#EXTRA_DOCK_STATE_UNDOCKED}, |
| 4928 | * {@link android.content.Intent#EXTRA_DOCK_STATE_DESK}, or |
Praveen Bharathi | 21e941b | 2010-10-06 15:23:14 -0500 | [diff] [blame] | 4929 | * {@link android.content.Intent#EXTRA_DOCK_STATE_CAR}, or |
| 4930 | * {@link android.content.Intent#EXTRA_DOCK_STATE_LE_DESK}, or |
| 4931 | * {@link android.content.Intent#EXTRA_DOCK_STATE_HE_DESK}. |
Dan Murphy | c9f4eaf | 2009-08-12 15:15:43 -0500 | [diff] [blame] | 4932 | */ |
| 4933 | public static final String EXTRA_DOCK_STATE = "android.intent.extra.DOCK_STATE"; |
| 4934 | |
| 4935 | /** |
| 4936 | * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} |
| 4937 | * to represent that the phone is not in any dock. |
Dan Murphy | c9f4eaf | 2009-08-12 15:15:43 -0500 | [diff] [blame] | 4938 | */ |
| 4939 | public static final int EXTRA_DOCK_STATE_UNDOCKED = 0; |
| 4940 | |
| 4941 | /** |
| 4942 | * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} |
| 4943 | * to represent that the phone is in a desk dock. |
Dan Murphy | c9f4eaf | 2009-08-12 15:15:43 -0500 | [diff] [blame] | 4944 | */ |
| 4945 | public static final int EXTRA_DOCK_STATE_DESK = 1; |
| 4946 | |
| 4947 | /** |
| 4948 | * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} |
| 4949 | * to represent that the phone is in a car dock. |
Dan Murphy | c9f4eaf | 2009-08-12 15:15:43 -0500 | [diff] [blame] | 4950 | */ |
| 4951 | public static final int EXTRA_DOCK_STATE_CAR = 2; |
| 4952 | |
| 4953 | /** |
Praveen Bharathi | 21e941b | 2010-10-06 15:23:14 -0500 | [diff] [blame] | 4954 | * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} |
| 4955 | * to represent that the phone is in a analog (low end) dock. |
| 4956 | */ |
| 4957 | public static final int EXTRA_DOCK_STATE_LE_DESK = 3; |
| 4958 | |
| 4959 | /** |
| 4960 | * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} |
| 4961 | * to represent that the phone is in a digital (high end) dock. |
| 4962 | */ |
| 4963 | public static final int EXTRA_DOCK_STATE_HE_DESK = 4; |
| 4964 | |
| 4965 | /** |
Dianne Hackborn | 9bfb707 | 2009-09-22 11:37:40 -0700 | [diff] [blame] | 4966 | * Boolean that can be supplied as meta-data with a dock activity, to |
| 4967 | * indicate that the dock should take over the home key when it is active. |
| 4968 | */ |
| 4969 | public static final String METADATA_DOCK_HOME = "android.dock_home"; |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 4970 | |
Dianne Hackborn | 9bfb707 | 2009-09-22 11:37:40 -0700 | [diff] [blame] | 4971 | /** |
Jacek Surazski | 86b6c53 | 2009-05-13 14:38:28 +0200 | [diff] [blame] | 4972 | * Used as a parcelable extra field in {@link #ACTION_APP_ERROR}, containing |
| 4973 | * the bug report. |
Jacek Surazski | 86b6c53 | 2009-05-13 14:38:28 +0200 | [diff] [blame] | 4974 | */ |
| 4975 | public static final String EXTRA_BUG_REPORT = "android.intent.extra.BUG_REPORT"; |
| 4976 | |
| 4977 | /** |
Wei Huang | 97ecc9c | 2009-05-11 17:44:20 -0700 | [diff] [blame] | 4978 | * Used in the extra field in the remote intent. It's astring token passed with the |
| 4979 | * remote intent. |
| 4980 | */ |
| 4981 | public static final String EXTRA_REMOTE_INTENT_TOKEN = |
| 4982 | "android.intent.extra.remote_intent_token"; |
| 4983 | |
Suchi Amalapurapu | 0214e94 | 2009-09-02 11:03:18 -0700 | [diff] [blame] | 4984 | /** |
Dianne Hackborn | 1d62ea9 | 2009-11-17 12:49:50 -0800 | [diff] [blame] | 4985 | * @deprecated See {@link #EXTRA_CHANGED_COMPONENT_NAME_LIST}; this field |
Dianne Hackborn | 86a72da | 2009-11-11 20:12:41 -0800 | [diff] [blame] | 4986 | * will contain only the first name in the list. |
Suchi Amalapurapu | 0214e94 | 2009-09-02 11:03:18 -0700 | [diff] [blame] | 4987 | */ |
Dianne Hackborn | 1d62ea9 | 2009-11-17 12:49:50 -0800 | [diff] [blame] | 4988 | @Deprecated public static final String EXTRA_CHANGED_COMPONENT_NAME = |
Suchi Amalapurapu | 0214e94 | 2009-09-02 11:03:18 -0700 | [diff] [blame] | 4989 | "android.intent.extra.changed_component_name"; |
| 4990 | |
Dianne Hackborn | dd9b82c | 2009-09-03 00:18:47 -0700 | [diff] [blame] | 4991 | /** |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 4992 | * This field is part of {@link android.content.Intent#ACTION_PACKAGE_CHANGED}, |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 4993 | * and contains a string array of all of the components that have changed. If |
| 4994 | * the state of the overall package has changed, then it will contain an entry |
| 4995 | * with the package name itself. |
Dianne Hackborn | 86a72da | 2009-11-11 20:12:41 -0800 | [diff] [blame] | 4996 | */ |
| 4997 | public static final String EXTRA_CHANGED_COMPONENT_NAME_LIST = |
| 4998 | "android.intent.extra.changed_component_name_list"; |
| 4999 | |
| 5000 | /** |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 5001 | * This field is part of |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 5002 | * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_AVAILABLE}, |
Andrei Stingaceanu | 69d5ebc | 2016-01-14 12:59:03 +0000 | [diff] [blame] | 5003 | * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE}, |
| 5004 | * {@link android.content.Intent#ACTION_PACKAGES_SUSPENDED}, |
| 5005 | * {@link android.content.Intent#ACTION_PACKAGES_UNSUSPENDED} |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 5006 | * and contains a string array of all of the components that have changed. |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 5007 | */ |
| 5008 | public static final String EXTRA_CHANGED_PACKAGE_LIST = |
| 5009 | "android.intent.extra.changed_package_list"; |
| 5010 | |
| 5011 | /** |
| 5012 | * This field is part of |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 5013 | * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_AVAILABLE}, |
| 5014 | * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE} |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 5015 | * and contains an integer array of uids of all of the components |
| 5016 | * that have changed. |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 5017 | */ |
| 5018 | public static final String EXTRA_CHANGED_UID_LIST = |
| 5019 | "android.intent.extra.changed_uid_list"; |
| 5020 | |
| 5021 | /** |
Dianne Hackborn | dd9b82c | 2009-09-03 00:18:47 -0700 | [diff] [blame] | 5022 | * @hide |
| 5023 | * Magic extra system code can use when binding, to give a label for |
| 5024 | * who it is that has bound to a service. This is an integer giving |
| 5025 | * a framework string resource that can be displayed to the user. |
| 5026 | */ |
| 5027 | public static final String EXTRA_CLIENT_LABEL = |
| 5028 | "android.intent.extra.client_label"; |
| 5029 | |
| 5030 | /** |
| 5031 | * @hide |
| 5032 | * Magic extra system code can use when binding, to give a PendingIntent object |
| 5033 | * that can be launched for the user to disable the system's use of this |
| 5034 | * service. |
| 5035 | */ |
| 5036 | public static final String EXTRA_CLIENT_INTENT = |
| 5037 | "android.intent.extra.client_intent"; |
| 5038 | |
Dianne Hackborn | c4d0e6f | 2011-01-25 14:55:06 -0800 | [diff] [blame] | 5039 | /** |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5040 | * Extra used to indicate that an intent should only return data that is on |
| 5041 | * the local device. This is a boolean extra; the default is false. If true, |
| 5042 | * an implementation should only allow the user to select data that is |
| 5043 | * already on the device, not requiring it be downloaded from a remote |
| 5044 | * service when opened. |
| 5045 | * |
| 5046 | * @see #ACTION_GET_CONTENT |
| 5047 | * @see #ACTION_OPEN_DOCUMENT |
Jeff Sharkey | b9fbb72 | 2014-06-04 16:42:47 -0700 | [diff] [blame] | 5048 | * @see #ACTION_OPEN_DOCUMENT_TREE |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5049 | * @see #ACTION_CREATE_DOCUMENT |
Dianne Hackborn | c4d0e6f | 2011-01-25 14:55:06 -0800 | [diff] [blame] | 5050 | */ |
| 5051 | public static final String EXTRA_LOCAL_ONLY = |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5052 | "android.intent.extra.LOCAL_ONLY"; |
Daniel Lehmann | a5b58df | 2011-10-12 16:24:22 -0700 | [diff] [blame] | 5053 | |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 5054 | /** |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5055 | * Extra used to indicate that an intent can allow the user to select and |
| 5056 | * return multiple items. This is a boolean extra; the default is false. If |
| 5057 | * true, an implementation is allowed to present the user with a UI where |
| 5058 | * they can pick multiple items that are all returned to the caller. When |
| 5059 | * this happens, they should be returned as the {@link #getClipData()} part |
| 5060 | * of the result Intent. |
| 5061 | * |
| 5062 | * @see #ACTION_GET_CONTENT |
| 5063 | * @see #ACTION_OPEN_DOCUMENT |
Dianne Hackborn | fdb3f09 | 2013-01-28 15:10:48 -0800 | [diff] [blame] | 5064 | */ |
| 5065 | public static final String EXTRA_ALLOW_MULTIPLE = |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5066 | "android.intent.extra.ALLOW_MULTIPLE"; |
Dianne Hackborn | fdb3f09 | 2013-01-28 15:10:48 -0800 | [diff] [blame] | 5067 | |
| 5068 | /** |
Alexandra Gherghina | c17d7e0 | 2014-04-04 16:27:28 +0100 | [diff] [blame] | 5069 | * The integer userHandle carried with broadcast intents related to addition, removal and |
| 5070 | * switching of users and managed profiles - {@link #ACTION_USER_ADDED}, |
| 5071 | * {@link #ACTION_USER_REMOVED} and {@link #ACTION_USER_SWITCHED}. |
| 5072 | * |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 5073 | * @hide |
| 5074 | */ |
Amith Yamasani | 2a00329 | 2012-08-14 18:25:45 -0700 | [diff] [blame] | 5075 | public static final String EXTRA_USER_HANDLE = |
| 5076 | "android.intent.extra.user_handle"; |
Jean-Michel Trivi | 3114ce3 | 2012-06-11 15:03:52 -0700 | [diff] [blame] | 5077 | |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 5078 | /** |
Philip P. Moltmann | c54c36d | 2018-10-08 15:51:07 -0700 | [diff] [blame] | 5079 | * The UserHandle carried with intents. |
Alexandra Gherghina | c17d7e0 | 2014-04-04 16:27:28 +0100 | [diff] [blame] | 5080 | */ |
| 5081 | public static final String EXTRA_USER = |
Alexandra Gherghina | 3315f6b | 2014-09-05 15:48:06 +0100 | [diff] [blame] | 5082 | "android.intent.extra.USER"; |
Alexandra Gherghina | c17d7e0 | 2014-04-04 16:27:28 +0100 | [diff] [blame] | 5083 | |
| 5084 | /** |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 5085 | * Extra used in the response from a BroadcastReceiver that handles |
Amith Yamasani | 7e99bc0 | 2013-04-16 18:24:51 -0700 | [diff] [blame] | 5086 | * {@link #ACTION_GET_RESTRICTION_ENTRIES}. The type of the extra is |
| 5087 | * <code>ArrayList<RestrictionEntry></code>. |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 5088 | */ |
Amith Yamasani | 7e99bc0 | 2013-04-16 18:24:51 -0700 | [diff] [blame] | 5089 | public static final String EXTRA_RESTRICTIONS_LIST = "android.intent.extra.restrictions_list"; |
| 5090 | |
| 5091 | /** |
| 5092 | * Extra sent in the intent to the BroadcastReceiver that handles |
| 5093 | * {@link #ACTION_GET_RESTRICTION_ENTRIES}. The type of the extra is a Bundle containing |
| 5094 | * the restrictions as key/value pairs. |
| 5095 | */ |
| 5096 | public static final String EXTRA_RESTRICTIONS_BUNDLE = |
| 5097 | "android.intent.extra.restrictions_bundle"; |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 5098 | |
Amith Yamasani | 86118ba | 2013-03-28 14:33:16 -0700 | [diff] [blame] | 5099 | /** |
| 5100 | * Extra used in the response from a BroadcastReceiver that handles |
| 5101 | * {@link #ACTION_GET_RESTRICTION_ENTRIES}. |
| 5102 | */ |
| 5103 | public static final String EXTRA_RESTRICTIONS_INTENT = |
| 5104 | "android.intent.extra.restrictions_intent"; |
| 5105 | |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 5106 | /** |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5107 | * Extra used to communicate a set of acceptable MIME types. The type of the |
| 5108 | * extra is {@code String[]}. Values may be a combination of concrete MIME |
| 5109 | * types (such as "image/png") and/or partial MIME types (such as |
| 5110 | * "audio/*"). |
| 5111 | * |
| 5112 | * @see #ACTION_GET_CONTENT |
| 5113 | * @see #ACTION_OPEN_DOCUMENT |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 5114 | */ |
| 5115 | public static final String EXTRA_MIME_TYPES = "android.intent.extra.MIME_TYPES"; |
| 5116 | |
Dianne Hackborn | 57a7f59 | 2013-07-22 18:21:32 -0700 | [diff] [blame] | 5117 | /** |
| 5118 | * Optional extra for {@link #ACTION_SHUTDOWN} that allows the sender to qualify that |
| 5119 | * this shutdown is only for the user space of the system, not a complete shutdown. |
Dianne Hackborn | d318e0b | 2013-09-03 14:34:12 -0700 | [diff] [blame] | 5120 | * When this is true, hardware devices can use this information to determine that |
| 5121 | * they shouldn't do a complete shutdown of their device since this is not a |
| 5122 | * complete shutdown down to the kernel, but only user space restarting. |
| 5123 | * The default if not supplied is false. |
Dianne Hackborn | 57a7f59 | 2013-07-22 18:21:32 -0700 | [diff] [blame] | 5124 | */ |
| 5125 | public static final String EXTRA_SHUTDOWN_USERSPACE_ONLY |
| 5126 | = "android.intent.extra.SHUTDOWN_USERSPACE_ONLY"; |
| 5127 | |
Narayan Kamath | ccb2a086 | 2013-12-19 14:49:36 +0000 | [diff] [blame] | 5128 | /** |
Neil Fuller | b7146fe | 2016-11-15 16:52:15 +0000 | [diff] [blame] | 5129 | * Optional int extra for {@link #ACTION_TIME_CHANGED} that indicates the |
| 5130 | * user has set their time format preference. See {@link #EXTRA_TIME_PREF_VALUE_USE_12_HOUR}, |
| 5131 | * {@link #EXTRA_TIME_PREF_VALUE_USE_24_HOUR} and |
| 5132 | * {@link #EXTRA_TIME_PREF_VALUE_USE_LOCALE_DEFAULT}. The value must not be negative. |
Narayan Kamath | ccb2a086 | 2013-12-19 14:49:36 +0000 | [diff] [blame] | 5133 | * |
| 5134 | * @hide for internal use only. |
| 5135 | */ |
| 5136 | public static final String EXTRA_TIME_PREF_24_HOUR_FORMAT = |
| 5137 | "android.intent.extra.TIME_PREF_24_HOUR_FORMAT"; |
Neil Fuller | b7146fe | 2016-11-15 16:52:15 +0000 | [diff] [blame] | 5138 | /** @hide */ |
| 5139 | public static final int EXTRA_TIME_PREF_VALUE_USE_12_HOUR = 0; |
| 5140 | /** @hide */ |
| 5141 | public static final int EXTRA_TIME_PREF_VALUE_USE_24_HOUR = 1; |
| 5142 | /** @hide */ |
| 5143 | public static final int EXTRA_TIME_PREF_VALUE_USE_LOCALE_DEFAULT = 2; |
Narayan Kamath | ccb2a086 | 2013-12-19 14:49:36 +0000 | [diff] [blame] | 5144 | |
Jeff Davidson | a0c7d1f | 2017-11-01 17:41:41 -0700 | [diff] [blame] | 5145 | /** |
| 5146 | * Intent extra: the reason that the operation associated with this intent is being performed. |
| 5147 | * |
| 5148 | * <p>Type: String |
| 5149 | * @hide |
| 5150 | */ |
| 5151 | @SystemApi |
Jeff Sharkey | 004a4b2 | 2014-09-24 11:45:24 -0700 | [diff] [blame] | 5152 | public static final String EXTRA_REASON = "android.intent.extra.REASON"; |
| 5153 | |
qingxi | 240c2bb | 2017-04-12 17:31:18 -0700 | [diff] [blame] | 5154 | /** |
| 5155 | * {@hide} |
| 5156 | * This extra will be send together with {@link #ACTION_FACTORY_RESET} |
| 5157 | */ |
Rubin Xu | e8490f1 | 2015-06-25 12:17:48 +0100 | [diff] [blame] | 5158 | public static final String EXTRA_WIPE_EXTERNAL_STORAGE = "android.intent.extra.WIPE_EXTERNAL_STORAGE"; |
| 5159 | |
Santos Cordon | 15a1378 | 2015-03-31 18:32:31 -0700 | [diff] [blame] | 5160 | /** |
qingxi | 240c2bb | 2017-04-12 17:31:18 -0700 | [diff] [blame] | 5161 | * {@hide} |
| 5162 | * This extra will be set to true when the user choose to wipe the data on eSIM during factory |
| 5163 | * reset for the device with eSIM. This extra will be sent together with |
| 5164 | * {@link #ACTION_FACTORY_RESET} |
| 5165 | */ |
| 5166 | public static final String EXTRA_WIPE_ESIMS = "com.android.internal.intent.extra.WIPE_ESIMS"; |
| 5167 | |
| 5168 | /** |
Santos Cordon | 15a1378 | 2015-03-31 18:32:31 -0700 | [diff] [blame] | 5169 | * Optional {@link android.app.PendingIntent} extra used to deliver the result of the SIM |
| 5170 | * activation request. |
| 5171 | * TODO: Add information about the structure and response data used with the pending intent. |
| 5172 | * @hide |
| 5173 | */ |
| 5174 | public static final String EXTRA_SIM_ACTIVATION_RESPONSE = |
| 5175 | "android.intent.extra.SIM_ACTIVATION_RESPONSE"; |
| 5176 | |
Tomasz Mikolajewski | 319fb49 | 2016-01-20 12:24:01 +0900 | [diff] [blame] | 5177 | /** |
| 5178 | * Optional index with semantics depending on the intent action. |
Tomasz Mikolajewski | fe02313 | 2016-03-10 17:42:35 +0900 | [diff] [blame] | 5179 | * |
| 5180 | * <p>The value must be an integer greater or equal to 0. |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 5181 | * @see #ACTION_QUICK_VIEW |
Tomasz Mikolajewski | 319fb49 | 2016-01-20 12:24:01 +0900 | [diff] [blame] | 5182 | */ |
Steve McKay | 6eaf3863 | 2015-08-04 10:11:01 -0700 | [diff] [blame] | 5183 | public static final String EXTRA_INDEX = "android.intent.extra.INDEX"; |
| 5184 | |
Rubin Xu | 0a29ecd | 2015-11-04 15:11:48 +0000 | [diff] [blame] | 5185 | /** |
Tomasz Mikolajewski | 17c50da | 2017-02-16 14:38:04 +0900 | [diff] [blame] | 5186 | * Tells the quick viewer to show additional UI actions suitable for the passed Uris, |
| 5187 | * such as opening in other apps, sharing, opening, editing, printing, deleting, |
| 5188 | * casting, etc. |
Tomasz Mikolajewski | 867addf | 2017-02-01 14:16:39 +0900 | [diff] [blame] | 5189 | * |
| 5190 | * <p>The value is boolean. By default false. |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 5191 | * @see #ACTION_QUICK_VIEW |
| 5192 | * @removed |
Tomasz Mikolajewski | 867addf | 2017-02-01 14:16:39 +0900 | [diff] [blame] | 5193 | */ |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 5194 | @Deprecated |
Tomasz Mikolajewski | 17c50da | 2017-02-16 14:38:04 +0900 | [diff] [blame] | 5195 | public static final String EXTRA_QUICK_VIEW_ADVANCED = |
| 5196 | "android.intent.extra.QUICK_VIEW_ADVANCED"; |
Tomasz Mikolajewski | 867addf | 2017-02-01 14:16:39 +0900 | [diff] [blame] | 5197 | |
| 5198 | /** |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 5199 | * An optional extra of {@code String[]} indicating which quick view features should be made |
| 5200 | * available to the user in the quick view UI while handing a |
| 5201 | * {@link Intent#ACTION_QUICK_VIEW} intent. |
| 5202 | * <li>Enumeration of features here is not meant to restrict capabilities of the quick viewer. |
| 5203 | * Quick viewer can implement features not listed below. |
| 5204 | * <li>Features included at this time are: {@link QuickViewConstants#FEATURE_VIEW}, |
Geoffrey Pitsch | bc02b77 | 2017-12-06 11:24:15 -0500 | [diff] [blame] | 5205 | * {@link QuickViewConstants#FEATURE_EDIT}, {@link QuickViewConstants#FEATURE_DELETE}, |
| 5206 | * {@link QuickViewConstants#FEATURE_DOWNLOAD}, {@link QuickViewConstants#FEATURE_SEND}, |
| 5207 | * {@link QuickViewConstants#FEATURE_PRINT}. |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 5208 | * <p> |
| 5209 | * Requirements: |
| 5210 | * <li>Quick viewer shouldn't show a feature if the feature is absent in |
| 5211 | * {@link #EXTRA_QUICK_VIEW_FEATURES}. |
| 5212 | * <li>When {@link #EXTRA_QUICK_VIEW_FEATURES} is not present, quick viewer should follow |
| 5213 | * internal policies. |
| 5214 | * <li>Presence of an feature in {@link #EXTRA_QUICK_VIEW_FEATURES}, does not constitute a |
| 5215 | * requirement that the feature be shown. Quick viewer may, according to its own policies, |
| 5216 | * disable or hide features. |
| 5217 | * |
| 5218 | * @see #ACTION_QUICK_VIEW |
| 5219 | */ |
| 5220 | public static final String EXTRA_QUICK_VIEW_FEATURES = |
| 5221 | "android.intent.extra.QUICK_VIEW_FEATURES"; |
| 5222 | |
| 5223 | /** |
Rubin Xu | 0a29ecd | 2015-11-04 15:11:48 +0000 | [diff] [blame] | 5224 | * Optional boolean extra indicating whether quiet mode has been switched on or off. |
Rubin Xu | e95057a | 2016-04-01 16:49:25 +0100 | [diff] [blame] | 5225 | * When a profile goes into quiet mode, all apps in the profile are killed and the |
| 5226 | * profile user is stopped. Widgets originating from the profile are masked, and app |
| 5227 | * launcher icons are grayed out. |
Rubin Xu | 0a29ecd | 2015-11-04 15:11:48 +0000 | [diff] [blame] | 5228 | */ |
| 5229 | public static final String EXTRA_QUIET_MODE = "android.intent.extra.QUIET_MODE"; |
Dongwon Kang | 2034a4c | 2015-12-14 21:57:34 +0900 | [diff] [blame] | 5230 | |
| 5231 | /** |
Amin Shaikh | 710d123 | 2018-11-14 16:58:13 -0500 | [diff] [blame^] | 5232 | * Optional CharSequence extra to provide a search query. |
| 5233 | * |
| 5234 | * <p>Applicable to {@link Intent} with actions: |
| 5235 | * <ul> |
| 5236 | * <li>{@link Intent#ACTION_GET_CONTENT}</li> |
| 5237 | * <li>{@link Intent#ACTION_OPEN_DOCUMENT}</li> |
| 5238 | * </ul> |
| 5239 | */ |
| 5240 | public static final String EXTRA_CONTENT_QUERY = "android.intent.extra.CONTENT_QUERY"; |
| 5241 | |
| 5242 | /** |
Dongwon Kang | 32cb9ab | 2016-01-13 18:11:10 -0800 | [diff] [blame] | 5243 | * Used as an int extra field in {@link #ACTION_MEDIA_RESOURCE_GRANTED} |
Dongwon Kang | 2034a4c | 2015-12-14 21:57:34 +0900 | [diff] [blame] | 5244 | * intents to specify the resource type granted. Possible values are |
Dongwon Kang | 32cb9ab | 2016-01-13 18:11:10 -0800 | [diff] [blame] | 5245 | * {@link #EXTRA_MEDIA_RESOURCE_TYPE_VIDEO_CODEC} or |
| 5246 | * {@link #EXTRA_MEDIA_RESOURCE_TYPE_AUDIO_CODEC}. |
Dongwon Kang | 2034a4c | 2015-12-14 21:57:34 +0900 | [diff] [blame] | 5247 | * |
| 5248 | * @hide |
| 5249 | */ |
| 5250 | public static final String EXTRA_MEDIA_RESOURCE_TYPE = |
| 5251 | "android.intent.extra.MEDIA_RESOURCE_TYPE"; |
| 5252 | |
| 5253 | /** |
Ben Lin | 145b0ca | 2016-10-14 14:23:40 -0700 | [diff] [blame] | 5254 | * Used as a boolean extra field in {@link #ACTION_CHOOSER} intents to specify |
| 5255 | * whether to show the chooser or not when there is only one application available |
| 5256 | * to choose from. |
| 5257 | * |
| 5258 | * @hide |
| 5259 | */ |
| 5260 | public static final String EXTRA_AUTO_LAUNCH_SINGLE_CHOICE = |
| 5261 | "android.intent.extra.AUTO_LAUNCH_SINGLE_CHOICE"; |
| 5262 | |
| 5263 | /** |
Dongwon Kang | 32cb9ab | 2016-01-13 18:11:10 -0800 | [diff] [blame] | 5264 | * Used as an int value for {@link #EXTRA_MEDIA_RESOURCE_TYPE} |
Dongwon Kang | 2034a4c | 2015-12-14 21:57:34 +0900 | [diff] [blame] | 5265 | * to represent that a video codec is allowed to use. |
| 5266 | * |
| 5267 | * @hide |
| 5268 | */ |
| 5269 | public static final int EXTRA_MEDIA_RESOURCE_TYPE_VIDEO_CODEC = 0; |
| 5270 | |
| 5271 | /** |
Dongwon Kang | 32cb9ab | 2016-01-13 18:11:10 -0800 | [diff] [blame] | 5272 | * Used as an int value for {@link #EXTRA_MEDIA_RESOURCE_TYPE} |
Dongwon Kang | 2034a4c | 2015-12-14 21:57:34 +0900 | [diff] [blame] | 5273 | * to represent that a audio codec is allowed to use. |
| 5274 | * |
| 5275 | * @hide |
| 5276 | */ |
| 5277 | public static final int EXTRA_MEDIA_RESOURCE_TYPE_AUDIO_CODEC = 1; |
| 5278 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5279 | // --------------------------------------------------------------------- |
| 5280 | // --------------------------------------------------------------------- |
| 5281 | // Intent flags (see mFlags variable). |
| 5282 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 5283 | /** @hide */ |
Jeff Sharkey | 6503bd8 | 2017-04-19 23:24:18 -0600 | [diff] [blame] | 5284 | @IntDef(flag = true, prefix = { "FLAG_GRANT_" }, value = { |
Jeff Sharkey | 846318a | 2014-04-04 12:12:41 -0700 | [diff] [blame] | 5285 | FLAG_GRANT_READ_URI_PERMISSION, FLAG_GRANT_WRITE_URI_PERMISSION, |
| 5286 | FLAG_GRANT_PERSISTABLE_URI_PERMISSION, FLAG_GRANT_PREFIX_URI_PERMISSION }) |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 5287 | @Retention(RetentionPolicy.SOURCE) |
| 5288 | public @interface GrantUriMode {} |
| 5289 | |
Jeff Sharkey | 846318a | 2014-04-04 12:12:41 -0700 | [diff] [blame] | 5290 | /** @hide */ |
Jeff Sharkey | 6503bd8 | 2017-04-19 23:24:18 -0600 | [diff] [blame] | 5291 | @IntDef(flag = true, prefix = { "FLAG_GRANT_" }, value = { |
Jeff Sharkey | 846318a | 2014-04-04 12:12:41 -0700 | [diff] [blame] | 5292 | FLAG_GRANT_READ_URI_PERMISSION, FLAG_GRANT_WRITE_URI_PERMISSION }) |
| 5293 | @Retention(RetentionPolicy.SOURCE) |
| 5294 | public @interface AccessUriMode {} |
| 5295 | |
| 5296 | /** |
| 5297 | * Test if given mode flags specify an access mode, which must be at least |
| 5298 | * read and/or write. |
| 5299 | * |
| 5300 | * @hide |
| 5301 | */ |
| 5302 | public static boolean isAccessUriMode(int modeFlags) { |
| 5303 | return (modeFlags & (Intent.FLAG_GRANT_READ_URI_PERMISSION |
| 5304 | | Intent.FLAG_GRANT_WRITE_URI_PERMISSION)) != 0; |
| 5305 | } |
| 5306 | |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5307 | /** @hide */ |
| 5308 | @IntDef(flag = true, prefix = { "FLAG_" }, value = { |
| 5309 | FLAG_GRANT_READ_URI_PERMISSION, |
| 5310 | FLAG_GRANT_WRITE_URI_PERMISSION, |
| 5311 | FLAG_FROM_BACKGROUND, |
| 5312 | FLAG_DEBUG_LOG_RESOLUTION, |
| 5313 | FLAG_EXCLUDE_STOPPED_PACKAGES, |
| 5314 | FLAG_INCLUDE_STOPPED_PACKAGES, |
| 5315 | FLAG_GRANT_PERSISTABLE_URI_PERMISSION, |
| 5316 | FLAG_GRANT_PREFIX_URI_PERMISSION, |
| 5317 | FLAG_DEBUG_TRIAGED_MISSING, |
| 5318 | FLAG_IGNORE_EPHEMERAL, |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 5319 | FLAG_ACTIVITY_MATCH_EXTERNAL, |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5320 | FLAG_ACTIVITY_NO_HISTORY, |
| 5321 | FLAG_ACTIVITY_SINGLE_TOP, |
| 5322 | FLAG_ACTIVITY_NEW_TASK, |
| 5323 | FLAG_ACTIVITY_MULTIPLE_TASK, |
| 5324 | FLAG_ACTIVITY_CLEAR_TOP, |
| 5325 | FLAG_ACTIVITY_FORWARD_RESULT, |
| 5326 | FLAG_ACTIVITY_PREVIOUS_IS_TOP, |
| 5327 | FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS, |
| 5328 | FLAG_ACTIVITY_BROUGHT_TO_FRONT, |
| 5329 | FLAG_ACTIVITY_RESET_TASK_IF_NEEDED, |
| 5330 | FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY, |
| 5331 | FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, |
| 5332 | FLAG_ACTIVITY_NEW_DOCUMENT, |
| 5333 | FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, |
| 5334 | FLAG_ACTIVITY_NO_USER_ACTION, |
| 5335 | FLAG_ACTIVITY_REORDER_TO_FRONT, |
| 5336 | FLAG_ACTIVITY_NO_ANIMATION, |
| 5337 | FLAG_ACTIVITY_CLEAR_TASK, |
| 5338 | FLAG_ACTIVITY_TASK_ON_HOME, |
| 5339 | FLAG_ACTIVITY_RETAIN_IN_RECENTS, |
| 5340 | FLAG_ACTIVITY_LAUNCH_ADJACENT, |
| 5341 | FLAG_RECEIVER_REGISTERED_ONLY, |
| 5342 | FLAG_RECEIVER_REPLACE_PENDING, |
| 5343 | FLAG_RECEIVER_FOREGROUND, |
| 5344 | FLAG_RECEIVER_NO_ABORT, |
| 5345 | FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT, |
| 5346 | FLAG_RECEIVER_BOOT_UPGRADE, |
| 5347 | FLAG_RECEIVER_INCLUDE_BACKGROUND, |
| 5348 | FLAG_RECEIVER_EXCLUDE_BACKGROUND, |
| 5349 | FLAG_RECEIVER_FROM_SHELL, |
| 5350 | FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS, |
Ng Zhi An | 150a6ba | 2018-08-13 09:08:11 -0700 | [diff] [blame] | 5351 | FLAG_RECEIVER_OFFLOAD, |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5352 | }) |
| 5353 | @Retention(RetentionPolicy.SOURCE) |
| 5354 | public @interface Flags {} |
| 5355 | |
| 5356 | /** @hide */ |
| 5357 | @IntDef(flag = true, prefix = { "FLAG_" }, value = { |
| 5358 | FLAG_FROM_BACKGROUND, |
| 5359 | FLAG_DEBUG_LOG_RESOLUTION, |
| 5360 | FLAG_EXCLUDE_STOPPED_PACKAGES, |
| 5361 | FLAG_INCLUDE_STOPPED_PACKAGES, |
| 5362 | FLAG_DEBUG_TRIAGED_MISSING, |
| 5363 | FLAG_IGNORE_EPHEMERAL, |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 5364 | FLAG_ACTIVITY_MATCH_EXTERNAL, |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5365 | FLAG_ACTIVITY_NO_HISTORY, |
| 5366 | FLAG_ACTIVITY_SINGLE_TOP, |
| 5367 | FLAG_ACTIVITY_NEW_TASK, |
| 5368 | FLAG_ACTIVITY_MULTIPLE_TASK, |
| 5369 | FLAG_ACTIVITY_CLEAR_TOP, |
| 5370 | FLAG_ACTIVITY_FORWARD_RESULT, |
| 5371 | FLAG_ACTIVITY_PREVIOUS_IS_TOP, |
| 5372 | FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS, |
| 5373 | FLAG_ACTIVITY_BROUGHT_TO_FRONT, |
| 5374 | FLAG_ACTIVITY_RESET_TASK_IF_NEEDED, |
| 5375 | FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY, |
| 5376 | FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, |
| 5377 | FLAG_ACTIVITY_NEW_DOCUMENT, |
| 5378 | FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, |
| 5379 | FLAG_ACTIVITY_NO_USER_ACTION, |
| 5380 | FLAG_ACTIVITY_REORDER_TO_FRONT, |
| 5381 | FLAG_ACTIVITY_NO_ANIMATION, |
| 5382 | FLAG_ACTIVITY_CLEAR_TASK, |
| 5383 | FLAG_ACTIVITY_TASK_ON_HOME, |
| 5384 | FLAG_ACTIVITY_RETAIN_IN_RECENTS, |
| 5385 | FLAG_ACTIVITY_LAUNCH_ADJACENT, |
| 5386 | FLAG_RECEIVER_REGISTERED_ONLY, |
| 5387 | FLAG_RECEIVER_REPLACE_PENDING, |
| 5388 | FLAG_RECEIVER_FOREGROUND, |
| 5389 | FLAG_RECEIVER_NO_ABORT, |
| 5390 | FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT, |
| 5391 | FLAG_RECEIVER_BOOT_UPGRADE, |
| 5392 | FLAG_RECEIVER_INCLUDE_BACKGROUND, |
| 5393 | FLAG_RECEIVER_EXCLUDE_BACKGROUND, |
| 5394 | FLAG_RECEIVER_FROM_SHELL, |
| 5395 | FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS, |
Ng Zhi An | 150a6ba | 2018-08-13 09:08:11 -0700 | [diff] [blame] | 5396 | FLAG_RECEIVER_OFFLOAD, |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5397 | }) |
| 5398 | @Retention(RetentionPolicy.SOURCE) |
| 5399 | public @interface MutableFlags {} |
| 5400 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5401 | /** |
| 5402 | * If set, the recipient of this Intent will be granted permission to |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5403 | * perform read operations on the URI in the Intent's data and any URIs |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 5404 | * specified in its ClipData. When applying to an Intent's ClipData, |
| 5405 | * all URIs as well as recursive traversals through data or other ClipData |
| 5406 | * in Intent items will be granted; only the grant flags of the top-level |
| 5407 | * Intent are used. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5408 | */ |
| 5409 | public static final int FLAG_GRANT_READ_URI_PERMISSION = 0x00000001; |
| 5410 | /** |
| 5411 | * If set, the recipient of this Intent will be granted permission to |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5412 | * perform write operations on the URI in the Intent's data and any URIs |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 5413 | * specified in its ClipData. When applying to an Intent's ClipData, |
| 5414 | * all URIs as well as recursive traversals through data or other ClipData |
| 5415 | * in Intent items will be granted; only the grant flags of the top-level |
| 5416 | * Intent are used. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5417 | */ |
| 5418 | public static final int FLAG_GRANT_WRITE_URI_PERMISSION = 0x00000002; |
| 5419 | /** |
| 5420 | * Can be set by the caller to indicate that this Intent is coming from |
| 5421 | * a background operation, not from direct user interaction. |
| 5422 | */ |
| 5423 | public static final int FLAG_FROM_BACKGROUND = 0x00000004; |
| 5424 | /** |
| 5425 | * A flag you can enable for debugging: when set, log messages will be |
| 5426 | * printed during the resolution of this intent to show you what has |
| 5427 | * been found to create the final resolved list. |
| 5428 | */ |
| 5429 | public static final int FLAG_DEBUG_LOG_RESOLUTION = 0x00000008; |
Dianne Hackborn | e7f9721 | 2011-02-24 14:40:20 -0800 | [diff] [blame] | 5430 | /** |
| 5431 | * If set, this intent will not match any components in packages that |
| 5432 | * are currently stopped. If this is not set, then the default behavior |
| 5433 | * is to include such applications in the result. |
| 5434 | */ |
| 5435 | public static final int FLAG_EXCLUDE_STOPPED_PACKAGES = 0x00000010; |
| 5436 | /** |
| 5437 | * If set, this intent will always match any components in packages that |
| 5438 | * are currently stopped. This is the default behavior when |
| 5439 | * {@link #FLAG_EXCLUDE_STOPPED_PACKAGES} is not set. If both of these |
| 5440 | * flags are set, this one wins (it allows overriding of exclude for |
| 5441 | * places where the framework may automatically set the exclude flag). |
| 5442 | */ |
| 5443 | public static final int FLAG_INCLUDE_STOPPED_PACKAGES = 0x00000020; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5444 | |
| 5445 | /** |
Jeff Sharkey | 328ebf2 | 2013-03-21 18:09:39 -0700 | [diff] [blame] | 5446 | * When combined with {@link #FLAG_GRANT_READ_URI_PERMISSION} and/or |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5447 | * {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, the URI permission grant can be |
Jeff Sharkey | e66c177 | 2013-09-20 14:30:59 -0700 | [diff] [blame] | 5448 | * persisted across device reboots until explicitly revoked with |
| 5449 | * {@link Context#revokeUriPermission(Uri, int)}. This flag only offers the |
| 5450 | * grant for possible persisting; the receiving application must call |
| 5451 | * {@link ContentResolver#takePersistableUriPermission(Uri, int)} to |
| 5452 | * actually persist. |
| 5453 | * |
| 5454 | * @see ContentResolver#takePersistableUriPermission(Uri, int) |
| 5455 | * @see ContentResolver#releasePersistableUriPermission(Uri, int) |
| 5456 | * @see ContentResolver#getPersistedUriPermissions() |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5457 | * @see ContentResolver#getOutgoingPersistedUriPermissions() |
Jeff Sharkey | 328ebf2 | 2013-03-21 18:09:39 -0700 | [diff] [blame] | 5458 | */ |
Jeff Sharkey | e66c177 | 2013-09-20 14:30:59 -0700 | [diff] [blame] | 5459 | public static final int FLAG_GRANT_PERSISTABLE_URI_PERMISSION = 0x00000040; |
Jeff Sharkey | 328ebf2 | 2013-03-21 18:09:39 -0700 | [diff] [blame] | 5460 | |
| 5461 | /** |
Jeff Sharkey | 846318a | 2014-04-04 12:12:41 -0700 | [diff] [blame] | 5462 | * When combined with {@link #FLAG_GRANT_READ_URI_PERMISSION} and/or |
| 5463 | * {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, the URI permission grant |
| 5464 | * applies to any URI that is a prefix match against the original granted |
| 5465 | * URI. (Without this flag, the URI must match exactly for access to be |
| 5466 | * granted.) Another URI is considered a prefix match only when scheme, |
| 5467 | * authority, and all path segments defined by the prefix are an exact |
| 5468 | * match. |
| 5469 | */ |
| 5470 | public static final int FLAG_GRANT_PREFIX_URI_PERMISSION = 0x00000080; |
| 5471 | |
| 5472 | /** |
Jeff Sharkey | c59a5e7 | 2018-06-21 19:14:58 -0600 | [diff] [blame] | 5473 | * Flag used to automatically match intents based on their Direct Boot |
| 5474 | * awareness and the current user state. |
| 5475 | * <p> |
| 5476 | * Since the default behavior is to automatically apply the current user |
| 5477 | * state, this is effectively a sentinel value that doesn't change the |
| 5478 | * output of any queries based on its presence or absence. |
| 5479 | * <p> |
| 5480 | * Instead, this value can be useful in conjunction with |
| 5481 | * {@link android.os.StrictMode.VmPolicy.Builder#detectImplicitDirectBoot()} |
| 5482 | * to detect when a caller is relying on implicit automatic matching, |
| 5483 | * instead of confirming the explicit behavior they want. |
Jeff Sharkey | 2a9e3f8 | 2015-12-18 10:57:58 -0700 | [diff] [blame] | 5484 | */ |
Jeff Sharkey | c59a5e7 | 2018-06-21 19:14:58 -0600 | [diff] [blame] | 5485 | public static final int FLAG_DIRECT_BOOT_AUTO = 0x00000100; |
| 5486 | |
| 5487 | /** {@hide} */ |
| 5488 | @Deprecated |
| 5489 | public static final int FLAG_DEBUG_TRIAGED_MISSING = FLAG_DIRECT_BOOT_AUTO; |
Jeff Sharkey | 2a9e3f8 | 2015-12-18 10:57:58 -0700 | [diff] [blame] | 5490 | |
| 5491 | /** |
Todd Kennedy | 8e2d9d1 | 2016-06-28 14:09:55 -0700 | [diff] [blame] | 5492 | * Internal flag used to indicate ephemeral applications should not be |
| 5493 | * considered when resolving the intent. |
| 5494 | * |
| 5495 | * @hide |
| 5496 | */ |
| 5497 | public static final int FLAG_IGNORE_EPHEMERAL = 0x00000200; |
| 5498 | |
| 5499 | /** |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 5500 | * If set, the new activity is not kept in the history stack. As soon as |
| 5501 | * the user navigates away from it, the activity is finished. This may also |
| 5502 | * be set with the {@link android.R.styleable#AndroidManifestActivity_noHistory |
| 5503 | * noHistory} attribute. |
Ricardo Cervera | 92f6a74 | 2014-04-04 11:17:06 -0700 | [diff] [blame] | 5504 | * |
| 5505 | * <p>If set, {@link android.app.Activity#onActivityResult onActivityResult()} |
| 5506 | * is never invoked when the current activity starts a new activity which |
| 5507 | * sets a result and finishes. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5508 | */ |
| 5509 | public static final int FLAG_ACTIVITY_NO_HISTORY = 0x40000000; |
| 5510 | /** |
| 5511 | * If set, the activity will not be launched if it is already running |
| 5512 | * at the top of the history stack. |
| 5513 | */ |
| 5514 | public static final int FLAG_ACTIVITY_SINGLE_TOP = 0x20000000; |
| 5515 | /** |
| 5516 | * If set, this activity will become the start of a new task on this |
| 5517 | * history stack. A task (from the activity that started it to the |
| 5518 | * next task activity) defines an atomic group of activities that the |
| 5519 | * user can move to. Tasks can be moved to the foreground and background; |
| 5520 | * all of the activities inside of a particular task always remain in |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 5521 | * the same order. See |
Scott Main | 7aee61f | 2011-02-08 11:25:01 -0800 | [diff] [blame] | 5522 | * <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back |
| 5523 | * Stack</a> for more information about tasks. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5524 | * |
| 5525 | * <p>This flag is generally used by activities that want |
| 5526 | * to present a "launcher" style behavior: they give the user a list of |
| 5527 | * separate things that can be done, which otherwise run completely |
| 5528 | * independently of the activity launching them. |
| 5529 | * |
| 5530 | * <p>When using this flag, if a task is already running for the activity |
| 5531 | * you are now starting, then a new activity will not be started; instead, |
| 5532 | * the current task will simply be brought to the front of the screen with |
| 5533 | * the state it was last in. See {@link #FLAG_ACTIVITY_MULTIPLE_TASK} for a flag |
| 5534 | * to disable this behavior. |
| 5535 | * |
| 5536 | * <p>This flag can not be used when the caller is requesting a result from |
| 5537 | * the activity being launched. |
| 5538 | */ |
| 5539 | public static final int FLAG_ACTIVITY_NEW_TASK = 0x10000000; |
| 5540 | /** |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5541 | * This flag is used to create a new task and launch an activity into it. |
| 5542 | * This flag is always paired with either {@link #FLAG_ACTIVITY_NEW_DOCUMENT} |
| 5543 | * or {@link #FLAG_ACTIVITY_NEW_TASK}. In both cases these flags alone would |
| 5544 | * search through existing tasks for ones matching this Intent. Only if no such |
| 5545 | * task is found would a new task be created. When paired with |
| 5546 | * FLAG_ACTIVITY_MULTIPLE_TASK both of these behaviors are modified to skip |
| 5547 | * the search for a matching task and unconditionally start a new task. |
| 5548 | * |
| 5549 | * <strong>When used with {@link #FLAG_ACTIVITY_NEW_TASK} do not use this |
| 5550 | * flag unless you are implementing your own |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5551 | * top-level application launcher.</strong> Used in conjunction with |
| 5552 | * {@link #FLAG_ACTIVITY_NEW_TASK} to disable the |
| 5553 | * behavior of bringing an existing task to the foreground. When set, |
| 5554 | * a new task is <em>always</em> started to host the Activity for the |
| 5555 | * Intent, regardless of whether there is already an existing task running |
| 5556 | * the same thing. |
| 5557 | * |
| 5558 | * <p><strong>Because the default system does not include graphical task management, |
| 5559 | * you should not use this flag unless you provide some way for a user to |
| 5560 | * return back to the tasks you have launched.</strong> |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 5561 | * |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5562 | * See {@link #FLAG_ACTIVITY_NEW_DOCUMENT} for details of this flag's use for |
| 5563 | * creating new document tasks. |
| 5564 | * |
| 5565 | * <p>This flag is ignored if one of {@link #FLAG_ACTIVITY_NEW_TASK} or |
Paul Soulos | 628cb74 | 2014-09-19 11:00:52 -0700 | [diff] [blame] | 5566 | * {@link #FLAG_ACTIVITY_NEW_DOCUMENT} is not also set. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5567 | * |
Scott Main | 7aee61f | 2011-02-08 11:25:01 -0800 | [diff] [blame] | 5568 | * <p>See |
| 5569 | * <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back |
| 5570 | * Stack</a> for more information about tasks. |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5571 | * |
| 5572 | * @see #FLAG_ACTIVITY_NEW_DOCUMENT |
| 5573 | * @see #FLAG_ACTIVITY_NEW_TASK |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5574 | */ |
| 5575 | public static final int FLAG_ACTIVITY_MULTIPLE_TASK = 0x08000000; |
| 5576 | /** |
| 5577 | * If set, and the activity being launched is already running in the |
| 5578 | * current task, then instead of launching a new instance of that activity, |
| 5579 | * all of the other activities on top of it will be closed and this Intent |
| 5580 | * will be delivered to the (now on top) old activity as a new Intent. |
| 5581 | * |
| 5582 | * <p>For example, consider a task consisting of the activities: A, B, C, D. |
| 5583 | * If D calls startActivity() with an Intent that resolves to the component |
| 5584 | * of activity B, then C and D will be finished and B receive the given |
| 5585 | * Intent, resulting in the stack now being: A, B. |
| 5586 | * |
Dianne Hackborn | aa52f9a | 2009-08-25 16:01:15 -0700 | [diff] [blame] | 5587 | * <p>The currently running instance of activity B in the above example will |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5588 | * either receive the new intent you are starting here in its |
| 5589 | * onNewIntent() method, or be itself finished and restarted with the |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5590 | * new intent. If it has declared its launch mode to be "multiple" (the |
Dianne Hackborn | aa52f9a | 2009-08-25 16:01:15 -0700 | [diff] [blame] | 5591 | * default) and you have not set {@link #FLAG_ACTIVITY_SINGLE_TOP} in |
| 5592 | * the same intent, then it will be finished and re-created; for all other |
| 5593 | * launch modes or if {@link #FLAG_ACTIVITY_SINGLE_TOP} is set then this |
| 5594 | * Intent will be delivered to the current instance's onNewIntent(). |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5595 | * |
| 5596 | * <p>This launch mode can also be used to good effect in conjunction with |
| 5597 | * {@link #FLAG_ACTIVITY_NEW_TASK}: if used to start the root activity |
| 5598 | * of a task, it will bring any currently running instance of that task |
| 5599 | * to the foreground, and then clear it to its root state. This is |
| 5600 | * especially useful, for example, when launching an activity from the |
| 5601 | * notification manager. |
| 5602 | * |
Scott Main | 7aee61f | 2011-02-08 11:25:01 -0800 | [diff] [blame] | 5603 | * <p>See |
| 5604 | * <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back |
| 5605 | * Stack</a> for more information about tasks. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5606 | */ |
| 5607 | public static final int FLAG_ACTIVITY_CLEAR_TOP = 0x04000000; |
| 5608 | /** |
| 5609 | * If set and this intent is being used to launch a new activity from an |
| 5610 | * existing one, then the reply target of the existing activity will be |
kopriva | 219f7dc | 2018-10-09 13:42:28 -0700 | [diff] [blame] | 5611 | * transferred to the new activity. This way, the new activity can call |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5612 | * {@link android.app.Activity#setResult} and have that result sent back to |
| 5613 | * the reply target of the original activity. |
| 5614 | */ |
| 5615 | public static final int FLAG_ACTIVITY_FORWARD_RESULT = 0x02000000; |
| 5616 | /** |
| 5617 | * If set and this intent is being used to launch a new activity from an |
| 5618 | * existing one, the current activity will not be counted as the top |
| 5619 | * activity for deciding whether the new intent should be delivered to |
| 5620 | * the top instead of starting a new one. The previous activity will |
| 5621 | * be used as the top, with the assumption being that the current activity |
| 5622 | * will finish itself immediately. |
| 5623 | */ |
| 5624 | public static final int FLAG_ACTIVITY_PREVIOUS_IS_TOP = 0x01000000; |
| 5625 | /** |
| 5626 | * If set, the new activity is not kept in the list of recently launched |
| 5627 | * activities. |
| 5628 | */ |
| 5629 | public static final int FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS = 0x00800000; |
| 5630 | /** |
| 5631 | * This flag is not normally set by application code, but set for you by |
| 5632 | * the system as described in the |
| 5633 | * {@link android.R.styleable#AndroidManifestActivity_launchMode |
| 5634 | * launchMode} documentation for the singleTask mode. |
| 5635 | */ |
| 5636 | public static final int FLAG_ACTIVITY_BROUGHT_TO_FRONT = 0x00400000; |
| 5637 | /** |
| 5638 | * If set, and this activity is either being started in a new task or |
| 5639 | * bringing to the top an existing task, then it will be launched as |
| 5640 | * the front door of the task. This will result in the application of |
| 5641 | * any affinities needed to have that task in the proper state (either |
| 5642 | * moving activities to or from it), or simply resetting that task to |
| 5643 | * its initial state if needed. |
| 5644 | */ |
| 5645 | public static final int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED = 0x00200000; |
| 5646 | /** |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 5647 | * This flag is not normally set by application code, but set for you by |
| 5648 | * the system if this activity is being launched from history |
| 5649 | * (longpress home key). |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5650 | */ |
| 5651 | public static final int FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY = 0x00100000; |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 5652 | /** |
Craig Mautner | f357c0c | 2014-06-09 09:23:27 -0700 | [diff] [blame] | 5653 | * @deprecated As of API 21 this performs identically to |
| 5654 | * {@link #FLAG_ACTIVITY_NEW_DOCUMENT} which should be used instead of this. |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 5655 | */ |
Aurimas Liutikas | 514c5ef | 2016-05-24 15:22:55 -0700 | [diff] [blame] | 5656 | @Deprecated |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 5657 | public static final int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET = 0x00080000; |
The Android Open Source Project | f1e484a | 2009-01-22 00:13:42 -0800 | [diff] [blame] | 5658 | /** |
Craig Mautner | 026596b | 2014-05-21 15:35:44 -0700 | [diff] [blame] | 5659 | * This flag is used to open a document into a new task rooted at the activity launched |
| 5660 | * by this Intent. Through the use of this flag, or its equivalent attribute, |
| 5661 | * {@link android.R.attr#documentLaunchMode} multiple instances of the same activity |
Chet Haase | 0d1c27a | 2014-11-03 18:35:16 +0000 | [diff] [blame] | 5662 | * containing different documents will appear in the recent tasks list. |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5663 | * |
Craig Mautner | 026596b | 2014-05-21 15:35:44 -0700 | [diff] [blame] | 5664 | * <p>The use of the activity attribute form of this, |
| 5665 | * {@link android.R.attr#documentLaunchMode}, is |
| 5666 | * preferred over the Intent flag described here. The attribute form allows the |
| 5667 | * Activity to specify multiple document behavior for all launchers of the Activity |
| 5668 | * whereas using this flag requires each Intent that launches the Activity to specify it. |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5669 | * |
Dianne Hackborn | 13420f2 | 2014-07-18 15:43:56 -0700 | [diff] [blame] | 5670 | * <p>Note that the default semantics of this flag w.r.t. whether the recents entry for |
| 5671 | * it is kept after the activity is finished is different than the use of |
| 5672 | * {@link #FLAG_ACTIVITY_NEW_TASK} and {@link android.R.attr#documentLaunchMode} -- if |
| 5673 | * this flag is being used to create a new recents entry, then by default that entry |
| 5674 | * will be removed once the activity is finished. You can modify this behavior with |
| 5675 | * {@link #FLAG_ACTIVITY_RETAIN_IN_RECENTS}. |
| 5676 | * |
Craig Mautner | 026596b | 2014-05-21 15:35:44 -0700 | [diff] [blame] | 5677 | * <p>FLAG_ACTIVITY_NEW_DOCUMENT may be used in conjunction with {@link |
| 5678 | * #FLAG_ACTIVITY_MULTIPLE_TASK}. When used alone it is the |
| 5679 | * equivalent of the Activity manifest specifying {@link |
| 5680 | * android.R.attr#documentLaunchMode}="intoExisting". When used with |
| 5681 | * FLAG_ACTIVITY_MULTIPLE_TASK it is the equivalent of the Activity manifest specifying |
| 5682 | * {@link android.R.attr#documentLaunchMode}="always". |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5683 | * |
Craig Mautner | 026596b | 2014-05-21 15:35:44 -0700 | [diff] [blame] | 5684 | * Refer to {@link android.R.attr#documentLaunchMode} for more information. |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5685 | * |
Craig Mautner | 026596b | 2014-05-21 15:35:44 -0700 | [diff] [blame] | 5686 | * @see android.R.attr#documentLaunchMode |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5687 | * @see #FLAG_ACTIVITY_MULTIPLE_TASK |
| 5688 | */ |
Craig Mautner | f357c0c | 2014-06-09 09:23:27 -0700 | [diff] [blame] | 5689 | public static final int FLAG_ACTIVITY_NEW_DOCUMENT = FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET; |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5690 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5691 | * If set, this flag will prevent the normal {@link android.app.Activity#onUserLeaveHint} |
The Android Open Source Project | f1e484a | 2009-01-22 00:13:42 -0800 | [diff] [blame] | 5692 | * callback from occurring on the current frontmost activity before it is |
| 5693 | * paused as the newly-started activity is brought to the front. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 5694 | * |
The Android Open Source Project | f1e484a | 2009-01-22 00:13:42 -0800 | [diff] [blame] | 5695 | * <p>Typically, an activity can rely on that callback to indicate that an |
| 5696 | * explicit user action has caused their activity to be moved out of the |
| 5697 | * foreground. The callback marks an appropriate point in the activity's |
| 5698 | * lifecycle for it to dismiss any notifications that it intends to display |
| 5699 | * "until the user has seen them," such as a blinking LED. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 5700 | * |
The Android Open Source Project | f1e484a | 2009-01-22 00:13:42 -0800 | [diff] [blame] | 5701 | * <p>If an activity is ever started via any non-user-driven events such as |
| 5702 | * phone-call receipt or an alarm handler, this flag should be passed to {@link |
| 5703 | * Context#startActivity Context.startActivity}, ensuring that the pausing |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 5704 | * activity does not think the user has acknowledged its notification. |
The Android Open Source Project | f1e484a | 2009-01-22 00:13:42 -0800 | [diff] [blame] | 5705 | */ |
| 5706 | public static final int FLAG_ACTIVITY_NO_USER_ACTION = 0x00040000; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5707 | /** |
| 5708 | * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, |
| 5709 | * this flag will cause the launched activity to be brought to the front of its |
| 5710 | * task's history stack if it is already running. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 5711 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5712 | * <p>For example, consider a task consisting of four activities: A, B, C, D. |
| 5713 | * If D calls startActivity() with an Intent that resolves to the component |
| 5714 | * of activity B, then B will be brought to the front of the history stack, |
| 5715 | * with this resulting order: A, C, D, B. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 5716 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5717 | * This flag will be ignored if {@link #FLAG_ACTIVITY_CLEAR_TOP} is also |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 5718 | * specified. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5719 | */ |
| 5720 | public static final int FLAG_ACTIVITY_REORDER_TO_FRONT = 0X00020000; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5721 | /** |
Dianne Hackborn | bfe319e | 2009-09-21 00:34:05 -0700 | [diff] [blame] | 5722 | * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, |
| 5723 | * this flag will prevent the system from applying an activity transition |
| 5724 | * animation to go to the next activity state. This doesn't mean an |
| 5725 | * animation will never run -- if another activity change happens that doesn't |
| 5726 | * specify this flag before the activity started here is displayed, then |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame] | 5727 | * that transition will be used. This flag can be put to good use |
Dianne Hackborn | bfe319e | 2009-09-21 00:34:05 -0700 | [diff] [blame] | 5728 | * when you are going to do a series of activity operations but the |
| 5729 | * animation seen by the user shouldn't be driven by the first activity |
| 5730 | * change but rather a later one. |
| 5731 | */ |
| 5732 | public static final int FLAG_ACTIVITY_NO_ANIMATION = 0X00010000; |
| 5733 | /** |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame] | 5734 | * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, |
| 5735 | * this flag will cause any existing task that would be associated with the |
| 5736 | * activity to be cleared before the activity is started. That is, the activity |
| 5737 | * becomes the new root of an otherwise empty task, and any old activities |
| 5738 | * are finished. This can only be used in conjunction with {@link #FLAG_ACTIVITY_NEW_TASK}. |
| 5739 | */ |
| 5740 | public static final int FLAG_ACTIVITY_CLEAR_TASK = 0X00008000; |
| 5741 | /** |
| 5742 | * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, |
| 5743 | * this flag will cause a newly launching task to be placed on top of the current |
| 5744 | * home activity task (if there is one). That is, pressing back from the task |
| 5745 | * will always return the user to home even if that was not the last activity they |
| 5746 | * saw. This can only be used in conjunction with {@link #FLAG_ACTIVITY_NEW_TASK}. |
| 5747 | */ |
| 5748 | public static final int FLAG_ACTIVITY_TASK_ON_HOME = 0X00004000; |
| 5749 | /** |
Dianne Hackborn | 13420f2 | 2014-07-18 15:43:56 -0700 | [diff] [blame] | 5750 | * By default a document created by {@link #FLAG_ACTIVITY_NEW_DOCUMENT} will |
| 5751 | * have its entry in recent tasks removed when the user closes it (with back |
Jeff Sharkey | 9f991a2 | 2014-08-13 11:37:41 -0700 | [diff] [blame] | 5752 | * or however else it may finish()). If you would like to instead allow the |
Dianne Hackborn | 13420f2 | 2014-07-18 15:43:56 -0700 | [diff] [blame] | 5753 | * document to be kept in recents so that it can be re-launched, you can use |
Jeff Sharkey | 9f991a2 | 2014-08-13 11:37:41 -0700 | [diff] [blame] | 5754 | * this flag. When set and the task's activity is finished, the recents |
| 5755 | * entry will remain in the interface for the user to re-launch it, like a |
| 5756 | * recents entry for a top-level application. |
| 5757 | * <p> |
| 5758 | * The receiving activity can override this request with |
| 5759 | * {@link android.R.attr#autoRemoveFromRecents} or by explcitly calling |
| 5760 | * {@link android.app.Activity#finishAndRemoveTask() |
Dianne Hackborn | 13420f2 | 2014-07-18 15:43:56 -0700 | [diff] [blame] | 5761 | * Activity.finishAndRemoveTask()}. |
Craig Mautner | 2dac056 | 2014-05-06 09:06:44 -0700 | [diff] [blame] | 5762 | */ |
Dianne Hackborn | 13420f2 | 2014-07-18 15:43:56 -0700 | [diff] [blame] | 5763 | public static final int FLAG_ACTIVITY_RETAIN_IN_RECENTS = 0x00002000; |
Craig Mautner | a228ae9 | 2014-07-09 05:44:55 -0700 | [diff] [blame] | 5764 | |
| 5765 | /** |
Wale Ogunwale | 2a25a62 | 2016-01-30 11:27:21 -0800 | [diff] [blame] | 5766 | * This flag is only used in split-screen multi-window mode. The new activity will be displayed |
| 5767 | * adjacent to the one launching it. This can only be used in conjunction with |
Wale Ogunwale | 6bdf257 | 2016-03-11 15:22:38 -0800 | [diff] [blame] | 5768 | * {@link #FLAG_ACTIVITY_NEW_TASK}. Also, setting {@link #FLAG_ACTIVITY_MULTIPLE_TASK} is |
| 5769 | * required if you want a new instance of an existing activity to be created. |
Filip Gruszczynski | 80e29f1 | 2015-12-14 14:58:30 -0800 | [diff] [blame] | 5770 | */ |
Wale Ogunwale | 2a25a62 | 2016-01-30 11:27:21 -0800 | [diff] [blame] | 5771 | public static final int FLAG_ACTIVITY_LAUNCH_ADJACENT = 0x00001000; |
Filip Gruszczynski | 80e29f1 | 2015-12-14 14:58:30 -0800 | [diff] [blame] | 5772 | |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 5773 | |
| 5774 | /** |
Patrick Baumann | 92ae2c6 | 2018-05-10 10:10:26 -0700 | [diff] [blame] | 5775 | * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, |
| 5776 | * this flag will attempt to launch an instant app if no full app on the device can already |
| 5777 | * handle the intent. |
| 5778 | * <p> |
| 5779 | * When attempting to resolve instant apps externally, the following {@link Intent} properties |
| 5780 | * are supported: |
| 5781 | * <ul> |
| 5782 | * <li>{@link Intent#setAction(String)}</li> |
| 5783 | * <li>{@link Intent#addCategory(String)}</li> |
| 5784 | * <li>{@link Intent#setData(Uri)}</li> |
| 5785 | * <li>{@link Intent#setType(String)}</li> |
| 5786 | * <li>{@link Intent#setPackage(String)}</li> |
| 5787 | * <li>{@link Intent#addFlags(int)}</li> |
| 5788 | * </ul> |
| 5789 | * <p> |
| 5790 | * In the case that no instant app can be found, the installer will be launched to notify the |
| 5791 | * user that the intent could not be resolved. On devices that do not support instant apps, |
| 5792 | * the flag will be ignored. |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 5793 | */ |
| 5794 | public static final int FLAG_ACTIVITY_MATCH_EXTERNAL = 0x00000800; |
| 5795 | |
Filip Gruszczynski | 80e29f1 | 2015-12-14 14:58:30 -0800 | [diff] [blame] | 5796 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5797 | * If set, when sending a broadcast only registered receivers will be |
| 5798 | * called -- no BroadcastReceiver components will be launched. |
| 5799 | */ |
| 5800 | public static final int FLAG_RECEIVER_REGISTERED_ONLY = 0x40000000; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5801 | /** |
Dianne Hackborn | 1c633fc | 2009-12-08 19:45:14 -0800 | [diff] [blame] | 5802 | * If set, when sending a broadcast the new broadcast will replace |
| 5803 | * any existing pending broadcast that matches it. Matching is defined |
| 5804 | * by {@link Intent#filterEquals(Intent) Intent.filterEquals} returning |
| 5805 | * true for the intents of the two broadcasts. When a match is found, |
| 5806 | * the new broadcast (and receivers associated with it) will replace the |
| 5807 | * existing one in the pending broadcast list, remaining at the same |
| 5808 | * position in the list. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 5809 | * |
Dianne Hackborn | 1c633fc | 2009-12-08 19:45:14 -0800 | [diff] [blame] | 5810 | * <p>This flag is most typically used with sticky broadcasts, which |
| 5811 | * only care about delivering the most recent values of the broadcast |
| 5812 | * to their receivers. |
| 5813 | */ |
| 5814 | public static final int FLAG_RECEIVER_REPLACE_PENDING = 0x20000000; |
| 5815 | /** |
Christopher Tate | f46723b | 2012-01-26 14:19:24 -0800 | [diff] [blame] | 5816 | * If set, when sending a broadcast the recipient is allowed to run at |
| 5817 | * foreground priority, with a shorter timeout interval. During normal |
| 5818 | * broadcasts the receivers are not automatically hoisted out of the |
| 5819 | * background priority class. |
| 5820 | */ |
| 5821 | public static final int FLAG_RECEIVER_FOREGROUND = 0x10000000; |
| 5822 | /** |
Ng Zhi An | 150a6ba | 2018-08-13 09:08:11 -0700 | [diff] [blame] | 5823 | * If set, when sending a broadcast the recipient will be run on the offload queue. |
| 5824 | * |
| 5825 | * @hide |
| 5826 | */ |
| 5827 | public static final int FLAG_RECEIVER_OFFLOAD = 0x80000000; |
| 5828 | /** |
Dianne Hackborn | 6285a32 | 2013-09-18 12:09:47 -0700 | [diff] [blame] | 5829 | * If this is an ordered broadcast, don't allow receivers to abort the broadcast. |
| 5830 | * They can still propagate results through to later receivers, but they can not prevent |
| 5831 | * later receivers from seeing the broadcast. |
| 5832 | */ |
| 5833 | public static final int FLAG_RECEIVER_NO_ABORT = 0x08000000; |
| 5834 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5835 | * If set, when sending a broadcast <i>before boot has completed</i> only |
| 5836 | * registered receivers will be called -- no BroadcastReceiver components |
| 5837 | * will be launched. Sticky intent state will be recorded properly even |
| 5838 | * if no receivers wind up being called. If {@link #FLAG_RECEIVER_REGISTERED_ONLY} |
| 5839 | * is specified in the broadcast intent, this flag is unnecessary. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 5840 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5841 | * <p>This flag is only for use by system sevices as a convenience to |
| 5842 | * avoid having to implement a more complex mechanism around detection |
| 5843 | * of boot completion. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 5844 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5845 | * @hide |
| 5846 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 5847 | @UnsupportedAppUsage |
Dianne Hackborn | 6285a32 | 2013-09-18 12:09:47 -0700 | [diff] [blame] | 5848 | public static final int FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT = 0x04000000; |
Dianne Hackborn | 9acc030 | 2009-08-25 00:27:12 -0700 | [diff] [blame] | 5849 | /** |
| 5850 | * Set when this broadcast is for a boot upgrade, a special mode that |
| 5851 | * allows the broadcast to be sent before the system is ready and launches |
| 5852 | * the app process with no providers running in it. |
| 5853 | * @hide |
| 5854 | */ |
Dianne Hackborn | 6285a32 | 2013-09-18 12:09:47 -0700 | [diff] [blame] | 5855 | public static final int FLAG_RECEIVER_BOOT_UPGRADE = 0x02000000; |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 5856 | /** |
| 5857 | * If set, the broadcast will always go to manifest receivers in background (cached |
| 5858 | * or not running) apps, regardless of whether that would be done by default. By |
| 5859 | * default they will only receive broadcasts if the broadcast has specified an |
| 5860 | * explicit component or package name. |
Christopher Tate | bdc3941 | 2017-01-23 12:21:13 -0800 | [diff] [blame] | 5861 | * |
| 5862 | * NOTE: dumpstate uses this flag numerically, so when its value is changed |
| 5863 | * the broadcast code there must also be changed to match. |
| 5864 | * |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 5865 | * @hide |
| 5866 | */ |
| 5867 | public static final int FLAG_RECEIVER_INCLUDE_BACKGROUND = 0x01000000; |
| 5868 | /** |
| 5869 | * If set, the broadcast will never go to manifest receivers in background (cached |
| 5870 | * or not running) apps, regardless of whether that would be done by default. By |
| 5871 | * default they will receive broadcasts if the broadcast has specified an |
| 5872 | * explicit component or package name. |
| 5873 | * @hide |
| 5874 | */ |
| 5875 | public static final int FLAG_RECEIVER_EXCLUDE_BACKGROUND = 0x00800000; |
Jeff Sharkey | 6a34e56 | 2016-12-21 09:56:00 -0700 | [diff] [blame] | 5876 | /** |
| 5877 | * If set, this broadcast is being sent from the shell. |
| 5878 | * @hide |
| 5879 | */ |
| 5880 | public static final int FLAG_RECEIVER_FROM_SHELL = 0x00400000; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5881 | |
Dianne Hackborn | fa82f22 | 2009-09-17 15:14:12 -0700 | [diff] [blame] | 5882 | /** |
Chad Brubaker | b7e34d5 | 2017-02-22 12:36:06 -0800 | [diff] [blame] | 5883 | * If set, the broadcast will be visible to receivers in Instant Apps. By default Instant Apps |
| 5884 | * will not receive broadcasts. |
| 5885 | * |
| 5886 | * <em>This flag has no effect when used by an Instant App.</em> |
| 5887 | */ |
| 5888 | public static final int FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS = 0x00200000; |
| 5889 | |
| 5890 | /** |
Dianne Hackborn | fa82f22 | 2009-09-17 15:14:12 -0700 | [diff] [blame] | 5891 | * @hide Flags that can't be changed with PendingIntent. |
| 5892 | */ |
Jeff Sharkey | 846318a | 2014-04-04 12:12:41 -0700 | [diff] [blame] | 5893 | public static final int IMMUTABLE_FLAGS = FLAG_GRANT_READ_URI_PERMISSION |
| 5894 | | FLAG_GRANT_WRITE_URI_PERMISSION | FLAG_GRANT_PERSISTABLE_URI_PERMISSION |
| 5895 | | FLAG_GRANT_PREFIX_URI_PERMISSION; |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 5896 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5897 | // --------------------------------------------------------------------- |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 5898 | // --------------------------------------------------------------------- |
| 5899 | // toUri() and parseUri() options. |
| 5900 | |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5901 | /** @hide */ |
| 5902 | @IntDef(flag = true, prefix = { "URI_" }, value = { |
| 5903 | URI_ALLOW_UNSAFE, |
| 5904 | URI_ANDROID_APP_SCHEME, |
| 5905 | URI_INTENT_SCHEME, |
| 5906 | }) |
| 5907 | @Retention(RetentionPolicy.SOURCE) |
| 5908 | public @interface UriFlags {} |
| 5909 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 5910 | /** |
| 5911 | * Flag for use with {@link #toUri} and {@link #parseUri}: the URI string |
| 5912 | * always has the "intent:" scheme. This syntax can be used when you want |
| 5913 | * to later disambiguate between URIs that are intended to describe an |
| 5914 | * Intent vs. all others that should be treated as raw URIs. When used |
| 5915 | * with {@link #parseUri}, any other scheme will result in a generic |
| 5916 | * VIEW action for that raw URI. |
| 5917 | */ |
| 5918 | public static final int URI_INTENT_SCHEME = 1<<0; |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 5919 | |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 5920 | /** |
| 5921 | * Flag for use with {@link #toUri} and {@link #parseUri}: the URI string |
| 5922 | * always has the "android-app:" scheme. This is a variation of |
| 5923 | * {@link #URI_INTENT_SCHEME} whose format is simpler for the case of an |
| 5924 | * http/https URI being delivered to a specific package name. The format |
| 5925 | * is: |
| 5926 | * |
| 5927 | * <pre class="prettyprint"> |
Dianne Hackborn | 0ee10f6 | 2015-01-14 16:16:13 -0800 | [diff] [blame] | 5928 | * android-app://{package_id}[/{scheme}[/{host}[/{path}]]][#Intent;{...}]</pre> |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 5929 | * |
Dianne Hackborn | 0ee10f6 | 2015-01-14 16:16:13 -0800 | [diff] [blame] | 5930 | * <p>In this scheme, only the <code>package_id</code> is required. If you include a host, |
| 5931 | * you must also include a scheme; including a path also requires both a host and a scheme. |
| 5932 | * The final #Intent; fragment can be used without a scheme, host, or path. |
| 5933 | * Note that this can not be |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 5934 | * used with intents that have a {@link #setSelector}, since the base intent |
| 5935 | * will always have an explicit package name.</p> |
| 5936 | * |
| 5937 | * <p>Some examples of how this scheme maps to Intent objects:</p> |
| 5938 | * <table border="2" width="85%" align="center" frame="hsides" rules="rows"> |
| 5939 | * <colgroup align="left" /> |
| 5940 | * <colgroup align="left" /> |
| 5941 | * <thead> |
| 5942 | * <tr><th>URI</th> <th>Intent</th></tr> |
| 5943 | * </thead> |
| 5944 | * |
| 5945 | * <tbody> |
| 5946 | * <tr><td><code>android-app://com.example.app</code></td> |
| 5947 | * <td><table style="margin:0;border:0;cellpadding:0;cellspacing:0"> |
| 5948 | * <tr><td>Action: </td><td>{@link #ACTION_MAIN}</td></tr> |
| 5949 | * <tr><td>Package: </td><td><code>com.example.app</code></td></tr> |
| 5950 | * </table></td> |
| 5951 | * </tr> |
| 5952 | * <tr><td><code>android-app://com.example.app/http/example.com</code></td> |
| 5953 | * <td><table style="margin:0;border:0;cellpadding:0;cellspacing:0"> |
| 5954 | * <tr><td>Action: </td><td>{@link #ACTION_VIEW}</td></tr> |
| 5955 | * <tr><td>Data: </td><td><code>http://example.com/</code></td></tr> |
| 5956 | * <tr><td>Package: </td><td><code>com.example.app</code></td></tr> |
| 5957 | * </table></td> |
| 5958 | * </tr> |
| 5959 | * <tr><td><code>android-app://com.example.app/http/example.com/foo?1234</code></td> |
| 5960 | * <td><table style="margin:0;border:0;cellpadding:0;cellspacing:0"> |
| 5961 | * <tr><td>Action: </td><td>{@link #ACTION_VIEW}</td></tr> |
| 5962 | * <tr><td>Data: </td><td><code>http://example.com/foo?1234</code></td></tr> |
| 5963 | * <tr><td>Package: </td><td><code>com.example.app</code></td></tr> |
| 5964 | * </table></td> |
| 5965 | * </tr> |
| 5966 | * <tr><td><code>android-app://com.example.app/<br />#Intent;action=com.example.MY_ACTION;end</code></td> |
| 5967 | * <td><table style="margin:0;border:0;cellpadding:0;cellspacing:0"> |
| 5968 | * <tr><td>Action: </td><td><code>com.example.MY_ACTION</code></td></tr> |
| 5969 | * <tr><td>Package: </td><td><code>com.example.app</code></td></tr> |
| 5970 | * </table></td> |
| 5971 | * </tr> |
| 5972 | * <tr><td><code>android-app://com.example.app/http/example.com/foo?1234<br />#Intent;action=com.example.MY_ACTION;end</code></td> |
| 5973 | * <td><table style="margin:0;border:0;cellpadding:0;cellspacing:0"> |
| 5974 | * <tr><td>Action: </td><td><code>com.example.MY_ACTION</code></td></tr> |
| 5975 | * <tr><td>Data: </td><td><code>http://example.com/foo?1234</code></td></tr> |
| 5976 | * <tr><td>Package: </td><td><code>com.example.app</code></td></tr> |
| 5977 | * </table></td> |
| 5978 | * </tr> |
| 5979 | * <tr><td><code>android-app://com.example.app/<br />#Intent;action=com.example.MY_ACTION;<br />i.some_int=100;S.some_str=hello;end</code></td> |
| 5980 | * <td><table border="" style="margin:0" > |
| 5981 | * <tr><td>Action: </td><td><code>com.example.MY_ACTION</code></td></tr> |
| 5982 | * <tr><td>Package: </td><td><code>com.example.app</code></td></tr> |
| 5983 | * <tr><td>Extras: </td><td><code>some_int=(int)100<br />some_str=(String)hello</code></td></tr> |
| 5984 | * </table></td> |
| 5985 | * </tr> |
| 5986 | * </tbody> |
| 5987 | * </table> |
| 5988 | */ |
| 5989 | public static final int URI_ANDROID_APP_SCHEME = 1<<1; |
| 5990 | |
Dianne Hackborn | 24b1c23 | 2014-11-20 17:17:39 -0800 | [diff] [blame] | 5991 | /** |
| 5992 | * Flag for use with {@link #toUri} and {@link #parseUri}: allow parsing |
| 5993 | * of unsafe information. In particular, the flags {@link #FLAG_GRANT_READ_URI_PERMISSION}, |
| 5994 | * {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, {@link #FLAG_GRANT_PERSISTABLE_URI_PERMISSION}, |
| 5995 | * and {@link #FLAG_GRANT_PREFIX_URI_PERMISSION} flags can not be set, so that the |
| 5996 | * generated Intent can not cause unexpected data access to happen. |
| 5997 | * |
| 5998 | * <p>If you do not trust the source of the URI being parsed, you should still do further |
| 5999 | * processing to protect yourself from it. In particular, when using it to start an |
| 6000 | * activity you should usually add in {@link #CATEGORY_BROWSABLE} to limit the activities |
| 6001 | * that can handle it.</p> |
| 6002 | */ |
| 6003 | public static final int URI_ALLOW_UNSAFE = 1<<2; |
| 6004 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6005 | // --------------------------------------------------------------------- |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6006 | |
| 6007 | private String mAction; |
| 6008 | private Uri mData; |
| 6009 | private String mType; |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6010 | private String mPackage; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6011 | private ComponentName mComponent; |
| 6012 | private int mFlags; |
Dianne Hackborn | add005c | 2013-07-17 18:43:12 -0700 | [diff] [blame] | 6013 | private ArraySet<String> mCategories; |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6014 | @UnsupportedAppUsage |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6015 | private Bundle mExtras; |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 6016 | private Rect mSourceBounds; |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 6017 | private Intent mSelector; |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 6018 | private ClipData mClipData; |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 6019 | private int mContentUserHint = UserHandle.USER_CURRENT; |
Todd Kennedy | b3b43130 | 2017-03-20 16:05:48 -0700 | [diff] [blame] | 6020 | /** Token to track instant app launches. Local only; do not copy cross-process. */ |
| 6021 | private String mLaunchToken; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6022 | |
| 6023 | // --------------------------------------------------------------------- |
| 6024 | |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 6025 | private static final int COPY_MODE_ALL = 0; |
| 6026 | private static final int COPY_MODE_FILTER = 1; |
| 6027 | private static final int COPY_MODE_HISTORY = 2; |
| 6028 | |
| 6029 | /** @hide */ |
Jeff Sharkey | ce8db99 | 2017-12-13 20:05:05 -0700 | [diff] [blame] | 6030 | @IntDef(prefix = { "COPY_MODE_" }, value = { |
| 6031 | COPY_MODE_ALL, |
| 6032 | COPY_MODE_FILTER, |
| 6033 | COPY_MODE_HISTORY |
| 6034 | }) |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 6035 | @Retention(RetentionPolicy.SOURCE) |
| 6036 | public @interface CopyMode {} |
| 6037 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6038 | /** |
| 6039 | * Create an empty intent. |
| 6040 | */ |
| 6041 | public Intent() { |
| 6042 | } |
| 6043 | |
| 6044 | /** |
| 6045 | * Copy constructor. |
| 6046 | */ |
| 6047 | public Intent(Intent o) { |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 6048 | this(o, COPY_MODE_ALL); |
| 6049 | } |
| 6050 | |
| 6051 | private Intent(Intent o, @CopyMode int copyMode) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6052 | this.mAction = o.mAction; |
| 6053 | this.mData = o.mData; |
| 6054 | this.mType = o.mType; |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6055 | this.mPackage = o.mPackage; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6056 | this.mComponent = o.mComponent; |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 6057 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6058 | if (o.mCategories != null) { |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 6059 | this.mCategories = new ArraySet<>(o.mCategories); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6060 | } |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 6061 | |
| 6062 | if (copyMode != COPY_MODE_FILTER) { |
| 6063 | this.mFlags = o.mFlags; |
| 6064 | this.mContentUserHint = o.mContentUserHint; |
| 6065 | this.mLaunchToken = o.mLaunchToken; |
| 6066 | if (o.mSourceBounds != null) { |
| 6067 | this.mSourceBounds = new Rect(o.mSourceBounds); |
| 6068 | } |
| 6069 | if (o.mSelector != null) { |
| 6070 | this.mSelector = new Intent(o.mSelector); |
| 6071 | } |
| 6072 | |
| 6073 | if (copyMode != COPY_MODE_HISTORY) { |
| 6074 | if (o.mExtras != null) { |
| 6075 | this.mExtras = new Bundle(o.mExtras); |
| 6076 | } |
| 6077 | if (o.mClipData != null) { |
| 6078 | this.mClipData = new ClipData(o.mClipData); |
| 6079 | } |
| 6080 | } else { |
| 6081 | if (o.mExtras != null && !o.mExtras.maybeIsEmpty()) { |
| 6082 | this.mExtras = Bundle.STRIPPED; |
| 6083 | } |
| 6084 | |
| 6085 | // Also set "stripped" clip data when we ever log mClipData in the (broadcast) |
| 6086 | // history. |
| 6087 | } |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 6088 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6089 | } |
| 6090 | |
| 6091 | @Override |
| 6092 | public Object clone() { |
| 6093 | return new Intent(this); |
| 6094 | } |
| 6095 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6096 | /** |
| 6097 | * Make a clone of only the parts of the Intent that are relevant for |
| 6098 | * filter matching: the action, data, type, component, and categories. |
| 6099 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 6100 | public @NonNull Intent cloneFilter() { |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 6101 | return new Intent(this, COPY_MODE_FILTER); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6102 | } |
| 6103 | |
| 6104 | /** |
| 6105 | * Create an intent with a given action. All other fields (data, type, |
| 6106 | * class) are null. Note that the action <em>must</em> be in a |
| 6107 | * namespace because Intents are used globally in the system -- for |
| 6108 | * example the system VIEW action is android.intent.action.VIEW; an |
| 6109 | * application's custom action would be something like |
| 6110 | * com.google.app.myapp.CUSTOM_ACTION. |
| 6111 | * |
| 6112 | * @param action The Intent action, such as ACTION_VIEW. |
| 6113 | */ |
| 6114 | public Intent(String action) { |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 6115 | setAction(action); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6116 | } |
| 6117 | |
| 6118 | /** |
| 6119 | * Create an intent with a given action and for a given data url. Note |
| 6120 | * that the action <em>must</em> be in a namespace because Intents are |
| 6121 | * used globally in the system -- for example the system VIEW action is |
| 6122 | * android.intent.action.VIEW; an application's custom action would be |
| 6123 | * something like com.google.app.myapp.CUSTOM_ACTION. |
| 6124 | * |
Dianne Hackborn | b3cddae | 2009-04-13 16:54:00 -0700 | [diff] [blame] | 6125 | * <p><em>Note: scheme and host name matching in the Android framework is |
| 6126 | * case-sensitive, unlike the formal RFC. As a result, |
| 6127 | * you should always ensure that you write your Uri with these elements |
| 6128 | * using lower case letters, and normalize any Uris you receive from |
| 6129 | * outside of Android to ensure the scheme and host is lower case.</em></p> |
| 6130 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6131 | * @param action The Intent action, such as ACTION_VIEW. |
| 6132 | * @param uri The Intent data URI. |
| 6133 | */ |
| 6134 | public Intent(String action, Uri uri) { |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 6135 | setAction(action); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6136 | mData = uri; |
| 6137 | } |
| 6138 | |
| 6139 | /** |
| 6140 | * Create an intent for a specific component. All other fields (action, data, |
| 6141 | * type, class) are null, though they can be modified later with explicit |
| 6142 | * calls. This provides a convenient way to create an intent that is |
| 6143 | * intended to execute a hard-coded class name, rather than relying on the |
| 6144 | * system to find an appropriate class for you; see {@link #setComponent} |
| 6145 | * for more information on the repercussions of this. |
| 6146 | * |
| 6147 | * @param packageContext A Context of the application package implementing |
| 6148 | * this class. |
| 6149 | * @param cls The component class that is to be used for the intent. |
| 6150 | * |
| 6151 | * @see #setClass |
| 6152 | * @see #setComponent |
| 6153 | * @see #Intent(String, android.net.Uri , Context, Class) |
| 6154 | */ |
| 6155 | public Intent(Context packageContext, Class<?> cls) { |
| 6156 | mComponent = new ComponentName(packageContext, cls); |
| 6157 | } |
| 6158 | |
| 6159 | /** |
| 6160 | * Create an intent for a specific component with a specified action and data. |
Craig Mautner | 2dac056 | 2014-05-06 09:06:44 -0700 | [diff] [blame] | 6161 | * This is equivalent to using {@link #Intent(String, android.net.Uri)} to |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6162 | * construct the Intent and then calling {@link #setClass} to set its |
| 6163 | * class. |
| 6164 | * |
Dianne Hackborn | b3cddae | 2009-04-13 16:54:00 -0700 | [diff] [blame] | 6165 | * <p><em>Note: scheme and host name matching in the Android framework is |
| 6166 | * case-sensitive, unlike the formal RFC. As a result, |
| 6167 | * you should always ensure that you write your Uri with these elements |
| 6168 | * using lower case letters, and normalize any Uris you receive from |
| 6169 | * outside of Android to ensure the scheme and host is lower case.</em></p> |
| 6170 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6171 | * @param action The Intent action, such as ACTION_VIEW. |
| 6172 | * @param uri The Intent data URI. |
| 6173 | * @param packageContext A Context of the application package implementing |
| 6174 | * this class. |
| 6175 | * @param cls The component class that is to be used for the intent. |
| 6176 | * |
| 6177 | * @see #Intent(String, android.net.Uri) |
| 6178 | * @see #Intent(Context, Class) |
| 6179 | * @see #setClass |
| 6180 | * @see #setComponent |
| 6181 | */ |
| 6182 | public Intent(String action, Uri uri, |
| 6183 | Context packageContext, Class<?> cls) { |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 6184 | setAction(action); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6185 | mData = uri; |
| 6186 | mComponent = new ComponentName(packageContext, cls); |
| 6187 | } |
| 6188 | |
| 6189 | /** |
Dianne Hackborn | 30d7189 | 2010-12-11 10:37:55 -0800 | [diff] [blame] | 6190 | * Create an intent to launch the main (root) activity of a task. This |
| 6191 | * is the Intent that is started when the application's is launched from |
| 6192 | * Home. For anything else that wants to launch an application in the |
| 6193 | * same way, it is important that they use an Intent structured the same |
| 6194 | * way, and can use this function to ensure this is the case. |
| 6195 | * |
| 6196 | * <p>The returned Intent has the given Activity component as its explicit |
| 6197 | * component, {@link #ACTION_MAIN} as its action, and includes the |
| 6198 | * category {@link #CATEGORY_LAUNCHER}. This does <em>not</em> have |
| 6199 | * {@link #FLAG_ACTIVITY_NEW_TASK} set, though typically you will want |
| 6200 | * to do that through {@link #addFlags(int)} on the returned Intent. |
| 6201 | * |
| 6202 | * @param mainActivity The main activity component that this Intent will |
| 6203 | * launch. |
| 6204 | * @return Returns a newly created Intent that can be used to launch the |
| 6205 | * activity as a main application entry. |
| 6206 | * |
| 6207 | * @see #setClass |
| 6208 | * @see #setComponent |
| 6209 | */ |
| 6210 | public static Intent makeMainActivity(ComponentName mainActivity) { |
| 6211 | Intent intent = new Intent(ACTION_MAIN); |
| 6212 | intent.setComponent(mainActivity); |
| 6213 | intent.addCategory(CATEGORY_LAUNCHER); |
| 6214 | return intent; |
| 6215 | } |
| 6216 | |
| 6217 | /** |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 6218 | * Make an Intent for the main activity of an application, without |
| 6219 | * specifying a specific activity to run but giving a selector to find |
| 6220 | * the activity. This results in a final Intent that is structured |
| 6221 | * the same as when the application is launched from |
| 6222 | * Home. For anything else that wants to launch an application in the |
| 6223 | * same way, it is important that they use an Intent structured the same |
| 6224 | * way, and can use this function to ensure this is the case. |
| 6225 | * |
| 6226 | * <p>The returned Intent has {@link #ACTION_MAIN} as its action, and includes the |
| 6227 | * category {@link #CATEGORY_LAUNCHER}. This does <em>not</em> have |
| 6228 | * {@link #FLAG_ACTIVITY_NEW_TASK} set, though typically you will want |
| 6229 | * to do that through {@link #addFlags(int)} on the returned Intent. |
| 6230 | * |
| 6231 | * @param selectorAction The action name of the Intent's selector. |
| 6232 | * @param selectorCategory The name of a category to add to the Intent's |
| 6233 | * selector. |
| 6234 | * @return Returns a newly created Intent that can be used to launch the |
| 6235 | * activity as a main application entry. |
| 6236 | * |
| 6237 | * @see #setSelector(Intent) |
| 6238 | */ |
| 6239 | public static Intent makeMainSelectorActivity(String selectorAction, |
| 6240 | String selectorCategory) { |
| 6241 | Intent intent = new Intent(ACTION_MAIN); |
| 6242 | intent.addCategory(CATEGORY_LAUNCHER); |
| 6243 | Intent selector = new Intent(); |
| 6244 | selector.setAction(selectorAction); |
| 6245 | selector.addCategory(selectorCategory); |
| 6246 | intent.setSelector(selector); |
| 6247 | return intent; |
| 6248 | } |
| 6249 | |
| 6250 | /** |
Dianne Hackborn | 30d7189 | 2010-12-11 10:37:55 -0800 | [diff] [blame] | 6251 | * Make an Intent that can be used to re-launch an application's task |
| 6252 | * in its base state. This is like {@link #makeMainActivity(ComponentName)}, |
| 6253 | * but also sets the flags {@link #FLAG_ACTIVITY_NEW_TASK} and |
| 6254 | * {@link #FLAG_ACTIVITY_CLEAR_TASK}. |
| 6255 | * |
| 6256 | * @param mainActivity The activity component that is the root of the |
| 6257 | * task; this is the activity that has been published in the application's |
| 6258 | * manifest as the main launcher icon. |
| 6259 | * |
| 6260 | * @return Returns a newly created Intent that can be used to relaunch the |
| 6261 | * activity's task in its root state. |
| 6262 | */ |
| 6263 | public static Intent makeRestartActivityTask(ComponentName mainActivity) { |
| 6264 | Intent intent = makeMainActivity(mainActivity); |
| 6265 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
| 6266 | | Intent.FLAG_ACTIVITY_CLEAR_TASK); |
| 6267 | return intent; |
| 6268 | } |
| 6269 | |
| 6270 | /** |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6271 | * Call {@link #parseUri} with 0 flags. |
| 6272 | * @deprecated Use {@link #parseUri} instead. |
| 6273 | */ |
| 6274 | @Deprecated |
| 6275 | public static Intent getIntent(String uri) throws URISyntaxException { |
| 6276 | return parseUri(uri, 0); |
| 6277 | } |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 6278 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6279 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6280 | * Create an intent from a URI. This URI may encode the action, |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6281 | * category, and other intent fields, if it was returned by |
Dianne Hackborn | 7f20543 | 2009-07-28 00:13:47 -0700 | [diff] [blame] | 6282 | * {@link #toUri}. If the Intent was not generate by toUri(), its data |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6283 | * will be the entire URI and its action will be ACTION_VIEW. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6284 | * |
| 6285 | * <p>The URI given here must not be relative -- that is, it must include |
| 6286 | * the scheme and full path. |
| 6287 | * |
| 6288 | * @param uri The URI to turn into an Intent. |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 6289 | * @param flags Additional processing flags. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6290 | * |
| 6291 | * @return Intent The newly created Intent object. |
| 6292 | * |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6293 | * @throws URISyntaxException Throws URISyntaxError if the basic URI syntax |
| 6294 | * it bad (as parsed by the Uri class) or the Intent data within the |
| 6295 | * URI is invalid. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 6296 | * |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6297 | * @see #toUri |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6298 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 6299 | public static Intent parseUri(String uri, @UriFlags int flags) throws URISyntaxException { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6300 | int i = 0; |
| 6301 | try { |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6302 | final boolean androidApp = uri.startsWith("android-app:"); |
| 6303 | |
| 6304 | // Validate intent scheme if requested. |
| 6305 | if ((flags&(URI_INTENT_SCHEME|URI_ANDROID_APP_SCHEME)) != 0) { |
| 6306 | if (!uri.startsWith("intent:") && !androidApp) { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6307 | Intent intent = new Intent(ACTION_VIEW); |
| 6308 | try { |
| 6309 | intent.setData(Uri.parse(uri)); |
| 6310 | } catch (IllegalArgumentException e) { |
| 6311 | throw new URISyntaxException(uri, e.getMessage()); |
| 6312 | } |
| 6313 | return intent; |
| 6314 | } |
| 6315 | } |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 6316 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6317 | i = uri.lastIndexOf("#"); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6318 | // simple case |
| 6319 | if (i == -1) { |
| 6320 | if (!androidApp) { |
| 6321 | return new Intent(ACTION_VIEW, Uri.parse(uri)); |
| 6322 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6323 | |
| 6324 | // old format Intent URI |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6325 | } else if (!uri.startsWith("#Intent;", i)) { |
| 6326 | if (!androidApp) { |
Dianne Hackborn | 24b1c23 | 2014-11-20 17:17:39 -0800 | [diff] [blame] | 6327 | return getIntentOld(uri, flags); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6328 | } else { |
| 6329 | i = -1; |
| 6330 | } |
| 6331 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6332 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6333 | // new format |
| 6334 | Intent intent = new Intent(ACTION_VIEW); |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 6335 | Intent baseIntent = intent; |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6336 | boolean explicitAction = false; |
| 6337 | boolean inSelector = false; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6338 | |
| 6339 | // fetch data part, if present |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6340 | String scheme = null; |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6341 | String data; |
| 6342 | if (i >= 0) { |
| 6343 | data = uri.substring(0, i); |
| 6344 | i += 8; // length of "#Intent;" |
| 6345 | } else { |
| 6346 | data = uri; |
| 6347 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6348 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6349 | // loop over contents of Intent, all name=value; |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6350 | while (i >= 0 && !uri.startsWith("end", i)) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6351 | int eq = uri.indexOf('=', i); |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 6352 | if (eq < 0) eq = i-1; |
| 6353 | int semi = uri.indexOf(';', i); |
| 6354 | String value = eq < semi ? Uri.decode(uri.substring(eq + 1, semi)) : ""; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6355 | |
| 6356 | // action |
| 6357 | if (uri.startsWith("action=", i)) { |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 6358 | intent.setAction(value); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6359 | if (!inSelector) { |
| 6360 | explicitAction = true; |
| 6361 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6362 | } |
| 6363 | |
| 6364 | // categories |
| 6365 | else if (uri.startsWith("category=", i)) { |
| 6366 | intent.addCategory(value); |
| 6367 | } |
| 6368 | |
| 6369 | // type |
| 6370 | else if (uri.startsWith("type=", i)) { |
| 6371 | intent.mType = value; |
| 6372 | } |
| 6373 | |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 6374 | // launch flags |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6375 | else if (uri.startsWith("launchFlags=", i)) { |
| 6376 | intent.mFlags = Integer.decode(value).intValue(); |
Dianne Hackborn | 24b1c23 | 2014-11-20 17:17:39 -0800 | [diff] [blame] | 6377 | if ((flags& URI_ALLOW_UNSAFE) == 0) { |
| 6378 | intent.mFlags &= ~IMMUTABLE_FLAGS; |
| 6379 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6380 | } |
| 6381 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6382 | // package |
| 6383 | else if (uri.startsWith("package=", i)) { |
| 6384 | intent.mPackage = value; |
| 6385 | } |
| 6386 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6387 | // component |
| 6388 | else if (uri.startsWith("component=", i)) { |
| 6389 | intent.mComponent = ComponentName.unflattenFromString(value); |
| 6390 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6391 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6392 | // scheme |
| 6393 | else if (uri.startsWith("scheme=", i)) { |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6394 | if (inSelector) { |
Dianne Hackborn | 80b1c56 | 2014-12-09 20:22:08 -0800 | [diff] [blame] | 6395 | intent.mData = Uri.parse(value + ":"); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6396 | } else { |
| 6397 | scheme = value; |
| 6398 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6399 | } |
| 6400 | |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 6401 | // source bounds |
| 6402 | else if (uri.startsWith("sourceBounds=", i)) { |
| 6403 | intent.mSourceBounds = Rect.unflattenFromString(value); |
| 6404 | } |
| 6405 | |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 6406 | // selector |
| 6407 | else if (semi == (i+3) && uri.startsWith("SEL", i)) { |
| 6408 | intent = new Intent(); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6409 | inSelector = true; |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 6410 | } |
| 6411 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6412 | // extra |
| 6413 | else { |
| 6414 | String key = Uri.decode(uri.substring(i + 2, eq)); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6415 | // create Bundle if it doesn't already exist |
| 6416 | if (intent.mExtras == null) intent.mExtras = new Bundle(); |
| 6417 | Bundle b = intent.mExtras; |
| 6418 | // add EXTRA |
| 6419 | if (uri.startsWith("S.", i)) b.putString(key, value); |
| 6420 | else if (uri.startsWith("B.", i)) b.putBoolean(key, Boolean.parseBoolean(value)); |
| 6421 | else if (uri.startsWith("b.", i)) b.putByte(key, Byte.parseByte(value)); |
| 6422 | else if (uri.startsWith("c.", i)) b.putChar(key, value.charAt(0)); |
| 6423 | else if (uri.startsWith("d.", i)) b.putDouble(key, Double.parseDouble(value)); |
| 6424 | else if (uri.startsWith("f.", i)) b.putFloat(key, Float.parseFloat(value)); |
| 6425 | else if (uri.startsWith("i.", i)) b.putInt(key, Integer.parseInt(value)); |
| 6426 | else if (uri.startsWith("l.", i)) b.putLong(key, Long.parseLong(value)); |
| 6427 | else if (uri.startsWith("s.", i)) b.putShort(key, Short.parseShort(value)); |
| 6428 | else throw new URISyntaxException(uri, "unknown EXTRA type", i); |
| 6429 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6430 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6431 | // move to the next item |
| 6432 | i = semi + 1; |
| 6433 | } |
| 6434 | |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6435 | if (inSelector) { |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 6436 | // The Intent had a selector; fix it up. |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6437 | if (baseIntent.mPackage == null) { |
| 6438 | baseIntent.setSelector(intent); |
| 6439 | } |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 6440 | intent = baseIntent; |
| 6441 | } |
| 6442 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6443 | if (data != null) { |
| 6444 | if (data.startsWith("intent:")) { |
| 6445 | data = data.substring(7); |
| 6446 | if (scheme != null) { |
| 6447 | data = scheme + ':' + data; |
| 6448 | } |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6449 | } else if (data.startsWith("android-app:")) { |
| 6450 | if (data.charAt(12) == '/' && data.charAt(13) == '/') { |
| 6451 | // Correctly formed android-app, first part is package name. |
| 6452 | int end = data.indexOf('/', 14); |
| 6453 | if (end < 0) { |
| 6454 | // All we have is a package name. |
| 6455 | intent.mPackage = data.substring(14); |
| 6456 | if (!explicitAction) { |
| 6457 | intent.setAction(ACTION_MAIN); |
| 6458 | } |
| 6459 | data = ""; |
| 6460 | } else { |
| 6461 | // Target the Intent at the given package name always. |
| 6462 | String authority = null; |
| 6463 | intent.mPackage = data.substring(14, end); |
| 6464 | int newEnd; |
Dianne Hackborn | 80b1c56 | 2014-12-09 20:22:08 -0800 | [diff] [blame] | 6465 | if ((end+1) < data.length()) { |
| 6466 | if ((newEnd=data.indexOf('/', end+1)) >= 0) { |
| 6467 | // Found a scheme, remember it. |
| 6468 | scheme = data.substring(end+1, newEnd); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6469 | end = newEnd; |
Dianne Hackborn | 80b1c56 | 2014-12-09 20:22:08 -0800 | [diff] [blame] | 6470 | if (end < data.length() && (newEnd=data.indexOf('/', end+1)) >= 0) { |
| 6471 | // Found a authority, remember it. |
| 6472 | authority = data.substring(end+1, newEnd); |
| 6473 | end = newEnd; |
| 6474 | } |
| 6475 | } else { |
| 6476 | // All we have is a scheme. |
| 6477 | scheme = data.substring(end+1); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6478 | } |
| 6479 | } |
| 6480 | if (scheme == null) { |
| 6481 | // If there was no scheme, then this just targets the package. |
| 6482 | if (!explicitAction) { |
| 6483 | intent.setAction(ACTION_MAIN); |
| 6484 | } |
| 6485 | data = ""; |
| 6486 | } else if (authority == null) { |
| 6487 | data = scheme + ":"; |
| 6488 | } else { |
| 6489 | data = scheme + "://" + authority + data.substring(end); |
| 6490 | } |
| 6491 | } |
| 6492 | } else { |
| 6493 | data = ""; |
| 6494 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6495 | } |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 6496 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6497 | if (data.length() > 0) { |
| 6498 | try { |
| 6499 | intent.mData = Uri.parse(data); |
| 6500 | } catch (IllegalArgumentException e) { |
| 6501 | throw new URISyntaxException(uri, e.getMessage()); |
| 6502 | } |
| 6503 | } |
| 6504 | } |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 6505 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6506 | return intent; |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6507 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6508 | } catch (IndexOutOfBoundsException e) { |
| 6509 | throw new URISyntaxException(uri, "illegal Intent URI format", i); |
| 6510 | } |
| 6511 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6512 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6513 | public static Intent getIntentOld(String uri) throws URISyntaxException { |
Dianne Hackborn | 24b1c23 | 2014-11-20 17:17:39 -0800 | [diff] [blame] | 6514 | return getIntentOld(uri, 0); |
| 6515 | } |
| 6516 | |
| 6517 | private static Intent getIntentOld(String uri, int flags) throws URISyntaxException { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6518 | Intent intent; |
| 6519 | |
| 6520 | int i = uri.lastIndexOf('#'); |
| 6521 | if (i >= 0) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6522 | String action = null; |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6523 | final int intentFragmentStart = i; |
| 6524 | boolean isIntentFragment = false; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6525 | |
| 6526 | i++; |
| 6527 | |
| 6528 | if (uri.regionMatches(i, "action(", 0, 7)) { |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6529 | isIntentFragment = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6530 | i += 7; |
| 6531 | int j = uri.indexOf(')', i); |
| 6532 | action = uri.substring(i, j); |
| 6533 | i = j + 1; |
| 6534 | } |
| 6535 | |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6536 | intent = new Intent(action); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6537 | |
| 6538 | if (uri.regionMatches(i, "categories(", 0, 11)) { |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6539 | isIntentFragment = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6540 | i += 11; |
| 6541 | int j = uri.indexOf(')', i); |
| 6542 | while (i < j) { |
| 6543 | int sep = uri.indexOf('!', i); |
Alan Viverette | 0adf32b | 2014-09-18 12:53:16 -0700 | [diff] [blame] | 6544 | if (sep < 0 || sep > j) sep = j; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6545 | if (i < sep) { |
| 6546 | intent.addCategory(uri.substring(i, sep)); |
| 6547 | } |
| 6548 | i = sep + 1; |
| 6549 | } |
| 6550 | i = j + 1; |
| 6551 | } |
| 6552 | |
| 6553 | if (uri.regionMatches(i, "type(", 0, 5)) { |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6554 | isIntentFragment = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6555 | i += 5; |
| 6556 | int j = uri.indexOf(')', i); |
| 6557 | intent.mType = uri.substring(i, j); |
| 6558 | i = j + 1; |
| 6559 | } |
| 6560 | |
| 6561 | if (uri.regionMatches(i, "launchFlags(", 0, 12)) { |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6562 | isIntentFragment = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6563 | i += 12; |
| 6564 | int j = uri.indexOf(')', i); |
| 6565 | intent.mFlags = Integer.decode(uri.substring(i, j)).intValue(); |
Dianne Hackborn | 24b1c23 | 2014-11-20 17:17:39 -0800 | [diff] [blame] | 6566 | if ((flags& URI_ALLOW_UNSAFE) == 0) { |
| 6567 | intent.mFlags &= ~IMMUTABLE_FLAGS; |
| 6568 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6569 | i = j + 1; |
| 6570 | } |
| 6571 | |
| 6572 | if (uri.regionMatches(i, "component(", 0, 10)) { |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6573 | isIntentFragment = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6574 | i += 10; |
| 6575 | int j = uri.indexOf(')', i); |
| 6576 | int sep = uri.indexOf('!', i); |
| 6577 | if (sep >= 0 && sep < j) { |
| 6578 | String pkg = uri.substring(i, sep); |
| 6579 | String cls = uri.substring(sep + 1, j); |
| 6580 | intent.mComponent = new ComponentName(pkg, cls); |
| 6581 | } |
| 6582 | i = j + 1; |
| 6583 | } |
| 6584 | |
| 6585 | if (uri.regionMatches(i, "extras(", 0, 7)) { |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6586 | isIntentFragment = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6587 | i += 7; |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6588 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6589 | final int closeParen = uri.indexOf(')', i); |
| 6590 | if (closeParen == -1) throw new URISyntaxException(uri, |
| 6591 | "EXTRA missing trailing ')'", i); |
| 6592 | |
| 6593 | while (i < closeParen) { |
| 6594 | // fetch the key value |
| 6595 | int j = uri.indexOf('=', i); |
| 6596 | if (j <= i + 1 || i >= closeParen) { |
| 6597 | throw new URISyntaxException(uri, "EXTRA missing '='", i); |
| 6598 | } |
| 6599 | char type = uri.charAt(i); |
| 6600 | i++; |
| 6601 | String key = uri.substring(i, j); |
| 6602 | i = j + 1; |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6603 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6604 | // get type-value |
| 6605 | j = uri.indexOf('!', i); |
| 6606 | if (j == -1 || j >= closeParen) j = closeParen; |
| 6607 | if (i >= j) throw new URISyntaxException(uri, "EXTRA missing '!'", i); |
| 6608 | String value = uri.substring(i, j); |
| 6609 | i = j; |
| 6610 | |
| 6611 | // create Bundle if it doesn't already exist |
| 6612 | if (intent.mExtras == null) intent.mExtras = new Bundle(); |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6613 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6614 | // add item to bundle |
| 6615 | try { |
| 6616 | switch (type) { |
| 6617 | case 'S': |
| 6618 | intent.mExtras.putString(key, Uri.decode(value)); |
| 6619 | break; |
| 6620 | case 'B': |
| 6621 | intent.mExtras.putBoolean(key, Boolean.parseBoolean(value)); |
| 6622 | break; |
| 6623 | case 'b': |
| 6624 | intent.mExtras.putByte(key, Byte.parseByte(value)); |
| 6625 | break; |
| 6626 | case 'c': |
| 6627 | intent.mExtras.putChar(key, Uri.decode(value).charAt(0)); |
| 6628 | break; |
| 6629 | case 'd': |
| 6630 | intent.mExtras.putDouble(key, Double.parseDouble(value)); |
| 6631 | break; |
| 6632 | case 'f': |
| 6633 | intent.mExtras.putFloat(key, Float.parseFloat(value)); |
| 6634 | break; |
| 6635 | case 'i': |
| 6636 | intent.mExtras.putInt(key, Integer.parseInt(value)); |
| 6637 | break; |
| 6638 | case 'l': |
| 6639 | intent.mExtras.putLong(key, Long.parseLong(value)); |
| 6640 | break; |
| 6641 | case 's': |
| 6642 | intent.mExtras.putShort(key, Short.parseShort(value)); |
| 6643 | break; |
| 6644 | default: |
| 6645 | throw new URISyntaxException(uri, "EXTRA has unknown type", i); |
| 6646 | } |
| 6647 | } catch (NumberFormatException e) { |
| 6648 | throw new URISyntaxException(uri, "EXTRA value can't be parsed", i); |
| 6649 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6650 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6651 | char ch = uri.charAt(i); |
| 6652 | if (ch == ')') break; |
| 6653 | if (ch != '!') throw new URISyntaxException(uri, "EXTRA missing '!'", i); |
| 6654 | i++; |
| 6655 | } |
| 6656 | } |
| 6657 | |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6658 | if (isIntentFragment) { |
| 6659 | intent.mData = Uri.parse(uri.substring(0, intentFragmentStart)); |
| 6660 | } else { |
| 6661 | intent.mData = Uri.parse(uri); |
| 6662 | } |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 6663 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6664 | if (intent.mAction == null) { |
| 6665 | // By default, if no action is specified, then use VIEW. |
| 6666 | intent.mAction = ACTION_VIEW; |
| 6667 | } |
| 6668 | |
| 6669 | } else { |
| 6670 | intent = new Intent(ACTION_VIEW, Uri.parse(uri)); |
| 6671 | } |
| 6672 | |
| 6673 | return intent; |
| 6674 | } |
| 6675 | |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 6676 | /** @hide */ |
| 6677 | public interface CommandOptionHandler { |
| 6678 | boolean handleOption(String opt, ShellCommand cmd); |
| 6679 | } |
| 6680 | |
| 6681 | /** @hide */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 6682 | @UnsupportedAppUsage |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 6683 | public static Intent parseCommandArgs(ShellCommand cmd, CommandOptionHandler optionHandler) |
| 6684 | throws URISyntaxException { |
| 6685 | Intent intent = new Intent(); |
| 6686 | Intent baseIntent = intent; |
| 6687 | boolean hasIntentInfo = false; |
| 6688 | |
| 6689 | Uri data = null; |
| 6690 | String type = null; |
| 6691 | |
| 6692 | String opt; |
| 6693 | while ((opt=cmd.getNextOption()) != null) { |
| 6694 | switch (opt) { |
| 6695 | case "-a": |
| 6696 | intent.setAction(cmd.getNextArgRequired()); |
| 6697 | if (intent == baseIntent) { |
| 6698 | hasIntentInfo = true; |
| 6699 | } |
| 6700 | break; |
| 6701 | case "-d": |
| 6702 | data = Uri.parse(cmd.getNextArgRequired()); |
| 6703 | if (intent == baseIntent) { |
| 6704 | hasIntentInfo = true; |
| 6705 | } |
| 6706 | break; |
| 6707 | case "-t": |
| 6708 | type = cmd.getNextArgRequired(); |
| 6709 | if (intent == baseIntent) { |
| 6710 | hasIntentInfo = true; |
| 6711 | } |
| 6712 | break; |
| 6713 | case "-c": |
| 6714 | intent.addCategory(cmd.getNextArgRequired()); |
| 6715 | if (intent == baseIntent) { |
| 6716 | hasIntentInfo = true; |
| 6717 | } |
| 6718 | break; |
| 6719 | case "-e": |
| 6720 | case "--es": { |
| 6721 | String key = cmd.getNextArgRequired(); |
| 6722 | String value = cmd.getNextArgRequired(); |
| 6723 | intent.putExtra(key, value); |
| 6724 | } |
| 6725 | break; |
| 6726 | case "--esn": { |
| 6727 | String key = cmd.getNextArgRequired(); |
| 6728 | intent.putExtra(key, (String) null); |
| 6729 | } |
| 6730 | break; |
| 6731 | case "--ei": { |
| 6732 | String key = cmd.getNextArgRequired(); |
| 6733 | String value = cmd.getNextArgRequired(); |
| 6734 | intent.putExtra(key, Integer.decode(value)); |
| 6735 | } |
| 6736 | break; |
| 6737 | case "--eu": { |
| 6738 | String key = cmd.getNextArgRequired(); |
| 6739 | String value = cmd.getNextArgRequired(); |
| 6740 | intent.putExtra(key, Uri.parse(value)); |
| 6741 | } |
| 6742 | break; |
| 6743 | case "--ecn": { |
| 6744 | String key = cmd.getNextArgRequired(); |
| 6745 | String value = cmd.getNextArgRequired(); |
| 6746 | ComponentName cn = ComponentName.unflattenFromString(value); |
| 6747 | if (cn == null) |
| 6748 | throw new IllegalArgumentException("Bad component name: " + value); |
| 6749 | intent.putExtra(key, cn); |
| 6750 | } |
| 6751 | break; |
| 6752 | case "--eia": { |
| 6753 | String key = cmd.getNextArgRequired(); |
| 6754 | String value = cmd.getNextArgRequired(); |
| 6755 | String[] strings = value.split(","); |
| 6756 | int[] list = new int[strings.length]; |
| 6757 | for (int i = 0; i < strings.length; i++) { |
| 6758 | list[i] = Integer.decode(strings[i]); |
| 6759 | } |
| 6760 | intent.putExtra(key, list); |
| 6761 | } |
| 6762 | break; |
| 6763 | case "--eial": { |
| 6764 | String key = cmd.getNextArgRequired(); |
| 6765 | String value = cmd.getNextArgRequired(); |
| 6766 | String[] strings = value.split(","); |
| 6767 | ArrayList<Integer> list = new ArrayList<>(strings.length); |
| 6768 | for (int i = 0; i < strings.length; i++) { |
| 6769 | list.add(Integer.decode(strings[i])); |
| 6770 | } |
| 6771 | intent.putExtra(key, list); |
| 6772 | } |
| 6773 | break; |
| 6774 | case "--el": { |
| 6775 | String key = cmd.getNextArgRequired(); |
| 6776 | String value = cmd.getNextArgRequired(); |
| 6777 | intent.putExtra(key, Long.valueOf(value)); |
| 6778 | } |
| 6779 | break; |
| 6780 | case "--ela": { |
| 6781 | String key = cmd.getNextArgRequired(); |
| 6782 | String value = cmd.getNextArgRequired(); |
| 6783 | String[] strings = value.split(","); |
| 6784 | long[] list = new long[strings.length]; |
| 6785 | for (int i = 0; i < strings.length; i++) { |
| 6786 | list[i] = Long.valueOf(strings[i]); |
| 6787 | } |
| 6788 | intent.putExtra(key, list); |
| 6789 | hasIntentInfo = true; |
| 6790 | } |
| 6791 | break; |
| 6792 | case "--elal": { |
| 6793 | String key = cmd.getNextArgRequired(); |
| 6794 | String value = cmd.getNextArgRequired(); |
| 6795 | String[] strings = value.split(","); |
| 6796 | ArrayList<Long> list = new ArrayList<>(strings.length); |
| 6797 | for (int i = 0; i < strings.length; i++) { |
| 6798 | list.add(Long.valueOf(strings[i])); |
| 6799 | } |
| 6800 | intent.putExtra(key, list); |
| 6801 | hasIntentInfo = true; |
| 6802 | } |
| 6803 | break; |
| 6804 | case "--ef": { |
| 6805 | String key = cmd.getNextArgRequired(); |
| 6806 | String value = cmd.getNextArgRequired(); |
| 6807 | intent.putExtra(key, Float.valueOf(value)); |
| 6808 | hasIntentInfo = true; |
| 6809 | } |
| 6810 | break; |
| 6811 | case "--efa": { |
| 6812 | String key = cmd.getNextArgRequired(); |
| 6813 | String value = cmd.getNextArgRequired(); |
| 6814 | String[] strings = value.split(","); |
| 6815 | float[] list = new float[strings.length]; |
| 6816 | for (int i = 0; i < strings.length; i++) { |
| 6817 | list[i] = Float.valueOf(strings[i]); |
| 6818 | } |
| 6819 | intent.putExtra(key, list); |
| 6820 | hasIntentInfo = true; |
| 6821 | } |
| 6822 | break; |
| 6823 | case "--efal": { |
| 6824 | String key = cmd.getNextArgRequired(); |
| 6825 | String value = cmd.getNextArgRequired(); |
| 6826 | String[] strings = value.split(","); |
| 6827 | ArrayList<Float> list = new ArrayList<>(strings.length); |
| 6828 | for (int i = 0; i < strings.length; i++) { |
| 6829 | list.add(Float.valueOf(strings[i])); |
| 6830 | } |
| 6831 | intent.putExtra(key, list); |
| 6832 | hasIntentInfo = true; |
| 6833 | } |
| 6834 | break; |
| 6835 | case "--esa": { |
| 6836 | String key = cmd.getNextArgRequired(); |
| 6837 | String value = cmd.getNextArgRequired(); |
| 6838 | // Split on commas unless they are preceeded by an escape. |
| 6839 | // The escape character must be escaped for the string and |
| 6840 | // again for the regex, thus four escape characters become one. |
| 6841 | String[] strings = value.split("(?<!\\\\),"); |
| 6842 | intent.putExtra(key, strings); |
| 6843 | hasIntentInfo = true; |
| 6844 | } |
| 6845 | break; |
| 6846 | case "--esal": { |
| 6847 | String key = cmd.getNextArgRequired(); |
| 6848 | String value = cmd.getNextArgRequired(); |
| 6849 | // Split on commas unless they are preceeded by an escape. |
| 6850 | // The escape character must be escaped for the string and |
| 6851 | // again for the regex, thus four escape characters become one. |
| 6852 | String[] strings = value.split("(?<!\\\\),"); |
| 6853 | ArrayList<String> list = new ArrayList<>(strings.length); |
| 6854 | for (int i = 0; i < strings.length; i++) { |
| 6855 | list.add(strings[i]); |
| 6856 | } |
| 6857 | intent.putExtra(key, list); |
| 6858 | hasIntentInfo = true; |
| 6859 | } |
| 6860 | break; |
| 6861 | case "--ez": { |
| 6862 | String key = cmd.getNextArgRequired(); |
| 6863 | String value = cmd.getNextArgRequired().toLowerCase(); |
| 6864 | // Boolean.valueOf() results in false for anything that is not "true", which is |
| 6865 | // error-prone in shell commands |
| 6866 | boolean arg; |
| 6867 | if ("true".equals(value) || "t".equals(value)) { |
| 6868 | arg = true; |
| 6869 | } else if ("false".equals(value) || "f".equals(value)) { |
| 6870 | arg = false; |
| 6871 | } else { |
| 6872 | try { |
| 6873 | arg = Integer.decode(value) != 0; |
| 6874 | } catch (NumberFormatException ex) { |
| 6875 | throw new IllegalArgumentException("Invalid boolean value: " + value); |
| 6876 | } |
| 6877 | } |
| 6878 | |
| 6879 | intent.putExtra(key, arg); |
| 6880 | } |
| 6881 | break; |
| 6882 | case "-n": { |
| 6883 | String str = cmd.getNextArgRequired(); |
| 6884 | ComponentName cn = ComponentName.unflattenFromString(str); |
| 6885 | if (cn == null) |
| 6886 | throw new IllegalArgumentException("Bad component name: " + str); |
| 6887 | intent.setComponent(cn); |
| 6888 | if (intent == baseIntent) { |
| 6889 | hasIntentInfo = true; |
| 6890 | } |
| 6891 | } |
| 6892 | break; |
| 6893 | case "-p": { |
| 6894 | String str = cmd.getNextArgRequired(); |
| 6895 | intent.setPackage(str); |
| 6896 | if (intent == baseIntent) { |
| 6897 | hasIntentInfo = true; |
| 6898 | } |
| 6899 | } |
| 6900 | break; |
| 6901 | case "-f": |
| 6902 | String str = cmd.getNextArgRequired(); |
| 6903 | intent.setFlags(Integer.decode(str).intValue()); |
| 6904 | break; |
| 6905 | case "--grant-read-uri-permission": |
| 6906 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 6907 | break; |
| 6908 | case "--grant-write-uri-permission": |
| 6909 | intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); |
| 6910 | break; |
| 6911 | case "--grant-persistable-uri-permission": |
| 6912 | intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); |
| 6913 | break; |
| 6914 | case "--grant-prefix-uri-permission": |
| 6915 | intent.addFlags(Intent.FLAG_GRANT_PREFIX_URI_PERMISSION); |
| 6916 | break; |
| 6917 | case "--exclude-stopped-packages": |
| 6918 | intent.addFlags(Intent.FLAG_EXCLUDE_STOPPED_PACKAGES); |
| 6919 | break; |
| 6920 | case "--include-stopped-packages": |
| 6921 | intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); |
| 6922 | break; |
| 6923 | case "--debug-log-resolution": |
| 6924 | intent.addFlags(Intent.FLAG_DEBUG_LOG_RESOLUTION); |
| 6925 | break; |
| 6926 | case "--activity-brought-to-front": |
| 6927 | intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); |
| 6928 | break; |
| 6929 | case "--activity-clear-top": |
| 6930 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); |
| 6931 | break; |
| 6932 | case "--activity-clear-when-task-reset": |
| 6933 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); |
| 6934 | break; |
| 6935 | case "--activity-exclude-from-recents": |
| 6936 | intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); |
| 6937 | break; |
| 6938 | case "--activity-launched-from-history": |
| 6939 | intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY); |
| 6940 | break; |
| 6941 | case "--activity-multiple-task": |
| 6942 | intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); |
| 6943 | break; |
| 6944 | case "--activity-no-animation": |
| 6945 | intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); |
| 6946 | break; |
| 6947 | case "--activity-no-history": |
| 6948 | intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); |
| 6949 | break; |
| 6950 | case "--activity-no-user-action": |
| 6951 | intent.addFlags(Intent.FLAG_ACTIVITY_NO_USER_ACTION); |
| 6952 | break; |
| 6953 | case "--activity-previous-is-top": |
| 6954 | intent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP); |
| 6955 | break; |
| 6956 | case "--activity-reorder-to-front": |
| 6957 | intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); |
| 6958 | break; |
| 6959 | case "--activity-reset-task-if-needed": |
| 6960 | intent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); |
| 6961 | break; |
| 6962 | case "--activity-single-top": |
| 6963 | intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); |
| 6964 | break; |
| 6965 | case "--activity-clear-task": |
| 6966 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); |
| 6967 | break; |
| 6968 | case "--activity-task-on-home": |
| 6969 | intent.addFlags(Intent.FLAG_ACTIVITY_TASK_ON_HOME); |
| 6970 | break; |
Patrick Baumann | 229141f | 2018-04-06 13:53:25 -0700 | [diff] [blame] | 6971 | case "--activity-match-external": |
| 6972 | intent.addFlags(Intent.FLAG_ACTIVITY_MATCH_EXTERNAL); |
| 6973 | break; |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 6974 | case "--receiver-registered-only": |
| 6975 | intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); |
| 6976 | break; |
| 6977 | case "--receiver-replace-pending": |
| 6978 | intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); |
| 6979 | break; |
Felipe Leme | 3cb48cd | 2016-01-27 08:39:09 -0800 | [diff] [blame] | 6980 | case "--receiver-foreground": |
| 6981 | intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); |
| 6982 | break; |
Dianne Hackborn | 797772b1 | 2017-02-08 16:33:43 -0800 | [diff] [blame] | 6983 | case "--receiver-no-abort": |
| 6984 | intent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT); |
| 6985 | break; |
| 6986 | case "--receiver-include-background": |
| 6987 | intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND); |
| 6988 | break; |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 6989 | case "--selector": |
| 6990 | intent.setDataAndType(data, type); |
| 6991 | intent = new Intent(); |
| 6992 | break; |
| 6993 | default: |
| 6994 | if (optionHandler != null && optionHandler.handleOption(opt, cmd)) { |
| 6995 | // Okay, caller handled this option. |
| 6996 | } else { |
| 6997 | throw new IllegalArgumentException("Unknown option: " + opt); |
| 6998 | } |
| 6999 | break; |
| 7000 | } |
| 7001 | } |
| 7002 | intent.setDataAndType(data, type); |
| 7003 | |
| 7004 | final boolean hasSelector = intent != baseIntent; |
| 7005 | if (hasSelector) { |
| 7006 | // A selector was specified; fix up. |
| 7007 | baseIntent.setSelector(intent); |
| 7008 | intent = baseIntent; |
| 7009 | } |
| 7010 | |
| 7011 | String arg = cmd.getNextArg(); |
| 7012 | baseIntent = null; |
| 7013 | if (arg == null) { |
| 7014 | if (hasSelector) { |
| 7015 | // If a selector has been specified, and no arguments |
| 7016 | // have been supplied for the main Intent, then we can |
| 7017 | // assume it is ACTION_MAIN CATEGORY_LAUNCHER; we don't |
| 7018 | // need to have a component name specified yet, the |
| 7019 | // selector will take care of that. |
| 7020 | baseIntent = new Intent(Intent.ACTION_MAIN); |
| 7021 | baseIntent.addCategory(Intent.CATEGORY_LAUNCHER); |
| 7022 | } |
| 7023 | } else if (arg.indexOf(':') >= 0) { |
| 7024 | // The argument is a URI. Fully parse it, and use that result |
| 7025 | // to fill in any data not specified so far. |
| 7026 | baseIntent = Intent.parseUri(arg, Intent.URI_INTENT_SCHEME |
| 7027 | | Intent.URI_ANDROID_APP_SCHEME | Intent.URI_ALLOW_UNSAFE); |
| 7028 | } else if (arg.indexOf('/') >= 0) { |
| 7029 | // The argument is a component name. Build an Intent to launch |
| 7030 | // it. |
| 7031 | baseIntent = new Intent(Intent.ACTION_MAIN); |
| 7032 | baseIntent.addCategory(Intent.CATEGORY_LAUNCHER); |
| 7033 | baseIntent.setComponent(ComponentName.unflattenFromString(arg)); |
| 7034 | } else { |
| 7035 | // Assume the argument is a package name. |
| 7036 | baseIntent = new Intent(Intent.ACTION_MAIN); |
| 7037 | baseIntent.addCategory(Intent.CATEGORY_LAUNCHER); |
| 7038 | baseIntent.setPackage(arg); |
| 7039 | } |
| 7040 | if (baseIntent != null) { |
| 7041 | Bundle extras = intent.getExtras(); |
| 7042 | intent.replaceExtras((Bundle)null); |
| 7043 | Bundle uriExtras = baseIntent.getExtras(); |
| 7044 | baseIntent.replaceExtras((Bundle)null); |
| 7045 | if (intent.getAction() != null && baseIntent.getCategories() != null) { |
| 7046 | HashSet<String> cats = new HashSet<String>(baseIntent.getCategories()); |
| 7047 | for (String c : cats) { |
| 7048 | baseIntent.removeCategory(c); |
| 7049 | } |
| 7050 | } |
| 7051 | intent.fillIn(baseIntent, Intent.FILL_IN_COMPONENT | Intent.FILL_IN_SELECTOR); |
| 7052 | if (extras == null) { |
| 7053 | extras = uriExtras; |
| 7054 | } else if (uriExtras != null) { |
| 7055 | uriExtras.putAll(extras); |
| 7056 | extras = uriExtras; |
| 7057 | } |
| 7058 | intent.replaceExtras(extras); |
| 7059 | hasIntentInfo = true; |
| 7060 | } |
| 7061 | |
| 7062 | if (!hasIntentInfo) throw new IllegalArgumentException("No intent supplied"); |
| 7063 | return intent; |
| 7064 | } |
| 7065 | |
| 7066 | /** @hide */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 7067 | @UnsupportedAppUsage |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 7068 | public static void printIntentArgsHelp(PrintWriter pw, String prefix) { |
| 7069 | final String[] lines = new String[] { |
| 7070 | "<INTENT> specifications include these flags and arguments:", |
| 7071 | " [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]", |
| 7072 | " [-c <CATEGORY> [-c <CATEGORY>] ...]", |
Felipe Leme | 4e02e25 | 2018-04-20 11:25:59 -0700 | [diff] [blame] | 7073 | " [-n <COMPONENT_NAME>]", |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 7074 | " [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]", |
| 7075 | " [--esn <EXTRA_KEY> ...]", |
| 7076 | " [--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]", |
| 7077 | " [--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]", |
| 7078 | " [--el <EXTRA_KEY> <EXTRA_LONG_VALUE> ...]", |
| 7079 | " [--ef <EXTRA_KEY> <EXTRA_FLOAT_VALUE> ...]", |
| 7080 | " [--eu <EXTRA_KEY> <EXTRA_URI_VALUE> ...]", |
| 7081 | " [--ecn <EXTRA_KEY> <EXTRA_COMPONENT_NAME_VALUE>]", |
| 7082 | " [--eia <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]", |
| 7083 | " (mutiple extras passed as Integer[])", |
| 7084 | " [--eial <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]", |
| 7085 | " (mutiple extras passed as List<Integer>)", |
| 7086 | " [--ela <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]", |
| 7087 | " (mutiple extras passed as Long[])", |
| 7088 | " [--elal <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]", |
| 7089 | " (mutiple extras passed as List<Long>)", |
| 7090 | " [--efa <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]", |
| 7091 | " (mutiple extras passed as Float[])", |
| 7092 | " [--efal <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]", |
| 7093 | " (mutiple extras passed as List<Float>)", |
| 7094 | " [--esa <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]", |
| 7095 | " (mutiple extras passed as String[]; to embed a comma into a string,", |
| 7096 | " escape it using \"\\,\")", |
| 7097 | " [--esal <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]", |
| 7098 | " (mutiple extras passed as List<String>; to embed a comma into a string,", |
| 7099 | " escape it using \"\\,\")", |
Felipe Leme | 545569d | 2016-01-11 16:27:58 -0800 | [diff] [blame] | 7100 | " [-f <FLAG>]", |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 7101 | " [--grant-read-uri-permission] [--grant-write-uri-permission]", |
| 7102 | " [--grant-persistable-uri-permission] [--grant-prefix-uri-permission]", |
| 7103 | " [--debug-log-resolution] [--exclude-stopped-packages]", |
| 7104 | " [--include-stopped-packages]", |
| 7105 | " [--activity-brought-to-front] [--activity-clear-top]", |
| 7106 | " [--activity-clear-when-task-reset] [--activity-exclude-from-recents]", |
| 7107 | " [--activity-launched-from-history] [--activity-multiple-task]", |
| 7108 | " [--activity-no-animation] [--activity-no-history]", |
| 7109 | " [--activity-no-user-action] [--activity-previous-is-top]", |
| 7110 | " [--activity-reorder-to-front] [--activity-reset-task-if-needed]", |
| 7111 | " [--activity-single-top] [--activity-clear-task]", |
Patrick Baumann | 229141f | 2018-04-06 13:53:25 -0700 | [diff] [blame] | 7112 | " [--activity-task-on-home] [--activity-match-external]", |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 7113 | " [--receiver-registered-only] [--receiver-replace-pending]", |
Dianne Hackborn | 797772b1 | 2017-02-08 16:33:43 -0800 | [diff] [blame] | 7114 | " [--receiver-foreground] [--receiver-no-abort]", |
| 7115 | " [--receiver-include-background]", |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 7116 | " [--selector]", |
| 7117 | " [<URI> | <PACKAGE> | <COMPONENT>]" |
| 7118 | }; |
| 7119 | for (String line : lines) { |
| 7120 | pw.print(prefix); |
| 7121 | pw.println(line); |
| 7122 | } |
| 7123 | } |
| 7124 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7125 | /** |
| 7126 | * Retrieve the general action to be performed, such as |
| 7127 | * {@link #ACTION_VIEW}. The action describes the general way the rest of |
| 7128 | * the information in the intent should be interpreted -- most importantly, |
| 7129 | * what to do with the data returned by {@link #getData}. |
| 7130 | * |
| 7131 | * @return The action of this intent or null if none is specified. |
| 7132 | * |
| 7133 | * @see #setAction |
| 7134 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7135 | public @Nullable String getAction() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7136 | return mAction; |
| 7137 | } |
| 7138 | |
| 7139 | /** |
| 7140 | * Retrieve data this intent is operating on. This URI specifies the name |
| 7141 | * of the data; often it uses the content: scheme, specifying data in a |
| 7142 | * content provider. Other schemes may be handled by specific activities, |
| 7143 | * such as http: by the web browser. |
| 7144 | * |
| 7145 | * @return The URI of the data this intent is targeting or null. |
| 7146 | * |
| 7147 | * @see #getScheme |
| 7148 | * @see #setData |
| 7149 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7150 | public @Nullable Uri getData() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7151 | return mData; |
| 7152 | } |
| 7153 | |
| 7154 | /** |
| 7155 | * The same as {@link #getData()}, but returns the URI as an encoded |
| 7156 | * String. |
| 7157 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7158 | public @Nullable String getDataString() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7159 | return mData != null ? mData.toString() : null; |
| 7160 | } |
| 7161 | |
| 7162 | /** |
| 7163 | * Return the scheme portion of the intent's data. If the data is null or |
| 7164 | * does not include a scheme, null is returned. Otherwise, the scheme |
| 7165 | * prefix without the final ':' is returned, i.e. "http". |
| 7166 | * |
| 7167 | * <p>This is the same as calling getData().getScheme() (and checking for |
| 7168 | * null data). |
| 7169 | * |
| 7170 | * @return The scheme of this intent. |
| 7171 | * |
| 7172 | * @see #getData |
| 7173 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7174 | public @Nullable String getScheme() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7175 | return mData != null ? mData.getScheme() : null; |
| 7176 | } |
| 7177 | |
| 7178 | /** |
| 7179 | * Retrieve any explicit MIME type included in the intent. This is usually |
| 7180 | * null, as the type is determined by the intent data. |
| 7181 | * |
| 7182 | * @return If a type was manually set, it is returned; else null is |
| 7183 | * returned. |
| 7184 | * |
| 7185 | * @see #resolveType(ContentResolver) |
| 7186 | * @see #setType |
| 7187 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7188 | public @Nullable String getType() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7189 | return mType; |
| 7190 | } |
| 7191 | |
| 7192 | /** |
| 7193 | * Return the MIME data type of this intent. If the type field is |
| 7194 | * explicitly set, that is simply returned. Otherwise, if the data is set, |
| 7195 | * the type of that data is returned. If neither fields are set, a null is |
| 7196 | * returned. |
| 7197 | * |
| 7198 | * @return The MIME type of this intent. |
| 7199 | * |
| 7200 | * @see #getType |
| 7201 | * @see #resolveType(ContentResolver) |
| 7202 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7203 | public @Nullable String resolveType(@NonNull Context context) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7204 | return resolveType(context.getContentResolver()); |
| 7205 | } |
| 7206 | |
| 7207 | /** |
| 7208 | * Return the MIME data type of this intent. If the type field is |
| 7209 | * explicitly set, that is simply returned. Otherwise, if the data is set, |
| 7210 | * the type of that data is returned. If neither fields are set, a null is |
| 7211 | * returned. |
| 7212 | * |
| 7213 | * @param resolver A ContentResolver that can be used to determine the MIME |
| 7214 | * type of the intent's data. |
| 7215 | * |
| 7216 | * @return The MIME type of this intent. |
| 7217 | * |
| 7218 | * @see #getType |
| 7219 | * @see #resolveType(Context) |
| 7220 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7221 | public @Nullable String resolveType(@NonNull ContentResolver resolver) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7222 | if (mType != null) { |
| 7223 | return mType; |
| 7224 | } |
| 7225 | if (mData != null) { |
| 7226 | if ("content".equals(mData.getScheme())) { |
| 7227 | return resolver.getType(mData); |
| 7228 | } |
| 7229 | } |
| 7230 | return null; |
| 7231 | } |
| 7232 | |
| 7233 | /** |
| 7234 | * Return the MIME data type of this intent, only if it will be needed for |
| 7235 | * intent resolution. This is not generally useful for application code; |
| 7236 | * it is used by the frameworks for communicating with back-end system |
| 7237 | * services. |
| 7238 | * |
| 7239 | * @param resolver A ContentResolver that can be used to determine the MIME |
| 7240 | * type of the intent's data. |
| 7241 | * |
| 7242 | * @return The MIME type of this intent, or null if it is unknown or not |
| 7243 | * needed. |
| 7244 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7245 | public @Nullable String resolveTypeIfNeeded(@NonNull ContentResolver resolver) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7246 | if (mComponent != null) { |
| 7247 | return mType; |
| 7248 | } |
| 7249 | return resolveType(resolver); |
| 7250 | } |
| 7251 | |
| 7252 | /** |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 7253 | * Check if a category exists in the intent. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7254 | * |
| 7255 | * @param category The category to check. |
| 7256 | * |
| 7257 | * @return boolean True if the intent contains the category, else false. |
| 7258 | * |
| 7259 | * @see #getCategories |
| 7260 | * @see #addCategory |
| 7261 | */ |
| 7262 | public boolean hasCategory(String category) { |
| 7263 | return mCategories != null && mCategories.contains(category); |
| 7264 | } |
| 7265 | |
| 7266 | /** |
| 7267 | * Return the set of all categories in the intent. If there are no categories, |
| 7268 | * returns NULL. |
| 7269 | * |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 7270 | * @return The set of categories you can examine. Do not modify! |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7271 | * |
| 7272 | * @see #hasCategory |
| 7273 | * @see #addCategory |
| 7274 | */ |
| 7275 | public Set<String> getCategories() { |
| 7276 | return mCategories; |
| 7277 | } |
| 7278 | |
| 7279 | /** |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 7280 | * Return the specific selector associated with this Intent. If there is |
| 7281 | * none, returns null. See {@link #setSelector} for more information. |
| 7282 | * |
| 7283 | * @see #setSelector |
| 7284 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7285 | public @Nullable Intent getSelector() { |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 7286 | return mSelector; |
| 7287 | } |
| 7288 | |
| 7289 | /** |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 7290 | * Return the {@link ClipData} associated with this Intent. If there is |
| 7291 | * none, returns null. See {@link #setClipData} for more information. |
| 7292 | * |
John Spurlock | 125d133 | 2013-11-25 11:58:37 -0500 | [diff] [blame] | 7293 | * @see #setClipData |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 7294 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7295 | public @Nullable ClipData getClipData() { |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 7296 | return mClipData; |
| 7297 | } |
| 7298 | |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 7299 | /** @hide */ |
| 7300 | public int getContentUserHint() { |
| 7301 | return mContentUserHint; |
| 7302 | } |
| 7303 | |
Todd Kennedy | b3b43130 | 2017-03-20 16:05:48 -0700 | [diff] [blame] | 7304 | /** @hide */ |
| 7305 | public String getLaunchToken() { |
| 7306 | return mLaunchToken; |
| 7307 | } |
| 7308 | |
| 7309 | /** @hide */ |
| 7310 | public void setLaunchToken(String launchToken) { |
| 7311 | mLaunchToken = launchToken; |
| 7312 | } |
| 7313 | |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 7314 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7315 | * Sets the ClassLoader that will be used when unmarshalling |
| 7316 | * any Parcelable values from the extras of this Intent. |
| 7317 | * |
| 7318 | * @param loader a ClassLoader, or null to use the default loader |
| 7319 | * at the time of unmarshalling. |
| 7320 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7321 | public void setExtrasClassLoader(@Nullable ClassLoader loader) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7322 | if (mExtras != null) { |
| 7323 | mExtras.setClassLoader(loader); |
| 7324 | } |
| 7325 | } |
| 7326 | |
| 7327 | /** |
| 7328 | * Returns true if an extra value is associated with the given name. |
| 7329 | * @param name the extra's name |
| 7330 | * @return true if the given extra is present. |
| 7331 | */ |
| 7332 | public boolean hasExtra(String name) { |
| 7333 | return mExtras != null && mExtras.containsKey(name); |
| 7334 | } |
| 7335 | |
| 7336 | /** |
| 7337 | * Returns true if the Intent's extras contain a parcelled file descriptor. |
| 7338 | * @return true if the Intent contains a parcelled file descriptor. |
| 7339 | */ |
| 7340 | public boolean hasFileDescriptors() { |
| 7341 | return mExtras != null && mExtras.hasFileDescriptors(); |
| 7342 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 7343 | |
Jeff Sharkey | d136e51 | 2016-03-09 22:30:56 -0700 | [diff] [blame] | 7344 | /** {@hide} */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 7345 | @UnsupportedAppUsage |
Dianne Hackborn | 9ecebbf | 2011-09-28 23:19:47 -0400 | [diff] [blame] | 7346 | public void setAllowFds(boolean allowFds) { |
| 7347 | if (mExtras != null) { |
| 7348 | mExtras.setAllowFds(allowFds); |
| 7349 | } |
| 7350 | } |
| 7351 | |
Jeff Sharkey | d136e51 | 2016-03-09 22:30:56 -0700 | [diff] [blame] | 7352 | /** {@hide} */ |
| 7353 | public void setDefusable(boolean defusable) { |
| 7354 | if (mExtras != null) { |
| 7355 | mExtras.setDefusable(defusable); |
| 7356 | } |
| 7357 | } |
| 7358 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7359 | /** |
| 7360 | * Retrieve extended data from the intent. |
| 7361 | * |
| 7362 | * @param name The name of the desired item. |
| 7363 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7364 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7365 | * or null if none was found. |
| 7366 | * |
| 7367 | * @deprecated |
| 7368 | * @hide |
| 7369 | */ |
| 7370 | @Deprecated |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 7371 | @UnsupportedAppUsage |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7372 | public Object getExtra(String name) { |
| 7373 | return getExtra(name, null); |
| 7374 | } |
| 7375 | |
| 7376 | /** |
| 7377 | * Retrieve extended data from the intent. |
| 7378 | * |
| 7379 | * @param name The name of the desired item. |
| 7380 | * @param defaultValue the value to be returned if no value of the desired |
| 7381 | * type is stored with the given name. |
| 7382 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7383 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7384 | * or the default value if none was found. |
| 7385 | * |
| 7386 | * @see #putExtra(String, boolean) |
| 7387 | */ |
| 7388 | public boolean getBooleanExtra(String name, boolean defaultValue) { |
| 7389 | return mExtras == null ? defaultValue : |
| 7390 | mExtras.getBoolean(name, defaultValue); |
| 7391 | } |
| 7392 | |
| 7393 | /** |
| 7394 | * Retrieve extended data from the intent. |
| 7395 | * |
| 7396 | * @param name The name of the desired item. |
| 7397 | * @param defaultValue the value to be returned if no value of the desired |
| 7398 | * type is stored with the given name. |
| 7399 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7400 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7401 | * or the default value if none was found. |
| 7402 | * |
| 7403 | * @see #putExtra(String, byte) |
| 7404 | */ |
| 7405 | public byte getByteExtra(String name, byte defaultValue) { |
| 7406 | return mExtras == null ? defaultValue : |
| 7407 | mExtras.getByte(name, defaultValue); |
| 7408 | } |
| 7409 | |
| 7410 | /** |
| 7411 | * Retrieve extended data from the intent. |
| 7412 | * |
| 7413 | * @param name The name of the desired item. |
| 7414 | * @param defaultValue the value to be returned if no value of the desired |
| 7415 | * type is stored with the given name. |
| 7416 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7417 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7418 | * or the default value if none was found. |
| 7419 | * |
| 7420 | * @see #putExtra(String, short) |
| 7421 | */ |
| 7422 | public short getShortExtra(String name, short defaultValue) { |
| 7423 | return mExtras == null ? defaultValue : |
| 7424 | mExtras.getShort(name, defaultValue); |
| 7425 | } |
| 7426 | |
| 7427 | /** |
| 7428 | * Retrieve extended data from the intent. |
| 7429 | * |
| 7430 | * @param name The name of the desired item. |
| 7431 | * @param defaultValue the value to be returned if no value of the desired |
| 7432 | * type is stored with the given name. |
| 7433 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7434 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7435 | * or the default value if none was found. |
| 7436 | * |
| 7437 | * @see #putExtra(String, char) |
| 7438 | */ |
| 7439 | public char getCharExtra(String name, char defaultValue) { |
| 7440 | return mExtras == null ? defaultValue : |
| 7441 | mExtras.getChar(name, defaultValue); |
| 7442 | } |
| 7443 | |
| 7444 | /** |
| 7445 | * Retrieve extended data from the intent. |
| 7446 | * |
| 7447 | * @param name The name of the desired item. |
| 7448 | * @param defaultValue the value to be returned if no value of the desired |
| 7449 | * type is stored with the given name. |
| 7450 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7451 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7452 | * or the default value if none was found. |
| 7453 | * |
| 7454 | * @see #putExtra(String, int) |
| 7455 | */ |
| 7456 | public int getIntExtra(String name, int defaultValue) { |
| 7457 | return mExtras == null ? defaultValue : |
| 7458 | mExtras.getInt(name, defaultValue); |
| 7459 | } |
| 7460 | |
| 7461 | /** |
| 7462 | * Retrieve extended data from the intent. |
| 7463 | * |
| 7464 | * @param name The name of the desired item. |
| 7465 | * @param defaultValue the value to be returned if no value of the desired |
| 7466 | * type is stored with the given name. |
| 7467 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7468 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7469 | * or the default value if none was found. |
| 7470 | * |
| 7471 | * @see #putExtra(String, long) |
| 7472 | */ |
| 7473 | public long getLongExtra(String name, long defaultValue) { |
| 7474 | return mExtras == null ? defaultValue : |
| 7475 | mExtras.getLong(name, defaultValue); |
| 7476 | } |
| 7477 | |
| 7478 | /** |
| 7479 | * Retrieve extended data from the intent. |
| 7480 | * |
| 7481 | * @param name The name of the desired item. |
| 7482 | * @param defaultValue the value to be returned if no value of the desired |
| 7483 | * type is stored with the given name. |
| 7484 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7485 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7486 | * or the default value if no such item is present |
| 7487 | * |
| 7488 | * @see #putExtra(String, float) |
| 7489 | */ |
| 7490 | public float getFloatExtra(String name, float defaultValue) { |
| 7491 | return mExtras == null ? defaultValue : |
| 7492 | mExtras.getFloat(name, defaultValue); |
| 7493 | } |
| 7494 | |
| 7495 | /** |
| 7496 | * Retrieve extended data from the intent. |
| 7497 | * |
| 7498 | * @param name The name of the desired item. |
| 7499 | * @param defaultValue the value to be returned if no value of the desired |
| 7500 | * type is stored with the given name. |
| 7501 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7502 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7503 | * or the default value if none was found. |
| 7504 | * |
| 7505 | * @see #putExtra(String, double) |
| 7506 | */ |
| 7507 | public double getDoubleExtra(String name, double defaultValue) { |
| 7508 | return mExtras == null ? defaultValue : |
| 7509 | mExtras.getDouble(name, defaultValue); |
| 7510 | } |
| 7511 | |
| 7512 | /** |
| 7513 | * Retrieve extended data from the intent. |
| 7514 | * |
| 7515 | * @param name The name of the desired item. |
| 7516 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7517 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7518 | * or null if no String value was found. |
| 7519 | * |
| 7520 | * @see #putExtra(String, String) |
| 7521 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7522 | public @Nullable String getStringExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7523 | return mExtras == null ? null : mExtras.getString(name); |
| 7524 | } |
| 7525 | |
| 7526 | /** |
| 7527 | * Retrieve extended data from the intent. |
| 7528 | * |
| 7529 | * @param name The name of the desired item. |
| 7530 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7531 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7532 | * or null if no CharSequence value was found. |
| 7533 | * |
| 7534 | * @see #putExtra(String, CharSequence) |
| 7535 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7536 | public @Nullable CharSequence getCharSequenceExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7537 | return mExtras == null ? null : mExtras.getCharSequence(name); |
| 7538 | } |
| 7539 | |
| 7540 | /** |
| 7541 | * Retrieve extended data from the intent. |
| 7542 | * |
| 7543 | * @param name The name of the desired item. |
| 7544 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7545 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7546 | * or null if no Parcelable value was found. |
| 7547 | * |
| 7548 | * @see #putExtra(String, Parcelable) |
| 7549 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7550 | public @Nullable <T extends Parcelable> T getParcelableExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7551 | return mExtras == null ? null : mExtras.<T>getParcelable(name); |
| 7552 | } |
| 7553 | |
| 7554 | /** |
| 7555 | * Retrieve extended data from the intent. |
| 7556 | * |
| 7557 | * @param name The name of the desired item. |
| 7558 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7559 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7560 | * or null if no Parcelable[] value was found. |
| 7561 | * |
| 7562 | * @see #putExtra(String, Parcelable[]) |
| 7563 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7564 | public @Nullable Parcelable[] getParcelableArrayExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7565 | return mExtras == null ? null : mExtras.getParcelableArray(name); |
| 7566 | } |
| 7567 | |
| 7568 | /** |
| 7569 | * Retrieve extended data from the intent. |
| 7570 | * |
| 7571 | * @param name The name of the desired item. |
| 7572 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7573 | * @return the value of an item previously added with |
| 7574 | * putParcelableArrayListExtra(), or null if no |
| 7575 | * ArrayList<Parcelable> value was found. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7576 | * |
| 7577 | * @see #putParcelableArrayListExtra(String, ArrayList) |
| 7578 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7579 | public @Nullable <T extends Parcelable> ArrayList<T> getParcelableArrayListExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7580 | return mExtras == null ? null : mExtras.<T>getParcelableArrayList(name); |
| 7581 | } |
| 7582 | |
| 7583 | /** |
| 7584 | * Retrieve extended data from the intent. |
| 7585 | * |
| 7586 | * @param name The name of the desired item. |
| 7587 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7588 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7589 | * or null if no Serializable value was found. |
| 7590 | * |
| 7591 | * @see #putExtra(String, Serializable) |
| 7592 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7593 | public @Nullable Serializable getSerializableExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7594 | return mExtras == null ? null : mExtras.getSerializable(name); |
| 7595 | } |
| 7596 | |
| 7597 | /** |
| 7598 | * Retrieve extended data from the intent. |
| 7599 | * |
| 7600 | * @param name The name of the desired item. |
| 7601 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7602 | * @return the value of an item previously added with |
| 7603 | * putIntegerArrayListExtra(), or null if no |
| 7604 | * ArrayList<Integer> value was found. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7605 | * |
| 7606 | * @see #putIntegerArrayListExtra(String, ArrayList) |
| 7607 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7608 | public @Nullable ArrayList<Integer> getIntegerArrayListExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7609 | return mExtras == null ? null : mExtras.getIntegerArrayList(name); |
| 7610 | } |
| 7611 | |
| 7612 | /** |
| 7613 | * Retrieve extended data from the intent. |
| 7614 | * |
| 7615 | * @param name The name of the desired item. |
| 7616 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7617 | * @return the value of an item previously added with |
| 7618 | * putStringArrayListExtra(), or null if no |
| 7619 | * ArrayList<String> value was found. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7620 | * |
| 7621 | * @see #putStringArrayListExtra(String, ArrayList) |
| 7622 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7623 | public @Nullable ArrayList<String> getStringArrayListExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7624 | return mExtras == null ? null : mExtras.getStringArrayList(name); |
| 7625 | } |
| 7626 | |
| 7627 | /** |
| 7628 | * Retrieve extended data from the intent. |
| 7629 | * |
| 7630 | * @param name The name of the desired item. |
| 7631 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7632 | * @return the value of an item previously added with |
| 7633 | * putCharSequenceArrayListExtra, or null if no |
| 7634 | * ArrayList<CharSequence> value was found. |
Bjorn Bringert | 08bbffb | 2010-02-25 11:16:22 +0000 | [diff] [blame] | 7635 | * |
| 7636 | * @see #putCharSequenceArrayListExtra(String, ArrayList) |
| 7637 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7638 | public @Nullable ArrayList<CharSequence> getCharSequenceArrayListExtra(String name) { |
Bjorn Bringert | 08bbffb | 2010-02-25 11:16:22 +0000 | [diff] [blame] | 7639 | return mExtras == null ? null : mExtras.getCharSequenceArrayList(name); |
| 7640 | } |
| 7641 | |
| 7642 | /** |
| 7643 | * Retrieve extended data from the intent. |
| 7644 | * |
| 7645 | * @param name The name of the desired item. |
| 7646 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7647 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7648 | * or null if no boolean array value was found. |
| 7649 | * |
| 7650 | * @see #putExtra(String, boolean[]) |
| 7651 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7652 | public @Nullable boolean[] getBooleanArrayExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7653 | return mExtras == null ? null : mExtras.getBooleanArray(name); |
| 7654 | } |
| 7655 | |
| 7656 | /** |
| 7657 | * Retrieve extended data from the intent. |
| 7658 | * |
| 7659 | * @param name The name of the desired item. |
| 7660 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7661 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7662 | * or null if no byte array value was found. |
| 7663 | * |
| 7664 | * @see #putExtra(String, byte[]) |
| 7665 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7666 | public @Nullable byte[] getByteArrayExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7667 | return mExtras == null ? null : mExtras.getByteArray(name); |
| 7668 | } |
| 7669 | |
| 7670 | /** |
| 7671 | * Retrieve extended data from the intent. |
| 7672 | * |
| 7673 | * @param name The name of the desired item. |
| 7674 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7675 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7676 | * or null if no short array value was found. |
| 7677 | * |
| 7678 | * @see #putExtra(String, short[]) |
| 7679 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7680 | public @Nullable short[] getShortArrayExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7681 | return mExtras == null ? null : mExtras.getShortArray(name); |
| 7682 | } |
| 7683 | |
| 7684 | /** |
| 7685 | * Retrieve extended data from the intent. |
| 7686 | * |
| 7687 | * @param name The name of the desired item. |
| 7688 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7689 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7690 | * or null if no char array value was found. |
| 7691 | * |
| 7692 | * @see #putExtra(String, char[]) |
| 7693 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7694 | public @Nullable char[] getCharArrayExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7695 | return mExtras == null ? null : mExtras.getCharArray(name); |
| 7696 | } |
| 7697 | |
| 7698 | /** |
| 7699 | * Retrieve extended data from the intent. |
| 7700 | * |
| 7701 | * @param name The name of the desired item. |
| 7702 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7703 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7704 | * or null if no int array value was found. |
| 7705 | * |
| 7706 | * @see #putExtra(String, int[]) |
| 7707 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7708 | public @Nullable int[] getIntArrayExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7709 | return mExtras == null ? null : mExtras.getIntArray(name); |
| 7710 | } |
| 7711 | |
| 7712 | /** |
| 7713 | * Retrieve extended data from the intent. |
| 7714 | * |
| 7715 | * @param name The name of the desired item. |
| 7716 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7717 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7718 | * or null if no long array value was found. |
| 7719 | * |
| 7720 | * @see #putExtra(String, long[]) |
| 7721 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7722 | public @Nullable long[] getLongArrayExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7723 | return mExtras == null ? null : mExtras.getLongArray(name); |
| 7724 | } |
| 7725 | |
| 7726 | /** |
| 7727 | * Retrieve extended data from the intent. |
| 7728 | * |
| 7729 | * @param name The name of the desired item. |
| 7730 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7731 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7732 | * or null if no float array value was found. |
| 7733 | * |
| 7734 | * @see #putExtra(String, float[]) |
| 7735 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7736 | public @Nullable float[] getFloatArrayExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7737 | return mExtras == null ? null : mExtras.getFloatArray(name); |
| 7738 | } |
| 7739 | |
| 7740 | /** |
| 7741 | * Retrieve extended data from the intent. |
| 7742 | * |
| 7743 | * @param name The name of the desired item. |
| 7744 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7745 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7746 | * or null if no double array value was found. |
| 7747 | * |
| 7748 | * @see #putExtra(String, double[]) |
| 7749 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7750 | public @Nullable double[] getDoubleArrayExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7751 | return mExtras == null ? null : mExtras.getDoubleArray(name); |
| 7752 | } |
| 7753 | |
| 7754 | /** |
| 7755 | * Retrieve extended data from the intent. |
| 7756 | * |
| 7757 | * @param name The name of the desired item. |
| 7758 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7759 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7760 | * or null if no String array value was found. |
| 7761 | * |
| 7762 | * @see #putExtra(String, String[]) |
| 7763 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7764 | public @Nullable String[] getStringArrayExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7765 | return mExtras == null ? null : mExtras.getStringArray(name); |
| 7766 | } |
| 7767 | |
| 7768 | /** |
| 7769 | * Retrieve extended data from the intent. |
| 7770 | * |
| 7771 | * @param name The name of the desired item. |
| 7772 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7773 | * @return the value of an item previously added with putExtra(), |
Bjorn Bringert | 08bbffb | 2010-02-25 11:16:22 +0000 | [diff] [blame] | 7774 | * or null if no CharSequence array value was found. |
| 7775 | * |
| 7776 | * @see #putExtra(String, CharSequence[]) |
| 7777 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7778 | public @Nullable CharSequence[] getCharSequenceArrayExtra(String name) { |
Bjorn Bringert | 08bbffb | 2010-02-25 11:16:22 +0000 | [diff] [blame] | 7779 | return mExtras == null ? null : mExtras.getCharSequenceArray(name); |
| 7780 | } |
| 7781 | |
| 7782 | /** |
| 7783 | * Retrieve extended data from the intent. |
| 7784 | * |
| 7785 | * @param name The name of the desired item. |
| 7786 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7787 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7788 | * or null if no Bundle value was found. |
| 7789 | * |
| 7790 | * @see #putExtra(String, Bundle) |
| 7791 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 7792 | public @Nullable Bundle getBundleExtra(String name) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7793 | return mExtras == null ? null : mExtras.getBundle(name); |
| 7794 | } |
| 7795 | |
| 7796 | /** |
| 7797 | * Retrieve extended data from the intent. |
| 7798 | * |
| 7799 | * @param name The name of the desired item. |
| 7800 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7801 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7802 | * or null if no IBinder value was found. |
| 7803 | * |
| 7804 | * @see #putExtra(String, IBinder) |
| 7805 | * |
| 7806 | * @deprecated |
| 7807 | * @hide |
| 7808 | */ |
| 7809 | @Deprecated |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 7810 | @UnsupportedAppUsage |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7811 | public IBinder getIBinderExtra(String name) { |
| 7812 | return mExtras == null ? null : mExtras.getIBinder(name); |
| 7813 | } |
| 7814 | |
| 7815 | /** |
| 7816 | * Retrieve extended data from the intent. |
| 7817 | * |
| 7818 | * @param name The name of the desired item. |
| 7819 | * @param defaultValue The default value to return in case no item is |
| 7820 | * associated with the key 'name' |
| 7821 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7822 | * @return the value of an item previously added with putExtra(), |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7823 | * or defaultValue if none was found. |
| 7824 | * |
| 7825 | * @see #putExtra |
| 7826 | * |
| 7827 | * @deprecated |
| 7828 | * @hide |
| 7829 | */ |
| 7830 | @Deprecated |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 7831 | @UnsupportedAppUsage |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7832 | public Object getExtra(String name, Object defaultValue) { |
| 7833 | Object result = defaultValue; |
| 7834 | if (mExtras != null) { |
| 7835 | Object result2 = mExtras.get(name); |
| 7836 | if (result2 != null) { |
| 7837 | result = result2; |
| 7838 | } |
| 7839 | } |
| 7840 | |
| 7841 | return result; |
| 7842 | } |
| 7843 | |
| 7844 | /** |
| 7845 | * Retrieves a map of extended data from the intent. |
| 7846 | * |
| 7847 | * @return the map of all extras previously added with putExtra(), |
| 7848 | * or null if none have been added. |
| 7849 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7850 | public @Nullable Bundle getExtras() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7851 | return (mExtras != null) |
| 7852 | ? new Bundle(mExtras) |
| 7853 | : null; |
| 7854 | } |
| 7855 | |
| 7856 | /** |
Dianne Hackborn | a83ce1d | 2015-03-11 15:16:13 -0700 | [diff] [blame] | 7857 | * Filter extras to only basic types. |
| 7858 | * @hide |
| 7859 | */ |
| 7860 | public void removeUnsafeExtras() { |
| 7861 | if (mExtras != null) { |
Dianne Hackborn | 851ec49 | 2016-10-12 17:20:07 -0700 | [diff] [blame] | 7862 | mExtras = mExtras.filterValues(); |
Dianne Hackborn | a83ce1d | 2015-03-11 15:16:13 -0700 | [diff] [blame] | 7863 | } |
| 7864 | } |
| 7865 | |
| 7866 | /** |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 7867 | * @return Whether {@link #maybeStripForHistory} will return an lightened intent or |
| 7868 | * return itself as-is. |
| 7869 | * @hide |
| 7870 | */ |
| 7871 | public boolean canStripForHistory() { |
| 7872 | return ((mExtras != null) && mExtras.isParcelled()) || (mClipData != null); |
| 7873 | } |
| 7874 | |
| 7875 | /** |
| 7876 | * Call it when the system needs to keep an intent for logging purposes to remove fields |
| 7877 | * that are not needed for logging. |
| 7878 | * @hide |
| 7879 | */ |
| 7880 | public Intent maybeStripForHistory() { |
| 7881 | // TODO Scan and remove possibly heavy instances like Bitmaps from unparcelled extras? |
| 7882 | |
| 7883 | if (!canStripForHistory()) { |
| 7884 | return this; |
| 7885 | } |
| 7886 | return new Intent(this, COPY_MODE_HISTORY); |
| 7887 | } |
| 7888 | |
| 7889 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7890 | * Retrieve any special flags associated with this intent. You will |
| 7891 | * normally just set them with {@link #setFlags} and let the system |
| 7892 | * take the appropriate action with them. |
| 7893 | * |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7894 | * @return The currently set flags. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7895 | * @see #setFlags |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7896 | * @see #addFlags |
| 7897 | * @see #removeFlags |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7898 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7899 | public @Flags int getFlags() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7900 | return mFlags; |
| 7901 | } |
| 7902 | |
Dianne Hackborn | e7f9721 | 2011-02-24 14:40:20 -0800 | [diff] [blame] | 7903 | /** @hide */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 7904 | @UnsupportedAppUsage |
Dianne Hackborn | e7f9721 | 2011-02-24 14:40:20 -0800 | [diff] [blame] | 7905 | public boolean isExcludingStopped() { |
| 7906 | return (mFlags&(FLAG_EXCLUDE_STOPPED_PACKAGES|FLAG_INCLUDE_STOPPED_PACKAGES)) |
| 7907 | == FLAG_EXCLUDE_STOPPED_PACKAGES; |
| 7908 | } |
| 7909 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7910 | /** |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 7911 | * Retrieve the application package name this Intent is limited to. When |
| 7912 | * resolving an Intent, if non-null this limits the resolution to only |
| 7913 | * components in the given application package. |
| 7914 | * |
| 7915 | * @return The name of the application package for the Intent. |
| 7916 | * |
| 7917 | * @see #resolveActivity |
| 7918 | * @see #setPackage |
| 7919 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7920 | public @Nullable String getPackage() { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 7921 | return mPackage; |
| 7922 | } |
| 7923 | |
| 7924 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7925 | * Retrieve the concrete component associated with the intent. When receiving |
| 7926 | * an intent, this is the component that was found to best handle it (that is, |
| 7927 | * yourself) and will always be non-null; in all other cases it will be |
| 7928 | * null unless explicitly set. |
| 7929 | * |
| 7930 | * @return The name of the application component to handle the intent. |
| 7931 | * |
| 7932 | * @see #resolveActivity |
| 7933 | * @see #setComponent |
| 7934 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7935 | public @Nullable ComponentName getComponent() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7936 | return mComponent; |
| 7937 | } |
| 7938 | |
| 7939 | /** |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 7940 | * Get the bounds of the sender of this intent, in screen coordinates. This can be |
| 7941 | * used as a hint to the receiver for animations and the like. Null means that there |
| 7942 | * is no source bounds. |
| 7943 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7944 | public @Nullable Rect getSourceBounds() { |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 7945 | return mSourceBounds; |
| 7946 | } |
| 7947 | |
| 7948 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7949 | * Return the Activity component that should be used to handle this intent. |
| 7950 | * The appropriate component is determined based on the information in the |
| 7951 | * intent, evaluated as follows: |
| 7952 | * |
| 7953 | * <p>If {@link #getComponent} returns an explicit class, that is returned |
| 7954 | * without any further consideration. |
| 7955 | * |
| 7956 | * <p>The activity must handle the {@link Intent#CATEGORY_DEFAULT} Intent |
| 7957 | * category to be considered. |
| 7958 | * |
| 7959 | * <p>If {@link #getAction} is non-NULL, the activity must handle this |
| 7960 | * action. |
| 7961 | * |
| 7962 | * <p>If {@link #resolveType} returns non-NULL, the activity must handle |
| 7963 | * this type. |
| 7964 | * |
| 7965 | * <p>If {@link #addCategory} has added any categories, the activity must |
| 7966 | * handle ALL of the categories specified. |
| 7967 | * |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 7968 | * <p>If {@link #getPackage} is non-NULL, only activity components in |
| 7969 | * that application package will be considered. |
| 7970 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7971 | * <p>If there are no activities that satisfy all of these conditions, a |
| 7972 | * null string is returned. |
| 7973 | * |
| 7974 | * <p>If multiple activities are found to satisfy the intent, the one with |
| 7975 | * the highest priority will be used. If there are multiple activities |
| 7976 | * with the same priority, the system will either pick the best activity |
| 7977 | * based on user preference, or resolve to a system class that will allow |
| 7978 | * the user to pick an activity and forward from there. |
| 7979 | * |
| 7980 | * <p>This method is implemented simply by calling |
| 7981 | * {@link PackageManager#resolveActivity} with the "defaultOnly" parameter |
| 7982 | * true.</p> |
| 7983 | * <p> This API is called for you as part of starting an activity from an |
| 7984 | * intent. You do not normally need to call it yourself.</p> |
| 7985 | * |
| 7986 | * @param pm The package manager with which to resolve the Intent. |
| 7987 | * |
| 7988 | * @return Name of the component implementing an activity that can |
| 7989 | * display the intent. |
| 7990 | * |
| 7991 | * @see #setComponent |
| 7992 | * @see #getComponent |
| 7993 | * @see #resolveActivityInfo |
| 7994 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7995 | public ComponentName resolveActivity(@NonNull PackageManager pm) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7996 | if (mComponent != null) { |
| 7997 | return mComponent; |
| 7998 | } |
| 7999 | |
| 8000 | ResolveInfo info = pm.resolveActivity( |
| 8001 | this, PackageManager.MATCH_DEFAULT_ONLY); |
| 8002 | if (info != null) { |
| 8003 | return new ComponentName( |
| 8004 | info.activityInfo.applicationInfo.packageName, |
| 8005 | info.activityInfo.name); |
| 8006 | } |
| 8007 | |
| 8008 | return null; |
| 8009 | } |
| 8010 | |
| 8011 | /** |
| 8012 | * Resolve the Intent into an {@link ActivityInfo} |
| 8013 | * describing the activity that should execute the intent. Resolution |
| 8014 | * follows the same rules as described for {@link #resolveActivity}, but |
| 8015 | * you get back the completely information about the resolved activity |
| 8016 | * instead of just its class name. |
| 8017 | * |
| 8018 | * @param pm The package manager with which to resolve the Intent. |
| 8019 | * @param flags Addition information to retrieve as per |
| 8020 | * {@link PackageManager#getActivityInfo(ComponentName, int) |
| 8021 | * PackageManager.getActivityInfo()}. |
| 8022 | * |
| 8023 | * @return PackageManager.ActivityInfo |
| 8024 | * |
| 8025 | * @see #resolveActivity |
| 8026 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8027 | public ActivityInfo resolveActivityInfo(@NonNull PackageManager pm, |
| 8028 | @PackageManager.ComponentInfoFlags int flags) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8029 | ActivityInfo ai = null; |
| 8030 | if (mComponent != null) { |
| 8031 | try { |
| 8032 | ai = pm.getActivityInfo(mComponent, flags); |
| 8033 | } catch (PackageManager.NameNotFoundException e) { |
| 8034 | // ignore |
| 8035 | } |
| 8036 | } else { |
| 8037 | ResolveInfo info = pm.resolveActivity( |
Dianne Hackborn | 9bfb707 | 2009-09-22 11:37:40 -0700 | [diff] [blame] | 8038 | this, PackageManager.MATCH_DEFAULT_ONLY | flags); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8039 | if (info != null) { |
| 8040 | ai = info.activityInfo; |
| 8041 | } |
| 8042 | } |
| 8043 | |
| 8044 | return ai; |
| 8045 | } |
| 8046 | |
| 8047 | /** |
Dianne Hackborn | 221ea89 | 2013-08-04 16:50:16 -0700 | [diff] [blame] | 8048 | * Special function for use by the system to resolve service |
| 8049 | * intents to system apps. Throws an exception if there are |
| 8050 | * multiple potential matches to the Intent. Returns null if |
| 8051 | * there are no matches. |
| 8052 | * @hide |
| 8053 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 8054 | @UnsupportedAppUsage |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8055 | public @Nullable ComponentName resolveSystemService(@NonNull PackageManager pm, |
| 8056 | @PackageManager.ComponentInfoFlags int flags) { |
Dianne Hackborn | 221ea89 | 2013-08-04 16:50:16 -0700 | [diff] [blame] | 8057 | if (mComponent != null) { |
| 8058 | return mComponent; |
| 8059 | } |
| 8060 | |
| 8061 | List<ResolveInfo> results = pm.queryIntentServices(this, flags); |
| 8062 | if (results == null) { |
| 8063 | return null; |
| 8064 | } |
| 8065 | ComponentName comp = null; |
| 8066 | for (int i=0; i<results.size(); i++) { |
| 8067 | ResolveInfo ri = results.get(i); |
| 8068 | if ((ri.serviceInfo.applicationInfo.flags&ApplicationInfo.FLAG_SYSTEM) == 0) { |
| 8069 | continue; |
| 8070 | } |
| 8071 | ComponentName foundComp = new ComponentName(ri.serviceInfo.applicationInfo.packageName, |
| 8072 | ri.serviceInfo.name); |
| 8073 | if (comp != null) { |
| 8074 | throw new IllegalStateException("Multiple system services handle " + this |
| 8075 | + ": " + comp + ", " + foundComp); |
| 8076 | } |
| 8077 | comp = foundComp; |
| 8078 | } |
| 8079 | return comp; |
| 8080 | } |
| 8081 | |
| 8082 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8083 | * Set the general action to be performed. |
| 8084 | * |
| 8085 | * @param action An action name, such as ACTION_VIEW. Application-specific |
| 8086 | * actions should be prefixed with the vendor's package name. |
| 8087 | * |
| 8088 | * @return Returns the same Intent object, for chaining multiple calls |
| 8089 | * into a single statement. |
| 8090 | * |
| 8091 | * @see #getAction |
| 8092 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8093 | public @NonNull Intent setAction(@Nullable String action) { |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 8094 | mAction = action != null ? action.intern() : null; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8095 | return this; |
| 8096 | } |
| 8097 | |
| 8098 | /** |
| 8099 | * Set the data this intent is operating on. This method automatically |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8100 | * clears any type that was previously set by {@link #setType} or |
| 8101 | * {@link #setTypeAndNormalize}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8102 | * |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8103 | * <p><em>Note: scheme matching in the Android framework is |
| 8104 | * case-sensitive, unlike the formal RFC. As a result, |
| 8105 | * you should always write your Uri with a lower case scheme, |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8106 | * or use {@link Uri#normalizeScheme} or |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8107 | * {@link #setDataAndNormalize} |
| 8108 | * to ensure that the scheme is converted to lower case.</em> |
Dianne Hackborn | b3cddae | 2009-04-13 16:54:00 -0700 | [diff] [blame] | 8109 | * |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8110 | * @param data The Uri of the data this intent is now targeting. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8111 | * |
| 8112 | * @return Returns the same Intent object, for chaining multiple calls |
| 8113 | * into a single statement. |
| 8114 | * |
| 8115 | * @see #getData |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8116 | * @see #setDataAndNormalize |
Dianne Hackborn | 221ea89 | 2013-08-04 16:50:16 -0700 | [diff] [blame] | 8117 | * @see android.net.Uri#normalizeScheme() |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8118 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8119 | public @NonNull Intent setData(@Nullable Uri data) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8120 | mData = data; |
| 8121 | mType = null; |
| 8122 | return this; |
| 8123 | } |
| 8124 | |
| 8125 | /** |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8126 | * Normalize and set the data this intent is operating on. |
| 8127 | * |
| 8128 | * <p>This method automatically clears any type that was |
| 8129 | * previously set (for example, by {@link #setType}). |
| 8130 | * |
| 8131 | * <p>The data Uri is normalized using |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8132 | * {@link android.net.Uri#normalizeScheme} before it is set, |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8133 | * so really this is just a convenience method for |
| 8134 | * <pre> |
| 8135 | * setData(data.normalize()) |
| 8136 | * </pre> |
| 8137 | * |
| 8138 | * @param data The Uri of the data this intent is now targeting. |
| 8139 | * |
| 8140 | * @return Returns the same Intent object, for chaining multiple calls |
| 8141 | * into a single statement. |
| 8142 | * |
| 8143 | * @see #getData |
| 8144 | * @see #setType |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8145 | * @see android.net.Uri#normalizeScheme |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8146 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8147 | public @NonNull Intent setDataAndNormalize(@NonNull Uri data) { |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8148 | return setData(data.normalizeScheme()); |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8149 | } |
| 8150 | |
| 8151 | /** |
| 8152 | * Set an explicit MIME data type. |
| 8153 | * |
| 8154 | * <p>This is used to create intents that only specify a type and not data, |
| 8155 | * for example to indicate the type of data to return. |
| 8156 | * |
| 8157 | * <p>This method automatically clears any data that was |
| 8158 | * previously set (for example by {@link #setData}). |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 8159 | * |
Dianne Hackborn | b3cddae | 2009-04-13 16:54:00 -0700 | [diff] [blame] | 8160 | * <p><em>Note: MIME type matching in the Android framework is |
| 8161 | * case-sensitive, unlike formal RFC MIME types. As a result, |
| 8162 | * you should always write your MIME types with lower case letters, |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8163 | * or use {@link #normalizeMimeType} or {@link #setTypeAndNormalize} |
| 8164 | * to ensure that it is converted to lower case.</em> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8165 | * |
| 8166 | * @param type The MIME type of the data being handled by this intent. |
| 8167 | * |
| 8168 | * @return Returns the same Intent object, for chaining multiple calls |
| 8169 | * into a single statement. |
| 8170 | * |
| 8171 | * @see #getType |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8172 | * @see #setTypeAndNormalize |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8173 | * @see #setDataAndType |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8174 | * @see #normalizeMimeType |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8175 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8176 | public @NonNull Intent setType(@Nullable String type) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8177 | mData = null; |
| 8178 | mType = type; |
| 8179 | return this; |
| 8180 | } |
| 8181 | |
| 8182 | /** |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8183 | * Normalize and set an explicit MIME data type. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8184 | * |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8185 | * <p>This is used to create intents that only specify a type and not data, |
| 8186 | * for example to indicate the type of data to return. |
Dianne Hackborn | b3cddae | 2009-04-13 16:54:00 -0700 | [diff] [blame] | 8187 | * |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8188 | * <p>This method automatically clears any data that was |
| 8189 | * previously set (for example by {@link #setData}). |
| 8190 | * |
| 8191 | * <p>The MIME type is normalized using |
| 8192 | * {@link #normalizeMimeType} before it is set, |
| 8193 | * so really this is just a convenience method for |
| 8194 | * <pre> |
| 8195 | * setType(Intent.normalizeMimeType(type)) |
| 8196 | * </pre> |
| 8197 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8198 | * @param type The MIME type of the data being handled by this intent. |
| 8199 | * |
| 8200 | * @return Returns the same Intent object, for chaining multiple calls |
| 8201 | * into a single statement. |
| 8202 | * |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8203 | * @see #getType |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8204 | * @see #setData |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8205 | * @see #normalizeMimeType |
| 8206 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8207 | public @NonNull Intent setTypeAndNormalize(@Nullable String type) { |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8208 | return setType(normalizeMimeType(type)); |
| 8209 | } |
| 8210 | |
| 8211 | /** |
| 8212 | * (Usually optional) Set the data for the intent along with an explicit |
| 8213 | * MIME data type. This method should very rarely be used -- it allows you |
| 8214 | * to override the MIME type that would ordinarily be inferred from the |
| 8215 | * data with your own type given here. |
| 8216 | * |
| 8217 | * <p><em>Note: MIME type and Uri scheme matching in the |
| 8218 | * Android framework is case-sensitive, unlike the formal RFC definitions. |
| 8219 | * As a result, you should always write these elements with lower case letters, |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8220 | * or use {@link #normalizeMimeType} or {@link android.net.Uri#normalizeScheme} or |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8221 | * {@link #setDataAndTypeAndNormalize} |
| 8222 | * to ensure that they are converted to lower case.</em> |
| 8223 | * |
| 8224 | * @param data The Uri of the data this intent is now targeting. |
| 8225 | * @param type The MIME type of the data being handled by this intent. |
| 8226 | * |
| 8227 | * @return Returns the same Intent object, for chaining multiple calls |
| 8228 | * into a single statement. |
| 8229 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8230 | * @see #setType |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8231 | * @see #setData |
| 8232 | * @see #normalizeMimeType |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8233 | * @see android.net.Uri#normalizeScheme |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8234 | * @see #setDataAndTypeAndNormalize |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8235 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8236 | public @NonNull Intent setDataAndType(@Nullable Uri data, @Nullable String type) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8237 | mData = data; |
| 8238 | mType = type; |
| 8239 | return this; |
| 8240 | } |
| 8241 | |
| 8242 | /** |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8243 | * (Usually optional) Normalize and set both the data Uri and an explicit |
| 8244 | * MIME data type. This method should very rarely be used -- it allows you |
| 8245 | * to override the MIME type that would ordinarily be inferred from the |
| 8246 | * data with your own type given here. |
| 8247 | * |
| 8248 | * <p>The data Uri and the MIME type are normalize using |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8249 | * {@link android.net.Uri#normalizeScheme} and {@link #normalizeMimeType} |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8250 | * before they are set, so really this is just a convenience method for |
| 8251 | * <pre> |
| 8252 | * setDataAndType(data.normalize(), Intent.normalizeMimeType(type)) |
| 8253 | * </pre> |
| 8254 | * |
| 8255 | * @param data The Uri of the data this intent is now targeting. |
| 8256 | * @param type The MIME type of the data being handled by this intent. |
| 8257 | * |
| 8258 | * @return Returns the same Intent object, for chaining multiple calls |
| 8259 | * into a single statement. |
| 8260 | * |
| 8261 | * @see #setType |
| 8262 | * @see #setData |
| 8263 | * @see #setDataAndType |
| 8264 | * @see #normalizeMimeType |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8265 | * @see android.net.Uri#normalizeScheme |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8266 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8267 | public @NonNull Intent setDataAndTypeAndNormalize(@NonNull Uri data, @Nullable String type) { |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8268 | return setDataAndType(data.normalizeScheme(), normalizeMimeType(type)); |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8269 | } |
| 8270 | |
| 8271 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8272 | * Add a new category to the intent. Categories provide additional detail |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 8273 | * about the action the intent performs. When resolving an intent, only |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8274 | * activities that provide <em>all</em> of the requested categories will be |
| 8275 | * used. |
| 8276 | * |
| 8277 | * @param category The desired category. This can be either one of the |
| 8278 | * predefined Intent categories, or a custom category in your own |
| 8279 | * namespace. |
| 8280 | * |
| 8281 | * @return Returns the same Intent object, for chaining multiple calls |
| 8282 | * into a single statement. |
| 8283 | * |
| 8284 | * @see #hasCategory |
| 8285 | * @see #removeCategory |
| 8286 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8287 | public @NonNull Intent addCategory(String category) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8288 | if (mCategories == null) { |
Dianne Hackborn | add005c | 2013-07-17 18:43:12 -0700 | [diff] [blame] | 8289 | mCategories = new ArraySet<String>(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8290 | } |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 8291 | mCategories.add(category.intern()); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8292 | return this; |
| 8293 | } |
| 8294 | |
| 8295 | /** |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 8296 | * Remove a category from an intent. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8297 | * |
| 8298 | * @param category The category to remove. |
| 8299 | * |
| 8300 | * @see #addCategory |
| 8301 | */ |
| 8302 | public void removeCategory(String category) { |
| 8303 | if (mCategories != null) { |
| 8304 | mCategories.remove(category); |
| 8305 | if (mCategories.size() == 0) { |
| 8306 | mCategories = null; |
| 8307 | } |
| 8308 | } |
| 8309 | } |
| 8310 | |
| 8311 | /** |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 8312 | * Set a selector for this Intent. This is a modification to the kinds of |
| 8313 | * things the Intent will match. If the selector is set, it will be used |
| 8314 | * when trying to find entities that can handle the Intent, instead of the |
| 8315 | * main contents of the Intent. This allows you build an Intent containing |
| 8316 | * a generic protocol while targeting it more specifically. |
| 8317 | * |
| 8318 | * <p>An example of where this may be used is with things like |
| 8319 | * {@link #CATEGORY_APP_BROWSER}. This category allows you to build an |
| 8320 | * Intent that will launch the Browser application. However, the correct |
| 8321 | * main entry point of an application is actually {@link #ACTION_MAIN} |
| 8322 | * {@link #CATEGORY_LAUNCHER} with {@link #setComponent(ComponentName)} |
| 8323 | * used to specify the actual Activity to launch. If you launch the browser |
| 8324 | * with something different, undesired behavior may happen if the user has |
| 8325 | * previously or later launches it the normal way, since they do not match. |
| 8326 | * Instead, you can build an Intent with the MAIN action (but no ComponentName |
| 8327 | * yet specified) and set a selector with {@link #ACTION_MAIN} and |
| 8328 | * {@link #CATEGORY_APP_BROWSER} to point it specifically to the browser activity. |
| 8329 | * |
| 8330 | * <p>Setting a selector does not impact the behavior of |
| 8331 | * {@link #filterEquals(Intent)} and {@link #filterHashCode()}. This is part of the |
| 8332 | * desired behavior of a selector -- it does not impact the base meaning |
| 8333 | * of the Intent, just what kinds of things will be matched against it |
| 8334 | * when determining who can handle it.</p> |
| 8335 | * |
| 8336 | * <p>You can not use both a selector and {@link #setPackage(String)} on |
| 8337 | * the same base Intent.</p> |
| 8338 | * |
| 8339 | * @param selector The desired selector Intent; set to null to not use |
| 8340 | * a special selector. |
| 8341 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8342 | public void setSelector(@Nullable Intent selector) { |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 8343 | if (selector == this) { |
| 8344 | throw new IllegalArgumentException( |
| 8345 | "Intent being set as a selector of itself"); |
| 8346 | } |
| 8347 | if (selector != null && mPackage != null) { |
| 8348 | throw new IllegalArgumentException( |
| 8349 | "Can't set selector when package name is already set"); |
| 8350 | } |
| 8351 | mSelector = selector; |
| 8352 | } |
| 8353 | |
| 8354 | /** |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 8355 | * Set a {@link ClipData} associated with this Intent. This replaces any |
| 8356 | * previously set ClipData. |
| 8357 | * |
| 8358 | * <p>The ClipData in an intent is not used for Intent matching or other |
| 8359 | * such operations. Semantically it is like extras, used to transmit |
| 8360 | * additional data with the Intent. The main feature of using this over |
| 8361 | * the extras for data is that {@link #FLAG_GRANT_READ_URI_PERMISSION} |
| 8362 | * and {@link #FLAG_GRANT_WRITE_URI_PERMISSION} will operate on any URI |
| 8363 | * items included in the clip data. This is useful, in particular, if |
| 8364 | * you want to transmit an Intent containing multiple <code>content:</code> |
| 8365 | * URIs for which the recipient may not have global permission to access the |
| 8366 | * content provider. |
| 8367 | * |
| 8368 | * <p>If the ClipData contains items that are themselves Intents, any |
| 8369 | * grant flags in those Intents will be ignored. Only the top-level flags |
| 8370 | * of the main Intent are respected, and will be applied to all Uri or |
| 8371 | * Intent items in the clip (or sub-items of the clip). |
| 8372 | * |
| 8373 | * <p>The MIME type, label, and icon in the ClipData object are not |
| 8374 | * directly used by Intent. Applications should generally rely on the |
| 8375 | * MIME type of the Intent itself, not what it may find in the ClipData. |
| 8376 | * A common practice is to construct a ClipData for use with an Intent |
John Spurlock | 3390018 | 2014-01-02 11:04:18 -0500 | [diff] [blame] | 8377 | * with a MIME type of "*/*". |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 8378 | * |
| 8379 | * @param clip The new clip to set. May be null to clear the current clip. |
| 8380 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8381 | public void setClipData(@Nullable ClipData clip) { |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 8382 | mClipData = clip; |
| 8383 | } |
| 8384 | |
| 8385 | /** |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 8386 | * This is NOT a secure mechanism to identify the user who sent the intent. |
| 8387 | * When the intent is sent to a different user, it is used to fix uris by adding the userId |
| 8388 | * who sent the intent. |
| 8389 | * @hide |
| 8390 | */ |
Nicolas Prevot | 107f7b7 | 2015-07-01 16:31:48 +0100 | [diff] [blame] | 8391 | public void prepareToLeaveUser(int userId) { |
| 8392 | // If mContentUserHint is not UserHandle.USER_CURRENT, the intent has already left a user. |
| 8393 | // We want mContentUserHint to refer to the original user, so don't do anything. |
| 8394 | if (mContentUserHint == UserHandle.USER_CURRENT) { |
| 8395 | mContentUserHint = userId; |
| 8396 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 8397 | } |
| 8398 | |
| 8399 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8400 | * Add extended data to the intent. The name must include a package |
| 8401 | * prefix, for example the app com.android.contacts would use names |
| 8402 | * like "com.android.contacts.ShowAll". |
| 8403 | * |
| 8404 | * @param name The name of the extra data, with package prefix. |
| 8405 | * @param value The boolean data value. |
| 8406 | * |
| 8407 | * @return Returns the same Intent object, for chaining multiple calls |
| 8408 | * into a single statement. |
| 8409 | * |
| 8410 | * @see #putExtras |
| 8411 | * @see #removeExtra |
| 8412 | * @see #getBooleanExtra(String, boolean) |
| 8413 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8414 | public @NonNull Intent putExtra(String name, boolean value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8415 | if (mExtras == null) { |
| 8416 | mExtras = new Bundle(); |
| 8417 | } |
| 8418 | mExtras.putBoolean(name, value); |
| 8419 | return this; |
| 8420 | } |
| 8421 | |
| 8422 | /** |
| 8423 | * Add extended data to the intent. The name must include a package |
| 8424 | * prefix, for example the app com.android.contacts would use names |
| 8425 | * like "com.android.contacts.ShowAll". |
| 8426 | * |
| 8427 | * @param name The name of the extra data, with package prefix. |
| 8428 | * @param value The byte data value. |
| 8429 | * |
| 8430 | * @return Returns the same Intent object, for chaining multiple calls |
| 8431 | * into a single statement. |
| 8432 | * |
| 8433 | * @see #putExtras |
| 8434 | * @see #removeExtra |
| 8435 | * @see #getByteExtra(String, byte) |
| 8436 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8437 | public @NonNull Intent putExtra(String name, byte value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8438 | if (mExtras == null) { |
| 8439 | mExtras = new Bundle(); |
| 8440 | } |
| 8441 | mExtras.putByte(name, value); |
| 8442 | return this; |
| 8443 | } |
| 8444 | |
| 8445 | /** |
| 8446 | * Add extended data to the intent. The name must include a package |
| 8447 | * prefix, for example the app com.android.contacts would use names |
| 8448 | * like "com.android.contacts.ShowAll". |
| 8449 | * |
| 8450 | * @param name The name of the extra data, with package prefix. |
| 8451 | * @param value The char data value. |
| 8452 | * |
| 8453 | * @return Returns the same Intent object, for chaining multiple calls |
| 8454 | * into a single statement. |
| 8455 | * |
| 8456 | * @see #putExtras |
| 8457 | * @see #removeExtra |
| 8458 | * @see #getCharExtra(String, char) |
| 8459 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8460 | public @NonNull Intent putExtra(String name, char value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8461 | if (mExtras == null) { |
| 8462 | mExtras = new Bundle(); |
| 8463 | } |
| 8464 | mExtras.putChar(name, value); |
| 8465 | return this; |
| 8466 | } |
| 8467 | |
| 8468 | /** |
| 8469 | * Add extended data to the intent. The name must include a package |
| 8470 | * prefix, for example the app com.android.contacts would use names |
| 8471 | * like "com.android.contacts.ShowAll". |
| 8472 | * |
| 8473 | * @param name The name of the extra data, with package prefix. |
| 8474 | * @param value The short data value. |
| 8475 | * |
| 8476 | * @return Returns the same Intent object, for chaining multiple calls |
| 8477 | * into a single statement. |
| 8478 | * |
| 8479 | * @see #putExtras |
| 8480 | * @see #removeExtra |
| 8481 | * @see #getShortExtra(String, short) |
| 8482 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8483 | public @NonNull Intent putExtra(String name, short value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8484 | if (mExtras == null) { |
| 8485 | mExtras = new Bundle(); |
| 8486 | } |
| 8487 | mExtras.putShort(name, value); |
| 8488 | return this; |
| 8489 | } |
| 8490 | |
| 8491 | /** |
| 8492 | * Add extended data to the intent. The name must include a package |
| 8493 | * prefix, for example the app com.android.contacts would use names |
| 8494 | * like "com.android.contacts.ShowAll". |
| 8495 | * |
| 8496 | * @param name The name of the extra data, with package prefix. |
| 8497 | * @param value The integer data value. |
| 8498 | * |
| 8499 | * @return Returns the same Intent object, for chaining multiple calls |
| 8500 | * into a single statement. |
| 8501 | * |
| 8502 | * @see #putExtras |
| 8503 | * @see #removeExtra |
| 8504 | * @see #getIntExtra(String, int) |
| 8505 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8506 | public @NonNull Intent putExtra(String name, int value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8507 | if (mExtras == null) { |
| 8508 | mExtras = new Bundle(); |
| 8509 | } |
| 8510 | mExtras.putInt(name, value); |
| 8511 | return this; |
| 8512 | } |
| 8513 | |
| 8514 | /** |
| 8515 | * Add extended data to the intent. The name must include a package |
| 8516 | * prefix, for example the app com.android.contacts would use names |
| 8517 | * like "com.android.contacts.ShowAll". |
| 8518 | * |
| 8519 | * @param name The name of the extra data, with package prefix. |
| 8520 | * @param value The long data value. |
| 8521 | * |
| 8522 | * @return Returns the same Intent object, for chaining multiple calls |
| 8523 | * into a single statement. |
| 8524 | * |
| 8525 | * @see #putExtras |
| 8526 | * @see #removeExtra |
| 8527 | * @see #getLongExtra(String, long) |
| 8528 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8529 | public @NonNull Intent putExtra(String name, long value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8530 | if (mExtras == null) { |
| 8531 | mExtras = new Bundle(); |
| 8532 | } |
| 8533 | mExtras.putLong(name, value); |
| 8534 | return this; |
| 8535 | } |
| 8536 | |
| 8537 | /** |
| 8538 | * Add extended data to the intent. The name must include a package |
| 8539 | * prefix, for example the app com.android.contacts would use names |
| 8540 | * like "com.android.contacts.ShowAll". |
| 8541 | * |
| 8542 | * @param name The name of the extra data, with package prefix. |
| 8543 | * @param value The float data value. |
| 8544 | * |
| 8545 | * @return Returns the same Intent object, for chaining multiple calls |
| 8546 | * into a single statement. |
| 8547 | * |
| 8548 | * @see #putExtras |
| 8549 | * @see #removeExtra |
| 8550 | * @see #getFloatExtra(String, float) |
| 8551 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8552 | public @NonNull Intent putExtra(String name, float value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8553 | if (mExtras == null) { |
| 8554 | mExtras = new Bundle(); |
| 8555 | } |
| 8556 | mExtras.putFloat(name, value); |
| 8557 | return this; |
| 8558 | } |
| 8559 | |
| 8560 | /** |
| 8561 | * Add extended data to the intent. The name must include a package |
| 8562 | * prefix, for example the app com.android.contacts would use names |
| 8563 | * like "com.android.contacts.ShowAll". |
| 8564 | * |
| 8565 | * @param name The name of the extra data, with package prefix. |
| 8566 | * @param value The double data value. |
| 8567 | * |
| 8568 | * @return Returns the same Intent object, for chaining multiple calls |
| 8569 | * into a single statement. |
| 8570 | * |
| 8571 | * @see #putExtras |
| 8572 | * @see #removeExtra |
| 8573 | * @see #getDoubleExtra(String, double) |
| 8574 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8575 | public @NonNull Intent putExtra(String name, double value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8576 | if (mExtras == null) { |
| 8577 | mExtras = new Bundle(); |
| 8578 | } |
| 8579 | mExtras.putDouble(name, value); |
| 8580 | return this; |
| 8581 | } |
| 8582 | |
| 8583 | /** |
| 8584 | * Add extended data to the intent. The name must include a package |
| 8585 | * prefix, for example the app com.android.contacts would use names |
| 8586 | * like "com.android.contacts.ShowAll". |
| 8587 | * |
| 8588 | * @param name The name of the extra data, with package prefix. |
| 8589 | * @param value The String data value. |
| 8590 | * |
| 8591 | * @return Returns the same Intent object, for chaining multiple calls |
| 8592 | * into a single statement. |
| 8593 | * |
| 8594 | * @see #putExtras |
| 8595 | * @see #removeExtra |
| 8596 | * @see #getStringExtra(String) |
| 8597 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8598 | public @NonNull Intent putExtra(String name, @Nullable String value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8599 | if (mExtras == null) { |
| 8600 | mExtras = new Bundle(); |
| 8601 | } |
| 8602 | mExtras.putString(name, value); |
| 8603 | return this; |
| 8604 | } |
| 8605 | |
| 8606 | /** |
| 8607 | * Add extended data to the intent. The name must include a package |
| 8608 | * prefix, for example the app com.android.contacts would use names |
| 8609 | * like "com.android.contacts.ShowAll". |
| 8610 | * |
| 8611 | * @param name The name of the extra data, with package prefix. |
| 8612 | * @param value The CharSequence data value. |
| 8613 | * |
| 8614 | * @return Returns the same Intent object, for chaining multiple calls |
| 8615 | * into a single statement. |
| 8616 | * |
| 8617 | * @see #putExtras |
| 8618 | * @see #removeExtra |
| 8619 | * @see #getCharSequenceExtra(String) |
| 8620 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8621 | public @NonNull Intent putExtra(String name, @Nullable CharSequence value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8622 | if (mExtras == null) { |
| 8623 | mExtras = new Bundle(); |
| 8624 | } |
| 8625 | mExtras.putCharSequence(name, value); |
| 8626 | return this; |
| 8627 | } |
| 8628 | |
| 8629 | /** |
| 8630 | * Add extended data to the intent. The name must include a package |
| 8631 | * prefix, for example the app com.android.contacts would use names |
| 8632 | * like "com.android.contacts.ShowAll". |
| 8633 | * |
| 8634 | * @param name The name of the extra data, with package prefix. |
| 8635 | * @param value The Parcelable data value. |
| 8636 | * |
| 8637 | * @return Returns the same Intent object, for chaining multiple calls |
| 8638 | * into a single statement. |
| 8639 | * |
| 8640 | * @see #putExtras |
| 8641 | * @see #removeExtra |
| 8642 | * @see #getParcelableExtra(String) |
| 8643 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8644 | public @NonNull Intent putExtra(String name, @Nullable Parcelable value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8645 | if (mExtras == null) { |
| 8646 | mExtras = new Bundle(); |
| 8647 | } |
| 8648 | mExtras.putParcelable(name, value); |
| 8649 | return this; |
| 8650 | } |
| 8651 | |
| 8652 | /** |
| 8653 | * Add extended data to the intent. The name must include a package |
| 8654 | * prefix, for example the app com.android.contacts would use names |
| 8655 | * like "com.android.contacts.ShowAll". |
| 8656 | * |
| 8657 | * @param name The name of the extra data, with package prefix. |
| 8658 | * @param value The Parcelable[] data value. |
| 8659 | * |
| 8660 | * @return Returns the same Intent object, for chaining multiple calls |
| 8661 | * into a single statement. |
| 8662 | * |
| 8663 | * @see #putExtras |
| 8664 | * @see #removeExtra |
| 8665 | * @see #getParcelableArrayExtra(String) |
| 8666 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8667 | public @NonNull Intent putExtra(String name, @Nullable Parcelable[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8668 | if (mExtras == null) { |
| 8669 | mExtras = new Bundle(); |
| 8670 | } |
| 8671 | mExtras.putParcelableArray(name, value); |
| 8672 | return this; |
| 8673 | } |
| 8674 | |
| 8675 | /** |
| 8676 | * Add extended data to the intent. The name must include a package |
| 8677 | * prefix, for example the app com.android.contacts would use names |
| 8678 | * like "com.android.contacts.ShowAll". |
| 8679 | * |
| 8680 | * @param name The name of the extra data, with package prefix. |
| 8681 | * @param value The ArrayList<Parcelable> data value. |
| 8682 | * |
| 8683 | * @return Returns the same Intent object, for chaining multiple calls |
| 8684 | * into a single statement. |
| 8685 | * |
| 8686 | * @see #putExtras |
| 8687 | * @see #removeExtra |
| 8688 | * @see #getParcelableArrayListExtra(String) |
| 8689 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8690 | public @NonNull Intent putParcelableArrayListExtra(String name, |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8691 | @Nullable ArrayList<? extends Parcelable> value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8692 | if (mExtras == null) { |
| 8693 | mExtras = new Bundle(); |
| 8694 | } |
| 8695 | mExtras.putParcelableArrayList(name, value); |
| 8696 | return this; |
| 8697 | } |
| 8698 | |
| 8699 | /** |
| 8700 | * Add extended data to the intent. The name must include a package |
| 8701 | * prefix, for example the app com.android.contacts would use names |
| 8702 | * like "com.android.contacts.ShowAll". |
| 8703 | * |
| 8704 | * @param name The name of the extra data, with package prefix. |
| 8705 | * @param value The ArrayList<Integer> data value. |
| 8706 | * |
| 8707 | * @return Returns the same Intent object, for chaining multiple calls |
| 8708 | * into a single statement. |
| 8709 | * |
| 8710 | * @see #putExtras |
| 8711 | * @see #removeExtra |
| 8712 | * @see #getIntegerArrayListExtra(String) |
| 8713 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8714 | public @NonNull Intent putIntegerArrayListExtra(String name, |
| 8715 | @Nullable ArrayList<Integer> value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8716 | if (mExtras == null) { |
| 8717 | mExtras = new Bundle(); |
| 8718 | } |
| 8719 | mExtras.putIntegerArrayList(name, value); |
| 8720 | return this; |
| 8721 | } |
| 8722 | |
| 8723 | /** |
| 8724 | * Add extended data to the intent. The name must include a package |
| 8725 | * prefix, for example the app com.android.contacts would use names |
| 8726 | * like "com.android.contacts.ShowAll". |
| 8727 | * |
| 8728 | * @param name The name of the extra data, with package prefix. |
| 8729 | * @param value The ArrayList<String> data value. |
| 8730 | * |
| 8731 | * @return Returns the same Intent object, for chaining multiple calls |
| 8732 | * into a single statement. |
| 8733 | * |
| 8734 | * @see #putExtras |
| 8735 | * @see #removeExtra |
| 8736 | * @see #getStringArrayListExtra(String) |
| 8737 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8738 | public @NonNull Intent putStringArrayListExtra(String name, @Nullable ArrayList<String> value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8739 | if (mExtras == null) { |
| 8740 | mExtras = new Bundle(); |
| 8741 | } |
| 8742 | mExtras.putStringArrayList(name, value); |
| 8743 | return this; |
| 8744 | } |
| 8745 | |
| 8746 | /** |
| 8747 | * Add extended data to the intent. The name must include a package |
| 8748 | * prefix, for example the app com.android.contacts would use names |
| 8749 | * like "com.android.contacts.ShowAll". |
| 8750 | * |
| 8751 | * @param name The name of the extra data, with package prefix. |
Bjorn Bringert | 08bbffb | 2010-02-25 11:16:22 +0000 | [diff] [blame] | 8752 | * @param value The ArrayList<CharSequence> data value. |
| 8753 | * |
| 8754 | * @return Returns the same Intent object, for chaining multiple calls |
| 8755 | * into a single statement. |
| 8756 | * |
| 8757 | * @see #putExtras |
| 8758 | * @see #removeExtra |
| 8759 | * @see #getCharSequenceArrayListExtra(String) |
| 8760 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8761 | public @NonNull Intent putCharSequenceArrayListExtra(String name, |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8762 | @Nullable ArrayList<CharSequence> value) { |
Bjorn Bringert | 08bbffb | 2010-02-25 11:16:22 +0000 | [diff] [blame] | 8763 | if (mExtras == null) { |
| 8764 | mExtras = new Bundle(); |
| 8765 | } |
| 8766 | mExtras.putCharSequenceArrayList(name, value); |
| 8767 | return this; |
| 8768 | } |
| 8769 | |
| 8770 | /** |
| 8771 | * Add extended data to the intent. The name must include a package |
| 8772 | * prefix, for example the app com.android.contacts would use names |
| 8773 | * like "com.android.contacts.ShowAll". |
| 8774 | * |
| 8775 | * @param name The name of the extra data, with package prefix. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8776 | * @param value The Serializable data value. |
| 8777 | * |
| 8778 | * @return Returns the same Intent object, for chaining multiple calls |
| 8779 | * into a single statement. |
| 8780 | * |
| 8781 | * @see #putExtras |
| 8782 | * @see #removeExtra |
| 8783 | * @see #getSerializableExtra(String) |
| 8784 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8785 | public @NonNull Intent putExtra(String name, @Nullable Serializable value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8786 | if (mExtras == null) { |
| 8787 | mExtras = new Bundle(); |
| 8788 | } |
| 8789 | mExtras.putSerializable(name, value); |
| 8790 | return this; |
| 8791 | } |
| 8792 | |
| 8793 | /** |
| 8794 | * Add extended data to the intent. The name must include a package |
| 8795 | * prefix, for example the app com.android.contacts would use names |
| 8796 | * like "com.android.contacts.ShowAll". |
| 8797 | * |
| 8798 | * @param name The name of the extra data, with package prefix. |
| 8799 | * @param value The boolean array data value. |
| 8800 | * |
| 8801 | * @return Returns the same Intent object, for chaining multiple calls |
| 8802 | * into a single statement. |
| 8803 | * |
| 8804 | * @see #putExtras |
| 8805 | * @see #removeExtra |
| 8806 | * @see #getBooleanArrayExtra(String) |
| 8807 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8808 | public @NonNull Intent putExtra(String name, @Nullable boolean[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8809 | if (mExtras == null) { |
| 8810 | mExtras = new Bundle(); |
| 8811 | } |
| 8812 | mExtras.putBooleanArray(name, value); |
| 8813 | return this; |
| 8814 | } |
| 8815 | |
| 8816 | /** |
| 8817 | * Add extended data to the intent. The name must include a package |
| 8818 | * prefix, for example the app com.android.contacts would use names |
| 8819 | * like "com.android.contacts.ShowAll". |
| 8820 | * |
| 8821 | * @param name The name of the extra data, with package prefix. |
| 8822 | * @param value The byte array data value. |
| 8823 | * |
| 8824 | * @return Returns the same Intent object, for chaining multiple calls |
| 8825 | * into a single statement. |
| 8826 | * |
| 8827 | * @see #putExtras |
| 8828 | * @see #removeExtra |
| 8829 | * @see #getByteArrayExtra(String) |
| 8830 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8831 | public @NonNull Intent putExtra(String name, @Nullable byte[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8832 | if (mExtras == null) { |
| 8833 | mExtras = new Bundle(); |
| 8834 | } |
| 8835 | mExtras.putByteArray(name, value); |
| 8836 | return this; |
| 8837 | } |
| 8838 | |
| 8839 | /** |
| 8840 | * Add extended data to the intent. The name must include a package |
| 8841 | * prefix, for example the app com.android.contacts would use names |
| 8842 | * like "com.android.contacts.ShowAll". |
| 8843 | * |
| 8844 | * @param name The name of the extra data, with package prefix. |
| 8845 | * @param value The short array data value. |
| 8846 | * |
| 8847 | * @return Returns the same Intent object, for chaining multiple calls |
| 8848 | * into a single statement. |
| 8849 | * |
| 8850 | * @see #putExtras |
| 8851 | * @see #removeExtra |
| 8852 | * @see #getShortArrayExtra(String) |
| 8853 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8854 | public @NonNull Intent putExtra(String name, @Nullable short[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8855 | if (mExtras == null) { |
| 8856 | mExtras = new Bundle(); |
| 8857 | } |
| 8858 | mExtras.putShortArray(name, value); |
| 8859 | return this; |
| 8860 | } |
| 8861 | |
| 8862 | /** |
| 8863 | * Add extended data to the intent. The name must include a package |
| 8864 | * prefix, for example the app com.android.contacts would use names |
| 8865 | * like "com.android.contacts.ShowAll". |
| 8866 | * |
| 8867 | * @param name The name of the extra data, with package prefix. |
| 8868 | * @param value The char array data value. |
| 8869 | * |
| 8870 | * @return Returns the same Intent object, for chaining multiple calls |
| 8871 | * into a single statement. |
| 8872 | * |
| 8873 | * @see #putExtras |
| 8874 | * @see #removeExtra |
| 8875 | * @see #getCharArrayExtra(String) |
| 8876 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8877 | public @NonNull Intent putExtra(String name, @Nullable char[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8878 | if (mExtras == null) { |
| 8879 | mExtras = new Bundle(); |
| 8880 | } |
| 8881 | mExtras.putCharArray(name, value); |
| 8882 | return this; |
| 8883 | } |
| 8884 | |
| 8885 | /** |
| 8886 | * Add extended data to the intent. The name must include a package |
| 8887 | * prefix, for example the app com.android.contacts would use names |
| 8888 | * like "com.android.contacts.ShowAll". |
| 8889 | * |
| 8890 | * @param name The name of the extra data, with package prefix. |
| 8891 | * @param value The int array data value. |
| 8892 | * |
| 8893 | * @return Returns the same Intent object, for chaining multiple calls |
| 8894 | * into a single statement. |
| 8895 | * |
| 8896 | * @see #putExtras |
| 8897 | * @see #removeExtra |
| 8898 | * @see #getIntArrayExtra(String) |
| 8899 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8900 | public @NonNull Intent putExtra(String name, @Nullable int[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8901 | if (mExtras == null) { |
| 8902 | mExtras = new Bundle(); |
| 8903 | } |
| 8904 | mExtras.putIntArray(name, value); |
| 8905 | return this; |
| 8906 | } |
| 8907 | |
| 8908 | /** |
| 8909 | * Add extended data to the intent. The name must include a package |
| 8910 | * prefix, for example the app com.android.contacts would use names |
| 8911 | * like "com.android.contacts.ShowAll". |
| 8912 | * |
| 8913 | * @param name The name of the extra data, with package prefix. |
| 8914 | * @param value The byte array data value. |
| 8915 | * |
| 8916 | * @return Returns the same Intent object, for chaining multiple calls |
| 8917 | * into a single statement. |
| 8918 | * |
| 8919 | * @see #putExtras |
| 8920 | * @see #removeExtra |
| 8921 | * @see #getLongArrayExtra(String) |
| 8922 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8923 | public @NonNull Intent putExtra(String name, @Nullable long[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8924 | if (mExtras == null) { |
| 8925 | mExtras = new Bundle(); |
| 8926 | } |
| 8927 | mExtras.putLongArray(name, value); |
| 8928 | return this; |
| 8929 | } |
| 8930 | |
| 8931 | /** |
| 8932 | * Add extended data to the intent. The name must include a package |
| 8933 | * prefix, for example the app com.android.contacts would use names |
| 8934 | * like "com.android.contacts.ShowAll". |
| 8935 | * |
| 8936 | * @param name The name of the extra data, with package prefix. |
| 8937 | * @param value The float array data value. |
| 8938 | * |
| 8939 | * @return Returns the same Intent object, for chaining multiple calls |
| 8940 | * into a single statement. |
| 8941 | * |
| 8942 | * @see #putExtras |
| 8943 | * @see #removeExtra |
| 8944 | * @see #getFloatArrayExtra(String) |
| 8945 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8946 | public @NonNull Intent putExtra(String name, @Nullable float[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8947 | if (mExtras == null) { |
| 8948 | mExtras = new Bundle(); |
| 8949 | } |
| 8950 | mExtras.putFloatArray(name, value); |
| 8951 | return this; |
| 8952 | } |
| 8953 | |
| 8954 | /** |
| 8955 | * Add extended data to the intent. The name must include a package |
| 8956 | * prefix, for example the app com.android.contacts would use names |
| 8957 | * like "com.android.contacts.ShowAll". |
| 8958 | * |
| 8959 | * @param name The name of the extra data, with package prefix. |
| 8960 | * @param value The double array data value. |
| 8961 | * |
| 8962 | * @return Returns the same Intent object, for chaining multiple calls |
| 8963 | * into a single statement. |
| 8964 | * |
| 8965 | * @see #putExtras |
| 8966 | * @see #removeExtra |
| 8967 | * @see #getDoubleArrayExtra(String) |
| 8968 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8969 | public @NonNull Intent putExtra(String name, @Nullable double[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8970 | if (mExtras == null) { |
| 8971 | mExtras = new Bundle(); |
| 8972 | } |
| 8973 | mExtras.putDoubleArray(name, value); |
| 8974 | return this; |
| 8975 | } |
| 8976 | |
| 8977 | /** |
| 8978 | * Add extended data to the intent. The name must include a package |
| 8979 | * prefix, for example the app com.android.contacts would use names |
| 8980 | * like "com.android.contacts.ShowAll". |
| 8981 | * |
| 8982 | * @param name The name of the extra data, with package prefix. |
| 8983 | * @param value The String array data value. |
| 8984 | * |
| 8985 | * @return Returns the same Intent object, for chaining multiple calls |
| 8986 | * into a single statement. |
| 8987 | * |
| 8988 | * @see #putExtras |
| 8989 | * @see #removeExtra |
| 8990 | * @see #getStringArrayExtra(String) |
| 8991 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 8992 | public @NonNull Intent putExtra(String name, @Nullable String[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8993 | if (mExtras == null) { |
| 8994 | mExtras = new Bundle(); |
| 8995 | } |
| 8996 | mExtras.putStringArray(name, value); |
| 8997 | return this; |
| 8998 | } |
| 8999 | |
| 9000 | /** |
| 9001 | * Add extended data to the intent. The name must include a package |
| 9002 | * prefix, for example the app com.android.contacts would use names |
| 9003 | * like "com.android.contacts.ShowAll". |
| 9004 | * |
| 9005 | * @param name The name of the extra data, with package prefix. |
Bjorn Bringert | 08bbffb | 2010-02-25 11:16:22 +0000 | [diff] [blame] | 9006 | * @param value The CharSequence array data value. |
| 9007 | * |
| 9008 | * @return Returns the same Intent object, for chaining multiple calls |
| 9009 | * into a single statement. |
| 9010 | * |
| 9011 | * @see #putExtras |
| 9012 | * @see #removeExtra |
| 9013 | * @see #getCharSequenceArrayExtra(String) |
| 9014 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 9015 | public @NonNull Intent putExtra(String name, @Nullable CharSequence[] value) { |
Bjorn Bringert | 08bbffb | 2010-02-25 11:16:22 +0000 | [diff] [blame] | 9016 | if (mExtras == null) { |
| 9017 | mExtras = new Bundle(); |
| 9018 | } |
| 9019 | mExtras.putCharSequenceArray(name, value); |
| 9020 | return this; |
| 9021 | } |
| 9022 | |
| 9023 | /** |
| 9024 | * Add extended data to the intent. The name must include a package |
| 9025 | * prefix, for example the app com.android.contacts would use names |
| 9026 | * like "com.android.contacts.ShowAll". |
| 9027 | * |
| 9028 | * @param name The name of the extra data, with package prefix. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9029 | * @param value The Bundle data value. |
| 9030 | * |
| 9031 | * @return Returns the same Intent object, for chaining multiple calls |
| 9032 | * into a single statement. |
| 9033 | * |
| 9034 | * @see #putExtras |
| 9035 | * @see #removeExtra |
| 9036 | * @see #getBundleExtra(String) |
| 9037 | */ |
Andrey Kulikov | 641c15c | 2018-11-13 16:44:40 +0000 | [diff] [blame] | 9038 | public @NonNull Intent putExtra(String name, @Nullable Bundle value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9039 | if (mExtras == null) { |
| 9040 | mExtras = new Bundle(); |
| 9041 | } |
| 9042 | mExtras.putBundle(name, value); |
| 9043 | return this; |
| 9044 | } |
| 9045 | |
| 9046 | /** |
| 9047 | * Add extended data to the intent. The name must include a package |
| 9048 | * prefix, for example the app com.android.contacts would use names |
| 9049 | * like "com.android.contacts.ShowAll". |
| 9050 | * |
| 9051 | * @param name The name of the extra data, with package prefix. |
| 9052 | * @param value The IBinder data value. |
| 9053 | * |
| 9054 | * @return Returns the same Intent object, for chaining multiple calls |
| 9055 | * into a single statement. |
| 9056 | * |
| 9057 | * @see #putExtras |
| 9058 | * @see #removeExtra |
| 9059 | * @see #getIBinderExtra(String) |
| 9060 | * |
| 9061 | * @deprecated |
| 9062 | * @hide |
| 9063 | */ |
| 9064 | @Deprecated |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 9065 | @UnsupportedAppUsage |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9066 | public @NonNull Intent putExtra(String name, IBinder value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9067 | if (mExtras == null) { |
| 9068 | mExtras = new Bundle(); |
| 9069 | } |
| 9070 | mExtras.putIBinder(name, value); |
| 9071 | return this; |
| 9072 | } |
| 9073 | |
| 9074 | /** |
| 9075 | * Copy all extras in 'src' in to this intent. |
| 9076 | * |
| 9077 | * @param src Contains the extras to copy. |
| 9078 | * |
| 9079 | * @see #putExtra |
| 9080 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9081 | public @NonNull Intent putExtras(@NonNull Intent src) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9082 | if (src.mExtras != null) { |
| 9083 | if (mExtras == null) { |
| 9084 | mExtras = new Bundle(src.mExtras); |
| 9085 | } else { |
| 9086 | mExtras.putAll(src.mExtras); |
| 9087 | } |
| 9088 | } |
| 9089 | return this; |
| 9090 | } |
| 9091 | |
| 9092 | /** |
| 9093 | * Add a set of extended data to the intent. The keys must include a package |
| 9094 | * prefix, for example the app com.android.contacts would use names |
| 9095 | * like "com.android.contacts.ShowAll". |
| 9096 | * |
| 9097 | * @param extras The Bundle of extras to add to this intent. |
| 9098 | * |
| 9099 | * @see #putExtra |
| 9100 | * @see #removeExtra |
| 9101 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9102 | public @NonNull Intent putExtras(@NonNull Bundle extras) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9103 | if (mExtras == null) { |
| 9104 | mExtras = new Bundle(); |
| 9105 | } |
| 9106 | mExtras.putAll(extras); |
| 9107 | return this; |
| 9108 | } |
| 9109 | |
| 9110 | /** |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 9111 | * Completely replace the extras in the Intent with the extras in the |
| 9112 | * given Intent. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 9113 | * |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 9114 | * @param src The exact extras contained in this Intent are copied |
| 9115 | * into the target intent, replacing any that were previously there. |
| 9116 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9117 | public @NonNull Intent replaceExtras(@NonNull Intent src) { |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 9118 | mExtras = src.mExtras != null ? new Bundle(src.mExtras) : null; |
| 9119 | return this; |
| 9120 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 9121 | |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 9122 | /** |
| 9123 | * Completely replace the extras in the Intent with the given Bundle of |
| 9124 | * extras. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 9125 | * |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 9126 | * @param extras The new set of extras in the Intent, or null to erase |
| 9127 | * all extras. |
| 9128 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9129 | public @NonNull Intent replaceExtras(@NonNull Bundle extras) { |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 9130 | mExtras = extras != null ? new Bundle(extras) : null; |
| 9131 | return this; |
| 9132 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 9133 | |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 9134 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9135 | * Remove extended data from the intent. |
| 9136 | * |
| 9137 | * @see #putExtra |
| 9138 | */ |
| 9139 | public void removeExtra(String name) { |
| 9140 | if (mExtras != null) { |
| 9141 | mExtras.remove(name); |
| 9142 | if (mExtras.size() == 0) { |
| 9143 | mExtras = null; |
| 9144 | } |
| 9145 | } |
| 9146 | } |
| 9147 | |
| 9148 | /** |
| 9149 | * Set special flags controlling how this intent is handled. Most values |
| 9150 | * here depend on the type of component being executed by the Intent, |
| 9151 | * specifically the FLAG_ACTIVITY_* flags are all for use with |
| 9152 | * {@link Context#startActivity Context.startActivity()} and the |
| 9153 | * FLAG_RECEIVER_* flags are all for use with |
| 9154 | * {@link Context#sendBroadcast(Intent) Context.sendBroadcast()}. |
| 9155 | * |
Scott Main | 7aee61f | 2011-02-08 11:25:01 -0800 | [diff] [blame] | 9156 | * <p>See the |
| 9157 | * <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back |
| 9158 | * Stack</a> documentation for important information on how some of these options impact |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9159 | * the behavior of your application. |
| 9160 | * |
| 9161 | * @param flags The desired flags. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9162 | * @return Returns the same Intent object, for chaining multiple calls |
| 9163 | * into a single statement. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9164 | * @see #getFlags |
| 9165 | * @see #addFlags |
Jeff Sharkey | 6a34e56 | 2016-12-21 09:56:00 -0700 | [diff] [blame] | 9166 | * @see #removeFlags |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9167 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9168 | public @NonNull Intent setFlags(@Flags int flags) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9169 | mFlags = flags; |
| 9170 | return this; |
| 9171 | } |
| 9172 | |
| 9173 | /** |
Jeff Sharkey | 6a34e56 | 2016-12-21 09:56:00 -0700 | [diff] [blame] | 9174 | * Add additional flags to the intent (or with existing flags value). |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9175 | * |
| 9176 | * @param flags The new flags to set. |
Jeff Sharkey | 6a34e56 | 2016-12-21 09:56:00 -0700 | [diff] [blame] | 9177 | * @return Returns the same Intent object, for chaining multiple calls into |
| 9178 | * a single statement. |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9179 | * @see #setFlags |
| 9180 | * @see #getFlags |
| 9181 | * @see #removeFlags |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9182 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9183 | public @NonNull Intent addFlags(@Flags int flags) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9184 | mFlags |= flags; |
| 9185 | return this; |
| 9186 | } |
| 9187 | |
| 9188 | /** |
Jeff Sharkey | 6a34e56 | 2016-12-21 09:56:00 -0700 | [diff] [blame] | 9189 | * Remove these flags from the intent. |
| 9190 | * |
| 9191 | * @param flags The flags to remove. |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9192 | * @see #setFlags |
| 9193 | * @see #getFlags |
| 9194 | * @see #addFlags |
Jeff Sharkey | 6a34e56 | 2016-12-21 09:56:00 -0700 | [diff] [blame] | 9195 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9196 | public void removeFlags(@Flags int flags) { |
Jeff Sharkey | 6a34e56 | 2016-12-21 09:56:00 -0700 | [diff] [blame] | 9197 | mFlags &= ~flags; |
| 9198 | } |
| 9199 | |
| 9200 | /** |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9201 | * (Usually optional) Set an explicit application package name that limits |
| 9202 | * the components this Intent will resolve to. If left to the default |
| 9203 | * value of null, all components in all applications will considered. |
| 9204 | * If non-null, the Intent can only match the components in the given |
| 9205 | * application package. |
| 9206 | * |
| 9207 | * @param packageName The name of the application package to handle the |
| 9208 | * intent, or null to allow any application package. |
| 9209 | * |
| 9210 | * @return Returns the same Intent object, for chaining multiple calls |
| 9211 | * into a single statement. |
| 9212 | * |
| 9213 | * @see #getPackage |
| 9214 | * @see #resolveActivity |
| 9215 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9216 | public @NonNull Intent setPackage(@Nullable String packageName) { |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9217 | if (packageName != null && mSelector != null) { |
| 9218 | throw new IllegalArgumentException( |
| 9219 | "Can't set package name when selector is already set"); |
| 9220 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9221 | mPackage = packageName; |
| 9222 | return this; |
| 9223 | } |
| 9224 | |
| 9225 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9226 | * (Usually optional) Explicitly set the component to handle the intent. |
| 9227 | * If left with the default value of null, the system will determine the |
| 9228 | * appropriate class to use based on the other fields (action, data, |
| 9229 | * type, categories) in the Intent. If this class is defined, the |
| 9230 | * specified class will always be used regardless of the other fields. You |
| 9231 | * should only set this value when you know you absolutely want a specific |
| 9232 | * class to be used; otherwise it is better to let the system find the |
| 9233 | * appropriate class so that you will respect the installed applications |
| 9234 | * and user preferences. |
| 9235 | * |
| 9236 | * @param component The name of the application component to handle the |
| 9237 | * intent, or null to let the system find one for you. |
| 9238 | * |
| 9239 | * @return Returns the same Intent object, for chaining multiple calls |
| 9240 | * into a single statement. |
| 9241 | * |
| 9242 | * @see #setClass |
| 9243 | * @see #setClassName(Context, String) |
| 9244 | * @see #setClassName(String, String) |
| 9245 | * @see #getComponent |
| 9246 | * @see #resolveActivity |
| 9247 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9248 | public @NonNull Intent setComponent(@Nullable ComponentName component) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9249 | mComponent = component; |
| 9250 | return this; |
| 9251 | } |
| 9252 | |
| 9253 | /** |
| 9254 | * Convenience for calling {@link #setComponent} with an |
| 9255 | * explicit class name. |
| 9256 | * |
| 9257 | * @param packageContext A Context of the application package implementing |
| 9258 | * this class. |
| 9259 | * @param className The name of a class inside of the application package |
| 9260 | * that will be used as the component for this Intent. |
| 9261 | * |
| 9262 | * @return Returns the same Intent object, for chaining multiple calls |
| 9263 | * into a single statement. |
| 9264 | * |
| 9265 | * @see #setComponent |
| 9266 | * @see #setClass |
| 9267 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9268 | public @NonNull Intent setClassName(@NonNull Context packageContext, |
| 9269 | @NonNull String className) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9270 | mComponent = new ComponentName(packageContext, className); |
| 9271 | return this; |
| 9272 | } |
| 9273 | |
| 9274 | /** |
| 9275 | * Convenience for calling {@link #setComponent} with an |
| 9276 | * explicit application package name and class name. |
| 9277 | * |
| 9278 | * @param packageName The name of the package implementing the desired |
| 9279 | * component. |
| 9280 | * @param className The name of a class inside of the application package |
| 9281 | * that will be used as the component for this Intent. |
| 9282 | * |
| 9283 | * @return Returns the same Intent object, for chaining multiple calls |
| 9284 | * into a single statement. |
| 9285 | * |
| 9286 | * @see #setComponent |
| 9287 | * @see #setClass |
| 9288 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9289 | public @NonNull Intent setClassName(@NonNull String packageName, @NonNull String className) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9290 | mComponent = new ComponentName(packageName, className); |
| 9291 | return this; |
| 9292 | } |
| 9293 | |
| 9294 | /** |
| 9295 | * Convenience for calling {@link #setComponent(ComponentName)} with the |
| 9296 | * name returned by a {@link Class} object. |
| 9297 | * |
| 9298 | * @param packageContext A Context of the application package implementing |
| 9299 | * this class. |
| 9300 | * @param cls The class name to set, equivalent to |
| 9301 | * <code>setClassName(context, cls.getName())</code>. |
| 9302 | * |
| 9303 | * @return Returns the same Intent object, for chaining multiple calls |
| 9304 | * into a single statement. |
| 9305 | * |
| 9306 | * @see #setComponent |
| 9307 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9308 | public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9309 | mComponent = new ComponentName(packageContext, cls); |
| 9310 | return this; |
| 9311 | } |
| 9312 | |
| 9313 | /** |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9314 | * Set the bounds of the sender of this intent, in screen coordinates. This can be |
| 9315 | * used as a hint to the receiver for animations and the like. Null means that there |
| 9316 | * is no source bounds. |
| 9317 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9318 | public void setSourceBounds(@Nullable Rect r) { |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9319 | if (r != null) { |
| 9320 | mSourceBounds = new Rect(r); |
| 9321 | } else { |
Daniel Lehmann | a5b58df | 2011-10-12 16:24:22 -0700 | [diff] [blame] | 9322 | mSourceBounds = null; |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9323 | } |
| 9324 | } |
| 9325 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 9326 | /** @hide */ |
Jeff Sharkey | ce8db99 | 2017-12-13 20:05:05 -0700 | [diff] [blame] | 9327 | @IntDef(flag = true, prefix = { "FILL_IN_" }, value = { |
| 9328 | FILL_IN_ACTION, |
| 9329 | FILL_IN_DATA, |
| 9330 | FILL_IN_CATEGORIES, |
| 9331 | FILL_IN_COMPONENT, |
| 9332 | FILL_IN_PACKAGE, |
| 9333 | FILL_IN_SOURCE_BOUNDS, |
| 9334 | FILL_IN_SELECTOR, |
| 9335 | FILL_IN_CLIP_DATA |
| 9336 | }) |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 9337 | @Retention(RetentionPolicy.SOURCE) |
| 9338 | public @interface FillInFlags {} |
| 9339 | |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9340 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9341 | * Use with {@link #fillIn} to allow the current action value to be |
| 9342 | * overwritten, even if it is already set. |
| 9343 | */ |
| 9344 | public static final int FILL_IN_ACTION = 1<<0; |
| 9345 | |
| 9346 | /** |
| 9347 | * Use with {@link #fillIn} to allow the current data or type value |
| 9348 | * overwritten, even if it is already set. |
| 9349 | */ |
| 9350 | public static final int FILL_IN_DATA = 1<<1; |
| 9351 | |
| 9352 | /** |
| 9353 | * Use with {@link #fillIn} to allow the current categories to be |
| 9354 | * overwritten, even if they are already set. |
| 9355 | */ |
| 9356 | public static final int FILL_IN_CATEGORIES = 1<<2; |
| 9357 | |
| 9358 | /** |
| 9359 | * Use with {@link #fillIn} to allow the current component value to be |
| 9360 | * overwritten, even if it is already set. |
| 9361 | */ |
| 9362 | public static final int FILL_IN_COMPONENT = 1<<3; |
| 9363 | |
| 9364 | /** |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9365 | * Use with {@link #fillIn} to allow the current package value to be |
| 9366 | * overwritten, even if it is already set. |
| 9367 | */ |
| 9368 | public static final int FILL_IN_PACKAGE = 1<<4; |
| 9369 | |
| 9370 | /** |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9371 | * Use with {@link #fillIn} to allow the current bounds rectangle to be |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9372 | * overwritten, even if it is already set. |
| 9373 | */ |
| 9374 | public static final int FILL_IN_SOURCE_BOUNDS = 1<<5; |
| 9375 | |
| 9376 | /** |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9377 | * Use with {@link #fillIn} to allow the current selector to be |
| 9378 | * overwritten, even if it is already set. |
| 9379 | */ |
| 9380 | public static final int FILL_IN_SELECTOR = 1<<6; |
| 9381 | |
| 9382 | /** |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9383 | * Use with {@link #fillIn} to allow the current ClipData to be |
| 9384 | * overwritten, even if it is already set. |
| 9385 | */ |
| 9386 | public static final int FILL_IN_CLIP_DATA = 1<<7; |
| 9387 | |
| 9388 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9389 | * Copy the contents of <var>other</var> in to this object, but only |
| 9390 | * where fields are not defined by this object. For purposes of a field |
| 9391 | * being defined, the following pieces of data in the Intent are |
| 9392 | * considered to be separate fields: |
| 9393 | * |
| 9394 | * <ul> |
| 9395 | * <li> action, as set by {@link #setAction}. |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 9396 | * <li> data Uri and MIME type, as set by {@link #setData(Uri)}, |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9397 | * {@link #setType(String)}, or {@link #setDataAndType(Uri, String)}. |
| 9398 | * <li> categories, as set by {@link #addCategory}. |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9399 | * <li> package, as set by {@link #setPackage}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9400 | * <li> component, as set by {@link #setComponent(ComponentName)} or |
| 9401 | * related methods. |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9402 | * <li> source bounds, as set by {@link #setSourceBounds}. |
| 9403 | * <li> selector, as set by {@link #setSelector(Intent)}. |
| 9404 | * <li> clip data, as set by {@link #setClipData(ClipData)}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9405 | * <li> each top-level name in the associated extras. |
| 9406 | * </ul> |
| 9407 | * |
| 9408 | * <p>In addition, you can use the {@link #FILL_IN_ACTION}, |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9409 | * {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE}, |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9410 | * {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS}, |
| 9411 | * {@link #FILL_IN_SELECTOR}, and {@link #FILL_IN_CLIP_DATA} to override |
| 9412 | * the restriction where the corresponding field will not be replaced if |
| 9413 | * it is already set. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9414 | * |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9415 | * <p>Note: The component field will only be copied if {@link #FILL_IN_COMPONENT} |
| 9416 | * is explicitly specified. The selector will only be copied if |
| 9417 | * {@link #FILL_IN_SELECTOR} is explicitly specified. |
Brett Chabot | 3e39175 | 2009-07-21 16:07:23 -0700 | [diff] [blame] | 9418 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9419 | * <p>For example, consider Intent A with {data="foo", categories="bar"} |
| 9420 | * and Intent B with {action="gotit", data-type="some/thing", |
| 9421 | * categories="one","two"}. |
| 9422 | * |
| 9423 | * <p>Calling A.fillIn(B, Intent.FILL_IN_DATA) will result in A now |
| 9424 | * containing: {action="gotit", data-type="some/thing", |
| 9425 | * categories="bar"}. |
| 9426 | * |
| 9427 | * @param other Another Intent whose values are to be used to fill in |
| 9428 | * the current one. |
| 9429 | * @param flags Options to control which fields can be filled in. |
| 9430 | * |
| 9431 | * @return Returns a bit mask of {@link #FILL_IN_ACTION}, |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9432 | * {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE}, |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 9433 | * {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS}, |
Elliot Waite | 54de774 | 2017-01-11 15:30:35 -0800 | [diff] [blame] | 9434 | * {@link #FILL_IN_SELECTOR} and {@link #FILL_IN_CLIP_DATA} indicating which fields were |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 9435 | * changed. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9436 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 9437 | @FillInFlags |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9438 | public int fillIn(@NonNull Intent other, @FillInFlags int flags) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9439 | int changes = 0; |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9440 | boolean mayHaveCopiedUris = false; |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9441 | if (other.mAction != null |
| 9442 | && (mAction == null || (flags&FILL_IN_ACTION) != 0)) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9443 | mAction = other.mAction; |
| 9444 | changes |= FILL_IN_ACTION; |
| 9445 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9446 | if ((other.mData != null || other.mType != null) |
| 9447 | && ((mData == null && mType == null) |
| 9448 | || (flags&FILL_IN_DATA) != 0)) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9449 | mData = other.mData; |
| 9450 | mType = other.mType; |
| 9451 | changes |= FILL_IN_DATA; |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9452 | mayHaveCopiedUris = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9453 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9454 | if (other.mCategories != null |
| 9455 | && (mCategories == null || (flags&FILL_IN_CATEGORIES) != 0)) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9456 | if (other.mCategories != null) { |
Dianne Hackborn | add005c | 2013-07-17 18:43:12 -0700 | [diff] [blame] | 9457 | mCategories = new ArraySet<String>(other.mCategories); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9458 | } |
| 9459 | changes |= FILL_IN_CATEGORIES; |
| 9460 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9461 | if (other.mPackage != null |
| 9462 | && (mPackage == null || (flags&FILL_IN_PACKAGE) != 0)) { |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9463 | // Only do this if mSelector is not set. |
| 9464 | if (mSelector == null) { |
| 9465 | mPackage = other.mPackage; |
| 9466 | changes |= FILL_IN_PACKAGE; |
| 9467 | } |
| 9468 | } |
| 9469 | // Selector is special: it can only be set if explicitly allowed, |
| 9470 | // for the same reason as the component name. |
| 9471 | if (other.mSelector != null && (flags&FILL_IN_SELECTOR) != 0) { |
| 9472 | if (mPackage == null) { |
| 9473 | mSelector = new Intent(other.mSelector); |
| 9474 | mPackage = null; |
| 9475 | changes |= FILL_IN_SELECTOR; |
| 9476 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9477 | } |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9478 | if (other.mClipData != null |
| 9479 | && (mClipData == null || (flags&FILL_IN_CLIP_DATA) != 0)) { |
| 9480 | mClipData = other.mClipData; |
| 9481 | changes |= FILL_IN_CLIP_DATA; |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9482 | mayHaveCopiedUris = true; |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9483 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9484 | // Component is special: it can -only- be set if explicitly allowed, |
| 9485 | // since otherwise the sender could force the intent somewhere the |
| 9486 | // originator didn't intend. |
| 9487 | if (other.mComponent != null && (flags&FILL_IN_COMPONENT) != 0) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9488 | mComponent = other.mComponent; |
| 9489 | changes |= FILL_IN_COMPONENT; |
| 9490 | } |
| 9491 | mFlags |= other.mFlags; |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9492 | if (other.mSourceBounds != null |
| 9493 | && (mSourceBounds == null || (flags&FILL_IN_SOURCE_BOUNDS) != 0)) { |
| 9494 | mSourceBounds = new Rect(other.mSourceBounds); |
| 9495 | changes |= FILL_IN_SOURCE_BOUNDS; |
| 9496 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9497 | if (mExtras == null) { |
| 9498 | if (other.mExtras != null) { |
| 9499 | mExtras = new Bundle(other.mExtras); |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9500 | mayHaveCopiedUris = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9501 | } |
| 9502 | } else if (other.mExtras != null) { |
| 9503 | try { |
| 9504 | Bundle newb = new Bundle(other.mExtras); |
| 9505 | newb.putAll(mExtras); |
| 9506 | mExtras = newb; |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9507 | mayHaveCopiedUris = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9508 | } catch (RuntimeException e) { |
| 9509 | // Modifying the extras can cause us to unparcel the contents |
| 9510 | // of the bundle, and if we do this in the system process that |
| 9511 | // may fail. We really should handle this (i.e., the Bundle |
| 9512 | // impl shouldn't be on top of a plain map), but for now just |
| 9513 | // ignore it and keep the original contents. :( |
| 9514 | Log.w("Intent", "Failure filling in extras", e); |
| 9515 | } |
| 9516 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9517 | if (mayHaveCopiedUris && mContentUserHint == UserHandle.USER_CURRENT |
| 9518 | && other.mContentUserHint != UserHandle.USER_CURRENT) { |
| 9519 | mContentUserHint = other.mContentUserHint; |
| 9520 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9521 | return changes; |
| 9522 | } |
| 9523 | |
| 9524 | /** |
| 9525 | * Wrapper class holding an Intent and implementing comparisons on it for |
| 9526 | * the purpose of filtering. The class implements its |
| 9527 | * {@link #equals equals()} and {@link #hashCode hashCode()} methods as |
| 9528 | * simple calls to {@link Intent#filterEquals(Intent)} filterEquals()} and |
| 9529 | * {@link android.content.Intent#filterHashCode()} filterHashCode()} |
| 9530 | * on the wrapped Intent. |
| 9531 | */ |
| 9532 | public static final class FilterComparison { |
| 9533 | private final Intent mIntent; |
| 9534 | private final int mHashCode; |
| 9535 | |
| 9536 | public FilterComparison(Intent intent) { |
| 9537 | mIntent = intent; |
| 9538 | mHashCode = intent.filterHashCode(); |
| 9539 | } |
| 9540 | |
| 9541 | /** |
| 9542 | * Return the Intent that this FilterComparison represents. |
| 9543 | * @return Returns the Intent held by the FilterComparison. Do |
| 9544 | * not modify! |
| 9545 | */ |
| 9546 | public Intent getIntent() { |
| 9547 | return mIntent; |
| 9548 | } |
| 9549 | |
| 9550 | @Override |
| 9551 | public boolean equals(Object obj) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 9552 | if (obj instanceof FilterComparison) { |
| 9553 | Intent other = ((FilterComparison)obj).mIntent; |
| 9554 | return mIntent.filterEquals(other); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9555 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 9556 | return false; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9557 | } |
| 9558 | |
| 9559 | @Override |
| 9560 | public int hashCode() { |
| 9561 | return mHashCode; |
| 9562 | } |
| 9563 | } |
| 9564 | |
| 9565 | /** |
| 9566 | * Determine if two intents are the same for the purposes of intent |
| 9567 | * resolution (filtering). That is, if their action, data, type, |
| 9568 | * class, and categories are the same. This does <em>not</em> compare |
| 9569 | * any extra data included in the intents. |
| 9570 | * |
| 9571 | * @param other The other Intent to compare against. |
| 9572 | * |
| 9573 | * @return Returns true if action, data, type, class, and categories |
| 9574 | * are the same. |
| 9575 | */ |
| 9576 | public boolean filterEquals(Intent other) { |
| 9577 | if (other == null) { |
| 9578 | return false; |
| 9579 | } |
Christopher Tate | 63d9ae1 | 2014-06-19 19:07:26 -0700 | [diff] [blame] | 9580 | if (!Objects.equals(this.mAction, other.mAction)) return false; |
| 9581 | if (!Objects.equals(this.mData, other.mData)) return false; |
| 9582 | if (!Objects.equals(this.mType, other.mType)) return false; |
| 9583 | if (!Objects.equals(this.mPackage, other.mPackage)) return false; |
| 9584 | if (!Objects.equals(this.mComponent, other.mComponent)) return false; |
| 9585 | if (!Objects.equals(this.mCategories, other.mCategories)) return false; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9586 | |
| 9587 | return true; |
| 9588 | } |
| 9589 | |
| 9590 | /** |
| 9591 | * Generate hash code that matches semantics of filterEquals(). |
| 9592 | * |
| 9593 | * @return Returns the hash value of the action, data, type, class, and |
| 9594 | * categories. |
| 9595 | * |
| 9596 | * @see #filterEquals |
| 9597 | */ |
| 9598 | public int filterHashCode() { |
| 9599 | int code = 0; |
| 9600 | if (mAction != null) { |
| 9601 | code += mAction.hashCode(); |
| 9602 | } |
| 9603 | if (mData != null) { |
| 9604 | code += mData.hashCode(); |
| 9605 | } |
| 9606 | if (mType != null) { |
| 9607 | code += mType.hashCode(); |
| 9608 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9609 | if (mPackage != null) { |
| 9610 | code += mPackage.hashCode(); |
| 9611 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9612 | if (mComponent != null) { |
| 9613 | code += mComponent.hashCode(); |
| 9614 | } |
| 9615 | if (mCategories != null) { |
| 9616 | code += mCategories.hashCode(); |
| 9617 | } |
| 9618 | return code; |
| 9619 | } |
| 9620 | |
| 9621 | @Override |
| 9622 | public String toString() { |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 9623 | StringBuilder b = new StringBuilder(128); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9624 | |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9625 | b.append("Intent { "); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9626 | toShortString(b, true, true, true, false); |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9627 | b.append(" }"); |
| 9628 | |
| 9629 | return b.toString(); |
| 9630 | } |
| 9631 | |
| 9632 | /** @hide */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 9633 | @UnsupportedAppUsage |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 9634 | public String toInsecureString() { |
| 9635 | StringBuilder b = new StringBuilder(128); |
| 9636 | |
| 9637 | b.append("Intent { "); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9638 | toShortString(b, false, true, true, false); |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 9639 | b.append(" }"); |
| 9640 | |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9641 | return b.toString(); |
| 9642 | } |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 9643 | |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9644 | /** @hide */ |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9645 | public String toInsecureStringWithClip() { |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 9646 | StringBuilder b = new StringBuilder(128); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9647 | |
| 9648 | b.append("Intent { "); |
| 9649 | toShortString(b, false, true, true, true); |
| 9650 | b.append(" }"); |
| 9651 | |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 9652 | return b.toString(); |
| 9653 | } |
| 9654 | |
| 9655 | /** @hide */ |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9656 | public String toShortString(boolean secure, boolean comp, boolean extras, boolean clip) { |
| 9657 | StringBuilder b = new StringBuilder(128); |
| 9658 | toShortString(b, secure, comp, extras, clip); |
| 9659 | return b.toString(); |
| 9660 | } |
| 9661 | |
| 9662 | /** @hide */ |
| 9663 | public void toShortString(StringBuilder b, boolean secure, boolean comp, boolean extras, |
| 9664 | boolean clip) { |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9665 | boolean first = true; |
| 9666 | if (mAction != null) { |
| 9667 | b.append("act=").append(mAction); |
| 9668 | first = false; |
| 9669 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9670 | if (mCategories != null) { |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9671 | if (!first) { |
| 9672 | b.append(' '); |
| 9673 | } |
| 9674 | first = false; |
| 9675 | b.append("cat=["); |
Dianne Hackborn | add005c | 2013-07-17 18:43:12 -0700 | [diff] [blame] | 9676 | for (int i=0; i<mCategories.size(); i++) { |
| 9677 | if (i > 0) b.append(','); |
| 9678 | b.append(mCategories.valueAt(i)); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9679 | } |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9680 | b.append("]"); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9681 | } |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9682 | if (mData != null) { |
| 9683 | if (!first) { |
| 9684 | b.append(' '); |
| 9685 | } |
| 9686 | first = false; |
Wink Saville | a428807 | 2010-10-12 12:36:38 -0700 | [diff] [blame] | 9687 | b.append("dat="); |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 9688 | if (secure) { |
| 9689 | b.append(mData.toSafeString()); |
Wink Saville | a428807 | 2010-10-12 12:36:38 -0700 | [diff] [blame] | 9690 | } else { |
| 9691 | b.append(mData); |
| 9692 | } |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9693 | } |
| 9694 | if (mType != null) { |
| 9695 | if (!first) { |
| 9696 | b.append(' '); |
| 9697 | } |
| 9698 | first = false; |
| 9699 | b.append("typ=").append(mType); |
| 9700 | } |
| 9701 | if (mFlags != 0) { |
| 9702 | if (!first) { |
| 9703 | b.append(' '); |
| 9704 | } |
| 9705 | first = false; |
| 9706 | b.append("flg=0x").append(Integer.toHexString(mFlags)); |
| 9707 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9708 | if (mPackage != null) { |
| 9709 | if (!first) { |
| 9710 | b.append(' '); |
| 9711 | } |
| 9712 | first = false; |
| 9713 | b.append("pkg=").append(mPackage); |
| 9714 | } |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9715 | if (comp && mComponent != null) { |
| 9716 | if (!first) { |
| 9717 | b.append(' '); |
| 9718 | } |
| 9719 | first = false; |
| 9720 | b.append("cmp=").append(mComponent.flattenToShortString()); |
| 9721 | } |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9722 | if (mSourceBounds != null) { |
| 9723 | if (!first) { |
| 9724 | b.append(' '); |
| 9725 | } |
| 9726 | first = false; |
| 9727 | b.append("bnds=").append(mSourceBounds.toShortString()); |
| 9728 | } |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9729 | if (mClipData != null) { |
| 9730 | if (!first) { |
| 9731 | b.append(' '); |
| 9732 | } |
Dianne Hackborn | ae49872 | 2015-08-14 13:29:47 -0700 | [diff] [blame] | 9733 | b.append("clip={"); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9734 | if (clip) { |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9735 | mClipData.toShortString(b); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9736 | } else { |
Dianne Hackborn | ae49872 | 2015-08-14 13:29:47 -0700 | [diff] [blame] | 9737 | if (mClipData.getDescription() != null) { |
| 9738 | first = !mClipData.getDescription().toShortStringTypesOnly(b); |
| 9739 | } else { |
| 9740 | first = true; |
| 9741 | } |
| 9742 | mClipData.toShortStringShortItems(b, first); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9743 | } |
Dianne Hackborn | ae49872 | 2015-08-14 13:29:47 -0700 | [diff] [blame] | 9744 | first = false; |
| 9745 | b.append('}'); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9746 | } |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9747 | if (extras && mExtras != null) { |
| 9748 | if (!first) { |
| 9749 | b.append(' '); |
| 9750 | } |
| 9751 | first = false; |
| 9752 | b.append("(has extras)"); |
| 9753 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9754 | if (mContentUserHint != UserHandle.USER_CURRENT) { |
| 9755 | if (!first) { |
| 9756 | b.append(' '); |
| 9757 | } |
| 9758 | first = false; |
| 9759 | b.append("u=").append(mContentUserHint); |
| 9760 | } |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9761 | if (mSelector != null) { |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9762 | b.append(" sel="); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9763 | mSelector.toShortString(b, secure, comp, extras, clip); |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9764 | b.append("}"); |
| 9765 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9766 | } |
| 9767 | |
Yi Jin | 129fc6c | 2017-09-28 15:48:38 -0700 | [diff] [blame] | 9768 | /** @hide */ |
Kweku Adams | 85f2fbc | 2017-12-18 12:04:12 -0800 | [diff] [blame] | 9769 | public void writeToProto(ProtoOutputStream proto, long fieldId) { |
| 9770 | // Same input parameters that toString() gives to toShortString(). |
| 9771 | writeToProto(proto, fieldId, true, true, true, false); |
| 9772 | } |
| 9773 | |
| 9774 | /** @hide */ |
Yi Jin | 129fc6c | 2017-09-28 15:48:38 -0700 | [diff] [blame] | 9775 | public void writeToProto(ProtoOutputStream proto, long fieldId, boolean secure, boolean comp, |
| 9776 | boolean extras, boolean clip) { |
| 9777 | long token = proto.start(fieldId); |
| 9778 | if (mAction != null) { |
| 9779 | proto.write(IntentProto.ACTION, mAction); |
| 9780 | } |
| 9781 | if (mCategories != null) { |
| 9782 | for (String category : mCategories) { |
| 9783 | proto.write(IntentProto.CATEGORIES, category); |
| 9784 | } |
| 9785 | } |
| 9786 | if (mData != null) { |
| 9787 | proto.write(IntentProto.DATA, secure ? mData.toSafeString() : mData.toString()); |
| 9788 | } |
| 9789 | if (mType != null) { |
| 9790 | proto.write(IntentProto.TYPE, mType); |
| 9791 | } |
| 9792 | if (mFlags != 0) { |
| 9793 | proto.write(IntentProto.FLAG, "0x" + Integer.toHexString(mFlags)); |
| 9794 | } |
| 9795 | if (mPackage != null) { |
| 9796 | proto.write(IntentProto.PACKAGE, mPackage); |
| 9797 | } |
| 9798 | if (comp && mComponent != null) { |
Yi Jin | 676d1ac | 2018-01-25 15:40:28 -0800 | [diff] [blame] | 9799 | mComponent.writeToProto(proto, IntentProto.COMPONENT); |
Yi Jin | 129fc6c | 2017-09-28 15:48:38 -0700 | [diff] [blame] | 9800 | } |
| 9801 | if (mSourceBounds != null) { |
| 9802 | proto.write(IntentProto.SOURCE_BOUNDS, mSourceBounds.toShortString()); |
| 9803 | } |
| 9804 | if (mClipData != null) { |
| 9805 | StringBuilder b = new StringBuilder(); |
| 9806 | if (clip) { |
| 9807 | mClipData.toShortString(b); |
| 9808 | } else { |
| 9809 | mClipData.toShortStringShortItems(b, false); |
| 9810 | } |
| 9811 | proto.write(IntentProto.CLIP_DATA, b.toString()); |
| 9812 | } |
| 9813 | if (extras && mExtras != null) { |
| 9814 | proto.write(IntentProto.EXTRAS, mExtras.toShortString()); |
| 9815 | } |
| 9816 | if (mContentUserHint != 0) { |
| 9817 | proto.write(IntentProto.CONTENT_USER_HINT, mContentUserHint); |
| 9818 | } |
| 9819 | if (mSelector != null) { |
| 9820 | proto.write(IntentProto.SELECTOR, mSelector.toShortString(secure, comp, extras, clip)); |
| 9821 | } |
| 9822 | proto.end(token); |
| 9823 | } |
| 9824 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9825 | /** |
| 9826 | * Call {@link #toUri} with 0 flags. |
| 9827 | * @deprecated Use {@link #toUri} instead. |
| 9828 | */ |
| 9829 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9830 | public String toURI() { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9831 | return toUri(0); |
| 9832 | } |
| 9833 | |
| 9834 | /** |
| 9835 | * Convert this Intent into a String holding a URI representation of it. |
| 9836 | * The returned URI string has been properly URI encoded, so it can be |
| 9837 | * used with {@link Uri#parse Uri.parse(String)}. The URI contains the |
| 9838 | * Intent's data as the base URI, with an additional fragment describing |
| 9839 | * the action, categories, type, flags, package, component, and extras. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 9840 | * |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9841 | * <p>You can convert the returned string back to an Intent with |
| 9842 | * {@link #getIntent}. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 9843 | * |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9844 | * @param flags Additional operating flags. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 9845 | * |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9846 | * @return Returns a URI encoding URI string describing the entire contents |
| 9847 | * of the Intent. |
| 9848 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9849 | public String toUri(@UriFlags int flags) { |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9850 | StringBuilder uri = new StringBuilder(128); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9851 | if ((flags&URI_ANDROID_APP_SCHEME) != 0) { |
| 9852 | if (mPackage == null) { |
| 9853 | throw new IllegalArgumentException( |
| 9854 | "Intent must include an explicit package name to build an android-app: " |
| 9855 | + this); |
| 9856 | } |
| 9857 | uri.append("android-app://"); |
| 9858 | uri.append(mPackage); |
| 9859 | String scheme = null; |
| 9860 | if (mData != null) { |
| 9861 | scheme = mData.getScheme(); |
| 9862 | if (scheme != null) { |
| 9863 | uri.append('/'); |
| 9864 | uri.append(scheme); |
| 9865 | String authority = mData.getEncodedAuthority(); |
| 9866 | if (authority != null) { |
| 9867 | uri.append('/'); |
| 9868 | uri.append(authority); |
| 9869 | String path = mData.getEncodedPath(); |
| 9870 | if (path != null) { |
| 9871 | uri.append(path); |
| 9872 | } |
| 9873 | String queryParams = mData.getEncodedQuery(); |
| 9874 | if (queryParams != null) { |
| 9875 | uri.append('?'); |
| 9876 | uri.append(queryParams); |
| 9877 | } |
| 9878 | String fragment = mData.getEncodedFragment(); |
| 9879 | if (fragment != null) { |
| 9880 | uri.append('#'); |
| 9881 | uri.append(fragment); |
| 9882 | } |
| 9883 | } |
| 9884 | } |
| 9885 | } |
| 9886 | toUriFragment(uri, null, scheme == null ? Intent.ACTION_MAIN : Intent.ACTION_VIEW, |
| 9887 | mPackage, flags); |
| 9888 | return uri.toString(); |
| 9889 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9890 | String scheme = null; |
| 9891 | if (mData != null) { |
| 9892 | String data = mData.toString(); |
| 9893 | if ((flags&URI_INTENT_SCHEME) != 0) { |
| 9894 | final int N = data.length(); |
| 9895 | for (int i=0; i<N; i++) { |
| 9896 | char c = data.charAt(i); |
| 9897 | if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') |
Christopher Schuster | 42c3a6e | 2017-07-21 14:53:52 -0700 | [diff] [blame] | 9898 | || (c >= '0' && c <= '9') || c == '.' || c == '-' || c == '+') { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9899 | continue; |
| 9900 | } |
| 9901 | if (c == ':' && i > 0) { |
| 9902 | // Valid scheme. |
| 9903 | scheme = data.substring(0, i); |
| 9904 | uri.append("intent:"); |
| 9905 | data = data.substring(i+1); |
| 9906 | break; |
| 9907 | } |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 9908 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9909 | // No scheme. |
| 9910 | break; |
| 9911 | } |
| 9912 | } |
| 9913 | uri.append(data); |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 9914 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9915 | } else if ((flags&URI_INTENT_SCHEME) != 0) { |
| 9916 | uri.append("intent:"); |
| 9917 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9918 | |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9919 | toUriFragment(uri, scheme, Intent.ACTION_VIEW, null, flags); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9920 | |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9921 | return uri.toString(); |
| 9922 | } |
| 9923 | |
| 9924 | private void toUriFragment(StringBuilder uri, String scheme, String defAction, |
| 9925 | String defPackage, int flags) { |
| 9926 | StringBuilder frag = new StringBuilder(128); |
| 9927 | |
| 9928 | toUriInner(frag, scheme, defAction, defPackage, flags); |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9929 | if (mSelector != null) { |
Dianne Hackborn | 80b1c56 | 2014-12-09 20:22:08 -0800 | [diff] [blame] | 9930 | frag.append("SEL;"); |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9931 | // Note that for now we are not going to try to handle the |
| 9932 | // data part; not clear how to represent this as a URI, and |
| 9933 | // not much utility in it. |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9934 | mSelector.toUriInner(frag, mSelector.mData != null ? mSelector.mData.getScheme() : null, |
| 9935 | null, null, flags); |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9936 | } |
| 9937 | |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9938 | if (frag.length() > 0) { |
| 9939 | uri.append("#Intent;"); |
| 9940 | uri.append(frag); |
| 9941 | uri.append("end"); |
| 9942 | } |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9943 | } |
| 9944 | |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9945 | private void toUriInner(StringBuilder uri, String scheme, String defAction, |
| 9946 | String defPackage, int flags) { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9947 | if (scheme != null) { |
| 9948 | uri.append("scheme=").append(scheme).append(';'); |
| 9949 | } |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9950 | if (mAction != null && !mAction.equals(defAction)) { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9951 | uri.append("action=").append(Uri.encode(mAction)).append(';'); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9952 | } |
| 9953 | if (mCategories != null) { |
Dianne Hackborn | add005c | 2013-07-17 18:43:12 -0700 | [diff] [blame] | 9954 | for (int i=0; i<mCategories.size(); i++) { |
| 9955 | uri.append("category=").append(Uri.encode(mCategories.valueAt(i))).append(';'); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9956 | } |
| 9957 | } |
| 9958 | if (mType != null) { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9959 | uri.append("type=").append(Uri.encode(mType, "/")).append(';'); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9960 | } |
| 9961 | if (mFlags != 0) { |
| 9962 | uri.append("launchFlags=0x").append(Integer.toHexString(mFlags)).append(';'); |
| 9963 | } |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9964 | if (mPackage != null && !mPackage.equals(defPackage)) { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9965 | uri.append("package=").append(Uri.encode(mPackage)).append(';'); |
| 9966 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9967 | if (mComponent != null) { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9968 | uri.append("component=").append(Uri.encode( |
| 9969 | mComponent.flattenToShortString(), "/")).append(';'); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9970 | } |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9971 | if (mSourceBounds != null) { |
| 9972 | uri.append("sourceBounds=") |
| 9973 | .append(Uri.encode(mSourceBounds.flattenToString())) |
| 9974 | .append(';'); |
| 9975 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9976 | if (mExtras != null) { |
| 9977 | for (String key : mExtras.keySet()) { |
| 9978 | final Object value = mExtras.get(key); |
| 9979 | char entryType = |
| 9980 | value instanceof String ? 'S' : |
| 9981 | value instanceof Boolean ? 'B' : |
| 9982 | value instanceof Byte ? 'b' : |
| 9983 | value instanceof Character ? 'c' : |
| 9984 | value instanceof Double ? 'd' : |
| 9985 | value instanceof Float ? 'f' : |
| 9986 | value instanceof Integer ? 'i' : |
| 9987 | value instanceof Long ? 'l' : |
| 9988 | value instanceof Short ? 's' : |
| 9989 | '\0'; |
| 9990 | |
| 9991 | if (entryType != '\0') { |
| 9992 | uri.append(entryType); |
| 9993 | uri.append('.'); |
| 9994 | uri.append(Uri.encode(key)); |
| 9995 | uri.append('='); |
| 9996 | uri.append(Uri.encode(value.toString())); |
| 9997 | uri.append(';'); |
| 9998 | } |
| 9999 | } |
| 10000 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10001 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 10002 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10003 | public int describeContents() { |
| 10004 | return (mExtras != null) ? mExtras.describeContents() : 0; |
| 10005 | } |
| 10006 | |
| 10007 | public void writeToParcel(Parcel out, int flags) { |
| 10008 | out.writeString(mAction); |
| 10009 | Uri.writeToParcel(out, mData); |
| 10010 | out.writeString(mType); |
| 10011 | out.writeInt(mFlags); |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 10012 | out.writeString(mPackage); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10013 | ComponentName.writeToParcel(mComponent, out); |
| 10014 | |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 10015 | if (mSourceBounds != null) { |
| 10016 | out.writeInt(1); |
| 10017 | mSourceBounds.writeToParcel(out, flags); |
| 10018 | } else { |
| 10019 | out.writeInt(0); |
| 10020 | } |
| 10021 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10022 | if (mCategories != null) { |
Dianne Hackborn | add005c | 2013-07-17 18:43:12 -0700 | [diff] [blame] | 10023 | final int N = mCategories.size(); |
| 10024 | out.writeInt(N); |
| 10025 | for (int i=0; i<N; i++) { |
| 10026 | out.writeString(mCategories.valueAt(i)); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10027 | } |
| 10028 | } else { |
| 10029 | out.writeInt(0); |
| 10030 | } |
| 10031 | |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 10032 | if (mSelector != null) { |
| 10033 | out.writeInt(1); |
| 10034 | mSelector.writeToParcel(out, flags); |
| 10035 | } else { |
| 10036 | out.writeInt(0); |
| 10037 | } |
| 10038 | |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 10039 | if (mClipData != null) { |
| 10040 | out.writeInt(1); |
| 10041 | mClipData.writeToParcel(out, flags); |
| 10042 | } else { |
| 10043 | out.writeInt(0); |
| 10044 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10045 | out.writeInt(mContentUserHint); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10046 | out.writeBundle(mExtras); |
| 10047 | } |
| 10048 | |
| 10049 | public static final Parcelable.Creator<Intent> CREATOR |
| 10050 | = new Parcelable.Creator<Intent>() { |
| 10051 | public Intent createFromParcel(Parcel in) { |
| 10052 | return new Intent(in); |
| 10053 | } |
| 10054 | public Intent[] newArray(int size) { |
| 10055 | return new Intent[size]; |
| 10056 | } |
| 10057 | }; |
| 10058 | |
Dianne Hackborn | eb03465 | 2009-09-07 00:49:58 -0700 | [diff] [blame] | 10059 | /** @hide */ |
| 10060 | protected Intent(Parcel in) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10061 | readFromParcel(in); |
| 10062 | } |
| 10063 | |
| 10064 | public void readFromParcel(Parcel in) { |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 10065 | setAction(in.readString()); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10066 | mData = Uri.CREATOR.createFromParcel(in); |
| 10067 | mType = in.readString(); |
| 10068 | mFlags = in.readInt(); |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 10069 | mPackage = in.readString(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10070 | mComponent = ComponentName.readFromParcel(in); |
| 10071 | |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 10072 | if (in.readInt() != 0) { |
| 10073 | mSourceBounds = Rect.CREATOR.createFromParcel(in); |
| 10074 | } |
| 10075 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10076 | int N = in.readInt(); |
| 10077 | if (N > 0) { |
Dianne Hackborn | add005c | 2013-07-17 18:43:12 -0700 | [diff] [blame] | 10078 | mCategories = new ArraySet<String>(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10079 | int i; |
| 10080 | for (i=0; i<N; i++) { |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 10081 | mCategories.add(in.readString().intern()); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10082 | } |
| 10083 | } else { |
| 10084 | mCategories = null; |
| 10085 | } |
| 10086 | |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 10087 | if (in.readInt() != 0) { |
| 10088 | mSelector = new Intent(in); |
| 10089 | } |
| 10090 | |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 10091 | if (in.readInt() != 0) { |
| 10092 | mClipData = new ClipData(in); |
| 10093 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10094 | mContentUserHint = in.readInt(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10095 | mExtras = in.readBundle(); |
| 10096 | } |
| 10097 | |
| 10098 | /** |
| 10099 | * Parses the "intent" element (and its children) from XML and instantiates |
| 10100 | * an Intent object. The given XML parser should be located at the tag |
| 10101 | * where parsing should start (often named "intent"), from which the |
| 10102 | * basic action, data, type, and package and class name will be |
| 10103 | * retrieved. The function will then parse in to any child elements, |
| 10104 | * looking for <category android:name="xxx"> tags to add categories and |
| 10105 | * <extra android:name="xxx" android:value="yyy"> to attach extra data |
| 10106 | * to the intent. |
| 10107 | * |
| 10108 | * @param resources The Resources to use when inflating resources. |
| 10109 | * @param parser The XML parser pointing at an "intent" tag. |
| 10110 | * @param attrs The AttributeSet interface for retrieving extended |
| 10111 | * attribute data at the current <var>parser</var> location. |
| 10112 | * @return An Intent object matching the XML data. |
| 10113 | * @throws XmlPullParserException If there was an XML parsing error. |
| 10114 | * @throws IOException If there was an I/O error. |
| 10115 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 10116 | public static @NonNull Intent parseIntent(@NonNull Resources resources, |
| 10117 | @NonNull XmlPullParser parser, AttributeSet attrs) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10118 | throws XmlPullParserException, IOException { |
| 10119 | Intent intent = new Intent(); |
| 10120 | |
| 10121 | TypedArray sa = resources.obtainAttributes(attrs, |
| 10122 | com.android.internal.R.styleable.Intent); |
| 10123 | |
| 10124 | intent.setAction(sa.getString(com.android.internal.R.styleable.Intent_action)); |
| 10125 | |
| 10126 | String data = sa.getString(com.android.internal.R.styleable.Intent_data); |
| 10127 | String mimeType = sa.getString(com.android.internal.R.styleable.Intent_mimeType); |
| 10128 | intent.setDataAndType(data != null ? Uri.parse(data) : null, mimeType); |
| 10129 | |
| 10130 | String packageName = sa.getString(com.android.internal.R.styleable.Intent_targetPackage); |
| 10131 | String className = sa.getString(com.android.internal.R.styleable.Intent_targetClass); |
| 10132 | if (packageName != null && className != null) { |
| 10133 | intent.setComponent(new ComponentName(packageName, className)); |
| 10134 | } |
| 10135 | |
| 10136 | sa.recycle(); |
| 10137 | |
| 10138 | int outerDepth = parser.getDepth(); |
| 10139 | int type; |
| 10140 | while ((type=parser.next()) != XmlPullParser.END_DOCUMENT |
| 10141 | && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) { |
| 10142 | if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) { |
| 10143 | continue; |
| 10144 | } |
| 10145 | |
| 10146 | String nodeName = parser.getName(); |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 10147 | if (nodeName.equals(TAG_CATEGORIES)) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10148 | sa = resources.obtainAttributes(attrs, |
| 10149 | com.android.internal.R.styleable.IntentCategory); |
| 10150 | String cat = sa.getString(com.android.internal.R.styleable.IntentCategory_name); |
| 10151 | sa.recycle(); |
| 10152 | |
| 10153 | if (cat != null) { |
| 10154 | intent.addCategory(cat); |
| 10155 | } |
| 10156 | XmlUtils.skipCurrentTag(parser); |
| 10157 | |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 10158 | } else if (nodeName.equals(TAG_EXTRA)) { |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 10159 | if (intent.mExtras == null) { |
| 10160 | intent.mExtras = new Bundle(); |
| 10161 | } |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 10162 | resources.parseBundleExtra(TAG_EXTRA, attrs, intent.mExtras); |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 10163 | XmlUtils.skipCurrentTag(parser); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10164 | |
| 10165 | } else { |
| 10166 | XmlUtils.skipCurrentTag(parser); |
| 10167 | } |
| 10168 | } |
| 10169 | |
| 10170 | return intent; |
| 10171 | } |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 10172 | |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 10173 | /** @hide */ |
| 10174 | public void saveToXml(XmlSerializer out) throws IOException { |
| 10175 | if (mAction != null) { |
| 10176 | out.attribute(null, ATTR_ACTION, mAction); |
| 10177 | } |
| 10178 | if (mData != null) { |
| 10179 | out.attribute(null, ATTR_DATA, mData.toString()); |
| 10180 | } |
| 10181 | if (mType != null) { |
| 10182 | out.attribute(null, ATTR_TYPE, mType); |
| 10183 | } |
| 10184 | if (mComponent != null) { |
| 10185 | out.attribute(null, ATTR_COMPONENT, mComponent.flattenToShortString()); |
| 10186 | } |
| 10187 | out.attribute(null, ATTR_FLAGS, Integer.toHexString(getFlags())); |
| 10188 | |
| 10189 | if (mCategories != null) { |
| 10190 | out.startTag(null, TAG_CATEGORIES); |
| 10191 | for (int categoryNdx = mCategories.size() - 1; categoryNdx >= 0; --categoryNdx) { |
| 10192 | out.attribute(null, ATTR_CATEGORY, mCategories.valueAt(categoryNdx)); |
| 10193 | } |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 10194 | out.endTag(null, TAG_CATEGORIES); |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 10195 | } |
| 10196 | } |
| 10197 | |
| 10198 | /** @hide */ |
| 10199 | public static Intent restoreFromXml(XmlPullParser in) throws IOException, |
| 10200 | XmlPullParserException { |
| 10201 | Intent intent = new Intent(); |
| 10202 | final int outerDepth = in.getDepth(); |
| 10203 | |
| 10204 | int attrCount = in.getAttributeCount(); |
| 10205 | for (int attrNdx = attrCount - 1; attrNdx >= 0; --attrNdx) { |
| 10206 | final String attrName = in.getAttributeName(attrNdx); |
| 10207 | final String attrValue = in.getAttributeValue(attrNdx); |
| 10208 | if (ATTR_ACTION.equals(attrName)) { |
| 10209 | intent.setAction(attrValue); |
| 10210 | } else if (ATTR_DATA.equals(attrName)) { |
| 10211 | intent.setData(Uri.parse(attrValue)); |
| 10212 | } else if (ATTR_TYPE.equals(attrName)) { |
| 10213 | intent.setType(attrValue); |
| 10214 | } else if (ATTR_COMPONENT.equals(attrName)) { |
| 10215 | intent.setComponent(ComponentName.unflattenFromString(attrValue)); |
| 10216 | } else if (ATTR_FLAGS.equals(attrName)) { |
Narayan Kamath | a09b4d2 | 2016-04-15 18:32:45 +0100 | [diff] [blame] | 10217 | intent.setFlags(Integer.parseInt(attrValue, 16)); |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 10218 | } else { |
| 10219 | Log.e("Intent", "restoreFromXml: unknown attribute=" + attrName); |
| 10220 | } |
| 10221 | } |
| 10222 | |
| 10223 | int event; |
| 10224 | String name; |
| 10225 | while (((event = in.next()) != XmlPullParser.END_DOCUMENT) && |
| 10226 | (event != XmlPullParser.END_TAG || in.getDepth() < outerDepth)) { |
| 10227 | if (event == XmlPullParser.START_TAG) { |
| 10228 | name = in.getName(); |
| 10229 | if (TAG_CATEGORIES.equals(name)) { |
| 10230 | attrCount = in.getAttributeCount(); |
| 10231 | for (int attrNdx = attrCount - 1; attrNdx >= 0; --attrNdx) { |
| 10232 | intent.addCategory(in.getAttributeValue(attrNdx)); |
| 10233 | } |
| 10234 | } else { |
| 10235 | Log.w("Intent", "restoreFromXml: unknown name=" + name); |
| 10236 | XmlUtils.skipCurrentTag(in); |
| 10237 | } |
| 10238 | } |
| 10239 | } |
| 10240 | |
| 10241 | return intent; |
| 10242 | } |
| 10243 | |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 10244 | /** |
| 10245 | * Normalize a MIME data type. |
| 10246 | * |
| 10247 | * <p>A normalized MIME type has white-space trimmed, |
| 10248 | * content-type parameters removed, and is lower-case. |
| 10249 | * This aligns the type with Android best practices for |
| 10250 | * intent filtering. |
| 10251 | * |
| 10252 | * <p>For example, "text/plain; charset=utf-8" becomes "text/plain". |
| 10253 | * "text/x-vCard" becomes "text/x-vcard". |
| 10254 | * |
| 10255 | * <p>All MIME types received from outside Android (such as user input, |
| 10256 | * or external sources like Bluetooth, NFC, or the Internet) should |
| 10257 | * be normalized before they are used to create an Intent. |
| 10258 | * |
| 10259 | * @param type MIME data type to normalize |
| 10260 | * @return normalized MIME data type, or null if the input was null |
John Spurlock | 125d133 | 2013-11-25 11:58:37 -0500 | [diff] [blame] | 10261 | * @see #setType |
| 10262 | * @see #setTypeAndNormalize |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 10263 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 10264 | public static @Nullable String normalizeMimeType(@Nullable String type) { |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 10265 | if (type == null) { |
| 10266 | return null; |
| 10267 | } |
| 10268 | |
Elliott Hughes | cb64d43 | 2013-08-02 10:00:44 -0700 | [diff] [blame] | 10269 | type = type.trim().toLowerCase(Locale.ROOT); |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 10270 | |
| 10271 | final int semicolonIndex = type.indexOf(';'); |
| 10272 | if (semicolonIndex != -1) { |
| 10273 | type = type.substring(0, semicolonIndex); |
| 10274 | } |
| 10275 | return type; |
| 10276 | } |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10277 | |
| 10278 | /** |
Jeff Sharkey | a14acd2 | 2013-04-02 18:27:45 -0700 | [diff] [blame] | 10279 | * Prepare this {@link Intent} to leave an app process. |
| 10280 | * |
| 10281 | * @hide |
| 10282 | */ |
Mathew Inwood | 5c0d354 | 2018-08-14 13:54:31 +0100 | [diff] [blame] | 10283 | @UnsupportedAppUsage |
Jeff Sharkey | 344744b | 2016-01-28 19:03:30 -0700 | [diff] [blame] | 10284 | public void prepareToLeaveProcess(Context context) { |
| 10285 | final boolean leavingPackage = (mComponent == null) |
| 10286 | || !Objects.equals(mComponent.getPackageName(), context.getPackageName()); |
| 10287 | prepareToLeaveProcess(leavingPackage); |
| 10288 | } |
| 10289 | |
| 10290 | /** |
| 10291 | * Prepare this {@link Intent} to leave an app process. |
| 10292 | * |
| 10293 | * @hide |
| 10294 | */ |
| 10295 | public void prepareToLeaveProcess(boolean leavingPackage) { |
Jeff Sharkey | a14acd2 | 2013-04-02 18:27:45 -0700 | [diff] [blame] | 10296 | setAllowFds(false); |
| 10297 | |
| 10298 | if (mSelector != null) { |
Jeff Sharkey | 344744b | 2016-01-28 19:03:30 -0700 | [diff] [blame] | 10299 | mSelector.prepareToLeaveProcess(leavingPackage); |
Jeff Sharkey | a14acd2 | 2013-04-02 18:27:45 -0700 | [diff] [blame] | 10300 | } |
| 10301 | if (mClipData != null) { |
Jeff Sharkey | fb833f3 | 2016-12-01 14:59:59 -0700 | [diff] [blame] | 10302 | mClipData.prepareToLeaveProcess(leavingPackage, getFlags()); |
Jeff Sharkey | a14acd2 | 2013-04-02 18:27:45 -0700 | [diff] [blame] | 10303 | } |
| 10304 | |
Jeff Sharkey | c6fe23d | 2017-02-24 09:39:58 -0700 | [diff] [blame] | 10305 | if (mExtras != null && !mExtras.isParcelled()) { |
| 10306 | final Object intent = mExtras.get(Intent.EXTRA_INTENT); |
| 10307 | if (intent instanceof Intent) { |
| 10308 | ((Intent) intent).prepareToLeaveProcess(leavingPackage); |
| 10309 | } |
| 10310 | } |
| 10311 | |
Jeff Sharkey | a8b4278 | 2016-01-30 17:58:09 -0700 | [diff] [blame] | 10312 | if (mAction != null && mData != null && StrictMode.vmFileUriExposureEnabled() |
| 10313 | && leavingPackage) { |
Jeff Sharkey | 344744b | 2016-01-28 19:03:30 -0700 | [diff] [blame] | 10314 | switch (mAction) { |
| 10315 | case ACTION_MEDIA_REMOVED: |
| 10316 | case ACTION_MEDIA_UNMOUNTED: |
| 10317 | case ACTION_MEDIA_CHECKING: |
| 10318 | case ACTION_MEDIA_NOFS: |
| 10319 | case ACTION_MEDIA_MOUNTED: |
| 10320 | case ACTION_MEDIA_SHARED: |
| 10321 | case ACTION_MEDIA_UNSHARED: |
| 10322 | case ACTION_MEDIA_BAD_REMOVAL: |
| 10323 | case ACTION_MEDIA_UNMOUNTABLE: |
| 10324 | case ACTION_MEDIA_EJECT: |
| 10325 | case ACTION_MEDIA_SCANNER_STARTED: |
| 10326 | case ACTION_MEDIA_SCANNER_FINISHED: |
| 10327 | case ACTION_MEDIA_SCANNER_SCAN_FILE: |
Jeff Sharkey | 37355a9 | 2016-02-05 16:19:10 -0700 | [diff] [blame] | 10328 | case ACTION_PACKAGE_NEEDS_VERIFICATION: |
| 10329 | case ACTION_PACKAGE_VERIFIED: |
Jeff Sharkey | 344744b | 2016-01-28 19:03:30 -0700 | [diff] [blame] | 10330 | // Ignore legacy actions |
| 10331 | break; |
| 10332 | default: |
| 10333 | mData.checkFileUriExposed("Intent.getData()"); |
Jeff Sharkey | a14acd2 | 2013-04-02 18:27:45 -0700 | [diff] [blame] | 10334 | } |
| 10335 | } |
Jeff Sharkey | fb833f3 | 2016-12-01 14:59:59 -0700 | [diff] [blame] | 10336 | |
| 10337 | if (mAction != null && mData != null && StrictMode.vmContentUriWithoutPermissionEnabled() |
| 10338 | && leavingPackage) { |
| 10339 | switch (mAction) { |
| 10340 | case ACTION_PROVIDER_CHANGED: |
Makoto Onuki | 7d1911f | 2017-06-09 12:30:09 -0700 | [diff] [blame] | 10341 | case QuickContact.ACTION_QUICK_CONTACT: |
Jeff Sharkey | fb833f3 | 2016-12-01 14:59:59 -0700 | [diff] [blame] | 10342 | // Ignore actions that don't need to grant |
| 10343 | break; |
| 10344 | default: |
| 10345 | mData.checkContentUriWithoutPermission("Intent.getData()", getFlags()); |
| 10346 | } |
| 10347 | } |
Jeff Sharkey | a14acd2 | 2013-04-02 18:27:45 -0700 | [diff] [blame] | 10348 | } |
| 10349 | |
| 10350 | /** |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10351 | * @hide |
| 10352 | */ |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10353 | public void prepareToEnterProcess() { |
Jeff Sharkey | d136e51 | 2016-03-09 22:30:56 -0700 | [diff] [blame] | 10354 | // We just entered destination process, so we should be able to read all |
| 10355 | // parcelables inside. |
| 10356 | setDefusable(true); |
| 10357 | |
| 10358 | if (mSelector != null) { |
| 10359 | mSelector.prepareToEnterProcess(); |
| 10360 | } |
| 10361 | if (mClipData != null) { |
| 10362 | mClipData.prepareToEnterProcess(); |
| 10363 | } |
| 10364 | |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10365 | if (mContentUserHint != UserHandle.USER_CURRENT) { |
Nicolas Prevot | c4fc00a | 2014-10-31 12:01:32 +0000 | [diff] [blame] | 10366 | if (UserHandle.getAppId(Process.myUid()) != Process.SYSTEM_UID) { |
| 10367 | fixUris(mContentUserHint); |
| 10368 | mContentUserHint = UserHandle.USER_CURRENT; |
| 10369 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10370 | } |
| 10371 | } |
| 10372 | |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 10373 | /** @hide */ |
| 10374 | public boolean hasWebURI() { |
| 10375 | if (getData() == null) { |
| 10376 | return false; |
| 10377 | } |
| 10378 | final String scheme = getScheme(); |
| 10379 | if (TextUtils.isEmpty(scheme)) { |
| 10380 | return false; |
| 10381 | } |
| 10382 | return scheme.equals(IntentFilter.SCHEME_HTTP) || scheme.equals(IntentFilter.SCHEME_HTTPS); |
| 10383 | } |
| 10384 | |
| 10385 | /** @hide */ |
Patrick Baumann | 0da8537 | 2018-02-02 16:07:35 -0800 | [diff] [blame] | 10386 | public boolean isWebIntent() { |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 10387 | return ACTION_VIEW.equals(mAction) |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 10388 | && hasWebURI(); |
| 10389 | } |
| 10390 | |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10391 | /** |
| 10392 | * @hide |
| 10393 | */ |
| 10394 | public void fixUris(int contentUserHint) { |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10395 | Uri data = getData(); |
| 10396 | if (data != null) { |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10397 | mData = maybeAddUserId(data, contentUserHint); |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10398 | } |
| 10399 | if (mClipData != null) { |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10400 | mClipData.fixUris(contentUserHint); |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10401 | } |
| 10402 | String action = getAction(); |
| 10403 | if (ACTION_SEND.equals(action)) { |
| 10404 | final Uri stream = getParcelableExtra(EXTRA_STREAM); |
| 10405 | if (stream != null) { |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10406 | putExtra(EXTRA_STREAM, maybeAddUserId(stream, contentUserHint)); |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10407 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10408 | } else if (ACTION_SEND_MULTIPLE.equals(action)) { |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10409 | final ArrayList<Uri> streams = getParcelableArrayListExtra(EXTRA_STREAM); |
| 10410 | if (streams != null) { |
| 10411 | ArrayList<Uri> newStreams = new ArrayList<Uri>(); |
| 10412 | for (int i = 0; i < streams.size(); i++) { |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10413 | newStreams.add(maybeAddUserId(streams.get(i), contentUserHint)); |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10414 | } |
| 10415 | putParcelableArrayListExtra(EXTRA_STREAM, newStreams); |
| 10416 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10417 | } else if (MediaStore.ACTION_IMAGE_CAPTURE.equals(action) |
| 10418 | || MediaStore.ACTION_IMAGE_CAPTURE_SECURE.equals(action) |
| 10419 | || MediaStore.ACTION_VIDEO_CAPTURE.equals(action)) { |
| 10420 | final Uri output = getParcelableExtra(MediaStore.EXTRA_OUTPUT); |
| 10421 | if (output != null) { |
| 10422 | putExtra(MediaStore.EXTRA_OUTPUT, maybeAddUserId(output, contentUserHint)); |
| 10423 | } |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10424 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10425 | } |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10426 | |
| 10427 | /** |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10428 | * Migrate any {@link #EXTRA_STREAM} in {@link #ACTION_SEND} and |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10429 | * {@link #ACTION_SEND_MULTIPLE} to {@link ClipData}. Also inspects nested |
| 10430 | * intents in {@link #ACTION_CHOOSER}. |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10431 | * |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10432 | * @return Whether any contents were migrated. |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10433 | * @hide |
| 10434 | */ |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10435 | public boolean migrateExtraStreamToClipData() { |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10436 | // Refuse to touch if extras already parcelled |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10437 | if (mExtras != null && mExtras.isParcelled()) return false; |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10438 | |
| 10439 | // Bail when someone already gave us ClipData |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10440 | if (getClipData() != null) return false; |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10441 | |
| 10442 | final String action = getAction(); |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10443 | if (ACTION_CHOOSER.equals(action)) { |
Jeff Sharkey | c004eef | 2014-09-23 16:40:50 -0700 | [diff] [blame] | 10444 | // Inspect contained intents to see if we need to migrate extras. We |
| 10445 | // don't promote ClipData to the parent, since ChooserActivity will |
| 10446 | // already start the picked item as the caller, and we can't combine |
| 10447 | // the flags in a safe way. |
| 10448 | |
| 10449 | boolean migrated = false; |
Jeff Sharkey | 1c29700 | 2012-05-18 13:55:47 -0700 | [diff] [blame] | 10450 | try { |
Jeff Sharkey | c004eef | 2014-09-23 16:40:50 -0700 | [diff] [blame] | 10451 | final Intent intent = getParcelableExtra(EXTRA_INTENT); |
| 10452 | if (intent != null) { |
| 10453 | migrated |= intent.migrateExtraStreamToClipData(); |
Jeff Sharkey | 1c29700 | 2012-05-18 13:55:47 -0700 | [diff] [blame] | 10454 | } |
| 10455 | } catch (ClassCastException e) { |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10456 | } |
Jeff Sharkey | c004eef | 2014-09-23 16:40:50 -0700 | [diff] [blame] | 10457 | try { |
| 10458 | final Parcelable[] intents = getParcelableArrayExtra(EXTRA_INITIAL_INTENTS); |
| 10459 | if (intents != null) { |
| 10460 | for (int i = 0; i < intents.length; i++) { |
| 10461 | final Intent intent = (Intent) intents[i]; |
| 10462 | if (intent != null) { |
| 10463 | migrated |= intent.migrateExtraStreamToClipData(); |
| 10464 | } |
| 10465 | } |
| 10466 | } |
| 10467 | } catch (ClassCastException e) { |
| 10468 | } |
| 10469 | return migrated; |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10470 | |
| 10471 | } else if (ACTION_SEND.equals(action)) { |
Jeff Sharkey | f27ea66 | 2012-03-27 10:34:24 -0700 | [diff] [blame] | 10472 | try { |
Jeff Sharkey | dd471e6 | 2012-05-01 13:07:01 -0700 | [diff] [blame] | 10473 | final Uri stream = getParcelableExtra(EXTRA_STREAM); |
| 10474 | final CharSequence text = getCharSequenceExtra(EXTRA_TEXT); |
| 10475 | final String htmlText = getStringExtra(EXTRA_HTML_TEXT); |
| 10476 | if (stream != null || text != null || htmlText != null) { |
| 10477 | final ClipData clipData = new ClipData( |
| 10478 | null, new String[] { getType() }, |
| 10479 | new ClipData.Item(text, htmlText, null, stream)); |
| 10480 | setClipData(clipData); |
| 10481 | addFlags(FLAG_GRANT_READ_URI_PERMISSION); |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10482 | return true; |
Jeff Sharkey | dd471e6 | 2012-05-01 13:07:01 -0700 | [diff] [blame] | 10483 | } |
Jeff Sharkey | f27ea66 | 2012-03-27 10:34:24 -0700 | [diff] [blame] | 10484 | } catch (ClassCastException e) { |
Jeff Sharkey | f27ea66 | 2012-03-27 10:34:24 -0700 | [diff] [blame] | 10485 | } |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10486 | |
| 10487 | } else if (ACTION_SEND_MULTIPLE.equals(action)) { |
Jeff Sharkey | f27ea66 | 2012-03-27 10:34:24 -0700 | [diff] [blame] | 10488 | try { |
Jeff Sharkey | dd471e6 | 2012-05-01 13:07:01 -0700 | [diff] [blame] | 10489 | final ArrayList<Uri> streams = getParcelableArrayListExtra(EXTRA_STREAM); |
| 10490 | final ArrayList<CharSequence> texts = getCharSequenceArrayListExtra(EXTRA_TEXT); |
| 10491 | final ArrayList<String> htmlTexts = getStringArrayListExtra(EXTRA_HTML_TEXT); |
| 10492 | int num = -1; |
| 10493 | if (streams != null) { |
| 10494 | num = streams.size(); |
| 10495 | } |
| 10496 | if (texts != null) { |
| 10497 | if (num >= 0 && num != texts.size()) { |
| 10498 | // Wha...! F- you. |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10499 | return false; |
Jeff Sharkey | dd471e6 | 2012-05-01 13:07:01 -0700 | [diff] [blame] | 10500 | } |
| 10501 | num = texts.size(); |
| 10502 | } |
| 10503 | if (htmlTexts != null) { |
| 10504 | if (num >= 0 && num != htmlTexts.size()) { |
| 10505 | // Wha...! F- you. |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10506 | return false; |
Jeff Sharkey | dd471e6 | 2012-05-01 13:07:01 -0700 | [diff] [blame] | 10507 | } |
| 10508 | num = htmlTexts.size(); |
| 10509 | } |
| 10510 | if (num > 0) { |
| 10511 | final ClipData clipData = new ClipData( |
| 10512 | null, new String[] { getType() }, |
| 10513 | makeClipItem(streams, texts, htmlTexts, 0)); |
| 10514 | |
| 10515 | for (int i = 1; i < num; i++) { |
| 10516 | clipData.addItem(makeClipItem(streams, texts, htmlTexts, i)); |
| 10517 | } |
| 10518 | |
| 10519 | setClipData(clipData); |
| 10520 | addFlags(FLAG_GRANT_READ_URI_PERMISSION); |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10521 | return true; |
Jeff Sharkey | dd471e6 | 2012-05-01 13:07:01 -0700 | [diff] [blame] | 10522 | } |
Jeff Sharkey | f27ea66 | 2012-03-27 10:34:24 -0700 | [diff] [blame] | 10523 | } catch (ClassCastException e) { |
Jeff Sharkey | f27ea66 | 2012-03-27 10:34:24 -0700 | [diff] [blame] | 10524 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10525 | } else if (MediaStore.ACTION_IMAGE_CAPTURE.equals(action) |
| 10526 | || MediaStore.ACTION_IMAGE_CAPTURE_SECURE.equals(action) |
| 10527 | || MediaStore.ACTION_VIDEO_CAPTURE.equals(action)) { |
| 10528 | final Uri output; |
| 10529 | try { |
| 10530 | output = getParcelableExtra(MediaStore.EXTRA_OUTPUT); |
| 10531 | } catch (ClassCastException e) { |
| 10532 | return false; |
| 10533 | } |
| 10534 | if (output != null) { |
| 10535 | setClipData(ClipData.newRawUri("", output)); |
| 10536 | addFlags(FLAG_GRANT_WRITE_URI_PERMISSION|FLAG_GRANT_READ_URI_PERMISSION); |
| 10537 | return true; |
| 10538 | } |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10539 | } |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10540 | |
| 10541 | return false; |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10542 | } |
Dianne Hackborn | ac4243f | 2012-04-13 17:32:18 -0700 | [diff] [blame] | 10543 | |
Michael Wright | 1985976 | 2017-09-18 20:57:58 +0100 | [diff] [blame] | 10544 | /** |
| 10545 | * Convert the dock state to a human readable format. |
| 10546 | * @hide |
| 10547 | */ |
| 10548 | public static String dockStateToString(int dock) { |
| 10549 | switch (dock) { |
| 10550 | case EXTRA_DOCK_STATE_HE_DESK: |
| 10551 | return "EXTRA_DOCK_STATE_HE_DESK"; |
| 10552 | case EXTRA_DOCK_STATE_LE_DESK: |
| 10553 | return "EXTRA_DOCK_STATE_LE_DESK"; |
| 10554 | case EXTRA_DOCK_STATE_CAR: |
| 10555 | return "EXTRA_DOCK_STATE_CAR"; |
| 10556 | case EXTRA_DOCK_STATE_DESK: |
| 10557 | return "EXTRA_DOCK_STATE_DESK"; |
| 10558 | case EXTRA_DOCK_STATE_UNDOCKED: |
| 10559 | return "EXTRA_DOCK_STATE_UNDOCKED"; |
| 10560 | default: |
| 10561 | return Integer.toString(dock); |
| 10562 | } |
| 10563 | } |
| 10564 | |
Dianne Hackborn | ac4243f | 2012-04-13 17:32:18 -0700 | [diff] [blame] | 10565 | private static ClipData.Item makeClipItem(ArrayList<Uri> streams, ArrayList<CharSequence> texts, |
| 10566 | ArrayList<String> htmlTexts, int which) { |
| 10567 | Uri uri = streams != null ? streams.get(which) : null; |
| 10568 | CharSequence text = texts != null ? texts.get(which) : null; |
| 10569 | String htmlText = htmlTexts != null ? htmlTexts.get(which) : null; |
| 10570 | return new ClipData.Item(text, htmlText, null, uri); |
| 10571 | } |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 10572 | |
| 10573 | /** @hide */ |
| 10574 | public boolean isDocument() { |
| 10575 | return (mFlags & FLAG_ACTIVITY_NEW_DOCUMENT) == FLAG_ACTIVITY_NEW_DOCUMENT; |
| 10576 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10577 | } |