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; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 26 | import android.annotation.SdkConstant; |
| 27 | import android.annotation.SdkConstant.SdkConstantType; |
Jason Monk | 2f68e8a | 2016-02-23 17:57:28 -0500 | [diff] [blame] | 28 | import android.annotation.SystemApi; |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 29 | import android.annotation.UnsupportedAppUsage; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 30 | import android.content.pm.ActivityInfo; |
Jason Monk | 2f68e8a | 2016-02-23 17:57:28 -0500 | [diff] [blame] | 31 | import android.content.pm.ApplicationInfo; |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 32 | import android.content.pm.ComponentInfo; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 33 | import android.content.pm.PackageManager; |
| 34 | import android.content.pm.ResolveInfo; |
| 35 | import android.content.res.Resources; |
| 36 | import android.content.res.TypedArray; |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 37 | import android.graphics.Rect; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 38 | import android.net.Uri; |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 39 | import android.os.Build; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 40 | import android.os.Bundle; |
| 41 | import android.os.IBinder; |
| 42 | import android.os.Parcel; |
| 43 | import android.os.Parcelable; |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 44 | import android.os.PersistableBundle; |
Nicolas Prevot | c4fc00a | 2014-10-31 12:01:32 +0000 | [diff] [blame] | 45 | import android.os.Process; |
Jason Monk | 2f68e8a | 2016-02-23 17:57:28 -0500 | [diff] [blame] | 46 | import android.os.ResultReceiver; |
| 47 | import android.os.ShellCommand; |
Jeff Sharkey | a14acd2 | 2013-04-02 18:27:45 -0700 | [diff] [blame] | 48 | import android.os.StrictMode; |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 49 | import android.os.UserHandle; |
Makoto Onuki | 7d1911f | 2017-06-09 12:30:09 -0700 | [diff] [blame] | 50 | import android.provider.ContactsContract.QuickContact; |
Jeff Sharkey | bd3b902 | 2013-08-20 15:20:04 -0700 | [diff] [blame] | 51 | import android.provider.DocumentsContract; |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 52 | import android.provider.DocumentsProvider; |
Jason Monk | 2f68e8a | 2016-02-23 17:57:28 -0500 | [diff] [blame] | 53 | import android.provider.MediaStore; |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 54 | import android.provider.OpenableColumns; |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 55 | import android.text.TextUtils; |
Jason Monk | 2f68e8a | 2016-02-23 17:57:28 -0500 | [diff] [blame] | 56 | import android.util.ArraySet; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 57 | import android.util.AttributeSet; |
| 58 | import android.util.Log; |
Yi Jin | 129fc6c | 2017-09-28 15:48:38 -0700 | [diff] [blame] | 59 | import android.util.proto.ProtoOutputStream; |
Makoto Onuki | 7d1911f | 2017-06-09 12:30:09 -0700 | [diff] [blame] | 60 | |
Dianne Hackborn | 2269d157 | 2010-02-24 19:54:22 -0800 | [diff] [blame] | 61 | import com.android.internal.util.XmlUtils; |
Makoto Onuki | 7d1911f | 2017-06-09 12:30:09 -0700 | [diff] [blame] | 62 | |
Jason Monk | 2f68e8a | 2016-02-23 17:57:28 -0500 | [diff] [blame] | 63 | import org.xmlpull.v1.XmlPullParser; |
| 64 | import org.xmlpull.v1.XmlPullParserException; |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 65 | import org.xmlpull.v1.XmlSerializer; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 66 | |
| 67 | import java.io.IOException; |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 68 | import java.io.PrintWriter; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 69 | import java.io.Serializable; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 70 | import java.lang.annotation.Retention; |
| 71 | import java.lang.annotation.RetentionPolicy; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 72 | import java.net.URISyntaxException; |
| 73 | import java.util.ArrayList; |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 74 | import java.util.HashSet; |
Dianne Hackborn | 221ea89 | 2013-08-04 16:50:16 -0700 | [diff] [blame] | 75 | import java.util.List; |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 76 | import java.util.Locale; |
Christopher Tate | 63d9ae1 | 2014-06-19 19:07:26 -0700 | [diff] [blame] | 77 | import java.util.Objects; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 78 | import java.util.Set; |
| 79 | |
| 80 | /** |
| 81 | * An intent is an abstract description of an operation to be performed. It |
| 82 | * can be used with {@link Context#startActivity(Intent) startActivity} to |
| 83 | * launch an {@link android.app.Activity}, |
| 84 | * {@link android.content.Context#sendBroadcast(Intent) broadcastIntent} to |
| 85 | * send it to any interested {@link BroadcastReceiver BroadcastReceiver} components, |
| 86 | * and {@link android.content.Context#startService} or |
| 87 | * {@link android.content.Context#bindService} to communicate with a |
| 88 | * background {@link android.app.Service}. |
| 89 | * |
Joe Fernandez | b54e7a3 | 2011-10-03 15:09:50 -0700 | [diff] [blame] | 90 | * <p>An Intent provides a facility for performing late runtime binding between the code in |
| 91 | * 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] | 92 | * can be thought of as the glue between activities. It is basically a passive data structure |
| 93 | * holding an abstract description of an action to be performed.</p> |
Joe Fernandez | b54e7a3 | 2011-10-03 15:09:50 -0700 | [diff] [blame] | 94 | * |
| 95 | * <div class="special reference"> |
| 96 | * <h3>Developer Guides</h3> |
| 97 | * <p>For information about how to create and resolve intents, read the |
| 98 | * <a href="{@docRoot}guide/topics/intents/intents-filters.html">Intents and Intent Filters</a> |
| 99 | * developer guide.</p> |
| 100 | * </div> |
| 101 | * |
| 102 | * <a name="IntentStructure"></a> |
| 103 | * <h3>Intent Structure</h3> |
| 104 | * <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] | 105 | * |
| 106 | * <ul> |
| 107 | * <li> <p><b>action</b> -- The general action to be performed, such as |
| 108 | * {@link #ACTION_VIEW}, {@link #ACTION_EDIT}, {@link #ACTION_MAIN}, |
| 109 | * etc.</p> |
| 110 | * </li> |
| 111 | * <li> <p><b>data</b> -- The data to operate on, such as a person record |
| 112 | * in the contacts database, expressed as a {@link android.net.Uri}.</p> |
| 113 | * </li> |
| 114 | * </ul> |
| 115 | * |
| 116 | * |
| 117 | * <p>Some examples of action/data pairs are:</p> |
| 118 | * |
| 119 | * <ul> |
Yusuf T. Mobile | 8ecb36e | 2009-07-10 14:13:29 -0700 | [diff] [blame] | 120 | * <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] | 121 | * information about the person whose identifier is "1".</p> |
| 122 | * </li> |
Yusuf T. Mobile | 8ecb36e | 2009-07-10 14:13:29 -0700 | [diff] [blame] | 123 | * <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] | 124 | * the phone dialer with the person filled in.</p> |
| 125 | * </li> |
| 126 | * <li> <p><b>{@link #ACTION_VIEW} <i>tel:123</i></b> -- Display |
| 127 | * the phone dialer with the given number filled in. Note how the |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 128 | * 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] | 129 | * a particular URI.</p> |
| 130 | * </li> |
| 131 | * <li> <p><b>{@link #ACTION_DIAL} <i>tel:123</i></b> -- Display |
| 132 | * the phone dialer with the given number filled in.</p> |
| 133 | * </li> |
Yusuf T. Mobile | 8ecb36e | 2009-07-10 14:13:29 -0700 | [diff] [blame] | 134 | * <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] | 135 | * information about the person whose identifier is "1".</p> |
| 136 | * </li> |
Yusuf T. Mobile | 8ecb36e | 2009-07-10 14:13:29 -0700 | [diff] [blame] | 137 | * <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] | 138 | * a list of people, which the user can browse through. This example is a |
| 139 | * typical top-level entry into the Contacts application, showing you the |
| 140 | * 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] | 141 | * 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] | 142 | * being used to start an activity to display that person.</p> |
| 143 | * </li> |
| 144 | * </ul> |
| 145 | * |
| 146 | * <p>In addition to these primary attributes, there are a number of secondary |
| 147 | * attributes that you can also include with an intent:</p> |
| 148 | * |
| 149 | * <ul> |
| 150 | * <li> <p><b>category</b> -- Gives additional information about the action |
| 151 | * to execute. For example, {@link #CATEGORY_LAUNCHER} means it should |
| 152 | * appear in the Launcher as a top-level application, while |
| 153 | * {@link #CATEGORY_ALTERNATIVE} means it should be included in a list |
| 154 | * of alternative actions the user can perform on a piece of data.</p> |
| 155 | * <li> <p><b>type</b> -- Specifies an explicit type (a MIME type) of the |
| 156 | * intent data. Normally the type is inferred from the data itself. |
| 157 | * By setting this attribute, you disable that evaluation and force |
| 158 | * an explicit type.</p> |
| 159 | * <li> <p><b>component</b> -- Specifies an explicit name of a component |
| 160 | * class to use for the intent. Normally this is determined by looking |
| 161 | * at the other information in the intent (the action, data/type, and |
| 162 | * categories) and matching that with a component that can handle it. |
| 163 | * If this attribute is set then none of the evaluation is performed, |
| 164 | * and this component is used exactly as is. By specifying this attribute, |
| 165 | * all of the other Intent attributes become optional.</p> |
| 166 | * <li> <p><b>extras</b> -- This is a {@link Bundle} of any additional information. |
| 167 | * This can be used to provide extended information to the component. |
| 168 | * For example, if we have a action to send an e-mail message, we could |
| 169 | * also include extra pieces of data here to supply a subject, body, |
| 170 | * etc.</p> |
| 171 | * </ul> |
| 172 | * |
| 173 | * <p>Here are some examples of other operations you can specify as intents |
| 174 | * using these additional parameters:</p> |
| 175 | * |
| 176 | * <ul> |
| 177 | * <li> <p><b>{@link #ACTION_MAIN} with category {@link #CATEGORY_HOME}</b> -- |
| 178 | * Launch the home screen.</p> |
| 179 | * </li> |
| 180 | * <li> <p><b>{@link #ACTION_GET_CONTENT} with MIME type |
| 181 | * <i>{@link android.provider.Contacts.Phones#CONTENT_URI |
| 182 | * vnd.android.cursor.item/phone}</i></b> |
| 183 | * -- Display the list of people's phone numbers, allowing the user to |
| 184 | * browse through them and pick one and return it to the parent activity.</p> |
| 185 | * </li> |
| 186 | * <li> <p><b>{@link #ACTION_GET_CONTENT} with MIME type |
| 187 | * <i>*{@literal /}*</i> and category {@link #CATEGORY_OPENABLE}</b> |
| 188 | * -- Display all pickers for data that can be opened with |
| 189 | * {@link ContentResolver#openInputStream(Uri) ContentResolver.openInputStream()}, |
| 190 | * allowing the user to pick one of them and then some data inside of it |
| 191 | * and returning the resulting URI to the caller. This can be used, |
| 192 | * for example, in an e-mail application to allow the user to pick some |
| 193 | * data to include as an attachment.</p> |
| 194 | * </li> |
| 195 | * </ul> |
| 196 | * |
| 197 | * <p>There are a variety of standard Intent action and category constants |
| 198 | * defined in the Intent class, but applications can also define their own. |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 199 | * 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] | 200 | * example, the standard {@link #ACTION_VIEW} is called |
Yusuf T. Mobile | 8ecb36e | 2009-07-10 14:13:29 -0700 | [diff] [blame] | 201 | * "android.intent.action.VIEW".</p> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 202 | * |
| 203 | * <p>Put together, the set of actions, data types, categories, and extra data |
| 204 | * defines a language for the system allowing for the expression of phrases |
| 205 | * such as "call john smith's cell". As applications are added to the system, |
| 206 | * they can extend this language by adding new actions, types, and categories, or |
| 207 | * they can modify the behavior of existing phrases by supplying their own |
| 208 | * activities that handle them.</p> |
| 209 | * |
| 210 | * <a name="IntentResolution"></a> |
| 211 | * <h3>Intent Resolution</h3> |
| 212 | * |
| 213 | * <p>There are two primary forms of intents you will use. |
| 214 | * |
| 215 | * <ul> |
| 216 | * <li> <p><b>Explicit Intents</b> have specified a component (via |
| 217 | * {@link #setComponent} or {@link #setClass}), which provides the exact |
| 218 | * class to be run. Often these will not include any other information, |
| 219 | * simply being a way for an application to launch various internal |
| 220 | * activities it has as the user interacts with the application. |
| 221 | * |
| 222 | * <li> <p><b>Implicit Intents</b> have not specified a component; |
| 223 | * instead, they must include enough information for the system to |
| 224 | * determine which of the available components is best to run for that |
| 225 | * intent. |
| 226 | * </ul> |
| 227 | * |
| 228 | * <p>When using implicit intents, given such an arbitrary intent we need to |
| 229 | * know what to do with it. This is handled by the process of <em>Intent |
| 230 | * resolution</em>, which maps an Intent to an {@link android.app.Activity}, |
| 231 | * {@link BroadcastReceiver}, or {@link android.app.Service} (or sometimes two or |
| 232 | * more activities/receivers) that can handle it.</p> |
| 233 | * |
| 234 | * <p>The intent resolution mechanism basically revolves around matching an |
| 235 | * Intent against all of the <intent-filter> descriptions in the |
| 236 | * installed application packages. (Plus, in the case of broadcasts, any {@link BroadcastReceiver} |
| 237 | * objects explicitly registered with {@link Context#registerReceiver}.) More |
| 238 | * details on this can be found in the documentation on the {@link |
| 239 | * IntentFilter} class.</p> |
| 240 | * |
| 241 | * <p>There are three pieces of information in the Intent that are used for |
| 242 | * resolution: the action, type, and category. Using this information, a query |
| 243 | * is done on the {@link PackageManager} for a component that can handle the |
| 244 | * intent. The appropriate component is determined based on the intent |
| 245 | * information supplied in the <code>AndroidManifest.xml</code> file as |
| 246 | * follows:</p> |
| 247 | * |
| 248 | * <ul> |
| 249 | * <li> <p>The <b>action</b>, if given, must be listed by the component as |
| 250 | * one it handles.</p> |
| 251 | * <li> <p>The <b>type</b> is retrieved from the Intent's data, if not |
| 252 | * already supplied in the Intent. Like the action, if a type is |
| 253 | * included in the intent (either explicitly or implicitly in its |
| 254 | * data), then this must be listed by the component as one it handles.</p> |
| 255 | * <li> For data that is not a <code>content:</code> URI and where no explicit |
| 256 | * type is included in the Intent, instead the <b>scheme</b> of the |
| 257 | * intent data (such as <code>http:</code> or <code>mailto:</code>) is |
| 258 | * considered. Again like the action, if we are matching a scheme it |
| 259 | * must be listed by the component as one it can handle. |
| 260 | * <li> <p>The <b>categories</b>, if supplied, must <em>all</em> be listed |
| 261 | * by the activity as categories it handles. That is, if you include |
| 262 | * the categories {@link #CATEGORY_LAUNCHER} and |
| 263 | * {@link #CATEGORY_ALTERNATIVE}, then you will only resolve to components |
| 264 | * with an intent that lists <em>both</em> of those categories. |
| 265 | * Activities will very often need to support the |
| 266 | * {@link #CATEGORY_DEFAULT} so that they can be found by |
| 267 | * {@link Context#startActivity Context.startActivity()}.</p> |
| 268 | * </ul> |
| 269 | * |
| 270 | * <p>For example, consider the Note Pad sample application that |
Joshua Baxter | 9a841a6 | 2018-03-27 14:42:03 -0700 | [diff] [blame] | 271 | * allows a user to browse through a list of notes data and view details about |
| 272 | * 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] | 273 | * name with one specific to your own package.</p> |
| 274 | * |
| 275 | * <pre> <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| 276 | * package="<i>com.android.notepad</i>"> |
| 277 | * <application android:icon="@drawable/app_notes" |
| 278 | * android:label="@string/app_name"> |
| 279 | * |
| 280 | * <provider class=".NotePadProvider" |
| 281 | * android:authorities="<i>com.google.provider.NotePad</i>" /> |
| 282 | * |
| 283 | * <activity class=".NotesList" android:label="@string/title_notes_list"> |
| 284 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 285 | * <action android:name="android.intent.action.MAIN" /> |
| 286 | * <category android:name="android.intent.category.LAUNCHER" /> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 287 | * </intent-filter> |
| 288 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 289 | * <action android:name="android.intent.action.VIEW" /> |
| 290 | * <action android:name="android.intent.action.EDIT" /> |
| 291 | * <action android:name="android.intent.action.PICK" /> |
| 292 | * <category android:name="android.intent.category.DEFAULT" /> |
| 293 | * <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] | 294 | * </intent-filter> |
| 295 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 296 | * <action android:name="android.intent.action.GET_CONTENT" /> |
| 297 | * <category android:name="android.intent.category.DEFAULT" /> |
| 298 | * <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] | 299 | * </intent-filter> |
| 300 | * </activity> |
| 301 | * |
| 302 | * <activity class=".NoteEditor" android:label="@string/title_note"> |
| 303 | * <intent-filter android:label="@string/resolve_edit"> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 304 | * <action android:name="android.intent.action.VIEW" /> |
| 305 | * <action android:name="android.intent.action.EDIT" /> |
| 306 | * <category android:name="android.intent.category.DEFAULT" /> |
| 307 | * <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] | 308 | * </intent-filter> |
| 309 | * |
| 310 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 311 | * <action android:name="android.intent.action.INSERT" /> |
| 312 | * <category android:name="android.intent.category.DEFAULT" /> |
| 313 | * <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] | 314 | * </intent-filter> |
| 315 | * |
| 316 | * </activity> |
| 317 | * |
| 318 | * <activity class=".TitleEditor" android:label="@string/title_edit_title" |
| 319 | * android:theme="@android:style/Theme.Dialog"> |
| 320 | * <intent-filter android:label="@string/resolve_title"> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 321 | * <action android:name="<i>com.android.notepad.action.EDIT_TITLE</i>" /> |
| 322 | * <category android:name="android.intent.category.DEFAULT" /> |
| 323 | * <category android:name="android.intent.category.ALTERNATIVE" /> |
| 324 | * <category android:name="android.intent.category.SELECTED_ALTERNATIVE" /> |
| 325 | * <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] | 326 | * </intent-filter> |
| 327 | * </activity> |
| 328 | * |
| 329 | * </application> |
| 330 | * </manifest></pre> |
| 331 | * |
| 332 | * <p>The first activity, |
| 333 | * <code>com.android.notepad.NotesList</code>, serves as our main |
| 334 | * entry into the app. It can do three things as described by its three intent |
| 335 | * templates: |
| 336 | * <ol> |
| 337 | * <li><pre> |
| 338 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 339 | * <action android:name="{@link #ACTION_MAIN android.intent.action.MAIN}" /> |
| 340 | * <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] | 341 | * </intent-filter></pre> |
| 342 | * <p>This provides a top-level entry into the NotePad application: the standard |
| 343 | * MAIN action is a main entry point (not requiring any other information in |
| 344 | * the Intent), and the LAUNCHER category says that this entry point should be |
| 345 | * listed in the application launcher.</p> |
| 346 | * <li><pre> |
| 347 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 348 | * <action android:name="{@link #ACTION_VIEW android.intent.action.VIEW}" /> |
| 349 | * <action android:name="{@link #ACTION_EDIT android.intent.action.EDIT}" /> |
| 350 | * <action android:name="{@link #ACTION_PICK android.intent.action.PICK}" /> |
| 351 | * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 352 | * <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] | 353 | * </intent-filter></pre> |
| 354 | * <p>This declares the things that the activity can do on a directory of |
| 355 | * notes. The type being supported is given with the <type> tag, where |
| 356 | * <code>vnd.android.cursor.dir/vnd.google.note</code> is a URI from which |
| 357 | * a Cursor of zero or more items (<code>vnd.android.cursor.dir</code>) can |
| 358 | * be retrieved which holds our note pad data (<code>vnd.google.note</code>). |
| 359 | * The activity allows the user to view or edit the directory of data (via |
| 360 | * the VIEW and EDIT actions), or to pick a particular note and return it |
| 361 | * to the caller (via the PICK action). Note also the DEFAULT category |
| 362 | * supplied here: this is <em>required</em> for the |
| 363 | * {@link Context#startActivity Context.startActivity} method to resolve your |
| 364 | * activity when its component name is not explicitly specified.</p> |
| 365 | * <li><pre> |
| 366 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 367 | * <action android:name="{@link #ACTION_GET_CONTENT android.intent.action.GET_CONTENT}" /> |
| 368 | * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> |
| 369 | * <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] | 370 | * </intent-filter></pre> |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 371 | * <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] | 372 | * the user without needing to know where it came from. The data type |
| 373 | * <code>vnd.android.cursor.item/vnd.google.note</code> is a URI from which |
| 374 | * a Cursor of exactly one (<code>vnd.android.cursor.item</code>) item can |
| 375 | * be retrieved which contains our note pad data (<code>vnd.google.note</code>). |
| 376 | * The GET_CONTENT action is similar to the PICK action, where the activity |
| 377 | * will return to its caller a piece of data selected by the user. Here, |
| 378 | * however, the caller specifies the type of data they desire instead of |
| 379 | * the type of data the user will be picking from.</p> |
| 380 | * </ol> |
| 381 | * |
| 382 | * <p>Given these capabilities, the following intents will resolve to the |
| 383 | * NotesList activity:</p> |
| 384 | * |
| 385 | * <ul> |
| 386 | * <li> <p><b>{ action=android.app.action.MAIN }</b> matches all of the |
| 387 | * activities that can be used as top-level entry points into an |
| 388 | * application.</p> |
| 389 | * <li> <p><b>{ action=android.app.action.MAIN, |
| 390 | * category=android.app.category.LAUNCHER }</b> is the actual intent |
| 391 | * used by the Launcher to populate its top-level list.</p> |
Yusuf T. Mobile | 8ecb36e | 2009-07-10 14:13:29 -0700 | [diff] [blame] | 392 | * <li> <p><b>{ action=android.intent.action.VIEW |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 393 | * data=content://com.google.provider.NotePad/notes }</b> |
| 394 | * displays a list of all the notes under |
| 395 | * "content://com.google.provider.NotePad/notes", which |
| 396 | * the user can browse through and see the details on.</p> |
| 397 | * <li> <p><b>{ action=android.app.action.PICK |
| 398 | * data=content://com.google.provider.NotePad/notes }</b> |
| 399 | * provides a list of the notes under |
| 400 | * "content://com.google.provider.NotePad/notes", from which |
| 401 | * the user can pick a note whose data URL is returned back to the caller.</p> |
| 402 | * <li> <p><b>{ action=android.app.action.GET_CONTENT |
| 403 | * type=vnd.android.cursor.item/vnd.google.note }</b> |
| 404 | * is similar to the pick action, but allows the caller to specify the |
| 405 | * kind of data they want back so that the system can find the appropriate |
| 406 | * activity to pick something of that data type.</p> |
| 407 | * </ul> |
| 408 | * |
| 409 | * <p>The second activity, |
| 410 | * <code>com.android.notepad.NoteEditor</code>, shows the user a single |
| 411 | * note entry and allows them to edit it. It can do two things as described |
| 412 | * by its two intent templates: |
| 413 | * <ol> |
| 414 | * <li><pre> |
| 415 | * <intent-filter android:label="@string/resolve_edit"> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 416 | * <action android:name="{@link #ACTION_VIEW android.intent.action.VIEW}" /> |
| 417 | * <action android:name="{@link #ACTION_EDIT android.intent.action.EDIT}" /> |
| 418 | * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> |
| 419 | * <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] | 420 | * </intent-filter></pre> |
| 421 | * <p>The first, primary, purpose of this activity is to let the user interact |
| 422 | * with a single note, as decribed by the MIME type |
| 423 | * <code>vnd.android.cursor.item/vnd.google.note</code>. The activity can |
| 424 | * either VIEW a note or allow the user to EDIT it. Again we support the |
| 425 | * DEFAULT category to allow the activity to be launched without explicitly |
| 426 | * specifying its component.</p> |
| 427 | * <li><pre> |
| 428 | * <intent-filter> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 429 | * <action android:name="{@link #ACTION_INSERT android.intent.action.INSERT}" /> |
| 430 | * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> |
| 431 | * <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] | 432 | * </intent-filter></pre> |
| 433 | * <p>The secondary use of this activity is to insert a new note entry into |
| 434 | * an existing directory of notes. This is used when the user creates a new |
| 435 | * note: the INSERT action is executed on the directory of notes, causing |
| 436 | * this activity to run and have the user create the new note data which |
| 437 | * it then adds to the content provider.</p> |
| 438 | * </ol> |
| 439 | * |
| 440 | * <p>Given these capabilities, the following intents will resolve to the |
| 441 | * NoteEditor activity:</p> |
| 442 | * |
| 443 | * <ul> |
Yusuf T. Mobile | 8ecb36e | 2009-07-10 14:13:29 -0700 | [diff] [blame] | 444 | * <li> <p><b>{ action=android.intent.action.VIEW |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 445 | * data=content://com.google.provider.NotePad/notes/<var>{ID}</var> }</b> |
| 446 | * shows the user the content of note <var>{ID}</var>.</p> |
| 447 | * <li> <p><b>{ action=android.app.action.EDIT |
| 448 | * data=content://com.google.provider.NotePad/notes/<var>{ID}</var> }</b> |
| 449 | * allows the user to edit the content of note <var>{ID}</var>.</p> |
| 450 | * <li> <p><b>{ action=android.app.action.INSERT |
| 451 | * data=content://com.google.provider.NotePad/notes }</b> |
| 452 | * creates a new, empty note in the notes list at |
| 453 | * "content://com.google.provider.NotePad/notes" |
| 454 | * and allows the user to edit it. If they keep their changes, the URI |
| 455 | * of the newly created note is returned to the caller.</p> |
| 456 | * </ul> |
| 457 | * |
| 458 | * <p>The last activity, |
| 459 | * <code>com.android.notepad.TitleEditor</code>, allows the user to |
| 460 | * edit the title of a note. This could be implemented as a class that the |
| 461 | * application directly invokes (by explicitly setting its component in |
| 462 | * the Intent), but here we show a way you can publish alternative |
| 463 | * operations on existing data:</p> |
| 464 | * |
| 465 | * <pre> |
| 466 | * <intent-filter android:label="@string/resolve_title"> |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 467 | * <action android:name="<i>com.android.notepad.action.EDIT_TITLE</i>" /> |
| 468 | * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> |
| 469 | * <category android:name="{@link #CATEGORY_ALTERNATIVE android.intent.category.ALTERNATIVE}" /> |
| 470 | * <category android:name="{@link #CATEGORY_SELECTED_ALTERNATIVE android.intent.category.SELECTED_ALTERNATIVE}" /> |
| 471 | * <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] | 472 | * </intent-filter></pre> |
| 473 | * |
| 474 | * <p>In the single intent template here, we |
| 475 | * have created our own private action called |
| 476 | * <code>com.android.notepad.action.EDIT_TITLE</code> which means to |
| 477 | * edit the title of a note. It must be invoked on a specific note |
| 478 | * (data type <code>vnd.android.cursor.item/vnd.google.note</code>) like the previous |
| 479 | * view and edit actions, but here displays and edits the title contained |
| 480 | * in the note data. |
| 481 | * |
| 482 | * <p>In addition to supporting the default category as usual, our title editor |
| 483 | * also supports two other standard categories: ALTERNATIVE and |
| 484 | * SELECTED_ALTERNATIVE. Implementing |
| 485 | * these categories allows others to find the special action it provides |
| 486 | * without directly knowing about it, through the |
| 487 | * {@link android.content.pm.PackageManager#queryIntentActivityOptions} method, or |
| 488 | * more often to build dynamic menu items with |
| 489 | * {@link android.view.Menu#addIntentOptions}. Note that in the intent |
| 490 | * template here was also supply an explicit name for the template |
| 491 | * (via <code>android:label="@string/resolve_title"</code>) to better control |
| 492 | * what the user sees when presented with this activity as an alternative |
| 493 | * action to the data they are viewing. |
| 494 | * |
| 495 | * <p>Given these capabilities, the following intent will resolve to the |
| 496 | * TitleEditor activity:</p> |
| 497 | * |
| 498 | * <ul> |
| 499 | * <li> <p><b>{ action=com.android.notepad.action.EDIT_TITLE |
| 500 | * data=content://com.google.provider.NotePad/notes/<var>{ID}</var> }</b> |
| 501 | * displays and allows the user to edit the title associated |
| 502 | * with note <var>{ID}</var>.</p> |
| 503 | * </ul> |
| 504 | * |
| 505 | * <h3>Standard Activity Actions</h3> |
| 506 | * |
| 507 | * <p>These are the current standard actions that Intent defines for launching |
| 508 | * activities (usually through {@link Context#startActivity}. The most |
| 509 | * important, and by far most frequently used, are {@link #ACTION_MAIN} and |
| 510 | * {@link #ACTION_EDIT}. |
| 511 | * |
| 512 | * <ul> |
| 513 | * <li> {@link #ACTION_MAIN} |
| 514 | * <li> {@link #ACTION_VIEW} |
| 515 | * <li> {@link #ACTION_ATTACH_DATA} |
| 516 | * <li> {@link #ACTION_EDIT} |
| 517 | * <li> {@link #ACTION_PICK} |
| 518 | * <li> {@link #ACTION_CHOOSER} |
| 519 | * <li> {@link #ACTION_GET_CONTENT} |
| 520 | * <li> {@link #ACTION_DIAL} |
| 521 | * <li> {@link #ACTION_CALL} |
| 522 | * <li> {@link #ACTION_SEND} |
| 523 | * <li> {@link #ACTION_SENDTO} |
| 524 | * <li> {@link #ACTION_ANSWER} |
| 525 | * <li> {@link #ACTION_INSERT} |
| 526 | * <li> {@link #ACTION_DELETE} |
| 527 | * <li> {@link #ACTION_RUN} |
| 528 | * <li> {@link #ACTION_SYNC} |
| 529 | * <li> {@link #ACTION_PICK_ACTIVITY} |
| 530 | * <li> {@link #ACTION_SEARCH} |
| 531 | * <li> {@link #ACTION_WEB_SEARCH} |
| 532 | * <li> {@link #ACTION_FACTORY_TEST} |
| 533 | * </ul> |
| 534 | * |
| 535 | * <h3>Standard Broadcast Actions</h3> |
| 536 | * |
| 537 | * <p>These are the current standard actions that Intent defines for receiving |
| 538 | * broadcasts (usually through {@link Context#registerReceiver} or a |
| 539 | * <receiver> tag in a manifest). |
| 540 | * |
| 541 | * <ul> |
| 542 | * <li> {@link #ACTION_TIME_TICK} |
| 543 | * <li> {@link #ACTION_TIME_CHANGED} |
| 544 | * <li> {@link #ACTION_TIMEZONE_CHANGED} |
| 545 | * <li> {@link #ACTION_BOOT_COMPLETED} |
| 546 | * <li> {@link #ACTION_PACKAGE_ADDED} |
| 547 | * <li> {@link #ACTION_PACKAGE_CHANGED} |
| 548 | * <li> {@link #ACTION_PACKAGE_REMOVED} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 549 | * <li> {@link #ACTION_PACKAGE_RESTARTED} |
| 550 | * <li> {@link #ACTION_PACKAGE_DATA_CLEARED} |
Andrei Stingaceanu | 69d5ebc | 2016-01-14 12:59:03 +0000 | [diff] [blame] | 551 | * <li> {@link #ACTION_PACKAGES_SUSPENDED} |
| 552 | * <li> {@link #ACTION_PACKAGES_UNSUSPENDED} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 553 | * <li> {@link #ACTION_UID_REMOVED} |
| 554 | * <li> {@link #ACTION_BATTERY_CHANGED} |
Cliff Spradlin | fda6fae | 2008-10-22 20:29:16 -0700 | [diff] [blame] | 555 | * <li> {@link #ACTION_POWER_CONNECTED} |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 556 | * <li> {@link #ACTION_POWER_DISCONNECTED} |
| 557 | * <li> {@link #ACTION_SHUTDOWN} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 558 | * </ul> |
| 559 | * |
| 560 | * <h3>Standard Categories</h3> |
| 561 | * |
| 562 | * <p>These are the current standard categories that can be used to further |
| 563 | * clarify an Intent via {@link #addCategory}. |
| 564 | * |
| 565 | * <ul> |
| 566 | * <li> {@link #CATEGORY_DEFAULT} |
| 567 | * <li> {@link #CATEGORY_BROWSABLE} |
| 568 | * <li> {@link #CATEGORY_TAB} |
| 569 | * <li> {@link #CATEGORY_ALTERNATIVE} |
| 570 | * <li> {@link #CATEGORY_SELECTED_ALTERNATIVE} |
| 571 | * <li> {@link #CATEGORY_LAUNCHER} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 572 | * <li> {@link #CATEGORY_INFO} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 573 | * <li> {@link #CATEGORY_HOME} |
| 574 | * <li> {@link #CATEGORY_PREFERENCE} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 575 | * <li> {@link #CATEGORY_TEST} |
Mike Lockwood | 9092ab4 | 2009-09-16 13:01:32 -0400 | [diff] [blame] | 576 | * <li> {@link #CATEGORY_CAR_DOCK} |
| 577 | * <li> {@link #CATEGORY_DESK_DOCK} |
Praveen Bharathi | 21e941b | 2010-10-06 15:23:14 -0500 | [diff] [blame] | 578 | * <li> {@link #CATEGORY_LE_DESK_DOCK} |
| 579 | * <li> {@link #CATEGORY_HE_DESK_DOCK} |
Bernd Holzhey | aea4b67 | 2010-03-31 09:46:13 +0200 | [diff] [blame] | 580 | * <li> {@link #CATEGORY_CAR_MODE} |
Patrick Dubroy | 6dabe24 | 2010-08-30 10:43:47 -0700 | [diff] [blame] | 581 | * <li> {@link #CATEGORY_APP_MARKET} |
Zak Cohen | db6ca49 | 2017-01-26 14:09:00 -0800 | [diff] [blame] | 582 | * <li> {@link #CATEGORY_VR_HOME} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 583 | * </ul> |
| 584 | * |
| 585 | * <h3>Standard Extra Data</h3> |
| 586 | * |
| 587 | * <p>These are the current standard fields that can be used as extra data via |
| 588 | * {@link #putExtra}. |
| 589 | * |
| 590 | * <ul> |
Trevor Johns | d59fb6e | 2009-11-20 12:54:57 -0800 | [diff] [blame] | 591 | * <li> {@link #EXTRA_ALARM_COUNT} |
| 592 | * <li> {@link #EXTRA_BCC} |
| 593 | * <li> {@link #EXTRA_CC} |
| 594 | * <li> {@link #EXTRA_CHANGED_COMPONENT_NAME} |
| 595 | * <li> {@link #EXTRA_DATA_REMOVED} |
| 596 | * <li> {@link #EXTRA_DOCK_STATE} |
Praveen Bharathi | 21e941b | 2010-10-06 15:23:14 -0500 | [diff] [blame] | 597 | * <li> {@link #EXTRA_DOCK_STATE_HE_DESK} |
| 598 | * <li> {@link #EXTRA_DOCK_STATE_LE_DESK} |
Trevor Johns | d59fb6e | 2009-11-20 12:54:57 -0800 | [diff] [blame] | 599 | * <li> {@link #EXTRA_DOCK_STATE_CAR} |
| 600 | * <li> {@link #EXTRA_DOCK_STATE_DESK} |
| 601 | * <li> {@link #EXTRA_DOCK_STATE_UNDOCKED} |
| 602 | * <li> {@link #EXTRA_DONT_KILL_APP} |
| 603 | * <li> {@link #EXTRA_EMAIL} |
| 604 | * <li> {@link #EXTRA_INITIAL_INTENTS} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 605 | * <li> {@link #EXTRA_INTENT} |
Trevor Johns | d59fb6e | 2009-11-20 12:54:57 -0800 | [diff] [blame] | 606 | * <li> {@link #EXTRA_KEY_EVENT} |
rich cannings | 706e8ba | 2012-08-20 13:20:14 -0700 | [diff] [blame] | 607 | * <li> {@link #EXTRA_ORIGINATING_URI} |
Trevor Johns | d59fb6e | 2009-11-20 12:54:57 -0800 | [diff] [blame] | 608 | * <li> {@link #EXTRA_PHONE_NUMBER} |
rich cannings | 368ed01 | 2012-06-07 15:37:57 -0700 | [diff] [blame] | 609 | * <li> {@link #EXTRA_REFERRER} |
Trevor Johns | d59fb6e | 2009-11-20 12:54:57 -0800 | [diff] [blame] | 610 | * <li> {@link #EXTRA_REMOTE_INTENT_TOKEN} |
| 611 | * <li> {@link #EXTRA_REPLACING} |
| 612 | * <li> {@link #EXTRA_SHORTCUT_ICON} |
| 613 | * <li> {@link #EXTRA_SHORTCUT_ICON_RESOURCE} |
| 614 | * <li> {@link #EXTRA_SHORTCUT_INTENT} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 615 | * <li> {@link #EXTRA_STREAM} |
Trevor Johns | d59fb6e | 2009-11-20 12:54:57 -0800 | [diff] [blame] | 616 | * <li> {@link #EXTRA_SHORTCUT_NAME} |
| 617 | * <li> {@link #EXTRA_SUBJECT} |
| 618 | * <li> {@link #EXTRA_TEMPLATE} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 619 | * <li> {@link #EXTRA_TEXT} |
Trevor Johns | d59fb6e | 2009-11-20 12:54:57 -0800 | [diff] [blame] | 620 | * <li> {@link #EXTRA_TITLE} |
| 621 | * <li> {@link #EXTRA_UID} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 622 | * </ul> |
| 623 | * |
| 624 | * <h3>Flags</h3> |
| 625 | * |
| 626 | * <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] | 627 | * {@link #setFlags} and {@link #addFlags}. See {@link #setFlags} for a list |
| 628 | * of all possible flags. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 629 | */ |
Dianne Hackborn | ee0511d | 2009-12-21 18:08:13 -0800 | [diff] [blame] | 630 | public class Intent implements Parcelable, Cloneable { |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 631 | private static final String ATTR_ACTION = "action"; |
| 632 | private static final String TAG_CATEGORIES = "categories"; |
| 633 | private static final String ATTR_CATEGORY = "category"; |
| 634 | private static final String TAG_EXTRA = "extra"; |
| 635 | private static final String ATTR_TYPE = "type"; |
| 636 | private static final String ATTR_COMPONENT = "component"; |
| 637 | private static final String ATTR_DATA = "data"; |
| 638 | private static final String ATTR_FLAGS = "flags"; |
| 639 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 640 | // --------------------------------------------------------------------- |
| 641 | // --------------------------------------------------------------------- |
| 642 | // Standard intent activity actions (see action variable). |
| 643 | |
| 644 | /** |
| 645 | * Activity Action: Start as a main entry point, does not expect to |
| 646 | * receive data. |
| 647 | * <p>Input: nothing |
| 648 | * <p>Output: nothing |
| 649 | */ |
| 650 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 651 | 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] | 652 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 653 | /** |
| 654 | * Activity Action: Display the data to the user. This is the most common |
| 655 | * action performed on data -- it is the generic action you can use on |
| 656 | * a piece of data to get the most reasonable thing to occur. For example, |
| 657 | * when used on a contacts entry it will view the entry; when used on a |
| 658 | * mailto: URI it will bring up a compose window filled with the information |
| 659 | * supplied by the URI; when used with a tel: URI it will invoke the |
| 660 | * dialer. |
| 661 | * <p>Input: {@link #getData} is URI from which to retrieve data. |
| 662 | * <p>Output: nothing. |
| 663 | */ |
| 664 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 665 | 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] | 666 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 667 | /** |
Dianne Hackborn | a320f01 | 2017-04-07 13:57:48 -0700 | [diff] [blame] | 668 | * Extra that can be included on activity intents coming from the storage UI |
| 669 | * when it launches sub-activities to manage various types of storage. For example, |
| 670 | * it may use {@link #ACTION_VIEW} with a "image/*" MIME type to have an app show |
| 671 | * the images on the device, and in that case also include this extra to tell the |
| 672 | * app it is coming from the storage UI so should help the user manage storage of |
| 673 | * this type. |
| 674 | */ |
| 675 | public static final String EXTRA_FROM_STORAGE = "android.intent.extra.FROM_STORAGE"; |
| 676 | |
| 677 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 678 | * A synonym for {@link #ACTION_VIEW}, the "standard" action that is |
| 679 | * performed on a piece of data. |
| 680 | */ |
| 681 | public static final String ACTION_DEFAULT = ACTION_VIEW; |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 682 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 683 | /** |
Tomasz Mikolajewski | 319fb49 | 2016-01-20 12:24:01 +0900 | [diff] [blame] | 684 | * Activity Action: Quick view the data. Launches a quick viewer for |
| 685 | * a URI or a list of URIs. |
Tomasz Mikolajewski | fe02313 | 2016-03-10 17:42:35 +0900 | [diff] [blame] | 686 | * <p>Activities handling this intent action should handle the vast majority of |
| 687 | * MIME types rather than only specific ones. |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 688 | * <p>Quick viewers must render the quick view image locally, and must not send |
| 689 | * file content outside current device. |
Tomasz Mikolajewski | 319fb49 | 2016-01-20 12:24:01 +0900 | [diff] [blame] | 690 | * <p>Input: {@link #getData} is a mandatory content URI of the item to |
| 691 | * preview. {@link #getClipData} contains an optional list of content URIs |
| 692 | * if there is more than one item to preview. {@link #EXTRA_INDEX} is an |
| 693 | * optional index of the URI in the clip data to show first. |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 694 | * {@link #EXTRA_QUICK_VIEW_FEATURES} is an optional extra indicating the features |
| 695 | * that can be shown in the quick view UI. |
Steve McKay | c78bcb8 | 2015-07-31 14:35:22 -0700 | [diff] [blame] | 696 | * <p>Output: nothing. |
Tomasz Mikolajewski | 867addf | 2017-02-01 14:16:39 +0900 | [diff] [blame] | 697 | * @see #EXTRA_INDEX |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 698 | * @see #EXTRA_QUICK_VIEW_FEATURES |
Steve McKay | c78bcb8 | 2015-07-31 14:35:22 -0700 | [diff] [blame] | 699 | */ |
| 700 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 701 | public static final String ACTION_QUICK_VIEW = "android.intent.action.QUICK_VIEW"; |
| 702 | |
| 703 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 704 | * Used to indicate that some piece of data should be attached to some other |
| 705 | * place. For example, image data could be attached to a contact. It is up |
| 706 | * to the recipient to decide where the data should be attached; the intent |
| 707 | * does not specify the ultimate destination. |
| 708 | * <p>Input: {@link #getData} is URI of data to be attached. |
| 709 | * <p>Output: nothing. |
| 710 | */ |
| 711 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 712 | 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] | 713 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 714 | /** |
| 715 | * Activity Action: Provide explicit editable access to the given data. |
| 716 | * <p>Input: {@link #getData} is URI of data to be edited. |
| 717 | * <p>Output: nothing. |
| 718 | */ |
| 719 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 720 | 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] | 721 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 722 | /** |
| 723 | * Activity Action: Pick an existing item, or insert a new item, and then edit it. |
| 724 | * <p>Input: {@link #getType} is the desired MIME type of the item to create or edit. |
| 725 | * The extras can contain type specific data to pass through to the editing/creating |
| 726 | * activity. |
| 727 | * <p>Output: The URI of the item that was picked. This must be a content: |
| 728 | * URI so that any receiver can access it. |
| 729 | */ |
| 730 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 731 | 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] | 732 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 733 | /** |
| 734 | * Activity Action: Pick an item from the data, returning what was selected. |
| 735 | * <p>Input: {@link #getData} is URI containing a directory of data |
| 736 | * (vnd.android.cursor.dir/*) from which to pick an item. |
| 737 | * <p>Output: The URI of the item that was picked. |
| 738 | */ |
| 739 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 740 | 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] | 741 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 742 | /** |
| 743 | * Activity Action: Creates a shortcut. |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 744 | * <p>Input: Nothing.</p> |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 745 | * <p>Output: An Intent representing the {@link android.content.pm.ShortcutInfo} result.</p> |
| 746 | * <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] | 747 | * extras: SHORTCUT_INTENT (value: Intent), SHORTCUT_NAME (value: String), |
| 748 | * and SHORTCUT_ICON (value: Bitmap) or SHORTCUT_ICON_RESOURCE |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 749 | * (value: ShortcutIconResource).</p> |
| 750 | * |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 751 | * @see android.content.pm.ShortcutManager#createShortcutResultIntent |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 752 | * @see #EXTRA_SHORTCUT_INTENT |
| 753 | * @see #EXTRA_SHORTCUT_NAME |
| 754 | * @see #EXTRA_SHORTCUT_ICON |
| 755 | * @see #EXTRA_SHORTCUT_ICON_RESOURCE |
| 756 | * @see android.content.Intent.ShortcutIconResource |
| 757 | */ |
| 758 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 759 | public static final String ACTION_CREATE_SHORTCUT = "android.intent.action.CREATE_SHORTCUT"; |
| 760 | |
| 761 | /** |
| 762 | * The name of the extra used to define the Intent of a shortcut. |
| 763 | * |
| 764 | * @see #ACTION_CREATE_SHORTCUT |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 765 | * @deprecated Replaced with {@link android.content.pm.ShortcutManager#createShortcutResultIntent} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 766 | */ |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 767 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 768 | public static final String EXTRA_SHORTCUT_INTENT = "android.intent.extra.shortcut.INTENT"; |
| 769 | /** |
| 770 | * The name of the extra used to define the name of a shortcut. |
| 771 | * |
| 772 | * @see #ACTION_CREATE_SHORTCUT |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 773 | * @deprecated Replaced with {@link android.content.pm.ShortcutManager#createShortcutResultIntent} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 774 | */ |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 775 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 776 | public static final String EXTRA_SHORTCUT_NAME = "android.intent.extra.shortcut.NAME"; |
| 777 | /** |
| 778 | * The name of the extra used to define the icon, as a Bitmap, of a shortcut. |
| 779 | * |
| 780 | * @see #ACTION_CREATE_SHORTCUT |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 781 | * @deprecated Replaced with {@link android.content.pm.ShortcutManager#createShortcutResultIntent} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 782 | */ |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 783 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 784 | public static final String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON"; |
| 785 | /** |
| 786 | * The name of the extra used to define the icon, as a ShortcutIconResource, of a shortcut. |
| 787 | * |
| 788 | * @see #ACTION_CREATE_SHORTCUT |
| 789 | * @see android.content.Intent.ShortcutIconResource |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 790 | * @deprecated Replaced with {@link android.content.pm.ShortcutManager#createShortcutResultIntent} |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 791 | */ |
Sunny Goyal | a6be88a | 2017-01-12 16:27:58 -0800 | [diff] [blame] | 792 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 793 | public static final String EXTRA_SHORTCUT_ICON_RESOURCE = |
| 794 | "android.intent.extra.shortcut.ICON_RESOURCE"; |
| 795 | |
| 796 | /** |
Jason Monk | 2f68e8a | 2016-02-23 17:57:28 -0500 | [diff] [blame] | 797 | * An activity that provides a user interface for adjusting application preferences. |
| 798 | * Optional but recommended settings for all applications which have settings. |
| 799 | */ |
| 800 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 801 | public static final String ACTION_APPLICATION_PREFERENCES |
| 802 | = "android.intent.action.APPLICATION_PREFERENCES"; |
| 803 | |
| 804 | /** |
Sudheer Shanka | 80b6641 | 2016-04-06 18:31:10 -0700 | [diff] [blame] | 805 | * Activity Action: Launch an activity showing the app information. |
| 806 | * For applications which install other applications (such as app stores), it is recommended |
| 807 | * to handle this action for providing the app information to the user. |
| 808 | * |
| 809 | * <p>Input: {@link #EXTRA_PACKAGE_NAME} specifies the package whose information needs |
| 810 | * to be displayed. |
| 811 | * <p>Output: Nothing. |
| 812 | */ |
| 813 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 814 | public static final String ACTION_SHOW_APP_INFO |
| 815 | = "android.intent.action.SHOW_APP_INFO"; |
| 816 | |
| 817 | /** |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 818 | * Represents a shortcut/live folder icon resource. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 819 | * |
| 820 | * @see Intent#ACTION_CREATE_SHORTCUT |
| 821 | * @see Intent#EXTRA_SHORTCUT_ICON_RESOURCE |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 822 | * @see android.provider.LiveFolders#ACTION_CREATE_LIVE_FOLDER |
| 823 | * @see android.provider.LiveFolders#EXTRA_LIVE_FOLDER_ICON |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 824 | */ |
| 825 | public static class ShortcutIconResource implements Parcelable { |
| 826 | /** |
| 827 | * The package name of the application containing the icon. |
| 828 | */ |
| 829 | public String packageName; |
| 830 | |
| 831 | /** |
| 832 | * The resource name of the icon, including package, name and type. |
| 833 | */ |
| 834 | public String resourceName; |
| 835 | |
| 836 | /** |
| 837 | * Creates a new ShortcutIconResource for the specified context and resource |
| 838 | * identifier. |
| 839 | * |
| 840 | * @param context The context of the application. |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 841 | * @param resourceId The resource identifier for the icon. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 842 | * @return A new ShortcutIconResource with the specified's context package name |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 843 | * and icon resource identifier.`` |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 844 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 845 | public static ShortcutIconResource fromContext(Context context, @AnyRes int resourceId) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 846 | ShortcutIconResource icon = new ShortcutIconResource(); |
| 847 | icon.packageName = context.getPackageName(); |
| 848 | icon.resourceName = context.getResources().getResourceName(resourceId); |
| 849 | return icon; |
| 850 | } |
| 851 | |
| 852 | /** |
| 853 | * Used to read a ShortcutIconResource from a Parcel. |
| 854 | */ |
| 855 | public static final Parcelable.Creator<ShortcutIconResource> CREATOR = |
| 856 | new Parcelable.Creator<ShortcutIconResource>() { |
| 857 | |
| 858 | public ShortcutIconResource createFromParcel(Parcel source) { |
| 859 | ShortcutIconResource icon = new ShortcutIconResource(); |
| 860 | icon.packageName = source.readString(); |
| 861 | icon.resourceName = source.readString(); |
| 862 | return icon; |
| 863 | } |
| 864 | |
| 865 | public ShortcutIconResource[] newArray(int size) { |
| 866 | return new ShortcutIconResource[size]; |
| 867 | } |
| 868 | }; |
| 869 | |
| 870 | /** |
| 871 | * No special parcel contents. |
| 872 | */ |
| 873 | public int describeContents() { |
| 874 | return 0; |
| 875 | } |
| 876 | |
| 877 | public void writeToParcel(Parcel dest, int flags) { |
| 878 | dest.writeString(packageName); |
| 879 | dest.writeString(resourceName); |
| 880 | } |
| 881 | |
| 882 | @Override |
| 883 | public String toString() { |
| 884 | return resourceName; |
| 885 | } |
| 886 | } |
| 887 | |
| 888 | /** |
| 889 | * Activity Action: Display an activity chooser, allowing the user to pick |
| 890 | * what they want to before proceeding. This can be used as an alternative |
| 891 | * to the standard activity picker that is displayed by the system when |
| 892 | * you try to start an activity with multiple possible matches, with these |
| 893 | * differences in behavior: |
| 894 | * <ul> |
| 895 | * <li>You can specify the title that will appear in the activity chooser. |
| 896 | * <li>The user does not have the option to make one of the matching |
| 897 | * activities a preferred activity, and all possible activities will |
| 898 | * always be shown even if one of them is currently marked as the |
| 899 | * preferred activity. |
| 900 | * </ul> |
| 901 | * <p> |
| 902 | * This action should be used when the user will naturally expect to |
| 903 | * select an activity in order to proceed. An example if when not to use |
| 904 | * it is when the user clicks on a "mailto:" link. They would naturally |
| 905 | * expect to go directly to their mail app, so startActivity() should be |
| 906 | * called directly: it will |
| 907 | * either launch the current preferred app, or put up a dialog allowing the |
| 908 | * user to pick an app to use and optionally marking that as preferred. |
| 909 | * <p> |
| 910 | * In contrast, if the user is selecting a menu item to send a picture |
| 911 | * they are viewing to someone else, there are many different things they |
| 912 | * may want to do at this point: send it through e-mail, upload it to a |
| 913 | * web service, etc. In this case the CHOOSER action should be used, to |
| 914 | * always present to the user a list of the things they can do, with a |
| 915 | * nice title given by the caller such as "Send this photo with:". |
| 916 | * <p> |
Dianne Hackborn | e302a16 | 2012-05-15 14:58:32 -0700 | [diff] [blame] | 917 | * If you need to grant URI permissions through a chooser, you must specify |
| 918 | * the permissions to be granted on the ACTION_CHOOSER Intent |
| 919 | * <em>in addition</em> to the EXTRA_INTENT inside. This means using |
| 920 | * {@link #setClipData} to specify the URIs to be granted as well as |
| 921 | * {@link #FLAG_GRANT_READ_URI_PERMISSION} and/or |
| 922 | * {@link #FLAG_GRANT_WRITE_URI_PERMISSION} as appropriate. |
| 923 | * <p> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 924 | * As a convenience, an Intent of this form can be created with the |
| 925 | * {@link #createChooser} function. |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 926 | * <p> |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 927 | * 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] | 928 | * a {@link #EXTRA_INTENT} field containing the Intent being executed, |
| 929 | * and can optionally have a {@link #EXTRA_TITLE} field containing the |
| 930 | * title text to display in the chooser. |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 931 | * <p> |
| 932 | * Output: Depends on the protocol of {@link #EXTRA_INTENT}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 933 | */ |
| 934 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 935 | public static final String ACTION_CHOOSER = "android.intent.action.CHOOSER"; |
| 936 | |
| 937 | /** |
| 938 | * Convenience function for creating a {@link #ACTION_CHOOSER} Intent. |
| 939 | * |
Dianne Hackborn | e302a16 | 2012-05-15 14:58:32 -0700 | [diff] [blame] | 940 | * <p>Builds a new {@link #ACTION_CHOOSER} Intent that wraps the given |
| 941 | * target intent, also optionally supplying a title. If the target |
| 942 | * intent has specified {@link #FLAG_GRANT_READ_URI_PERMISSION} or |
| 943 | * {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, then these flags will also be |
| 944 | * set in the returned chooser intent, with its ClipData set appropriately: |
| 945 | * either a direct reflection of {@link #getClipData()} if that is non-null, |
John Spurlock | 3390018 | 2014-01-02 11:04:18 -0500 | [diff] [blame] | 946 | * or a new ClipData built from {@link #getData()}. |
Dianne Hackborn | e302a16 | 2012-05-15 14:58:32 -0700 | [diff] [blame] | 947 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 948 | * @param target The Intent that the user will be selecting an activity |
| 949 | * to perform. |
| 950 | * @param title Optional title that will be displayed in the chooser. |
| 951 | * @return Return a new Intent object that you can hand to |
| 952 | * {@link Context#startActivity(Intent) Context.startActivity()} and |
| 953 | * related methods. |
| 954 | */ |
| 955 | public static Intent createChooser(Intent target, CharSequence title) { |
Adam Powell | 0b3c112 | 2014-10-09 12:50:14 -0700 | [diff] [blame] | 956 | return createChooser(target, title, null); |
| 957 | } |
| 958 | |
| 959 | /** |
| 960 | * Convenience function for creating a {@link #ACTION_CHOOSER} Intent. |
| 961 | * |
| 962 | * <p>Builds a new {@link #ACTION_CHOOSER} Intent that wraps the given |
| 963 | * target intent, also optionally supplying a title. If the target |
| 964 | * intent has specified {@link #FLAG_GRANT_READ_URI_PERMISSION} or |
| 965 | * {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, then these flags will also be |
| 966 | * set in the returned chooser intent, with its ClipData set appropriately: |
| 967 | * either a direct reflection of {@link #getClipData()} if that is non-null, |
| 968 | * or a new ClipData built from {@link #getData()}.</p> |
| 969 | * |
| 970 | * <p>The caller may optionally supply an {@link IntentSender} to receive a callback |
| 971 | * when the user makes a choice. This can be useful if the calling application wants |
| 972 | * to remember the last chosen target and surface it as a more prominent or one-touch |
| 973 | * affordance elsewhere in the UI for next time.</p> |
| 974 | * |
| 975 | * @param target The Intent that the user will be selecting an activity |
| 976 | * to perform. |
| 977 | * @param title Optional title that will be displayed in the chooser. |
| 978 | * @param sender Optional IntentSender to be called when a choice is made. |
| 979 | * @return Return a new Intent object that you can hand to |
| 980 | * {@link Context#startActivity(Intent) Context.startActivity()} and |
| 981 | * related methods. |
| 982 | */ |
| 983 | 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] | 984 | Intent intent = new Intent(ACTION_CHOOSER); |
| 985 | intent.putExtra(EXTRA_INTENT, target); |
| 986 | if (title != null) { |
| 987 | intent.putExtra(EXTRA_TITLE, title); |
| 988 | } |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 989 | |
Adam Powell | 0b3c112 | 2014-10-09 12:50:14 -0700 | [diff] [blame] | 990 | if (sender != null) { |
| 991 | intent.putExtra(EXTRA_CHOSEN_COMPONENT_INTENT_SENDER, sender); |
| 992 | } |
| 993 | |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 994 | // Migrate any clip data and flags from target. |
Jeff Sharkey | 846318a | 2014-04-04 12:12:41 -0700 | [diff] [blame] | 995 | int permFlags = target.getFlags() & (FLAG_GRANT_READ_URI_PERMISSION |
| 996 | | FLAG_GRANT_WRITE_URI_PERMISSION | FLAG_GRANT_PERSISTABLE_URI_PERMISSION |
| 997 | | FLAG_GRANT_PREFIX_URI_PERMISSION); |
Dianne Hackborn | e302a16 | 2012-05-15 14:58:32 -0700 | [diff] [blame] | 998 | if (permFlags != 0) { |
| 999 | ClipData targetClipData = target.getClipData(); |
| 1000 | if (targetClipData == null && target.getData() != null) { |
| 1001 | ClipData.Item item = new ClipData.Item(target.getData()); |
| 1002 | String[] mimeTypes; |
| 1003 | if (target.getType() != null) { |
| 1004 | mimeTypes = new String[] { target.getType() }; |
| 1005 | } else { |
| 1006 | mimeTypes = new String[] { }; |
| 1007 | } |
| 1008 | targetClipData = new ClipData(null, mimeTypes, item); |
| 1009 | } |
| 1010 | if (targetClipData != null) { |
| 1011 | intent.setClipData(targetClipData); |
| 1012 | intent.addFlags(permFlags); |
| 1013 | } |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 1014 | } |
Dianne Hackborn | e302a16 | 2012-05-15 14:58:32 -0700 | [diff] [blame] | 1015 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1016 | return intent; |
| 1017 | } |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 1018 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1019 | /** |
| 1020 | * Activity Action: Allow the user to select a particular kind of data and |
| 1021 | * return it. This is different than {@link #ACTION_PICK} in that here we |
| 1022 | * 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] | 1023 | * 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] | 1024 | * 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] | 1025 | * 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] | 1026 | * etc. |
| 1027 | * <p> |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 1028 | * 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] | 1029 | * of data, such as a person contact, you set the MIME type to the kind of |
| 1030 | * data you want and launch it with {@link Context#startActivity(Intent)}. |
| 1031 | * The system will then launch the best application to select that kind |
| 1032 | * of data for you. |
| 1033 | * <p> |
| 1034 | * You may also be interested in any of a set of types of content the user |
| 1035 | * can pick. For example, an e-mail application that wants to allow the |
| 1036 | * user to add an attachment to an e-mail message can use this action to |
| 1037 | * bring up a list of all of the types of content the user can attach. |
| 1038 | * <p> |
| 1039 | * In this case, you should wrap the GET_CONTENT intent with a chooser |
| 1040 | * (through {@link #createChooser}), which will give the proper interface |
| 1041 | * for the user to pick how to send your data and allow you to specify |
| 1042 | * a prompt indicating what they are doing. You will usually specify a |
| 1043 | * broad MIME type (such as image/* or {@literal *}/*), resulting in a |
| 1044 | * broad range of content types the user can select from. |
| 1045 | * <p> |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 1046 | * 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] | 1047 | * only pick from data that can be represented as a stream. This is |
| 1048 | * accomplished by requiring the {@link #CATEGORY_OPENABLE} in the Intent. |
| 1049 | * <p> |
Dianne Hackborn | c4d0e6f | 2011-01-25 14:55:06 -0800 | [diff] [blame] | 1050 | * Callers can optionally specify {@link #EXTRA_LOCAL_ONLY} to request that |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 1051 | * the launched content chooser only returns results representing data that |
Dianne Hackborn | c4d0e6f | 2011-01-25 14:55:06 -0800 | [diff] [blame] | 1052 | * is locally available on the device. For example, if this extra is set |
| 1053 | * to true then an image picker should not show any pictures that are available |
| 1054 | * from a remote server but not already on the local device (thus requiring |
| 1055 | * they be downloaded when opened). |
| 1056 | * <p> |
Dianne Hackborn | fdb3f09 | 2013-01-28 15:10:48 -0800 | [diff] [blame] | 1057 | * If the caller can handle multiple returned items (the user performing |
| 1058 | * multiple selection), then it can specify {@link #EXTRA_ALLOW_MULTIPLE} |
| 1059 | * to indicate this. |
| 1060 | * <p> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1061 | * Input: {@link #getType} is the desired MIME type to retrieve. Note |
| 1062 | * that no URI is supplied in the intent, as there are no constraints on |
| 1063 | * where the returned data originally comes from. You may also include the |
| 1064 | * {@link #CATEGORY_OPENABLE} if you can only accept data that can be |
Dianne Hackborn | c4d0e6f | 2011-01-25 14:55:06 -0800 | [diff] [blame] | 1065 | * 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] | 1066 | * selection to local data. You may use {@link #EXTRA_ALLOW_MULTIPLE} to |
| 1067 | * allow the user to select multiple items. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1068 | * <p> |
| 1069 | * Output: The URI of the item that was picked. This must be a content: |
| 1070 | * URI so that any receiver can access it. |
| 1071 | */ |
| 1072 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1073 | public static final String ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT"; |
| 1074 | /** |
| 1075 | * Activity Action: Dial a number as specified by the data. This shows a |
| 1076 | * UI with the number being dialed, allowing the user to explicitly |
| 1077 | * initiate the call. |
| 1078 | * <p>Input: If nothing, an empty dialer is started; else {@link #getData} |
| 1079 | * is URI of a phone number to be dialed or a tel: URI of an explicit phone |
| 1080 | * number. |
| 1081 | * <p>Output: nothing. |
| 1082 | */ |
| 1083 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1084 | public static final String ACTION_DIAL = "android.intent.action.DIAL"; |
| 1085 | /** |
| 1086 | * Activity Action: Perform a call to someone specified by the data. |
| 1087 | * <p>Input: If nothing, an empty dialer is started; else {@link #getData} |
| 1088 | * is URI of a phone number to be dialed or a tel: URI of an explicit phone |
| 1089 | * number. |
| 1090 | * <p>Output: nothing. |
| 1091 | * |
| 1092 | * <p>Note: there will be restrictions on which applications can initiate a |
| 1093 | * call; most applications should use the {@link #ACTION_DIAL}. |
| 1094 | * <p>Note: this Intent <strong>cannot</strong> be used to call emergency |
| 1095 | * numbers. Applications can <strong>dial</strong> emergency numbers using |
| 1096 | * {@link #ACTION_DIAL}, however. |
Svetoslav | 7008b51 | 2015-06-24 18:47:07 -0700 | [diff] [blame] | 1097 | * |
Dianne Hackborn | 0e3de6c | 2015-07-29 15:20:21 -0700 | [diff] [blame] | 1098 | * <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] | 1099 | * 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] | 1100 | * permission which is not granted, then attempting to use this action will |
Svetoslav | 7008b51 | 2015-06-24 18:47:07 -0700 | [diff] [blame] | 1101 | * result in a {@link java.lang.SecurityException}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1102 | */ |
| 1103 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1104 | public static final String ACTION_CALL = "android.intent.action.CALL"; |
| 1105 | /** |
| 1106 | * Activity Action: Perform a call to an emergency number specified by the |
| 1107 | * data. |
| 1108 | * <p>Input: {@link #getData} is URI of a phone number to be dialed or a |
| 1109 | * tel: URI of an explicit phone number. |
| 1110 | * <p>Output: nothing. |
| 1111 | * @hide |
| 1112 | */ |
Brad Ebinger | 7a8d352 | 2017-03-31 10:21:09 -0700 | [diff] [blame] | 1113 | @SystemApi |
| 1114 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1115 | public static final String ACTION_CALL_EMERGENCY = "android.intent.action.CALL_EMERGENCY"; |
| 1116 | /** |
| 1117 | * Activity action: Perform a call to any number (emergency or not) |
| 1118 | * specified by the data. |
| 1119 | * <p>Input: {@link #getData} is URI of a phone number to be dialed or a |
| 1120 | * tel: URI of an explicit phone number. |
| 1121 | * <p>Output: nothing. |
| 1122 | * @hide |
| 1123 | */ |
Brad Ebinger | 7a8d352 | 2017-03-31 10:21:09 -0700 | [diff] [blame] | 1124 | @SystemApi |
| 1125 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1126 | public static final String ACTION_CALL_PRIVILEGED = "android.intent.action.CALL_PRIVILEGED"; |
fionaxu | 77a744c | 2017-03-17 14:35:39 -0700 | [diff] [blame] | 1127 | |
Santos Cordon | 15a1378 | 2015-03-31 18:32:31 -0700 | [diff] [blame] | 1128 | /** |
fionaxu | adfe700 | 2017-02-17 17:20:46 -0800 | [diff] [blame] | 1129 | * Activity Action: Main entry point for carrier setup apps. |
| 1130 | * <p>Carrier apps that provide an implementation for this action may be invoked to configure |
| 1131 | * carrier service and typically require |
| 1132 | * {@link android.telephony.TelephonyManager#hasCarrierPrivileges() carrier privileges} to |
| 1133 | * fulfill their duties. |
| 1134 | */ |
| 1135 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1136 | public static final String ACTION_CARRIER_SETUP = "android.intent.action.CARRIER_SETUP"; |
| 1137 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1138 | * Activity Action: Send a message to someone specified by the data. |
| 1139 | * <p>Input: {@link #getData} is URI describing the target. |
| 1140 | * <p>Output: nothing. |
| 1141 | */ |
| 1142 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1143 | public static final String ACTION_SENDTO = "android.intent.action.SENDTO"; |
| 1144 | /** |
| 1145 | * Activity Action: Deliver some data to someone else. Who the data is |
| 1146 | * being delivered to is not specified; it is up to the receiver of this |
| 1147 | * action to ask the user where the data should be sent. |
| 1148 | * <p> |
| 1149 | * When launching a SEND intent, you should usually wrap it in a chooser |
| 1150 | * (through {@link #createChooser}), which will give the proper interface |
| 1151 | * for the user to pick how to send your data and allow you to specify |
| 1152 | * a prompt indicating what they are doing. |
| 1153 | * <p> |
| 1154 | * Input: {@link #getType} is the MIME type of the data being sent. |
| 1155 | * get*Extra can have either a {@link #EXTRA_TEXT} |
| 1156 | * or {@link #EXTRA_STREAM} field, containing the data to be sent. If |
| 1157 | * using EXTRA_TEXT, the MIME type should be "text/plain"; otherwise it |
| 1158 | * should be the MIME type of the data in EXTRA_STREAM. Use {@literal *}/* |
| 1159 | * 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] | 1160 | * handle generic data streams). If using {@link #EXTRA_TEXT}, you can |
| 1161 | * also optionally supply {@link #EXTRA_HTML_TEXT} for clients to retrieve |
| 1162 | * your text with HTML formatting. |
| 1163 | * <p> |
| 1164 | * As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, the data |
| 1165 | * being sent can be supplied through {@link #setClipData(ClipData)}. This |
| 1166 | * allows you to use {@link #FLAG_GRANT_READ_URI_PERMISSION} when sharing |
| 1167 | * content: URIs and other advanced features of {@link ClipData}. If |
| 1168 | * using this approach, you still must supply the same data through the |
| 1169 | * {@link #EXTRA_TEXT} or {@link #EXTRA_STREAM} fields described below |
| 1170 | * for compatibility with old applications. If you don't set a ClipData, |
| 1171 | * 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] | 1172 | * <p> |
Tomasz Mikolajewski | d8a2e19 | 2016-12-15 16:10:46 +0900 | [diff] [blame] | 1173 | * Starting from {@link android.os.Build.VERSION_CODES#O}, if |
| 1174 | * {@link #CATEGORY_TYPED_OPENABLE} is passed, then the Uris passed in |
| 1175 | * either {@link #EXTRA_STREAM} or via {@link #setClipData(ClipData)} may |
| 1176 | * be openable only as asset typed files using |
| 1177 | * {@link ContentResolver#openTypedAssetFileDescriptor(Uri, String, Bundle)}. |
| 1178 | * <p> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1179 | * Optional standard extras, which may be interpreted by some recipients as |
| 1180 | * appropriate, are: {@link #EXTRA_EMAIL}, {@link #EXTRA_CC}, |
| 1181 | * {@link #EXTRA_BCC}, {@link #EXTRA_SUBJECT}. |
| 1182 | * <p> |
| 1183 | * Output: nothing. |
| 1184 | */ |
| 1185 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1186 | public static final String ACTION_SEND = "android.intent.action.SEND"; |
| 1187 | /** |
Wu-cheng Li | 649f99e | 2009-06-17 14:29:57 +0800 | [diff] [blame] | 1188 | * Activity Action: Deliver multiple data to someone else. |
| 1189 | * <p> |
Dianne Hackborn | acb69bb | 2012-04-13 15:36:06 -0700 | [diff] [blame] | 1190 | * Like {@link #ACTION_SEND}, except the data is multiple. |
Wu-cheng Li | 649f99e | 2009-06-17 14:29:57 +0800 | [diff] [blame] | 1191 | * <p> |
| 1192 | * Input: {@link #getType} is the MIME type of the data being sent. |
| 1193 | * get*ArrayListExtra can have either a {@link #EXTRA_TEXT} or {@link |
Dianne Hackborn | acb69bb | 2012-04-13 15:36:06 -0700 | [diff] [blame] | 1194 | * #EXTRA_STREAM} field, containing the data to be sent. If using |
| 1195 | * {@link #EXTRA_TEXT}, you can also optionally supply {@link #EXTRA_HTML_TEXT} |
| 1196 | * for clients to retrieve your text with HTML formatting. |
Wu-cheng Li | 649f99e | 2009-06-17 14:29:57 +0800 | [diff] [blame] | 1197 | * <p> |
Chih-Chung Chang | 5962d27 | 2009-09-04 14:36:01 +0800 | [diff] [blame] | 1198 | * Multiple types are supported, and receivers should handle mixed types |
| 1199 | * whenever possible. The right way for the receiver to check them is to |
| 1200 | * use the content resolver on each URI. The intent sender should try to |
| 1201 | * put the most concrete mime type in the intent type, but it can fall |
| 1202 | * back to {@literal <type>/*} or {@literal *}/* as needed. |
| 1203 | * <p> |
| 1204 | * e.g. if you are sending image/jpg and image/jpg, the intent's type can |
| 1205 | * be image/jpg, but if you are sending image/jpg and image/png, then the |
| 1206 | * intent's type should be image/*. |
| 1207 | * <p> |
Dianne Hackborn | acb69bb | 2012-04-13 15:36:06 -0700 | [diff] [blame] | 1208 | * As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, the data |
| 1209 | * being sent can be supplied through {@link #setClipData(ClipData)}. This |
| 1210 | * allows you to use {@link #FLAG_GRANT_READ_URI_PERMISSION} when sharing |
| 1211 | * content: URIs and other advanced features of {@link ClipData}. If |
| 1212 | * using this approach, you still must supply the same data through the |
| 1213 | * {@link #EXTRA_TEXT} or {@link #EXTRA_STREAM} fields described below |
| 1214 | * for compatibility with old applications. If you don't set a ClipData, |
| 1215 | * it will be copied there for you when calling {@link Context#startActivity(Intent)}. |
| 1216 | * <p> |
Tomasz Mikolajewski | d8a2e19 | 2016-12-15 16:10:46 +0900 | [diff] [blame] | 1217 | * Starting from {@link android.os.Build.VERSION_CODES#O}, if |
| 1218 | * {@link #CATEGORY_TYPED_OPENABLE} is passed, then the Uris passed in |
| 1219 | * either {@link #EXTRA_STREAM} or via {@link #setClipData(ClipData)} may |
| 1220 | * be openable only as asset typed files using |
| 1221 | * {@link ContentResolver#openTypedAssetFileDescriptor(Uri, String, Bundle)}. |
| 1222 | * <p> |
Wu-cheng Li | 649f99e | 2009-06-17 14:29:57 +0800 | [diff] [blame] | 1223 | * Optional standard extras, which may be interpreted by some recipients as |
| 1224 | * appropriate, are: {@link #EXTRA_EMAIL}, {@link #EXTRA_CC}, |
| 1225 | * {@link #EXTRA_BCC}, {@link #EXTRA_SUBJECT}. |
| 1226 | * <p> |
| 1227 | * Output: nothing. |
| 1228 | */ |
| 1229 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1230 | public static final String ACTION_SEND_MULTIPLE = "android.intent.action.SEND_MULTIPLE"; |
| 1231 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1232 | * Activity Action: Handle an incoming phone call. |
| 1233 | * <p>Input: nothing. |
| 1234 | * <p>Output: nothing. |
| 1235 | */ |
| 1236 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1237 | public static final String ACTION_ANSWER = "android.intent.action.ANSWER"; |
| 1238 | /** |
| 1239 | * Activity Action: Insert an empty item into the given container. |
| 1240 | * <p>Input: {@link #getData} is URI of the directory (vnd.android.cursor.dir/*) |
| 1241 | * in which to place the data. |
| 1242 | * <p>Output: URI of the new data that was created. |
| 1243 | */ |
| 1244 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1245 | public static final String ACTION_INSERT = "android.intent.action.INSERT"; |
| 1246 | /** |
Dianne Hackborn | 23fdaf6 | 2010-08-06 12:16:55 -0700 | [diff] [blame] | 1247 | * Activity Action: Create a new item in the given container, initializing it |
| 1248 | * from the current contents of the clipboard. |
| 1249 | * <p>Input: {@link #getData} is URI of the directory (vnd.android.cursor.dir/*) |
| 1250 | * in which to place the data. |
| 1251 | * <p>Output: URI of the new data that was created. |
| 1252 | */ |
| 1253 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1254 | public static final String ACTION_PASTE = "android.intent.action.PASTE"; |
| 1255 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1256 | * Activity Action: Delete the given data from its container. |
| 1257 | * <p>Input: {@link #getData} is URI of data to be deleted. |
| 1258 | * <p>Output: nothing. |
| 1259 | */ |
| 1260 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1261 | public static final String ACTION_DELETE = "android.intent.action.DELETE"; |
| 1262 | /** |
| 1263 | * Activity Action: Run the data, whatever that means. |
| 1264 | * <p>Input: ? (Note: this is currently specific to the test harness.) |
| 1265 | * <p>Output: nothing. |
| 1266 | */ |
| 1267 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1268 | public static final String ACTION_RUN = "android.intent.action.RUN"; |
| 1269 | /** |
| 1270 | * Activity Action: Perform a data synchronization. |
| 1271 | * <p>Input: ? |
| 1272 | * <p>Output: ? |
| 1273 | */ |
| 1274 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1275 | public static final String ACTION_SYNC = "android.intent.action.SYNC"; |
| 1276 | /** |
| 1277 | * Activity Action: Pick an activity given an intent, returning the class |
| 1278 | * selected. |
| 1279 | * <p>Input: get*Extra field {@link #EXTRA_INTENT} is an Intent |
| 1280 | * used with {@link PackageManager#queryIntentActivities} to determine the |
| 1281 | * set of activities from which to pick. |
| 1282 | * <p>Output: Class name of the activity that was selected. |
| 1283 | */ |
| 1284 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1285 | public static final String ACTION_PICK_ACTIVITY = "android.intent.action.PICK_ACTIVITY"; |
| 1286 | /** |
| 1287 | * Activity Action: Perform a search. |
| 1288 | * <p>Input: {@link android.app.SearchManager#QUERY getStringExtra(SearchManager.QUERY)} |
| 1289 | * is the text to search for. If empty, simply |
| 1290 | * enter your search results Activity with the search UI activated. |
| 1291 | * <p>Output: nothing. |
| 1292 | */ |
| 1293 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1294 | public static final String ACTION_SEARCH = "android.intent.action.SEARCH"; |
| 1295 | /** |
Jim Miller | 7e4ad35 | 2009-03-25 18:16:41 -0700 | [diff] [blame] | 1296 | * Activity Action: Start the platform-defined tutorial |
| 1297 | * <p>Input: {@link android.app.SearchManager#QUERY getStringExtra(SearchManager.QUERY)} |
| 1298 | * is the text to search for. If empty, simply |
| 1299 | * enter your search results Activity with the search UI activated. |
| 1300 | * <p>Output: nothing. |
| 1301 | */ |
| 1302 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1303 | public static final String ACTION_SYSTEM_TUTORIAL = "android.intent.action.SYSTEM_TUTORIAL"; |
| 1304 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1305 | * Activity Action: Perform a web search. |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 1306 | * <p> |
| 1307 | * Input: {@link android.app.SearchManager#QUERY |
| 1308 | * getStringExtra(SearchManager.QUERY)} is the text to search for. If it is |
| 1309 | * a url starts with http or https, the site will be opened. If it is plain |
| 1310 | * text, Google search will be applied. |
| 1311 | * <p> |
| 1312 | * Output: nothing. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1313 | */ |
| 1314 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1315 | public static final String ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH"; |
Dianne Hackborn | f9c5e0f | 2013-01-23 14:39:13 -0800 | [diff] [blame] | 1316 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1317 | /** |
Jim Miller | 0799440 | 2012-05-02 14:22:27 -0700 | [diff] [blame] | 1318 | * Activity Action: Perform assist action. |
| 1319 | * <p> |
Adam Skory | 7140a25 | 2013-09-11 12:04:58 +0100 | [diff] [blame] | 1320 | * Input: {@link #EXTRA_ASSIST_PACKAGE}, {@link #EXTRA_ASSIST_CONTEXT}, can provide |
| 1321 | * additional optional contextual information about where the user was when they |
Dianne Hackborn | a3acdb3 | 2015-06-08 17:07:40 -0700 | [diff] [blame] | 1322 | * requested the assist; {@link #EXTRA_REFERRER} may be set with additional referrer |
| 1323 | * information. |
Jim Miller | 0799440 | 2012-05-02 14:22:27 -0700 | [diff] [blame] | 1324 | * Output: nothing. |
| 1325 | */ |
| 1326 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1327 | public static final String ACTION_ASSIST = "android.intent.action.ASSIST"; |
Dianne Hackborn | f9c5e0f | 2013-01-23 14:39:13 -0800 | [diff] [blame] | 1328 | |
| 1329 | /** |
Bjorn Bringert | bc08686 | 2013-03-01 12:59:24 +0000 | [diff] [blame] | 1330 | * Activity Action: Perform voice assist action. |
| 1331 | * <p> |
Adam Skory | 7140a25 | 2013-09-11 12:04:58 +0100 | [diff] [blame] | 1332 | * Input: {@link #EXTRA_ASSIST_PACKAGE}, {@link #EXTRA_ASSIST_CONTEXT}, can provide |
| 1333 | * additional optional contextual information about where the user was when they |
Adam Skory | dfc7fd7 | 2013-08-05 19:23:41 -0700 | [diff] [blame] | 1334 | * requested the voice assist. |
Bjorn Bringert | bc08686 | 2013-03-01 12:59:24 +0000 | [diff] [blame] | 1335 | * Output: nothing. |
Adam Skory | 7140a25 | 2013-09-11 12:04:58 +0100 | [diff] [blame] | 1336 | * @hide |
Bjorn Bringert | bc08686 | 2013-03-01 12:59:24 +0000 | [diff] [blame] | 1337 | */ |
Amith Yamasani | 1645203 | 2017-03-03 10:15:57 -0800 | [diff] [blame] | 1338 | @SystemApi |
Bjorn Bringert | bc08686 | 2013-03-01 12:59:24 +0000 | [diff] [blame] | 1339 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1340 | public static final String ACTION_VOICE_ASSIST = "android.intent.action.VOICE_ASSIST"; |
| 1341 | |
| 1342 | /** |
Adam Skory | 7140a25 | 2013-09-11 12:04:58 +0100 | [diff] [blame] | 1343 | * An optional field on {@link #ACTION_ASSIST} containing the name of the current foreground |
| 1344 | * application package at the time the assist was invoked. |
Dianne Hackborn | f9c5e0f | 2013-01-23 14:39:13 -0800 | [diff] [blame] | 1345 | */ |
| 1346 | public static final String EXTRA_ASSIST_PACKAGE |
| 1347 | = "android.intent.extra.ASSIST_PACKAGE"; |
| 1348 | |
| 1349 | /** |
Dianne Hackborn | a83ce1d | 2015-03-11 15:16:13 -0700 | [diff] [blame] | 1350 | * An optional field on {@link #ACTION_ASSIST} containing the uid of the current foreground |
| 1351 | * application package at the time the assist was invoked. |
| 1352 | */ |
| 1353 | public static final String EXTRA_ASSIST_UID |
| 1354 | = "android.intent.extra.ASSIST_UID"; |
| 1355 | |
| 1356 | /** |
Adam Skory | 7140a25 | 2013-09-11 12:04:58 +0100 | [diff] [blame] | 1357 | * An optional field on {@link #ACTION_ASSIST} and containing additional contextual |
| 1358 | * information supplied by the current foreground app at the time of the assist request. |
| 1359 | * This is a {@link Bundle} of additional data. |
Dianne Hackborn | f9c5e0f | 2013-01-23 14:39:13 -0800 | [diff] [blame] | 1360 | */ |
| 1361 | public static final String EXTRA_ASSIST_CONTEXT |
| 1362 | = "android.intent.extra.ASSIST_CONTEXT"; |
| 1363 | |
Jim Miller | 0799440 | 2012-05-02 14:22:27 -0700 | [diff] [blame] | 1364 | /** |
Michael Wright | 8ab940a | 2014-09-01 11:01:27 -0700 | [diff] [blame] | 1365 | * An optional field on {@link #ACTION_ASSIST} suggesting that the user will likely use a |
| 1366 | * keyboard as the primary input device for assistance. |
| 1367 | */ |
| 1368 | public static final String EXTRA_ASSIST_INPUT_HINT_KEYBOARD = |
| 1369 | "android.intent.extra.ASSIST_INPUT_HINT_KEYBOARD"; |
| 1370 | |
| 1371 | /** |
Tim Kilbourn | 0e5f110 | 2015-06-05 16:18:09 -0700 | [diff] [blame] | 1372 | * An optional field on {@link #ACTION_ASSIST} containing the InputDevice id |
| 1373 | * that was used to invoke the assist. |
| 1374 | */ |
| 1375 | public static final String EXTRA_ASSIST_INPUT_DEVICE_ID = |
| 1376 | "android.intent.extra.ASSIST_INPUT_DEVICE_ID"; |
| 1377 | |
| 1378 | /** |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 1379 | * Activity Action: List all available applications. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1380 | * <p>Input: Nothing. |
| 1381 | * <p>Output: nothing. |
| 1382 | */ |
| 1383 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1384 | public static final String ACTION_ALL_APPS = "android.intent.action.ALL_APPS"; |
| 1385 | /** |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 1386 | * Activity Action: Show settings for choosing wallpaper. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1387 | * <p>Input: Nothing. |
| 1388 | * <p>Output: Nothing. |
| 1389 | */ |
| 1390 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1391 | public static final String ACTION_SET_WALLPAPER = "android.intent.action.SET_WALLPAPER"; |
| 1392 | |
| 1393 | /** |
| 1394 | * Activity Action: Show activity for reporting a bug. |
| 1395 | * <p>Input: Nothing. |
| 1396 | * <p>Output: Nothing. |
| 1397 | */ |
| 1398 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1399 | public static final String ACTION_BUG_REPORT = "android.intent.action.BUG_REPORT"; |
| 1400 | |
| 1401 | /** |
| 1402 | * Activity Action: Main entry point for factory tests. Only used when |
| 1403 | * the device is booting in factory test node. The implementing package |
| 1404 | * must be installed in the system image. |
| 1405 | * <p>Input: nothing |
| 1406 | * <p>Output: nothing |
| 1407 | */ |
Jeff Sharkey | 0f3f60b | 2017-04-24 18:06:20 -0600 | [diff] [blame] | 1408 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1409 | public static final String ACTION_FACTORY_TEST = "android.intent.action.FACTORY_TEST"; |
| 1410 | |
| 1411 | /** |
| 1412 | * Activity Action: The user pressed the "call" button to go to the dialer |
| 1413 | * or other appropriate UI for placing a call. |
| 1414 | * <p>Input: Nothing. |
| 1415 | * <p>Output: Nothing. |
| 1416 | */ |
| 1417 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1418 | public static final String ACTION_CALL_BUTTON = "android.intent.action.CALL_BUTTON"; |
| 1419 | |
| 1420 | /** |
| 1421 | * Activity Action: Start Voice Command. |
| 1422 | * <p>Input: Nothing. |
| 1423 | * <p>Output: Nothing. |
Christopher Tate | 72da1e6 | 2018-05-10 13:09:48 -0700 | [diff] [blame] | 1424 | * <p class="note"> |
| 1425 | * In some cases, a matching Activity may not exist, so ensure you |
| 1426 | * safeguard against this. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1427 | */ |
| 1428 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1429 | 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] | 1430 | |
| 1431 | /** |
| 1432 | * Activity Action: Start action associated with long pressing on the |
| 1433 | * search key. |
| 1434 | * <p>Input: Nothing. |
| 1435 | * <p>Output: Nothing. |
| 1436 | */ |
| 1437 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1438 | 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] | 1439 | |
Jacek Surazski | 86b6c53 | 2009-05-13 14:38:28 +0200 | [diff] [blame] | 1440 | /** |
| 1441 | * Activity Action: The user pressed the "Report" button in the crash/ANR dialog. |
| 1442 | * This intent is delivered to the package which installed the application, usually |
Dirk Dougherty | 4d7bc655 | 2012-01-27 17:56:49 -0800 | [diff] [blame] | 1443 | * Google Play. |
Jacek Surazski | 86b6c53 | 2009-05-13 14:38:28 +0200 | [diff] [blame] | 1444 | * <p>Input: No data is specified. The bug report is passed in using |
| 1445 | * an {@link #EXTRA_BUG_REPORT} field. |
| 1446 | * <p>Output: Nothing. |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1447 | * |
| 1448 | * @see #EXTRA_BUG_REPORT |
Jacek Surazski | 86b6c53 | 2009-05-13 14:38:28 +0200 | [diff] [blame] | 1449 | */ |
| 1450 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1451 | public static final String ACTION_APP_ERROR = "android.intent.action.APP_ERROR"; |
Dianne Hackborn | 3d74bb4 | 2009-06-19 10:35:21 -0700 | [diff] [blame] | 1452 | |
| 1453 | /** |
| 1454 | * Activity Action: Show power usage information to the user. |
| 1455 | * <p>Input: Nothing. |
| 1456 | * <p>Output: Nothing. |
| 1457 | */ |
| 1458 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1459 | 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] | 1460 | |
Dianne Hackborn | d7cd29d | 2009-07-01 11:22:45 -0700 | [diff] [blame] | 1461 | /** |
Russell Brenner | 4cd32e5 | 2017-02-24 11:11:47 -0800 | [diff] [blame] | 1462 | * Activity Action: Setup wizard action provided for OTA provisioning to determine if it needs |
| 1463 | * to run. |
| 1464 | * <p>Input: Nothing. |
| 1465 | * <p>Output: Nothing. |
| 1466 | * @deprecated As of {@link android.os.Build.VERSION_CODES#M}, setup wizard can be identified |
| 1467 | * using {@link #ACTION_MAIN} and {@link #CATEGORY_SETUP_WIZARD} |
| 1468 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 1469 | * @removed |
Russell Brenner | 4cd32e5 | 2017-02-24 11:11:47 -0800 | [diff] [blame] | 1470 | */ |
| 1471 | @Deprecated |
| 1472 | @SystemApi |
| 1473 | public static final String ACTION_DEVICE_INITIALIZATION_WIZARD = |
| 1474 | "android.intent.action.DEVICE_INITIALIZATION_WIZARD"; |
| 1475 | |
| 1476 | /** |
Dianne Hackborn | d7cd29d | 2009-07-01 11:22:45 -0700 | [diff] [blame] | 1477 | * Activity Action: Setup wizard to launch after a platform update. This |
| 1478 | * activity should have a string meta-data field associated with it, |
| 1479 | * {@link #METADATA_SETUP_VERSION}, which defines the current version of |
| 1480 | * the platform for setup. The activity will be launched only if |
| 1481 | * {@link android.provider.Settings.Secure#LAST_SETUP_SHOWN} is not the |
| 1482 | * same value. |
| 1483 | * <p>Input: Nothing. |
| 1484 | * <p>Output: Nothing. |
| 1485 | * @hide |
| 1486 | */ |
Russell Brenner | 4cd32e5 | 2017-02-24 11:11:47 -0800 | [diff] [blame] | 1487 | @SystemApi |
Dianne Hackborn | d7cd29d | 2009-07-01 11:22:45 -0700 | [diff] [blame] | 1488 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1489 | public static final String ACTION_UPGRADE_SETUP = "android.intent.action.UPGRADE_SETUP"; |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 1490 | |
Dianne Hackborn | d7cd29d | 2009-07-01 11:22:45 -0700 | [diff] [blame] | 1491 | /** |
Clara Bayarri | eb3c2d3 | 2016-04-01 14:37:32 +0100 | [diff] [blame] | 1492 | * Activity Action: Start the Keyboard Shortcuts Helper screen. |
| 1493 | * <p>Input: Nothing. |
| 1494 | * <p>Output: Nothing. |
| 1495 | * @hide |
| 1496 | */ |
| 1497 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1498 | public static final String ACTION_SHOW_KEYBOARD_SHORTCUTS = |
Clara Bayarri | 847d868 | 2017-03-06 16:48:44 +0000 | [diff] [blame] | 1499 | "com.android.intent.action.SHOW_KEYBOARD_SHORTCUTS"; |
Clara Bayarri | eb3c2d3 | 2016-04-01 14:37:32 +0100 | [diff] [blame] | 1500 | |
| 1501 | /** |
Andrei Stingaceanu | 0bf096f | 2016-04-14 18:11:57 +0100 | [diff] [blame] | 1502 | * Activity Action: Dismiss the Keyboard Shortcuts Helper screen. |
| 1503 | * <p>Input: Nothing. |
| 1504 | * <p>Output: Nothing. |
| 1505 | * @hide |
| 1506 | */ |
| 1507 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1508 | public static final String ACTION_DISMISS_KEYBOARD_SHORTCUTS = |
Clara Bayarri | 847d868 | 2017-03-06 16:48:44 +0000 | [diff] [blame] | 1509 | "com.android.intent.action.DISMISS_KEYBOARD_SHORTCUTS"; |
Andrei Stingaceanu | 0bf096f | 2016-04-14 18:11:57 +0100 | [diff] [blame] | 1510 | |
| 1511 | /** |
Jeff Sharkey | 7f86827 | 2011-06-05 16:05:02 -0700 | [diff] [blame] | 1512 | * Activity Action: Show settings for managing network data usage of a |
| 1513 | * specific application. Applications should define an activity that offers |
| 1514 | * options to control data usage. |
| 1515 | */ |
| 1516 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1517 | public static final String ACTION_MANAGE_NETWORK_USAGE = |
| 1518 | "android.intent.action.MANAGE_NETWORK_USAGE"; |
| 1519 | |
| 1520 | /** |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1521 | * Activity Action: Launch application installer. |
| 1522 | * <p> |
Todd Kennedy | 9cc589a | 2016-08-18 16:23:17 -0700 | [diff] [blame] | 1523 | * Input: The data must be a content: URI at which the application |
Dianne Hackborn | eba784ff | 2012-09-19 12:42:37 -0700 | [diff] [blame] | 1524 | * can be retrieved. As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}, |
| 1525 | * you can also use "package:<package-name>" to install an application for the |
| 1526 | * 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] | 1527 | * {@link #EXTRA_INSTALLER_PACKAGE_NAME}, {@link #EXTRA_NOT_UNKNOWN_SOURCE}, |
| 1528 | * {@link #EXTRA_ALLOW_REPLACE}, and {@link #EXTRA_RETURN_RESULT}. |
| 1529 | * <p> |
| 1530 | * Output: If {@link #EXTRA_RETURN_RESULT}, returns whether the install |
| 1531 | * succeeded. |
Svet Ganov | 86877e4 | 2015-05-28 08:19:48 -0700 | [diff] [blame] | 1532 | * <p> |
Suprabh Shukla | 54a10e6 | 2017-04-14 18:17:23 -0700 | [diff] [blame] | 1533 | * <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] | 1534 | * need to hold {@link android.Manifest.permission#REQUEST_INSTALL_PACKAGES} |
| 1535 | * in order to launch the application installer. |
| 1536 | * </p> |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1537 | * |
| 1538 | * @see #EXTRA_INSTALLER_PACKAGE_NAME |
| 1539 | * @see #EXTRA_NOT_UNKNOWN_SOURCE |
| 1540 | * @see #EXTRA_RETURN_RESULT |
| 1541 | */ |
| 1542 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1543 | public static final String ACTION_INSTALL_PACKAGE = "android.intent.action.INSTALL_PACKAGE"; |
| 1544 | |
| 1545 | /** |
Todd Kennedy | d0084f7 | 2017-07-28 13:56:14 -0700 | [diff] [blame] | 1546 | * Activity Action: Activity to handle split installation failures. |
| 1547 | * <p>Splits may be installed dynamically. This happens when an Activity is launched, |
| 1548 | * but the split that contains the application isn't installed. When a split is |
| 1549 | * installed in this manner, the containing package usually doesn't know this is |
| 1550 | * happening. However, if an error occurs during installation, the containing |
| 1551 | * package can define a single activity handling this action to deal with such |
| 1552 | * failures. |
| 1553 | * <p>The activity handling this action must be in the base package. |
| 1554 | * <p> |
| 1555 | * Input: {@link #EXTRA_INTENT} the original intent that started split installation. |
| 1556 | * {@link #EXTRA_SPLIT_NAME} the name of the split that failed to be installed. |
| 1557 | */ |
| 1558 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1559 | public static final String ACTION_INSTALL_FAILURE = "android.intent.action.INSTALL_FAILURE"; |
| 1560 | |
| 1561 | /** |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1562 | * Activity Action: Launch instant application installer. |
Todd Kennedy | b8a279e | 2015-11-18 09:59:47 -0800 | [diff] [blame] | 1563 | * <p class="note"> |
| 1564 | * This is a protected intent that can only be sent by the system. |
| 1565 | * </p> |
| 1566 | * |
| 1567 | * @hide |
| 1568 | */ |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1569 | @SystemApi |
Todd Kennedy | b8a279e | 2015-11-18 09:59:47 -0800 | [diff] [blame] | 1570 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1571 | public static final String ACTION_INSTALL_INSTANT_APP_PACKAGE |
| 1572 | = "android.intent.action.INSTALL_INSTANT_APP_PACKAGE"; |
Todd Kennedy | b8a279e | 2015-11-18 09:59:47 -0800 | [diff] [blame] | 1573 | |
| 1574 | /** |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1575 | * Service Action: Resolve instant application. |
Todd Kennedy | b8a279e | 2015-11-18 09:59:47 -0800 | [diff] [blame] | 1576 | * <p> |
| 1577 | * The system will have a persistent connection to this service. |
| 1578 | * This is a protected intent that can only be sent by the system. |
| 1579 | * </p> |
| 1580 | * |
| 1581 | * @hide |
| 1582 | */ |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1583 | @SystemApi |
Todd Kennedy | b8a279e | 2015-11-18 09:59:47 -0800 | [diff] [blame] | 1584 | @SdkConstant(SdkConstantType.SERVICE_ACTION) |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1585 | public static final String ACTION_RESOLVE_INSTANT_APP_PACKAGE |
| 1586 | = "android.intent.action.RESOLVE_INSTANT_APP_PACKAGE"; |
Todd Kennedy | b8a279e | 2015-11-18 09:59:47 -0800 | [diff] [blame] | 1587 | |
| 1588 | /** |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1589 | * Activity Action: Launch instant app settings. |
Chad Brubaker | 336ae5b | 2017-03-24 15:53:09 -0700 | [diff] [blame] | 1590 | * |
| 1591 | * <p class="note"> |
| 1592 | * This is a protected intent that can only be sent by the system. |
| 1593 | * </p> |
| 1594 | * |
| 1595 | * @hide |
| 1596 | */ |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1597 | @SystemApi |
Chad Brubaker | 336ae5b | 2017-03-24 15:53:09 -0700 | [diff] [blame] | 1598 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
Todd Kennedy | d46a160 | 2017-04-03 15:22:38 -0700 | [diff] [blame] | 1599 | public static final String ACTION_INSTANT_APP_RESOLVER_SETTINGS |
| 1600 | = "android.intent.action.INSTANT_APP_RESOLVER_SETTINGS"; |
Chad Brubaker | 336ae5b | 2017-03-24 15:53:09 -0700 | [diff] [blame] | 1601 | |
| 1602 | /** |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1603 | * Used as a string extra field with {@link #ACTION_INSTALL_PACKAGE} to install a |
| 1604 | * package. Specifies the installer package name; this package will receive the |
| 1605 | * {@link #ACTION_APP_ERROR} intent. |
| 1606 | */ |
| 1607 | public static final String EXTRA_INSTALLER_PACKAGE_NAME |
| 1608 | = "android.intent.extra.INSTALLER_PACKAGE_NAME"; |
| 1609 | |
| 1610 | /** |
| 1611 | * Used as a boolean extra field with {@link #ACTION_INSTALL_PACKAGE} to install a |
| 1612 | * package. Specifies that the application being installed should not be |
| 1613 | * treated as coming from an unknown source, but as coming from the app |
| 1614 | * invoking the Intent. For this to work you must start the installer with |
| 1615 | * startActivityForResult(). |
| 1616 | */ |
| 1617 | public static final String EXTRA_NOT_UNKNOWN_SOURCE |
| 1618 | = "android.intent.extra.NOT_UNKNOWN_SOURCE"; |
| 1619 | |
| 1620 | /** |
rich cannings | 706e8ba | 2012-08-20 13:20:14 -0700 | [diff] [blame] | 1621 | * Used as a URI extra field with {@link #ACTION_INSTALL_PACKAGE} and |
| 1622 | * {@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] | 1623 | * data field originated from. |
| 1624 | */ |
rich cannings | 706e8ba | 2012-08-20 13:20:14 -0700 | [diff] [blame] | 1625 | public static final String EXTRA_ORIGINATING_URI |
| 1626 | = "android.intent.extra.ORIGINATING_URI"; |
rich cannings | 368ed01 | 2012-06-07 15:37:57 -0700 | [diff] [blame] | 1627 | |
| 1628 | /** |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 1629 | * This extra can be used with any Intent used to launch an activity, supplying information |
| 1630 | * about who is launching that activity. This field contains a {@link android.net.Uri} |
| 1631 | * object, typically an http: or https: URI of the web site that the referral came from; |
| 1632 | * it can also use the {@link #URI_ANDROID_APP_SCHEME android-app:} scheme to identify |
| 1633 | * a native application that it came from. |
| 1634 | * |
| 1635 | * <p>To retrieve this value in a client, use {@link android.app.Activity#getReferrer} |
| 1636 | * instead of directly retrieving the extra. It is also valid for applications to |
| 1637 | * instead supply {@link #EXTRA_REFERRER_NAME} for cases where they can only create |
| 1638 | * a string, not a Uri; the field here, if supplied, will always take precedence, |
| 1639 | * however.</p> |
| 1640 | * |
| 1641 | * @see #EXTRA_REFERRER_NAME |
rich cannings | 368ed01 | 2012-06-07 15:37:57 -0700 | [diff] [blame] | 1642 | */ |
| 1643 | public static final String EXTRA_REFERRER |
| 1644 | = "android.intent.extra.REFERRER"; |
| 1645 | |
| 1646 | /** |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 1647 | * Alternate version of {@link #EXTRA_REFERRER} that supplies the URI as a String rather |
| 1648 | * than a {@link android.net.Uri} object. Only for use in cases where Uri objects can |
| 1649 | * not be created, in particular when Intent extras are supplied through the |
| 1650 | * {@link #URI_INTENT_SCHEME intent:} or {@link #URI_ANDROID_APP_SCHEME android-app:} |
| 1651 | * schemes. |
| 1652 | * |
| 1653 | * @see #EXTRA_REFERRER |
| 1654 | */ |
| 1655 | public static final String EXTRA_REFERRER_NAME |
| 1656 | = "android.intent.extra.REFERRER_NAME"; |
| 1657 | |
| 1658 | /** |
Ben Gruver | 37d83a3 | 2012-09-27 13:02:06 -0700 | [diff] [blame] | 1659 | * Used as an int extra field with {@link #ACTION_INSTALL_PACKAGE} and |
Gina Dimino | 98ad888 | 2016-05-31 17:25:48 -0700 | [diff] [blame] | 1660 | * {@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] | 1661 | * Currently only a system app that hosts the provider authority "downloads" or holds the |
| 1662 | * permission {@link android.Manifest.permission.MANAGE_DOCUMENTS} can use this. |
Ben Gruver | 37d83a3 | 2012-09-27 13:02:06 -0700 | [diff] [blame] | 1663 | * @hide |
| 1664 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 1665 | @SystemApi |
Ben Gruver | 37d83a3 | 2012-09-27 13:02:06 -0700 | [diff] [blame] | 1666 | public static final String EXTRA_ORIGINATING_UID |
| 1667 | = "android.intent.extra.ORIGINATING_UID"; |
| 1668 | |
| 1669 | /** |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1670 | * Used as a boolean extra field with {@link #ACTION_INSTALL_PACKAGE} to install a |
| 1671 | * package. Tells the installer UI to skip the confirmation with the user |
| 1672 | * if the .apk is replacing an existing one. |
Dianne Hackborn | 0e128bb | 2012-05-01 14:40:15 -0700 | [diff] [blame] | 1673 | * @deprecated As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, Android |
| 1674 | * will no longer show an interstitial message about updating existing |
| 1675 | * applications so this is no longer needed. |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1676 | */ |
Dianne Hackborn | 0e128bb | 2012-05-01 14:40:15 -0700 | [diff] [blame] | 1677 | @Deprecated |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1678 | public static final String EXTRA_ALLOW_REPLACE |
| 1679 | = "android.intent.extra.ALLOW_REPLACE"; |
| 1680 | |
| 1681 | /** |
| 1682 | * Used as a boolean extra field with {@link #ACTION_INSTALL_PACKAGE} or |
| 1683 | * {@link #ACTION_UNINSTALL_PACKAGE}. Specifies that the installer UI should |
| 1684 | * return to the application the result code of the install/uninstall. The returned result |
| 1685 | * code will be {@link android.app.Activity#RESULT_OK} on success or |
| 1686 | * {@link android.app.Activity#RESULT_FIRST_USER} on failure. |
| 1687 | */ |
| 1688 | public static final String EXTRA_RETURN_RESULT |
| 1689 | = "android.intent.extra.RETURN_RESULT"; |
| 1690 | |
| 1691 | /** |
| 1692 | * Package manager install result code. @hide because result codes are not |
| 1693 | * yet ready to be exposed. |
| 1694 | */ |
| 1695 | public static final String EXTRA_INSTALL_RESULT |
| 1696 | = "android.intent.extra.INSTALL_RESULT"; |
| 1697 | |
| 1698 | /** |
| 1699 | * Activity Action: Launch application uninstaller. |
| 1700 | * <p> |
| 1701 | * Input: The data must be a package: URI whose scheme specific part is |
| 1702 | * the package name of the current installed package to be uninstalled. |
| 1703 | * You can optionally supply {@link #EXTRA_RETURN_RESULT}. |
| 1704 | * <p> |
| 1705 | * Output: If {@link #EXTRA_RETURN_RESULT}, returns whether the install |
| 1706 | * succeeded. |
Philip P. Moltmann | d9bb39a | 2017-09-05 12:41:15 -0700 | [diff] [blame] | 1707 | * <p> |
| 1708 | * Requires {@link android.Manifest.permission#REQUEST_DELETE_PACKAGES} |
| 1709 | * since {@link Build.VERSION_CODES#P}. |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 1710 | */ |
| 1711 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1712 | public static final String ACTION_UNINSTALL_PACKAGE = "android.intent.action.UNINSTALL_PACKAGE"; |
| 1713 | |
| 1714 | /** |
Dianne Hackborn | 6d235d8 | 2012-09-16 18:25:40 -0700 | [diff] [blame] | 1715 | * Specify whether the package should be uninstalled for all users. |
| 1716 | * @hide because these should not be part of normal application flow. |
| 1717 | */ |
| 1718 | public static final String EXTRA_UNINSTALL_ALL_USERS |
| 1719 | = "android.intent.extra.UNINSTALL_ALL_USERS"; |
| 1720 | |
| 1721 | /** |
Dianne Hackborn | d7cd29d | 2009-07-01 11:22:45 -0700 | [diff] [blame] | 1722 | * A string associated with a {@link #ACTION_UPGRADE_SETUP} activity |
| 1723 | * describing the last run version of the platform that was setup. |
| 1724 | * @hide |
| 1725 | */ |
| 1726 | public static final String METADATA_SETUP_VERSION = "android.SETUP_VERSION"; |
| 1727 | |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1728 | /** |
| 1729 | * Activity action: Launch UI to manage the permissions of an app. |
| 1730 | * <p> |
| 1731 | * Input: {@link #EXTRA_PACKAGE_NAME} specifies the package whose permissions |
| 1732 | * will be managed by the launched UI. |
| 1733 | * </p> |
| 1734 | * <p> |
| 1735 | * Output: Nothing. |
| 1736 | * </p> |
| 1737 | * |
| 1738 | * @see #EXTRA_PACKAGE_NAME |
| 1739 | * |
| 1740 | * @hide |
| 1741 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 1742 | @SystemApi |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1743 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1744 | public static final String ACTION_MANAGE_APP_PERMISSIONS = |
| 1745 | "android.intent.action.MANAGE_APP_PERMISSIONS"; |
| 1746 | |
| 1747 | /** |
Svet Ganov | 321f015 | 2015-05-16 22:51:50 -0700 | [diff] [blame] | 1748 | * Activity action: Launch UI to manage permissions. |
| 1749 | * <p> |
| 1750 | * Input: Nothing. |
| 1751 | * </p> |
| 1752 | * <p> |
| 1753 | * Output: Nothing. |
| 1754 | * </p> |
| 1755 | * |
| 1756 | * @hide |
| 1757 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 1758 | @SystemApi |
Svet Ganov | 321f015 | 2015-05-16 22:51:50 -0700 | [diff] [blame] | 1759 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1760 | public static final String ACTION_MANAGE_PERMISSIONS = |
| 1761 | "android.intent.action.MANAGE_PERMISSIONS"; |
| 1762 | |
| 1763 | /** |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 1764 | * Activity action: Launch UI to review permissions for an app. |
| 1765 | * The system uses this intent if permission review for apps not |
| 1766 | * supporting the new runtime permissions model is enabled. In |
| 1767 | * this mode a permission review is required before any of the |
| 1768 | * app components can run. |
| 1769 | * <p> |
| 1770 | * Input: {@link #EXTRA_PACKAGE_NAME} specifies the package whose |
| 1771 | * permissions will be reviewed (mandatory). |
| 1772 | * </p> |
| 1773 | * <p> |
| 1774 | * Input: {@link #EXTRA_INTENT} specifies a pending intent to |
| 1775 | * be fired after the permission review (optional). |
| 1776 | * </p> |
| 1777 | * <p> |
| 1778 | * Input: {@link #EXTRA_REMOTE_CALLBACK} specifies a callback to |
| 1779 | * be invoked after the permission review (optional). |
| 1780 | * </p> |
| 1781 | * <p> |
| 1782 | * Input: {@link #EXTRA_RESULT_NEEDED} specifies whether the intent |
| 1783 | * passed via {@link #EXTRA_INTENT} needs a result (optional). |
| 1784 | * </p> |
| 1785 | * <p> |
| 1786 | * Output: Nothing. |
| 1787 | * </p> |
| 1788 | * |
| 1789 | * @see #EXTRA_PACKAGE_NAME |
| 1790 | * @see #EXTRA_INTENT |
| 1791 | * @see #EXTRA_REMOTE_CALLBACK |
| 1792 | * @see #EXTRA_RESULT_NEEDED |
| 1793 | * |
| 1794 | * @hide |
| 1795 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 1796 | @SystemApi |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 1797 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1798 | public static final String ACTION_REVIEW_PERMISSIONS = |
| 1799 | "android.intent.action.REVIEW_PERMISSIONS"; |
| 1800 | |
| 1801 | /** |
| 1802 | * Intent extra: A callback for reporting remote result as a bundle. |
| 1803 | * <p> |
| 1804 | * Type: IRemoteCallback |
| 1805 | * </p> |
| 1806 | * |
| 1807 | * @hide |
| 1808 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 1809 | @SystemApi |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 1810 | public static final String EXTRA_REMOTE_CALLBACK = "android.intent.extra.REMOTE_CALLBACK"; |
| 1811 | |
| 1812 | /** |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1813 | * Intent extra: An app package name. |
| 1814 | * <p> |
| 1815 | * Type: String |
Svet Ganov | 0b31670 | 2015-05-23 13:25:11 -0700 | [diff] [blame] | 1816 | * </p> |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1817 | * |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1818 | */ |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1819 | public static final String EXTRA_PACKAGE_NAME = "android.intent.extra.PACKAGE_NAME"; |
| 1820 | |
| 1821 | /** |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 1822 | * Intent extra: A {@link Bundle} of extras for a package being suspended. Will be sent as an |
| 1823 | * extra with {@link #ACTION_MY_PACKAGE_SUSPENDED}. |
| 1824 | * |
| 1825 | * <p>The contents of this {@link Bundle} are a contract between the suspended app and the |
| 1826 | * suspending app, i.e. any app with the permission {@code android.permission.SUSPEND_APPS}. |
| 1827 | * 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] | 1828 | * |
| 1829 | * @see #ACTION_MY_PACKAGE_SUSPENDED |
| 1830 | * @see #ACTION_MY_PACKAGE_UNSUSPENDED |
| 1831 | * @see PackageManager#isPackageSuspended() |
| 1832 | * @see PackageManager#getSuspendedPackageAppExtras() |
| 1833 | */ |
| 1834 | public static final String EXTRA_SUSPENDED_PACKAGE_EXTRAS = "android.intent.extra.SUSPENDED_PACKAGE_EXTRAS"; |
| 1835 | |
| 1836 | /** |
Todd Kennedy | e5195dd | 2016-10-19 15:29:19 -0700 | [diff] [blame] | 1837 | * Intent extra: An app split name. |
| 1838 | * <p> |
| 1839 | * Type: String |
| 1840 | * </p> |
Todd Kennedy | e5195dd | 2016-10-19 15:29:19 -0700 | [diff] [blame] | 1841 | */ |
Todd Kennedy | e5195dd | 2016-10-19 15:29:19 -0700 | [diff] [blame] | 1842 | public static final String EXTRA_SPLIT_NAME = "android.intent.extra.SPLIT_NAME"; |
| 1843 | |
| 1844 | /** |
Jeff Sharkey | 1a74942 | 2017-04-28 14:19:50 -0600 | [diff] [blame] | 1845 | * Intent extra: A {@link ComponentName} value. |
| 1846 | * <p> |
| 1847 | * Type: String |
| 1848 | * </p> |
| 1849 | */ |
| 1850 | public static final String EXTRA_COMPONENT_NAME = "android.intent.extra.COMPONENT_NAME"; |
| 1851 | |
| 1852 | /** |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 1853 | * Intent extra: An extra for specifying whether a result is needed. |
| 1854 | * <p> |
| 1855 | * Type: boolean |
| 1856 | * </p> |
| 1857 | * |
| 1858 | * @hide |
| 1859 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 1860 | @SystemApi |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 1861 | public static final String EXTRA_RESULT_NEEDED = "android.intent.extra.RESULT_NEEDED"; |
| 1862 | |
| 1863 | /** |
Suprabh Shukla | 19b41f3 | 2018-03-26 22:35:13 -0700 | [diff] [blame] | 1864 | * Intent extra: A {@link Bundle} of extras supplied for the launcher when any packages on |
| 1865 | * device are suspended. Will be sent with {@link #ACTION_PACKAGES_SUSPENDED}. |
| 1866 | * |
| 1867 | * @see PackageManager#isPackageSuspended() |
| 1868 | * @see #ACTION_PACKAGES_SUSPENDED |
| 1869 | * |
| 1870 | * @hide |
| 1871 | */ |
| 1872 | public static final String EXTRA_LAUNCHER_EXTRAS = "android.intent.extra.LAUNCHER_EXTRAS"; |
| 1873 | |
| 1874 | /** |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1875 | * Activity action: Launch UI to manage which apps have a given permission. |
| 1876 | * <p> |
| 1877 | * Input: {@link #EXTRA_PERMISSION_NAME} specifies the permission access |
| 1878 | * to which will be managed by the launched UI. |
| 1879 | * </p> |
| 1880 | * <p> |
| 1881 | * Output: Nothing. |
| 1882 | * </p> |
| 1883 | * |
| 1884 | * @see #EXTRA_PERMISSION_NAME |
| 1885 | * |
| 1886 | * @hide |
| 1887 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 1888 | @SystemApi |
Svet Ganov | 3695b8a | 2015-03-24 16:30:25 -0700 | [diff] [blame] | 1889 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 1890 | public static final String ACTION_MANAGE_PERMISSION_APPS = |
| 1891 | "android.intent.action.MANAGE_PERMISSION_APPS"; |
| 1892 | |
| 1893 | /** |
| 1894 | * Intent extra: The name of a permission. |
| 1895 | * <p> |
| 1896 | * Type: String |
| 1897 | * </p> |
| 1898 | * |
| 1899 | * @hide |
| 1900 | */ |
| 1901 | @SystemApi |
| 1902 | public static final String EXTRA_PERMISSION_NAME = "android.intent.extra.PERMISSION_NAME"; |
| 1903 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1904 | // --------------------------------------------------------------------- |
| 1905 | // --------------------------------------------------------------------- |
| 1906 | // Standard intent broadcast actions (see action variable). |
| 1907 | |
| 1908 | /** |
Jeff Brown | 037c33e | 2014-04-09 00:31:55 -0700 | [diff] [blame] | 1909 | * Broadcast Action: Sent when the device goes to sleep and becomes non-interactive. |
| 1910 | * <p> |
| 1911 | * For historical reasons, the name of this broadcast action refers to the power |
| 1912 | * state of the screen but it is actually sent in response to changes in the |
| 1913 | * overall interactive state of the device. |
| 1914 | * </p><p> |
| 1915 | * This broadcast is sent when the device becomes non-interactive which may have |
| 1916 | * nothing to do with the screen turning off. To determine the |
| 1917 | * actual state of the screen, use {@link android.view.Display#getState}. |
| 1918 | * </p><p> |
| 1919 | * See {@link android.os.PowerManager#isInteractive} for details. |
| 1920 | * </p> |
Casey Ho | dbf6785c | 2015-03-17 15:59:39 -0700 | [diff] [blame] | 1921 | * You <em>cannot</em> receive this through components declared in |
| 1922 | * manifests, only by explicitly registering for it with |
| 1923 | * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
| 1924 | * Context.registerReceiver()}. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 1925 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 1926 | * <p class="note">This is a protected intent that can only be sent |
| 1927 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1928 | */ |
| 1929 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1930 | public static final String ACTION_SCREEN_OFF = "android.intent.action.SCREEN_OFF"; |
Jeff Brown | 037c33e | 2014-04-09 00:31:55 -0700 | [diff] [blame] | 1931 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1932 | /** |
Jeff Brown | 037c33e | 2014-04-09 00:31:55 -0700 | [diff] [blame] | 1933 | * Broadcast Action: Sent when the device wakes up and becomes interactive. |
| 1934 | * <p> |
| 1935 | * For historical reasons, the name of this broadcast action refers to the power |
| 1936 | * state of the screen but it is actually sent in response to changes in the |
| 1937 | * overall interactive state of the device. |
| 1938 | * </p><p> |
| 1939 | * This broadcast is sent when the device becomes interactive which may have |
| 1940 | * nothing to do with the screen turning on. To determine the |
| 1941 | * actual state of the screen, use {@link android.view.Display#getState}. |
| 1942 | * </p><p> |
| 1943 | * See {@link android.os.PowerManager#isInteractive} for details. |
| 1944 | * </p> |
Casey Ho | dbf6785c | 2015-03-17 15:59:39 -0700 | [diff] [blame] | 1945 | * You <em>cannot</em> receive this through components declared in |
| 1946 | * manifests, only by explicitly registering for it with |
| 1947 | * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
| 1948 | * Context.registerReceiver()}. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 1949 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 1950 | * <p class="note">This is a protected intent that can only be sent |
| 1951 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1952 | */ |
| 1953 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1954 | 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] | 1955 | |
| 1956 | /** |
Dianne Hackborn | be87e2f | 2012-09-28 16:31:34 -0700 | [diff] [blame] | 1957 | * Broadcast Action: Sent after the system stops dreaming. |
| 1958 | * |
| 1959 | * <p class="note">This is a protected intent that can only be sent by the system. |
| 1960 | * It is only sent to registered receivers.</p> |
| 1961 | */ |
| 1962 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1963 | public static final String ACTION_DREAMING_STOPPED = "android.intent.action.DREAMING_STOPPED"; |
| 1964 | |
| 1965 | /** |
| 1966 | * Broadcast Action: Sent after the system starts dreaming. |
| 1967 | * |
| 1968 | * <p class="note">This is a protected intent that can only be sent by the system. |
| 1969 | * It is only sent to registered receivers.</p> |
| 1970 | */ |
| 1971 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1972 | public static final String ACTION_DREAMING_STARTED = "android.intent.action.DREAMING_STARTED"; |
| 1973 | |
| 1974 | /** |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 1975 | * 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] | 1976 | * keyguard is gone). |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 1977 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 1978 | * <p class="note">This is a protected intent that can only be sent |
| 1979 | * by the system. |
The Android Open Source Project | b2a3dd8 | 2009-03-09 11:52:12 -0700 | [diff] [blame] | 1980 | */ |
| 1981 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Dianne Hackborn | 1c633fc | 2009-12-08 19:45:14 -0800 | [diff] [blame] | 1982 | 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] | 1983 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1984 | /** |
| 1985 | * Broadcast Action: The current time has changed. Sent every |
Casey Ho | dbf6785c | 2015-03-17 15:59:39 -0700 | [diff] [blame] | 1986 | * minute. You <em>cannot</em> receive this through components declared |
John Spurlock | 6098c5d | 2013-06-17 10:32:46 -0400 | [diff] [blame] | 1987 | * in manifests, only by explicitly registering for it with |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1988 | * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
| 1989 | * Context.registerReceiver()}. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 1990 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 1991 | * <p class="note">This is a protected intent that can only be sent |
| 1992 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1993 | */ |
| 1994 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 1995 | public static final String ACTION_TIME_TICK = "android.intent.action.TIME_TICK"; |
| 1996 | /** |
| 1997 | * Broadcast Action: The time was set. |
| 1998 | */ |
| 1999 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2000 | public static final String ACTION_TIME_CHANGED = "android.intent.action.TIME_SET"; |
| 2001 | /** |
| 2002 | * Broadcast Action: The date has changed. |
| 2003 | */ |
| 2004 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2005 | public static final String ACTION_DATE_CHANGED = "android.intent.action.DATE_CHANGED"; |
| 2006 | /** |
| 2007 | * Broadcast Action: The timezone has changed. The intent will have the following extra values:</p> |
| 2008 | * <ul> |
| 2009 | * <li><em>time-zone</em> - The java.util.TimeZone.getID() value identifying the new time zone.</li> |
| 2010 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2011 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2012 | * <p class="note">This is a protected intent that can only be sent |
| 2013 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2014 | */ |
| 2015 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2016 | public static final String ACTION_TIMEZONE_CHANGED = "android.intent.action.TIMEZONE_CHANGED"; |
| 2017 | /** |
Robert Greenwalt | 03595d0 | 2010-11-02 14:08:23 -0700 | [diff] [blame] | 2018 | * Clear DNS Cache Action: This is broadcast when networks have changed and old |
| 2019 | * DNS entries should be tossed. |
| 2020 | * @hide |
| 2021 | */ |
| 2022 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2023 | public static final String ACTION_CLEAR_DNS_CACHE = "android.intent.action.CLEAR_DNS_CACHE"; |
| 2024 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2025 | * Alarm Changed Action: This is broadcast when the AlarmClock |
| 2026 | * application's alarm is set or unset. It is used by the |
| 2027 | * AlarmClock application and the StatusBar service. |
| 2028 | * @hide |
| 2029 | */ |
| 2030 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 2031 | @UnsupportedAppUsage |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2032 | public static final String ACTION_ALARM_CHANGED = "android.intent.action.ALARM_CHANGED"; |
Jeff Sharkey | bedbaa9 | 2015-12-02 16:42:25 -0700 | [diff] [blame] | 2033 | |
| 2034 | /** |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 2035 | * Broadcast Action: This is broadcast once, after the user has finished |
| 2036 | * booting, but while still in the "locked" state. It can be used to perform |
| 2037 | * application-specific initialization, such as installing alarms. You must |
| 2038 | * hold the {@link android.Manifest.permission#RECEIVE_BOOT_COMPLETED} |
| 2039 | * permission in order to receive this broadcast. |
Jeff Sharkey | bedbaa9 | 2015-12-02 16:42:25 -0700 | [diff] [blame] | 2040 | * <p> |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 2041 | * This broadcast is sent immediately at boot by all devices (regardless of |
| 2042 | * direct boot support) running {@link android.os.Build.VERSION_CODES#N} or |
| 2043 | * higher. Upon receipt of this broadcast, the user is still locked and only |
| 2044 | * device-protected storage can be accessed safely. If you want to access |
| 2045 | * credential-protected storage, you need to wait for the user to be |
| 2046 | * unlocked (typically by entering their lock pattern or PIN for the first |
| 2047 | * time), after which the {@link #ACTION_USER_UNLOCKED} and |
| 2048 | * {@link #ACTION_BOOT_COMPLETED} broadcasts are sent. |
| 2049 | * <p> |
| 2050 | * To receive this broadcast, your receiver component must be marked as |
| 2051 | * being {@link ComponentInfo#directBootAware}. |
Jeff Sharkey | bedbaa9 | 2015-12-02 16:42:25 -0700 | [diff] [blame] | 2052 | * <p class="note"> |
| 2053 | * 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] | 2054 | * |
| 2055 | * @see Context#createDeviceProtectedStorageContext() |
Jeff Sharkey | bedbaa9 | 2015-12-02 16:42:25 -0700 | [diff] [blame] | 2056 | */ |
| 2057 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2058 | public static final String ACTION_LOCKED_BOOT_COMPLETED = "android.intent.action.LOCKED_BOOT_COMPLETED"; |
| 2059 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2060 | /** |
Jeff Sharkey | cf3f0a1 | 2016-03-17 19:57:58 -0600 | [diff] [blame] | 2061 | * Broadcast Action: This is broadcast once, after the user has finished |
| 2062 | * booting. It can be used to perform application-specific initialization, |
| 2063 | * such as installing alarms. You must hold the |
| 2064 | * {@link android.Manifest.permission#RECEIVE_BOOT_COMPLETED} permission in |
| 2065 | * order to receive this broadcast. |
| 2066 | * <p> |
| 2067 | * This broadcast is sent at boot by all devices (both with and without |
| 2068 | * direct boot support). Upon receipt of this broadcast, the user is |
| 2069 | * unlocked and both device-protected and credential-protected storage can |
| 2070 | * accessed safely. |
| 2071 | * <p> |
| 2072 | * If you need to run while the user is still locked (before they've entered |
| 2073 | * their lock pattern or PIN for the first time), you can listen for the |
| 2074 | * {@link #ACTION_LOCKED_BOOT_COMPLETED} broadcast. |
| 2075 | * <p class="note"> |
| 2076 | * 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] | 2077 | */ |
| 2078 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Jeff Sharkey | 32ee8ee | 2017-03-08 20:17:51 -0700 | [diff] [blame] | 2079 | @BroadcastBehavior(includeBackground = true) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2080 | public static final String ACTION_BOOT_COMPLETED = "android.intent.action.BOOT_COMPLETED"; |
Jeff Sharkey | bedbaa9 | 2015-12-02 16:42:25 -0700 | [diff] [blame] | 2081 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2082 | /** |
| 2083 | * Broadcast Action: This is broadcast when a user action should request a |
| 2084 | * temporary system dialog to dismiss. Some examples of temporary system |
| 2085 | * dialogs are the notification window-shade and the recent tasks dialog. |
| 2086 | */ |
Jeff Sharkey | 0f3f60b | 2017-04-24 18:06:20 -0600 | [diff] [blame] | 2087 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2088 | public static final String ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS"; |
| 2089 | /** |
| 2090 | * Broadcast Action: Trigger the download and eventual installation |
| 2091 | * of a package. |
| 2092 | * <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] | 2093 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2094 | * <p class="note">This is a protected intent that can only be sent |
| 2095 | * by the system. |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 2096 | * |
| 2097 | * @deprecated This constant has never been used. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2098 | */ |
Dianne Hackborn | 271c2fe | 2011-08-09 19:35:13 -0700 | [diff] [blame] | 2099 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2100 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2101 | public static final String ACTION_PACKAGE_INSTALL = "android.intent.action.PACKAGE_INSTALL"; |
| 2102 | /** |
Christopher Tate | 94b91db | 2017-04-19 15:49:17 -0700 | [diff] [blame] | 2103 | * 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] | 2104 | * device. The data contains the name of the package. Note that the |
| 2105 | * newly installed package does <em>not</em> receive this broadcast. |
Jeff Sharkey | d0c6ccb | 2012-09-14 16:26:37 -0700 | [diff] [blame] | 2106 | * <p>May include the following extras: |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2107 | * <ul> |
Christopher Tate | 94b91db | 2017-04-19 15:49:17 -0700 | [diff] [blame] | 2108 | * <li> {@link #EXTRA_UID} containing the integer uid assigned to the new package. |
| 2109 | * <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] | 2110 | * an {@link #ACTION_PACKAGE_REMOVED} broadcast for the same package. |
| 2111 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2112 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2113 | * <p class="note">This is a protected intent that can only be sent |
| 2114 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2115 | */ |
| 2116 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2117 | public static final String ACTION_PACKAGE_ADDED = "android.intent.action.PACKAGE_ADDED"; |
| 2118 | /** |
The Android Open Source Project | c2ad241 | 2009-03-19 23:08:54 -0700 | [diff] [blame] | 2119 | * Broadcast Action: A new version of an application package has been |
| 2120 | * installed, replacing an existing version that was previously installed. |
| 2121 | * The data contains the name of the package. |
Jeff Sharkey | d0c6ccb | 2012-09-14 16:26:37 -0700 | [diff] [blame] | 2122 | * <p>May include the following extras: |
The Android Open Source Project | c2ad241 | 2009-03-19 23:08:54 -0700 | [diff] [blame] | 2123 | * <ul> |
| 2124 | * <li> {@link #EXTRA_UID} containing the integer uid assigned to the new package. |
| 2125 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2126 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2127 | * <p class="note">This is a protected intent that can only be sent |
| 2128 | * by the system. |
The Android Open Source Project | c2ad241 | 2009-03-19 23:08:54 -0700 | [diff] [blame] | 2129 | */ |
| 2130 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2131 | public static final String ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED"; |
| 2132 | /** |
Dianne Hackborn | e7f9721 | 2011-02-24 14:40:20 -0800 | [diff] [blame] | 2133 | * Broadcast Action: A new version of your application has been installed |
| 2134 | * over an existing one. This is only sent to the application that was |
| 2135 | * replaced. It does not contain any additional data; to receive it, just |
| 2136 | * use an intent filter for this action. |
| 2137 | * |
| 2138 | * <p class="note">This is a protected intent that can only be sent |
| 2139 | * by the system. |
| 2140 | */ |
| 2141 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2142 | public static final String ACTION_MY_PACKAGE_REPLACED = "android.intent.action.MY_PACKAGE_REPLACED"; |
| 2143 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2144 | * Broadcast Action: An existing application package has been removed from |
| 2145 | * the device. The data contains the name of the package. The package |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 2146 | * 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] | 2147 | * <ul> |
| 2148 | * <li> {@link #EXTRA_UID} containing the integer uid previously assigned |
| 2149 | * to the package. |
| 2150 | * <li> {@link #EXTRA_DATA_REMOVED} is set to true if the entire |
| 2151 | * application -- data and code -- is being removed. |
| 2152 | * <li> {@link #EXTRA_REPLACING} is set to true if this will be followed |
| 2153 | * by an {@link #ACTION_PACKAGE_ADDED} broadcast for the same package. |
| 2154 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2155 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2156 | * <p class="note">This is a protected intent that can only be sent |
| 2157 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2158 | */ |
| 2159 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2160 | public static final String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED"; |
| 2161 | /** |
Dianne Hackborn | f9abb40 | 2011-08-10 15:00:59 -0700 | [diff] [blame] | 2162 | * Broadcast Action: An existing application package has been completely |
| 2163 | * removed from the device. The data contains the name of the package. |
| 2164 | * This is like {@link #ACTION_PACKAGE_REMOVED}, but only set when |
| 2165 | * {@link #EXTRA_DATA_REMOVED} is true and |
| 2166 | * {@link #EXTRA_REPLACING} is false of that broadcast. |
| 2167 | * |
| 2168 | * <ul> |
| 2169 | * <li> {@link #EXTRA_UID} containing the integer uid previously assigned |
| 2170 | * to the package. |
| 2171 | * </ul> |
| 2172 | * |
| 2173 | * <p class="note">This is a protected intent that can only be sent |
| 2174 | * by the system. |
| 2175 | */ |
| 2176 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2177 | public static final String ACTION_PACKAGE_FULLY_REMOVED |
| 2178 | = "android.intent.action.PACKAGE_FULLY_REMOVED"; |
| 2179 | /** |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 2180 | * Broadcast Action: An existing application package has been changed (for |
| 2181 | * example, a component has been enabled or disabled). The data contains |
| 2182 | * the name of the package. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2183 | * <ul> |
| 2184 | * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. |
Dianne Hackborn | 86a72da | 2009-11-11 20:12:41 -0800 | [diff] [blame] | 2185 | * <li> {@link #EXTRA_CHANGED_COMPONENT_NAME_LIST} containing the class name |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 2186 | * of the changed components (or the package name itself). |
Dianne Hackborn | 86a72da | 2009-11-11 20:12:41 -0800 | [diff] [blame] | 2187 | * <li> {@link #EXTRA_DONT_KILL_APP} containing boolean field to override the |
| 2188 | * default action of restarting the application. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2189 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2190 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2191 | * <p class="note">This is a protected intent that can only be sent |
| 2192 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2193 | */ |
| 2194 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2195 | public static final String ACTION_PACKAGE_CHANGED = "android.intent.action.PACKAGE_CHANGED"; |
| 2196 | /** |
Dianne Hackborn | 21f1bd1 | 2010-02-19 17:02:21 -0800 | [diff] [blame] | 2197 | * @hide |
| 2198 | * Broadcast Action: Ask system services if there is any reason to |
| 2199 | * restart the given package. The data contains the name of the |
| 2200 | * package. |
| 2201 | * <ul> |
| 2202 | * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. |
| 2203 | * <li> {@link #EXTRA_PACKAGES} String array of all packages to check. |
| 2204 | * </ul> |
| 2205 | * |
| 2206 | * <p class="note">This is a protected intent that can only be sent |
| 2207 | * by the system. |
| 2208 | */ |
Soonil Nagarkar | 0e8fd09 | 2015-02-10 10:37:36 -0800 | [diff] [blame] | 2209 | @SystemApi |
Dianne Hackborn | 21f1bd1 | 2010-02-19 17:02:21 -0800 | [diff] [blame] | 2210 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2211 | public static final String ACTION_QUERY_PACKAGE_RESTART = "android.intent.action.QUERY_PACKAGE_RESTART"; |
| 2212 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2213 | * Broadcast Action: The user has restarted a package, and all of its |
| 2214 | * processes have been killed. All runtime state |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2215 | * associated with it (processes, alarms, notifications, etc) should |
The Android Open Source Project | c2ad241 | 2009-03-19 23:08:54 -0700 | [diff] [blame] | 2216 | * be removed. Note that the restarted package does <em>not</em> |
| 2217 | * receive this broadcast. |
| 2218 | * The data contains the name of the package. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2219 | * <ul> |
| 2220 | * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. |
| 2221 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2222 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2223 | * <p class="note">This is a protected intent that can only be sent |
| 2224 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2225 | */ |
| 2226 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2227 | public static final String ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED"; |
| 2228 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2229 | * Broadcast Action: The user has cleared the data of a package. This should |
| 2230 | * 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] | 2231 | * its persistent data is erased and this broadcast sent. |
| 2232 | * Note that the cleared package does <em>not</em> |
| 2233 | * 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] | 2234 | * <ul> |
Svet Ganov | f935a70 | 2017-08-22 12:15:58 -0700 | [diff] [blame] | 2235 | * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. If the |
| 2236 | * package whose data was cleared is an uninstalled instant app, then the UID |
| 2237 | * will be -1. The platform keeps some meta-data associated with instant apps |
| 2238 | * after they are uninstalled. |
| 2239 | * <li> {@link #EXTRA_PACKAGE_NAME} containing the package name only if the cleared |
| 2240 | * data was for an instant app. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2241 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2242 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2243 | * <p class="note">This is a protected intent that can only be sent |
| 2244 | * by the system. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2245 | */ |
| 2246 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2247 | public static final String ACTION_PACKAGE_DATA_CLEARED = "android.intent.action.PACKAGE_DATA_CLEARED"; |
| 2248 | /** |
Andrei Stingaceanu | 69d5ebc | 2016-01-14 12:59:03 +0000 | [diff] [blame] | 2249 | * Broadcast Action: Packages have been suspended. |
| 2250 | * <p>Includes the following extras: |
| 2251 | * <ul> |
| 2252 | * <li> {@link #EXTRA_CHANGED_PACKAGE_LIST} is the set of packages which have been suspended |
| 2253 | * </ul> |
| 2254 | * |
| 2255 | * <p class="note">This is a protected intent that can only be sent |
| 2256 | * by the system. It is only sent to registered receivers. |
| 2257 | */ |
| 2258 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2259 | public static final String ACTION_PACKAGES_SUSPENDED = "android.intent.action.PACKAGES_SUSPENDED"; |
| 2260 | /** |
| 2261 | * Broadcast Action: Packages have been unsuspended. |
| 2262 | * <p>Includes the following extras: |
| 2263 | * <ul> |
| 2264 | * <li> {@link #EXTRA_CHANGED_PACKAGE_LIST} is the set of packages which have been unsuspended |
| 2265 | * </ul> |
| 2266 | * |
| 2267 | * <p class="note">This is a protected intent that can only be sent |
| 2268 | * by the system. It is only sent to registered receivers. |
| 2269 | */ |
| 2270 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2271 | public static final String ACTION_PACKAGES_UNSUSPENDED = "android.intent.action.PACKAGES_UNSUSPENDED"; |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 2272 | |
| 2273 | /** |
| 2274 | * 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] | 2275 | * whenever a package is put into a suspended state or any of its app extras change while in the |
| 2276 | * suspended state. |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 2277 | * <p> Optionally includes the following extras: |
| 2278 | * <ul> |
| 2279 | * <li> {@link #EXTRA_SUSPENDED_PACKAGE_EXTRAS} which is a {@link Bundle} which will contain |
| 2280 | * useful information for the app being suspended. |
| 2281 | * </ul> |
| 2282 | * <p class="note">This is a protected intent that can only be sent |
| 2283 | * by the system. <em>This will be delivered to {@link BroadcastReceiver} components declared in |
| 2284 | * the manifest.</em> |
| 2285 | * |
| 2286 | * @see #ACTION_MY_PACKAGE_UNSUSPENDED |
| 2287 | * @see #EXTRA_SUSPENDED_PACKAGE_EXTRAS |
| 2288 | * @see PackageManager#isPackageSuspended() |
| 2289 | * @see PackageManager#getSuspendedPackageAppExtras() |
| 2290 | */ |
| 2291 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2292 | public static final String ACTION_MY_PACKAGE_SUSPENDED = "android.intent.action.MY_PACKAGE_SUSPENDED"; |
| 2293 | |
| 2294 | /** |
Suprabh Shukla | 3c3af14 | 2018-03-30 00:28:37 -0700 | [diff] [blame] | 2295 | * Activity Action: Started to show more details about why an application was suspended. |
| 2296 | * |
Suprabh Shukla | 3e03ab9 | 2018-04-11 16:03:49 -0700 | [diff] [blame] | 2297 | * <p>Whenever the system detects an activity launch for a suspended app, this action can |
| 2298 | * be used to show more details about the reason for suspension. |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 2299 | * |
Suprabh Shukla | 3c3af14 | 2018-03-30 00:28:37 -0700 | [diff] [blame] | 2300 | * <p>Apps holding {@link android.Manifest.permission#SUSPEND_APPS} must declare an activity |
| 2301 | * handling this intent and protect it with |
| 2302 | * {@link android.Manifest.permission#SEND_SHOW_SUSPENDED_APP_DETAILS}. |
| 2303 | * |
| 2304 | * <p>Includes an extra {@link #EXTRA_PACKAGE_NAME} which is the name of the suspended package. |
| 2305 | * |
| 2306 | * <p class="note">This is a protected intent that can only be sent |
| 2307 | * by the system. |
| 2308 | * |
Suprabh Shukla | 96212bc | 2018-04-10 15:04:51 -0700 | [diff] [blame] | 2309 | * @see PackageManager#setPackagesSuspended(String[], boolean, PersistableBundle, |
| 2310 | * PersistableBundle, String) |
Suprabh Shukla | 3c3af14 | 2018-03-30 00:28:37 -0700 | [diff] [blame] | 2311 | * @see PackageManager#isPackageSuspended() |
| 2312 | * @see #ACTION_PACKAGES_SUSPENDED |
| 2313 | * |
| 2314 | * @hide |
| 2315 | */ |
| 2316 | @SystemApi |
| 2317 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 2318 | public static final String ACTION_SHOW_SUSPENDED_APP_DETAILS = |
| 2319 | "android.intent.action.SHOW_SUSPENDED_APP_DETAILS"; |
| 2320 | |
| 2321 | /** |
Suprabh Shukla | 2fd43ba | 2018-03-22 16:57:49 -0700 | [diff] [blame] | 2322 | * Broadcast Action: Sent to a package that has been unsuspended. |
| 2323 | * |
| 2324 | * <p class="note">This is a protected intent that can only be sent |
| 2325 | * by the system. <em>This will be delivered to {@link BroadcastReceiver} components declared in |
| 2326 | * the manifest.</em> |
| 2327 | * |
| 2328 | * @see #ACTION_MY_PACKAGE_SUSPENDED |
| 2329 | * @see #EXTRA_SUSPENDED_PACKAGE_EXTRAS |
| 2330 | * @see PackageManager#isPackageSuspended() |
| 2331 | * @see PackageManager#getSuspendedPackageAppExtras() |
| 2332 | */ |
| 2333 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2334 | public static final String ACTION_MY_PACKAGE_UNSUSPENDED = "android.intent.action.MY_PACKAGE_UNSUSPENDED"; |
| 2335 | |
Andrei Stingaceanu | 69d5ebc | 2016-01-14 12:59:03 +0000 | [diff] [blame] | 2336 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2337 | * Broadcast Action: A user ID has been removed from the system. The user |
| 2338 | * ID number is stored in the extra data under {@link #EXTRA_UID}. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2339 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2340 | * <p class="note">This is a protected intent that can only be sent |
| 2341 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2342 | */ |
| 2343 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2344 | public static final String ACTION_UID_REMOVED = "android.intent.action.UID_REMOVED"; |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 2345 | |
| 2346 | /** |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 2347 | * Broadcast Action: Sent to the installer package of an application when |
| 2348 | * that application is first launched (that is the first time it is moved |
| 2349 | * 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] | 2350 | * |
| 2351 | * <p class="note">This is a protected intent that can only be sent |
| 2352 | * by the system. |
| 2353 | */ |
| 2354 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2355 | public static final String ACTION_PACKAGE_FIRST_LAUNCH = "android.intent.action.PACKAGE_FIRST_LAUNCH"; |
| 2356 | |
| 2357 | /** |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 2358 | * Broadcast Action: Sent to the system package verifier when a package |
| 2359 | * needs to be verified. The data contains the package URI. |
| 2360 | * <p class="note"> |
| 2361 | * This is a protected intent that can only be sent by the system. |
| 2362 | * </p> |
Kenny Root | 5ab2157 | 2011-07-27 11:11:19 -0700 | [diff] [blame] | 2363 | */ |
| 2364 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2365 | public static final String ACTION_PACKAGE_NEEDS_VERIFICATION = "android.intent.action.PACKAGE_NEEDS_VERIFICATION"; |
| 2366 | |
| 2367 | /** |
rich cannings | d1b5cfc | 2012-08-29 14:49:51 -0700 | [diff] [blame] | 2368 | * Broadcast Action: Sent to the system package verifier when a package is |
| 2369 | * verified. The data contains the package URI. |
| 2370 | * <p class="note"> |
| 2371 | * This is a protected intent that can only be sent by the system. |
| 2372 | */ |
| 2373 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2374 | public static final String ACTION_PACKAGE_VERIFIED = "android.intent.action.PACKAGE_VERIFIED"; |
| 2375 | |
| 2376 | /** |
Trevor Johns | 682c24e | 2016-04-12 10:13:47 -0700 | [diff] [blame] | 2377 | * Broadcast Action: Sent to the system intent filter verifier when an |
| 2378 | * intent filter needs to be verified. The data contains the filter data |
| 2379 | * hosts to be verified against. |
Fabrice Di Meglio | 1c1b471 | 2014-11-19 17:12:32 -0800 | [diff] [blame] | 2380 | * <p class="note"> |
| 2381 | * This is a protected intent that can only be sent by the system. |
| 2382 | * </p> |
| 2383 | * |
| 2384 | * @hide |
| 2385 | */ |
| 2386 | @SystemApi |
| 2387 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2388 | public static final String ACTION_INTENT_FILTER_NEEDS_VERIFICATION = "android.intent.action.INTENT_FILTER_NEEDS_VERIFICATION"; |
| 2389 | |
| 2390 | /** |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 2391 | * Broadcast Action: Resources for a set of packages (which were |
| 2392 | * previously unavailable) are currently |
| 2393 | * available since the media on which they exist is available. |
| 2394 | * The extra data {@link #EXTRA_CHANGED_PACKAGE_LIST} contains a |
| 2395 | * list of packages whose availability changed. |
| 2396 | * The extra data {@link #EXTRA_CHANGED_UID_LIST} contains a |
| 2397 | * list of uids of packages whose availability changed. |
| 2398 | * Note that the |
| 2399 | * packages in this list do <em>not</em> receive this broadcast. |
| 2400 | * The specified set of packages are now available on the system. |
| 2401 | * <p>Includes the following extras: |
| 2402 | * <ul> |
| 2403 | * <li> {@link #EXTRA_CHANGED_PACKAGE_LIST} is the set of packages |
| 2404 | * whose resources(were previously unavailable) are currently available. |
| 2405 | * {@link #EXTRA_CHANGED_UID_LIST} is the set of uids of the |
| 2406 | * packages whose resources(were previously unavailable) |
| 2407 | * are currently available. |
| 2408 | * </ul> |
| 2409 | * |
| 2410 | * <p class="note">This is a protected intent that can only be sent |
| 2411 | * by the system. |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 2412 | */ |
| 2413 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 2414 | public static final String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE = |
| 2415 | "android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE"; |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 2416 | |
| 2417 | /** |
| 2418 | * Broadcast Action: Resources for a set of packages are currently |
| 2419 | * unavailable since the media on which they exist is unavailable. |
| 2420 | * The extra data {@link #EXTRA_CHANGED_PACKAGE_LIST} contains a |
| 2421 | * list of packages whose availability changed. |
| 2422 | * The extra data {@link #EXTRA_CHANGED_UID_LIST} contains a |
| 2423 | * list of uids of packages whose availability changed. |
| 2424 | * The specified set of packages can no longer be |
| 2425 | * launched and are practically unavailable on the system. |
| 2426 | * <p>Inclues the following extras: |
| 2427 | * <ul> |
| 2428 | * <li> {@link #EXTRA_CHANGED_PACKAGE_LIST} is the set of packages |
| 2429 | * whose resources are no longer available. |
| 2430 | * {@link #EXTRA_CHANGED_UID_LIST} is the set of packages |
| 2431 | * whose resources are no longer available. |
| 2432 | * </ul> |
| 2433 | * |
| 2434 | * <p class="note">This is a protected intent that can only be sent |
| 2435 | * by the system. |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 2436 | */ |
| 2437 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 2438 | public static final String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE = |
Joe Onorato | 8a051a4 | 2010-03-04 15:54:50 -0500 | [diff] [blame] | 2439 | "android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE"; |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 2440 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2441 | /** |
Makoto Onuki | 1030520 | 2016-07-14 18:14:08 -0700 | [diff] [blame] | 2442 | * Broadcast Action: preferred activities have changed *explicitly*. |
| 2443 | * |
| 2444 | * <p>Note there are cases where a preferred activity is invalidated *implicitly*, e.g. |
| 2445 | * when an app is installed or uninstalled, but in such cases this broadcast will *not* |
| 2446 | * be sent. |
| 2447 | * |
| 2448 | * {@link #EXTRA_USER_HANDLE} contains the user ID in question. |
| 2449 | * |
| 2450 | * @hide |
| 2451 | */ |
| 2452 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2453 | public static final String ACTION_PREFERRED_ACTIVITY_CHANGED = |
| 2454 | "android.intent.action.ACTION_PREFERRED_ACTIVITY_CHANGED"; |
| 2455 | |
| 2456 | |
| 2457 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2458 | * Broadcast Action: The current system wallpaper has changed. See |
Scott Main | 8b2e000 | 2009-09-29 18:17:31 -0700 | [diff] [blame] | 2459 | * {@link android.app.WallpaperManager} for retrieving the new wallpaper. |
Dianne Hackborn | c5bf758 | 2012-04-25 19:12:07 -0700 | [diff] [blame] | 2460 | * This should <em>only</em> be used to determine when the wallpaper |
| 2461 | * has changed to show the new wallpaper to the user. You should certainly |
| 2462 | * never, in response to this, change the wallpaper or other attributes of |
| 2463 | * it such as the suggested size. That would be crazy, right? You'd cause |
| 2464 | * all kinds of loops, especially if other apps are doing similar things, |
| 2465 | * right? Of course. So please don't do this. |
| 2466 | * |
| 2467 | * @deprecated Modern applications should use |
| 2468 | * {@link android.view.WindowManager.LayoutParams#FLAG_SHOW_WALLPAPER |
| 2469 | * WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER} to have the wallpaper |
| 2470 | * shown behind their UI, rather than watching for this broadcast and |
| 2471 | * rendering the wallpaper on their own. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2472 | */ |
Dianne Hackborn | c5bf758 | 2012-04-25 19:12:07 -0700 | [diff] [blame] | 2473 | @Deprecated @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2474 | public static final String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED"; |
| 2475 | /** |
| 2476 | * Broadcast Action: The current device {@link android.content.res.Configuration} |
| 2477 | * (orientation, locale, etc) has changed. When such a change happens, the |
| 2478 | * UIs (view hierarchy) will need to be rebuilt based on this new |
| 2479 | * information; for the most part, applications don't need to worry about |
| 2480 | * this, because the system will take care of stopping and restarting the |
| 2481 | * application to make sure it sees the new changes. Some system code that |
| 2482 | * can not be restarted will need to watch for this action and handle it |
| 2483 | * appropriately. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2484 | * |
Dianne Hackborn | 362d5b9 | 2009-11-11 18:04:39 -0800 | [diff] [blame] | 2485 | * <p class="note"> |
Casey Ho | dbf6785c | 2015-03-17 15:59:39 -0700 | [diff] [blame] | 2486 | * You <em>cannot</em> receive this through components declared |
Dianne Hackborn | 362d5b9 | 2009-11-11 18:04:39 -0800 | [diff] [blame] | 2487 | * in manifests, only by explicitly registering for it with |
| 2488 | * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
| 2489 | * Context.registerReceiver()}. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2490 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2491 | * <p class="note">This is a protected intent that can only be sent |
| 2492 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2493 | * |
| 2494 | * @see android.content.res.Configuration |
| 2495 | */ |
| 2496 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2497 | public static final String ACTION_CONFIGURATION_CHANGED = "android.intent.action.CONFIGURATION_CHANGED"; |
Adam Lesinski | 57fccd6 | 2018-01-25 13:03:57 -0800 | [diff] [blame] | 2498 | |
| 2499 | /** |
| 2500 | * Broadcast Action: The current device {@link android.content.res.Configuration} has changed |
| 2501 | * such that the device may be eligible for the installation of additional configuration splits. |
| 2502 | * Configuration properties that can trigger this broadcast include locale and display density. |
| 2503 | * |
| 2504 | * <p class="note"> |
| 2505 | * Unlike {@link #ACTION_CONFIGURATION_CHANGED}, you <em>can</em> receive this through |
| 2506 | * components declared in manifests. However, the receiver <em>must</em> hold the |
| 2507 | * {@link android.Manifest.permission#INSTALL_PACKAGES} permission. |
| 2508 | * |
| 2509 | * <p class="note"> |
| 2510 | * This is a protected intent that can only be sent by the system. |
| 2511 | * |
| 2512 | * @hide |
| 2513 | */ |
| 2514 | @SystemApi |
| 2515 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2516 | public static final String ACTION_SPLIT_CONFIGURATION_CHANGED = |
| 2517 | "android.intent.action.SPLIT_CONFIGURATION_CHANGED"; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2518 | /** |
Dianne Hackborn | 362d5b9 | 2009-11-11 18:04:39 -0800 | [diff] [blame] | 2519 | * Broadcast Action: The current device's locale has changed. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2520 | * |
Dianne Hackborn | 362d5b9 | 2009-11-11 18:04:39 -0800 | [diff] [blame] | 2521 | * <p class="note">This is a protected intent that can only be sent |
| 2522 | * by the system. |
| 2523 | */ |
| 2524 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2525 | public static final String ACTION_LOCALE_CHANGED = "android.intent.action.LOCALE_CHANGED"; |
| 2526 | /** |
Dianne Hackborn | edd9316 | 2009-09-19 14:03:05 -0700 | [diff] [blame] | 2527 | * Broadcast Action: This is a <em>sticky broadcast</em> containing the |
| 2528 | * charging state, level, and other information about the battery. |
| 2529 | * See {@link android.os.BatteryManager} for documentation on the |
| 2530 | * contents of the Intent. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 2531 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2532 | * <p class="note"> |
Casey Ho | dbf6785c | 2015-03-17 15:59:39 -0700 | [diff] [blame] | 2533 | * You <em>cannot</em> receive this through components declared |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2534 | * in manifests, only by explicitly registering for it with |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2535 | * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
Dianne Hackborn | edd9316 | 2009-09-19 14:03:05 -0700 | [diff] [blame] | 2536 | * Context.registerReceiver()}. See {@link #ACTION_BATTERY_LOW}, |
| 2537 | * {@link #ACTION_BATTERY_OKAY}, {@link #ACTION_POWER_CONNECTED}, |
| 2538 | * and {@link #ACTION_POWER_DISCONNECTED} for distinct battery-related |
| 2539 | * broadcasts that are sent and can be received through manifest |
| 2540 | * receivers. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2541 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2542 | * <p class="note">This is a protected intent that can only be sent |
| 2543 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2544 | */ |
| 2545 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2546 | public static final String ACTION_BATTERY_CHANGED = "android.intent.action.BATTERY_CHANGED"; |
Fyodor Kupolov | 70e7543 | 2018-03-01 18:29:06 -0800 | [diff] [blame] | 2547 | |
| 2548 | |
| 2549 | /** |
| 2550 | * Broadcast Action: Sent when the current battery level changes. |
| 2551 | * |
| 2552 | * It has {@link android.os.BatteryManager#EXTRA_EVENTS} that carries a list of {@link Bundle} |
| 2553 | * instances representing individual battery level changes with associated |
| 2554 | * extras from {@link #ACTION_BATTERY_CHANGED}. |
| 2555 | * |
| 2556 | * <p class="note"> |
| 2557 | * This broadcast requires {@link android.Manifest.permission#BATTERY_STATS} permission. |
| 2558 | * |
| 2559 | * @hide |
| 2560 | */ |
| 2561 | @SystemApi |
| 2562 | public static final String ACTION_BATTERY_LEVEL_CHANGED = |
| 2563 | "android.intent.action.BATTERY_LEVEL_CHANGED"; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2564 | /** |
| 2565 | * Broadcast Action: Indicates low battery condition on the device. |
| 2566 | * This broadcast corresponds to the "Low battery warning" system dialog. |
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 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2572 | public static final String ACTION_BATTERY_LOW = "android.intent.action.BATTERY_LOW"; |
| 2573 | /** |
Dianne Hackborn | 1dac277 | 2009-06-26 18:16:48 -0700 | [diff] [blame] | 2574 | * Broadcast Action: Indicates the battery is now okay after being low. |
| 2575 | * This will be sent after {@link #ACTION_BATTERY_LOW} once the battery has |
| 2576 | * gone back up to an okay state. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2577 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2578 | * <p class="note">This is a protected intent that can only be sent |
| 2579 | * by the system. |
Dianne Hackborn | 1dac277 | 2009-06-26 18:16:48 -0700 | [diff] [blame] | 2580 | */ |
| 2581 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2582 | public static final String ACTION_BATTERY_OKAY = "android.intent.action.BATTERY_OKAY"; |
| 2583 | /** |
Cliff Spradlin | fda6fae | 2008-10-22 20:29:16 -0700 | [diff] [blame] | 2584 | * Broadcast Action: External power has been connected to the device. |
| 2585 | * This is intended for applications that wish to register specifically to this notification. |
| 2586 | * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to |
| 2587 | * stay active to receive this notification. This action can be used to implement actions |
| 2588 | * that wait until power is available to trigger. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2589 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2590 | * <p class="note">This is a protected intent that can only be sent |
| 2591 | * by the system. |
Cliff Spradlin | fda6fae | 2008-10-22 20:29:16 -0700 | [diff] [blame] | 2592 | */ |
| 2593 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Dianne Hackborn | fe240ec | 2009-08-27 12:51:11 -0700 | [diff] [blame] | 2594 | 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] | 2595 | /** |
| 2596 | * Broadcast Action: External power has been removed from the device. |
| 2597 | * This is intended for applications that wish to register specifically to this notification. |
| 2598 | * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to |
| 2599 | * 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] | 2600 | * that wait until power is available to trigger. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2601 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2602 | * <p class="note">This is a protected intent that can only be sent |
| 2603 | * by the system. |
Cliff Spradlin | fda6fae | 2008-10-22 20:29:16 -0700 | [diff] [blame] | 2604 | */ |
| 2605 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Jean-Baptiste Queru | 1ef4564 | 2008-10-24 11:49:25 -0700 | [diff] [blame] | 2606 | public static final String ACTION_POWER_DISCONNECTED = |
Dianne Hackborn | fe240ec | 2009-08-27 12:51:11 -0700 | [diff] [blame] | 2607 | "android.intent.action.ACTION_POWER_DISCONNECTED"; |
Cliff Spradlin | fda6fae | 2008-10-22 20:29:16 -0700 | [diff] [blame] | 2608 | /** |
Dianne Hackborn | 55280a9 | 2009-05-07 15:53:46 -0700 | [diff] [blame] | 2609 | * Broadcast Action: Device is shutting down. |
| 2610 | * This is broadcast when the device is being shut down (completely turned |
| 2611 | * off, not sleeping). Once the broadcast is complete, the final shutdown |
| 2612 | * will proceed and all unsaved data lost. Apps will not normally need |
Dianne Hackborn | fe240ec | 2009-08-27 12:51:11 -0700 | [diff] [blame] | 2613 | * to handle this, since the foreground activity will be paused as well. |
Fyodor Kupolov | 1fc6260 | 2018-02-01 15:48:53 -0800 | [diff] [blame] | 2614 | * <p>As of {@link Build.VERSION_CODES#P} this broadcast is only sent to receivers registered |
| 2615 | * through {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
| 2616 | * Context.registerReceiver}. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2617 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2618 | * <p class="note">This is a protected intent that can only be sent |
| 2619 | * by the system. |
Dianne Hackborn | 57a7f59 | 2013-07-22 18:21:32 -0700 | [diff] [blame] | 2620 | * <p>May include the following extras: |
| 2621 | * <ul> |
| 2622 | * <li> {@link #EXTRA_SHUTDOWN_USERSPACE_ONLY} a boolean that is set to true if this |
| 2623 | * shutdown is only for userspace processes. If not set, assumed to be false. |
| 2624 | * </ul> |
Dianne Hackborn | 55280a9 | 2009-05-07 15:53:46 -0700 | [diff] [blame] | 2625 | */ |
| 2626 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 2627 | public static final String ACTION_SHUTDOWN = "android.intent.action.ACTION_SHUTDOWN"; |
Dianne Hackborn | 55280a9 | 2009-05-07 15:53:46 -0700 | [diff] [blame] | 2628 | /** |
Mike Lockwood | bad80e0 | 2009-07-30 01:21:08 -0700 | [diff] [blame] | 2629 | * Activity Action: Start this activity to request system shutdown. |
| 2630 | * 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] | 2631 | * to request confirmation from the user before shutting down. The optional boolean |
| 2632 | * extra field {@link #EXTRA_USER_REQUESTED_SHUTDOWN} can be set to true to |
| 2633 | * indicate that the shutdown is requested by the user. |
Mike Lockwood | bad80e0 | 2009-07-30 01:21:08 -0700 | [diff] [blame] | 2634 | * |
| 2635 | * <p class="note">This is a protected intent that can only be sent |
| 2636 | * by the system. |
| 2637 | * |
| 2638 | * {@hide} |
| 2639 | */ |
Sudheer Shanka | 218190a | 2017-03-30 16:07:54 -0700 | [diff] [blame] | 2640 | public static final String ACTION_REQUEST_SHUTDOWN |
| 2641 | = "com.android.internal.intent.action.REQUEST_SHUTDOWN"; |
Mike Lockwood | bad80e0 | 2009-07-30 01:21:08 -0700 | [diff] [blame] | 2642 | /** |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2643 | * Broadcast Action: A sticky broadcast that indicates low storage space |
Dianne Hackborn | edd9316 | 2009-09-19 14:03:05 -0700 | [diff] [blame] | 2644 | * condition on the device |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2645 | * <p class="note"> |
| 2646 | * 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] | 2647 | * |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2648 | * @deprecated if your app targets {@link android.os.Build.VERSION_CODES#O} |
| 2649 | * or above, this broadcast will no longer be delivered to any |
| 2650 | * {@link BroadcastReceiver} defined in your manifest. Instead, |
| 2651 | * apps are strongly encouraged to use the improved |
| 2652 | * {@link Context#getCacheDir()} behavior so the system can |
| 2653 | * automatically free up storage when needed. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2654 | */ |
| 2655 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2656 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2657 | public static final String ACTION_DEVICE_STORAGE_LOW = "android.intent.action.DEVICE_STORAGE_LOW"; |
| 2658 | /** |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2659 | * Broadcast Action: Indicates low storage space condition on the device no |
| 2660 | * longer exists |
| 2661 | * <p class="note"> |
| 2662 | * 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] | 2663 | * |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2664 | * @deprecated if your app targets {@link android.os.Build.VERSION_CODES#O} |
| 2665 | * or above, this broadcast will no longer be delivered to any |
| 2666 | * {@link BroadcastReceiver} defined in your manifest. Instead, |
| 2667 | * apps are strongly encouraged to use the improved |
| 2668 | * {@link Context#getCacheDir()} behavior so the system can |
| 2669 | * automatically free up storage when needed. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2670 | */ |
| 2671 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2672 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2673 | public static final String ACTION_DEVICE_STORAGE_OK = "android.intent.action.DEVICE_STORAGE_OK"; |
| 2674 | /** |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2675 | * Broadcast Action: A sticky broadcast that indicates a storage space full |
| 2676 | * condition on the device. This is intended for activities that want to be |
| 2677 | * able to fill the data partition completely, leaving only enough free |
| 2678 | * space to prevent system-wide SQLite failures. |
| 2679 | * <p class="note"> |
| 2680 | * 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] | 2681 | * |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2682 | * @deprecated if your app targets {@link android.os.Build.VERSION_CODES#O} |
| 2683 | * or above, this broadcast will no longer be delivered to any |
| 2684 | * {@link BroadcastReceiver} defined in your manifest. Instead, |
| 2685 | * apps are strongly encouraged to use the improved |
| 2686 | * {@link Context#getCacheDir()} behavior so the system can |
| 2687 | * automatically free up storage when needed. |
| 2688 | * @hide |
Jake Hamby | bb37163 | 2010-08-23 18:16:48 -0700 | [diff] [blame] | 2689 | */ |
| 2690 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2691 | @Deprecated |
Jake Hamby | bb37163 | 2010-08-23 18:16:48 -0700 | [diff] [blame] | 2692 | public static final String ACTION_DEVICE_STORAGE_FULL = "android.intent.action.DEVICE_STORAGE_FULL"; |
| 2693 | /** |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2694 | * Broadcast Action: Indicates storage space full condition on the device no |
| 2695 | * longer exists. |
| 2696 | * <p class="note"> |
| 2697 | * 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] | 2698 | * |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2699 | * @deprecated if your app targets {@link android.os.Build.VERSION_CODES#O} |
| 2700 | * or above, this broadcast will no longer be delivered to any |
| 2701 | * {@link BroadcastReceiver} defined in your manifest. Instead, |
| 2702 | * apps are strongly encouraged to use the improved |
| 2703 | * {@link Context#getCacheDir()} behavior so the system can |
| 2704 | * automatically free up storage when needed. |
| 2705 | * @hide |
Jake Hamby | bb37163 | 2010-08-23 18:16:48 -0700 | [diff] [blame] | 2706 | */ |
| 2707 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Jeff Sharkey | 179d6b3 | 2017-03-12 17:27:47 -0600 | [diff] [blame] | 2708 | @Deprecated |
Jake Hamby | bb37163 | 2010-08-23 18:16:48 -0700 | [diff] [blame] | 2709 | public static final String ACTION_DEVICE_STORAGE_NOT_FULL = "android.intent.action.DEVICE_STORAGE_NOT_FULL"; |
| 2710 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2711 | * Broadcast Action: Indicates low memory condition notification acknowledged by user |
| 2712 | * and package management should be started. |
| 2713 | * This is triggered by the user from the ACTION_DEVICE_STORAGE_LOW |
| 2714 | * notification. |
| 2715 | */ |
| 2716 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2717 | public static final String ACTION_MANAGE_PACKAGE_STORAGE = "android.intent.action.MANAGE_PACKAGE_STORAGE"; |
| 2718 | /** |
| 2719 | * Broadcast Action: The device has entered USB Mass Storage mode. |
| 2720 | * This is used mainly for the USB Settings panel. |
| 2721 | * Apps should listen for ACTION_MEDIA_MOUNTED and ACTION_MEDIA_UNMOUNTED broadcasts to be notified |
| 2722 | * when the SD card file system is mounted or unmounted |
Mike Lockwood | 7e4db37 | 2011-06-07 11:23:44 -0700 | [diff] [blame] | 2723 | * @deprecated replaced by android.os.storage.StorageEventListener |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2724 | */ |
Mike Lockwood | da85e52 | 2011-06-07 09:08:34 -0700 | [diff] [blame] | 2725 | @Deprecated |
Jeff Sharkey | 0f3f60b | 2017-04-24 18:06:20 -0600 | [diff] [blame] | 2726 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2727 | public static final String ACTION_UMS_CONNECTED = "android.intent.action.UMS_CONNECTED"; |
| 2728 | |
| 2729 | /** |
| 2730 | * Broadcast Action: The device has exited USB Mass Storage mode. |
| 2731 | * This is used mainly for the USB Settings panel. |
| 2732 | * Apps should listen for ACTION_MEDIA_MOUNTED and ACTION_MEDIA_UNMOUNTED broadcasts to be notified |
| 2733 | * when the SD card file system is mounted or unmounted |
Mike Lockwood | 7e4db37 | 2011-06-07 11:23:44 -0700 | [diff] [blame] | 2734 | * @deprecated replaced by android.os.storage.StorageEventListener |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2735 | */ |
Mike Lockwood | da85e52 | 2011-06-07 09:08:34 -0700 | [diff] [blame] | 2736 | @Deprecated |
Jeff Sharkey | 0f3f60b | 2017-04-24 18:06:20 -0600 | [diff] [blame] | 2737 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2738 | public static final String ACTION_UMS_DISCONNECTED = "android.intent.action.UMS_DISCONNECTED"; |
| 2739 | |
| 2740 | /** |
| 2741 | * Broadcast Action: External media has been removed. |
| 2742 | * The path to the mount point for the removed media is contained in the Intent.mData field. |
| 2743 | */ |
| 2744 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2745 | public static final String ACTION_MEDIA_REMOVED = "android.intent.action.MEDIA_REMOVED"; |
| 2746 | |
| 2747 | /** |
| 2748 | * 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] | 2749 | * 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] | 2750 | */ |
| 2751 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2752 | public static final String ACTION_MEDIA_UNMOUNTED = "android.intent.action.MEDIA_UNMOUNTED"; |
| 2753 | |
| 2754 | /** |
The Android Open Source Project | f1e484a | 2009-01-22 00:13:42 -0800 | [diff] [blame] | 2755 | * Broadcast Action: External media is present, and being disk-checked |
| 2756 | * 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] | 2757 | */ |
| 2758 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2759 | public static final String ACTION_MEDIA_CHECKING = "android.intent.action.MEDIA_CHECKING"; |
| 2760 | |
| 2761 | /** |
| 2762 | * Broadcast Action: External media is present, but is using an incompatible fs (or is blank) |
| 2763 | * 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] | 2764 | */ |
| 2765 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2766 | public static final String ACTION_MEDIA_NOFS = "android.intent.action.MEDIA_NOFS"; |
| 2767 | |
| 2768 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2769 | * Broadcast Action: External media is present and mounted at its mount point. |
suyi Yuan | be7af83 | 2013-01-04 21:21:59 +0800 | [diff] [blame] | 2770 | * 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] | 2771 | * The Intent contains an extra with name "read-only" and Boolean value to indicate if the |
| 2772 | * media was mounted read only. |
| 2773 | */ |
| 2774 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2775 | public static final String ACTION_MEDIA_MOUNTED = "android.intent.action.MEDIA_MOUNTED"; |
| 2776 | |
| 2777 | /** |
| 2778 | * 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] | 2779 | * 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] | 2780 | */ |
| 2781 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2782 | public static final String ACTION_MEDIA_SHARED = "android.intent.action.MEDIA_SHARED"; |
| 2783 | |
| 2784 | /** |
Mike Lockwood | bf2dd44 | 2010-03-03 06:16:52 -0500 | [diff] [blame] | 2785 | * Broadcast Action: External media is no longer being shared via USB mass storage. |
| 2786 | * The path to the mount point for the previously shared media is contained in the Intent.mData field. |
| 2787 | * |
| 2788 | * @hide |
| 2789 | */ |
| 2790 | public static final String ACTION_MEDIA_UNSHARED = "android.intent.action.MEDIA_UNSHARED"; |
| 2791 | |
| 2792 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2793 | * Broadcast Action: External media was removed from SD card slot, but mount point was not unmounted. |
| 2794 | * The path to the mount point for the removed media is contained in the Intent.mData field. |
| 2795 | */ |
| 2796 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2797 | public static final String ACTION_MEDIA_BAD_REMOVAL = "android.intent.action.MEDIA_BAD_REMOVAL"; |
| 2798 | |
| 2799 | /** |
| 2800 | * Broadcast Action: External media is present but cannot be mounted. |
suyi Yuan | be7af83 | 2013-01-04 21:21:59 +0800 | [diff] [blame] | 2801 | * 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] | 2802 | */ |
| 2803 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2804 | public static final String ACTION_MEDIA_UNMOUNTABLE = "android.intent.action.MEDIA_UNMOUNTABLE"; |
| 2805 | |
| 2806 | /** |
| 2807 | * Broadcast Action: User has expressed the desire to remove the external storage media. |
| 2808 | * Applications should close all files they have open within the mount point when they receive this intent. |
| 2809 | * The path to the mount point for the media to be ejected is contained in the Intent.mData field. |
| 2810 | */ |
| 2811 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2812 | public static final String ACTION_MEDIA_EJECT = "android.intent.action.MEDIA_EJECT"; |
| 2813 | |
| 2814 | /** |
| 2815 | * Broadcast Action: The media scanner has started scanning a directory. |
| 2816 | * The path to the directory being scanned is contained in the Intent.mData field. |
| 2817 | */ |
| 2818 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2819 | public static final String ACTION_MEDIA_SCANNER_STARTED = "android.intent.action.MEDIA_SCANNER_STARTED"; |
| 2820 | |
| 2821 | /** |
| 2822 | * Broadcast Action: The media scanner has finished scanning a directory. |
| 2823 | * The path to the scanned directory is contained in the Intent.mData field. |
| 2824 | */ |
| 2825 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2826 | public static final String ACTION_MEDIA_SCANNER_FINISHED = "android.intent.action.MEDIA_SCANNER_FINISHED"; |
| 2827 | |
| 2828 | /** |
| 2829 | * Broadcast Action: Request the media scanner to scan a file and add it to the media database. |
| 2830 | * The path to the file is contained in the Intent.mData field. |
| 2831 | */ |
| 2832 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2833 | public static final String ACTION_MEDIA_SCANNER_SCAN_FILE = "android.intent.action.MEDIA_SCANNER_SCAN_FILE"; |
| 2834 | |
| 2835 | /** |
| 2836 | * Broadcast Action: The "Media Button" was pressed. Includes a single |
| 2837 | * extra field, {@link #EXTRA_KEY_EVENT}, containing the key event that |
| 2838 | * caused the broadcast. |
| 2839 | */ |
| 2840 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2841 | public static final String ACTION_MEDIA_BUTTON = "android.intent.action.MEDIA_BUTTON"; |
| 2842 | |
| 2843 | /** |
| 2844 | * Broadcast Action: The "Camera Button" was pressed. Includes a single |
| 2845 | * extra field, {@link #EXTRA_KEY_EVENT}, containing the key event that |
| 2846 | * caused the broadcast. |
| 2847 | */ |
| 2848 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2849 | public static final String ACTION_CAMERA_BUTTON = "android.intent.action.CAMERA_BUTTON"; |
| 2850 | |
| 2851 | // *** NOTE: @todo(*) The following really should go into a more domain-specific |
| 2852 | // location; they are not general-purpose actions. |
| 2853 | |
| 2854 | /** |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 2855 | * Broadcast Action: A GTalk connection has been established. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2856 | */ |
| 2857 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2858 | public static final String ACTION_GTALK_SERVICE_CONNECTED = |
| 2859 | "android.intent.action.GTALK_CONNECTED"; |
| 2860 | |
| 2861 | /** |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 2862 | * Broadcast Action: A GTalk connection has been disconnected. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2863 | */ |
| 2864 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2865 | public static final String ACTION_GTALK_SERVICE_DISCONNECTED = |
| 2866 | "android.intent.action.GTALK_DISCONNECTED"; |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 2867 | |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 2868 | /** |
| 2869 | * Broadcast Action: An input method has been changed. |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 2870 | */ |
| 2871 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2872 | public static final String ACTION_INPUT_METHOD_CHANGED = |
| 2873 | "android.intent.action.INPUT_METHOD_CHANGED"; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2874 | |
| 2875 | /** |
| 2876 | * <p>Broadcast Action: The user has switched the phone into or out of Airplane Mode. One or |
| 2877 | * more radios have been turned off or on. The intent will have the following extra value:</p> |
| 2878 | * <ul> |
| 2879 | * <li><em>state</em> - A boolean value indicating whether Airplane Mode is on. If true, |
| 2880 | * then cell radio and possibly other radios such as bluetooth or WiFi may have also been |
| 2881 | * turned off</li> |
| 2882 | * </ul> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2883 | * |
Peng Xu | a35b553 | 2016-01-20 00:05:45 -0800 | [diff] [blame] | 2884 | * <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] | 2885 | */ |
| 2886 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2887 | public static final String ACTION_AIRPLANE_MODE_CHANGED = "android.intent.action.AIRPLANE_MODE"; |
| 2888 | |
| 2889 | /** |
| 2890 | * Broadcast Action: Some content providers have parts of their namespace |
| 2891 | * where they publish new events or items that the user may be especially |
| 2892 | * interested in. For these things, they may broadcast this action when the |
| 2893 | * set of interesting items change. |
| 2894 | * |
| 2895 | * For example, GmailProvider sends this notification when the set of unread |
| 2896 | * mail in the inbox changes. |
| 2897 | * |
| 2898 | * <p>The data of the intent identifies which part of which provider |
| 2899 | * changed. When queried through the content resolver, the data URI will |
| 2900 | * return the data set in question. |
| 2901 | * |
| 2902 | * <p>The intent will have the following extra values: |
| 2903 | * <ul> |
| 2904 | * <li><em>count</em> - The number of items in the data set. This is the |
| 2905 | * same as the number of items in the cursor returned by querying the |
| 2906 | * data URI. </li> |
| 2907 | * </ul> |
| 2908 | * |
| 2909 | * This intent will be sent at boot (if the count is non-zero) and when the |
| 2910 | * data set changes. It is possible for the data set to change without the |
| 2911 | * count changing (for example, if a new unread message arrives in the same |
| 2912 | * sync operation in which a message is archived). The phone should still |
| 2913 | * ring/vibrate/etc as normal in this case. |
| 2914 | */ |
| 2915 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2916 | public static final String ACTION_PROVIDER_CHANGED = |
| 2917 | "android.intent.action.PROVIDER_CHANGED"; |
| 2918 | |
| 2919 | /** |
| 2920 | * Broadcast Action: Wired Headset plugged in or unplugged. |
| 2921 | * |
Jean-Michel Trivi | c525843 | 2014-08-27 15:46:54 -0700 | [diff] [blame] | 2922 | * Same as {@link android.media.AudioManager#ACTION_HEADSET_PLUG}, to be consulted for value |
| 2923 | * and documentation. |
| 2924 | * <p>If the minimum SDK version of your application is |
Dianne Hackborn | 955d8d6 | 2014-10-07 20:17:19 -0700 | [diff] [blame] | 2925 | * {@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] | 2926 | * 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] | 2927 | */ |
| 2928 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
Jean-Michel Trivi | c525843 | 2014-08-27 15:46:54 -0700 | [diff] [blame] | 2929 | 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] | 2930 | |
| 2931 | /** |
Joe Onorato | 9cdffa1 | 2011-04-06 18:27:27 -0700 | [diff] [blame] | 2932 | * <p>Broadcast Action: The user has switched on advanced settings in the settings app:</p> |
| 2933 | * <ul> |
| 2934 | * <li><em>state</em> - A boolean value indicating whether the settings is on or off.</li> |
| 2935 | * </ul> |
| 2936 | * |
| 2937 | * <p class="note">This is a protected intent that can only be sent |
| 2938 | * by the system. |
| 2939 | * |
| 2940 | * @hide |
| 2941 | */ |
| 2942 | //@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2943 | public static final String ACTION_ADVANCED_SETTINGS_CHANGED |
| 2944 | = "android.intent.action.ADVANCED_SETTINGS"; |
| 2945 | |
| 2946 | /** |
Robin Lee | 66e5d96 | 2014-04-09 16:44:21 +0100 | [diff] [blame] | 2947 | * Broadcast Action: Sent after application restrictions are changed. |
| 2948 | * |
| 2949 | * <p class="note">This is a protected intent that can only be sent |
| 2950 | * by the system.</p> |
| 2951 | */ |
| 2952 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2953 | public static final String ACTION_APPLICATION_RESTRICTIONS_CHANGED = |
| 2954 | "android.intent.action.APPLICATION_RESTRICTIONS_CHANGED"; |
| 2955 | |
| 2956 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2957 | * Broadcast Action: An outgoing call is about to be placed. |
| 2958 | * |
Dirk Dougherty | 367ce90 | 2013-05-28 17:37:12 -0700 | [diff] [blame] | 2959 | * <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] | 2960 | * <ul> |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 2961 | * <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] | 2962 | * the phone number originally intended to be dialed.</li> |
| 2963 | * </ul> |
| 2964 | * <p>Once the broadcast is finished, the resultData is used as the actual |
| 2965 | * 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] | 2966 | * <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] | 2967 | * outgoing call in turn: for example, a parental control application |
| 2968 | * might verify that the user is authorized to place the call at that |
| 2969 | * time, then a number-rewriting application might add an area code if |
| 2970 | * one was not specified.</p> |
| 2971 | * <p>For consistency, any receiver whose purpose is to prohibit phone |
| 2972 | * calls should have a priority of 0, to ensure it will see the final |
| 2973 | * phone number to be dialed. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 2974 | * 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] | 2975 | * should have a positive priority. |
| 2976 | * Negative priorities are reserved for the system for this broadcast; |
| 2977 | * using them may cause problems.</p> |
Dirk Dougherty | 932fbcc | 2013-05-29 15:19:14 -0700 | [diff] [blame] | 2978 | * <p>Any BroadcastReceiver receiving this Intent <em>must not</em> |
| 2979 | * abort the broadcast.</p> |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2980 | * <p>Emergency calls cannot be intercepted using this mechanism, and |
| 2981 | * other calls cannot be modified to call emergency numbers using this |
| 2982 | * mechanism. |
Santos Cordon | ba70136 | 2013-05-17 14:48:54 -0700 | [diff] [blame] | 2983 | * <p>Some apps (such as VoIP apps) may want to redirect the outgoing |
| 2984 | * call to use their own service instead. Those apps should first prevent |
| 2985 | * the call from being placed by setting resultData to <code>null</code> |
| 2986 | * 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] | 2987 | * <p>You must hold the |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2988 | * {@link android.Manifest.permission#PROCESS_OUTGOING_CALLS} |
| 2989 | * permission to receive this Intent.</p> |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 2990 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 2991 | * <p class="note">This is a protected intent that can only be sent |
| 2992 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 2993 | */ |
| 2994 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 2995 | public static final String ACTION_NEW_OUTGOING_CALL = |
| 2996 | "android.intent.action.NEW_OUTGOING_CALL"; |
| 2997 | |
| 2998 | /** |
| 2999 | * Broadcast Action: Have the device reboot. This is only for use by |
| 3000 | * system code. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 3001 | * |
Dianne Hackborn | 854060af | 2009-07-09 18:14:31 -0700 | [diff] [blame] | 3002 | * <p class="note">This is a protected intent that can only be sent |
| 3003 | * by the system. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 3004 | */ |
| 3005 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3006 | public static final String ACTION_REBOOT = |
| 3007 | "android.intent.action.REBOOT"; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 3008 | |
Wei Huang | 97ecc9c | 2009-05-11 17:44:20 -0700 | [diff] [blame] | 3009 | /** |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 3010 | * Broadcast Action: A sticky broadcast for changes in the physical |
| 3011 | * docking state of the device. |
Tobias Haamel | 154f7a1 | 2010-02-17 11:56:39 -0800 | [diff] [blame] | 3012 | * |
| 3013 | * <p>The intent will have the following extra values: |
| 3014 | * <ul> |
| 3015 | * <li><em>{@link #EXTRA_DOCK_STATE}</em> - the current dock |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 3016 | * state, indicating which dock the device is physically in.</li> |
Tobias Haamel | 154f7a1 | 2010-02-17 11:56:39 -0800 | [diff] [blame] | 3017 | * </ul> |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 3018 | * <p>This is intended for monitoring the current physical dock state. |
| 3019 | * See {@link android.app.UiModeManager} for the normal API dealing with |
| 3020 | * dock mode changes. |
Dianne Hackborn | edd9316 | 2009-09-19 14:03:05 -0700 | [diff] [blame] | 3021 | */ |
| 3022 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3023 | public static final String ACTION_DOCK_EVENT = |
| 3024 | "android.intent.action.DOCK_EVENT"; |
| 3025 | |
| 3026 | /** |
Svetoslav | b3038ec | 2013-02-13 14:39:30 -0800 | [diff] [blame] | 3027 | * Broadcast Action: A broadcast when idle maintenance can be started. |
| 3028 | * This means that the user is not interacting with the device and is |
| 3029 | * not expected to do so soon. Typical use of the idle maintenance is |
| 3030 | * to perform somehow expensive tasks that can be postponed at a moment |
| 3031 | * when they will not degrade user experience. |
| 3032 | * <p> |
| 3033 | * <p class="note">In order to keep the device responsive in case of an |
| 3034 | * unexpected user interaction, implementations of a maintenance task |
| 3035 | * should be interruptible. In such a scenario a broadcast with action |
| 3036 | * {@link #ACTION_IDLE_MAINTENANCE_END} will be sent. In other words, you |
| 3037 | * should not do the maintenance work in |
| 3038 | * {@link BroadcastReceiver#onReceive(Context, Intent)}, rather start a |
| 3039 | * maintenance service by {@link Context#startService(Intent)}. Also |
| 3040 | * you should hold a wake lock while your maintenance service is running |
| 3041 | * to prevent the device going to sleep. |
| 3042 | * </p> |
| 3043 | * <p> |
| 3044 | * <p class="note">This is a protected intent that can only be sent by |
| 3045 | * the system. |
| 3046 | * </p> |
| 3047 | * |
| 3048 | * @see #ACTION_IDLE_MAINTENANCE_END |
Svetoslav | 6a08a12 | 2013-05-03 11:24:26 -0700 | [diff] [blame] | 3049 | * |
| 3050 | * @hide |
Svetoslav | b3038ec | 2013-02-13 14:39:30 -0800 | [diff] [blame] | 3051 | */ |
| 3052 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3053 | public static final String ACTION_IDLE_MAINTENANCE_START = |
| 3054 | "android.intent.action.ACTION_IDLE_MAINTENANCE_START"; |
| 3055 | |
| 3056 | /** |
| 3057 | * Broadcast Action: A broadcast when idle maintenance should be stopped. |
| 3058 | * This means that the user was not interacting with the device as a result |
| 3059 | * of which a broadcast with action {@link #ACTION_IDLE_MAINTENANCE_START} |
| 3060 | * was sent and now the user started interacting with the device. Typical |
| 3061 | * use of the idle maintenance is to perform somehow expensive tasks that |
| 3062 | * can be postponed at a moment when they will not degrade user experience. |
| 3063 | * <p> |
| 3064 | * <p class="note">In order to keep the device responsive in case of an |
| 3065 | * unexpected user interaction, implementations of a maintenance task |
| 3066 | * should be interruptible. Hence, on receiving a broadcast with this |
| 3067 | * action, the maintenance task should be interrupted as soon as possible. |
| 3068 | * In other words, you should not do the maintenance work in |
| 3069 | * {@link BroadcastReceiver#onReceive(Context, Intent)}, rather stop the |
| 3070 | * maintenance service that was started on receiving of |
| 3071 | * {@link #ACTION_IDLE_MAINTENANCE_START}.Also you should release the wake |
| 3072 | * lock you acquired when your maintenance service started. |
| 3073 | * </p> |
| 3074 | * <p class="note">This is a protected intent that can only be sent |
| 3075 | * by the system. |
| 3076 | * |
| 3077 | * @see #ACTION_IDLE_MAINTENANCE_START |
Svetoslav | 6a08a12 | 2013-05-03 11:24:26 -0700 | [diff] [blame] | 3078 | * |
| 3079 | * @hide |
Svetoslav | b3038ec | 2013-02-13 14:39:30 -0800 | [diff] [blame] | 3080 | */ |
| 3081 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3082 | public static final String ACTION_IDLE_MAINTENANCE_END = |
| 3083 | "android.intent.action.ACTION_IDLE_MAINTENANCE_END"; |
| 3084 | |
| 3085 | /** |
Wei Huang | 97ecc9c | 2009-05-11 17:44:20 -0700 | [diff] [blame] | 3086 | * Broadcast Action: a remote intent is to be broadcasted. |
| 3087 | * |
| 3088 | * A remote intent is used for remote RPC between devices. The remote intent |
| 3089 | * is serialized and sent from one device to another device. The receiving |
| 3090 | * device parses the remote intent and broadcasts it. Note that anyone can |
| 3091 | * broadcast a remote intent. However, if the intent receiver of the remote intent |
| 3092 | * does not trust intent broadcasts from arbitrary intent senders, it should require |
| 3093 | * the sender to hold certain permissions so only trusted sender's broadcast will be |
| 3094 | * let through. |
Dianne Hackborn | edd9316 | 2009-09-19 14:03:05 -0700 | [diff] [blame] | 3095 | * @hide |
Wei Huang | 97ecc9c | 2009-05-11 17:44:20 -0700 | [diff] [blame] | 3096 | */ |
| 3097 | public static final String ACTION_REMOTE_INTENT = |
Costin Manolache | 8d83f9e | 2010-05-12 16:04:10 -0700 | [diff] [blame] | 3098 | "com.google.android.c2dm.intent.RECEIVE"; |
Wei Huang | 97ecc9c | 2009-05-11 17:44:20 -0700 | [diff] [blame] | 3099 | |
Dianne Hackborn | 9acc030 | 2009-08-25 00:27:12 -0700 | [diff] [blame] | 3100 | /** |
Jeff Sharkey | bd91e2f | 2016-03-22 15:32:31 -0600 | [diff] [blame] | 3101 | * Broadcast Action: This is broadcast once when the user is booting after a |
| 3102 | * system update. It can be used to perform cleanup or upgrades after a |
| 3103 | * system update. |
| 3104 | * <p> |
| 3105 | * This broadcast is sent after the {@link #ACTION_LOCKED_BOOT_COMPLETED} |
| 3106 | * broadcast but before the {@link #ACTION_BOOT_COMPLETED} broadcast. It's |
| 3107 | * only sent when the {@link Build#FINGERPRINT} has changed, and it's only |
| 3108 | * sent to receivers in the system image. |
Dianne Hackborn | 9acc030 | 2009-08-25 00:27:12 -0700 | [diff] [blame] | 3109 | * |
Dianne Hackborn | 9acc030 | 2009-08-25 00:27:12 -0700 | [diff] [blame] | 3110 | * @hide |
| 3111 | */ |
Amith Yamasani | cbabb8d | 2017-02-17 16:50:05 -0800 | [diff] [blame] | 3112 | @SystemApi |
Dianne Hackborn | 9acc030 | 2009-08-25 00:27:12 -0700 | [diff] [blame] | 3113 | public static final String ACTION_PRE_BOOT_COMPLETED = |
| 3114 | "android.intent.action.PRE_BOOT_COMPLETED"; |
| 3115 | |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 3116 | /** |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 3117 | * Broadcast to a specific application to query any supported restrictions to impose |
Amith Yamasani | 7e99bc0 | 2013-04-16 18:24:51 -0700 | [diff] [blame] | 3118 | * on restricted users. The broadcast intent contains an extra |
| 3119 | * {@link #EXTRA_RESTRICTIONS_BUNDLE} with the currently persisted |
| 3120 | * restrictions as a Bundle of key/value pairs. The value types can be Boolean, String or |
| 3121 | * String[] depending on the restriction type.<p/> |
| 3122 | * The response should contain an extra {@link #EXTRA_RESTRICTIONS_LIST}, |
Amith Yamasani | 86118ba | 2013-03-28 14:33:16 -0700 | [diff] [blame] | 3123 | * which is of type <code>ArrayList<RestrictionEntry></code>. It can also |
| 3124 | * contain an extra {@link #EXTRA_RESTRICTIONS_INTENT}, which is of type <code>Intent</code>. |
| 3125 | * 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] | 3126 | * one of the extras {@link #EXTRA_RESTRICTIONS_LIST} or {@link #EXTRA_RESTRICTIONS_BUNDLE}. |
| 3127 | * The keys and values of the returned restrictions will be persisted. |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 3128 | * @see RestrictionEntry |
| 3129 | */ |
| 3130 | public static final String ACTION_GET_RESTRICTION_ENTRIES = |
| 3131 | "android.intent.action.GET_RESTRICTION_ENTRIES"; |
| 3132 | |
| 3133 | /** |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3134 | * Sent the first time a user is starting, to allow system apps to |
| 3135 | * perform one time initialization. (This will not be seen by third |
| 3136 | * party applications because a newly initialized user does not have any |
| 3137 | * third party applications installed for it.) This is sent early in |
| 3138 | * starting the user, around the time the home app is started, before |
Dianne Hackborn | 36d337a | 2012-10-08 14:33:47 -0700 | [diff] [blame] | 3139 | * {@link #ACTION_BOOT_COMPLETED} is sent. This is sent as a foreground |
| 3140 | * broadcast, since it is part of a visible user interaction; be as quick |
| 3141 | * as possible when handling it. |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3142 | */ |
| 3143 | public static final String ACTION_USER_INITIALIZE = |
| 3144 | "android.intent.action.USER_INITIALIZE"; |
| 3145 | |
| 3146 | /** |
| 3147 | * Sent when a user switch is happening, causing the process's user to be |
| 3148 | * brought to the foreground. This is only sent to receivers registered |
| 3149 | * through {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
| 3150 | * 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] | 3151 | * foreground. This is sent as a foreground |
| 3152 | * broadcast, since it is part of a visible user interaction; be as quick |
| 3153 | * as possible when handling it. |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3154 | */ |
| 3155 | public static final String ACTION_USER_FOREGROUND = |
| 3156 | "android.intent.action.USER_FOREGROUND"; |
| 3157 | |
| 3158 | /** |
| 3159 | * Sent when a user switch is happening, causing the process's user to be |
| 3160 | * sent to the background. This is only sent to receivers registered |
| 3161 | * through {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) |
| 3162 | * 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] | 3163 | * background. This is sent as a foreground |
| 3164 | * broadcast, since it is part of a visible user interaction; be as quick |
| 3165 | * as possible when handling it. |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3166 | */ |
| 3167 | public static final String ACTION_USER_BACKGROUND = |
| 3168 | "android.intent.action.USER_BACKGROUND"; |
| 3169 | |
| 3170 | /** |
Dianne Hackborn | 36d337a | 2012-10-08 14:33:47 -0700 | [diff] [blame] | 3171 | * Broadcast sent to the system when a user is added. Carries an extra |
| 3172 | * EXTRA_USER_HANDLE that has the userHandle of the new user. It is sent to |
| 3173 | * all running users. You must hold |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3174 | * {@link android.Manifest.permission#MANAGE_USERS} to receive this broadcast. |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 3175 | * @hide |
| 3176 | */ |
| 3177 | public static final String ACTION_USER_ADDED = |
| 3178 | "android.intent.action.USER_ADDED"; |
| 3179 | |
| 3180 | /** |
Dianne Hackborn | 36d337a | 2012-10-08 14:33:47 -0700 | [diff] [blame] | 3181 | * Broadcast sent by the system when a user is started. Carries an extra |
| 3182 | * 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] | 3183 | * registered receivers, not manifest receivers. It is sent to the user |
Dianne Hackborn | 36d337a | 2012-10-08 14:33:47 -0700 | [diff] [blame] | 3184 | * that has been started. This is sent as a foreground |
| 3185 | * broadcast, since it is part of a visible user interaction; be as quick |
| 3186 | * as possible when handling it. |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3187 | * @hide |
| 3188 | */ |
| 3189 | public static final String ACTION_USER_STARTED = |
| 3190 | "android.intent.action.USER_STARTED"; |
| 3191 | |
| 3192 | /** |
Dianne Hackborn | 36d337a | 2012-10-08 14:33:47 -0700 | [diff] [blame] | 3193 | * Broadcast sent when a user is in the process of starting. Carries an extra |
| 3194 | * EXTRA_USER_HANDLE that has the userHandle of the user. This is only |
| 3195 | * sent to registered receivers, not manifest receivers. It is sent to all |
| 3196 | * users (including the one that is being started). You must hold |
| 3197 | * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} to receive |
| 3198 | * this broadcast. This is sent as a background broadcast, since |
| 3199 | * its result is not part of the primary UX flow; to safely keep track of |
| 3200 | * started/stopped state of a user you can use this in conjunction with |
| 3201 | * {@link #ACTION_USER_STOPPING}. It is <b>not</b> generally safe to use with |
| 3202 | * other user state broadcasts since those are foreground broadcasts so can |
| 3203 | * execute in a different order. |
| 3204 | * @hide |
| 3205 | */ |
| 3206 | public static final String ACTION_USER_STARTING = |
| 3207 | "android.intent.action.USER_STARTING"; |
| 3208 | |
| 3209 | /** |
| 3210 | * Broadcast sent when a user is going to be stopped. Carries an extra |
| 3211 | * EXTRA_USER_HANDLE that has the userHandle of the user. This is only |
| 3212 | * sent to registered receivers, not manifest receivers. It is sent to all |
| 3213 | * users (including the one that is being stopped). You must hold |
| 3214 | * {@link android.Manifest.permission#INTERACT_ACROSS_USERS} to receive |
| 3215 | * this broadcast. The user will not stop until all receivers have |
| 3216 | * handled the broadcast. This is sent as a background broadcast, since |
| 3217 | * its result is not part of the primary UX flow; to safely keep track of |
| 3218 | * started/stopped state of a user you can use this in conjunction with |
| 3219 | * {@link #ACTION_USER_STARTING}. It is <b>not</b> generally safe to use with |
| 3220 | * other user state broadcasts since those are foreground broadcasts so can |
| 3221 | * execute in a different order. |
| 3222 | * @hide |
| 3223 | */ |
| 3224 | public static final String ACTION_USER_STOPPING = |
| 3225 | "android.intent.action.USER_STOPPING"; |
| 3226 | |
| 3227 | /** |
| 3228 | * Broadcast sent to the system when a user is stopped. Carries an extra |
| 3229 | * EXTRA_USER_HANDLE that has the userHandle of the user. This is similar to |
| 3230 | * {@link #ACTION_PACKAGE_RESTARTED}, but for an entire user instead of a |
| 3231 | * specific package. This is only sent to registered receivers, not manifest |
| 3232 | * receivers. It is sent to all running users <em>except</em> the one that |
| 3233 | * has just been stopped (which is no longer running). |
Dianne Hackborn | 80a4af2 | 2012-08-27 19:18:31 -0700 | [diff] [blame] | 3234 | * @hide |
| 3235 | */ |
| 3236 | public static final String ACTION_USER_STOPPED = |
| 3237 | "android.intent.action.USER_STOPPED"; |
| 3238 | |
| 3239 | /** |
Amith Yamasani | 2a00329 | 2012-08-14 18:25:45 -0700 | [diff] [blame] | 3240 | * 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] | 3241 | * 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] | 3242 | * one that has been removed. The user will not be completely removed until all receivers have |
| 3243 | * handled the broadcast. You must hold |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 3244 | * {@link android.Manifest.permission#MANAGE_USERS} to receive this broadcast. |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 3245 | * @hide |
| 3246 | */ |
Sudheer Shanka | 166a81b | 2017-03-30 15:42:51 -0700 | [diff] [blame] | 3247 | @SystemApi |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 3248 | public static final String ACTION_USER_REMOVED = |
| 3249 | "android.intent.action.USER_REMOVED"; |
| 3250 | |
| 3251 | /** |
Amith Yamasani | 2a00329 | 2012-08-14 18:25:45 -0700 | [diff] [blame] | 3252 | * 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] | 3253 | * the userHandle of the user to become the current one. This is only sent to |
| 3254 | * registered receivers, not manifest receivers. It is sent to all running users. |
| 3255 | * You must hold |
| 3256 | * {@link android.Manifest.permission#MANAGE_USERS} to receive this broadcast. |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 3257 | * @hide |
| 3258 | */ |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 3259 | @UnsupportedAppUsage |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 3260 | public static final String ACTION_USER_SWITCHED = |
| 3261 | "android.intent.action.USER_SWITCHED"; |
| 3262 | |
Amith Yamasani | e928d7d | 2012-09-17 21:46:51 -0700 | [diff] [blame] | 3263 | /** |
Jeff Sharkey | 8924e87 | 2015-11-30 12:52:10 -0700 | [diff] [blame] | 3264 | * Broadcast Action: Sent when the credential-encrypted private storage has |
| 3265 | * become unlocked for the target user. This is only sent to registered |
| 3266 | * receivers, not manifest receivers. |
| 3267 | */ |
| 3268 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3269 | public static final String ACTION_USER_UNLOCKED = "android.intent.action.USER_UNLOCKED"; |
| 3270 | |
| 3271 | /** |
Amith Yamasani | e928d7d | 2012-09-17 21:46:51 -0700 | [diff] [blame] | 3272 | * Broadcast sent to the system when a user's information changes. Carries an extra |
| 3273 | * {@link #EXTRA_USER_HANDLE} to indicate which user's information changed. |
Amith Yamasani | 6fc1d4e | 2013-05-08 16:43:58 -0700 | [diff] [blame] | 3274 | * 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] | 3275 | * @hide |
| 3276 | */ |
| 3277 | public static final String ACTION_USER_INFO_CHANGED = |
| 3278 | "android.intent.action.USER_INFO_CHANGED"; |
| 3279 | |
Daniel Sandler | 2e7d25b | 2012-10-01 16:43:26 -0400 | [diff] [blame] | 3280 | /** |
Alexandra Gherghina | c17d7e0 | 2014-04-04 16:27:28 +0100 | [diff] [blame] | 3281 | * Broadcast sent to the primary user when an associated managed profile is added (the profile |
| 3282 | * 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] | 3283 | * the UserHandle of the profile that was added. Only applications (for example Launchers) |
| 3284 | * that need to display merged content across both primary and managed profiles need to |
| 3285 | * worry about this broadcast. This is only sent to registered receivers, |
Alexandra Gherghina | c17d7e0 | 2014-04-04 16:27:28 +0100 | [diff] [blame] | 3286 | * not manifest receivers. |
| 3287 | */ |
| 3288 | public static final String ACTION_MANAGED_PROFILE_ADDED = |
| 3289 | "android.intent.action.MANAGED_PROFILE_ADDED"; |
| 3290 | |
| 3291 | /** |
| 3292 | * 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] | 3293 | * extra {@link #EXTRA_USER} that specifies the UserHandle of the profile that was removed. |
| 3294 | * Only applications (for example Launchers) that need to display merged content across both |
| 3295 | * primary and managed profiles need to worry about this broadcast. This is only sent to |
| 3296 | * registered receivers, not manifest receivers. |
Alexandra Gherghina | c17d7e0 | 2014-04-04 16:27:28 +0100 | [diff] [blame] | 3297 | */ |
| 3298 | public static final String ACTION_MANAGED_PROFILE_REMOVED = |
| 3299 | "android.intent.action.MANAGED_PROFILE_REMOVED"; |
| 3300 | |
| 3301 | /** |
Kenny Guy | b1b3026 | 2016-02-09 16:02:35 +0000 | [diff] [blame] | 3302 | * Broadcast sent to the primary user when the credential-encrypted private storage for |
| 3303 | * an associated managed profile is unlocked. Carries an extra {@link #EXTRA_USER} that |
| 3304 | * specifies the UserHandle of the profile that was unlocked. Only applications (for example |
| 3305 | * Launchers) that need to display merged content across both primary and managed profiles |
| 3306 | * need to worry about this broadcast. This is only sent to registered receivers, |
| 3307 | * not manifest receivers. |
| 3308 | */ |
| 3309 | public static final String ACTION_MANAGED_PROFILE_UNLOCKED = |
| 3310 | "android.intent.action.MANAGED_PROFILE_UNLOCKED"; |
| 3311 | |
| 3312 | /** |
Rubin Xu | e95057a | 2016-04-01 16:49:25 +0100 | [diff] [blame] | 3313 | * Broadcast sent to the primary user when an associated managed profile has become available. |
| 3314 | * 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] | 3315 | * {@link #EXTRA_USER} that specifies the UserHandle of the profile. When quiet mode is changed, |
| 3316 | * this broadcast will carry a boolean extra {@link #EXTRA_QUIET_MODE} indicating the new state |
| 3317 | * 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] | 3318 | */ |
Rubin Xu | e95057a | 2016-04-01 16:49:25 +0100 | [diff] [blame] | 3319 | public static final String ACTION_MANAGED_PROFILE_AVAILABLE = |
| 3320 | "android.intent.action.MANAGED_PROFILE_AVAILABLE"; |
| 3321 | |
| 3322 | /** |
| 3323 | * Broadcast sent to the primary user when an associated managed profile has become unavailable. |
| 3324 | * Currently this includes when the user enables quiet mode for the profile. Carries an extra |
| 3325 | * {@link #EXTRA_USER} that specifies the UserHandle of the profile. When quiet mode is changed, |
| 3326 | * this broadcast will carry a boolean extra {@link #EXTRA_QUIET_MODE} indicating the new state |
| 3327 | * of quiet mode. This is only sent to registered receivers, not manifest receivers. |
| 3328 | */ |
| 3329 | public static final String ACTION_MANAGED_PROFILE_UNAVAILABLE = |
| 3330 | "android.intent.action.MANAGED_PROFILE_UNAVAILABLE"; |
Rubin Xu | 0a29ecd | 2015-11-04 15:11:48 +0000 | [diff] [blame] | 3331 | |
| 3332 | /** |
Robin Lee | 92b83c6 | 2016-08-31 13:27:51 +0100 | [diff] [blame] | 3333 | * Broadcast sent to the system user when the 'device locked' state changes for any user. |
| 3334 | * Carries an extra {@link #EXTRA_USER_HANDLE} that specifies the ID of the user for which |
| 3335 | * the device was locked or unlocked. |
| 3336 | * |
| 3337 | * This is only sent to registered receivers. |
| 3338 | * |
| 3339 | * @hide |
| 3340 | */ |
| 3341 | public static final String ACTION_DEVICE_LOCKED_CHANGED = |
| 3342 | "android.intent.action.DEVICE_LOCKED_CHANGED"; |
| 3343 | |
| 3344 | /** |
Daniel Sandler | 2e7d25b | 2012-10-01 16:43:26 -0400 | [diff] [blame] | 3345 | * Sent when the user taps on the clock widget in the system's "quick settings" area. |
| 3346 | */ |
| 3347 | public static final String ACTION_QUICK_CLOCK = |
| 3348 | "android.intent.action.QUICK_CLOCK"; |
| 3349 | |
Michael Wright | 0087a14 | 2013-02-05 16:29:39 -0800 | [diff] [blame] | 3350 | /** |
Alan Viverette | 5a39949 | 2014-07-14 16:19:38 -0700 | [diff] [blame] | 3351 | * Activity Action: Shows the brightness setting dialog. |
Michael Wright | 0087a14 | 2013-02-05 16:29:39 -0800 | [diff] [blame] | 3352 | * @hide |
| 3353 | */ |
| 3354 | public static final String ACTION_SHOW_BRIGHTNESS_DIALOG = |
Clara Bayarri | 847d868 | 2017-03-06 16:48:44 +0000 | [diff] [blame] | 3355 | "com.android.intent.action.SHOW_BRIGHTNESS_DIALOG"; |
Michael Wright | 0087a14 | 2013-02-05 16:29:39 -0800 | [diff] [blame] | 3356 | |
Justin Koh | d378ad7 | 2013-04-01 12:18:26 -0700 | [diff] [blame] | 3357 | /** |
| 3358 | * Broadcast Action: A global button was pressed. Includes a single |
| 3359 | * extra field, {@link #EXTRA_KEY_EVENT}, containing the key event that |
| 3360 | * caused the broadcast. |
| 3361 | * @hide |
| 3362 | */ |
Sujith Ramakrishnan | 48e19c8 | 2017-04-24 15:57:58 -0700 | [diff] [blame] | 3363 | @SystemApi |
Justin Koh | d378ad7 | 2013-04-01 12:18:26 -0700 | [diff] [blame] | 3364 | public static final String ACTION_GLOBAL_BUTTON = "android.intent.action.GLOBAL_BUTTON"; |
| 3365 | |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3366 | /** |
Dongwon Kang | 2034a4c | 2015-12-14 21:57:34 +0900 | [diff] [blame] | 3367 | * Broadcast Action: Sent when media resource is granted. |
| 3368 | * <p> |
| 3369 | * {@link #EXTRA_PACKAGES} specifies the packages on the process holding the media resource |
| 3370 | * granted. |
| 3371 | * </p> |
| 3372 | * <p class="note"> |
| 3373 | * This is a protected intent that can only be sent by the system. |
| 3374 | * </p> |
| 3375 | * <p class="note"> |
Dongwon Kang | 32cb9ab | 2016-01-13 18:11:10 -0800 | [diff] [blame] | 3376 | * This requires {@link android.Manifest.permission#RECEIVE_MEDIA_RESOURCE_USAGE} permission. |
Dongwon Kang | 2034a4c | 2015-12-14 21:57:34 +0900 | [diff] [blame] | 3377 | * </p> |
| 3378 | * |
| 3379 | * @hide |
| 3380 | */ |
| 3381 | public static final String ACTION_MEDIA_RESOURCE_GRANTED = |
| 3382 | "android.intent.action.MEDIA_RESOURCE_GRANTED"; |
| 3383 | |
| 3384 | /** |
MÃ¥rten Kongstad | eabc9e9 | 2015-12-15 16:40:23 +0100 | [diff] [blame] | 3385 | * Broadcast Action: An overlay package has changed. The data contains the |
| 3386 | * name of the overlay package which has changed. This is broadcast on all |
| 3387 | * changes to the OverlayInfo returned by {@link |
| 3388 | * android.content.om.IOverlayManager#getOverlayInfo(String, int)}. The |
| 3389 | * most common change is a state change that will change whether the |
| 3390 | * overlay is enabled or not. |
| 3391 | * @hide |
| 3392 | */ |
| 3393 | public static final String ACTION_OVERLAY_CHANGED = "android.intent.action.OVERLAY_CHANGED"; |
| 3394 | |
| 3395 | /** |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3396 | * Activity Action: Allow the user to select and return one or more existing |
| 3397 | * documents. When invoked, the system will display the various |
| 3398 | * {@link DocumentsProvider} instances installed on the device, letting the |
| 3399 | * user interactively navigate through them. These documents include local |
| 3400 | * media, such as photos and video, and documents provided by installed |
| 3401 | * cloud storage providers. |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3402 | * <p> |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3403 | * Each document is represented as a {@code content://} URI backed by a |
| 3404 | * {@link DocumentsProvider}, which can be opened as a stream with |
| 3405 | * {@link ContentResolver#openFileDescriptor(Uri, String)}, or queried for |
| 3406 | * {@link android.provider.DocumentsContract.Document} metadata. |
| 3407 | * <p> |
| 3408 | * All selected documents are returned to the calling application with |
| 3409 | * persistable read and write permission grants. If you want to maintain |
| 3410 | * access to the documents across device reboots, you need to explicitly |
| 3411 | * take the persistable permissions using |
| 3412 | * {@link ContentResolver#takePersistableUriPermission(Uri, int)}. |
| 3413 | * <p> |
Jeff Sharkey | 21de56a | 2014-04-05 19:05:24 -0700 | [diff] [blame] | 3414 | * Callers must indicate the acceptable document MIME types through |
| 3415 | * {@link #setType(String)}. For example, to select photos, use |
| 3416 | * {@code image/*}. If multiple disjoint MIME types are acceptable, define |
| 3417 | * them in {@link #EXTRA_MIME_TYPES} and {@link #setType(String)} to |
| 3418 | * {@literal *}/*. |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3419 | * <p> |
| 3420 | * If the caller can handle multiple returned items (the user performing |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3421 | * multiple selection), then you can specify {@link #EXTRA_ALLOW_MULTIPLE} |
| 3422 | * to indicate this. |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3423 | * <p> |
Tomasz Mikolajewski | a8057a9 | 2015-11-16 11:41:28 +0900 | [diff] [blame] | 3424 | * Callers must include {@link #CATEGORY_OPENABLE} in the Intent to obtain |
| 3425 | * URIs that can be opened with |
Jeff Sharkey | bd3b902 | 2013-08-20 15:20:04 -0700 | [diff] [blame] | 3426 | * {@link ContentResolver#openFileDescriptor(Uri, String)}. |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3427 | * <p> |
Garfield Tan | b44ae61 | 2016-11-07 16:46:37 -0800 | [diff] [blame] | 3428 | * Callers can set a document URI through |
| 3429 | * {@link DocumentsContract#EXTRA_INITIAL_URI} to indicate the initial |
| 3430 | * location of documents navigator. System will do its best to launch the |
| 3431 | * navigator in the specified document if it's a folder, or the folder that |
| 3432 | * contains the specified document if not. |
Garfield Tan | 0b3cf66 | 2016-10-31 12:59:45 -0700 | [diff] [blame] | 3433 | * <p> |
Jeff Sharkey | 21de56a | 2014-04-05 19:05:24 -0700 | [diff] [blame] | 3434 | * Output: The URI of the item that was picked, returned in |
| 3435 | * {@link #getData()}. This must be a {@code content://} URI so that any |
| 3436 | * receiver can access it. If multiple documents were selected, they are |
| 3437 | * returned in {@link #getClipData()}. |
Jeff Sharkey | bd3b902 | 2013-08-20 15:20:04 -0700 | [diff] [blame] | 3438 | * |
| 3439 | * @see DocumentsContract |
Jeff Sharkey | b9fbb72 | 2014-06-04 16:42:47 -0700 | [diff] [blame] | 3440 | * @see #ACTION_OPEN_DOCUMENT_TREE |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3441 | * @see #ACTION_CREATE_DOCUMENT |
| 3442 | * @see #FLAG_GRANT_PERSISTABLE_URI_PERMISSION |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3443 | */ |
| 3444 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 3445 | public static final String ACTION_OPEN_DOCUMENT = "android.intent.action.OPEN_DOCUMENT"; |
| 3446 | |
| 3447 | /** |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3448 | * Activity Action: Allow the user to create a new document. When invoked, |
| 3449 | * the system will display the various {@link DocumentsProvider} instances |
| 3450 | * installed on the device, letting the user navigate through them. The |
| 3451 | * returned document may be a newly created document with no content, or it |
| 3452 | * may be an existing document with the requested MIME type. |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3453 | * <p> |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3454 | * Each document is represented as a {@code content://} URI backed by a |
| 3455 | * {@link DocumentsProvider}, which can be opened as a stream with |
| 3456 | * {@link ContentResolver#openFileDescriptor(Uri, String)}, or queried for |
| 3457 | * {@link android.provider.DocumentsContract.Document} metadata. |
| 3458 | * <p> |
| 3459 | * Callers must indicate the concrete MIME type of the document being |
| 3460 | * created by setting {@link #setType(String)}. This MIME type cannot be |
| 3461 | * changed after the document is created. |
| 3462 | * <p> |
| 3463 | * Callers can provide an initial display name through {@link #EXTRA_TITLE}, |
| 3464 | * but the user may change this value before creating the file. |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3465 | * <p> |
Tomasz Mikolajewski | a8057a9 | 2015-11-16 11:41:28 +0900 | [diff] [blame] | 3466 | * Callers must include {@link #CATEGORY_OPENABLE} in the Intent to obtain |
| 3467 | * URIs that can be opened with |
Jeff Sharkey | bd3b902 | 2013-08-20 15:20:04 -0700 | [diff] [blame] | 3468 | * {@link ContentResolver#openFileDescriptor(Uri, String)}. |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3469 | * <p> |
Garfield Tan | b44ae61 | 2016-11-07 16:46:37 -0800 | [diff] [blame] | 3470 | * Callers can set a document URI through |
| 3471 | * {@link DocumentsContract#EXTRA_INITIAL_URI} to indicate the initial |
| 3472 | * location of documents navigator. System will do its best to launch the |
| 3473 | * navigator in the specified document if it's a folder, or the folder that |
| 3474 | * contains the specified document if not. |
Garfield Tan | 0b3cf66 | 2016-10-31 12:59:45 -0700 | [diff] [blame] | 3475 | * <p> |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3476 | * Output: The URI of the item that was created. This must be a |
| 3477 | * {@code content://} URI so that any receiver can access it. |
Jeff Sharkey | bd3b902 | 2013-08-20 15:20:04 -0700 | [diff] [blame] | 3478 | * |
| 3479 | * @see DocumentsContract |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3480 | * @see #ACTION_OPEN_DOCUMENT |
Jeff Sharkey | b9fbb72 | 2014-06-04 16:42:47 -0700 | [diff] [blame] | 3481 | * @see #ACTION_OPEN_DOCUMENT_TREE |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 3482 | * @see #FLAG_GRANT_PERSISTABLE_URI_PERMISSION |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 3483 | */ |
| 3484 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 3485 | public static final String ACTION_CREATE_DOCUMENT = "android.intent.action.CREATE_DOCUMENT"; |
| 3486 | |
Jeff Sharkey | 21de56a | 2014-04-05 19:05:24 -0700 | [diff] [blame] | 3487 | /** |
Jeff Sharkey | b9fbb72 | 2014-06-04 16:42:47 -0700 | [diff] [blame] | 3488 | * Activity Action: Allow the user to pick a directory subtree. When |
| 3489 | * invoked, the system will display the various {@link DocumentsProvider} |
| 3490 | * instances installed on the device, letting the user navigate through |
| 3491 | * them. Apps can fully manage documents within the returned directory. |
Jeff Sharkey | 21de56a | 2014-04-05 19:05:24 -0700 | [diff] [blame] | 3492 | * <p> |
| 3493 | * To gain access to descendant (child, grandchild, etc) documents, use |
Jeff Sharkey | b9fbb72 | 2014-06-04 16:42:47 -0700 | [diff] [blame] | 3494 | * {@link DocumentsContract#buildDocumentUriUsingTree(Uri, String)} and |
| 3495 | * {@link DocumentsContract#buildChildDocumentsUriUsingTree(Uri, String)} |
| 3496 | * with the returned URI. |
Jeff Sharkey | 21de56a | 2014-04-05 19:05:24 -0700 | [diff] [blame] | 3497 | * <p> |
Garfield Tan | b44ae61 | 2016-11-07 16:46:37 -0800 | [diff] [blame] | 3498 | * Callers can set a document URI through |
| 3499 | * {@link DocumentsContract#EXTRA_INITIAL_URI} to indicate the initial |
| 3500 | * location of documents navigator. System will do its best to launch the |
| 3501 | * navigator in the specified document if it's a folder, or the folder that |
| 3502 | * contains the specified document if not. |
Garfield Tan | 0b3cf66 | 2016-10-31 12:59:45 -0700 | [diff] [blame] | 3503 | * <p> |
Jeff Sharkey | b9fbb72 | 2014-06-04 16:42:47 -0700 | [diff] [blame] | 3504 | * Output: The URI representing the selected directory tree. |
Jeff Sharkey | 21de56a | 2014-04-05 19:05:24 -0700 | [diff] [blame] | 3505 | * |
| 3506 | * @see DocumentsContract |
| 3507 | */ |
| 3508 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
Jeff Sharkey | b9fbb72 | 2014-06-04 16:42:47 -0700 | [diff] [blame] | 3509 | public static final String |
| 3510 | ACTION_OPEN_DOCUMENT_TREE = "android.intent.action.OPEN_DOCUMENT_TREE"; |
Jeff Sharkey | 21de56a | 2014-04-05 19:05:24 -0700 | [diff] [blame] | 3511 | |
Felipe Leme | c7b1f89 | 2016-01-15 15:02:31 -0800 | [diff] [blame] | 3512 | /** |
Peng Xu | a35b553 | 2016-01-20 00:05:45 -0800 | [diff] [blame] | 3513 | * Broadcast Action: List of dynamic sensor is changed due to new sensor being connected or |
| 3514 | * exisiting sensor being disconnected. |
| 3515 | * |
| 3516 | * <p class="note">This is a protected intent that can only be sent by the system.</p> |
| 3517 | * |
| 3518 | * {@hide} |
| 3519 | */ |
| 3520 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3521 | public static final String |
| 3522 | ACTION_DYNAMIC_SENSOR_CHANGED = "android.intent.action.DYNAMIC_SENSOR_CHANGED"; |
| 3523 | |
Lenka Trochtova | 73aeea2 | 2016-11-18 17:34:34 +0100 | [diff] [blame] | 3524 | /** |
Sam Lin | e707f83 | 2017-04-13 17:00:55 -0700 | [diff] [blame] | 3525 | * Deprecated - use ACTION_FACTORY_RESET instead. |
Amith Yamasani | e99757e4 | 2017-04-14 14:41:45 -0700 | [diff] [blame] | 3526 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3527 | * @removed |
Lenka Trochtova | 73aeea2 | 2016-11-18 17:34:34 +0100 | [diff] [blame] | 3528 | */ |
| 3529 | @Deprecated |
Amith Yamasani | e99757e4 | 2017-04-14 14:41:45 -0700 | [diff] [blame] | 3530 | @SystemApi |
Jeff Sharkey | 004a4b2 | 2014-09-24 11:45:24 -0700 | [diff] [blame] | 3531 | public static final String ACTION_MASTER_CLEAR = "android.intent.action.MASTER_CLEAR"; |
| 3532 | |
Christopher Tate | 6597e34 | 2015-02-17 12:15:25 -0800 | [diff] [blame] | 3533 | /** |
Amith Yamasani | cbabb8d | 2017-02-17 16:50:05 -0800 | [diff] [blame] | 3534 | * Broadcast intent sent by the RecoverySystem to inform listeners that a master clear (wipe) |
| 3535 | * is about to be performed. |
| 3536 | * @hide |
| 3537 | */ |
| 3538 | @SystemApi |
| 3539 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3540 | public static final String ACTION_MASTER_CLEAR_NOTIFICATION |
| 3541 | = "android.intent.action.MASTER_CLEAR_NOTIFICATION"; |
| 3542 | |
| 3543 | /** |
Lenka Trochtova | 73aeea2 | 2016-11-18 17:34:34 +0100 | [diff] [blame] | 3544 | * Boolean intent extra to be used with {@link #ACTION_MASTER_CLEAR} in order to force a factory |
| 3545 | * reset even if {@link android.os.UserManager#DISALLOW_FACTORY_RESET} is set. |
| 3546 | * |
| 3547 | * <p>Deprecated - use {@link #EXTRA_FORCE_FACTORY_RESET} instead. |
| 3548 | * |
Benjamin Franz | f9d5e6a | 2016-05-26 14:24:29 +0100 | [diff] [blame] | 3549 | * @hide |
| 3550 | */ |
Lenka Trochtova | 73aeea2 | 2016-11-18 17:34:34 +0100 | [diff] [blame] | 3551 | @Deprecated |
Benjamin Franz | f9d5e6a | 2016-05-26 14:24:29 +0100 | [diff] [blame] | 3552 | public static final String EXTRA_FORCE_MASTER_CLEAR = |
| 3553 | "android.intent.extra.FORCE_MASTER_CLEAR"; |
| 3554 | |
| 3555 | /** |
Lenka Trochtova | 73aeea2 | 2016-11-18 17:34:34 +0100 | [diff] [blame] | 3556 | * A broadcast action to trigger a factory reset. |
| 3557 | * |
Jeff Davidson | a0c7d1f | 2017-11-01 17:41:41 -0700 | [diff] [blame] | 3558 | * <p>The sender must hold the {@link android.Manifest.permission#MASTER_CLEAR} permission. The |
| 3559 | * reason for the factory reset should be specified as {@link #EXTRA_REASON}. |
Lenka Trochtova | 73aeea2 | 2016-11-18 17:34:34 +0100 | [diff] [blame] | 3560 | * |
| 3561 | * <p>Not for use by third-party applications. |
| 3562 | * |
Jeff Davidson | a0c7d1f | 2017-11-01 17:41:41 -0700 | [diff] [blame] | 3563 | * @see #EXTRA_FORCE_FACTORY_RESET |
Lenka Trochtova | 73aeea2 | 2016-11-18 17:34:34 +0100 | [diff] [blame] | 3564 | * |
| 3565 | * {@hide} |
| 3566 | */ |
| 3567 | @SystemApi |
| 3568 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3569 | public static final String ACTION_FACTORY_RESET = "android.intent.action.FACTORY_RESET"; |
| 3570 | |
| 3571 | /** |
| 3572 | * Boolean intent extra to be used with {@link #ACTION_MASTER_CLEAR} in order to force a factory |
| 3573 | * reset even if {@link android.os.UserManager#DISALLOW_FACTORY_RESET} is set. |
| 3574 | * |
| 3575 | * <p>Not for use by third-party applications. |
| 3576 | * |
| 3577 | * @hide |
| 3578 | */ |
| 3579 | @SystemApi |
| 3580 | public static final String EXTRA_FORCE_FACTORY_RESET = |
| 3581 | "android.intent.extra.FORCE_FACTORY_RESET"; |
| 3582 | |
| 3583 | /** |
Michal Karpinski | 6135a26 | 2017-08-11 10:45:58 +0100 | [diff] [blame] | 3584 | * Broadcast action: report that a settings element is being restored from backup. The intent |
| 3585 | * contains four extras: EXTRA_SETTING_NAME is a string naming the restored setting, |
| 3586 | * EXTRA_SETTING_NEW_VALUE is the value being restored, EXTRA_SETTING_PREVIOUS_VALUE |
| 3587 | * is the value of that settings entry prior to the restore operation, and |
| 3588 | * EXTRA_SETTING_RESTORED_FROM_SDK_INT is the version of the SDK that the setting has been |
| 3589 | * restored from (corresponds to {@link android.os.Build.VERSION#SDK_INT}). The first three |
| 3590 | * values are represented as strings, the fourth one as int. |
Christopher Tate | 6597e34 | 2015-02-17 12:15:25 -0800 | [diff] [blame] | 3591 | * |
| 3592 | * <p>This broadcast is sent only for settings provider entries known to require special handling |
| 3593 | * around restore time. These entries are found in the BROADCAST_ON_RESTORE table within |
| 3594 | * the provider's backup agent implementation. |
| 3595 | * |
| 3596 | * @see #EXTRA_SETTING_NAME |
| 3597 | * @see #EXTRA_SETTING_PREVIOUS_VALUE |
| 3598 | * @see #EXTRA_SETTING_NEW_VALUE |
Michal Karpinski | 6135a26 | 2017-08-11 10:45:58 +0100 | [diff] [blame] | 3599 | * @see #EXTRA_SETTING_RESTORED_FROM_SDK_INT |
Christopher Tate | 6597e34 | 2015-02-17 12:15:25 -0800 | [diff] [blame] | 3600 | * {@hide} |
| 3601 | */ |
| 3602 | public static final String ACTION_SETTING_RESTORED = "android.os.action.SETTING_RESTORED"; |
| 3603 | |
| 3604 | /** {@hide} */ |
| 3605 | public static final String EXTRA_SETTING_NAME = "setting_name"; |
| 3606 | /** {@hide} */ |
| 3607 | public static final String EXTRA_SETTING_PREVIOUS_VALUE = "previous_value"; |
| 3608 | /** {@hide} */ |
| 3609 | public static final String EXTRA_SETTING_NEW_VALUE = "new_value"; |
Michal Karpinski | 6135a26 | 2017-08-11 10:45:58 +0100 | [diff] [blame] | 3610 | /** {@hide} */ |
| 3611 | 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] | 3612 | |
Clara Bayarri | 0a26157a | 2015-03-26 18:38:55 +0000 | [diff] [blame] | 3613 | /** |
| 3614 | * Activity Action: Process a piece of text. |
| 3615 | * <p>Input: {@link #EXTRA_PROCESS_TEXT} contains the text to be processed. |
| 3616 | * {@link #EXTRA_PROCESS_TEXT_READONLY} states if the resulting text will be read-only.</p> |
| 3617 | * <p>Output: {@link #EXTRA_PROCESS_TEXT} contains the processed text.</p> |
| 3618 | */ |
| 3619 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 3620 | public static final String ACTION_PROCESS_TEXT = "android.intent.action.PROCESS_TEXT"; |
Amith Yamasani | cbabb8d | 2017-02-17 16:50:05 -0800 | [diff] [blame] | 3621 | |
| 3622 | /** |
| 3623 | * Broadcast Action: The sim card state has changed. |
| 3624 | * For more details see TelephonyIntents.ACTION_SIM_STATE_CHANGED. This is here |
| 3625 | * because TelephonyIntents is an internal class. |
| 3626 | * @hide |
Amit Mahajan | 052e1e2 | 2018-01-12 17:40:29 -0800 | [diff] [blame] | 3627 | * @deprecated Use {@link #ACTION_SIM_CARD_STATE_CHANGED} or |
| 3628 | * {@link #ACTION_SIM_APPLICATION_STATE_CHANGED} |
Amith Yamasani | cbabb8d | 2017-02-17 16:50:05 -0800 | [diff] [blame] | 3629 | */ |
Amit Mahajan | 052e1e2 | 2018-01-12 17:40:29 -0800 | [diff] [blame] | 3630 | @Deprecated |
Amith Yamasani | cbabb8d | 2017-02-17 16:50:05 -0800 | [diff] [blame] | 3631 | @SystemApi |
| 3632 | @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3633 | public static final String ACTION_SIM_STATE_CHANGED = "android.intent.action.SIM_STATE_CHANGED"; |
| 3634 | |
Clara Bayarri | 0a26157a | 2015-03-26 18:38:55 +0000 | [diff] [blame] | 3635 | /** |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3636 | * Broadcast Action: indicate that the phone service state has changed. |
| 3637 | * The intent will have the following extra values:</p> |
| 3638 | * <p> |
| 3639 | * @see #EXTRA_VOICE_REG_STATE |
| 3640 | * @see #EXTRA_DATA_REG_STATE |
| 3641 | * @see #EXTRA_VOICE_ROAMING_TYPE |
| 3642 | * @see #EXTRA_DATA_ROAMING_TYPE |
| 3643 | * @see #EXTRA_OPERATOR_ALPHA_LONG |
| 3644 | * @see #EXTRA_OPERATOR_ALPHA_SHORT |
| 3645 | * @see #EXTRA_OPERATOR_NUMERIC |
| 3646 | * @see #EXTRA_DATA_OPERATOR_ALPHA_LONG |
| 3647 | * @see #EXTRA_DATA_OPERATOR_ALPHA_SHORT |
| 3648 | * @see #EXTRA_DATA_OPERATOR_NUMERIC |
| 3649 | * @see #EXTRA_MANUAL |
| 3650 | * @see #EXTRA_VOICE_RADIO_TECH |
| 3651 | * @see #EXTRA_DATA_RADIO_TECH |
| 3652 | * @see #EXTRA_CSS_INDICATOR |
| 3653 | * @see #EXTRA_NETWORK_ID |
| 3654 | * @see #EXTRA_SYSTEM_ID |
| 3655 | * @see #EXTRA_CDMA_ROAMING_INDICATOR |
| 3656 | * @see #EXTRA_CDMA_DEFAULT_ROAMING_INDICATOR |
| 3657 | * @see #EXTRA_EMERGENCY_ONLY |
| 3658 | * @see #EXTRA_IS_DATA_ROAMING_FROM_REGISTRATION |
| 3659 | * @see #EXTRA_IS_USING_CARRIER_AGGREGATION |
| 3660 | * @see #EXTRA_LTE_EARFCN_RSRP_BOOST |
| 3661 | * |
| 3662 | * <p class="note"> |
| 3663 | * Requires the READ_PHONE_STATE permission. |
| 3664 | * |
| 3665 | * <p class="note">This is a protected intent that can only be sent by the system. |
| 3666 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3667 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3668 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable} and the helper |
| 3669 | * functions {@code ServiceStateTable.getUriForSubscriptionIdAndField} and |
| 3670 | * {@code ServiceStateTable.getUriForSubscriptionId} to subscribe to changes to the ServiceState |
| 3671 | * for a given subscription id and field with a ContentObserver or using JobScheduler. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3672 | */ |
| 3673 | @Deprecated |
| 3674 | @SystemApi |
| 3675 | @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION) |
| 3676 | public static final String ACTION_SERVICE_STATE = "android.intent.action.SERVICE_STATE"; |
| 3677 | |
| 3678 | /** |
| 3679 | * An int extra used with {@link #ACTION_SERVICE_STATE} which indicates voice registration |
| 3680 | * state. |
| 3681 | * @see android.telephony.ServiceState#STATE_EMERGENCY_ONLY |
| 3682 | * @see android.telephony.ServiceState#STATE_IN_SERVICE |
| 3683 | * @see android.telephony.ServiceState#STATE_OUT_OF_SERVICE |
| 3684 | * @see android.telephony.ServiceState#STATE_POWER_OFF |
| 3685 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3686 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3687 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#VOICE_REG_STATE}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3688 | */ |
| 3689 | @Deprecated |
| 3690 | @SystemApi |
| 3691 | public static final String EXTRA_VOICE_REG_STATE = "voiceRegState"; |
| 3692 | |
| 3693 | /** |
| 3694 | * An int extra used with {@link #ACTION_SERVICE_STATE} which indicates data registration state. |
| 3695 | * @see android.telephony.ServiceState#STATE_EMERGENCY_ONLY |
| 3696 | * @see android.telephony.ServiceState#STATE_IN_SERVICE |
| 3697 | * @see android.telephony.ServiceState#STATE_OUT_OF_SERVICE |
| 3698 | * @see android.telephony.ServiceState#STATE_POWER_OFF |
| 3699 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3700 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3701 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#DATA_REG_STATE}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3702 | */ |
| 3703 | @Deprecated |
| 3704 | @SystemApi |
| 3705 | public static final String EXTRA_DATA_REG_STATE = "dataRegState"; |
| 3706 | |
| 3707 | /** |
| 3708 | * An integer extra used with {@link #ACTION_SERVICE_STATE} which indicates the voice roaming |
| 3709 | * type. |
| 3710 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3711 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3712 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#VOICE_ROAMING_TYPE}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3713 | */ |
| 3714 | @Deprecated |
| 3715 | @SystemApi |
| 3716 | public static final String EXTRA_VOICE_ROAMING_TYPE = "voiceRoamingType"; |
| 3717 | |
| 3718 | /** |
| 3719 | * An integer extra used with {@link #ACTION_SERVICE_STATE} which indicates the data roaming |
| 3720 | * type. |
| 3721 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3722 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3723 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#DATA_ROAMING_TYPE}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3724 | */ |
| 3725 | @Deprecated |
| 3726 | @SystemApi |
| 3727 | public static final String EXTRA_DATA_ROAMING_TYPE = "dataRoamingType"; |
| 3728 | |
| 3729 | /** |
| 3730 | * A string extra used with {@link #ACTION_SERVICE_STATE} which represents the current |
| 3731 | * registered voice operator name in long alphanumeric format. |
| 3732 | * {@code null} if the operator name is not known or unregistered. |
| 3733 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3734 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3735 | * @deprecated Use |
| 3736 | * {@link android.provider.Telephony.ServiceStateTable#VOICE_OPERATOR_ALPHA_LONG}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3737 | */ |
| 3738 | @Deprecated |
| 3739 | @SystemApi |
| 3740 | public static final String EXTRA_OPERATOR_ALPHA_LONG = "operator-alpha-long"; |
| 3741 | |
| 3742 | /** |
| 3743 | * A string extra used with {@link #ACTION_SERVICE_STATE} which represents the current |
| 3744 | * registered voice operator name in short alphanumeric format. |
| 3745 | * {@code null} if the operator name is not known or unregistered. |
| 3746 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3747 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3748 | * @deprecated Use |
| 3749 | * {@link android.provider.Telephony.ServiceStateTable#VOICE_OPERATOR_ALPHA_SHORT}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3750 | */ |
| 3751 | @Deprecated |
| 3752 | @SystemApi |
| 3753 | public static final String EXTRA_OPERATOR_ALPHA_SHORT = "operator-alpha-short"; |
| 3754 | |
| 3755 | /** |
| 3756 | * A string extra used with {@link #ACTION_SERVICE_STATE} containing the MCC |
| 3757 | * (Mobile Country Code, 3 digits) and MNC (Mobile Network code, 2-3 digits) for the mobile |
| 3758 | * network. |
| 3759 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3760 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3761 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#VOICE_OPERATOR_NUMERIC}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3762 | */ |
| 3763 | @Deprecated |
| 3764 | @SystemApi |
| 3765 | public static final String EXTRA_OPERATOR_NUMERIC = "operator-numeric"; |
| 3766 | |
| 3767 | /** |
| 3768 | * A string extra used with {@link #ACTION_SERVICE_STATE} which represents the current |
| 3769 | * registered data operator name in long alphanumeric format. |
| 3770 | * {@code null} if the operator name is not known or unregistered. |
| 3771 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3772 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3773 | * @deprecated Use |
| 3774 | * {@link android.provider.Telephony.ServiceStateTable#DATA_OPERATOR_ALPHA_LONG}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3775 | */ |
| 3776 | @Deprecated |
| 3777 | @SystemApi |
| 3778 | public static final String EXTRA_DATA_OPERATOR_ALPHA_LONG = "data-operator-alpha-long"; |
| 3779 | |
| 3780 | /** |
| 3781 | * A string extra used with {@link #ACTION_SERVICE_STATE} which represents the current |
| 3782 | * registered data operator name in short alphanumeric format. |
| 3783 | * {@code null} if the operator name is not known or unregistered. |
| 3784 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3785 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3786 | * @deprecated Use |
| 3787 | * {@link android.provider.Telephony.ServiceStateTable#DATA_OPERATOR_ALPHA_SHORT}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3788 | */ |
| 3789 | @Deprecated |
| 3790 | @SystemApi |
| 3791 | public static final String EXTRA_DATA_OPERATOR_ALPHA_SHORT = "data-operator-alpha-short"; |
| 3792 | |
| 3793 | /** |
| 3794 | * A string extra used with {@link #ACTION_SERVICE_STATE} containing the MCC |
| 3795 | * (Mobile Country Code, 3 digits) and MNC (Mobile Network code, 2-3 digits) for the |
| 3796 | * data operator. |
| 3797 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3798 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3799 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#DATA_OPERATOR_NUMERIC}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3800 | */ |
| 3801 | @Deprecated |
| 3802 | @SystemApi |
| 3803 | public static final String EXTRA_DATA_OPERATOR_NUMERIC = "data-operator-numeric"; |
| 3804 | |
| 3805 | /** |
| 3806 | * A boolean extra used with {@link #ACTION_SERVICE_STATE} which indicates whether the current |
| 3807 | * network selection mode is manual. |
| 3808 | * Will be {@code true} if manual mode, {@code false} if automatic mode. |
| 3809 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3810 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3811 | * @deprecated Use |
| 3812 | * {@link android.provider.Telephony.ServiceStateTable#IS_MANUAL_NETWORK_SELECTION}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3813 | */ |
| 3814 | @Deprecated |
| 3815 | @SystemApi |
| 3816 | public static final String EXTRA_MANUAL = "manual"; |
| 3817 | |
| 3818 | /** |
| 3819 | * An integer extra used with {@link #ACTION_SERVICE_STATE} which represents the current voice |
| 3820 | * radio technology. |
| 3821 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3822 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3823 | * @deprecated Use |
| 3824 | * {@link android.provider.Telephony.ServiceStateTable#RIL_VOICE_RADIO_TECHNOLOGY}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3825 | */ |
| 3826 | @Deprecated |
| 3827 | @SystemApi |
| 3828 | public static final String EXTRA_VOICE_RADIO_TECH = "radioTechnology"; |
| 3829 | |
| 3830 | /** |
| 3831 | * An integer extra used with {@link #ACTION_SERVICE_STATE} which represents the current data |
| 3832 | * radio technology. |
| 3833 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3834 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3835 | * @deprecated Use |
| 3836 | * {@link android.provider.Telephony.ServiceStateTable#RIL_DATA_RADIO_TECHNOLOGY}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3837 | */ |
| 3838 | @Deprecated |
| 3839 | @SystemApi |
| 3840 | public static final String EXTRA_DATA_RADIO_TECH = "dataRadioTechnology"; |
| 3841 | |
| 3842 | /** |
| 3843 | * A boolean extra used with {@link #ACTION_SERVICE_STATE} which represents concurrent service |
| 3844 | * support on CDMA network. |
| 3845 | * Will be {@code true} if support, {@code false} otherwise. |
| 3846 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3847 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3848 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#CSS_INDICATOR}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3849 | */ |
| 3850 | @Deprecated |
| 3851 | @SystemApi |
| 3852 | public static final String EXTRA_CSS_INDICATOR = "cssIndicator"; |
| 3853 | |
| 3854 | /** |
| 3855 | * An integer extra used with {@link #ACTION_SERVICE_STATE} which represents the CDMA network |
| 3856 | * id. {@code Integer.MAX_VALUE} if unknown. |
| 3857 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3858 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3859 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#NETWORK_ID}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3860 | */ |
| 3861 | @Deprecated |
| 3862 | @SystemApi |
| 3863 | public static final String EXTRA_NETWORK_ID = "networkId"; |
| 3864 | |
| 3865 | /** |
| 3866 | * An integer extra used with {@link #ACTION_SERVICE_STATE} which represents the CDMA system id. |
| 3867 | * {@code Integer.MAX_VALUE} if unknown. |
| 3868 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3869 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3870 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#SYSTEM_ID}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3871 | */ |
| 3872 | @Deprecated |
| 3873 | @SystemApi |
| 3874 | public static final String EXTRA_SYSTEM_ID = "systemId"; |
| 3875 | |
| 3876 | /** |
| 3877 | * An integer extra used with {@link #ACTION_SERVICE_STATE} represents the TSB-58 roaming |
| 3878 | * indicator if registered on a CDMA or EVDO system or {@code -1} if not. |
| 3879 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3880 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3881 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#CDMA_ROAMING_INDICATOR}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3882 | */ |
| 3883 | @Deprecated |
| 3884 | @SystemApi |
| 3885 | public static final String EXTRA_CDMA_ROAMING_INDICATOR = "cdmaRoamingIndicator"; |
| 3886 | |
| 3887 | /** |
| 3888 | * An integer extra used with {@link #ACTION_SERVICE_STATE} represents the default roaming |
| 3889 | * indicator from the PRL if registered on a CDMA or EVDO system {@code -1} if not. |
| 3890 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3891 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3892 | * @deprecated Use |
| 3893 | * {@link android.provider.Telephony.ServiceStateTable#CDMA_DEFAULT_ROAMING_INDICATOR}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3894 | */ |
| 3895 | @Deprecated |
| 3896 | @SystemApi |
| 3897 | public static final String EXTRA_CDMA_DEFAULT_ROAMING_INDICATOR = "cdmaDefaultRoamingIndicator"; |
| 3898 | |
| 3899 | /** |
| 3900 | * A boolean extra used with {@link #ACTION_SERVICE_STATE} which indicates if under emergency |
| 3901 | * only mode. |
| 3902 | * {@code true} if in emergency only mode, {@code false} otherwise. |
| 3903 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3904 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3905 | * @deprecated Use {@link android.provider.Telephony.ServiceStateTable#IS_EMERGENCY_ONLY}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3906 | */ |
| 3907 | @Deprecated |
| 3908 | @SystemApi |
| 3909 | public static final String EXTRA_EMERGENCY_ONLY = "emergencyOnly"; |
| 3910 | |
| 3911 | /** |
| 3912 | * A boolean extra used with {@link #ACTION_SERVICE_STATE} which indicates whether data network |
| 3913 | * registration state is roaming. |
| 3914 | * {@code true} if registration indicates roaming, {@code false} otherwise |
| 3915 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3916 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3917 | * @deprecated Use |
| 3918 | * {@link android.provider.Telephony.ServiceStateTable#IS_DATA_ROAMING_FROM_REGISTRATION}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3919 | */ |
| 3920 | @Deprecated |
| 3921 | @SystemApi |
| 3922 | public static final String EXTRA_IS_DATA_ROAMING_FROM_REGISTRATION = |
| 3923 | "isDataRoamingFromRegistration"; |
| 3924 | |
| 3925 | /** |
| 3926 | * A boolean extra used with {@link #ACTION_SERVICE_STATE} which indicates if carrier |
| 3927 | * aggregation is in use. |
| 3928 | * {@code true} if carrier aggregation is in use, {@code false} otherwise. |
| 3929 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3930 | * @removed |
Jordan Liu | 47990452 | 2018-04-17 14:43:39 -0700 | [diff] [blame] | 3931 | * @deprecated Use |
| 3932 | * {@link android.provider.Telephony.ServiceStateTable#IS_USING_CARRIER_AGGREGATION}. |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3933 | */ |
| 3934 | @Deprecated |
| 3935 | @SystemApi |
| 3936 | public static final String EXTRA_IS_USING_CARRIER_AGGREGATION = "isUsingCarrierAggregation"; |
| 3937 | |
| 3938 | /** |
| 3939 | * An integer extra used with {@link #ACTION_SERVICE_STATE} representing the offset which |
| 3940 | * is reduced from the rsrp threshold while calculating signal strength level. |
| 3941 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 3942 | * @removed |
fionaxu | 90fee27 | 2017-03-31 12:45:12 -0700 | [diff] [blame] | 3943 | */ |
| 3944 | @Deprecated |
| 3945 | @SystemApi |
| 3946 | public static final String EXTRA_LTE_EARFCN_RSRP_BOOST = "LteEarfcnRsrpBoost"; |
| 3947 | |
| 3948 | /** |
chen xu | 0281169 | 2018-10-03 19:07:09 -0700 | [diff] [blame] | 3949 | * An parcelable extra used with {@link #ACTION_SERVICE_STATE} representing the service state. |
| 3950 | * @hide |
| 3951 | */ |
| 3952 | public static final String EXTRA_SERVICE_STATE = "android.intent.extra.SERVICE_STATE"; |
| 3953 | |
| 3954 | /** |
Clara Bayarri | 92c8e6f | 2015-05-21 17:50:08 +0100 | [diff] [blame] | 3955 | * The name of the extra used to define the text to be processed, as a |
| 3956 | * CharSequence. Note that this may be a styled CharSequence, so you must use |
| 3957 | * {@link Bundle#getCharSequence(String) Bundle.getCharSequence()} to retrieve it. |
Clara Bayarri | 0a26157a | 2015-03-26 18:38:55 +0000 | [diff] [blame] | 3958 | */ |
| 3959 | public static final String EXTRA_PROCESS_TEXT = "android.intent.extra.PROCESS_TEXT"; |
| 3960 | /** |
Clara Bayarri | 92c8e6f | 2015-05-21 17:50:08 +0100 | [diff] [blame] | 3961 | * 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] | 3962 | */ |
| 3963 | public static final String EXTRA_PROCESS_TEXT_READONLY = |
| 3964 | "android.intent.extra.PROCESS_TEXT_READONLY"; |
| 3965 | |
Bryce Lee | bc58f59 | 2015-09-25 16:43:01 -0700 | [diff] [blame] | 3966 | /** |
| 3967 | * Broadcast action: reports when a new thermal event has been reached. When the device |
| 3968 | * is reaching its maximum temperatue, the thermal level reported |
| 3969 | * {@hide} |
| 3970 | */ |
| 3971 | @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 3972 | public static final String ACTION_THERMAL_EVENT = "android.intent.action.THERMAL_EVENT"; |
| 3973 | |
| 3974 | /** {@hide} */ |
| 3975 | public static final String EXTRA_THERMAL_STATE = "android.intent.extra.THERMAL_STATE"; |
| 3976 | |
| 3977 | /** |
| 3978 | * 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] | 3979 | * {@link #ACTION_THERMAL_EVENT} broadcast as {@link #EXTRA_THERMAL_STATE}. |
Bryce Lee | bc58f59 | 2015-09-25 16:43:01 -0700 | [diff] [blame] | 3980 | * {@hide} |
| 3981 | */ |
| 3982 | public static final int EXTRA_THERMAL_STATE_NORMAL = 0; |
| 3983 | |
| 3984 | /** |
| 3985 | * 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] | 3986 | * the {@link #ACTION_THERMAL_EVENT} broadcast as {@link #EXTRA_THERMAL_STATE}. |
Bryce Lee | bc58f59 | 2015-09-25 16:43:01 -0700 | [diff] [blame] | 3987 | * {@hide} |
| 3988 | */ |
| 3989 | public static final int EXTRA_THERMAL_STATE_WARNING = 1; |
| 3990 | |
| 3991 | /** |
| 3992 | * 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] | 3993 | * {@link #ACTION_THERMAL_EVENT} broadcast as {@link #EXTRA_THERMAL_STATE}. |
Bryce Lee | bc58f59 | 2015-09-25 16:43:01 -0700 | [diff] [blame] | 3994 | * {@hide} |
| 3995 | */ |
| 3996 | public static final int EXTRA_THERMAL_STATE_EXCEEDED = 2; |
| 3997 | |
lpeter | 318abc9 | 2018-05-04 16:13:14 +0800 | [diff] [blame] | 3998 | /** |
| 3999 | * Broadcast Action: Indicates the dock in idle state while device is docked. |
| 4000 | * |
| 4001 | * <p class="note">This is a protected intent that can only be sent |
| 4002 | * by the system. |
| 4003 | * |
| 4004 | * @hide |
| 4005 | */ |
| 4006 | public static final String ACTION_DOCK_IDLE = "android.intent.action.DOCK_IDLE"; |
| 4007 | |
| 4008 | /** |
| 4009 | * Broadcast Action: Indicates the dock in active state while device is docked. |
| 4010 | * |
| 4011 | * <p class="note">This is a protected intent that can only be sent |
| 4012 | * by the system. |
| 4013 | * |
| 4014 | * @hide |
| 4015 | */ |
| 4016 | public static final String ACTION_DOCK_ACTIVE = "android.intent.action.DOCK_ACTIVE"; |
| 4017 | |
Bryce Lee | bc58f59 | 2015-09-25 16:43:01 -0700 | [diff] [blame] | 4018 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4019 | // --------------------------------------------------------------------- |
| 4020 | // --------------------------------------------------------------------- |
| 4021 | // Standard intent categories (see addCategory()). |
| 4022 | |
| 4023 | /** |
| 4024 | * Set if the activity should be an option for the default action |
| 4025 | * (center press) to perform on a piece of data. Setting this will |
| 4026 | * hide from the user any activities without it set when performing an |
John Spurlock | 6098c5d | 2013-06-17 10:32:46 -0400 | [diff] [blame] | 4027 | * 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] | 4028 | * Intent when initiating an action -- it is for use in intent filters |
| 4029 | * specified in packages. |
| 4030 | */ |
| 4031 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4032 | public static final String CATEGORY_DEFAULT = "android.intent.category.DEFAULT"; |
| 4033 | /** |
| 4034 | * Activities that can be safely invoked from a browser must support this |
| 4035 | * category. For example, if the user is viewing a web page or an e-mail |
| 4036 | * and clicks on a link in the text, the Intent generated execute that |
| 4037 | * link will require the BROWSABLE category, so that only activities |
| 4038 | * supporting this category will be considered as possible actions. By |
| 4039 | * supporting this category, you are promising that there is nothing |
| 4040 | * damaging (without user intervention) that can happen by invoking any |
| 4041 | * matching Intent. |
| 4042 | */ |
| 4043 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4044 | public static final String CATEGORY_BROWSABLE = "android.intent.category.BROWSABLE"; |
| 4045 | /** |
Dianne Hackborn | 91097de | 2014-04-04 18:02:06 -0700 | [diff] [blame] | 4046 | * Categories for activities that can participate in voice interaction. |
| 4047 | * An activity that supports this category must be prepared to run with |
| 4048 | * no UI shown at all (though in some case it may have a UI shown), and |
| 4049 | * rely on {@link android.app.VoiceInteractor} to interact with the user. |
| 4050 | */ |
| 4051 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4052 | public static final String CATEGORY_VOICE = "android.intent.category.VOICE"; |
| 4053 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4054 | * Set if the activity should be considered as an alternative action to |
| 4055 | * the data the user is currently viewing. See also |
| 4056 | * {@link #CATEGORY_SELECTED_ALTERNATIVE} for an alternative action that |
| 4057 | * applies to the selection in a list of items. |
| 4058 | * |
| 4059 | * <p>Supporting this category means that you would like your activity to be |
| 4060 | * displayed in the set of alternative things the user can do, usually as |
| 4061 | * part of the current activity's options menu. You will usually want to |
| 4062 | * include a specific label in the <intent-filter> of this action |
| 4063 | * describing to the user what it does. |
| 4064 | * |
| 4065 | * <p>The action of IntentFilter with this category is important in that it |
| 4066 | * describes the specific action the target will perform. This generally |
| 4067 | * should not be a generic action (such as {@link #ACTION_VIEW}, but rather |
| 4068 | * a specific name such as "com.android.camera.action.CROP. Only one |
| 4069 | * alternative of any particular action will be shown to the user, so using |
| 4070 | * a specific action like this makes sure that your alternative will be |
| 4071 | * displayed while also allowing other applications to provide their own |
| 4072 | * overrides of that particular action. |
| 4073 | */ |
| 4074 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4075 | public static final String CATEGORY_ALTERNATIVE = "android.intent.category.ALTERNATIVE"; |
| 4076 | /** |
| 4077 | * Set if the activity should be considered as an alternative selection |
| 4078 | * action to the data the user has currently selected. This is like |
| 4079 | * {@link #CATEGORY_ALTERNATIVE}, but is used in activities showing a list |
| 4080 | * of items from which the user can select, giving them alternatives to the |
| 4081 | * default action that will be performed on it. |
| 4082 | */ |
| 4083 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4084 | public static final String CATEGORY_SELECTED_ALTERNATIVE = "android.intent.category.SELECTED_ALTERNATIVE"; |
| 4085 | /** |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 4086 | * 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] | 4087 | */ |
| 4088 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4089 | public static final String CATEGORY_TAB = "android.intent.category.TAB"; |
| 4090 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4091 | * Should be displayed in the top-level launcher. |
| 4092 | */ |
| 4093 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4094 | public static final String CATEGORY_LAUNCHER = "android.intent.category.LAUNCHER"; |
| 4095 | /** |
Jose Lima | 38b75b6 | 2014-03-11 10:41:39 -0700 | [diff] [blame] | 4096 | * Indicates an activity optimized for Leanback mode, and that should |
| 4097 | * be displayed in the Leanback launcher. |
| 4098 | */ |
| 4099 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4100 | public static final String CATEGORY_LEANBACK_LAUNCHER = "android.intent.category.LEANBACK_LAUNCHER"; |
| 4101 | /** |
Roberto Perez | 7ee1a7a | 2017-12-04 17:14:33 -0800 | [diff] [blame] | 4102 | * Indicates the preferred entry-point activity when an application is launched from a Car |
| 4103 | * launcher. If not present, Car launcher can optionally use {@link #CATEGORY_LAUNCHER} as a |
| 4104 | * fallback, or exclude the application entirely. |
| 4105 | * @hide |
| 4106 | */ |
| 4107 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4108 | public static final String CATEGORY_CAR_LAUNCHER = "android.intent.category.CAR_LAUNCHER"; |
| 4109 | /** |
Jose Lima | 73915cf | 2014-07-29 17:16:31 -0700 | [diff] [blame] | 4110 | * Indicates a Leanback settings activity to be displayed in the Leanback launcher. |
| 4111 | * @hide |
| 4112 | */ |
| 4113 | @SystemApi |
| 4114 | public static final String CATEGORY_LEANBACK_SETTINGS = "android.intent.category.LEANBACK_SETTINGS"; |
| 4115 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4116 | * Provides information about the package it is in; typically used if |
| 4117 | * a package does not contain a {@link #CATEGORY_LAUNCHER} to provide |
| 4118 | * a front-door to the user without having to be shown in the all apps list. |
| 4119 | */ |
| 4120 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4121 | public static final String CATEGORY_INFO = "android.intent.category.INFO"; |
| 4122 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4123 | * This is the home activity, that is the first activity that is displayed |
| 4124 | * when the device boots. |
| 4125 | */ |
| 4126 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4127 | public static final String CATEGORY_HOME = "android.intent.category.HOME"; |
| 4128 | /** |
Anthony Hugh | 979b81a | 2015-09-29 16:50:35 -0700 | [diff] [blame] | 4129 | * This is the home activity that is displayed when the device is finished setting up and ready |
| 4130 | * for use. |
| 4131 | * @hide |
| 4132 | */ |
| 4133 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4134 | public static final String CATEGORY_HOME_MAIN = "android.intent.category.HOME_MAIN"; |
| 4135 | /** |
Svet Ganov | 50a8bf4 | 2015-07-15 11:04:18 -0700 | [diff] [blame] | 4136 | * This is the setup wizard activity, that is the first activity that is displayed |
| 4137 | * when the user sets up the device for the first time. |
| 4138 | * @hide |
| 4139 | */ |
| 4140 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4141 | public static final String CATEGORY_SETUP_WIZARD = "android.intent.category.SETUP_WIZARD"; |
| 4142 | /** |
Svet Ganov | 5bb6bc6 | 2017-08-28 12:39:35 -0700 | [diff] [blame] | 4143 | * This is the home activity, that is the activity that serves as the launcher app |
| 4144 | * from there the user can start other apps. Often components with lower/higher |
| 4145 | * priority intent filters handle the home intent, for example SetupWizard, to |
| 4146 | * setup the device and we need to be able to distinguish the home app from these |
| 4147 | * setup helpers. |
| 4148 | * @hide |
| 4149 | */ |
| 4150 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4151 | public static final String CATEGORY_LAUNCHER_APP = "android.intent.category.LAUNCHER_APP"; |
| 4152 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4153 | * This activity is a preference panel. |
| 4154 | */ |
| 4155 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4156 | public static final String CATEGORY_PREFERENCE = "android.intent.category.PREFERENCE"; |
| 4157 | /** |
| 4158 | * This activity is a development preference panel. |
| 4159 | */ |
| 4160 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4161 | public static final String CATEGORY_DEVELOPMENT_PREFERENCE = "android.intent.category.DEVELOPMENT_PREFERENCE"; |
| 4162 | /** |
| 4163 | * Capable of running inside a parent activity container. |
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_EMBED = "android.intent.category.EMBED"; |
| 4167 | /** |
Patrick Dubroy | 6dabe24 | 2010-08-30 10:43:47 -0700 | [diff] [blame] | 4168 | * This activity allows the user to browse and download new applications. |
| 4169 | */ |
| 4170 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4171 | public static final String CATEGORY_APP_MARKET = "android.intent.category.APP_MARKET"; |
| 4172 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4173 | * This activity may be exercised by the monkey or other automated test tools. |
| 4174 | */ |
| 4175 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4176 | public static final String CATEGORY_MONKEY = "android.intent.category.MONKEY"; |
| 4177 | /** |
| 4178 | * To be used as a test (not part of the normal user experience). |
| 4179 | */ |
| 4180 | public static final String CATEGORY_TEST = "android.intent.category.TEST"; |
| 4181 | /** |
| 4182 | * To be used as a unit test (run through the Test Harness). |
| 4183 | */ |
| 4184 | public static final String CATEGORY_UNIT_TEST = "android.intent.category.UNIT_TEST"; |
| 4185 | /** |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 4186 | * 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] | 4187 | * experience). |
| 4188 | */ |
| 4189 | public static final String CATEGORY_SAMPLE_CODE = "android.intent.category.SAMPLE_CODE"; |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 4190 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4191 | /** |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 4192 | * Used to indicate that an intent only wants URIs that can be opened with |
| 4193 | * {@link ContentResolver#openFileDescriptor(Uri, String)}. Openable URIs |
| 4194 | * must support at least the columns defined in {@link OpenableColumns} when |
| 4195 | * queried. |
| 4196 | * |
| 4197 | * @see #ACTION_GET_CONTENT |
| 4198 | * @see #ACTION_OPEN_DOCUMENT |
| 4199 | * @see #ACTION_CREATE_DOCUMENT |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4200 | */ |
| 4201 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4202 | public static final String CATEGORY_OPENABLE = "android.intent.category.OPENABLE"; |
| 4203 | |
| 4204 | /** |
Tomasz Mikolajewski | 28a815c | 2016-10-28 15:54:11 +0900 | [diff] [blame] | 4205 | * Used to indicate that an intent filter can accept files which are not necessarily |
| 4206 | * openable by {@link ContentResolver#openFileDescriptor(Uri, String)}, but |
| 4207 | * at least streamable via |
| 4208 | * {@link ContentResolver#openTypedAssetFileDescriptor(Uri, String, Bundle)} |
| 4209 | * using one of the stream types exposed via |
| 4210 | * {@link ContentResolver#getStreamTypes(Uri, String)}. |
| 4211 | * |
| 4212 | * @see #ACTION_SEND |
| 4213 | * @see #ACTION_SEND_MULTIPLE |
| 4214 | */ |
| 4215 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4216 | public static final String CATEGORY_TYPED_OPENABLE = |
| 4217 | "android.intent.category.TYPED_OPENABLE"; |
| 4218 | |
| 4219 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4220 | * To be used as code under test for framework instrumentation tests. |
| 4221 | */ |
| 4222 | public static final String CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST = |
| 4223 | "android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST"; |
Mike Lockwood | 9092ab4 | 2009-09-16 13:01:32 -0400 | [diff] [blame] | 4224 | /** |
| 4225 | * An activity to run when device is inserted into a car dock. |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 4226 | * Used with {@link #ACTION_MAIN} to launch an activity. For more |
| 4227 | * information, see {@link android.app.UiModeManager}. |
Mike Lockwood | 9092ab4 | 2009-09-16 13:01:32 -0400 | [diff] [blame] | 4228 | */ |
| 4229 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4230 | public static final String CATEGORY_CAR_DOCK = "android.intent.category.CAR_DOCK"; |
| 4231 | /** |
| 4232 | * An activity to run when device is inserted into a car dock. |
Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 4233 | * Used with {@link #ACTION_MAIN} to launch an activity. For more |
| 4234 | * information, see {@link android.app.UiModeManager}. |
Mike Lockwood | 9092ab4 | 2009-09-16 13:01:32 -0400 | [diff] [blame] | 4235 | */ |
| 4236 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4237 | public static final String CATEGORY_DESK_DOCK = "android.intent.category.DESK_DOCK"; |
Praveen Bharathi | 21e941b | 2010-10-06 15:23:14 -0500 | [diff] [blame] | 4238 | /** |
| 4239 | * An activity to run when device is inserted into a analog (low end) dock. |
| 4240 | * Used with {@link #ACTION_MAIN} to launch an activity. For more |
| 4241 | * information, see {@link android.app.UiModeManager}. |
| 4242 | */ |
| 4243 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4244 | public static final String CATEGORY_LE_DESK_DOCK = "android.intent.category.LE_DESK_DOCK"; |
| 4245 | |
| 4246 | /** |
| 4247 | * An activity to run when device is inserted into a digital (high end) dock. |
| 4248 | * Used with {@link #ACTION_MAIN} to launch an activity. For more |
| 4249 | * information, see {@link android.app.UiModeManager}. |
| 4250 | */ |
| 4251 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4252 | 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] | 4253 | |
Bernd Holzhey | aea4b67 | 2010-03-31 09:46:13 +0200 | [diff] [blame] | 4254 | /** |
| 4255 | * Used to indicate that the activity can be used in a car environment. |
| 4256 | */ |
| 4257 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4258 | public static final String CATEGORY_CAR_MODE = "android.intent.category.CAR_MODE"; |
| 4259 | |
Zak Cohen | db6ca49 | 2017-01-26 14:09:00 -0800 | [diff] [blame] | 4260 | /** |
| 4261 | * An activity to use for the launcher when the device is placed in a VR Headset viewer. |
| 4262 | * Used with {@link #ACTION_MAIN} to launch an activity. For more |
| 4263 | * information, see {@link android.app.UiModeManager}. |
| 4264 | */ |
| 4265 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4266 | 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] | 4267 | // --------------------------------------------------------------------- |
| 4268 | // --------------------------------------------------------------------- |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4269 | // Application launch intent categories (see addCategory()). |
| 4270 | |
| 4271 | /** |
| 4272 | * Used with {@link #ACTION_MAIN} to launch the browser application. |
| 4273 | * The activity should be able to browse the Internet. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4274 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4275 | * since it will not result in the app launching with the correct |
| 4276 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4277 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4278 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4279 | */ |
| 4280 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4281 | public static final String CATEGORY_APP_BROWSER = "android.intent.category.APP_BROWSER"; |
| 4282 | |
| 4283 | /** |
| 4284 | * Used with {@link #ACTION_MAIN} to launch the calculator application. |
| 4285 | * The activity should be able to perform standard arithmetic operations. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4286 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4287 | * since it will not result in the app launching with the correct |
| 4288 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4289 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4290 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4291 | */ |
| 4292 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4293 | public static final String CATEGORY_APP_CALCULATOR = "android.intent.category.APP_CALCULATOR"; |
| 4294 | |
| 4295 | /** |
| 4296 | * Used with {@link #ACTION_MAIN} to launch the calendar application. |
| 4297 | * The activity should be able to view and manipulate calendar entries. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4298 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4299 | * since it will not result in the app launching with the correct |
| 4300 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4301 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4302 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4303 | */ |
| 4304 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4305 | public static final String CATEGORY_APP_CALENDAR = "android.intent.category.APP_CALENDAR"; |
| 4306 | |
| 4307 | /** |
| 4308 | * Used with {@link #ACTION_MAIN} to launch the contacts application. |
| 4309 | * The activity should be able to view and manipulate address book entries. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4310 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4311 | * since it will not result in the app launching with the correct |
| 4312 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4313 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4314 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4315 | */ |
| 4316 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4317 | public static final String CATEGORY_APP_CONTACTS = "android.intent.category.APP_CONTACTS"; |
| 4318 | |
| 4319 | /** |
| 4320 | * Used with {@link #ACTION_MAIN} to launch the email application. |
| 4321 | * The activity should be able to send and receive email. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4322 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4323 | * since it will not result in the app launching with the correct |
| 4324 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4325 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4326 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4327 | */ |
| 4328 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4329 | public static final String CATEGORY_APP_EMAIL = "android.intent.category.APP_EMAIL"; |
| 4330 | |
| 4331 | /** |
| 4332 | * Used with {@link #ACTION_MAIN} to launch the gallery application. |
| 4333 | * The activity should be able to view and manipulate image and video files |
| 4334 | * stored on the device. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4335 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4336 | * since it will not result in the app launching with the correct |
| 4337 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4338 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4339 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4340 | */ |
| 4341 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4342 | public static final String CATEGORY_APP_GALLERY = "android.intent.category.APP_GALLERY"; |
| 4343 | |
| 4344 | /** |
| 4345 | * Used with {@link #ACTION_MAIN} to launch the maps application. |
| 4346 | * 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] | 4347 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4348 | * since it will not result in the app launching with the correct |
| 4349 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4350 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4351 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4352 | */ |
| 4353 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4354 | public static final String CATEGORY_APP_MAPS = "android.intent.category.APP_MAPS"; |
| 4355 | |
| 4356 | /** |
| 4357 | * Used with {@link #ACTION_MAIN} to launch the messaging application. |
| 4358 | * The activity should be able to send and receive text messages. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4359 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4360 | * since it will not result in the app launching with the correct |
| 4361 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4362 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4363 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4364 | */ |
| 4365 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4366 | public static final String CATEGORY_APP_MESSAGING = "android.intent.category.APP_MESSAGING"; |
| 4367 | |
| 4368 | /** |
| 4369 | * Used with {@link #ACTION_MAIN} to launch the music application. |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4370 | * The activity should be able to play, browse, or manipulate music files |
| 4371 | * stored on the device. |
| 4372 | * <p>NOTE: This should not be used as the primary key of an Intent, |
| 4373 | * since it will not result in the app launching with the correct |
| 4374 | * action and category. Instead, use this with |
Dianne Hackborn | 251fe26 | 2011-12-14 17:20:54 -0800 | [diff] [blame] | 4375 | * {@link #makeMainSelectorActivity(String, String)} to generate a main |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 4376 | * Intent with this category in the selector.</p> |
Jeff Brown | 6651a63 | 2011-11-28 12:59:11 -0800 | [diff] [blame] | 4377 | */ |
| 4378 | @SdkConstant(SdkConstantType.INTENT_CATEGORY) |
| 4379 | public static final String CATEGORY_APP_MUSIC = "android.intent.category.APP_MUSIC"; |
| 4380 | |
| 4381 | // --------------------------------------------------------------------- |
| 4382 | // --------------------------------------------------------------------- |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4383 | // Standard extra data keys. |
| 4384 | |
| 4385 | /** |
| 4386 | * The initial data to place in a newly created record. Use with |
| 4387 | * {@link #ACTION_INSERT}. The data here is a Map containing the same |
| 4388 | * fields as would be given to the underlying ContentProvider.insert() |
| 4389 | * call. |
| 4390 | */ |
| 4391 | public static final String EXTRA_TEMPLATE = "android.intent.extra.TEMPLATE"; |
| 4392 | |
| 4393 | /** |
| 4394 | * A constant CharSequence that is associated with the Intent, used with |
| 4395 | * {@link #ACTION_SEND} to supply the literal data to be sent. Note that |
| 4396 | * this may be a styled CharSequence, so you must use |
| 4397 | * {@link Bundle#getCharSequence(String) Bundle.getCharSequence()} to |
| 4398 | * retrieve it. |
| 4399 | */ |
| 4400 | public static final String EXTRA_TEXT = "android.intent.extra.TEXT"; |
| 4401 | |
| 4402 | /** |
Dianne Hackborn | acb69bb | 2012-04-13 15:36:06 -0700 | [diff] [blame] | 4403 | * A constant String that is associated with the Intent, used with |
| 4404 | * {@link #ACTION_SEND} to supply an alternative to {@link #EXTRA_TEXT} |
| 4405 | * as HTML formatted text. Note that you <em>must</em> also supply |
| 4406 | * {@link #EXTRA_TEXT}. |
| 4407 | */ |
| 4408 | public static final String EXTRA_HTML_TEXT = "android.intent.extra.HTML_TEXT"; |
| 4409 | |
| 4410 | /** |
Jeff Sharkey | 81aebe7 | 2017-04-03 20:14:10 +0000 | [diff] [blame] | 4411 | * A content: URI holding a stream of data associated with the Intent, |
| 4412 | * 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] | 4413 | */ |
| 4414 | public static final String EXTRA_STREAM = "android.intent.extra.STREAM"; |
| 4415 | |
| 4416 | /** |
| 4417 | * A String[] holding e-mail addresses that should be delivered to. |
| 4418 | */ |
| 4419 | public static final String EXTRA_EMAIL = "android.intent.extra.EMAIL"; |
| 4420 | |
| 4421 | /** |
| 4422 | * A String[] holding e-mail addresses that should be carbon copied. |
| 4423 | */ |
| 4424 | public static final String EXTRA_CC = "android.intent.extra.CC"; |
| 4425 | |
| 4426 | /** |
| 4427 | * A String[] holding e-mail addresses that should be blind carbon copied. |
| 4428 | */ |
| 4429 | public static final String EXTRA_BCC = "android.intent.extra.BCC"; |
| 4430 | |
| 4431 | /** |
| 4432 | * A constant string holding the desired subject line of a message. |
| 4433 | */ |
| 4434 | public static final String EXTRA_SUBJECT = "android.intent.extra.SUBJECT"; |
| 4435 | |
| 4436 | /** |
| 4437 | * An Intent describing the choices you would like shown with |
Adam Powell | 2ed547e | 2015-04-29 18:45:04 -0700 | [diff] [blame] | 4438 | * {@link #ACTION_PICK_ACTIVITY} or {@link #ACTION_CHOOSER}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4439 | */ |
| 4440 | public static final String EXTRA_INTENT = "android.intent.extra.INTENT"; |
| 4441 | |
| 4442 | /** |
Clara Bayarri | f7fea16 | 2015-10-22 16:09:52 +0100 | [diff] [blame] | 4443 | * An int representing the user id to be used. |
| 4444 | * |
| 4445 | * @hide |
| 4446 | */ |
| 4447 | public static final String EXTRA_USER_ID = "android.intent.extra.USER_ID"; |
| 4448 | |
| 4449 | /** |
Clara Bayarri | ea9b10e | 2015-12-04 15:36:26 +0000 | [diff] [blame] | 4450 | * An int representing the task id to be retrieved. This is used when a launch from recents is |
| 4451 | * intercepted by another action such as credentials confirmation to remember which task should |
| 4452 | * be resumed when complete. |
| 4453 | * |
| 4454 | * @hide |
| 4455 | */ |
| 4456 | public static final String EXTRA_TASK_ID = "android.intent.extra.TASK_ID"; |
| 4457 | |
| 4458 | /** |
Adam Powell | 2ed547e | 2015-04-29 18:45:04 -0700 | [diff] [blame] | 4459 | * An Intent[] describing additional, alternate choices you would like shown with |
| 4460 | * {@link #ACTION_CHOOSER}. |
| 4461 | * |
| 4462 | * <p>An app may be capable of providing several different payload types to complete a |
| 4463 | * user's intended action. For example, an app invoking {@link #ACTION_SEND} to share photos |
| 4464 | * with another app may use EXTRA_ALTERNATE_INTENTS to have the chooser transparently offer |
| 4465 | * several different supported sending mechanisms for sharing, such as the actual "image/*" |
| 4466 | * photo data or a hosted link where the photos can be viewed.</p> |
| 4467 | * |
| 4468 | * <p>The intent present in {@link #EXTRA_INTENT} will be treated as the |
| 4469 | * first/primary/preferred intent in the set. Additional intents specified in |
| 4470 | * this extra are ordered; by default intents that appear earlier in the array will be |
| 4471 | * preferred over intents that appear later in the array as matches for the same |
| 4472 | * target component. To alter this preference, a calling app may also supply |
| 4473 | * {@link #EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER}.</p> |
| 4474 | */ |
| 4475 | public static final String EXTRA_ALTERNATE_INTENTS = "android.intent.extra.ALTERNATE_INTENTS"; |
| 4476 | |
| 4477 | /** |
Adam Powell | 52c3921 | 2016-04-07 15:14:18 -0700 | [diff] [blame] | 4478 | * A {@link ComponentName ComponentName[]} describing components that should be filtered out |
| 4479 | * and omitted from a list of components presented to the user. |
| 4480 | * |
| 4481 | * <p>When used with {@link #ACTION_CHOOSER}, the chooser will omit any of the components |
| 4482 | * in this array if it otherwise would have shown them. Useful for omitting specific targets |
| 4483 | * from your own package or other apps from your organization if the idea of sending to those |
| 4484 | * targets would be redundant with other app functionality. Filtered components will not |
| 4485 | * be able to present targets from an associated <code>ChooserTargetService</code>.</p> |
| 4486 | */ |
| 4487 | public static final String EXTRA_EXCLUDE_COMPONENTS |
| 4488 | = "android.intent.extra.EXCLUDE_COMPONENTS"; |
| 4489 | |
| 4490 | /** |
| 4491 | * A {@link android.service.chooser.ChooserTarget ChooserTarget[]} for {@link #ACTION_CHOOSER} |
| 4492 | * describing additional high-priority deep-link targets for the chooser to present to the user. |
| 4493 | * |
| 4494 | * <p>Targets provided in this way will be presented inline with all other targets provided |
| 4495 | * by services from other apps. They will be prioritized before other service targets, but |
| 4496 | * after those targets provided by sources that the user has manually pinned to the front.</p> |
| 4497 | * |
| 4498 | * @see #ACTION_CHOOSER |
| 4499 | */ |
| 4500 | public static final String EXTRA_CHOOSER_TARGETS = "android.intent.extra.CHOOSER_TARGETS"; |
| 4501 | |
| 4502 | /** |
Adam Powell | 2ed547e | 2015-04-29 18:45:04 -0700 | [diff] [blame] | 4503 | * An {@link IntentSender} for an Activity that will be invoked when the user makes a selection |
| 4504 | * from the chooser activity presented by {@link #ACTION_CHOOSER}. |
| 4505 | * |
| 4506 | * <p>An app preparing an action for another app to complete may wish to allow the user to |
| 4507 | * disambiguate between several options for completing the action based on the chosen target |
| 4508 | * or otherwise refine the action before it is invoked. |
| 4509 | * </p> |
| 4510 | * |
| 4511 | * <p>When sent, this IntentSender may be filled in with the following extras:</p> |
| 4512 | * <ul> |
| 4513 | * <li>{@link #EXTRA_INTENT} The first intent that matched the user's chosen target</li> |
| 4514 | * <li>{@link #EXTRA_ALTERNATE_INTENTS} Any additional intents that also matched the user's |
| 4515 | * chosen target beyond the first</li> |
| 4516 | * <li>{@link #EXTRA_RESULT_RECEIVER} A {@link ResultReceiver} that the refinement activity |
| 4517 | * should fill in and send once the disambiguation is complete</li> |
| 4518 | * </ul> |
| 4519 | */ |
| 4520 | public static final String EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER |
| 4521 | = "android.intent.extra.CHOOSER_REFINEMENT_INTENT_SENDER"; |
| 4522 | |
| 4523 | /** |
Kang Li | 9fa2a2c | 2017-01-06 13:33:24 -0800 | [diff] [blame] | 4524 | * An {@code ArrayList} of {@code String} annotations describing content for |
| 4525 | * {@link #ACTION_CHOOSER}. |
| 4526 | * |
| 4527 | * <p>If {@link #EXTRA_CONTENT_ANNOTATIONS} is present in an intent used to start a |
| 4528 | * {@link #ACTION_CHOOSER} activity, the first three annotations will be used to rank apps.</p> |
| 4529 | * |
| 4530 | * <p>Annotations should describe the major components or topics of the content. It is up to |
| 4531 | * apps initiating {@link #ACTION_CHOOSER} to learn and add annotations. Annotations should be |
| 4532 | * 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] | 4533 | * start {@link #ACTION_CHOOSER}. Names of customized annotations should not contain the colon |
| 4534 | * character. Performance on customized annotations can suffer, if they are rarely used for |
| 4535 | * {@link #ACTION_CHOOSER} in the past 14 days. Therefore, it is recommended to use the |
| 4536 | * following annotations when applicable.</p> |
Kang Li | 9fa2a2c | 2017-01-06 13:33:24 -0800 | [diff] [blame] | 4537 | * <ul> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4538 | * <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] | 4539 | * health & beauty, and office supplies.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4540 | * <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] | 4541 | * happy, and sad.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4542 | * <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] | 4543 | * face, finger, standing, and walking.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4544 | * <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] | 4545 | * child, and baby.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4546 | * <li>"selfie" represents that the topic of the content is mainly about selfies.</li> |
| 4547 | * <li>"crowd" represents that the topic of the content is mainly about crowds.</li> |
| 4548 | * <li>"party" represents that the topic of the content is mainly about parties.</li> |
| 4549 | * <li>"animal" represent that the topic of the content is mainly about animals.</li> |
| 4550 | * <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] | 4551 | * flowers.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4552 | * <li>"vacation" represents that the topic of the content is mainly about vacations.</li> |
| 4553 | * <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] | 4554 | * sunglasses, jewelry, handbags and clothing.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4555 | * <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] | 4556 | * paper, and silk.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4557 | * <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] | 4558 | * cars, and boats.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4559 | * <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] | 4560 | * posters.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4561 | * <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] | 4562 | * and designs of houses.</li> |
Kang Li | fadc016 | 2017-04-19 11:56:05 -0700 | [diff] [blame] | 4563 | * <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] | 4564 | * Christmas and Thanksgiving.</li> |
| 4565 | * </ul> |
| 4566 | */ |
| 4567 | public static final String EXTRA_CONTENT_ANNOTATIONS |
| 4568 | = "android.intent.extra.CONTENT_ANNOTATIONS"; |
| 4569 | |
| 4570 | /** |
Adam Powell | 2ed547e | 2015-04-29 18:45:04 -0700 | [diff] [blame] | 4571 | * A {@link ResultReceiver} used to return data back to the sender. |
| 4572 | * |
| 4573 | * <p>Used to complete an app-specific |
| 4574 | * {@link #EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER refinement} for {@link #ACTION_CHOOSER}.</p> |
| 4575 | * |
| 4576 | * <p>If {@link #EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER} is present in the intent |
| 4577 | * used to start a {@link #ACTION_CHOOSER} activity this extra will be |
| 4578 | * {@link #fillIn(Intent, int) filled in} to that {@link IntentSender} and sent |
| 4579 | * when the user selects a target component from the chooser. It is up to the recipient |
| 4580 | * to send a result to this ResultReceiver to signal that disambiguation is complete |
| 4581 | * and that the chooser should invoke the user's choice.</p> |
| 4582 | * |
| 4583 | * <p>The disambiguator should provide a Bundle to the ResultReceiver with an intent |
| 4584 | * assigned to the key {@link #EXTRA_INTENT}. This supplied intent will be used by the chooser |
| 4585 | * to match and fill in the final Intent or ChooserTarget before starting it. |
| 4586 | * The supplied intent must {@link #filterEquals(Intent) match} one of the intents from |
| 4587 | * {@link #EXTRA_INTENT} or {@link #EXTRA_ALTERNATE_INTENTS} passed to |
| 4588 | * {@link #EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER} to be accepted.</p> |
| 4589 | * |
| 4590 | * <p>The result code passed to the ResultReceiver should be |
| 4591 | * {@link android.app.Activity#RESULT_OK} if the refinement succeeded and the supplied intent's |
| 4592 | * target in the chooser should be started, or {@link android.app.Activity#RESULT_CANCELED} if |
| 4593 | * the chooser should finish without starting a target.</p> |
| 4594 | */ |
| 4595 | public static final String EXTRA_RESULT_RECEIVER |
| 4596 | = "android.intent.extra.RESULT_RECEIVER"; |
| 4597 | |
| 4598 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4599 | * 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] | 4600 | * {@link #ACTION_CHOOSER}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4601 | */ |
| 4602 | public static final String EXTRA_TITLE = "android.intent.extra.TITLE"; |
| 4603 | |
| 4604 | /** |
Dianne Hackborn | eb03465 | 2009-09-07 00:49:58 -0700 | [diff] [blame] | 4605 | * A Parcelable[] of {@link Intent} or |
| 4606 | * {@link android.content.pm.LabeledIntent} objects as set with |
| 4607 | * {@link #putExtra(String, Parcelable[])} of additional activities to place |
| 4608 | * a the front of the list of choices, when shown to the user with a |
| 4609 | * {@link #ACTION_CHOOSER}. |
| 4610 | */ |
| 4611 | public static final String EXTRA_INITIAL_INTENTS = "android.intent.extra.INITIAL_INTENTS"; |
| 4612 | |
| 4613 | /** |
Todd Kennedy | 7440f17 | 2015-12-09 14:31:22 -0800 | [diff] [blame] | 4614 | * A {@link IntentSender} to start after ephemeral installation success. |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4615 | * @deprecated Use {@link #EXTRA_INSTANT_APP_SUCCESS). |
| 4616 | * @removed |
Todd Kennedy | 7440f17 | 2015-12-09 14:31:22 -0800 | [diff] [blame] | 4617 | * @hide |
| 4618 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4619 | @Deprecated |
Todd Kennedy | 7440f17 | 2015-12-09 14:31:22 -0800 | [diff] [blame] | 4620 | public static final String EXTRA_EPHEMERAL_SUCCESS = "android.intent.extra.EPHEMERAL_SUCCESS"; |
| 4621 | |
| 4622 | /** |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4623 | * A {@link IntentSender} to start after instant app installation success. |
Todd Kennedy | 7440f17 | 2015-12-09 14:31:22 -0800 | [diff] [blame] | 4624 | * @hide |
| 4625 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4626 | @SystemApi |
| 4627 | public static final String EXTRA_INSTANT_APP_SUCCESS = |
| 4628 | "android.intent.extra.INSTANT_APP_SUCCESS"; |
| 4629 | |
| 4630 | /** |
| 4631 | * A {@link IntentSender} to start after ephemeral installation failure. |
| 4632 | * @deprecated Use {@link #EXTRA_INSTANT_APP_FAILURE). |
| 4633 | * @removed |
| 4634 | * @hide |
| 4635 | */ |
| 4636 | @Deprecated |
Todd Kennedy | 7440f17 | 2015-12-09 14:31:22 -0800 | [diff] [blame] | 4637 | public static final String EXTRA_EPHEMERAL_FAILURE = "android.intent.extra.EPHEMERAL_FAILURE"; |
| 4638 | |
| 4639 | /** |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4640 | * A {@link IntentSender} to start after instant app installation failure. |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 4641 | * @hide |
| 4642 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4643 | @SystemApi |
| 4644 | public static final String EXTRA_INSTANT_APP_FAILURE = |
| 4645 | "android.intent.extra.INSTANT_APP_FAILURE"; |
| 4646 | |
| 4647 | /** |
| 4648 | * The host name that triggered an ephemeral resolution. |
| 4649 | * @deprecated Use {@link #EXTRA_INSTANT_APP_HOSTNAME). |
| 4650 | * @removed |
| 4651 | * @hide |
| 4652 | */ |
| 4653 | @Deprecated |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 4654 | public static final String EXTRA_EPHEMERAL_HOSTNAME = "android.intent.extra.EPHEMERAL_HOSTNAME"; |
| 4655 | |
| 4656 | /** |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4657 | * The host name that triggered an instant app resolution. |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 4658 | * @hide |
| 4659 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4660 | @SystemApi |
| 4661 | public static final String EXTRA_INSTANT_APP_HOSTNAME = |
| 4662 | "android.intent.extra.INSTANT_APP_HOSTNAME"; |
| 4663 | |
| 4664 | /** |
| 4665 | * An opaque token to track ephemeral resolution. |
| 4666 | * @deprecated Use {@link #EXTRA_INSTANT_APP_TOKEN). |
| 4667 | * @removed |
| 4668 | * @hide |
| 4669 | */ |
| 4670 | @Deprecated |
Todd Kennedy | 01ad0c7 | 2016-11-11 15:33:12 -0800 | [diff] [blame] | 4671 | public static final String EXTRA_EPHEMERAL_TOKEN = "android.intent.extra.EPHEMERAL_TOKEN"; |
| 4672 | |
| 4673 | /** |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4674 | * An opaque token to track instant app resolution. |
| 4675 | * @hide |
| 4676 | */ |
| 4677 | @SystemApi |
| 4678 | public static final String EXTRA_INSTANT_APP_TOKEN = |
| 4679 | "android.intent.extra.INSTANT_APP_TOKEN"; |
| 4680 | |
| 4681 | /** |
Patrick Baumann | b4165d7 | 2017-12-04 11:29:24 -0800 | [diff] [blame] | 4682 | * The action that triggered an instant application resolution. |
| 4683 | * @hide |
| 4684 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4685 | @SystemApi |
Patrick Baumann | b4165d7 | 2017-12-04 11:29:24 -0800 | [diff] [blame] | 4686 | public static final String EXTRA_INSTANT_APP_ACTION = "android.intent.extra.INSTANT_APP_ACTION"; |
| 4687 | |
| 4688 | /** |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 4689 | * An array of {@link Bundle}s containing details about resolved instant apps.. |
| 4690 | * @hide |
| 4691 | */ |
| 4692 | @SystemApi |
| 4693 | public static final String EXTRA_INSTANT_APP_BUNDLES = |
| 4694 | "android.intent.extra.INSTANT_APP_BUNDLES"; |
| 4695 | |
| 4696 | /** |
| 4697 | * 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] | 4698 | * installed. This data is populated from the response to |
| 4699 | * {@link android.content.pm.InstantAppResolveInfo#getExtras()} as provided by the registered |
| 4700 | * instant application resolver. |
| 4701 | * @hide |
| 4702 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4703 | @SystemApi |
Patrick Baumann | 709ee15 | 2017-12-04 16:12:52 -0800 | [diff] [blame] | 4704 | public static final String EXTRA_INSTANT_APP_EXTRAS = |
| 4705 | "android.intent.extra.INSTANT_APP_EXTRAS"; |
| 4706 | |
| 4707 | /** |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 4708 | * A boolean value indicating that the instant app resolver was unable to state with certainty |
| 4709 | * that it did or did not have an app for the sanitized {@link Intent} defined at |
| 4710 | * {@link #EXTRA_INTENT}. |
| 4711 | * @hide |
| 4712 | */ |
| 4713 | @SystemApi |
| 4714 | public static final String EXTRA_UNKNOWN_INSTANT_APP = |
| 4715 | "android.intent.extra.UNKNOWN_INSTANT_APP"; |
| 4716 | |
| 4717 | /** |
Todd Kennedy | 316c2f2 | 2017-01-23 15:40:07 -0800 | [diff] [blame] | 4718 | * The version code of the app to install components from. |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 4719 | * @deprecated Use {@link #EXTRA_LONG_VERSION_CODE). |
Todd Kennedy | 316c2f2 | 2017-01-23 15:40:07 -0800 | [diff] [blame] | 4720 | * @hide |
| 4721 | */ |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 4722 | @Deprecated |
Todd Kennedy | 316c2f2 | 2017-01-23 15:40:07 -0800 | [diff] [blame] | 4723 | public static final String EXTRA_VERSION_CODE = "android.intent.extra.VERSION_CODE"; |
| 4724 | |
| 4725 | /** |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 4726 | * The version code of the app to install components from. |
| 4727 | * @hide |
| 4728 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4729 | @SystemApi |
Dianne Hackborn | 3accca0 | 2013-09-20 09:32:11 -0700 | [diff] [blame] | 4730 | public static final String EXTRA_LONG_VERSION_CODE = "android.intent.extra.LONG_VERSION_CODE"; |
| 4731 | |
| 4732 | /** |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4733 | * The app that triggered the instant app installation. |
Chad Brubaker | 0606861 | 2017-04-06 09:43:47 -0700 | [diff] [blame] | 4734 | * @hide |
| 4735 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4736 | @SystemApi |
Chad Brubaker | 0606861 | 2017-04-06 09:43:47 -0700 | [diff] [blame] | 4737 | public static final String EXTRA_CALLING_PACKAGE |
| 4738 | = "android.intent.extra.CALLING_PACKAGE"; |
| 4739 | |
| 4740 | /** |
| 4741 | * Optional calling app provided bundle containing additional launch information the |
| 4742 | * installer may use. |
| 4743 | * @hide |
| 4744 | */ |
Patrick Baumann | 159cd02 | 2018-01-11 13:25:05 -0800 | [diff] [blame] | 4745 | @SystemApi |
Chad Brubaker | 0606861 | 2017-04-06 09:43:47 -0700 | [diff] [blame] | 4746 | public static final String EXTRA_VERIFICATION_BUNDLE |
| 4747 | = "android.intent.extra.VERIFICATION_BUNDLE"; |
| 4748 | |
| 4749 | /** |
Adam Powell | e49d939 | 2014-07-17 18:45:19 -0700 | [diff] [blame] | 4750 | * A Bundle forming a mapping of potential target package names to different extras Bundles |
| 4751 | * to add to the default intent extras in {@link #EXTRA_INTENT} when used with |
| 4752 | * {@link #ACTION_CHOOSER}. Each key should be a package name. The package need not |
| 4753 | * be currently installed on the device. |
| 4754 | * |
| 4755 | * <p>An application may choose to provide alternate extras for the case where a user |
| 4756 | * selects an activity from a predetermined set of target packages. If the activity |
| 4757 | * the user selects from the chooser belongs to a package with its package name as |
| 4758 | * a key in this bundle, the corresponding extras for that package will be merged with |
| 4759 | * the extras already present in the intent at {@link #EXTRA_INTENT}. If a replacement |
| 4760 | * extra has the same key as an extra already present in the intent it will overwrite |
| 4761 | * the extra from the intent.</p> |
| 4762 | * |
| 4763 | * <p><em>Examples:</em> |
| 4764 | * <ul> |
| 4765 | * <li>An application may offer different {@link #EXTRA_TEXT} to an application |
| 4766 | * when sharing with it via {@link #ACTION_SEND}, augmenting a link with additional query |
| 4767 | * parameters for that target.</li> |
| 4768 | * <li>An application may offer additional metadata for known targets of a given intent |
| 4769 | * to pass along information only relevant to that target such as account or content |
| 4770 | * identifiers already known to that application.</li> |
| 4771 | * </ul></p> |
| 4772 | */ |
| 4773 | public static final String EXTRA_REPLACEMENT_EXTRAS = |
| 4774 | "android.intent.extra.REPLACEMENT_EXTRAS"; |
| 4775 | |
| 4776 | /** |
Adam Powell | 0b3c112 | 2014-10-09 12:50:14 -0700 | [diff] [blame] | 4777 | * An {@link IntentSender} that will be notified if a user successfully chooses a target |
| 4778 | * component to handle an action in an {@link #ACTION_CHOOSER} activity. The IntentSender |
| 4779 | * will have the extra {@link #EXTRA_CHOSEN_COMPONENT} appended to it containing the |
| 4780 | * {@link ComponentName} of the chosen component. |
| 4781 | * |
| 4782 | * <p>In some situations this callback may never come, for example if the user abandons |
| 4783 | * the chooser, switches to another task or any number of other reasons. Apps should not |
| 4784 | * be written assuming that this callback will always occur.</p> |
| 4785 | */ |
| 4786 | public static final String EXTRA_CHOSEN_COMPONENT_INTENT_SENDER = |
| 4787 | "android.intent.extra.CHOSEN_COMPONENT_INTENT_SENDER"; |
| 4788 | |
| 4789 | /** |
| 4790 | * The {@link ComponentName} chosen by the user to complete an action. |
| 4791 | * |
| 4792 | * @see #EXTRA_CHOSEN_COMPONENT_INTENT_SENDER |
| 4793 | */ |
| 4794 | public static final String EXTRA_CHOSEN_COMPONENT = "android.intent.extra.CHOSEN_COMPONENT"; |
| 4795 | |
| 4796 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4797 | * A {@link android.view.KeyEvent} object containing the event that |
| 4798 | * triggered the creation of the Intent it is in. |
| 4799 | */ |
| 4800 | public static final String EXTRA_KEY_EVENT = "android.intent.extra.KEY_EVENT"; |
| 4801 | |
| 4802 | /** |
Mike Lockwood | bad80e0 | 2009-07-30 01:21:08 -0700 | [diff] [blame] | 4803 | * Set to true in {@link #ACTION_REQUEST_SHUTDOWN} to request confirmation from the user |
| 4804 | * before shutting down. |
| 4805 | * |
| 4806 | * {@hide} |
| 4807 | */ |
| 4808 | public static final String EXTRA_KEY_CONFIRM = "android.intent.extra.KEY_CONFIRM"; |
| 4809 | |
| 4810 | /** |
Yusuke Sato | 705ffd1 | 2015-07-21 15:52:11 -0700 | [diff] [blame] | 4811 | * Set to true in {@link #ACTION_REQUEST_SHUTDOWN} to indicate that the shutdown is |
| 4812 | * requested by the user. |
| 4813 | * |
| 4814 | * {@hide} |
| 4815 | */ |
| 4816 | public static final String EXTRA_USER_REQUESTED_SHUTDOWN = |
| 4817 | "android.intent.extra.USER_REQUESTED_SHUTDOWN"; |
| 4818 | |
| 4819 | /** |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 4820 | * 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] | 4821 | * {@link android.content.Intent#ACTION_PACKAGE_CHANGED} intents to override the default action |
| 4822 | * of restarting the application. |
| 4823 | */ |
| 4824 | public static final String EXTRA_DONT_KILL_APP = "android.intent.extra.DONT_KILL_APP"; |
| 4825 | |
| 4826 | /** |
| 4827 | * A String holding the phone number originally entered in |
| 4828 | * {@link android.content.Intent#ACTION_NEW_OUTGOING_CALL}, or the actual |
| 4829 | * number to call in a {@link android.content.Intent#ACTION_CALL}. |
| 4830 | */ |
| 4831 | public static final String EXTRA_PHONE_NUMBER = "android.intent.extra.PHONE_NUMBER"; |
Bernd Holzhey | aea4b67 | 2010-03-31 09:46:13 +0200 | [diff] [blame] | 4832 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4833 | /** |
| 4834 | * Used as an int extra field in {@link android.content.Intent#ACTION_UID_REMOVED} |
| 4835 | * intents to supply the uid the package had been assigned. Also an optional |
| 4836 | * extra in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} or |
| 4837 | * {@link android.content.Intent#ACTION_PACKAGE_CHANGED} for the same |
| 4838 | * purpose. |
| 4839 | */ |
| 4840 | public static final String EXTRA_UID = "android.intent.extra.UID"; |
| 4841 | |
| 4842 | /** |
Dianne Hackborn | 21f1bd1 | 2010-02-19 17:02:21 -0800 | [diff] [blame] | 4843 | * @hide String array of package names. |
| 4844 | */ |
Soonil Nagarkar | 0e8fd09 | 2015-02-10 10:37:36 -0800 | [diff] [blame] | 4845 | @SystemApi |
Dianne Hackborn | 21f1bd1 | 2010-02-19 17:02:21 -0800 | [diff] [blame] | 4846 | public static final String EXTRA_PACKAGES = "android.intent.extra.PACKAGES"; |
| 4847 | |
| 4848 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4849 | * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} |
| 4850 | * intents to indicate whether this represents a full uninstall (removing |
| 4851 | * both the code and its data) or a partial uninstall (leaving its data, |
| 4852 | * implying that this is an update). |
| 4853 | */ |
| 4854 | 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] | 4855 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4856 | /** |
Dianne Hackborn | c72fc67 | 2012-09-20 13:12:03 -0700 | [diff] [blame] | 4857 | * @hide |
| 4858 | * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} |
| 4859 | * intents to indicate that at this point the package has been removed for |
| 4860 | * all users on the device. |
| 4861 | */ |
| 4862 | public static final String EXTRA_REMOVED_FOR_ALL_USERS |
| 4863 | = "android.intent.extra.REMOVED_FOR_ALL_USERS"; |
| 4864 | |
| 4865 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4866 | * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} |
| 4867 | * intents to indicate that this is a replacement of the package, so this |
| 4868 | * broadcast will immediately be followed by an add broadcast for a |
| 4869 | * different version of the same package. |
| 4870 | */ |
| 4871 | 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] | 4872 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4873 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 4874 | * Used as an int extra field in {@link android.app.AlarmManager} intents |
| 4875 | * to tell the application being invoked how many pending alarms are being |
| 4876 | * delievered with the intent. For one-shot alarms this will always be 1. |
| 4877 | * For recurring alarms, this might be greater than 1 if the device was |
| 4878 | * asleep or powered off at the time an earlier alarm would have been |
| 4879 | * delivered. |
| 4880 | */ |
| 4881 | public static final String EXTRA_ALARM_COUNT = "android.intent.extra.ALARM_COUNT"; |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 4882 | |
Jacek Surazski | 86b6c53 | 2009-05-13 14:38:28 +0200 | [diff] [blame] | 4883 | /** |
Dan Murphy | c9f4eaf | 2009-08-12 15:15:43 -0500 | [diff] [blame] | 4884 | * Used as an int extra field in {@link android.content.Intent#ACTION_DOCK_EVENT} |
| 4885 | * intents to request the dock state. Possible values are |
Mike Lockwood | 725fcbf | 2009-08-24 13:09:20 -0700 | [diff] [blame] | 4886 | * {@link android.content.Intent#EXTRA_DOCK_STATE_UNDOCKED}, |
| 4887 | * {@link android.content.Intent#EXTRA_DOCK_STATE_DESK}, or |
Praveen Bharathi | 21e941b | 2010-10-06 15:23:14 -0500 | [diff] [blame] | 4888 | * {@link android.content.Intent#EXTRA_DOCK_STATE_CAR}, or |
| 4889 | * {@link android.content.Intent#EXTRA_DOCK_STATE_LE_DESK}, or |
| 4890 | * {@link android.content.Intent#EXTRA_DOCK_STATE_HE_DESK}. |
Dan Murphy | c9f4eaf | 2009-08-12 15:15:43 -0500 | [diff] [blame] | 4891 | */ |
| 4892 | public static final String EXTRA_DOCK_STATE = "android.intent.extra.DOCK_STATE"; |
| 4893 | |
| 4894 | /** |
| 4895 | * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} |
| 4896 | * to represent that the phone is not in any dock. |
Dan Murphy | c9f4eaf | 2009-08-12 15:15:43 -0500 | [diff] [blame] | 4897 | */ |
| 4898 | public static final int EXTRA_DOCK_STATE_UNDOCKED = 0; |
| 4899 | |
| 4900 | /** |
| 4901 | * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} |
| 4902 | * to represent that the phone is in a desk dock. |
Dan Murphy | c9f4eaf | 2009-08-12 15:15:43 -0500 | [diff] [blame] | 4903 | */ |
| 4904 | public static final int EXTRA_DOCK_STATE_DESK = 1; |
| 4905 | |
| 4906 | /** |
| 4907 | * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} |
| 4908 | * to represent that the phone is in a car dock. |
Dan Murphy | c9f4eaf | 2009-08-12 15:15:43 -0500 | [diff] [blame] | 4909 | */ |
| 4910 | public static final int EXTRA_DOCK_STATE_CAR = 2; |
| 4911 | |
| 4912 | /** |
Praveen Bharathi | 21e941b | 2010-10-06 15:23:14 -0500 | [diff] [blame] | 4913 | * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} |
| 4914 | * to represent that the phone is in a analog (low end) dock. |
| 4915 | */ |
| 4916 | public static final int EXTRA_DOCK_STATE_LE_DESK = 3; |
| 4917 | |
| 4918 | /** |
| 4919 | * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} |
| 4920 | * to represent that the phone is in a digital (high end) dock. |
| 4921 | */ |
| 4922 | public static final int EXTRA_DOCK_STATE_HE_DESK = 4; |
| 4923 | |
| 4924 | /** |
Dianne Hackborn | 9bfb707 | 2009-09-22 11:37:40 -0700 | [diff] [blame] | 4925 | * Boolean that can be supplied as meta-data with a dock activity, to |
| 4926 | * indicate that the dock should take over the home key when it is active. |
| 4927 | */ |
| 4928 | public static final String METADATA_DOCK_HOME = "android.dock_home"; |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 4929 | |
Dianne Hackborn | 9bfb707 | 2009-09-22 11:37:40 -0700 | [diff] [blame] | 4930 | /** |
Jacek Surazski | 86b6c53 | 2009-05-13 14:38:28 +0200 | [diff] [blame] | 4931 | * Used as a parcelable extra field in {@link #ACTION_APP_ERROR}, containing |
| 4932 | * the bug report. |
Jacek Surazski | 86b6c53 | 2009-05-13 14:38:28 +0200 | [diff] [blame] | 4933 | */ |
| 4934 | public static final String EXTRA_BUG_REPORT = "android.intent.extra.BUG_REPORT"; |
| 4935 | |
| 4936 | /** |
Wei Huang | 97ecc9c | 2009-05-11 17:44:20 -0700 | [diff] [blame] | 4937 | * Used in the extra field in the remote intent. It's astring token passed with the |
| 4938 | * remote intent. |
| 4939 | */ |
| 4940 | public static final String EXTRA_REMOTE_INTENT_TOKEN = |
| 4941 | "android.intent.extra.remote_intent_token"; |
| 4942 | |
Suchi Amalapurapu | 0214e94 | 2009-09-02 11:03:18 -0700 | [diff] [blame] | 4943 | /** |
Dianne Hackborn | 1d62ea9 | 2009-11-17 12:49:50 -0800 | [diff] [blame] | 4944 | * @deprecated See {@link #EXTRA_CHANGED_COMPONENT_NAME_LIST}; this field |
Dianne Hackborn | 86a72da | 2009-11-11 20:12:41 -0800 | [diff] [blame] | 4945 | * will contain only the first name in the list. |
Suchi Amalapurapu | 0214e94 | 2009-09-02 11:03:18 -0700 | [diff] [blame] | 4946 | */ |
Dianne Hackborn | 1d62ea9 | 2009-11-17 12:49:50 -0800 | [diff] [blame] | 4947 | @Deprecated public static final String EXTRA_CHANGED_COMPONENT_NAME = |
Suchi Amalapurapu | 0214e94 | 2009-09-02 11:03:18 -0700 | [diff] [blame] | 4948 | "android.intent.extra.changed_component_name"; |
| 4949 | |
Dianne Hackborn | dd9b82c | 2009-09-03 00:18:47 -0700 | [diff] [blame] | 4950 | /** |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 4951 | * This field is part of {@link android.content.Intent#ACTION_PACKAGE_CHANGED}, |
Dianne Hackborn | fd7aded | 2013-01-22 17:10:23 -0800 | [diff] [blame] | 4952 | * and contains a string array of all of the components that have changed. If |
| 4953 | * the state of the overall package has changed, then it will contain an entry |
| 4954 | * with the package name itself. |
Dianne Hackborn | 86a72da | 2009-11-11 20:12:41 -0800 | [diff] [blame] | 4955 | */ |
| 4956 | public static final String EXTRA_CHANGED_COMPONENT_NAME_LIST = |
| 4957 | "android.intent.extra.changed_component_name_list"; |
| 4958 | |
| 4959 | /** |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 4960 | * This field is part of |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 4961 | * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_AVAILABLE}, |
Andrei Stingaceanu | 69d5ebc | 2016-01-14 12:59:03 +0000 | [diff] [blame] | 4962 | * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE}, |
| 4963 | * {@link android.content.Intent#ACTION_PACKAGES_SUSPENDED}, |
| 4964 | * {@link android.content.Intent#ACTION_PACKAGES_UNSUSPENDED} |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 4965 | * 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] | 4966 | */ |
| 4967 | public static final String EXTRA_CHANGED_PACKAGE_LIST = |
| 4968 | "android.intent.extra.changed_package_list"; |
| 4969 | |
| 4970 | /** |
| 4971 | * This field is part of |
Suchi Amalapurapu | b56ae20 | 2010-02-04 22:51:07 -0800 | [diff] [blame] | 4972 | * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_AVAILABLE}, |
| 4973 | * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE} |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 4974 | * and contains an integer array of uids of all of the components |
| 4975 | * that have changed. |
Suchi Amalapurapu | 08675a3 | 2010-01-28 09:57:30 -0800 | [diff] [blame] | 4976 | */ |
| 4977 | public static final String EXTRA_CHANGED_UID_LIST = |
| 4978 | "android.intent.extra.changed_uid_list"; |
| 4979 | |
| 4980 | /** |
Dianne Hackborn | dd9b82c | 2009-09-03 00:18:47 -0700 | [diff] [blame] | 4981 | * @hide |
| 4982 | * Magic extra system code can use when binding, to give a label for |
| 4983 | * who it is that has bound to a service. This is an integer giving |
| 4984 | * a framework string resource that can be displayed to the user. |
| 4985 | */ |
| 4986 | public static final String EXTRA_CLIENT_LABEL = |
| 4987 | "android.intent.extra.client_label"; |
| 4988 | |
| 4989 | /** |
| 4990 | * @hide |
| 4991 | * Magic extra system code can use when binding, to give a PendingIntent object |
| 4992 | * that can be launched for the user to disable the system's use of this |
| 4993 | * service. |
| 4994 | */ |
| 4995 | public static final String EXTRA_CLIENT_INTENT = |
| 4996 | "android.intent.extra.client_intent"; |
| 4997 | |
Dianne Hackborn | c4d0e6f | 2011-01-25 14:55:06 -0800 | [diff] [blame] | 4998 | /** |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 4999 | * Extra used to indicate that an intent should only return data that is on |
| 5000 | * the local device. This is a boolean extra; the default is false. If true, |
| 5001 | * an implementation should only allow the user to select data that is |
| 5002 | * already on the device, not requiring it be downloaded from a remote |
| 5003 | * service when opened. |
| 5004 | * |
| 5005 | * @see #ACTION_GET_CONTENT |
| 5006 | * @see #ACTION_OPEN_DOCUMENT |
Jeff Sharkey | b9fbb72 | 2014-06-04 16:42:47 -0700 | [diff] [blame] | 5007 | * @see #ACTION_OPEN_DOCUMENT_TREE |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5008 | * @see #ACTION_CREATE_DOCUMENT |
Dianne Hackborn | c4d0e6f | 2011-01-25 14:55:06 -0800 | [diff] [blame] | 5009 | */ |
| 5010 | public static final String EXTRA_LOCAL_ONLY = |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5011 | "android.intent.extra.LOCAL_ONLY"; |
Daniel Lehmann | a5b58df | 2011-10-12 16:24:22 -0700 | [diff] [blame] | 5012 | |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 5013 | /** |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5014 | * Extra used to indicate that an intent can allow the user to select and |
| 5015 | * return multiple items. This is a boolean extra; the default is false. If |
| 5016 | * true, an implementation is allowed to present the user with a UI where |
| 5017 | * they can pick multiple items that are all returned to the caller. When |
| 5018 | * this happens, they should be returned as the {@link #getClipData()} part |
| 5019 | * of the result Intent. |
| 5020 | * |
| 5021 | * @see #ACTION_GET_CONTENT |
| 5022 | * @see #ACTION_OPEN_DOCUMENT |
Dianne Hackborn | fdb3f09 | 2013-01-28 15:10:48 -0800 | [diff] [blame] | 5023 | */ |
| 5024 | public static final String EXTRA_ALLOW_MULTIPLE = |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5025 | "android.intent.extra.ALLOW_MULTIPLE"; |
Dianne Hackborn | fdb3f09 | 2013-01-28 15:10:48 -0800 | [diff] [blame] | 5026 | |
| 5027 | /** |
Alexandra Gherghina | c17d7e0 | 2014-04-04 16:27:28 +0100 | [diff] [blame] | 5028 | * The integer userHandle carried with broadcast intents related to addition, removal and |
| 5029 | * switching of users and managed profiles - {@link #ACTION_USER_ADDED}, |
| 5030 | * {@link #ACTION_USER_REMOVED} and {@link #ACTION_USER_SWITCHED}. |
| 5031 | * |
Amith Yamasani | 1359360 | 2012-03-22 16:16:17 -0700 | [diff] [blame] | 5032 | * @hide |
| 5033 | */ |
Amith Yamasani | 2a00329 | 2012-08-14 18:25:45 -0700 | [diff] [blame] | 5034 | public static final String EXTRA_USER_HANDLE = |
| 5035 | "android.intent.extra.user_handle"; |
Jean-Michel Trivi | 3114ce3 | 2012-06-11 15:03:52 -0700 | [diff] [blame] | 5036 | |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 5037 | /** |
Alexandra Gherghina | c17d7e0 | 2014-04-04 16:27:28 +0100 | [diff] [blame] | 5038 | * The UserHandle carried with broadcasts intents related to addition and removal of managed |
| 5039 | * profiles - {@link #ACTION_MANAGED_PROFILE_ADDED} and {@link #ACTION_MANAGED_PROFILE_REMOVED}. |
| 5040 | */ |
| 5041 | public static final String EXTRA_USER = |
Alexandra Gherghina | 3315f6b | 2014-09-05 15:48:06 +0100 | [diff] [blame] | 5042 | "android.intent.extra.USER"; |
Alexandra Gherghina | c17d7e0 | 2014-04-04 16:27:28 +0100 | [diff] [blame] | 5043 | |
| 5044 | /** |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 5045 | * Extra used in the response from a BroadcastReceiver that handles |
Amith Yamasani | 7e99bc0 | 2013-04-16 18:24:51 -0700 | [diff] [blame] | 5046 | * {@link #ACTION_GET_RESTRICTION_ENTRIES}. The type of the extra is |
| 5047 | * <code>ArrayList<RestrictionEntry></code>. |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 5048 | */ |
Amith Yamasani | 7e99bc0 | 2013-04-16 18:24:51 -0700 | [diff] [blame] | 5049 | public static final String EXTRA_RESTRICTIONS_LIST = "android.intent.extra.restrictions_list"; |
| 5050 | |
| 5051 | /** |
| 5052 | * Extra sent in the intent to the BroadcastReceiver that handles |
| 5053 | * {@link #ACTION_GET_RESTRICTION_ENTRIES}. The type of the extra is a Bundle containing |
| 5054 | * the restrictions as key/value pairs. |
| 5055 | */ |
| 5056 | public static final String EXTRA_RESTRICTIONS_BUNDLE = |
| 5057 | "android.intent.extra.restrictions_bundle"; |
Amith Yamasani | df2e92a | 2013-03-01 17:04:38 -0800 | [diff] [blame] | 5058 | |
Amith Yamasani | 86118ba | 2013-03-28 14:33:16 -0700 | [diff] [blame] | 5059 | /** |
| 5060 | * Extra used in the response from a BroadcastReceiver that handles |
| 5061 | * {@link #ACTION_GET_RESTRICTION_ENTRIES}. |
| 5062 | */ |
| 5063 | public static final String EXTRA_RESTRICTIONS_INTENT = |
| 5064 | "android.intent.extra.restrictions_intent"; |
| 5065 | |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 5066 | /** |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5067 | * Extra used to communicate a set of acceptable MIME types. The type of the |
| 5068 | * extra is {@code String[]}. Values may be a combination of concrete MIME |
| 5069 | * types (such as "image/png") and/or partial MIME types (such as |
| 5070 | * "audio/*"). |
| 5071 | * |
| 5072 | * @see #ACTION_GET_CONTENT |
| 5073 | * @see #ACTION_OPEN_DOCUMENT |
Jeff Sharkey | 9ecfee0 | 2013-04-19 14:05:03 -0700 | [diff] [blame] | 5074 | */ |
| 5075 | public static final String EXTRA_MIME_TYPES = "android.intent.extra.MIME_TYPES"; |
| 5076 | |
Dianne Hackborn | 57a7f59 | 2013-07-22 18:21:32 -0700 | [diff] [blame] | 5077 | /** |
| 5078 | * Optional extra for {@link #ACTION_SHUTDOWN} that allows the sender to qualify that |
| 5079 | * 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] | 5080 | * When this is true, hardware devices can use this information to determine that |
| 5081 | * they shouldn't do a complete shutdown of their device since this is not a |
| 5082 | * complete shutdown down to the kernel, but only user space restarting. |
| 5083 | * The default if not supplied is false. |
Dianne Hackborn | 57a7f59 | 2013-07-22 18:21:32 -0700 | [diff] [blame] | 5084 | */ |
| 5085 | public static final String EXTRA_SHUTDOWN_USERSPACE_ONLY |
| 5086 | = "android.intent.extra.SHUTDOWN_USERSPACE_ONLY"; |
| 5087 | |
Narayan Kamath | ccb2a086 | 2013-12-19 14:49:36 +0000 | [diff] [blame] | 5088 | /** |
Neil Fuller | b7146fe | 2016-11-15 16:52:15 +0000 | [diff] [blame] | 5089 | * Optional int extra for {@link #ACTION_TIME_CHANGED} that indicates the |
| 5090 | * user has set their time format preference. See {@link #EXTRA_TIME_PREF_VALUE_USE_12_HOUR}, |
| 5091 | * {@link #EXTRA_TIME_PREF_VALUE_USE_24_HOUR} and |
| 5092 | * {@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] | 5093 | * |
| 5094 | * @hide for internal use only. |
| 5095 | */ |
| 5096 | public static final String EXTRA_TIME_PREF_24_HOUR_FORMAT = |
| 5097 | "android.intent.extra.TIME_PREF_24_HOUR_FORMAT"; |
Neil Fuller | b7146fe | 2016-11-15 16:52:15 +0000 | [diff] [blame] | 5098 | /** @hide */ |
| 5099 | public static final int EXTRA_TIME_PREF_VALUE_USE_12_HOUR = 0; |
| 5100 | /** @hide */ |
| 5101 | public static final int EXTRA_TIME_PREF_VALUE_USE_24_HOUR = 1; |
| 5102 | /** @hide */ |
| 5103 | public static final int EXTRA_TIME_PREF_VALUE_USE_LOCALE_DEFAULT = 2; |
Narayan Kamath | ccb2a086 | 2013-12-19 14:49:36 +0000 | [diff] [blame] | 5104 | |
Jeff Davidson | a0c7d1f | 2017-11-01 17:41:41 -0700 | [diff] [blame] | 5105 | /** |
| 5106 | * Intent extra: the reason that the operation associated with this intent is being performed. |
| 5107 | * |
| 5108 | * <p>Type: String |
| 5109 | * @hide |
| 5110 | */ |
| 5111 | @SystemApi |
Jeff Sharkey | 004a4b2 | 2014-09-24 11:45:24 -0700 | [diff] [blame] | 5112 | public static final String EXTRA_REASON = "android.intent.extra.REASON"; |
| 5113 | |
qingxi | 240c2bb | 2017-04-12 17:31:18 -0700 | [diff] [blame] | 5114 | /** |
| 5115 | * {@hide} |
| 5116 | * This extra will be send together with {@link #ACTION_FACTORY_RESET} |
| 5117 | */ |
Rubin Xu | e8490f1 | 2015-06-25 12:17:48 +0100 | [diff] [blame] | 5118 | public static final String EXTRA_WIPE_EXTERNAL_STORAGE = "android.intent.extra.WIPE_EXTERNAL_STORAGE"; |
| 5119 | |
Santos Cordon | 15a1378 | 2015-03-31 18:32:31 -0700 | [diff] [blame] | 5120 | /** |
qingxi | 240c2bb | 2017-04-12 17:31:18 -0700 | [diff] [blame] | 5121 | * {@hide} |
| 5122 | * This extra will be set to true when the user choose to wipe the data on eSIM during factory |
| 5123 | * reset for the device with eSIM. This extra will be sent together with |
| 5124 | * {@link #ACTION_FACTORY_RESET} |
| 5125 | */ |
| 5126 | public static final String EXTRA_WIPE_ESIMS = "com.android.internal.intent.extra.WIPE_ESIMS"; |
| 5127 | |
| 5128 | /** |
Santos Cordon | 15a1378 | 2015-03-31 18:32:31 -0700 | [diff] [blame] | 5129 | * Optional {@link android.app.PendingIntent} extra used to deliver the result of the SIM |
| 5130 | * activation request. |
| 5131 | * TODO: Add information about the structure and response data used with the pending intent. |
| 5132 | * @hide |
| 5133 | */ |
| 5134 | public static final String EXTRA_SIM_ACTIVATION_RESPONSE = |
| 5135 | "android.intent.extra.SIM_ACTIVATION_RESPONSE"; |
| 5136 | |
Tomasz Mikolajewski | 319fb49 | 2016-01-20 12:24:01 +0900 | [diff] [blame] | 5137 | /** |
| 5138 | * Optional index with semantics depending on the intent action. |
Tomasz Mikolajewski | fe02313 | 2016-03-10 17:42:35 +0900 | [diff] [blame] | 5139 | * |
| 5140 | * <p>The value must be an integer greater or equal to 0. |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 5141 | * @see #ACTION_QUICK_VIEW |
Tomasz Mikolajewski | 319fb49 | 2016-01-20 12:24:01 +0900 | [diff] [blame] | 5142 | */ |
Steve McKay | 6eaf3863 | 2015-08-04 10:11:01 -0700 | [diff] [blame] | 5143 | public static final String EXTRA_INDEX = "android.intent.extra.INDEX"; |
| 5144 | |
Rubin Xu | 0a29ecd | 2015-11-04 15:11:48 +0000 | [diff] [blame] | 5145 | /** |
Tomasz Mikolajewski | 17c50da | 2017-02-16 14:38:04 +0900 | [diff] [blame] | 5146 | * Tells the quick viewer to show additional UI actions suitable for the passed Uris, |
| 5147 | * such as opening in other apps, sharing, opening, editing, printing, deleting, |
| 5148 | * casting, etc. |
Tomasz Mikolajewski | 867addf | 2017-02-01 14:16:39 +0900 | [diff] [blame] | 5149 | * |
| 5150 | * <p>The value is boolean. By default false. |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 5151 | * @see #ACTION_QUICK_VIEW |
| 5152 | * @removed |
Tomasz Mikolajewski | 867addf | 2017-02-01 14:16:39 +0900 | [diff] [blame] | 5153 | */ |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 5154 | @Deprecated |
Tomasz Mikolajewski | 17c50da | 2017-02-16 14:38:04 +0900 | [diff] [blame] | 5155 | public static final String EXTRA_QUICK_VIEW_ADVANCED = |
| 5156 | "android.intent.extra.QUICK_VIEW_ADVANCED"; |
Tomasz Mikolajewski | 867addf | 2017-02-01 14:16:39 +0900 | [diff] [blame] | 5157 | |
| 5158 | /** |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 5159 | * An optional extra of {@code String[]} indicating which quick view features should be made |
| 5160 | * available to the user in the quick view UI while handing a |
| 5161 | * {@link Intent#ACTION_QUICK_VIEW} intent. |
| 5162 | * <li>Enumeration of features here is not meant to restrict capabilities of the quick viewer. |
| 5163 | * Quick viewer can implement features not listed below. |
| 5164 | * <li>Features included at this time are: {@link QuickViewConstants#FEATURE_VIEW}, |
Geoffrey Pitsch | bc02b77 | 2017-12-06 11:24:15 -0500 | [diff] [blame] | 5165 | * {@link QuickViewConstants#FEATURE_EDIT}, {@link QuickViewConstants#FEATURE_DELETE}, |
| 5166 | * {@link QuickViewConstants#FEATURE_DOWNLOAD}, {@link QuickViewConstants#FEATURE_SEND}, |
| 5167 | * {@link QuickViewConstants#FEATURE_PRINT}. |
Garfield Tan | ce1d0e9 | 2017-03-23 10:52:48 -0700 | [diff] [blame] | 5168 | * <p> |
| 5169 | * Requirements: |
| 5170 | * <li>Quick viewer shouldn't show a feature if the feature is absent in |
| 5171 | * {@link #EXTRA_QUICK_VIEW_FEATURES}. |
| 5172 | * <li>When {@link #EXTRA_QUICK_VIEW_FEATURES} is not present, quick viewer should follow |
| 5173 | * internal policies. |
| 5174 | * <li>Presence of an feature in {@link #EXTRA_QUICK_VIEW_FEATURES}, does not constitute a |
| 5175 | * requirement that the feature be shown. Quick viewer may, according to its own policies, |
| 5176 | * disable or hide features. |
| 5177 | * |
| 5178 | * @see #ACTION_QUICK_VIEW |
| 5179 | */ |
| 5180 | public static final String EXTRA_QUICK_VIEW_FEATURES = |
| 5181 | "android.intent.extra.QUICK_VIEW_FEATURES"; |
| 5182 | |
| 5183 | /** |
Rubin Xu | 0a29ecd | 2015-11-04 15:11:48 +0000 | [diff] [blame] | 5184 | * 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] | 5185 | * When a profile goes into quiet mode, all apps in the profile are killed and the |
| 5186 | * profile user is stopped. Widgets originating from the profile are masked, and app |
| 5187 | * launcher icons are grayed out. |
Rubin Xu | 0a29ecd | 2015-11-04 15:11:48 +0000 | [diff] [blame] | 5188 | */ |
| 5189 | public static final String EXTRA_QUIET_MODE = "android.intent.extra.QUIET_MODE"; |
Dongwon Kang | 2034a4c | 2015-12-14 21:57:34 +0900 | [diff] [blame] | 5190 | |
| 5191 | /** |
Dongwon Kang | 32cb9ab | 2016-01-13 18:11:10 -0800 | [diff] [blame] | 5192 | * Used as an int extra field in {@link #ACTION_MEDIA_RESOURCE_GRANTED} |
Dongwon Kang | 2034a4c | 2015-12-14 21:57:34 +0900 | [diff] [blame] | 5193 | * intents to specify the resource type granted. Possible values are |
Dongwon Kang | 32cb9ab | 2016-01-13 18:11:10 -0800 | [diff] [blame] | 5194 | * {@link #EXTRA_MEDIA_RESOURCE_TYPE_VIDEO_CODEC} or |
| 5195 | * {@link #EXTRA_MEDIA_RESOURCE_TYPE_AUDIO_CODEC}. |
Dongwon Kang | 2034a4c | 2015-12-14 21:57:34 +0900 | [diff] [blame] | 5196 | * |
| 5197 | * @hide |
| 5198 | */ |
| 5199 | public static final String EXTRA_MEDIA_RESOURCE_TYPE = |
| 5200 | "android.intent.extra.MEDIA_RESOURCE_TYPE"; |
| 5201 | |
| 5202 | /** |
Ben Lin | 145b0ca | 2016-10-14 14:23:40 -0700 | [diff] [blame] | 5203 | * Used as a boolean extra field in {@link #ACTION_CHOOSER} intents to specify |
| 5204 | * whether to show the chooser or not when there is only one application available |
| 5205 | * to choose from. |
| 5206 | * |
| 5207 | * @hide |
| 5208 | */ |
| 5209 | public static final String EXTRA_AUTO_LAUNCH_SINGLE_CHOICE = |
| 5210 | "android.intent.extra.AUTO_LAUNCH_SINGLE_CHOICE"; |
| 5211 | |
| 5212 | /** |
Dongwon Kang | 32cb9ab | 2016-01-13 18:11:10 -0800 | [diff] [blame] | 5213 | * Used as an int value for {@link #EXTRA_MEDIA_RESOURCE_TYPE} |
Dongwon Kang | 2034a4c | 2015-12-14 21:57:34 +0900 | [diff] [blame] | 5214 | * to represent that a video codec is allowed to use. |
| 5215 | * |
| 5216 | * @hide |
| 5217 | */ |
| 5218 | public static final int EXTRA_MEDIA_RESOURCE_TYPE_VIDEO_CODEC = 0; |
| 5219 | |
| 5220 | /** |
Dongwon Kang | 32cb9ab | 2016-01-13 18:11:10 -0800 | [diff] [blame] | 5221 | * Used as an int value for {@link #EXTRA_MEDIA_RESOURCE_TYPE} |
Dongwon Kang | 2034a4c | 2015-12-14 21:57:34 +0900 | [diff] [blame] | 5222 | * to represent that a audio codec is allowed to use. |
| 5223 | * |
| 5224 | * @hide |
| 5225 | */ |
| 5226 | public static final int EXTRA_MEDIA_RESOURCE_TYPE_AUDIO_CODEC = 1; |
| 5227 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5228 | // --------------------------------------------------------------------- |
| 5229 | // --------------------------------------------------------------------- |
| 5230 | // Intent flags (see mFlags variable). |
| 5231 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 5232 | /** @hide */ |
Jeff Sharkey | 6503bd8 | 2017-04-19 23:24:18 -0600 | [diff] [blame] | 5233 | @IntDef(flag = true, prefix = { "FLAG_GRANT_" }, value = { |
Jeff Sharkey | 846318a | 2014-04-04 12:12:41 -0700 | [diff] [blame] | 5234 | FLAG_GRANT_READ_URI_PERMISSION, FLAG_GRANT_WRITE_URI_PERMISSION, |
| 5235 | FLAG_GRANT_PERSISTABLE_URI_PERMISSION, FLAG_GRANT_PREFIX_URI_PERMISSION }) |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 5236 | @Retention(RetentionPolicy.SOURCE) |
| 5237 | public @interface GrantUriMode {} |
| 5238 | |
Jeff Sharkey | 846318a | 2014-04-04 12:12:41 -0700 | [diff] [blame] | 5239 | /** @hide */ |
Jeff Sharkey | 6503bd8 | 2017-04-19 23:24:18 -0600 | [diff] [blame] | 5240 | @IntDef(flag = true, prefix = { "FLAG_GRANT_" }, value = { |
Jeff Sharkey | 846318a | 2014-04-04 12:12:41 -0700 | [diff] [blame] | 5241 | FLAG_GRANT_READ_URI_PERMISSION, FLAG_GRANT_WRITE_URI_PERMISSION }) |
| 5242 | @Retention(RetentionPolicy.SOURCE) |
| 5243 | public @interface AccessUriMode {} |
| 5244 | |
| 5245 | /** |
| 5246 | * Test if given mode flags specify an access mode, which must be at least |
| 5247 | * read and/or write. |
| 5248 | * |
| 5249 | * @hide |
| 5250 | */ |
| 5251 | public static boolean isAccessUriMode(int modeFlags) { |
| 5252 | return (modeFlags & (Intent.FLAG_GRANT_READ_URI_PERMISSION |
| 5253 | | Intent.FLAG_GRANT_WRITE_URI_PERMISSION)) != 0; |
| 5254 | } |
| 5255 | |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5256 | /** @hide */ |
| 5257 | @IntDef(flag = true, prefix = { "FLAG_" }, value = { |
| 5258 | FLAG_GRANT_READ_URI_PERMISSION, |
| 5259 | FLAG_GRANT_WRITE_URI_PERMISSION, |
| 5260 | FLAG_FROM_BACKGROUND, |
| 5261 | FLAG_DEBUG_LOG_RESOLUTION, |
| 5262 | FLAG_EXCLUDE_STOPPED_PACKAGES, |
| 5263 | FLAG_INCLUDE_STOPPED_PACKAGES, |
| 5264 | FLAG_GRANT_PERSISTABLE_URI_PERMISSION, |
| 5265 | FLAG_GRANT_PREFIX_URI_PERMISSION, |
| 5266 | FLAG_DEBUG_TRIAGED_MISSING, |
| 5267 | FLAG_IGNORE_EPHEMERAL, |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 5268 | FLAG_ACTIVITY_MATCH_EXTERNAL, |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5269 | FLAG_ACTIVITY_NO_HISTORY, |
| 5270 | FLAG_ACTIVITY_SINGLE_TOP, |
| 5271 | FLAG_ACTIVITY_NEW_TASK, |
| 5272 | FLAG_ACTIVITY_MULTIPLE_TASK, |
| 5273 | FLAG_ACTIVITY_CLEAR_TOP, |
| 5274 | FLAG_ACTIVITY_FORWARD_RESULT, |
| 5275 | FLAG_ACTIVITY_PREVIOUS_IS_TOP, |
| 5276 | FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS, |
| 5277 | FLAG_ACTIVITY_BROUGHT_TO_FRONT, |
| 5278 | FLAG_ACTIVITY_RESET_TASK_IF_NEEDED, |
| 5279 | FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY, |
| 5280 | FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, |
| 5281 | FLAG_ACTIVITY_NEW_DOCUMENT, |
| 5282 | FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, |
| 5283 | FLAG_ACTIVITY_NO_USER_ACTION, |
| 5284 | FLAG_ACTIVITY_REORDER_TO_FRONT, |
| 5285 | FLAG_ACTIVITY_NO_ANIMATION, |
| 5286 | FLAG_ACTIVITY_CLEAR_TASK, |
| 5287 | FLAG_ACTIVITY_TASK_ON_HOME, |
| 5288 | FLAG_ACTIVITY_RETAIN_IN_RECENTS, |
| 5289 | FLAG_ACTIVITY_LAUNCH_ADJACENT, |
| 5290 | FLAG_RECEIVER_REGISTERED_ONLY, |
| 5291 | FLAG_RECEIVER_REPLACE_PENDING, |
| 5292 | FLAG_RECEIVER_FOREGROUND, |
| 5293 | FLAG_RECEIVER_NO_ABORT, |
| 5294 | FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT, |
| 5295 | FLAG_RECEIVER_BOOT_UPGRADE, |
| 5296 | FLAG_RECEIVER_INCLUDE_BACKGROUND, |
| 5297 | FLAG_RECEIVER_EXCLUDE_BACKGROUND, |
| 5298 | FLAG_RECEIVER_FROM_SHELL, |
| 5299 | FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS, |
| 5300 | }) |
| 5301 | @Retention(RetentionPolicy.SOURCE) |
| 5302 | public @interface Flags {} |
| 5303 | |
| 5304 | /** @hide */ |
| 5305 | @IntDef(flag = true, prefix = { "FLAG_" }, value = { |
| 5306 | FLAG_FROM_BACKGROUND, |
| 5307 | FLAG_DEBUG_LOG_RESOLUTION, |
| 5308 | FLAG_EXCLUDE_STOPPED_PACKAGES, |
| 5309 | FLAG_INCLUDE_STOPPED_PACKAGES, |
| 5310 | FLAG_DEBUG_TRIAGED_MISSING, |
| 5311 | FLAG_IGNORE_EPHEMERAL, |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 5312 | FLAG_ACTIVITY_MATCH_EXTERNAL, |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5313 | FLAG_ACTIVITY_NO_HISTORY, |
| 5314 | FLAG_ACTIVITY_SINGLE_TOP, |
| 5315 | FLAG_ACTIVITY_NEW_TASK, |
| 5316 | FLAG_ACTIVITY_MULTIPLE_TASK, |
| 5317 | FLAG_ACTIVITY_CLEAR_TOP, |
| 5318 | FLAG_ACTIVITY_FORWARD_RESULT, |
| 5319 | FLAG_ACTIVITY_PREVIOUS_IS_TOP, |
| 5320 | FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS, |
| 5321 | FLAG_ACTIVITY_BROUGHT_TO_FRONT, |
| 5322 | FLAG_ACTIVITY_RESET_TASK_IF_NEEDED, |
| 5323 | FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY, |
| 5324 | FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, |
| 5325 | FLAG_ACTIVITY_NEW_DOCUMENT, |
| 5326 | FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, |
| 5327 | FLAG_ACTIVITY_NO_USER_ACTION, |
| 5328 | FLAG_ACTIVITY_REORDER_TO_FRONT, |
| 5329 | FLAG_ACTIVITY_NO_ANIMATION, |
| 5330 | FLAG_ACTIVITY_CLEAR_TASK, |
| 5331 | FLAG_ACTIVITY_TASK_ON_HOME, |
| 5332 | FLAG_ACTIVITY_RETAIN_IN_RECENTS, |
| 5333 | FLAG_ACTIVITY_LAUNCH_ADJACENT, |
| 5334 | FLAG_RECEIVER_REGISTERED_ONLY, |
| 5335 | FLAG_RECEIVER_REPLACE_PENDING, |
| 5336 | FLAG_RECEIVER_FOREGROUND, |
| 5337 | FLAG_RECEIVER_NO_ABORT, |
| 5338 | FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT, |
| 5339 | FLAG_RECEIVER_BOOT_UPGRADE, |
| 5340 | FLAG_RECEIVER_INCLUDE_BACKGROUND, |
| 5341 | FLAG_RECEIVER_EXCLUDE_BACKGROUND, |
| 5342 | FLAG_RECEIVER_FROM_SHELL, |
| 5343 | FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS, |
| 5344 | }) |
| 5345 | @Retention(RetentionPolicy.SOURCE) |
| 5346 | public @interface MutableFlags {} |
| 5347 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5348 | /** |
| 5349 | * If set, the recipient of this Intent will be granted permission to |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5350 | * 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] | 5351 | * specified in its ClipData. When applying to an Intent's ClipData, |
| 5352 | * all URIs as well as recursive traversals through data or other ClipData |
| 5353 | * in Intent items will be granted; only the grant flags of the top-level |
| 5354 | * Intent are used. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5355 | */ |
| 5356 | public static final int FLAG_GRANT_READ_URI_PERMISSION = 0x00000001; |
| 5357 | /** |
| 5358 | * If set, the recipient of this Intent will be granted permission to |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5359 | * 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] | 5360 | * specified in its ClipData. When applying to an Intent's ClipData, |
| 5361 | * all URIs as well as recursive traversals through data or other ClipData |
| 5362 | * in Intent items will be granted; only the grant flags of the top-level |
| 5363 | * Intent are used. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5364 | */ |
| 5365 | public static final int FLAG_GRANT_WRITE_URI_PERMISSION = 0x00000002; |
| 5366 | /** |
| 5367 | * Can be set by the caller to indicate that this Intent is coming from |
| 5368 | * a background operation, not from direct user interaction. |
| 5369 | */ |
| 5370 | public static final int FLAG_FROM_BACKGROUND = 0x00000004; |
| 5371 | /** |
| 5372 | * A flag you can enable for debugging: when set, log messages will be |
| 5373 | * printed during the resolution of this intent to show you what has |
| 5374 | * been found to create the final resolved list. |
| 5375 | */ |
| 5376 | public static final int FLAG_DEBUG_LOG_RESOLUTION = 0x00000008; |
Dianne Hackborn | e7f9721 | 2011-02-24 14:40:20 -0800 | [diff] [blame] | 5377 | /** |
| 5378 | * If set, this intent will not match any components in packages that |
| 5379 | * are currently stopped. If this is not set, then the default behavior |
| 5380 | * is to include such applications in the result. |
| 5381 | */ |
| 5382 | public static final int FLAG_EXCLUDE_STOPPED_PACKAGES = 0x00000010; |
| 5383 | /** |
| 5384 | * If set, this intent will always match any components in packages that |
| 5385 | * are currently stopped. This is the default behavior when |
| 5386 | * {@link #FLAG_EXCLUDE_STOPPED_PACKAGES} is not set. If both of these |
| 5387 | * flags are set, this one wins (it allows overriding of exclude for |
| 5388 | * places where the framework may automatically set the exclude flag). |
| 5389 | */ |
| 5390 | public static final int FLAG_INCLUDE_STOPPED_PACKAGES = 0x00000020; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5391 | |
| 5392 | /** |
Jeff Sharkey | 328ebf2 | 2013-03-21 18:09:39 -0700 | [diff] [blame] | 5393 | * When combined with {@link #FLAG_GRANT_READ_URI_PERMISSION} and/or |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5394 | * {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, the URI permission grant can be |
Jeff Sharkey | e66c177 | 2013-09-20 14:30:59 -0700 | [diff] [blame] | 5395 | * persisted across device reboots until explicitly revoked with |
| 5396 | * {@link Context#revokeUriPermission(Uri, int)}. This flag only offers the |
| 5397 | * grant for possible persisting; the receiving application must call |
| 5398 | * {@link ContentResolver#takePersistableUriPermission(Uri, int)} to |
| 5399 | * actually persist. |
| 5400 | * |
| 5401 | * @see ContentResolver#takePersistableUriPermission(Uri, int) |
| 5402 | * @see ContentResolver#releasePersistableUriPermission(Uri, int) |
| 5403 | * @see ContentResolver#getPersistedUriPermissions() |
Jeff Sharkey | adef88a | 2013-10-15 13:54:44 -0700 | [diff] [blame] | 5404 | * @see ContentResolver#getOutgoingPersistedUriPermissions() |
Jeff Sharkey | 328ebf2 | 2013-03-21 18:09:39 -0700 | [diff] [blame] | 5405 | */ |
Jeff Sharkey | e66c177 | 2013-09-20 14:30:59 -0700 | [diff] [blame] | 5406 | public static final int FLAG_GRANT_PERSISTABLE_URI_PERMISSION = 0x00000040; |
Jeff Sharkey | 328ebf2 | 2013-03-21 18:09:39 -0700 | [diff] [blame] | 5407 | |
| 5408 | /** |
Jeff Sharkey | 846318a | 2014-04-04 12:12:41 -0700 | [diff] [blame] | 5409 | * When combined with {@link #FLAG_GRANT_READ_URI_PERMISSION} and/or |
| 5410 | * {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, the URI permission grant |
| 5411 | * applies to any URI that is a prefix match against the original granted |
| 5412 | * URI. (Without this flag, the URI must match exactly for access to be |
| 5413 | * granted.) Another URI is considered a prefix match only when scheme, |
| 5414 | * authority, and all path segments defined by the prefix are an exact |
| 5415 | * match. |
| 5416 | */ |
| 5417 | public static final int FLAG_GRANT_PREFIX_URI_PERMISSION = 0x00000080; |
| 5418 | |
| 5419 | /** |
Jeff Sharkey | 2a9e3f8 | 2015-12-18 10:57:58 -0700 | [diff] [blame] | 5420 | * Internal flag used to indicate that a system component has done their |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 5421 | * homework and verified that they correctly handle packages and components |
| 5422 | * that come and go over time. In particular: |
| 5423 | * <ul> |
| 5424 | * <li>Apps installed on external storage, which will appear to be |
| 5425 | * uninstalled while the the device is ejected. |
| 5426 | * <li>Apps with encryption unaware components, which will appear to not |
| 5427 | * exist while the device is locked. |
| 5428 | * </ul> |
Jeff Sharkey | 2a9e3f8 | 2015-12-18 10:57:58 -0700 | [diff] [blame] | 5429 | * |
| 5430 | * @hide |
| 5431 | */ |
Jeff Sharkey | 2f3e353 | 2015-12-21 14:16:43 -0700 | [diff] [blame] | 5432 | public static final int FLAG_DEBUG_TRIAGED_MISSING = 0x00000100; |
Jeff Sharkey | 2a9e3f8 | 2015-12-18 10:57:58 -0700 | [diff] [blame] | 5433 | |
| 5434 | /** |
Todd Kennedy | 8e2d9d1 | 2016-06-28 14:09:55 -0700 | [diff] [blame] | 5435 | * Internal flag used to indicate ephemeral applications should not be |
| 5436 | * considered when resolving the intent. |
| 5437 | * |
| 5438 | * @hide |
| 5439 | */ |
| 5440 | public static final int FLAG_IGNORE_EPHEMERAL = 0x00000200; |
| 5441 | |
| 5442 | /** |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 5443 | * If set, the new activity is not kept in the history stack. As soon as |
| 5444 | * the user navigates away from it, the activity is finished. This may also |
| 5445 | * be set with the {@link android.R.styleable#AndroidManifestActivity_noHistory |
| 5446 | * noHistory} attribute. |
Ricardo Cervera | 92f6a74 | 2014-04-04 11:17:06 -0700 | [diff] [blame] | 5447 | * |
| 5448 | * <p>If set, {@link android.app.Activity#onActivityResult onActivityResult()} |
| 5449 | * is never invoked when the current activity starts a new activity which |
| 5450 | * sets a result and finishes. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5451 | */ |
| 5452 | public static final int FLAG_ACTIVITY_NO_HISTORY = 0x40000000; |
| 5453 | /** |
| 5454 | * If set, the activity will not be launched if it is already running |
| 5455 | * at the top of the history stack. |
| 5456 | */ |
| 5457 | public static final int FLAG_ACTIVITY_SINGLE_TOP = 0x20000000; |
| 5458 | /** |
| 5459 | * If set, this activity will become the start of a new task on this |
| 5460 | * history stack. A task (from the activity that started it to the |
| 5461 | * next task activity) defines an atomic group of activities that the |
| 5462 | * user can move to. Tasks can be moved to the foreground and background; |
| 5463 | * 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] | 5464 | * the same order. See |
Scott Main | 7aee61f | 2011-02-08 11:25:01 -0800 | [diff] [blame] | 5465 | * <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back |
| 5466 | * Stack</a> for more information about tasks. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5467 | * |
| 5468 | * <p>This flag is generally used by activities that want |
| 5469 | * to present a "launcher" style behavior: they give the user a list of |
| 5470 | * separate things that can be done, which otherwise run completely |
| 5471 | * independently of the activity launching them. |
| 5472 | * |
| 5473 | * <p>When using this flag, if a task is already running for the activity |
| 5474 | * you are now starting, then a new activity will not be started; instead, |
| 5475 | * the current task will simply be brought to the front of the screen with |
| 5476 | * the state it was last in. See {@link #FLAG_ACTIVITY_MULTIPLE_TASK} for a flag |
| 5477 | * to disable this behavior. |
| 5478 | * |
| 5479 | * <p>This flag can not be used when the caller is requesting a result from |
| 5480 | * the activity being launched. |
| 5481 | */ |
| 5482 | public static final int FLAG_ACTIVITY_NEW_TASK = 0x10000000; |
| 5483 | /** |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5484 | * This flag is used to create a new task and launch an activity into it. |
| 5485 | * This flag is always paired with either {@link #FLAG_ACTIVITY_NEW_DOCUMENT} |
| 5486 | * or {@link #FLAG_ACTIVITY_NEW_TASK}. In both cases these flags alone would |
| 5487 | * search through existing tasks for ones matching this Intent. Only if no such |
| 5488 | * task is found would a new task be created. When paired with |
| 5489 | * FLAG_ACTIVITY_MULTIPLE_TASK both of these behaviors are modified to skip |
| 5490 | * the search for a matching task and unconditionally start a new task. |
| 5491 | * |
| 5492 | * <strong>When used with {@link #FLAG_ACTIVITY_NEW_TASK} do not use this |
| 5493 | * flag unless you are implementing your own |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5494 | * top-level application launcher.</strong> Used in conjunction with |
| 5495 | * {@link #FLAG_ACTIVITY_NEW_TASK} to disable the |
| 5496 | * behavior of bringing an existing task to the foreground. When set, |
| 5497 | * a new task is <em>always</em> started to host the Activity for the |
| 5498 | * Intent, regardless of whether there is already an existing task running |
| 5499 | * the same thing. |
| 5500 | * |
| 5501 | * <p><strong>Because the default system does not include graphical task management, |
| 5502 | * you should not use this flag unless you provide some way for a user to |
| 5503 | * return back to the tasks you have launched.</strong> |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 5504 | * |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5505 | * See {@link #FLAG_ACTIVITY_NEW_DOCUMENT} for details of this flag's use for |
| 5506 | * creating new document tasks. |
| 5507 | * |
| 5508 | * <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] | 5509 | * {@link #FLAG_ACTIVITY_NEW_DOCUMENT} is not also set. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5510 | * |
Scott Main | 7aee61f | 2011-02-08 11:25:01 -0800 | [diff] [blame] | 5511 | * <p>See |
| 5512 | * <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back |
| 5513 | * Stack</a> for more information about tasks. |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5514 | * |
| 5515 | * @see #FLAG_ACTIVITY_NEW_DOCUMENT |
| 5516 | * @see #FLAG_ACTIVITY_NEW_TASK |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5517 | */ |
| 5518 | public static final int FLAG_ACTIVITY_MULTIPLE_TASK = 0x08000000; |
| 5519 | /** |
| 5520 | * If set, and the activity being launched is already running in the |
| 5521 | * current task, then instead of launching a new instance of that activity, |
| 5522 | * all of the other activities on top of it will be closed and this Intent |
| 5523 | * will be delivered to the (now on top) old activity as a new Intent. |
| 5524 | * |
| 5525 | * <p>For example, consider a task consisting of the activities: A, B, C, D. |
| 5526 | * If D calls startActivity() with an Intent that resolves to the component |
| 5527 | * of activity B, then C and D will be finished and B receive the given |
| 5528 | * Intent, resulting in the stack now being: A, B. |
| 5529 | * |
Dianne Hackborn | aa52f9a | 2009-08-25 16:01:15 -0700 | [diff] [blame] | 5530 | * <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] | 5531 | * either receive the new intent you are starting here in its |
| 5532 | * 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] | 5533 | * 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] | 5534 | * default) and you have not set {@link #FLAG_ACTIVITY_SINGLE_TOP} in |
| 5535 | * the same intent, then it will be finished and re-created; for all other |
| 5536 | * launch modes or if {@link #FLAG_ACTIVITY_SINGLE_TOP} is set then this |
| 5537 | * 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] | 5538 | * |
| 5539 | * <p>This launch mode can also be used to good effect in conjunction with |
| 5540 | * {@link #FLAG_ACTIVITY_NEW_TASK}: if used to start the root activity |
| 5541 | * of a task, it will bring any currently running instance of that task |
| 5542 | * to the foreground, and then clear it to its root state. This is |
| 5543 | * especially useful, for example, when launching an activity from the |
| 5544 | * notification manager. |
| 5545 | * |
Scott Main | 7aee61f | 2011-02-08 11:25:01 -0800 | [diff] [blame] | 5546 | * <p>See |
| 5547 | * <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back |
| 5548 | * Stack</a> for more information about tasks. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5549 | */ |
| 5550 | public static final int FLAG_ACTIVITY_CLEAR_TOP = 0x04000000; |
| 5551 | /** |
| 5552 | * If set and this intent is being used to launch a new activity from an |
| 5553 | * existing one, then the reply target of the existing activity will be |
| 5554 | * transfered to the new activity. This way the new activity can call |
| 5555 | * {@link android.app.Activity#setResult} and have that result sent back to |
| 5556 | * the reply target of the original activity. |
| 5557 | */ |
| 5558 | public static final int FLAG_ACTIVITY_FORWARD_RESULT = 0x02000000; |
| 5559 | /** |
| 5560 | * If set and this intent is being used to launch a new activity from an |
| 5561 | * existing one, the current activity will not be counted as the top |
| 5562 | * activity for deciding whether the new intent should be delivered to |
| 5563 | * the top instead of starting a new one. The previous activity will |
| 5564 | * be used as the top, with the assumption being that the current activity |
| 5565 | * will finish itself immediately. |
| 5566 | */ |
| 5567 | public static final int FLAG_ACTIVITY_PREVIOUS_IS_TOP = 0x01000000; |
| 5568 | /** |
| 5569 | * If set, the new activity is not kept in the list of recently launched |
| 5570 | * activities. |
| 5571 | */ |
| 5572 | public static final int FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS = 0x00800000; |
| 5573 | /** |
| 5574 | * This flag is not normally set by application code, but set for you by |
| 5575 | * the system as described in the |
| 5576 | * {@link android.R.styleable#AndroidManifestActivity_launchMode |
| 5577 | * launchMode} documentation for the singleTask mode. |
| 5578 | */ |
| 5579 | public static final int FLAG_ACTIVITY_BROUGHT_TO_FRONT = 0x00400000; |
| 5580 | /** |
| 5581 | * If set, and this activity is either being started in a new task or |
| 5582 | * bringing to the top an existing task, then it will be launched as |
| 5583 | * the front door of the task. This will result in the application of |
| 5584 | * any affinities needed to have that task in the proper state (either |
| 5585 | * moving activities to or from it), or simply resetting that task to |
| 5586 | * its initial state if needed. |
| 5587 | */ |
| 5588 | public static final int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED = 0x00200000; |
| 5589 | /** |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 5590 | * This flag is not normally set by application code, but set for you by |
| 5591 | * the system if this activity is being launched from history |
| 5592 | * (longpress home key). |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5593 | */ |
| 5594 | 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] | 5595 | /** |
Craig Mautner | f357c0c | 2014-06-09 09:23:27 -0700 | [diff] [blame] | 5596 | * @deprecated As of API 21 this performs identically to |
| 5597 | * {@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] | 5598 | */ |
Aurimas Liutikas | 514c5ef | 2016-05-24 15:22:55 -0700 | [diff] [blame] | 5599 | @Deprecated |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 5600 | 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] | 5601 | /** |
Craig Mautner | 026596b | 2014-05-21 15:35:44 -0700 | [diff] [blame] | 5602 | * This flag is used to open a document into a new task rooted at the activity launched |
| 5603 | * by this Intent. Through the use of this flag, or its equivalent attribute, |
| 5604 | * {@link android.R.attr#documentLaunchMode} multiple instances of the same activity |
Chet Haase | 0d1c27a | 2014-11-03 18:35:16 +0000 | [diff] [blame] | 5605 | * containing different documents will appear in the recent tasks list. |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5606 | * |
Craig Mautner | 026596b | 2014-05-21 15:35:44 -0700 | [diff] [blame] | 5607 | * <p>The use of the activity attribute form of this, |
| 5608 | * {@link android.R.attr#documentLaunchMode}, is |
| 5609 | * preferred over the Intent flag described here. The attribute form allows the |
| 5610 | * Activity to specify multiple document behavior for all launchers of the Activity |
| 5611 | * 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] | 5612 | * |
Dianne Hackborn | 13420f2 | 2014-07-18 15:43:56 -0700 | [diff] [blame] | 5613 | * <p>Note that the default semantics of this flag w.r.t. whether the recents entry for |
| 5614 | * it is kept after the activity is finished is different than the use of |
| 5615 | * {@link #FLAG_ACTIVITY_NEW_TASK} and {@link android.R.attr#documentLaunchMode} -- if |
| 5616 | * this flag is being used to create a new recents entry, then by default that entry |
| 5617 | * will be removed once the activity is finished. You can modify this behavior with |
| 5618 | * {@link #FLAG_ACTIVITY_RETAIN_IN_RECENTS}. |
| 5619 | * |
Craig Mautner | 026596b | 2014-05-21 15:35:44 -0700 | [diff] [blame] | 5620 | * <p>FLAG_ACTIVITY_NEW_DOCUMENT may be used in conjunction with {@link |
| 5621 | * #FLAG_ACTIVITY_MULTIPLE_TASK}. When used alone it is the |
| 5622 | * equivalent of the Activity manifest specifying {@link |
| 5623 | * android.R.attr#documentLaunchMode}="intoExisting". When used with |
| 5624 | * FLAG_ACTIVITY_MULTIPLE_TASK it is the equivalent of the Activity manifest specifying |
| 5625 | * {@link android.R.attr#documentLaunchMode}="always". |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5626 | * |
Craig Mautner | 026596b | 2014-05-21 15:35:44 -0700 | [diff] [blame] | 5627 | * Refer to {@link android.R.attr#documentLaunchMode} for more information. |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5628 | * |
Craig Mautner | 026596b | 2014-05-21 15:35:44 -0700 | [diff] [blame] | 5629 | * @see android.R.attr#documentLaunchMode |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 5630 | * @see #FLAG_ACTIVITY_MULTIPLE_TASK |
| 5631 | */ |
Craig Mautner | f357c0c | 2014-06-09 09:23:27 -0700 | [diff] [blame] | 5632 | 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] | 5633 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5634 | * 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] | 5635 | * callback from occurring on the current frontmost activity before it is |
| 5636 | * 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] | 5637 | * |
The Android Open Source Project | f1e484a | 2009-01-22 00:13:42 -0800 | [diff] [blame] | 5638 | * <p>Typically, an activity can rely on that callback to indicate that an |
| 5639 | * explicit user action has caused their activity to be moved out of the |
| 5640 | * foreground. The callback marks an appropriate point in the activity's |
| 5641 | * lifecycle for it to dismiss any notifications that it intends to display |
| 5642 | * "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] | 5643 | * |
The Android Open Source Project | f1e484a | 2009-01-22 00:13:42 -0800 | [diff] [blame] | 5644 | * <p>If an activity is ever started via any non-user-driven events such as |
| 5645 | * phone-call receipt or an alarm handler, this flag should be passed to {@link |
| 5646 | * Context#startActivity Context.startActivity}, ensuring that the pausing |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 5647 | * 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] | 5648 | */ |
| 5649 | 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] | 5650 | /** |
| 5651 | * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, |
| 5652 | * this flag will cause the launched activity to be brought to the front of its |
| 5653 | * task's history stack if it is already running. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 5654 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5655 | * <p>For example, consider a task consisting of four activities: A, B, C, D. |
| 5656 | * If D calls startActivity() with an Intent that resolves to the component |
| 5657 | * of activity B, then B will be brought to the front of the history stack, |
| 5658 | * with this resulting order: A, C, D, B. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 5659 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5660 | * 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] | 5661 | * specified. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5662 | */ |
| 5663 | 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] | 5664 | /** |
Dianne Hackborn | bfe319e | 2009-09-21 00:34:05 -0700 | [diff] [blame] | 5665 | * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, |
| 5666 | * this flag will prevent the system from applying an activity transition |
| 5667 | * animation to go to the next activity state. This doesn't mean an |
| 5668 | * animation will never run -- if another activity change happens that doesn't |
| 5669 | * specify this flag before the activity started here is displayed, then |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame] | 5670 | * 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] | 5671 | * when you are going to do a series of activity operations but the |
| 5672 | * animation seen by the user shouldn't be driven by the first activity |
| 5673 | * change but rather a later one. |
| 5674 | */ |
| 5675 | public static final int FLAG_ACTIVITY_NO_ANIMATION = 0X00010000; |
| 5676 | /** |
Dianne Hackborn | 621e17d | 2010-11-22 15:59:56 -0800 | [diff] [blame] | 5677 | * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, |
| 5678 | * this flag will cause any existing task that would be associated with the |
| 5679 | * activity to be cleared before the activity is started. That is, the activity |
| 5680 | * becomes the new root of an otherwise empty task, and any old activities |
| 5681 | * are finished. This can only be used in conjunction with {@link #FLAG_ACTIVITY_NEW_TASK}. |
| 5682 | */ |
| 5683 | public static final int FLAG_ACTIVITY_CLEAR_TASK = 0X00008000; |
| 5684 | /** |
| 5685 | * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, |
| 5686 | * this flag will cause a newly launching task to be placed on top of the current |
| 5687 | * home activity task (if there is one). That is, pressing back from the task |
| 5688 | * will always return the user to home even if that was not the last activity they |
| 5689 | * saw. This can only be used in conjunction with {@link #FLAG_ACTIVITY_NEW_TASK}. |
| 5690 | */ |
| 5691 | public static final int FLAG_ACTIVITY_TASK_ON_HOME = 0X00004000; |
| 5692 | /** |
Dianne Hackborn | 13420f2 | 2014-07-18 15:43:56 -0700 | [diff] [blame] | 5693 | * By default a document created by {@link #FLAG_ACTIVITY_NEW_DOCUMENT} will |
| 5694 | * 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] | 5695 | * 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] | 5696 | * 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] | 5697 | * this flag. When set and the task's activity is finished, the recents |
| 5698 | * entry will remain in the interface for the user to re-launch it, like a |
| 5699 | * recents entry for a top-level application. |
| 5700 | * <p> |
| 5701 | * The receiving activity can override this request with |
| 5702 | * {@link android.R.attr#autoRemoveFromRecents} or by explcitly calling |
| 5703 | * {@link android.app.Activity#finishAndRemoveTask() |
Dianne Hackborn | 13420f2 | 2014-07-18 15:43:56 -0700 | [diff] [blame] | 5704 | * Activity.finishAndRemoveTask()}. |
Craig Mautner | 2dac056 | 2014-05-06 09:06:44 -0700 | [diff] [blame] | 5705 | */ |
Dianne Hackborn | 13420f2 | 2014-07-18 15:43:56 -0700 | [diff] [blame] | 5706 | public static final int FLAG_ACTIVITY_RETAIN_IN_RECENTS = 0x00002000; |
Craig Mautner | a228ae9 | 2014-07-09 05:44:55 -0700 | [diff] [blame] | 5707 | |
| 5708 | /** |
Wale Ogunwale | 2a25a62 | 2016-01-30 11:27:21 -0800 | [diff] [blame] | 5709 | * This flag is only used in split-screen multi-window mode. The new activity will be displayed |
| 5710 | * 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] | 5711 | * {@link #FLAG_ACTIVITY_NEW_TASK}. Also, setting {@link #FLAG_ACTIVITY_MULTIPLE_TASK} is |
| 5712 | * 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] | 5713 | */ |
Wale Ogunwale | 2a25a62 | 2016-01-30 11:27:21 -0800 | [diff] [blame] | 5714 | public static final int FLAG_ACTIVITY_LAUNCH_ADJACENT = 0x00001000; |
Filip Gruszczynski | 80e29f1 | 2015-12-14 14:58:30 -0800 | [diff] [blame] | 5715 | |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 5716 | |
| 5717 | /** |
Patrick Baumann | 92ae2c6 | 2018-05-10 10:10:26 -0700 | [diff] [blame] | 5718 | * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, |
| 5719 | * this flag will attempt to launch an instant app if no full app on the device can already |
| 5720 | * handle the intent. |
| 5721 | * <p> |
| 5722 | * When attempting to resolve instant apps externally, the following {@link Intent} properties |
| 5723 | * are supported: |
| 5724 | * <ul> |
| 5725 | * <li>{@link Intent#setAction(String)}</li> |
| 5726 | * <li>{@link Intent#addCategory(String)}</li> |
| 5727 | * <li>{@link Intent#setData(Uri)}</li> |
| 5728 | * <li>{@link Intent#setType(String)}</li> |
| 5729 | * <li>{@link Intent#setPackage(String)}</li> |
| 5730 | * <li>{@link Intent#addFlags(int)}</li> |
| 5731 | * </ul> |
| 5732 | * <p> |
| 5733 | * In the case that no instant app can be found, the installer will be launched to notify the |
| 5734 | * user that the intent could not be resolved. On devices that do not support instant apps, |
| 5735 | * the flag will be ignored. |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 5736 | */ |
| 5737 | public static final int FLAG_ACTIVITY_MATCH_EXTERNAL = 0x00000800; |
| 5738 | |
Filip Gruszczynski | 80e29f1 | 2015-12-14 14:58:30 -0800 | [diff] [blame] | 5739 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5740 | * If set, when sending a broadcast only registered receivers will be |
| 5741 | * called -- no BroadcastReceiver components will be launched. |
| 5742 | */ |
| 5743 | public static final int FLAG_RECEIVER_REGISTERED_ONLY = 0x40000000; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5744 | /** |
Dianne Hackborn | 1c633fc | 2009-12-08 19:45:14 -0800 | [diff] [blame] | 5745 | * If set, when sending a broadcast the new broadcast will replace |
| 5746 | * any existing pending broadcast that matches it. Matching is defined |
| 5747 | * by {@link Intent#filterEquals(Intent) Intent.filterEquals} returning |
| 5748 | * true for the intents of the two broadcasts. When a match is found, |
| 5749 | * the new broadcast (and receivers associated with it) will replace the |
| 5750 | * existing one in the pending broadcast list, remaining at the same |
| 5751 | * position in the list. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 5752 | * |
Dianne Hackborn | 1c633fc | 2009-12-08 19:45:14 -0800 | [diff] [blame] | 5753 | * <p>This flag is most typically used with sticky broadcasts, which |
| 5754 | * only care about delivering the most recent values of the broadcast |
| 5755 | * to their receivers. |
| 5756 | */ |
| 5757 | public static final int FLAG_RECEIVER_REPLACE_PENDING = 0x20000000; |
| 5758 | /** |
Christopher Tate | f46723b | 2012-01-26 14:19:24 -0800 | [diff] [blame] | 5759 | * If set, when sending a broadcast the recipient is allowed to run at |
| 5760 | * foreground priority, with a shorter timeout interval. During normal |
| 5761 | * broadcasts the receivers are not automatically hoisted out of the |
| 5762 | * background priority class. |
| 5763 | */ |
| 5764 | public static final int FLAG_RECEIVER_FOREGROUND = 0x10000000; |
| 5765 | /** |
Dianne Hackborn | 6285a32 | 2013-09-18 12:09:47 -0700 | [diff] [blame] | 5766 | * If this is an ordered broadcast, don't allow receivers to abort the broadcast. |
| 5767 | * They can still propagate results through to later receivers, but they can not prevent |
| 5768 | * later receivers from seeing the broadcast. |
| 5769 | */ |
| 5770 | public static final int FLAG_RECEIVER_NO_ABORT = 0x08000000; |
| 5771 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5772 | * If set, when sending a broadcast <i>before boot has completed</i> only |
| 5773 | * registered receivers will be called -- no BroadcastReceiver components |
| 5774 | * will be launched. Sticky intent state will be recorded properly even |
| 5775 | * if no receivers wind up being called. If {@link #FLAG_RECEIVER_REGISTERED_ONLY} |
| 5776 | * 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] | 5777 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5778 | * <p>This flag is only for use by system sevices as a convenience to |
| 5779 | * avoid having to implement a more complex mechanism around detection |
| 5780 | * of boot completion. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 5781 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 5782 | * @hide |
| 5783 | */ |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 5784 | @UnsupportedAppUsage |
Dianne Hackborn | 6285a32 | 2013-09-18 12:09:47 -0700 | [diff] [blame] | 5785 | public static final int FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT = 0x04000000; |
Dianne Hackborn | 9acc030 | 2009-08-25 00:27:12 -0700 | [diff] [blame] | 5786 | /** |
| 5787 | * Set when this broadcast is for a boot upgrade, a special mode that |
| 5788 | * allows the broadcast to be sent before the system is ready and launches |
| 5789 | * the app process with no providers running in it. |
| 5790 | * @hide |
| 5791 | */ |
Dianne Hackborn | 6285a32 | 2013-09-18 12:09:47 -0700 | [diff] [blame] | 5792 | public static final int FLAG_RECEIVER_BOOT_UPGRADE = 0x02000000; |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 5793 | /** |
| 5794 | * If set, the broadcast will always go to manifest receivers in background (cached |
| 5795 | * or not running) apps, regardless of whether that would be done by default. By |
| 5796 | * default they will only receive broadcasts if the broadcast has specified an |
| 5797 | * explicit component or package name. |
Christopher Tate | bdc3941 | 2017-01-23 12:21:13 -0800 | [diff] [blame] | 5798 | * |
| 5799 | * NOTE: dumpstate uses this flag numerically, so when its value is changed |
| 5800 | * the broadcast code there must also be changed to match. |
| 5801 | * |
Dianne Hackborn | 6ac42ae | 2015-12-08 17:22:10 -0800 | [diff] [blame] | 5802 | * @hide |
| 5803 | */ |
| 5804 | public static final int FLAG_RECEIVER_INCLUDE_BACKGROUND = 0x01000000; |
| 5805 | /** |
| 5806 | * If set, the broadcast will never go to manifest receivers in background (cached |
| 5807 | * or not running) apps, regardless of whether that would be done by default. By |
| 5808 | * default they will receive broadcasts if the broadcast has specified an |
| 5809 | * explicit component or package name. |
| 5810 | * @hide |
| 5811 | */ |
| 5812 | public static final int FLAG_RECEIVER_EXCLUDE_BACKGROUND = 0x00800000; |
Jeff Sharkey | 6a34e56 | 2016-12-21 09:56:00 -0700 | [diff] [blame] | 5813 | /** |
| 5814 | * If set, this broadcast is being sent from the shell. |
| 5815 | * @hide |
| 5816 | */ |
| 5817 | public static final int FLAG_RECEIVER_FROM_SHELL = 0x00400000; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5818 | |
Dianne Hackborn | fa82f22 | 2009-09-17 15:14:12 -0700 | [diff] [blame] | 5819 | /** |
Chad Brubaker | b7e34d5 | 2017-02-22 12:36:06 -0800 | [diff] [blame] | 5820 | * If set, the broadcast will be visible to receivers in Instant Apps. By default Instant Apps |
| 5821 | * will not receive broadcasts. |
| 5822 | * |
| 5823 | * <em>This flag has no effect when used by an Instant App.</em> |
| 5824 | */ |
| 5825 | public static final int FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS = 0x00200000; |
| 5826 | |
| 5827 | /** |
Dianne Hackborn | fa82f22 | 2009-09-17 15:14:12 -0700 | [diff] [blame] | 5828 | * @hide Flags that can't be changed with PendingIntent. |
| 5829 | */ |
Jeff Sharkey | 846318a | 2014-04-04 12:12:41 -0700 | [diff] [blame] | 5830 | public static final int IMMUTABLE_FLAGS = FLAG_GRANT_READ_URI_PERMISSION |
| 5831 | | FLAG_GRANT_WRITE_URI_PERMISSION | FLAG_GRANT_PERSISTABLE_URI_PERMISSION |
| 5832 | | FLAG_GRANT_PREFIX_URI_PERMISSION; |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 5833 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5834 | // --------------------------------------------------------------------- |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 5835 | // --------------------------------------------------------------------- |
| 5836 | // toUri() and parseUri() options. |
| 5837 | |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 5838 | /** @hide */ |
| 5839 | @IntDef(flag = true, prefix = { "URI_" }, value = { |
| 5840 | URI_ALLOW_UNSAFE, |
| 5841 | URI_ANDROID_APP_SCHEME, |
| 5842 | URI_INTENT_SCHEME, |
| 5843 | }) |
| 5844 | @Retention(RetentionPolicy.SOURCE) |
| 5845 | public @interface UriFlags {} |
| 5846 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 5847 | /** |
| 5848 | * Flag for use with {@link #toUri} and {@link #parseUri}: the URI string |
| 5849 | * always has the "intent:" scheme. This syntax can be used when you want |
| 5850 | * to later disambiguate between URIs that are intended to describe an |
| 5851 | * Intent vs. all others that should be treated as raw URIs. When used |
| 5852 | * with {@link #parseUri}, any other scheme will result in a generic |
| 5853 | * VIEW action for that raw URI. |
| 5854 | */ |
| 5855 | public static final int URI_INTENT_SCHEME = 1<<0; |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 5856 | |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 5857 | /** |
| 5858 | * Flag for use with {@link #toUri} and {@link #parseUri}: the URI string |
| 5859 | * always has the "android-app:" scheme. This is a variation of |
| 5860 | * {@link #URI_INTENT_SCHEME} whose format is simpler for the case of an |
| 5861 | * http/https URI being delivered to a specific package name. The format |
| 5862 | * is: |
| 5863 | * |
| 5864 | * <pre class="prettyprint"> |
Dianne Hackborn | 0ee10f6 | 2015-01-14 16:16:13 -0800 | [diff] [blame] | 5865 | * android-app://{package_id}[/{scheme}[/{host}[/{path}]]][#Intent;{...}]</pre> |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 5866 | * |
Dianne Hackborn | 0ee10f6 | 2015-01-14 16:16:13 -0800 | [diff] [blame] | 5867 | * <p>In this scheme, only the <code>package_id</code> is required. If you include a host, |
| 5868 | * you must also include a scheme; including a path also requires both a host and a scheme. |
| 5869 | * The final #Intent; fragment can be used without a scheme, host, or path. |
| 5870 | * Note that this can not be |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 5871 | * used with intents that have a {@link #setSelector}, since the base intent |
| 5872 | * will always have an explicit package name.</p> |
| 5873 | * |
| 5874 | * <p>Some examples of how this scheme maps to Intent objects:</p> |
| 5875 | * <table border="2" width="85%" align="center" frame="hsides" rules="rows"> |
| 5876 | * <colgroup align="left" /> |
| 5877 | * <colgroup align="left" /> |
| 5878 | * <thead> |
| 5879 | * <tr><th>URI</th> <th>Intent</th></tr> |
| 5880 | * </thead> |
| 5881 | * |
| 5882 | * <tbody> |
| 5883 | * <tr><td><code>android-app://com.example.app</code></td> |
| 5884 | * <td><table style="margin:0;border:0;cellpadding:0;cellspacing:0"> |
| 5885 | * <tr><td>Action: </td><td>{@link #ACTION_MAIN}</td></tr> |
| 5886 | * <tr><td>Package: </td><td><code>com.example.app</code></td></tr> |
| 5887 | * </table></td> |
| 5888 | * </tr> |
| 5889 | * <tr><td><code>android-app://com.example.app/http/example.com</code></td> |
| 5890 | * <td><table style="margin:0;border:0;cellpadding:0;cellspacing:0"> |
| 5891 | * <tr><td>Action: </td><td>{@link #ACTION_VIEW}</td></tr> |
| 5892 | * <tr><td>Data: </td><td><code>http://example.com/</code></td></tr> |
| 5893 | * <tr><td>Package: </td><td><code>com.example.app</code></td></tr> |
| 5894 | * </table></td> |
| 5895 | * </tr> |
| 5896 | * <tr><td><code>android-app://com.example.app/http/example.com/foo?1234</code></td> |
| 5897 | * <td><table style="margin:0;border:0;cellpadding:0;cellspacing:0"> |
| 5898 | * <tr><td>Action: </td><td>{@link #ACTION_VIEW}</td></tr> |
| 5899 | * <tr><td>Data: </td><td><code>http://example.com/foo?1234</code></td></tr> |
| 5900 | * <tr><td>Package: </td><td><code>com.example.app</code></td></tr> |
| 5901 | * </table></td> |
| 5902 | * </tr> |
| 5903 | * <tr><td><code>android-app://com.example.app/<br />#Intent;action=com.example.MY_ACTION;end</code></td> |
| 5904 | * <td><table style="margin:0;border:0;cellpadding:0;cellspacing:0"> |
| 5905 | * <tr><td>Action: </td><td><code>com.example.MY_ACTION</code></td></tr> |
| 5906 | * <tr><td>Package: </td><td><code>com.example.app</code></td></tr> |
| 5907 | * </table></td> |
| 5908 | * </tr> |
| 5909 | * <tr><td><code>android-app://com.example.app/http/example.com/foo?1234<br />#Intent;action=com.example.MY_ACTION;end</code></td> |
| 5910 | * <td><table style="margin:0;border:0;cellpadding:0;cellspacing:0"> |
| 5911 | * <tr><td>Action: </td><td><code>com.example.MY_ACTION</code></td></tr> |
| 5912 | * <tr><td>Data: </td><td><code>http://example.com/foo?1234</code></td></tr> |
| 5913 | * <tr><td>Package: </td><td><code>com.example.app</code></td></tr> |
| 5914 | * </table></td> |
| 5915 | * </tr> |
| 5916 | * <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> |
| 5917 | * <td><table border="" style="margin:0" > |
| 5918 | * <tr><td>Action: </td><td><code>com.example.MY_ACTION</code></td></tr> |
| 5919 | * <tr><td>Package: </td><td><code>com.example.app</code></td></tr> |
| 5920 | * <tr><td>Extras: </td><td><code>some_int=(int)100<br />some_str=(String)hello</code></td></tr> |
| 5921 | * </table></td> |
| 5922 | * </tr> |
| 5923 | * </tbody> |
| 5924 | * </table> |
| 5925 | */ |
| 5926 | public static final int URI_ANDROID_APP_SCHEME = 1<<1; |
| 5927 | |
Dianne Hackborn | 24b1c23 | 2014-11-20 17:17:39 -0800 | [diff] [blame] | 5928 | /** |
| 5929 | * Flag for use with {@link #toUri} and {@link #parseUri}: allow parsing |
| 5930 | * of unsafe information. In particular, the flags {@link #FLAG_GRANT_READ_URI_PERMISSION}, |
| 5931 | * {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, {@link #FLAG_GRANT_PERSISTABLE_URI_PERMISSION}, |
| 5932 | * and {@link #FLAG_GRANT_PREFIX_URI_PERMISSION} flags can not be set, so that the |
| 5933 | * generated Intent can not cause unexpected data access to happen. |
| 5934 | * |
| 5935 | * <p>If you do not trust the source of the URI being parsed, you should still do further |
| 5936 | * processing to protect yourself from it. In particular, when using it to start an |
| 5937 | * activity you should usually add in {@link #CATEGORY_BROWSABLE} to limit the activities |
| 5938 | * that can handle it.</p> |
| 5939 | */ |
| 5940 | public static final int URI_ALLOW_UNSAFE = 1<<2; |
| 5941 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 5942 | // --------------------------------------------------------------------- |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5943 | |
| 5944 | private String mAction; |
| 5945 | private Uri mData; |
| 5946 | private String mType; |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 5947 | private String mPackage; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5948 | private ComponentName mComponent; |
| 5949 | private int mFlags; |
Dianne Hackborn | add005c | 2013-07-17 18:43:12 -0700 | [diff] [blame] | 5950 | private ArraySet<String> mCategories; |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 5951 | @UnsupportedAppUsage |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5952 | private Bundle mExtras; |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 5953 | private Rect mSourceBounds; |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 5954 | private Intent mSelector; |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 5955 | private ClipData mClipData; |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 5956 | private int mContentUserHint = UserHandle.USER_CURRENT; |
Todd Kennedy | b3b43130 | 2017-03-20 16:05:48 -0700 | [diff] [blame] | 5957 | /** Token to track instant app launches. Local only; do not copy cross-process. */ |
| 5958 | private String mLaunchToken; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5959 | |
| 5960 | // --------------------------------------------------------------------- |
| 5961 | |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 5962 | private static final int COPY_MODE_ALL = 0; |
| 5963 | private static final int COPY_MODE_FILTER = 1; |
| 5964 | private static final int COPY_MODE_HISTORY = 2; |
| 5965 | |
| 5966 | /** @hide */ |
Jeff Sharkey | ce8db99 | 2017-12-13 20:05:05 -0700 | [diff] [blame] | 5967 | @IntDef(prefix = { "COPY_MODE_" }, value = { |
| 5968 | COPY_MODE_ALL, |
| 5969 | COPY_MODE_FILTER, |
| 5970 | COPY_MODE_HISTORY |
| 5971 | }) |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 5972 | @Retention(RetentionPolicy.SOURCE) |
| 5973 | public @interface CopyMode {} |
| 5974 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5975 | /** |
| 5976 | * Create an empty intent. |
| 5977 | */ |
| 5978 | public Intent() { |
| 5979 | } |
| 5980 | |
| 5981 | /** |
| 5982 | * Copy constructor. |
| 5983 | */ |
| 5984 | public Intent(Intent o) { |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 5985 | this(o, COPY_MODE_ALL); |
| 5986 | } |
| 5987 | |
| 5988 | private Intent(Intent o, @CopyMode int copyMode) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5989 | this.mAction = o.mAction; |
| 5990 | this.mData = o.mData; |
| 5991 | this.mType = o.mType; |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 5992 | this.mPackage = o.mPackage; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5993 | this.mComponent = o.mComponent; |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 5994 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5995 | if (o.mCategories != null) { |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 5996 | this.mCategories = new ArraySet<>(o.mCategories); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 5997 | } |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 5998 | |
| 5999 | if (copyMode != COPY_MODE_FILTER) { |
| 6000 | this.mFlags = o.mFlags; |
| 6001 | this.mContentUserHint = o.mContentUserHint; |
| 6002 | this.mLaunchToken = o.mLaunchToken; |
| 6003 | if (o.mSourceBounds != null) { |
| 6004 | this.mSourceBounds = new Rect(o.mSourceBounds); |
| 6005 | } |
| 6006 | if (o.mSelector != null) { |
| 6007 | this.mSelector = new Intent(o.mSelector); |
| 6008 | } |
| 6009 | |
| 6010 | if (copyMode != COPY_MODE_HISTORY) { |
| 6011 | if (o.mExtras != null) { |
| 6012 | this.mExtras = new Bundle(o.mExtras); |
| 6013 | } |
| 6014 | if (o.mClipData != null) { |
| 6015 | this.mClipData = new ClipData(o.mClipData); |
| 6016 | } |
| 6017 | } else { |
| 6018 | if (o.mExtras != null && !o.mExtras.maybeIsEmpty()) { |
| 6019 | this.mExtras = Bundle.STRIPPED; |
| 6020 | } |
| 6021 | |
| 6022 | // Also set "stripped" clip data when we ever log mClipData in the (broadcast) |
| 6023 | // history. |
| 6024 | } |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 6025 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6026 | } |
| 6027 | |
| 6028 | @Override |
| 6029 | public Object clone() { |
| 6030 | return new Intent(this); |
| 6031 | } |
| 6032 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6033 | /** |
| 6034 | * Make a clone of only the parts of the Intent that are relevant for |
| 6035 | * filter matching: the action, data, type, component, and categories. |
| 6036 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 6037 | public @NonNull Intent cloneFilter() { |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 6038 | return new Intent(this, COPY_MODE_FILTER); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6039 | } |
| 6040 | |
| 6041 | /** |
| 6042 | * Create an intent with a given action. All other fields (data, type, |
| 6043 | * class) are null. Note that the action <em>must</em> be in a |
| 6044 | * namespace because Intents are used globally in the system -- for |
| 6045 | * example the system VIEW action is android.intent.action.VIEW; an |
| 6046 | * application's custom action would be something like |
| 6047 | * com.google.app.myapp.CUSTOM_ACTION. |
| 6048 | * |
| 6049 | * @param action The Intent action, such as ACTION_VIEW. |
| 6050 | */ |
| 6051 | public Intent(String action) { |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 6052 | setAction(action); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6053 | } |
| 6054 | |
| 6055 | /** |
| 6056 | * Create an intent with a given action and for a given data url. Note |
| 6057 | * that the action <em>must</em> be in a namespace because Intents are |
| 6058 | * used globally in the system -- for example the system VIEW action is |
| 6059 | * android.intent.action.VIEW; an application's custom action would be |
| 6060 | * something like com.google.app.myapp.CUSTOM_ACTION. |
| 6061 | * |
Dianne Hackborn | b3cddae | 2009-04-13 16:54:00 -0700 | [diff] [blame] | 6062 | * <p><em>Note: scheme and host name matching in the Android framework is |
| 6063 | * case-sensitive, unlike the formal RFC. As a result, |
| 6064 | * you should always ensure that you write your Uri with these elements |
| 6065 | * using lower case letters, and normalize any Uris you receive from |
| 6066 | * outside of Android to ensure the scheme and host is lower case.</em></p> |
| 6067 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6068 | * @param action The Intent action, such as ACTION_VIEW. |
| 6069 | * @param uri The Intent data URI. |
| 6070 | */ |
| 6071 | public Intent(String action, Uri uri) { |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 6072 | setAction(action); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6073 | mData = uri; |
| 6074 | } |
| 6075 | |
| 6076 | /** |
| 6077 | * Create an intent for a specific component. All other fields (action, data, |
| 6078 | * type, class) are null, though they can be modified later with explicit |
| 6079 | * calls. This provides a convenient way to create an intent that is |
| 6080 | * intended to execute a hard-coded class name, rather than relying on the |
| 6081 | * system to find an appropriate class for you; see {@link #setComponent} |
| 6082 | * for more information on the repercussions of this. |
| 6083 | * |
| 6084 | * @param packageContext A Context of the application package implementing |
| 6085 | * this class. |
| 6086 | * @param cls The component class that is to be used for the intent. |
| 6087 | * |
| 6088 | * @see #setClass |
| 6089 | * @see #setComponent |
| 6090 | * @see #Intent(String, android.net.Uri , Context, Class) |
| 6091 | */ |
| 6092 | public Intent(Context packageContext, Class<?> cls) { |
| 6093 | mComponent = new ComponentName(packageContext, cls); |
| 6094 | } |
| 6095 | |
| 6096 | /** |
| 6097 | * 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] | 6098 | * 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] | 6099 | * construct the Intent and then calling {@link #setClass} to set its |
| 6100 | * class. |
| 6101 | * |
Dianne Hackborn | b3cddae | 2009-04-13 16:54:00 -0700 | [diff] [blame] | 6102 | * <p><em>Note: scheme and host name matching in the Android framework is |
| 6103 | * case-sensitive, unlike the formal RFC. As a result, |
| 6104 | * you should always ensure that you write your Uri with these elements |
| 6105 | * using lower case letters, and normalize any Uris you receive from |
| 6106 | * outside of Android to ensure the scheme and host is lower case.</em></p> |
| 6107 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6108 | * @param action The Intent action, such as ACTION_VIEW. |
| 6109 | * @param uri The Intent data URI. |
| 6110 | * @param packageContext A Context of the application package implementing |
| 6111 | * this class. |
| 6112 | * @param cls The component class that is to be used for the intent. |
| 6113 | * |
| 6114 | * @see #Intent(String, android.net.Uri) |
| 6115 | * @see #Intent(Context, Class) |
| 6116 | * @see #setClass |
| 6117 | * @see #setComponent |
| 6118 | */ |
| 6119 | public Intent(String action, Uri uri, |
| 6120 | Context packageContext, Class<?> cls) { |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 6121 | setAction(action); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6122 | mData = uri; |
| 6123 | mComponent = new ComponentName(packageContext, cls); |
| 6124 | } |
| 6125 | |
| 6126 | /** |
Dianne Hackborn | 30d7189 | 2010-12-11 10:37:55 -0800 | [diff] [blame] | 6127 | * Create an intent to launch the main (root) activity of a task. This |
| 6128 | * is the Intent that is started when the application's is launched from |
| 6129 | * Home. For anything else that wants to launch an application in the |
| 6130 | * same way, it is important that they use an Intent structured the same |
| 6131 | * way, and can use this function to ensure this is the case. |
| 6132 | * |
| 6133 | * <p>The returned Intent has the given Activity component as its explicit |
| 6134 | * component, {@link #ACTION_MAIN} as its action, and includes the |
| 6135 | * category {@link #CATEGORY_LAUNCHER}. This does <em>not</em> have |
| 6136 | * {@link #FLAG_ACTIVITY_NEW_TASK} set, though typically you will want |
| 6137 | * to do that through {@link #addFlags(int)} on the returned Intent. |
| 6138 | * |
| 6139 | * @param mainActivity The main activity component that this Intent will |
| 6140 | * launch. |
| 6141 | * @return Returns a newly created Intent that can be used to launch the |
| 6142 | * activity as a main application entry. |
| 6143 | * |
| 6144 | * @see #setClass |
| 6145 | * @see #setComponent |
| 6146 | */ |
| 6147 | public static Intent makeMainActivity(ComponentName mainActivity) { |
| 6148 | Intent intent = new Intent(ACTION_MAIN); |
| 6149 | intent.setComponent(mainActivity); |
| 6150 | intent.addCategory(CATEGORY_LAUNCHER); |
| 6151 | return intent; |
| 6152 | } |
| 6153 | |
| 6154 | /** |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 6155 | * Make an Intent for the main activity of an application, without |
| 6156 | * specifying a specific activity to run but giving a selector to find |
| 6157 | * the activity. This results in a final Intent that is structured |
| 6158 | * the same as when the application is launched from |
| 6159 | * Home. For anything else that wants to launch an application in the |
| 6160 | * same way, it is important that they use an Intent structured the same |
| 6161 | * way, and can use this function to ensure this is the case. |
| 6162 | * |
| 6163 | * <p>The returned Intent has {@link #ACTION_MAIN} as its action, and includes the |
| 6164 | * category {@link #CATEGORY_LAUNCHER}. This does <em>not</em> have |
| 6165 | * {@link #FLAG_ACTIVITY_NEW_TASK} set, though typically you will want |
| 6166 | * to do that through {@link #addFlags(int)} on the returned Intent. |
| 6167 | * |
| 6168 | * @param selectorAction The action name of the Intent's selector. |
| 6169 | * @param selectorCategory The name of a category to add to the Intent's |
| 6170 | * selector. |
| 6171 | * @return Returns a newly created Intent that can be used to launch the |
| 6172 | * activity as a main application entry. |
| 6173 | * |
| 6174 | * @see #setSelector(Intent) |
| 6175 | */ |
| 6176 | public static Intent makeMainSelectorActivity(String selectorAction, |
| 6177 | String selectorCategory) { |
| 6178 | Intent intent = new Intent(ACTION_MAIN); |
| 6179 | intent.addCategory(CATEGORY_LAUNCHER); |
| 6180 | Intent selector = new Intent(); |
| 6181 | selector.setAction(selectorAction); |
| 6182 | selector.addCategory(selectorCategory); |
| 6183 | intent.setSelector(selector); |
| 6184 | return intent; |
| 6185 | } |
| 6186 | |
| 6187 | /** |
Dianne Hackborn | 30d7189 | 2010-12-11 10:37:55 -0800 | [diff] [blame] | 6188 | * Make an Intent that can be used to re-launch an application's task |
| 6189 | * in its base state. This is like {@link #makeMainActivity(ComponentName)}, |
| 6190 | * but also sets the flags {@link #FLAG_ACTIVITY_NEW_TASK} and |
| 6191 | * {@link #FLAG_ACTIVITY_CLEAR_TASK}. |
| 6192 | * |
| 6193 | * @param mainActivity The activity component that is the root of the |
| 6194 | * task; this is the activity that has been published in the application's |
| 6195 | * manifest as the main launcher icon. |
| 6196 | * |
| 6197 | * @return Returns a newly created Intent that can be used to relaunch the |
| 6198 | * activity's task in its root state. |
| 6199 | */ |
| 6200 | public static Intent makeRestartActivityTask(ComponentName mainActivity) { |
| 6201 | Intent intent = makeMainActivity(mainActivity); |
| 6202 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
| 6203 | | Intent.FLAG_ACTIVITY_CLEAR_TASK); |
| 6204 | return intent; |
| 6205 | } |
| 6206 | |
| 6207 | /** |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6208 | * Call {@link #parseUri} with 0 flags. |
| 6209 | * @deprecated Use {@link #parseUri} instead. |
| 6210 | */ |
| 6211 | @Deprecated |
| 6212 | public static Intent getIntent(String uri) throws URISyntaxException { |
| 6213 | return parseUri(uri, 0); |
| 6214 | } |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 6215 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6216 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6217 | * Create an intent from a URI. This URI may encode the action, |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6218 | * category, and other intent fields, if it was returned by |
Dianne Hackborn | 7f20543 | 2009-07-28 00:13:47 -0700 | [diff] [blame] | 6219 | * {@link #toUri}. If the Intent was not generate by toUri(), its data |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6220 | * 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] | 6221 | * |
| 6222 | * <p>The URI given here must not be relative -- that is, it must include |
| 6223 | * the scheme and full path. |
| 6224 | * |
| 6225 | * @param uri The URI to turn into an Intent. |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 6226 | * @param flags Additional processing flags. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6227 | * |
| 6228 | * @return Intent The newly created Intent object. |
| 6229 | * |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6230 | * @throws URISyntaxException Throws URISyntaxError if the basic URI syntax |
| 6231 | * it bad (as parsed by the Uri class) or the Intent data within the |
| 6232 | * URI is invalid. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 6233 | * |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6234 | * @see #toUri |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6235 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 6236 | 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] | 6237 | int i = 0; |
| 6238 | try { |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6239 | final boolean androidApp = uri.startsWith("android-app:"); |
| 6240 | |
| 6241 | // Validate intent scheme if requested. |
| 6242 | if ((flags&(URI_INTENT_SCHEME|URI_ANDROID_APP_SCHEME)) != 0) { |
| 6243 | if (!uri.startsWith("intent:") && !androidApp) { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6244 | Intent intent = new Intent(ACTION_VIEW); |
| 6245 | try { |
| 6246 | intent.setData(Uri.parse(uri)); |
| 6247 | } catch (IllegalArgumentException e) { |
| 6248 | throw new URISyntaxException(uri, e.getMessage()); |
| 6249 | } |
| 6250 | return intent; |
| 6251 | } |
| 6252 | } |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 6253 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6254 | i = uri.lastIndexOf("#"); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6255 | // simple case |
| 6256 | if (i == -1) { |
| 6257 | if (!androidApp) { |
| 6258 | return new Intent(ACTION_VIEW, Uri.parse(uri)); |
| 6259 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6260 | |
| 6261 | // old format Intent URI |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6262 | } else if (!uri.startsWith("#Intent;", i)) { |
| 6263 | if (!androidApp) { |
Dianne Hackborn | 24b1c23 | 2014-11-20 17:17:39 -0800 | [diff] [blame] | 6264 | return getIntentOld(uri, flags); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6265 | } else { |
| 6266 | i = -1; |
| 6267 | } |
| 6268 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6269 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6270 | // new format |
| 6271 | Intent intent = new Intent(ACTION_VIEW); |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 6272 | Intent baseIntent = intent; |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6273 | boolean explicitAction = false; |
| 6274 | boolean inSelector = false; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6275 | |
| 6276 | // fetch data part, if present |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6277 | String scheme = null; |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6278 | String data; |
| 6279 | if (i >= 0) { |
| 6280 | data = uri.substring(0, i); |
| 6281 | i += 8; // length of "#Intent;" |
| 6282 | } else { |
| 6283 | data = uri; |
| 6284 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6285 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6286 | // loop over contents of Intent, all name=value; |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6287 | while (i >= 0 && !uri.startsWith("end", i)) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6288 | int eq = uri.indexOf('=', i); |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 6289 | if (eq < 0) eq = i-1; |
| 6290 | int semi = uri.indexOf(';', i); |
| 6291 | 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] | 6292 | |
| 6293 | // action |
| 6294 | if (uri.startsWith("action=", i)) { |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 6295 | intent.setAction(value); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6296 | if (!inSelector) { |
| 6297 | explicitAction = true; |
| 6298 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6299 | } |
| 6300 | |
| 6301 | // categories |
| 6302 | else if (uri.startsWith("category=", i)) { |
| 6303 | intent.addCategory(value); |
| 6304 | } |
| 6305 | |
| 6306 | // type |
| 6307 | else if (uri.startsWith("type=", i)) { |
| 6308 | intent.mType = value; |
| 6309 | } |
| 6310 | |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 6311 | // launch flags |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6312 | else if (uri.startsWith("launchFlags=", i)) { |
| 6313 | intent.mFlags = Integer.decode(value).intValue(); |
Dianne Hackborn | 24b1c23 | 2014-11-20 17:17:39 -0800 | [diff] [blame] | 6314 | if ((flags& URI_ALLOW_UNSAFE) == 0) { |
| 6315 | intent.mFlags &= ~IMMUTABLE_FLAGS; |
| 6316 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6317 | } |
| 6318 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6319 | // package |
| 6320 | else if (uri.startsWith("package=", i)) { |
| 6321 | intent.mPackage = value; |
| 6322 | } |
| 6323 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6324 | // component |
| 6325 | else if (uri.startsWith("component=", i)) { |
| 6326 | intent.mComponent = ComponentName.unflattenFromString(value); |
| 6327 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6328 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6329 | // scheme |
| 6330 | else if (uri.startsWith("scheme=", i)) { |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6331 | if (inSelector) { |
Dianne Hackborn | 80b1c56 | 2014-12-09 20:22:08 -0800 | [diff] [blame] | 6332 | intent.mData = Uri.parse(value + ":"); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6333 | } else { |
| 6334 | scheme = value; |
| 6335 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6336 | } |
| 6337 | |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 6338 | // source bounds |
| 6339 | else if (uri.startsWith("sourceBounds=", i)) { |
| 6340 | intent.mSourceBounds = Rect.unflattenFromString(value); |
| 6341 | } |
| 6342 | |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 6343 | // selector |
| 6344 | else if (semi == (i+3) && uri.startsWith("SEL", i)) { |
| 6345 | intent = new Intent(); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6346 | inSelector = true; |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 6347 | } |
| 6348 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6349 | // extra |
| 6350 | else { |
| 6351 | String key = Uri.decode(uri.substring(i + 2, eq)); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6352 | // create Bundle if it doesn't already exist |
| 6353 | if (intent.mExtras == null) intent.mExtras = new Bundle(); |
| 6354 | Bundle b = intent.mExtras; |
| 6355 | // add EXTRA |
| 6356 | if (uri.startsWith("S.", i)) b.putString(key, value); |
| 6357 | else if (uri.startsWith("B.", i)) b.putBoolean(key, Boolean.parseBoolean(value)); |
| 6358 | else if (uri.startsWith("b.", i)) b.putByte(key, Byte.parseByte(value)); |
| 6359 | else if (uri.startsWith("c.", i)) b.putChar(key, value.charAt(0)); |
| 6360 | else if (uri.startsWith("d.", i)) b.putDouble(key, Double.parseDouble(value)); |
| 6361 | else if (uri.startsWith("f.", i)) b.putFloat(key, Float.parseFloat(value)); |
| 6362 | else if (uri.startsWith("i.", i)) b.putInt(key, Integer.parseInt(value)); |
| 6363 | else if (uri.startsWith("l.", i)) b.putLong(key, Long.parseLong(value)); |
| 6364 | else if (uri.startsWith("s.", i)) b.putShort(key, Short.parseShort(value)); |
| 6365 | else throw new URISyntaxException(uri, "unknown EXTRA type", i); |
| 6366 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6367 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6368 | // move to the next item |
| 6369 | i = semi + 1; |
| 6370 | } |
| 6371 | |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6372 | if (inSelector) { |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 6373 | // The Intent had a selector; fix it up. |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6374 | if (baseIntent.mPackage == null) { |
| 6375 | baseIntent.setSelector(intent); |
| 6376 | } |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 6377 | intent = baseIntent; |
| 6378 | } |
| 6379 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6380 | if (data != null) { |
| 6381 | if (data.startsWith("intent:")) { |
| 6382 | data = data.substring(7); |
| 6383 | if (scheme != null) { |
| 6384 | data = scheme + ':' + data; |
| 6385 | } |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6386 | } else if (data.startsWith("android-app:")) { |
| 6387 | if (data.charAt(12) == '/' && data.charAt(13) == '/') { |
| 6388 | // Correctly formed android-app, first part is package name. |
| 6389 | int end = data.indexOf('/', 14); |
| 6390 | if (end < 0) { |
| 6391 | // All we have is a package name. |
| 6392 | intent.mPackage = data.substring(14); |
| 6393 | if (!explicitAction) { |
| 6394 | intent.setAction(ACTION_MAIN); |
| 6395 | } |
| 6396 | data = ""; |
| 6397 | } else { |
| 6398 | // Target the Intent at the given package name always. |
| 6399 | String authority = null; |
| 6400 | intent.mPackage = data.substring(14, end); |
| 6401 | int newEnd; |
Dianne Hackborn | 80b1c56 | 2014-12-09 20:22:08 -0800 | [diff] [blame] | 6402 | if ((end+1) < data.length()) { |
| 6403 | if ((newEnd=data.indexOf('/', end+1)) >= 0) { |
| 6404 | // Found a scheme, remember it. |
| 6405 | scheme = data.substring(end+1, newEnd); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6406 | end = newEnd; |
Dianne Hackborn | 80b1c56 | 2014-12-09 20:22:08 -0800 | [diff] [blame] | 6407 | if (end < data.length() && (newEnd=data.indexOf('/', end+1)) >= 0) { |
| 6408 | // Found a authority, remember it. |
| 6409 | authority = data.substring(end+1, newEnd); |
| 6410 | end = newEnd; |
| 6411 | } |
| 6412 | } else { |
| 6413 | // All we have is a scheme. |
| 6414 | scheme = data.substring(end+1); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 6415 | } |
| 6416 | } |
| 6417 | if (scheme == null) { |
| 6418 | // If there was no scheme, then this just targets the package. |
| 6419 | if (!explicitAction) { |
| 6420 | intent.setAction(ACTION_MAIN); |
| 6421 | } |
| 6422 | data = ""; |
| 6423 | } else if (authority == null) { |
| 6424 | data = scheme + ":"; |
| 6425 | } else { |
| 6426 | data = scheme + "://" + authority + data.substring(end); |
| 6427 | } |
| 6428 | } |
| 6429 | } else { |
| 6430 | data = ""; |
| 6431 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6432 | } |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 6433 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 6434 | if (data.length() > 0) { |
| 6435 | try { |
| 6436 | intent.mData = Uri.parse(data); |
| 6437 | } catch (IllegalArgumentException e) { |
| 6438 | throw new URISyntaxException(uri, e.getMessage()); |
| 6439 | } |
| 6440 | } |
| 6441 | } |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 6442 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6443 | return intent; |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6444 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6445 | } catch (IndexOutOfBoundsException e) { |
| 6446 | throw new URISyntaxException(uri, "illegal Intent URI format", i); |
| 6447 | } |
| 6448 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6449 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6450 | public static Intent getIntentOld(String uri) throws URISyntaxException { |
Dianne Hackborn | 24b1c23 | 2014-11-20 17:17:39 -0800 | [diff] [blame] | 6451 | return getIntentOld(uri, 0); |
| 6452 | } |
| 6453 | |
| 6454 | 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] | 6455 | Intent intent; |
| 6456 | |
| 6457 | int i = uri.lastIndexOf('#'); |
| 6458 | if (i >= 0) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6459 | String action = null; |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6460 | final int intentFragmentStart = i; |
| 6461 | boolean isIntentFragment = false; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6462 | |
| 6463 | i++; |
| 6464 | |
| 6465 | if (uri.regionMatches(i, "action(", 0, 7)) { |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6466 | isIntentFragment = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6467 | i += 7; |
| 6468 | int j = uri.indexOf(')', i); |
| 6469 | action = uri.substring(i, j); |
| 6470 | i = j + 1; |
| 6471 | } |
| 6472 | |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6473 | intent = new Intent(action); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6474 | |
| 6475 | if (uri.regionMatches(i, "categories(", 0, 11)) { |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6476 | isIntentFragment = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6477 | i += 11; |
| 6478 | int j = uri.indexOf(')', i); |
| 6479 | while (i < j) { |
| 6480 | int sep = uri.indexOf('!', i); |
Alan Viverette | 0adf32b | 2014-09-18 12:53:16 -0700 | [diff] [blame] | 6481 | if (sep < 0 || sep > j) sep = j; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6482 | if (i < sep) { |
| 6483 | intent.addCategory(uri.substring(i, sep)); |
| 6484 | } |
| 6485 | i = sep + 1; |
| 6486 | } |
| 6487 | i = j + 1; |
| 6488 | } |
| 6489 | |
| 6490 | if (uri.regionMatches(i, "type(", 0, 5)) { |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6491 | isIntentFragment = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6492 | i += 5; |
| 6493 | int j = uri.indexOf(')', i); |
| 6494 | intent.mType = uri.substring(i, j); |
| 6495 | i = j + 1; |
| 6496 | } |
| 6497 | |
| 6498 | if (uri.regionMatches(i, "launchFlags(", 0, 12)) { |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6499 | isIntentFragment = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6500 | i += 12; |
| 6501 | int j = uri.indexOf(')', i); |
| 6502 | intent.mFlags = Integer.decode(uri.substring(i, j)).intValue(); |
Dianne Hackborn | 24b1c23 | 2014-11-20 17:17:39 -0800 | [diff] [blame] | 6503 | if ((flags& URI_ALLOW_UNSAFE) == 0) { |
| 6504 | intent.mFlags &= ~IMMUTABLE_FLAGS; |
| 6505 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6506 | i = j + 1; |
| 6507 | } |
| 6508 | |
| 6509 | if (uri.regionMatches(i, "component(", 0, 10)) { |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6510 | isIntentFragment = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6511 | i += 10; |
| 6512 | int j = uri.indexOf(')', i); |
| 6513 | int sep = uri.indexOf('!', i); |
| 6514 | if (sep >= 0 && sep < j) { |
| 6515 | String pkg = uri.substring(i, sep); |
| 6516 | String cls = uri.substring(sep + 1, j); |
| 6517 | intent.mComponent = new ComponentName(pkg, cls); |
| 6518 | } |
| 6519 | i = j + 1; |
| 6520 | } |
| 6521 | |
| 6522 | if (uri.regionMatches(i, "extras(", 0, 7)) { |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6523 | isIntentFragment = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6524 | i += 7; |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6525 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6526 | final int closeParen = uri.indexOf(')', i); |
| 6527 | if (closeParen == -1) throw new URISyntaxException(uri, |
| 6528 | "EXTRA missing trailing ')'", i); |
| 6529 | |
| 6530 | while (i < closeParen) { |
| 6531 | // fetch the key value |
| 6532 | int j = uri.indexOf('=', i); |
| 6533 | if (j <= i + 1 || i >= closeParen) { |
| 6534 | throw new URISyntaxException(uri, "EXTRA missing '='", i); |
| 6535 | } |
| 6536 | char type = uri.charAt(i); |
| 6537 | i++; |
| 6538 | String key = uri.substring(i, j); |
| 6539 | i = j + 1; |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6540 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6541 | // get type-value |
| 6542 | j = uri.indexOf('!', i); |
| 6543 | if (j == -1 || j >= closeParen) j = closeParen; |
| 6544 | if (i >= j) throw new URISyntaxException(uri, "EXTRA missing '!'", i); |
| 6545 | String value = uri.substring(i, j); |
| 6546 | i = j; |
| 6547 | |
| 6548 | // create Bundle if it doesn't already exist |
| 6549 | if (intent.mExtras == null) intent.mExtras = new Bundle(); |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6550 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6551 | // add item to bundle |
| 6552 | try { |
| 6553 | switch (type) { |
| 6554 | case 'S': |
| 6555 | intent.mExtras.putString(key, Uri.decode(value)); |
| 6556 | break; |
| 6557 | case 'B': |
| 6558 | intent.mExtras.putBoolean(key, Boolean.parseBoolean(value)); |
| 6559 | break; |
| 6560 | case 'b': |
| 6561 | intent.mExtras.putByte(key, Byte.parseByte(value)); |
| 6562 | break; |
| 6563 | case 'c': |
| 6564 | intent.mExtras.putChar(key, Uri.decode(value).charAt(0)); |
| 6565 | break; |
| 6566 | case 'd': |
| 6567 | intent.mExtras.putDouble(key, Double.parseDouble(value)); |
| 6568 | break; |
| 6569 | case 'f': |
| 6570 | intent.mExtras.putFloat(key, Float.parseFloat(value)); |
| 6571 | break; |
| 6572 | case 'i': |
| 6573 | intent.mExtras.putInt(key, Integer.parseInt(value)); |
| 6574 | break; |
| 6575 | case 'l': |
| 6576 | intent.mExtras.putLong(key, Long.parseLong(value)); |
| 6577 | break; |
| 6578 | case 's': |
| 6579 | intent.mExtras.putShort(key, Short.parseShort(value)); |
| 6580 | break; |
| 6581 | default: |
| 6582 | throw new URISyntaxException(uri, "EXTRA has unknown type", i); |
| 6583 | } |
| 6584 | } catch (NumberFormatException e) { |
| 6585 | throw new URISyntaxException(uri, "EXTRA value can't be parsed", i); |
| 6586 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 6587 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6588 | char ch = uri.charAt(i); |
| 6589 | if (ch == ')') break; |
| 6590 | if (ch != '!') throw new URISyntaxException(uri, "EXTRA missing '!'", i); |
| 6591 | i++; |
| 6592 | } |
| 6593 | } |
| 6594 | |
Dianne Hackborn | 6cca159 | 2009-09-20 12:40:03 -0700 | [diff] [blame] | 6595 | if (isIntentFragment) { |
| 6596 | intent.mData = Uri.parse(uri.substring(0, intentFragmentStart)); |
| 6597 | } else { |
| 6598 | intent.mData = Uri.parse(uri); |
| 6599 | } |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 6600 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 6601 | if (intent.mAction == null) { |
| 6602 | // By default, if no action is specified, then use VIEW. |
| 6603 | intent.mAction = ACTION_VIEW; |
| 6604 | } |
| 6605 | |
| 6606 | } else { |
| 6607 | intent = new Intent(ACTION_VIEW, Uri.parse(uri)); |
| 6608 | } |
| 6609 | |
| 6610 | return intent; |
| 6611 | } |
| 6612 | |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 6613 | /** @hide */ |
| 6614 | public interface CommandOptionHandler { |
| 6615 | boolean handleOption(String opt, ShellCommand cmd); |
| 6616 | } |
| 6617 | |
| 6618 | /** @hide */ |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 6619 | @UnsupportedAppUsage |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 6620 | public static Intent parseCommandArgs(ShellCommand cmd, CommandOptionHandler optionHandler) |
| 6621 | throws URISyntaxException { |
| 6622 | Intent intent = new Intent(); |
| 6623 | Intent baseIntent = intent; |
| 6624 | boolean hasIntentInfo = false; |
| 6625 | |
| 6626 | Uri data = null; |
| 6627 | String type = null; |
| 6628 | |
| 6629 | String opt; |
| 6630 | while ((opt=cmd.getNextOption()) != null) { |
| 6631 | switch (opt) { |
| 6632 | case "-a": |
| 6633 | intent.setAction(cmd.getNextArgRequired()); |
| 6634 | if (intent == baseIntent) { |
| 6635 | hasIntentInfo = true; |
| 6636 | } |
| 6637 | break; |
| 6638 | case "-d": |
| 6639 | data = Uri.parse(cmd.getNextArgRequired()); |
| 6640 | if (intent == baseIntent) { |
| 6641 | hasIntentInfo = true; |
| 6642 | } |
| 6643 | break; |
| 6644 | case "-t": |
| 6645 | type = cmd.getNextArgRequired(); |
| 6646 | if (intent == baseIntent) { |
| 6647 | hasIntentInfo = true; |
| 6648 | } |
| 6649 | break; |
| 6650 | case "-c": |
| 6651 | intent.addCategory(cmd.getNextArgRequired()); |
| 6652 | if (intent == baseIntent) { |
| 6653 | hasIntentInfo = true; |
| 6654 | } |
| 6655 | break; |
| 6656 | case "-e": |
| 6657 | case "--es": { |
| 6658 | String key = cmd.getNextArgRequired(); |
| 6659 | String value = cmd.getNextArgRequired(); |
| 6660 | intent.putExtra(key, value); |
| 6661 | } |
| 6662 | break; |
| 6663 | case "--esn": { |
| 6664 | String key = cmd.getNextArgRequired(); |
| 6665 | intent.putExtra(key, (String) null); |
| 6666 | } |
| 6667 | break; |
| 6668 | case "--ei": { |
| 6669 | String key = cmd.getNextArgRequired(); |
| 6670 | String value = cmd.getNextArgRequired(); |
| 6671 | intent.putExtra(key, Integer.decode(value)); |
| 6672 | } |
| 6673 | break; |
| 6674 | case "--eu": { |
| 6675 | String key = cmd.getNextArgRequired(); |
| 6676 | String value = cmd.getNextArgRequired(); |
| 6677 | intent.putExtra(key, Uri.parse(value)); |
| 6678 | } |
| 6679 | break; |
| 6680 | case "--ecn": { |
| 6681 | String key = cmd.getNextArgRequired(); |
| 6682 | String value = cmd.getNextArgRequired(); |
| 6683 | ComponentName cn = ComponentName.unflattenFromString(value); |
| 6684 | if (cn == null) |
| 6685 | throw new IllegalArgumentException("Bad component name: " + value); |
| 6686 | intent.putExtra(key, cn); |
| 6687 | } |
| 6688 | break; |
| 6689 | case "--eia": { |
| 6690 | String key = cmd.getNextArgRequired(); |
| 6691 | String value = cmd.getNextArgRequired(); |
| 6692 | String[] strings = value.split(","); |
| 6693 | int[] list = new int[strings.length]; |
| 6694 | for (int i = 0; i < strings.length; i++) { |
| 6695 | list[i] = Integer.decode(strings[i]); |
| 6696 | } |
| 6697 | intent.putExtra(key, list); |
| 6698 | } |
| 6699 | break; |
| 6700 | case "--eial": { |
| 6701 | String key = cmd.getNextArgRequired(); |
| 6702 | String value = cmd.getNextArgRequired(); |
| 6703 | String[] strings = value.split(","); |
| 6704 | ArrayList<Integer> list = new ArrayList<>(strings.length); |
| 6705 | for (int i = 0; i < strings.length; i++) { |
| 6706 | list.add(Integer.decode(strings[i])); |
| 6707 | } |
| 6708 | intent.putExtra(key, list); |
| 6709 | } |
| 6710 | break; |
| 6711 | case "--el": { |
| 6712 | String key = cmd.getNextArgRequired(); |
| 6713 | String value = cmd.getNextArgRequired(); |
| 6714 | intent.putExtra(key, Long.valueOf(value)); |
| 6715 | } |
| 6716 | break; |
| 6717 | case "--ela": { |
| 6718 | String key = cmd.getNextArgRequired(); |
| 6719 | String value = cmd.getNextArgRequired(); |
| 6720 | String[] strings = value.split(","); |
| 6721 | long[] list = new long[strings.length]; |
| 6722 | for (int i = 0; i < strings.length; i++) { |
| 6723 | list[i] = Long.valueOf(strings[i]); |
| 6724 | } |
| 6725 | intent.putExtra(key, list); |
| 6726 | hasIntentInfo = true; |
| 6727 | } |
| 6728 | break; |
| 6729 | case "--elal": { |
| 6730 | String key = cmd.getNextArgRequired(); |
| 6731 | String value = cmd.getNextArgRequired(); |
| 6732 | String[] strings = value.split(","); |
| 6733 | ArrayList<Long> list = new ArrayList<>(strings.length); |
| 6734 | for (int i = 0; i < strings.length; i++) { |
| 6735 | list.add(Long.valueOf(strings[i])); |
| 6736 | } |
| 6737 | intent.putExtra(key, list); |
| 6738 | hasIntentInfo = true; |
| 6739 | } |
| 6740 | break; |
| 6741 | case "--ef": { |
| 6742 | String key = cmd.getNextArgRequired(); |
| 6743 | String value = cmd.getNextArgRequired(); |
| 6744 | intent.putExtra(key, Float.valueOf(value)); |
| 6745 | hasIntentInfo = true; |
| 6746 | } |
| 6747 | break; |
| 6748 | case "--efa": { |
| 6749 | String key = cmd.getNextArgRequired(); |
| 6750 | String value = cmd.getNextArgRequired(); |
| 6751 | String[] strings = value.split(","); |
| 6752 | float[] list = new float[strings.length]; |
| 6753 | for (int i = 0; i < strings.length; i++) { |
| 6754 | list[i] = Float.valueOf(strings[i]); |
| 6755 | } |
| 6756 | intent.putExtra(key, list); |
| 6757 | hasIntentInfo = true; |
| 6758 | } |
| 6759 | break; |
| 6760 | case "--efal": { |
| 6761 | String key = cmd.getNextArgRequired(); |
| 6762 | String value = cmd.getNextArgRequired(); |
| 6763 | String[] strings = value.split(","); |
| 6764 | ArrayList<Float> list = new ArrayList<>(strings.length); |
| 6765 | for (int i = 0; i < strings.length; i++) { |
| 6766 | list.add(Float.valueOf(strings[i])); |
| 6767 | } |
| 6768 | intent.putExtra(key, list); |
| 6769 | hasIntentInfo = true; |
| 6770 | } |
| 6771 | break; |
| 6772 | case "--esa": { |
| 6773 | String key = cmd.getNextArgRequired(); |
| 6774 | String value = cmd.getNextArgRequired(); |
| 6775 | // Split on commas unless they are preceeded by an escape. |
| 6776 | // The escape character must be escaped for the string and |
| 6777 | // again for the regex, thus four escape characters become one. |
| 6778 | String[] strings = value.split("(?<!\\\\),"); |
| 6779 | intent.putExtra(key, strings); |
| 6780 | hasIntentInfo = true; |
| 6781 | } |
| 6782 | break; |
| 6783 | case "--esal": { |
| 6784 | String key = cmd.getNextArgRequired(); |
| 6785 | String value = cmd.getNextArgRequired(); |
| 6786 | // Split on commas unless they are preceeded by an escape. |
| 6787 | // The escape character must be escaped for the string and |
| 6788 | // again for the regex, thus four escape characters become one. |
| 6789 | String[] strings = value.split("(?<!\\\\),"); |
| 6790 | ArrayList<String> list = new ArrayList<>(strings.length); |
| 6791 | for (int i = 0; i < strings.length; i++) { |
| 6792 | list.add(strings[i]); |
| 6793 | } |
| 6794 | intent.putExtra(key, list); |
| 6795 | hasIntentInfo = true; |
| 6796 | } |
| 6797 | break; |
| 6798 | case "--ez": { |
| 6799 | String key = cmd.getNextArgRequired(); |
| 6800 | String value = cmd.getNextArgRequired().toLowerCase(); |
| 6801 | // Boolean.valueOf() results in false for anything that is not "true", which is |
| 6802 | // error-prone in shell commands |
| 6803 | boolean arg; |
| 6804 | if ("true".equals(value) || "t".equals(value)) { |
| 6805 | arg = true; |
| 6806 | } else if ("false".equals(value) || "f".equals(value)) { |
| 6807 | arg = false; |
| 6808 | } else { |
| 6809 | try { |
| 6810 | arg = Integer.decode(value) != 0; |
| 6811 | } catch (NumberFormatException ex) { |
| 6812 | throw new IllegalArgumentException("Invalid boolean value: " + value); |
| 6813 | } |
| 6814 | } |
| 6815 | |
| 6816 | intent.putExtra(key, arg); |
| 6817 | } |
| 6818 | break; |
| 6819 | case "-n": { |
| 6820 | String str = cmd.getNextArgRequired(); |
| 6821 | ComponentName cn = ComponentName.unflattenFromString(str); |
| 6822 | if (cn == null) |
| 6823 | throw new IllegalArgumentException("Bad component name: " + str); |
| 6824 | intent.setComponent(cn); |
| 6825 | if (intent == baseIntent) { |
| 6826 | hasIntentInfo = true; |
| 6827 | } |
| 6828 | } |
| 6829 | break; |
| 6830 | case "-p": { |
| 6831 | String str = cmd.getNextArgRequired(); |
| 6832 | intent.setPackage(str); |
| 6833 | if (intent == baseIntent) { |
| 6834 | hasIntentInfo = true; |
| 6835 | } |
| 6836 | } |
| 6837 | break; |
| 6838 | case "-f": |
| 6839 | String str = cmd.getNextArgRequired(); |
| 6840 | intent.setFlags(Integer.decode(str).intValue()); |
| 6841 | break; |
| 6842 | case "--grant-read-uri-permission": |
| 6843 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 6844 | break; |
| 6845 | case "--grant-write-uri-permission": |
| 6846 | intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); |
| 6847 | break; |
| 6848 | case "--grant-persistable-uri-permission": |
| 6849 | intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); |
| 6850 | break; |
| 6851 | case "--grant-prefix-uri-permission": |
| 6852 | intent.addFlags(Intent.FLAG_GRANT_PREFIX_URI_PERMISSION); |
| 6853 | break; |
| 6854 | case "--exclude-stopped-packages": |
| 6855 | intent.addFlags(Intent.FLAG_EXCLUDE_STOPPED_PACKAGES); |
| 6856 | break; |
| 6857 | case "--include-stopped-packages": |
| 6858 | intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); |
| 6859 | break; |
| 6860 | case "--debug-log-resolution": |
| 6861 | intent.addFlags(Intent.FLAG_DEBUG_LOG_RESOLUTION); |
| 6862 | break; |
| 6863 | case "--activity-brought-to-front": |
| 6864 | intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); |
| 6865 | break; |
| 6866 | case "--activity-clear-top": |
| 6867 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); |
| 6868 | break; |
| 6869 | case "--activity-clear-when-task-reset": |
| 6870 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); |
| 6871 | break; |
| 6872 | case "--activity-exclude-from-recents": |
| 6873 | intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); |
| 6874 | break; |
| 6875 | case "--activity-launched-from-history": |
| 6876 | intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY); |
| 6877 | break; |
| 6878 | case "--activity-multiple-task": |
| 6879 | intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); |
| 6880 | break; |
| 6881 | case "--activity-no-animation": |
| 6882 | intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); |
| 6883 | break; |
| 6884 | case "--activity-no-history": |
| 6885 | intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); |
| 6886 | break; |
| 6887 | case "--activity-no-user-action": |
| 6888 | intent.addFlags(Intent.FLAG_ACTIVITY_NO_USER_ACTION); |
| 6889 | break; |
| 6890 | case "--activity-previous-is-top": |
| 6891 | intent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP); |
| 6892 | break; |
| 6893 | case "--activity-reorder-to-front": |
| 6894 | intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); |
| 6895 | break; |
| 6896 | case "--activity-reset-task-if-needed": |
| 6897 | intent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); |
| 6898 | break; |
| 6899 | case "--activity-single-top": |
| 6900 | intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); |
| 6901 | break; |
| 6902 | case "--activity-clear-task": |
| 6903 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); |
| 6904 | break; |
| 6905 | case "--activity-task-on-home": |
| 6906 | intent.addFlags(Intent.FLAG_ACTIVITY_TASK_ON_HOME); |
| 6907 | break; |
Patrick Baumann | 229141f | 2018-04-06 13:53:25 -0700 | [diff] [blame] | 6908 | case "--activity-match-external": |
| 6909 | intent.addFlags(Intent.FLAG_ACTIVITY_MATCH_EXTERNAL); |
| 6910 | break; |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 6911 | case "--receiver-registered-only": |
| 6912 | intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); |
| 6913 | break; |
| 6914 | case "--receiver-replace-pending": |
| 6915 | intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); |
| 6916 | break; |
Felipe Leme | 3cb48cd | 2016-01-27 08:39:09 -0800 | [diff] [blame] | 6917 | case "--receiver-foreground": |
| 6918 | intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); |
| 6919 | break; |
Dianne Hackborn | 797772b1 | 2017-02-08 16:33:43 -0800 | [diff] [blame] | 6920 | case "--receiver-no-abort": |
| 6921 | intent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT); |
| 6922 | break; |
| 6923 | case "--receiver-include-background": |
| 6924 | intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND); |
| 6925 | break; |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 6926 | case "--selector": |
| 6927 | intent.setDataAndType(data, type); |
| 6928 | intent = new Intent(); |
| 6929 | break; |
| 6930 | default: |
| 6931 | if (optionHandler != null && optionHandler.handleOption(opt, cmd)) { |
| 6932 | // Okay, caller handled this option. |
| 6933 | } else { |
| 6934 | throw new IllegalArgumentException("Unknown option: " + opt); |
| 6935 | } |
| 6936 | break; |
| 6937 | } |
| 6938 | } |
| 6939 | intent.setDataAndType(data, type); |
| 6940 | |
| 6941 | final boolean hasSelector = intent != baseIntent; |
| 6942 | if (hasSelector) { |
| 6943 | // A selector was specified; fix up. |
| 6944 | baseIntent.setSelector(intent); |
| 6945 | intent = baseIntent; |
| 6946 | } |
| 6947 | |
| 6948 | String arg = cmd.getNextArg(); |
| 6949 | baseIntent = null; |
| 6950 | if (arg == null) { |
| 6951 | if (hasSelector) { |
| 6952 | // If a selector has been specified, and no arguments |
| 6953 | // have been supplied for the main Intent, then we can |
| 6954 | // assume it is ACTION_MAIN CATEGORY_LAUNCHER; we don't |
| 6955 | // need to have a component name specified yet, the |
| 6956 | // selector will take care of that. |
| 6957 | baseIntent = new Intent(Intent.ACTION_MAIN); |
| 6958 | baseIntent.addCategory(Intent.CATEGORY_LAUNCHER); |
| 6959 | } |
| 6960 | } else if (arg.indexOf(':') >= 0) { |
| 6961 | // The argument is a URI. Fully parse it, and use that result |
| 6962 | // to fill in any data not specified so far. |
| 6963 | baseIntent = Intent.parseUri(arg, Intent.URI_INTENT_SCHEME |
| 6964 | | Intent.URI_ANDROID_APP_SCHEME | Intent.URI_ALLOW_UNSAFE); |
| 6965 | } else if (arg.indexOf('/') >= 0) { |
| 6966 | // The argument is a component name. Build an Intent to launch |
| 6967 | // it. |
| 6968 | baseIntent = new Intent(Intent.ACTION_MAIN); |
| 6969 | baseIntent.addCategory(Intent.CATEGORY_LAUNCHER); |
| 6970 | baseIntent.setComponent(ComponentName.unflattenFromString(arg)); |
| 6971 | } else { |
| 6972 | // Assume the argument is a package name. |
| 6973 | baseIntent = new Intent(Intent.ACTION_MAIN); |
| 6974 | baseIntent.addCategory(Intent.CATEGORY_LAUNCHER); |
| 6975 | baseIntent.setPackage(arg); |
| 6976 | } |
| 6977 | if (baseIntent != null) { |
| 6978 | Bundle extras = intent.getExtras(); |
| 6979 | intent.replaceExtras((Bundle)null); |
| 6980 | Bundle uriExtras = baseIntent.getExtras(); |
| 6981 | baseIntent.replaceExtras((Bundle)null); |
| 6982 | if (intent.getAction() != null && baseIntent.getCategories() != null) { |
| 6983 | HashSet<String> cats = new HashSet<String>(baseIntent.getCategories()); |
| 6984 | for (String c : cats) { |
| 6985 | baseIntent.removeCategory(c); |
| 6986 | } |
| 6987 | } |
| 6988 | intent.fillIn(baseIntent, Intent.FILL_IN_COMPONENT | Intent.FILL_IN_SELECTOR); |
| 6989 | if (extras == null) { |
| 6990 | extras = uriExtras; |
| 6991 | } else if (uriExtras != null) { |
| 6992 | uriExtras.putAll(extras); |
| 6993 | extras = uriExtras; |
| 6994 | } |
| 6995 | intent.replaceExtras(extras); |
| 6996 | hasIntentInfo = true; |
| 6997 | } |
| 6998 | |
| 6999 | if (!hasIntentInfo) throw new IllegalArgumentException("No intent supplied"); |
| 7000 | return intent; |
| 7001 | } |
| 7002 | |
| 7003 | /** @hide */ |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 7004 | @UnsupportedAppUsage |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 7005 | public static void printIntentArgsHelp(PrintWriter pw, String prefix) { |
| 7006 | final String[] lines = new String[] { |
| 7007 | "<INTENT> specifications include these flags and arguments:", |
| 7008 | " [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]", |
| 7009 | " [-c <CATEGORY> [-c <CATEGORY>] ...]", |
Felipe Leme | 4e02e25 | 2018-04-20 11:25:59 -0700 | [diff] [blame] | 7010 | " [-n <COMPONENT_NAME>]", |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 7011 | " [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]", |
| 7012 | " [--esn <EXTRA_KEY> ...]", |
| 7013 | " [--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]", |
| 7014 | " [--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]", |
| 7015 | " [--el <EXTRA_KEY> <EXTRA_LONG_VALUE> ...]", |
| 7016 | " [--ef <EXTRA_KEY> <EXTRA_FLOAT_VALUE> ...]", |
| 7017 | " [--eu <EXTRA_KEY> <EXTRA_URI_VALUE> ...]", |
| 7018 | " [--ecn <EXTRA_KEY> <EXTRA_COMPONENT_NAME_VALUE>]", |
| 7019 | " [--eia <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]", |
| 7020 | " (mutiple extras passed as Integer[])", |
| 7021 | " [--eial <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]", |
| 7022 | " (mutiple extras passed as List<Integer>)", |
| 7023 | " [--ela <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]", |
| 7024 | " (mutiple extras passed as Long[])", |
| 7025 | " [--elal <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]", |
| 7026 | " (mutiple extras passed as List<Long>)", |
| 7027 | " [--efa <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]", |
| 7028 | " (mutiple extras passed as Float[])", |
| 7029 | " [--efal <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]", |
| 7030 | " (mutiple extras passed as List<Float>)", |
| 7031 | " [--esa <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]", |
| 7032 | " (mutiple extras passed as String[]; to embed a comma into a string,", |
| 7033 | " escape it using \"\\,\")", |
| 7034 | " [--esal <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]", |
| 7035 | " (mutiple extras passed as List<String>; to embed a comma into a string,", |
| 7036 | " escape it using \"\\,\")", |
Felipe Leme | 545569d | 2016-01-11 16:27:58 -0800 | [diff] [blame] | 7037 | " [-f <FLAG>]", |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 7038 | " [--grant-read-uri-permission] [--grant-write-uri-permission]", |
| 7039 | " [--grant-persistable-uri-permission] [--grant-prefix-uri-permission]", |
| 7040 | " [--debug-log-resolution] [--exclude-stopped-packages]", |
| 7041 | " [--include-stopped-packages]", |
| 7042 | " [--activity-brought-to-front] [--activity-clear-top]", |
| 7043 | " [--activity-clear-when-task-reset] [--activity-exclude-from-recents]", |
| 7044 | " [--activity-launched-from-history] [--activity-multiple-task]", |
| 7045 | " [--activity-no-animation] [--activity-no-history]", |
| 7046 | " [--activity-no-user-action] [--activity-previous-is-top]", |
| 7047 | " [--activity-reorder-to-front] [--activity-reset-task-if-needed]", |
| 7048 | " [--activity-single-top] [--activity-clear-task]", |
Patrick Baumann | 229141f | 2018-04-06 13:53:25 -0700 | [diff] [blame] | 7049 | " [--activity-task-on-home] [--activity-match-external]", |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 7050 | " [--receiver-registered-only] [--receiver-replace-pending]", |
Dianne Hackborn | 797772b1 | 2017-02-08 16:33:43 -0800 | [diff] [blame] | 7051 | " [--receiver-foreground] [--receiver-no-abort]", |
| 7052 | " [--receiver-include-background]", |
Dianne Hackborn | 3cdb56e | 2015-11-11 12:45:44 -0800 | [diff] [blame] | 7053 | " [--selector]", |
| 7054 | " [<URI> | <PACKAGE> | <COMPONENT>]" |
| 7055 | }; |
| 7056 | for (String line : lines) { |
| 7057 | pw.print(prefix); |
| 7058 | pw.println(line); |
| 7059 | } |
| 7060 | } |
| 7061 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7062 | /** |
| 7063 | * Retrieve the general action to be performed, such as |
| 7064 | * {@link #ACTION_VIEW}. The action describes the general way the rest of |
| 7065 | * the information in the intent should be interpreted -- most importantly, |
| 7066 | * what to do with the data returned by {@link #getData}. |
| 7067 | * |
| 7068 | * @return The action of this intent or null if none is specified. |
| 7069 | * |
| 7070 | * @see #setAction |
| 7071 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7072 | public @Nullable String getAction() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7073 | return mAction; |
| 7074 | } |
| 7075 | |
| 7076 | /** |
| 7077 | * Retrieve data this intent is operating on. This URI specifies the name |
| 7078 | * of the data; often it uses the content: scheme, specifying data in a |
| 7079 | * content provider. Other schemes may be handled by specific activities, |
| 7080 | * such as http: by the web browser. |
| 7081 | * |
| 7082 | * @return The URI of the data this intent is targeting or null. |
| 7083 | * |
| 7084 | * @see #getScheme |
| 7085 | * @see #setData |
| 7086 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7087 | public @Nullable Uri getData() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7088 | return mData; |
| 7089 | } |
| 7090 | |
| 7091 | /** |
| 7092 | * The same as {@link #getData()}, but returns the URI as an encoded |
| 7093 | * String. |
| 7094 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7095 | public @Nullable String getDataString() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7096 | return mData != null ? mData.toString() : null; |
| 7097 | } |
| 7098 | |
| 7099 | /** |
| 7100 | * Return the scheme portion of the intent's data. If the data is null or |
| 7101 | * does not include a scheme, null is returned. Otherwise, the scheme |
| 7102 | * prefix without the final ':' is returned, i.e. "http". |
| 7103 | * |
| 7104 | * <p>This is the same as calling getData().getScheme() (and checking for |
| 7105 | * null data). |
| 7106 | * |
| 7107 | * @return The scheme of this intent. |
| 7108 | * |
| 7109 | * @see #getData |
| 7110 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7111 | public @Nullable String getScheme() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7112 | return mData != null ? mData.getScheme() : null; |
| 7113 | } |
| 7114 | |
| 7115 | /** |
| 7116 | * Retrieve any explicit MIME type included in the intent. This is usually |
| 7117 | * null, as the type is determined by the intent data. |
| 7118 | * |
| 7119 | * @return If a type was manually set, it is returned; else null is |
| 7120 | * returned. |
| 7121 | * |
| 7122 | * @see #resolveType(ContentResolver) |
| 7123 | * @see #setType |
| 7124 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7125 | public @Nullable String getType() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7126 | return mType; |
| 7127 | } |
| 7128 | |
| 7129 | /** |
| 7130 | * Return the MIME data type of this intent. If the type field is |
| 7131 | * explicitly set, that is simply returned. Otherwise, if the data is set, |
| 7132 | * the type of that data is returned. If neither fields are set, a null is |
| 7133 | * returned. |
| 7134 | * |
| 7135 | * @return The MIME type of this intent. |
| 7136 | * |
| 7137 | * @see #getType |
| 7138 | * @see #resolveType(ContentResolver) |
| 7139 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7140 | public @Nullable String resolveType(@NonNull Context context) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7141 | return resolveType(context.getContentResolver()); |
| 7142 | } |
| 7143 | |
| 7144 | /** |
| 7145 | * Return the MIME data type of this intent. If the type field is |
| 7146 | * explicitly set, that is simply returned. Otherwise, if the data is set, |
| 7147 | * the type of that data is returned. If neither fields are set, a null is |
| 7148 | * returned. |
| 7149 | * |
| 7150 | * @param resolver A ContentResolver that can be used to determine the MIME |
| 7151 | * type of the intent's data. |
| 7152 | * |
| 7153 | * @return The MIME type of this intent. |
| 7154 | * |
| 7155 | * @see #getType |
| 7156 | * @see #resolveType(Context) |
| 7157 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7158 | public @Nullable String resolveType(@NonNull ContentResolver resolver) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7159 | if (mType != null) { |
| 7160 | return mType; |
| 7161 | } |
| 7162 | if (mData != null) { |
| 7163 | if ("content".equals(mData.getScheme())) { |
| 7164 | return resolver.getType(mData); |
| 7165 | } |
| 7166 | } |
| 7167 | return null; |
| 7168 | } |
| 7169 | |
| 7170 | /** |
| 7171 | * Return the MIME data type of this intent, only if it will be needed for |
| 7172 | * intent resolution. This is not generally useful for application code; |
| 7173 | * it is used by the frameworks for communicating with back-end system |
| 7174 | * services. |
| 7175 | * |
| 7176 | * @param resolver A ContentResolver that can be used to determine the MIME |
| 7177 | * type of the intent's data. |
| 7178 | * |
| 7179 | * @return The MIME type of this intent, or null if it is unknown or not |
| 7180 | * needed. |
| 7181 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7182 | public @Nullable String resolveTypeIfNeeded(@NonNull ContentResolver resolver) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7183 | if (mComponent != null) { |
| 7184 | return mType; |
| 7185 | } |
| 7186 | return resolveType(resolver); |
| 7187 | } |
| 7188 | |
| 7189 | /** |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 7190 | * Check if a category exists in the intent. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7191 | * |
| 7192 | * @param category The category to check. |
| 7193 | * |
| 7194 | * @return boolean True if the intent contains the category, else false. |
| 7195 | * |
| 7196 | * @see #getCategories |
| 7197 | * @see #addCategory |
| 7198 | */ |
| 7199 | public boolean hasCategory(String category) { |
| 7200 | return mCategories != null && mCategories.contains(category); |
| 7201 | } |
| 7202 | |
| 7203 | /** |
| 7204 | * Return the set of all categories in the intent. If there are no categories, |
| 7205 | * returns NULL. |
| 7206 | * |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 7207 | * @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] | 7208 | * |
| 7209 | * @see #hasCategory |
| 7210 | * @see #addCategory |
| 7211 | */ |
| 7212 | public Set<String> getCategories() { |
| 7213 | return mCategories; |
| 7214 | } |
| 7215 | |
| 7216 | /** |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 7217 | * Return the specific selector associated with this Intent. If there is |
| 7218 | * none, returns null. See {@link #setSelector} for more information. |
| 7219 | * |
| 7220 | * @see #setSelector |
| 7221 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7222 | public @Nullable Intent getSelector() { |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 7223 | return mSelector; |
| 7224 | } |
| 7225 | |
| 7226 | /** |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 7227 | * Return the {@link ClipData} associated with this Intent. If there is |
| 7228 | * none, returns null. See {@link #setClipData} for more information. |
| 7229 | * |
John Spurlock | 125d133 | 2013-11-25 11:58:37 -0500 | [diff] [blame] | 7230 | * @see #setClipData |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 7231 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7232 | public @Nullable ClipData getClipData() { |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 7233 | return mClipData; |
| 7234 | } |
| 7235 | |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 7236 | /** @hide */ |
| 7237 | public int getContentUserHint() { |
| 7238 | return mContentUserHint; |
| 7239 | } |
| 7240 | |
Todd Kennedy | b3b43130 | 2017-03-20 16:05:48 -0700 | [diff] [blame] | 7241 | /** @hide */ |
| 7242 | public String getLaunchToken() { |
| 7243 | return mLaunchToken; |
| 7244 | } |
| 7245 | |
| 7246 | /** @hide */ |
| 7247 | public void setLaunchToken(String launchToken) { |
| 7248 | mLaunchToken = launchToken; |
| 7249 | } |
| 7250 | |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 7251 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7252 | * Sets the ClassLoader that will be used when unmarshalling |
| 7253 | * any Parcelable values from the extras of this Intent. |
| 7254 | * |
| 7255 | * @param loader a ClassLoader, or null to use the default loader |
| 7256 | * at the time of unmarshalling. |
| 7257 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7258 | public void setExtrasClassLoader(@Nullable ClassLoader loader) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7259 | if (mExtras != null) { |
| 7260 | mExtras.setClassLoader(loader); |
| 7261 | } |
| 7262 | } |
| 7263 | |
| 7264 | /** |
| 7265 | * Returns true if an extra value is associated with the given name. |
| 7266 | * @param name the extra's name |
| 7267 | * @return true if the given extra is present. |
| 7268 | */ |
| 7269 | public boolean hasExtra(String name) { |
| 7270 | return mExtras != null && mExtras.containsKey(name); |
| 7271 | } |
| 7272 | |
| 7273 | /** |
| 7274 | * Returns true if the Intent's extras contain a parcelled file descriptor. |
| 7275 | * @return true if the Intent contains a parcelled file descriptor. |
| 7276 | */ |
| 7277 | public boolean hasFileDescriptors() { |
| 7278 | return mExtras != null && mExtras.hasFileDescriptors(); |
| 7279 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 7280 | |
Jeff Sharkey | d136e51 | 2016-03-09 22:30:56 -0700 | [diff] [blame] | 7281 | /** {@hide} */ |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 7282 | @UnsupportedAppUsage |
Dianne Hackborn | 9ecebbf | 2011-09-28 23:19:47 -0400 | [diff] [blame] | 7283 | public void setAllowFds(boolean allowFds) { |
| 7284 | if (mExtras != null) { |
| 7285 | mExtras.setAllowFds(allowFds); |
| 7286 | } |
| 7287 | } |
| 7288 | |
Jeff Sharkey | d136e51 | 2016-03-09 22:30:56 -0700 | [diff] [blame] | 7289 | /** {@hide} */ |
| 7290 | public void setDefusable(boolean defusable) { |
| 7291 | if (mExtras != null) { |
| 7292 | mExtras.setDefusable(defusable); |
| 7293 | } |
| 7294 | } |
| 7295 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7296 | /** |
| 7297 | * Retrieve extended data from the intent. |
| 7298 | * |
| 7299 | * @param name The name of the desired item. |
| 7300 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7301 | * @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] | 7302 | * or null if none was found. |
| 7303 | * |
| 7304 | * @deprecated |
| 7305 | * @hide |
| 7306 | */ |
| 7307 | @Deprecated |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 7308 | @UnsupportedAppUsage |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7309 | public Object getExtra(String name) { |
| 7310 | return getExtra(name, null); |
| 7311 | } |
| 7312 | |
| 7313 | /** |
| 7314 | * Retrieve extended data from the intent. |
| 7315 | * |
| 7316 | * @param name The name of the desired item. |
| 7317 | * @param defaultValue the value to be returned if no value of the desired |
| 7318 | * type is stored with the given name. |
| 7319 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7320 | * @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] | 7321 | * or the default value if none was found. |
| 7322 | * |
| 7323 | * @see #putExtra(String, boolean) |
| 7324 | */ |
| 7325 | public boolean getBooleanExtra(String name, boolean defaultValue) { |
| 7326 | return mExtras == null ? defaultValue : |
| 7327 | mExtras.getBoolean(name, defaultValue); |
| 7328 | } |
| 7329 | |
| 7330 | /** |
| 7331 | * Retrieve extended data from the intent. |
| 7332 | * |
| 7333 | * @param name The name of the desired item. |
| 7334 | * @param defaultValue the value to be returned if no value of the desired |
| 7335 | * type is stored with the given name. |
| 7336 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7337 | * @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] | 7338 | * or the default value if none was found. |
| 7339 | * |
| 7340 | * @see #putExtra(String, byte) |
| 7341 | */ |
| 7342 | public byte getByteExtra(String name, byte defaultValue) { |
| 7343 | return mExtras == null ? defaultValue : |
| 7344 | mExtras.getByte(name, defaultValue); |
| 7345 | } |
| 7346 | |
| 7347 | /** |
| 7348 | * Retrieve extended data from the intent. |
| 7349 | * |
| 7350 | * @param name The name of the desired item. |
| 7351 | * @param defaultValue the value to be returned if no value of the desired |
| 7352 | * type is stored with the given name. |
| 7353 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7354 | * @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] | 7355 | * or the default value if none was found. |
| 7356 | * |
| 7357 | * @see #putExtra(String, short) |
| 7358 | */ |
| 7359 | public short getShortExtra(String name, short defaultValue) { |
| 7360 | return mExtras == null ? defaultValue : |
| 7361 | mExtras.getShort(name, defaultValue); |
| 7362 | } |
| 7363 | |
| 7364 | /** |
| 7365 | * Retrieve extended data from the intent. |
| 7366 | * |
| 7367 | * @param name The name of the desired item. |
| 7368 | * @param defaultValue the value to be returned if no value of the desired |
| 7369 | * type is stored with the given name. |
| 7370 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7371 | * @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] | 7372 | * or the default value if none was found. |
| 7373 | * |
| 7374 | * @see #putExtra(String, char) |
| 7375 | */ |
| 7376 | public char getCharExtra(String name, char defaultValue) { |
| 7377 | return mExtras == null ? defaultValue : |
| 7378 | mExtras.getChar(name, defaultValue); |
| 7379 | } |
| 7380 | |
| 7381 | /** |
| 7382 | * Retrieve extended data from the intent. |
| 7383 | * |
| 7384 | * @param name The name of the desired item. |
| 7385 | * @param defaultValue the value to be returned if no value of the desired |
| 7386 | * type is stored with the given name. |
| 7387 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7388 | * @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] | 7389 | * or the default value if none was found. |
| 7390 | * |
| 7391 | * @see #putExtra(String, int) |
| 7392 | */ |
| 7393 | public int getIntExtra(String name, int defaultValue) { |
| 7394 | return mExtras == null ? defaultValue : |
| 7395 | mExtras.getInt(name, defaultValue); |
| 7396 | } |
| 7397 | |
| 7398 | /** |
| 7399 | * Retrieve extended data from the intent. |
| 7400 | * |
| 7401 | * @param name The name of the desired item. |
| 7402 | * @param defaultValue the value to be returned if no value of the desired |
| 7403 | * type is stored with the given name. |
| 7404 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7405 | * @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] | 7406 | * or the default value if none was found. |
| 7407 | * |
| 7408 | * @see #putExtra(String, long) |
| 7409 | */ |
| 7410 | public long getLongExtra(String name, long defaultValue) { |
| 7411 | return mExtras == null ? defaultValue : |
| 7412 | mExtras.getLong(name, defaultValue); |
| 7413 | } |
| 7414 | |
| 7415 | /** |
| 7416 | * Retrieve extended data from the intent. |
| 7417 | * |
| 7418 | * @param name The name of the desired item. |
| 7419 | * @param defaultValue the value to be returned if no value of the desired |
| 7420 | * type is stored with the given name. |
| 7421 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7422 | * @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] | 7423 | * or the default value if no such item is present |
| 7424 | * |
| 7425 | * @see #putExtra(String, float) |
| 7426 | */ |
| 7427 | public float getFloatExtra(String name, float defaultValue) { |
| 7428 | return mExtras == null ? defaultValue : |
| 7429 | mExtras.getFloat(name, defaultValue); |
| 7430 | } |
| 7431 | |
| 7432 | /** |
| 7433 | * Retrieve extended data from the intent. |
| 7434 | * |
| 7435 | * @param name The name of the desired item. |
| 7436 | * @param defaultValue the value to be returned if no value of the desired |
| 7437 | * type is stored with the given name. |
| 7438 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7439 | * @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] | 7440 | * or the default value if none was found. |
| 7441 | * |
| 7442 | * @see #putExtra(String, double) |
| 7443 | */ |
| 7444 | public double getDoubleExtra(String name, double defaultValue) { |
| 7445 | return mExtras == null ? defaultValue : |
| 7446 | mExtras.getDouble(name, defaultValue); |
| 7447 | } |
| 7448 | |
| 7449 | /** |
| 7450 | * Retrieve extended data from the intent. |
| 7451 | * |
| 7452 | * @param name The name of the desired item. |
| 7453 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7454 | * @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] | 7455 | * or null if no String value was found. |
| 7456 | * |
| 7457 | * @see #putExtra(String, String) |
| 7458 | */ |
| 7459 | public String getStringExtra(String name) { |
| 7460 | return mExtras == null ? null : mExtras.getString(name); |
| 7461 | } |
| 7462 | |
| 7463 | /** |
| 7464 | * Retrieve extended data from the intent. |
| 7465 | * |
| 7466 | * @param name The name of the desired item. |
| 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 null if no CharSequence value was found. |
| 7470 | * |
| 7471 | * @see #putExtra(String, CharSequence) |
| 7472 | */ |
| 7473 | public CharSequence getCharSequenceExtra(String name) { |
| 7474 | return mExtras == null ? null : mExtras.getCharSequence(name); |
| 7475 | } |
| 7476 | |
| 7477 | /** |
| 7478 | * Retrieve extended data from the intent. |
| 7479 | * |
| 7480 | * @param name The name of the desired item. |
| 7481 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7482 | * @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] | 7483 | * or null if no Parcelable value was found. |
| 7484 | * |
| 7485 | * @see #putExtra(String, Parcelable) |
| 7486 | */ |
| 7487 | public <T extends Parcelable> T getParcelableExtra(String name) { |
| 7488 | return mExtras == null ? null : mExtras.<T>getParcelable(name); |
| 7489 | } |
| 7490 | |
| 7491 | /** |
| 7492 | * Retrieve extended data from the intent. |
| 7493 | * |
| 7494 | * @param name The name of the desired item. |
| 7495 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7496 | * @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] | 7497 | * or null if no Parcelable[] value was found. |
| 7498 | * |
| 7499 | * @see #putExtra(String, Parcelable[]) |
| 7500 | */ |
| 7501 | public Parcelable[] getParcelableArrayExtra(String name) { |
| 7502 | return mExtras == null ? null : mExtras.getParcelableArray(name); |
| 7503 | } |
| 7504 | |
| 7505 | /** |
| 7506 | * Retrieve extended data from the intent. |
| 7507 | * |
| 7508 | * @param name The name of the desired item. |
| 7509 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7510 | * @return the value of an item previously added with |
| 7511 | * putParcelableArrayListExtra(), or null if no |
| 7512 | * ArrayList<Parcelable> value was found. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7513 | * |
| 7514 | * @see #putParcelableArrayListExtra(String, ArrayList) |
| 7515 | */ |
| 7516 | public <T extends Parcelable> ArrayList<T> getParcelableArrayListExtra(String name) { |
| 7517 | return mExtras == null ? null : mExtras.<T>getParcelableArrayList(name); |
| 7518 | } |
| 7519 | |
| 7520 | /** |
| 7521 | * Retrieve extended data from the intent. |
| 7522 | * |
| 7523 | * @param name The name of the desired item. |
| 7524 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7525 | * @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] | 7526 | * or null if no Serializable value was found. |
| 7527 | * |
| 7528 | * @see #putExtra(String, Serializable) |
| 7529 | */ |
| 7530 | public Serializable getSerializableExtra(String name) { |
| 7531 | return mExtras == null ? null : mExtras.getSerializable(name); |
| 7532 | } |
| 7533 | |
| 7534 | /** |
| 7535 | * Retrieve extended data from the intent. |
| 7536 | * |
| 7537 | * @param name The name of the desired item. |
| 7538 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7539 | * @return the value of an item previously added with |
| 7540 | * putIntegerArrayListExtra(), or null if no |
| 7541 | * ArrayList<Integer> value was found. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7542 | * |
| 7543 | * @see #putIntegerArrayListExtra(String, ArrayList) |
| 7544 | */ |
| 7545 | public ArrayList<Integer> getIntegerArrayListExtra(String name) { |
| 7546 | return mExtras == null ? null : mExtras.getIntegerArrayList(name); |
| 7547 | } |
| 7548 | |
| 7549 | /** |
| 7550 | * Retrieve extended data from the intent. |
| 7551 | * |
| 7552 | * @param name The name of the desired item. |
| 7553 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7554 | * @return the value of an item previously added with |
| 7555 | * putStringArrayListExtra(), or null if no |
| 7556 | * ArrayList<String> value was found. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7557 | * |
| 7558 | * @see #putStringArrayListExtra(String, ArrayList) |
| 7559 | */ |
| 7560 | public ArrayList<String> getStringArrayListExtra(String name) { |
| 7561 | return mExtras == null ? null : mExtras.getStringArrayList(name); |
| 7562 | } |
| 7563 | |
| 7564 | /** |
| 7565 | * Retrieve extended data from the intent. |
| 7566 | * |
| 7567 | * @param name The name of the desired item. |
| 7568 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7569 | * @return the value of an item previously added with |
| 7570 | * putCharSequenceArrayListExtra, or null if no |
| 7571 | * ArrayList<CharSequence> value was found. |
Bjorn Bringert | 08bbffb | 2010-02-25 11:16:22 +0000 | [diff] [blame] | 7572 | * |
| 7573 | * @see #putCharSequenceArrayListExtra(String, ArrayList) |
| 7574 | */ |
| 7575 | public ArrayList<CharSequence> getCharSequenceArrayListExtra(String name) { |
| 7576 | return mExtras == null ? null : mExtras.getCharSequenceArrayList(name); |
| 7577 | } |
| 7578 | |
| 7579 | /** |
| 7580 | * Retrieve extended data from the intent. |
| 7581 | * |
| 7582 | * @param name The name of the desired item. |
| 7583 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7584 | * @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] | 7585 | * or null if no boolean array value was found. |
| 7586 | * |
| 7587 | * @see #putExtra(String, boolean[]) |
| 7588 | */ |
| 7589 | public boolean[] getBooleanArrayExtra(String name) { |
| 7590 | return mExtras == null ? null : mExtras.getBooleanArray(name); |
| 7591 | } |
| 7592 | |
| 7593 | /** |
| 7594 | * Retrieve extended data from the intent. |
| 7595 | * |
| 7596 | * @param name The name of the desired item. |
| 7597 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7598 | * @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] | 7599 | * or null if no byte array value was found. |
| 7600 | * |
| 7601 | * @see #putExtra(String, byte[]) |
| 7602 | */ |
| 7603 | public byte[] getByteArrayExtra(String name) { |
| 7604 | return mExtras == null ? null : mExtras.getByteArray(name); |
| 7605 | } |
| 7606 | |
| 7607 | /** |
| 7608 | * Retrieve extended data from the intent. |
| 7609 | * |
| 7610 | * @param name The name of the desired item. |
| 7611 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7612 | * @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] | 7613 | * or null if no short array value was found. |
| 7614 | * |
| 7615 | * @see #putExtra(String, short[]) |
| 7616 | */ |
| 7617 | public short[] getShortArrayExtra(String name) { |
| 7618 | return mExtras == null ? null : mExtras.getShortArray(name); |
| 7619 | } |
| 7620 | |
| 7621 | /** |
| 7622 | * Retrieve extended data from the intent. |
| 7623 | * |
| 7624 | * @param name The name of the desired item. |
| 7625 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7626 | * @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] | 7627 | * or null if no char array value was found. |
| 7628 | * |
| 7629 | * @see #putExtra(String, char[]) |
| 7630 | */ |
| 7631 | public char[] getCharArrayExtra(String name) { |
| 7632 | return mExtras == null ? null : mExtras.getCharArray(name); |
| 7633 | } |
| 7634 | |
| 7635 | /** |
| 7636 | * Retrieve extended data from the intent. |
| 7637 | * |
| 7638 | * @param name The name of the desired item. |
| 7639 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7640 | * @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] | 7641 | * or null if no int array value was found. |
| 7642 | * |
| 7643 | * @see #putExtra(String, int[]) |
| 7644 | */ |
| 7645 | public int[] getIntArrayExtra(String name) { |
| 7646 | return mExtras == null ? null : mExtras.getIntArray(name); |
| 7647 | } |
| 7648 | |
| 7649 | /** |
| 7650 | * Retrieve extended data from the intent. |
| 7651 | * |
| 7652 | * @param name The name of the desired item. |
| 7653 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7654 | * @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] | 7655 | * or null if no long array value was found. |
| 7656 | * |
| 7657 | * @see #putExtra(String, long[]) |
| 7658 | */ |
| 7659 | public long[] getLongArrayExtra(String name) { |
| 7660 | return mExtras == null ? null : mExtras.getLongArray(name); |
| 7661 | } |
| 7662 | |
| 7663 | /** |
| 7664 | * Retrieve extended data from the intent. |
| 7665 | * |
| 7666 | * @param name The name of the desired item. |
| 7667 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7668 | * @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] | 7669 | * or null if no float array value was found. |
| 7670 | * |
| 7671 | * @see #putExtra(String, float[]) |
| 7672 | */ |
| 7673 | public float[] getFloatArrayExtra(String name) { |
| 7674 | return mExtras == null ? null : mExtras.getFloatArray(name); |
| 7675 | } |
| 7676 | |
| 7677 | /** |
| 7678 | * Retrieve extended data from the intent. |
| 7679 | * |
| 7680 | * @param name The name of the desired item. |
| 7681 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7682 | * @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] | 7683 | * or null if no double array value was found. |
| 7684 | * |
| 7685 | * @see #putExtra(String, double[]) |
| 7686 | */ |
| 7687 | public double[] getDoubleArrayExtra(String name) { |
| 7688 | return mExtras == null ? null : mExtras.getDoubleArray(name); |
| 7689 | } |
| 7690 | |
| 7691 | /** |
| 7692 | * Retrieve extended data from the intent. |
| 7693 | * |
| 7694 | * @param name The name of the desired item. |
| 7695 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7696 | * @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] | 7697 | * or null if no String array value was found. |
| 7698 | * |
| 7699 | * @see #putExtra(String, String[]) |
| 7700 | */ |
| 7701 | public String[] getStringArrayExtra(String name) { |
| 7702 | return mExtras == null ? null : mExtras.getStringArray(name); |
| 7703 | } |
| 7704 | |
| 7705 | /** |
| 7706 | * Retrieve extended data from the intent. |
| 7707 | * |
| 7708 | * @param name The name of the desired item. |
| 7709 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7710 | * @return the value of an item previously added with putExtra(), |
Bjorn Bringert | 08bbffb | 2010-02-25 11:16:22 +0000 | [diff] [blame] | 7711 | * or null if no CharSequence array value was found. |
| 7712 | * |
| 7713 | * @see #putExtra(String, CharSequence[]) |
| 7714 | */ |
| 7715 | public CharSequence[] getCharSequenceArrayExtra(String name) { |
| 7716 | return mExtras == null ? null : mExtras.getCharSequenceArray(name); |
| 7717 | } |
| 7718 | |
| 7719 | /** |
| 7720 | * Retrieve extended data from the intent. |
| 7721 | * |
| 7722 | * @param name The name of the desired item. |
| 7723 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7724 | * @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] | 7725 | * or null if no Bundle value was found. |
| 7726 | * |
| 7727 | * @see #putExtra(String, Bundle) |
| 7728 | */ |
| 7729 | public Bundle getBundleExtra(String name) { |
| 7730 | return mExtras == null ? null : mExtras.getBundle(name); |
| 7731 | } |
| 7732 | |
| 7733 | /** |
| 7734 | * Retrieve extended data from the intent. |
| 7735 | * |
| 7736 | * @param name The name of the desired item. |
| 7737 | * |
Jonathan Dormody | d07017e | 2017-11-15 14:10:57 -0700 | [diff] [blame] | 7738 | * @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] | 7739 | * or null if no IBinder value was found. |
| 7740 | * |
| 7741 | * @see #putExtra(String, IBinder) |
| 7742 | * |
| 7743 | * @deprecated |
| 7744 | * @hide |
| 7745 | */ |
| 7746 | @Deprecated |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 7747 | @UnsupportedAppUsage |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7748 | public IBinder getIBinderExtra(String name) { |
| 7749 | return mExtras == null ? null : mExtras.getIBinder(name); |
| 7750 | } |
| 7751 | |
| 7752 | /** |
| 7753 | * Retrieve extended data from the intent. |
| 7754 | * |
| 7755 | * @param name The name of the desired item. |
| 7756 | * @param defaultValue The default value to return in case no item is |
| 7757 | * associated with the key 'name' |
| 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 defaultValue if none was found. |
| 7761 | * |
| 7762 | * @see #putExtra |
| 7763 | * |
| 7764 | * @deprecated |
| 7765 | * @hide |
| 7766 | */ |
| 7767 | @Deprecated |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 7768 | @UnsupportedAppUsage |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7769 | public Object getExtra(String name, Object defaultValue) { |
| 7770 | Object result = defaultValue; |
| 7771 | if (mExtras != null) { |
| 7772 | Object result2 = mExtras.get(name); |
| 7773 | if (result2 != null) { |
| 7774 | result = result2; |
| 7775 | } |
| 7776 | } |
| 7777 | |
| 7778 | return result; |
| 7779 | } |
| 7780 | |
| 7781 | /** |
| 7782 | * Retrieves a map of extended data from the intent. |
| 7783 | * |
| 7784 | * @return the map of all extras previously added with putExtra(), |
| 7785 | * or null if none have been added. |
| 7786 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7787 | public @Nullable Bundle getExtras() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7788 | return (mExtras != null) |
| 7789 | ? new Bundle(mExtras) |
| 7790 | : null; |
| 7791 | } |
| 7792 | |
| 7793 | /** |
Dianne Hackborn | a83ce1d | 2015-03-11 15:16:13 -0700 | [diff] [blame] | 7794 | * Filter extras to only basic types. |
| 7795 | * @hide |
| 7796 | */ |
| 7797 | public void removeUnsafeExtras() { |
| 7798 | if (mExtras != null) { |
Dianne Hackborn | 851ec49 | 2016-10-12 17:20:07 -0700 | [diff] [blame] | 7799 | mExtras = mExtras.filterValues(); |
Dianne Hackborn | a83ce1d | 2015-03-11 15:16:13 -0700 | [diff] [blame] | 7800 | } |
| 7801 | } |
| 7802 | |
| 7803 | /** |
Makoto Onuki | 97f82f2 | 2017-05-31 16:20:21 -0700 | [diff] [blame] | 7804 | * @return Whether {@link #maybeStripForHistory} will return an lightened intent or |
| 7805 | * return itself as-is. |
| 7806 | * @hide |
| 7807 | */ |
| 7808 | public boolean canStripForHistory() { |
| 7809 | return ((mExtras != null) && mExtras.isParcelled()) || (mClipData != null); |
| 7810 | } |
| 7811 | |
| 7812 | /** |
| 7813 | * Call it when the system needs to keep an intent for logging purposes to remove fields |
| 7814 | * that are not needed for logging. |
| 7815 | * @hide |
| 7816 | */ |
| 7817 | public Intent maybeStripForHistory() { |
| 7818 | // TODO Scan and remove possibly heavy instances like Bitmaps from unparcelled extras? |
| 7819 | |
| 7820 | if (!canStripForHistory()) { |
| 7821 | return this; |
| 7822 | } |
| 7823 | return new Intent(this, COPY_MODE_HISTORY); |
| 7824 | } |
| 7825 | |
| 7826 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7827 | * Retrieve any special flags associated with this intent. You will |
| 7828 | * normally just set them with {@link #setFlags} and let the system |
| 7829 | * take the appropriate action with them. |
| 7830 | * |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7831 | * @return The currently set flags. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7832 | * @see #setFlags |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7833 | * @see #addFlags |
| 7834 | * @see #removeFlags |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7835 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7836 | public @Flags int getFlags() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7837 | return mFlags; |
| 7838 | } |
| 7839 | |
Dianne Hackborn | e7f9721 | 2011-02-24 14:40:20 -0800 | [diff] [blame] | 7840 | /** @hide */ |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 7841 | @UnsupportedAppUsage |
Dianne Hackborn | e7f9721 | 2011-02-24 14:40:20 -0800 | [diff] [blame] | 7842 | public boolean isExcludingStopped() { |
| 7843 | return (mFlags&(FLAG_EXCLUDE_STOPPED_PACKAGES|FLAG_INCLUDE_STOPPED_PACKAGES)) |
| 7844 | == FLAG_EXCLUDE_STOPPED_PACKAGES; |
| 7845 | } |
| 7846 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7847 | /** |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 7848 | * Retrieve the application package name this Intent is limited to. When |
| 7849 | * resolving an Intent, if non-null this limits the resolution to only |
| 7850 | * components in the given application package. |
| 7851 | * |
| 7852 | * @return The name of the application package for the Intent. |
| 7853 | * |
| 7854 | * @see #resolveActivity |
| 7855 | * @see #setPackage |
| 7856 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7857 | public @Nullable String getPackage() { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 7858 | return mPackage; |
| 7859 | } |
| 7860 | |
| 7861 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7862 | * Retrieve the concrete component associated with the intent. When receiving |
| 7863 | * an intent, this is the component that was found to best handle it (that is, |
| 7864 | * yourself) and will always be non-null; in all other cases it will be |
| 7865 | * null unless explicitly set. |
| 7866 | * |
| 7867 | * @return The name of the application component to handle the intent. |
| 7868 | * |
| 7869 | * @see #resolveActivity |
| 7870 | * @see #setComponent |
| 7871 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7872 | public @Nullable ComponentName getComponent() { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7873 | return mComponent; |
| 7874 | } |
| 7875 | |
| 7876 | /** |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 7877 | * Get the bounds of the sender of this intent, in screen coordinates. This can be |
| 7878 | * used as a hint to the receiver for animations and the like. Null means that there |
| 7879 | * is no source bounds. |
| 7880 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7881 | public @Nullable Rect getSourceBounds() { |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 7882 | return mSourceBounds; |
| 7883 | } |
| 7884 | |
| 7885 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7886 | * Return the Activity component that should be used to handle this intent. |
| 7887 | * The appropriate component is determined based on the information in the |
| 7888 | * intent, evaluated as follows: |
| 7889 | * |
| 7890 | * <p>If {@link #getComponent} returns an explicit class, that is returned |
| 7891 | * without any further consideration. |
| 7892 | * |
| 7893 | * <p>The activity must handle the {@link Intent#CATEGORY_DEFAULT} Intent |
| 7894 | * category to be considered. |
| 7895 | * |
| 7896 | * <p>If {@link #getAction} is non-NULL, the activity must handle this |
| 7897 | * action. |
| 7898 | * |
| 7899 | * <p>If {@link #resolveType} returns non-NULL, the activity must handle |
| 7900 | * this type. |
| 7901 | * |
| 7902 | * <p>If {@link #addCategory} has added any categories, the activity must |
| 7903 | * handle ALL of the categories specified. |
| 7904 | * |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 7905 | * <p>If {@link #getPackage} is non-NULL, only activity components in |
| 7906 | * that application package will be considered. |
| 7907 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7908 | * <p>If there are no activities that satisfy all of these conditions, a |
| 7909 | * null string is returned. |
| 7910 | * |
| 7911 | * <p>If multiple activities are found to satisfy the intent, the one with |
| 7912 | * the highest priority will be used. If there are multiple activities |
| 7913 | * with the same priority, the system will either pick the best activity |
| 7914 | * based on user preference, or resolve to a system class that will allow |
| 7915 | * the user to pick an activity and forward from there. |
| 7916 | * |
| 7917 | * <p>This method is implemented simply by calling |
| 7918 | * {@link PackageManager#resolveActivity} with the "defaultOnly" parameter |
| 7919 | * true.</p> |
| 7920 | * <p> This API is called for you as part of starting an activity from an |
| 7921 | * intent. You do not normally need to call it yourself.</p> |
| 7922 | * |
| 7923 | * @param pm The package manager with which to resolve the Intent. |
| 7924 | * |
| 7925 | * @return Name of the component implementing an activity that can |
| 7926 | * display the intent. |
| 7927 | * |
| 7928 | * @see #setComponent |
| 7929 | * @see #getComponent |
| 7930 | * @see #resolveActivityInfo |
| 7931 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7932 | public ComponentName resolveActivity(@NonNull PackageManager pm) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7933 | if (mComponent != null) { |
| 7934 | return mComponent; |
| 7935 | } |
| 7936 | |
| 7937 | ResolveInfo info = pm.resolveActivity( |
| 7938 | this, PackageManager.MATCH_DEFAULT_ONLY); |
| 7939 | if (info != null) { |
| 7940 | return new ComponentName( |
| 7941 | info.activityInfo.applicationInfo.packageName, |
| 7942 | info.activityInfo.name); |
| 7943 | } |
| 7944 | |
| 7945 | return null; |
| 7946 | } |
| 7947 | |
| 7948 | /** |
| 7949 | * Resolve the Intent into an {@link ActivityInfo} |
| 7950 | * describing the activity that should execute the intent. Resolution |
| 7951 | * follows the same rules as described for {@link #resolveActivity}, but |
| 7952 | * you get back the completely information about the resolved activity |
| 7953 | * instead of just its class name. |
| 7954 | * |
| 7955 | * @param pm The package manager with which to resolve the Intent. |
| 7956 | * @param flags Addition information to retrieve as per |
| 7957 | * {@link PackageManager#getActivityInfo(ComponentName, int) |
| 7958 | * PackageManager.getActivityInfo()}. |
| 7959 | * |
| 7960 | * @return PackageManager.ActivityInfo |
| 7961 | * |
| 7962 | * @see #resolveActivity |
| 7963 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7964 | public ActivityInfo resolveActivityInfo(@NonNull PackageManager pm, |
| 7965 | @PackageManager.ComponentInfoFlags int flags) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7966 | ActivityInfo ai = null; |
| 7967 | if (mComponent != null) { |
| 7968 | try { |
| 7969 | ai = pm.getActivityInfo(mComponent, flags); |
| 7970 | } catch (PackageManager.NameNotFoundException e) { |
| 7971 | // ignore |
| 7972 | } |
| 7973 | } else { |
| 7974 | ResolveInfo info = pm.resolveActivity( |
Dianne Hackborn | 9bfb707 | 2009-09-22 11:37:40 -0700 | [diff] [blame] | 7975 | this, PackageManager.MATCH_DEFAULT_ONLY | flags); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7976 | if (info != null) { |
| 7977 | ai = info.activityInfo; |
| 7978 | } |
| 7979 | } |
| 7980 | |
| 7981 | return ai; |
| 7982 | } |
| 7983 | |
| 7984 | /** |
Dianne Hackborn | 221ea89 | 2013-08-04 16:50:16 -0700 | [diff] [blame] | 7985 | * Special function for use by the system to resolve service |
| 7986 | * intents to system apps. Throws an exception if there are |
| 7987 | * multiple potential matches to the Intent. Returns null if |
| 7988 | * there are no matches. |
| 7989 | * @hide |
| 7990 | */ |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 7991 | @UnsupportedAppUsage |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 7992 | public @Nullable ComponentName resolveSystemService(@NonNull PackageManager pm, |
| 7993 | @PackageManager.ComponentInfoFlags int flags) { |
Dianne Hackborn | 221ea89 | 2013-08-04 16:50:16 -0700 | [diff] [blame] | 7994 | if (mComponent != null) { |
| 7995 | return mComponent; |
| 7996 | } |
| 7997 | |
| 7998 | List<ResolveInfo> results = pm.queryIntentServices(this, flags); |
| 7999 | if (results == null) { |
| 8000 | return null; |
| 8001 | } |
| 8002 | ComponentName comp = null; |
| 8003 | for (int i=0; i<results.size(); i++) { |
| 8004 | ResolveInfo ri = results.get(i); |
| 8005 | if ((ri.serviceInfo.applicationInfo.flags&ApplicationInfo.FLAG_SYSTEM) == 0) { |
| 8006 | continue; |
| 8007 | } |
| 8008 | ComponentName foundComp = new ComponentName(ri.serviceInfo.applicationInfo.packageName, |
| 8009 | ri.serviceInfo.name); |
| 8010 | if (comp != null) { |
| 8011 | throw new IllegalStateException("Multiple system services handle " + this |
| 8012 | + ": " + comp + ", " + foundComp); |
| 8013 | } |
| 8014 | comp = foundComp; |
| 8015 | } |
| 8016 | return comp; |
| 8017 | } |
| 8018 | |
| 8019 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8020 | * Set the general action to be performed. |
| 8021 | * |
| 8022 | * @param action An action name, such as ACTION_VIEW. Application-specific |
| 8023 | * actions should be prefixed with the vendor's package name. |
| 8024 | * |
| 8025 | * @return Returns the same Intent object, for chaining multiple calls |
| 8026 | * into a single statement. |
| 8027 | * |
| 8028 | * @see #getAction |
| 8029 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8030 | public @NonNull Intent setAction(@Nullable String action) { |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 8031 | mAction = action != null ? action.intern() : null; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8032 | return this; |
| 8033 | } |
| 8034 | |
| 8035 | /** |
| 8036 | * Set the data this intent is operating on. This method automatically |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8037 | * clears any type that was previously set by {@link #setType} or |
| 8038 | * {@link #setTypeAndNormalize}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8039 | * |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8040 | * <p><em>Note: scheme matching in the Android framework is |
| 8041 | * case-sensitive, unlike the formal RFC. As a result, |
| 8042 | * you should always write your Uri with a lower case scheme, |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8043 | * or use {@link Uri#normalizeScheme} or |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8044 | * {@link #setDataAndNormalize} |
| 8045 | * to ensure that the scheme is converted to lower case.</em> |
Dianne Hackborn | b3cddae | 2009-04-13 16:54:00 -0700 | [diff] [blame] | 8046 | * |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8047 | * @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] | 8048 | * |
| 8049 | * @return Returns the same Intent object, for chaining multiple calls |
| 8050 | * into a single statement. |
| 8051 | * |
| 8052 | * @see #getData |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8053 | * @see #setDataAndNormalize |
Dianne Hackborn | 221ea89 | 2013-08-04 16:50:16 -0700 | [diff] [blame] | 8054 | * @see android.net.Uri#normalizeScheme() |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8055 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8056 | public @NonNull Intent setData(@Nullable Uri data) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8057 | mData = data; |
| 8058 | mType = null; |
| 8059 | return this; |
| 8060 | } |
| 8061 | |
| 8062 | /** |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8063 | * Normalize and set the data this intent is operating on. |
| 8064 | * |
| 8065 | * <p>This method automatically clears any type that was |
| 8066 | * previously set (for example, by {@link #setType}). |
| 8067 | * |
| 8068 | * <p>The data Uri is normalized using |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8069 | * {@link android.net.Uri#normalizeScheme} before it is set, |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8070 | * so really this is just a convenience method for |
| 8071 | * <pre> |
| 8072 | * setData(data.normalize()) |
| 8073 | * </pre> |
| 8074 | * |
| 8075 | * @param data The Uri of the data this intent is now targeting. |
| 8076 | * |
| 8077 | * @return Returns the same Intent object, for chaining multiple calls |
| 8078 | * into a single statement. |
| 8079 | * |
| 8080 | * @see #getData |
| 8081 | * @see #setType |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8082 | * @see android.net.Uri#normalizeScheme |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8083 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8084 | public @NonNull Intent setDataAndNormalize(@NonNull Uri data) { |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8085 | return setData(data.normalizeScheme()); |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8086 | } |
| 8087 | |
| 8088 | /** |
| 8089 | * Set an explicit MIME data type. |
| 8090 | * |
| 8091 | * <p>This is used to create intents that only specify a type and not data, |
| 8092 | * for example to indicate the type of data to return. |
| 8093 | * |
| 8094 | * <p>This method automatically clears any data that was |
| 8095 | * previously set (for example by {@link #setData}). |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 8096 | * |
Dianne Hackborn | b3cddae | 2009-04-13 16:54:00 -0700 | [diff] [blame] | 8097 | * <p><em>Note: MIME type matching in the Android framework is |
| 8098 | * case-sensitive, unlike formal RFC MIME types. As a result, |
| 8099 | * you should always write your MIME types with lower case letters, |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8100 | * or use {@link #normalizeMimeType} or {@link #setTypeAndNormalize} |
| 8101 | * 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] | 8102 | * |
| 8103 | * @param type The MIME type of the data being handled by this intent. |
| 8104 | * |
| 8105 | * @return Returns the same Intent object, for chaining multiple calls |
| 8106 | * into a single statement. |
| 8107 | * |
| 8108 | * @see #getType |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8109 | * @see #setTypeAndNormalize |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8110 | * @see #setDataAndType |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8111 | * @see #normalizeMimeType |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8112 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8113 | public @NonNull Intent setType(@Nullable String type) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8114 | mData = null; |
| 8115 | mType = type; |
| 8116 | return this; |
| 8117 | } |
| 8118 | |
| 8119 | /** |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8120 | * Normalize and set an explicit MIME data type. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8121 | * |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8122 | * <p>This is used to create intents that only specify a type and not data, |
| 8123 | * for example to indicate the type of data to return. |
Dianne Hackborn | b3cddae | 2009-04-13 16:54:00 -0700 | [diff] [blame] | 8124 | * |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8125 | * <p>This method automatically clears any data that was |
| 8126 | * previously set (for example by {@link #setData}). |
| 8127 | * |
| 8128 | * <p>The MIME type is normalized using |
| 8129 | * {@link #normalizeMimeType} before it is set, |
| 8130 | * so really this is just a convenience method for |
| 8131 | * <pre> |
| 8132 | * setType(Intent.normalizeMimeType(type)) |
| 8133 | * </pre> |
| 8134 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8135 | * @param type The MIME type of the data being handled by this intent. |
| 8136 | * |
| 8137 | * @return Returns the same Intent object, for chaining multiple calls |
| 8138 | * into a single statement. |
| 8139 | * |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8140 | * @see #getType |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8141 | * @see #setData |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8142 | * @see #normalizeMimeType |
| 8143 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8144 | public @NonNull Intent setTypeAndNormalize(@Nullable String type) { |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8145 | return setType(normalizeMimeType(type)); |
| 8146 | } |
| 8147 | |
| 8148 | /** |
| 8149 | * (Usually optional) Set the data for the intent along with an explicit |
| 8150 | * MIME data type. This method should very rarely be used -- it allows you |
| 8151 | * to override the MIME type that would ordinarily be inferred from the |
| 8152 | * data with your own type given here. |
| 8153 | * |
| 8154 | * <p><em>Note: MIME type and Uri scheme matching in the |
| 8155 | * Android framework is case-sensitive, unlike the formal RFC definitions. |
| 8156 | * 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] | 8157 | * or use {@link #normalizeMimeType} or {@link android.net.Uri#normalizeScheme} or |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8158 | * {@link #setDataAndTypeAndNormalize} |
| 8159 | * to ensure that they are converted to lower case.</em> |
| 8160 | * |
| 8161 | * @param data The Uri of the data this intent is now targeting. |
| 8162 | * @param type The MIME type of the data being handled by this intent. |
| 8163 | * |
| 8164 | * @return Returns the same Intent object, for chaining multiple calls |
| 8165 | * into a single statement. |
| 8166 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8167 | * @see #setType |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8168 | * @see #setData |
| 8169 | * @see #normalizeMimeType |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8170 | * @see android.net.Uri#normalizeScheme |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8171 | * @see #setDataAndTypeAndNormalize |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8172 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8173 | 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] | 8174 | mData = data; |
| 8175 | mType = type; |
| 8176 | return this; |
| 8177 | } |
| 8178 | |
| 8179 | /** |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8180 | * (Usually optional) Normalize and set both the data Uri and an explicit |
| 8181 | * MIME data type. This method should very rarely be used -- it allows you |
| 8182 | * to override the MIME type that would ordinarily be inferred from the |
| 8183 | * data with your own type given here. |
| 8184 | * |
| 8185 | * <p>The data Uri and the MIME type are normalize using |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8186 | * {@link android.net.Uri#normalizeScheme} and {@link #normalizeMimeType} |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8187 | * before they are set, so really this is just a convenience method for |
| 8188 | * <pre> |
| 8189 | * setDataAndType(data.normalize(), Intent.normalizeMimeType(type)) |
| 8190 | * </pre> |
| 8191 | * |
| 8192 | * @param data The Uri of the data this intent is now targeting. |
| 8193 | * @param type The MIME type of the data being handled by this intent. |
| 8194 | * |
| 8195 | * @return Returns the same Intent object, for chaining multiple calls |
| 8196 | * into a single statement. |
| 8197 | * |
| 8198 | * @see #setType |
| 8199 | * @see #setData |
| 8200 | * @see #setDataAndType |
| 8201 | * @see #normalizeMimeType |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8202 | * @see android.net.Uri#normalizeScheme |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8203 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8204 | public @NonNull Intent setDataAndTypeAndNormalize(@NonNull Uri data, @Nullable String type) { |
Jesse Wilson | abc43dd | 2012-05-10 14:29:33 -0400 | [diff] [blame] | 8205 | return setDataAndType(data.normalizeScheme(), normalizeMimeType(type)); |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 8206 | } |
| 8207 | |
| 8208 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8209 | * Add a new category to the intent. Categories provide additional detail |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 8210 | * 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] | 8211 | * activities that provide <em>all</em> of the requested categories will be |
| 8212 | * used. |
| 8213 | * |
| 8214 | * @param category The desired category. This can be either one of the |
| 8215 | * predefined Intent categories, or a custom category in your own |
| 8216 | * namespace. |
| 8217 | * |
| 8218 | * @return Returns the same Intent object, for chaining multiple calls |
| 8219 | * into a single statement. |
| 8220 | * |
| 8221 | * @see #hasCategory |
| 8222 | * @see #removeCategory |
| 8223 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8224 | public @NonNull Intent addCategory(String category) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8225 | if (mCategories == null) { |
Dianne Hackborn | add005c | 2013-07-17 18:43:12 -0700 | [diff] [blame] | 8226 | mCategories = new ArraySet<String>(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8227 | } |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 8228 | mCategories.add(category.intern()); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8229 | return this; |
| 8230 | } |
| 8231 | |
| 8232 | /** |
Ken Wakasa | f76a50c | 2012-03-09 19:56:35 +0900 | [diff] [blame] | 8233 | * Remove a category from an intent. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8234 | * |
| 8235 | * @param category The category to remove. |
| 8236 | * |
| 8237 | * @see #addCategory |
| 8238 | */ |
| 8239 | public void removeCategory(String category) { |
| 8240 | if (mCategories != null) { |
| 8241 | mCategories.remove(category); |
| 8242 | if (mCategories.size() == 0) { |
| 8243 | mCategories = null; |
| 8244 | } |
| 8245 | } |
| 8246 | } |
| 8247 | |
| 8248 | /** |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 8249 | * Set a selector for this Intent. This is a modification to the kinds of |
| 8250 | * things the Intent will match. If the selector is set, it will be used |
| 8251 | * when trying to find entities that can handle the Intent, instead of the |
| 8252 | * main contents of the Intent. This allows you build an Intent containing |
| 8253 | * a generic protocol while targeting it more specifically. |
| 8254 | * |
| 8255 | * <p>An example of where this may be used is with things like |
| 8256 | * {@link #CATEGORY_APP_BROWSER}. This category allows you to build an |
| 8257 | * Intent that will launch the Browser application. However, the correct |
| 8258 | * main entry point of an application is actually {@link #ACTION_MAIN} |
| 8259 | * {@link #CATEGORY_LAUNCHER} with {@link #setComponent(ComponentName)} |
| 8260 | * used to specify the actual Activity to launch. If you launch the browser |
| 8261 | * with something different, undesired behavior may happen if the user has |
| 8262 | * previously or later launches it the normal way, since they do not match. |
| 8263 | * Instead, you can build an Intent with the MAIN action (but no ComponentName |
| 8264 | * yet specified) and set a selector with {@link #ACTION_MAIN} and |
| 8265 | * {@link #CATEGORY_APP_BROWSER} to point it specifically to the browser activity. |
| 8266 | * |
| 8267 | * <p>Setting a selector does not impact the behavior of |
| 8268 | * {@link #filterEquals(Intent)} and {@link #filterHashCode()}. This is part of the |
| 8269 | * desired behavior of a selector -- it does not impact the base meaning |
| 8270 | * of the Intent, just what kinds of things will be matched against it |
| 8271 | * when determining who can handle it.</p> |
| 8272 | * |
| 8273 | * <p>You can not use both a selector and {@link #setPackage(String)} on |
| 8274 | * the same base Intent.</p> |
| 8275 | * |
| 8276 | * @param selector The desired selector Intent; set to null to not use |
| 8277 | * a special selector. |
| 8278 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8279 | public void setSelector(@Nullable Intent selector) { |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 8280 | if (selector == this) { |
| 8281 | throw new IllegalArgumentException( |
| 8282 | "Intent being set as a selector of itself"); |
| 8283 | } |
| 8284 | if (selector != null && mPackage != null) { |
| 8285 | throw new IllegalArgumentException( |
| 8286 | "Can't set selector when package name is already set"); |
| 8287 | } |
| 8288 | mSelector = selector; |
| 8289 | } |
| 8290 | |
| 8291 | /** |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 8292 | * Set a {@link ClipData} associated with this Intent. This replaces any |
| 8293 | * previously set ClipData. |
| 8294 | * |
| 8295 | * <p>The ClipData in an intent is not used for Intent matching or other |
| 8296 | * such operations. Semantically it is like extras, used to transmit |
| 8297 | * additional data with the Intent. The main feature of using this over |
| 8298 | * the extras for data is that {@link #FLAG_GRANT_READ_URI_PERMISSION} |
| 8299 | * and {@link #FLAG_GRANT_WRITE_URI_PERMISSION} will operate on any URI |
| 8300 | * items included in the clip data. This is useful, in particular, if |
| 8301 | * you want to transmit an Intent containing multiple <code>content:</code> |
| 8302 | * URIs for which the recipient may not have global permission to access the |
| 8303 | * content provider. |
| 8304 | * |
| 8305 | * <p>If the ClipData contains items that are themselves Intents, any |
| 8306 | * grant flags in those Intents will be ignored. Only the top-level flags |
| 8307 | * of the main Intent are respected, and will be applied to all Uri or |
| 8308 | * Intent items in the clip (or sub-items of the clip). |
| 8309 | * |
| 8310 | * <p>The MIME type, label, and icon in the ClipData object are not |
| 8311 | * directly used by Intent. Applications should generally rely on the |
| 8312 | * MIME type of the Intent itself, not what it may find in the ClipData. |
| 8313 | * 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] | 8314 | * with a MIME type of "*/*". |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 8315 | * |
| 8316 | * @param clip The new clip to set. May be null to clear the current clip. |
| 8317 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8318 | public void setClipData(@Nullable ClipData clip) { |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 8319 | mClipData = clip; |
| 8320 | } |
| 8321 | |
| 8322 | /** |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 8323 | * This is NOT a secure mechanism to identify the user who sent the intent. |
| 8324 | * When the intent is sent to a different user, it is used to fix uris by adding the userId |
| 8325 | * who sent the intent. |
| 8326 | * @hide |
| 8327 | */ |
Nicolas Prevot | 107f7b7 | 2015-07-01 16:31:48 +0100 | [diff] [blame] | 8328 | public void prepareToLeaveUser(int userId) { |
| 8329 | // If mContentUserHint is not UserHandle.USER_CURRENT, the intent has already left a user. |
| 8330 | // We want mContentUserHint to refer to the original user, so don't do anything. |
| 8331 | if (mContentUserHint == UserHandle.USER_CURRENT) { |
| 8332 | mContentUserHint = userId; |
| 8333 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 8334 | } |
| 8335 | |
| 8336 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8337 | * Add extended data to the intent. The name must include a package |
| 8338 | * prefix, for example the app com.android.contacts would use names |
| 8339 | * like "com.android.contacts.ShowAll". |
| 8340 | * |
| 8341 | * @param name The name of the extra data, with package prefix. |
| 8342 | * @param value The boolean data value. |
| 8343 | * |
| 8344 | * @return Returns the same Intent object, for chaining multiple calls |
| 8345 | * into a single statement. |
| 8346 | * |
| 8347 | * @see #putExtras |
| 8348 | * @see #removeExtra |
| 8349 | * @see #getBooleanExtra(String, boolean) |
| 8350 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8351 | public @NonNull Intent putExtra(String name, boolean value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8352 | if (mExtras == null) { |
| 8353 | mExtras = new Bundle(); |
| 8354 | } |
| 8355 | mExtras.putBoolean(name, value); |
| 8356 | return this; |
| 8357 | } |
| 8358 | |
| 8359 | /** |
| 8360 | * Add extended data to the intent. The name must include a package |
| 8361 | * prefix, for example the app com.android.contacts would use names |
| 8362 | * like "com.android.contacts.ShowAll". |
| 8363 | * |
| 8364 | * @param name The name of the extra data, with package prefix. |
| 8365 | * @param value The byte data value. |
| 8366 | * |
| 8367 | * @return Returns the same Intent object, for chaining multiple calls |
| 8368 | * into a single statement. |
| 8369 | * |
| 8370 | * @see #putExtras |
| 8371 | * @see #removeExtra |
| 8372 | * @see #getByteExtra(String, byte) |
| 8373 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8374 | public @NonNull Intent putExtra(String name, byte value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8375 | if (mExtras == null) { |
| 8376 | mExtras = new Bundle(); |
| 8377 | } |
| 8378 | mExtras.putByte(name, value); |
| 8379 | return this; |
| 8380 | } |
| 8381 | |
| 8382 | /** |
| 8383 | * Add extended data to the intent. The name must include a package |
| 8384 | * prefix, for example the app com.android.contacts would use names |
| 8385 | * like "com.android.contacts.ShowAll". |
| 8386 | * |
| 8387 | * @param name The name of the extra data, with package prefix. |
| 8388 | * @param value The char data value. |
| 8389 | * |
| 8390 | * @return Returns the same Intent object, for chaining multiple calls |
| 8391 | * into a single statement. |
| 8392 | * |
| 8393 | * @see #putExtras |
| 8394 | * @see #removeExtra |
| 8395 | * @see #getCharExtra(String, char) |
| 8396 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8397 | public @NonNull Intent putExtra(String name, char value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8398 | if (mExtras == null) { |
| 8399 | mExtras = new Bundle(); |
| 8400 | } |
| 8401 | mExtras.putChar(name, value); |
| 8402 | return this; |
| 8403 | } |
| 8404 | |
| 8405 | /** |
| 8406 | * Add extended data to the intent. The name must include a package |
| 8407 | * prefix, for example the app com.android.contacts would use names |
| 8408 | * like "com.android.contacts.ShowAll". |
| 8409 | * |
| 8410 | * @param name The name of the extra data, with package prefix. |
| 8411 | * @param value The short data value. |
| 8412 | * |
| 8413 | * @return Returns the same Intent object, for chaining multiple calls |
| 8414 | * into a single statement. |
| 8415 | * |
| 8416 | * @see #putExtras |
| 8417 | * @see #removeExtra |
| 8418 | * @see #getShortExtra(String, short) |
| 8419 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8420 | public @NonNull Intent putExtra(String name, short value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8421 | if (mExtras == null) { |
| 8422 | mExtras = new Bundle(); |
| 8423 | } |
| 8424 | mExtras.putShort(name, value); |
| 8425 | return this; |
| 8426 | } |
| 8427 | |
| 8428 | /** |
| 8429 | * Add extended data to the intent. The name must include a package |
| 8430 | * prefix, for example the app com.android.contacts would use names |
| 8431 | * like "com.android.contacts.ShowAll". |
| 8432 | * |
| 8433 | * @param name The name of the extra data, with package prefix. |
| 8434 | * @param value The integer data value. |
| 8435 | * |
| 8436 | * @return Returns the same Intent object, for chaining multiple calls |
| 8437 | * into a single statement. |
| 8438 | * |
| 8439 | * @see #putExtras |
| 8440 | * @see #removeExtra |
| 8441 | * @see #getIntExtra(String, int) |
| 8442 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8443 | public @NonNull Intent putExtra(String name, int value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8444 | if (mExtras == null) { |
| 8445 | mExtras = new Bundle(); |
| 8446 | } |
| 8447 | mExtras.putInt(name, value); |
| 8448 | return this; |
| 8449 | } |
| 8450 | |
| 8451 | /** |
| 8452 | * Add extended data to the intent. The name must include a package |
| 8453 | * prefix, for example the app com.android.contacts would use names |
| 8454 | * like "com.android.contacts.ShowAll". |
| 8455 | * |
| 8456 | * @param name The name of the extra data, with package prefix. |
| 8457 | * @param value The long data value. |
| 8458 | * |
| 8459 | * @return Returns the same Intent object, for chaining multiple calls |
| 8460 | * into a single statement. |
| 8461 | * |
| 8462 | * @see #putExtras |
| 8463 | * @see #removeExtra |
| 8464 | * @see #getLongExtra(String, long) |
| 8465 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8466 | public @NonNull Intent putExtra(String name, long value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8467 | if (mExtras == null) { |
| 8468 | mExtras = new Bundle(); |
| 8469 | } |
| 8470 | mExtras.putLong(name, value); |
| 8471 | return this; |
| 8472 | } |
| 8473 | |
| 8474 | /** |
| 8475 | * Add extended data to the intent. The name must include a package |
| 8476 | * prefix, for example the app com.android.contacts would use names |
| 8477 | * like "com.android.contacts.ShowAll". |
| 8478 | * |
| 8479 | * @param name The name of the extra data, with package prefix. |
| 8480 | * @param value The float data value. |
| 8481 | * |
| 8482 | * @return Returns the same Intent object, for chaining multiple calls |
| 8483 | * into a single statement. |
| 8484 | * |
| 8485 | * @see #putExtras |
| 8486 | * @see #removeExtra |
| 8487 | * @see #getFloatExtra(String, float) |
| 8488 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8489 | public @NonNull Intent putExtra(String name, float value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8490 | if (mExtras == null) { |
| 8491 | mExtras = new Bundle(); |
| 8492 | } |
| 8493 | mExtras.putFloat(name, value); |
| 8494 | return this; |
| 8495 | } |
| 8496 | |
| 8497 | /** |
| 8498 | * Add extended data to the intent. The name must include a package |
| 8499 | * prefix, for example the app com.android.contacts would use names |
| 8500 | * like "com.android.contacts.ShowAll". |
| 8501 | * |
| 8502 | * @param name The name of the extra data, with package prefix. |
| 8503 | * @param value The double data value. |
| 8504 | * |
| 8505 | * @return Returns the same Intent object, for chaining multiple calls |
| 8506 | * into a single statement. |
| 8507 | * |
| 8508 | * @see #putExtras |
| 8509 | * @see #removeExtra |
| 8510 | * @see #getDoubleExtra(String, double) |
| 8511 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8512 | public @NonNull Intent putExtra(String name, double value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8513 | if (mExtras == null) { |
| 8514 | mExtras = new Bundle(); |
| 8515 | } |
| 8516 | mExtras.putDouble(name, value); |
| 8517 | return this; |
| 8518 | } |
| 8519 | |
| 8520 | /** |
| 8521 | * Add extended data to the intent. The name must include a package |
| 8522 | * prefix, for example the app com.android.contacts would use names |
| 8523 | * like "com.android.contacts.ShowAll". |
| 8524 | * |
| 8525 | * @param name The name of the extra data, with package prefix. |
| 8526 | * @param value The String data value. |
| 8527 | * |
| 8528 | * @return Returns the same Intent object, for chaining multiple calls |
| 8529 | * into a single statement. |
| 8530 | * |
| 8531 | * @see #putExtras |
| 8532 | * @see #removeExtra |
| 8533 | * @see #getStringExtra(String) |
| 8534 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8535 | public @NonNull Intent putExtra(String name, String value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8536 | if (mExtras == null) { |
| 8537 | mExtras = new Bundle(); |
| 8538 | } |
| 8539 | mExtras.putString(name, value); |
| 8540 | return this; |
| 8541 | } |
| 8542 | |
| 8543 | /** |
| 8544 | * Add extended data to the intent. The name must include a package |
| 8545 | * prefix, for example the app com.android.contacts would use names |
| 8546 | * like "com.android.contacts.ShowAll". |
| 8547 | * |
| 8548 | * @param name The name of the extra data, with package prefix. |
| 8549 | * @param value The CharSequence data value. |
| 8550 | * |
| 8551 | * @return Returns the same Intent object, for chaining multiple calls |
| 8552 | * into a single statement. |
| 8553 | * |
| 8554 | * @see #putExtras |
| 8555 | * @see #removeExtra |
| 8556 | * @see #getCharSequenceExtra(String) |
| 8557 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8558 | public @NonNull Intent putExtra(String name, CharSequence value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8559 | if (mExtras == null) { |
| 8560 | mExtras = new Bundle(); |
| 8561 | } |
| 8562 | mExtras.putCharSequence(name, value); |
| 8563 | return this; |
| 8564 | } |
| 8565 | |
| 8566 | /** |
| 8567 | * Add extended data to the intent. The name must include a package |
| 8568 | * prefix, for example the app com.android.contacts would use names |
| 8569 | * like "com.android.contacts.ShowAll". |
| 8570 | * |
| 8571 | * @param name The name of the extra data, with package prefix. |
| 8572 | * @param value The Parcelable data value. |
| 8573 | * |
| 8574 | * @return Returns the same Intent object, for chaining multiple calls |
| 8575 | * into a single statement. |
| 8576 | * |
| 8577 | * @see #putExtras |
| 8578 | * @see #removeExtra |
| 8579 | * @see #getParcelableExtra(String) |
| 8580 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8581 | public @NonNull Intent putExtra(String name, Parcelable value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8582 | if (mExtras == null) { |
| 8583 | mExtras = new Bundle(); |
| 8584 | } |
| 8585 | mExtras.putParcelable(name, value); |
| 8586 | return this; |
| 8587 | } |
| 8588 | |
| 8589 | /** |
| 8590 | * Add extended data to the intent. The name must include a package |
| 8591 | * prefix, for example the app com.android.contacts would use names |
| 8592 | * like "com.android.contacts.ShowAll". |
| 8593 | * |
| 8594 | * @param name The name of the extra data, with package prefix. |
| 8595 | * @param value The Parcelable[] data value. |
| 8596 | * |
| 8597 | * @return Returns the same Intent object, for chaining multiple calls |
| 8598 | * into a single statement. |
| 8599 | * |
| 8600 | * @see #putExtras |
| 8601 | * @see #removeExtra |
| 8602 | * @see #getParcelableArrayExtra(String) |
| 8603 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8604 | public @NonNull Intent putExtra(String name, Parcelable[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8605 | if (mExtras == null) { |
| 8606 | mExtras = new Bundle(); |
| 8607 | } |
| 8608 | mExtras.putParcelableArray(name, value); |
| 8609 | return this; |
| 8610 | } |
| 8611 | |
| 8612 | /** |
| 8613 | * Add extended data to the intent. The name must include a package |
| 8614 | * prefix, for example the app com.android.contacts would use names |
| 8615 | * like "com.android.contacts.ShowAll". |
| 8616 | * |
| 8617 | * @param name The name of the extra data, with package prefix. |
| 8618 | * @param value The ArrayList<Parcelable> data value. |
| 8619 | * |
| 8620 | * @return Returns the same Intent object, for chaining multiple calls |
| 8621 | * into a single statement. |
| 8622 | * |
| 8623 | * @see #putExtras |
| 8624 | * @see #removeExtra |
| 8625 | * @see #getParcelableArrayListExtra(String) |
| 8626 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8627 | public @NonNull Intent putParcelableArrayListExtra(String name, |
| 8628 | ArrayList<? extends Parcelable> value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8629 | if (mExtras == null) { |
| 8630 | mExtras = new Bundle(); |
| 8631 | } |
| 8632 | mExtras.putParcelableArrayList(name, value); |
| 8633 | return this; |
| 8634 | } |
| 8635 | |
| 8636 | /** |
| 8637 | * Add extended data to the intent. The name must include a package |
| 8638 | * prefix, for example the app com.android.contacts would use names |
| 8639 | * like "com.android.contacts.ShowAll". |
| 8640 | * |
| 8641 | * @param name The name of the extra data, with package prefix. |
| 8642 | * @param value The ArrayList<Integer> data value. |
| 8643 | * |
| 8644 | * @return Returns the same Intent object, for chaining multiple calls |
| 8645 | * into a single statement. |
| 8646 | * |
| 8647 | * @see #putExtras |
| 8648 | * @see #removeExtra |
| 8649 | * @see #getIntegerArrayListExtra(String) |
| 8650 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8651 | public @NonNull Intent putIntegerArrayListExtra(String name, ArrayList<Integer> value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8652 | if (mExtras == null) { |
| 8653 | mExtras = new Bundle(); |
| 8654 | } |
| 8655 | mExtras.putIntegerArrayList(name, value); |
| 8656 | return this; |
| 8657 | } |
| 8658 | |
| 8659 | /** |
| 8660 | * Add extended data to the intent. The name must include a package |
| 8661 | * prefix, for example the app com.android.contacts would use names |
| 8662 | * like "com.android.contacts.ShowAll". |
| 8663 | * |
| 8664 | * @param name The name of the extra data, with package prefix. |
| 8665 | * @param value The ArrayList<String> data value. |
| 8666 | * |
| 8667 | * @return Returns the same Intent object, for chaining multiple calls |
| 8668 | * into a single statement. |
| 8669 | * |
| 8670 | * @see #putExtras |
| 8671 | * @see #removeExtra |
| 8672 | * @see #getStringArrayListExtra(String) |
| 8673 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8674 | public @NonNull Intent putStringArrayListExtra(String name, ArrayList<String> value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8675 | if (mExtras == null) { |
| 8676 | mExtras = new Bundle(); |
| 8677 | } |
| 8678 | mExtras.putStringArrayList(name, value); |
| 8679 | return this; |
| 8680 | } |
| 8681 | |
| 8682 | /** |
| 8683 | * Add extended data to the intent. The name must include a package |
| 8684 | * prefix, for example the app com.android.contacts would use names |
| 8685 | * like "com.android.contacts.ShowAll". |
| 8686 | * |
| 8687 | * @param name The name of the extra data, with package prefix. |
Bjorn Bringert | 08bbffb | 2010-02-25 11:16:22 +0000 | [diff] [blame] | 8688 | * @param value The ArrayList<CharSequence> data value. |
| 8689 | * |
| 8690 | * @return Returns the same Intent object, for chaining multiple calls |
| 8691 | * into a single statement. |
| 8692 | * |
| 8693 | * @see #putExtras |
| 8694 | * @see #removeExtra |
| 8695 | * @see #getCharSequenceArrayListExtra(String) |
| 8696 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8697 | public @NonNull Intent putCharSequenceArrayListExtra(String name, |
| 8698 | ArrayList<CharSequence> value) { |
Bjorn Bringert | 08bbffb | 2010-02-25 11:16:22 +0000 | [diff] [blame] | 8699 | if (mExtras == null) { |
| 8700 | mExtras = new Bundle(); |
| 8701 | } |
| 8702 | mExtras.putCharSequenceArrayList(name, value); |
| 8703 | return this; |
| 8704 | } |
| 8705 | |
| 8706 | /** |
| 8707 | * Add extended data to the intent. The name must include a package |
| 8708 | * prefix, for example the app com.android.contacts would use names |
| 8709 | * like "com.android.contacts.ShowAll". |
| 8710 | * |
| 8711 | * @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] | 8712 | * @param value The Serializable data value. |
| 8713 | * |
| 8714 | * @return Returns the same Intent object, for chaining multiple calls |
| 8715 | * into a single statement. |
| 8716 | * |
| 8717 | * @see #putExtras |
| 8718 | * @see #removeExtra |
| 8719 | * @see #getSerializableExtra(String) |
| 8720 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8721 | public @NonNull Intent putExtra(String name, Serializable value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8722 | if (mExtras == null) { |
| 8723 | mExtras = new Bundle(); |
| 8724 | } |
| 8725 | mExtras.putSerializable(name, value); |
| 8726 | return this; |
| 8727 | } |
| 8728 | |
| 8729 | /** |
| 8730 | * Add extended data to the intent. The name must include a package |
| 8731 | * prefix, for example the app com.android.contacts would use names |
| 8732 | * like "com.android.contacts.ShowAll". |
| 8733 | * |
| 8734 | * @param name The name of the extra data, with package prefix. |
| 8735 | * @param value The boolean array data value. |
| 8736 | * |
| 8737 | * @return Returns the same Intent object, for chaining multiple calls |
| 8738 | * into a single statement. |
| 8739 | * |
| 8740 | * @see #putExtras |
| 8741 | * @see #removeExtra |
| 8742 | * @see #getBooleanArrayExtra(String) |
| 8743 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8744 | public @NonNull Intent putExtra(String name, boolean[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8745 | if (mExtras == null) { |
| 8746 | mExtras = new Bundle(); |
| 8747 | } |
| 8748 | mExtras.putBooleanArray(name, value); |
| 8749 | return this; |
| 8750 | } |
| 8751 | |
| 8752 | /** |
| 8753 | * Add extended data to the intent. The name must include a package |
| 8754 | * prefix, for example the app com.android.contacts would use names |
| 8755 | * like "com.android.contacts.ShowAll". |
| 8756 | * |
| 8757 | * @param name The name of the extra data, with package prefix. |
| 8758 | * @param value The byte array data value. |
| 8759 | * |
| 8760 | * @return Returns the same Intent object, for chaining multiple calls |
| 8761 | * into a single statement. |
| 8762 | * |
| 8763 | * @see #putExtras |
| 8764 | * @see #removeExtra |
| 8765 | * @see #getByteArrayExtra(String) |
| 8766 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8767 | public @NonNull Intent putExtra(String name, byte[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8768 | if (mExtras == null) { |
| 8769 | mExtras = new Bundle(); |
| 8770 | } |
| 8771 | mExtras.putByteArray(name, value); |
| 8772 | return this; |
| 8773 | } |
| 8774 | |
| 8775 | /** |
| 8776 | * Add extended data to the intent. The name must include a package |
| 8777 | * prefix, for example the app com.android.contacts would use names |
| 8778 | * like "com.android.contacts.ShowAll". |
| 8779 | * |
| 8780 | * @param name The name of the extra data, with package prefix. |
| 8781 | * @param value The short array data value. |
| 8782 | * |
| 8783 | * @return Returns the same Intent object, for chaining multiple calls |
| 8784 | * into a single statement. |
| 8785 | * |
| 8786 | * @see #putExtras |
| 8787 | * @see #removeExtra |
| 8788 | * @see #getShortArrayExtra(String) |
| 8789 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8790 | public @NonNull Intent putExtra(String name, short[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8791 | if (mExtras == null) { |
| 8792 | mExtras = new Bundle(); |
| 8793 | } |
| 8794 | mExtras.putShortArray(name, value); |
| 8795 | return this; |
| 8796 | } |
| 8797 | |
| 8798 | /** |
| 8799 | * Add extended data to the intent. The name must include a package |
| 8800 | * prefix, for example the app com.android.contacts would use names |
| 8801 | * like "com.android.contacts.ShowAll". |
| 8802 | * |
| 8803 | * @param name The name of the extra data, with package prefix. |
| 8804 | * @param value The char array data value. |
| 8805 | * |
| 8806 | * @return Returns the same Intent object, for chaining multiple calls |
| 8807 | * into a single statement. |
| 8808 | * |
| 8809 | * @see #putExtras |
| 8810 | * @see #removeExtra |
| 8811 | * @see #getCharArrayExtra(String) |
| 8812 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8813 | public @NonNull Intent putExtra(String name, char[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8814 | if (mExtras == null) { |
| 8815 | mExtras = new Bundle(); |
| 8816 | } |
| 8817 | mExtras.putCharArray(name, value); |
| 8818 | return this; |
| 8819 | } |
| 8820 | |
| 8821 | /** |
| 8822 | * Add extended data to the intent. The name must include a package |
| 8823 | * prefix, for example the app com.android.contacts would use names |
| 8824 | * like "com.android.contacts.ShowAll". |
| 8825 | * |
| 8826 | * @param name The name of the extra data, with package prefix. |
| 8827 | * @param value The int array data value. |
| 8828 | * |
| 8829 | * @return Returns the same Intent object, for chaining multiple calls |
| 8830 | * into a single statement. |
| 8831 | * |
| 8832 | * @see #putExtras |
| 8833 | * @see #removeExtra |
| 8834 | * @see #getIntArrayExtra(String) |
| 8835 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8836 | public @NonNull Intent putExtra(String name, int[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8837 | if (mExtras == null) { |
| 8838 | mExtras = new Bundle(); |
| 8839 | } |
| 8840 | mExtras.putIntArray(name, value); |
| 8841 | return this; |
| 8842 | } |
| 8843 | |
| 8844 | /** |
| 8845 | * Add extended data to the intent. The name must include a package |
| 8846 | * prefix, for example the app com.android.contacts would use names |
| 8847 | * like "com.android.contacts.ShowAll". |
| 8848 | * |
| 8849 | * @param name The name of the extra data, with package prefix. |
| 8850 | * @param value The byte array data value. |
| 8851 | * |
| 8852 | * @return Returns the same Intent object, for chaining multiple calls |
| 8853 | * into a single statement. |
| 8854 | * |
| 8855 | * @see #putExtras |
| 8856 | * @see #removeExtra |
| 8857 | * @see #getLongArrayExtra(String) |
| 8858 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8859 | public @NonNull Intent putExtra(String name, long[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8860 | if (mExtras == null) { |
| 8861 | mExtras = new Bundle(); |
| 8862 | } |
| 8863 | mExtras.putLongArray(name, value); |
| 8864 | return this; |
| 8865 | } |
| 8866 | |
| 8867 | /** |
| 8868 | * Add extended data to the intent. The name must include a package |
| 8869 | * prefix, for example the app com.android.contacts would use names |
| 8870 | * like "com.android.contacts.ShowAll". |
| 8871 | * |
| 8872 | * @param name The name of the extra data, with package prefix. |
| 8873 | * @param value The float array data value. |
| 8874 | * |
| 8875 | * @return Returns the same Intent object, for chaining multiple calls |
| 8876 | * into a single statement. |
| 8877 | * |
| 8878 | * @see #putExtras |
| 8879 | * @see #removeExtra |
| 8880 | * @see #getFloatArrayExtra(String) |
| 8881 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8882 | public @NonNull Intent putExtra(String name, float[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8883 | if (mExtras == null) { |
| 8884 | mExtras = new Bundle(); |
| 8885 | } |
| 8886 | mExtras.putFloatArray(name, value); |
| 8887 | return this; |
| 8888 | } |
| 8889 | |
| 8890 | /** |
| 8891 | * Add extended data to the intent. The name must include a package |
| 8892 | * prefix, for example the app com.android.contacts would use names |
| 8893 | * like "com.android.contacts.ShowAll". |
| 8894 | * |
| 8895 | * @param name The name of the extra data, with package prefix. |
| 8896 | * @param value The double array data value. |
| 8897 | * |
| 8898 | * @return Returns the same Intent object, for chaining multiple calls |
| 8899 | * into a single statement. |
| 8900 | * |
| 8901 | * @see #putExtras |
| 8902 | * @see #removeExtra |
| 8903 | * @see #getDoubleArrayExtra(String) |
| 8904 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8905 | public @NonNull Intent putExtra(String name, double[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8906 | if (mExtras == null) { |
| 8907 | mExtras = new Bundle(); |
| 8908 | } |
| 8909 | mExtras.putDoubleArray(name, value); |
| 8910 | return this; |
| 8911 | } |
| 8912 | |
| 8913 | /** |
| 8914 | * Add extended data to the intent. The name must include a package |
| 8915 | * prefix, for example the app com.android.contacts would use names |
| 8916 | * like "com.android.contacts.ShowAll". |
| 8917 | * |
| 8918 | * @param name The name of the extra data, with package prefix. |
| 8919 | * @param value The String array data value. |
| 8920 | * |
| 8921 | * @return Returns the same Intent object, for chaining multiple calls |
| 8922 | * into a single statement. |
| 8923 | * |
| 8924 | * @see #putExtras |
| 8925 | * @see #removeExtra |
| 8926 | * @see #getStringArrayExtra(String) |
| 8927 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8928 | public @NonNull Intent putExtra(String name, String[] value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8929 | if (mExtras == null) { |
| 8930 | mExtras = new Bundle(); |
| 8931 | } |
| 8932 | mExtras.putStringArray(name, value); |
| 8933 | return this; |
| 8934 | } |
| 8935 | |
| 8936 | /** |
| 8937 | * Add extended data to the intent. The name must include a package |
| 8938 | * prefix, for example the app com.android.contacts would use names |
| 8939 | * like "com.android.contacts.ShowAll". |
| 8940 | * |
| 8941 | * @param name The name of the extra data, with package prefix. |
Bjorn Bringert | 08bbffb | 2010-02-25 11:16:22 +0000 | [diff] [blame] | 8942 | * @param value The CharSequence array data value. |
| 8943 | * |
| 8944 | * @return Returns the same Intent object, for chaining multiple calls |
| 8945 | * into a single statement. |
| 8946 | * |
| 8947 | * @see #putExtras |
| 8948 | * @see #removeExtra |
| 8949 | * @see #getCharSequenceArrayExtra(String) |
| 8950 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8951 | public @NonNull Intent putExtra(String name, CharSequence[] value) { |
Bjorn Bringert | 08bbffb | 2010-02-25 11:16:22 +0000 | [diff] [blame] | 8952 | if (mExtras == null) { |
| 8953 | mExtras = new Bundle(); |
| 8954 | } |
| 8955 | mExtras.putCharSequenceArray(name, value); |
| 8956 | return this; |
| 8957 | } |
| 8958 | |
| 8959 | /** |
| 8960 | * Add extended data to the intent. The name must include a package |
| 8961 | * prefix, for example the app com.android.contacts would use names |
| 8962 | * like "com.android.contacts.ShowAll". |
| 8963 | * |
| 8964 | * @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] | 8965 | * @param value The Bundle data value. |
| 8966 | * |
| 8967 | * @return Returns the same Intent object, for chaining multiple calls |
| 8968 | * into a single statement. |
| 8969 | * |
| 8970 | * @see #putExtras |
| 8971 | * @see #removeExtra |
| 8972 | * @see #getBundleExtra(String) |
| 8973 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 8974 | public @NonNull Intent putExtra(String name, Bundle value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 8975 | if (mExtras == null) { |
| 8976 | mExtras = new Bundle(); |
| 8977 | } |
| 8978 | mExtras.putBundle(name, value); |
| 8979 | return this; |
| 8980 | } |
| 8981 | |
| 8982 | /** |
| 8983 | * Add extended data to the intent. The name must include a package |
| 8984 | * prefix, for example the app com.android.contacts would use names |
| 8985 | * like "com.android.contacts.ShowAll". |
| 8986 | * |
| 8987 | * @param name The name of the extra data, with package prefix. |
| 8988 | * @param value The IBinder data value. |
| 8989 | * |
| 8990 | * @return Returns the same Intent object, for chaining multiple calls |
| 8991 | * into a single statement. |
| 8992 | * |
| 8993 | * @see #putExtras |
| 8994 | * @see #removeExtra |
| 8995 | * @see #getIBinderExtra(String) |
| 8996 | * |
| 8997 | * @deprecated |
| 8998 | * @hide |
| 8999 | */ |
| 9000 | @Deprecated |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 9001 | @UnsupportedAppUsage |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9002 | public @NonNull Intent putExtra(String name, IBinder value) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9003 | if (mExtras == null) { |
| 9004 | mExtras = new Bundle(); |
| 9005 | } |
| 9006 | mExtras.putIBinder(name, value); |
| 9007 | return this; |
| 9008 | } |
| 9009 | |
| 9010 | /** |
| 9011 | * Copy all extras in 'src' in to this intent. |
| 9012 | * |
| 9013 | * @param src Contains the extras to copy. |
| 9014 | * |
| 9015 | * @see #putExtra |
| 9016 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9017 | public @NonNull Intent putExtras(@NonNull Intent src) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9018 | if (src.mExtras != null) { |
| 9019 | if (mExtras == null) { |
| 9020 | mExtras = new Bundle(src.mExtras); |
| 9021 | } else { |
| 9022 | mExtras.putAll(src.mExtras); |
| 9023 | } |
| 9024 | } |
| 9025 | return this; |
| 9026 | } |
| 9027 | |
| 9028 | /** |
| 9029 | * Add a set of extended data to the intent. The keys must include a package |
| 9030 | * prefix, for example the app com.android.contacts would use names |
| 9031 | * like "com.android.contacts.ShowAll". |
| 9032 | * |
| 9033 | * @param extras The Bundle of extras to add to this intent. |
| 9034 | * |
| 9035 | * @see #putExtra |
| 9036 | * @see #removeExtra |
| 9037 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9038 | public @NonNull Intent putExtras(@NonNull Bundle extras) { |
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.putAll(extras); |
| 9043 | return this; |
| 9044 | } |
| 9045 | |
| 9046 | /** |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 9047 | * Completely replace the extras in the Intent with the extras in the |
| 9048 | * given Intent. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 9049 | * |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 9050 | * @param src The exact extras contained in this Intent are copied |
| 9051 | * into the target intent, replacing any that were previously there. |
| 9052 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9053 | public @NonNull Intent replaceExtras(@NonNull Intent src) { |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 9054 | mExtras = src.mExtras != null ? new Bundle(src.mExtras) : null; |
| 9055 | return this; |
| 9056 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 9057 | |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 9058 | /** |
| 9059 | * Completely replace the extras in the Intent with the given Bundle of |
| 9060 | * extras. |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 9061 | * |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 9062 | * @param extras The new set of extras in the Intent, or null to erase |
| 9063 | * all extras. |
| 9064 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9065 | public @NonNull Intent replaceExtras(@NonNull Bundle extras) { |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 9066 | mExtras = extras != null ? new Bundle(extras) : null; |
| 9067 | return this; |
| 9068 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 9069 | |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 9070 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9071 | * Remove extended data from the intent. |
| 9072 | * |
| 9073 | * @see #putExtra |
| 9074 | */ |
| 9075 | public void removeExtra(String name) { |
| 9076 | if (mExtras != null) { |
| 9077 | mExtras.remove(name); |
| 9078 | if (mExtras.size() == 0) { |
| 9079 | mExtras = null; |
| 9080 | } |
| 9081 | } |
| 9082 | } |
| 9083 | |
| 9084 | /** |
| 9085 | * Set special flags controlling how this intent is handled. Most values |
| 9086 | * here depend on the type of component being executed by the Intent, |
| 9087 | * specifically the FLAG_ACTIVITY_* flags are all for use with |
| 9088 | * {@link Context#startActivity Context.startActivity()} and the |
| 9089 | * FLAG_RECEIVER_* flags are all for use with |
| 9090 | * {@link Context#sendBroadcast(Intent) Context.sendBroadcast()}. |
| 9091 | * |
Scott Main | 7aee61f | 2011-02-08 11:25:01 -0800 | [diff] [blame] | 9092 | * <p>See the |
| 9093 | * <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back |
| 9094 | * 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] | 9095 | * the behavior of your application. |
| 9096 | * |
| 9097 | * @param flags The desired flags. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9098 | * @return Returns the same Intent object, for chaining multiple calls |
| 9099 | * into a single statement. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9100 | * @see #getFlags |
| 9101 | * @see #addFlags |
Jeff Sharkey | 6a34e56 | 2016-12-21 09:56:00 -0700 | [diff] [blame] | 9102 | * @see #removeFlags |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9103 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9104 | public @NonNull Intent setFlags(@Flags int flags) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9105 | mFlags = flags; |
| 9106 | return this; |
| 9107 | } |
| 9108 | |
| 9109 | /** |
Jeff Sharkey | 6a34e56 | 2016-12-21 09:56:00 -0700 | [diff] [blame] | 9110 | * 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] | 9111 | * |
| 9112 | * @param flags The new flags to set. |
Jeff Sharkey | 6a34e56 | 2016-12-21 09:56:00 -0700 | [diff] [blame] | 9113 | * @return Returns the same Intent object, for chaining multiple calls into |
| 9114 | * a single statement. |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9115 | * @see #setFlags |
| 9116 | * @see #getFlags |
| 9117 | * @see #removeFlags |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9118 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9119 | public @NonNull Intent addFlags(@Flags int flags) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9120 | mFlags |= flags; |
| 9121 | return this; |
| 9122 | } |
| 9123 | |
| 9124 | /** |
Jeff Sharkey | 6a34e56 | 2016-12-21 09:56:00 -0700 | [diff] [blame] | 9125 | * Remove these flags from the intent. |
| 9126 | * |
| 9127 | * @param flags The flags to remove. |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9128 | * @see #setFlags |
| 9129 | * @see #getFlags |
| 9130 | * @see #addFlags |
Jeff Sharkey | 6a34e56 | 2016-12-21 09:56:00 -0700 | [diff] [blame] | 9131 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9132 | public void removeFlags(@Flags int flags) { |
Jeff Sharkey | 6a34e56 | 2016-12-21 09:56:00 -0700 | [diff] [blame] | 9133 | mFlags &= ~flags; |
| 9134 | } |
| 9135 | |
| 9136 | /** |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9137 | * (Usually optional) Set an explicit application package name that limits |
| 9138 | * the components this Intent will resolve to. If left to the default |
| 9139 | * value of null, all components in all applications will considered. |
| 9140 | * If non-null, the Intent can only match the components in the given |
| 9141 | * application package. |
| 9142 | * |
| 9143 | * @param packageName The name of the application package to handle the |
| 9144 | * intent, or null to allow any application package. |
| 9145 | * |
| 9146 | * @return Returns the same Intent object, for chaining multiple calls |
| 9147 | * into a single statement. |
| 9148 | * |
| 9149 | * @see #getPackage |
| 9150 | * @see #resolveActivity |
| 9151 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9152 | public @NonNull Intent setPackage(@Nullable String packageName) { |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9153 | if (packageName != null && mSelector != null) { |
| 9154 | throw new IllegalArgumentException( |
| 9155 | "Can't set package name when selector is already set"); |
| 9156 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9157 | mPackage = packageName; |
| 9158 | return this; |
| 9159 | } |
| 9160 | |
| 9161 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9162 | * (Usually optional) Explicitly set the component to handle the intent. |
| 9163 | * If left with the default value of null, the system will determine the |
| 9164 | * appropriate class to use based on the other fields (action, data, |
| 9165 | * type, categories) in the Intent. If this class is defined, the |
| 9166 | * specified class will always be used regardless of the other fields. You |
| 9167 | * should only set this value when you know you absolutely want a specific |
| 9168 | * class to be used; otherwise it is better to let the system find the |
| 9169 | * appropriate class so that you will respect the installed applications |
| 9170 | * and user preferences. |
| 9171 | * |
| 9172 | * @param component The name of the application component to handle the |
| 9173 | * intent, or null to let the system find one for you. |
| 9174 | * |
| 9175 | * @return Returns the same Intent object, for chaining multiple calls |
| 9176 | * into a single statement. |
| 9177 | * |
| 9178 | * @see #setClass |
| 9179 | * @see #setClassName(Context, String) |
| 9180 | * @see #setClassName(String, String) |
| 9181 | * @see #getComponent |
| 9182 | * @see #resolveActivity |
| 9183 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9184 | public @NonNull Intent setComponent(@Nullable ComponentName component) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9185 | mComponent = component; |
| 9186 | return this; |
| 9187 | } |
| 9188 | |
| 9189 | /** |
| 9190 | * Convenience for calling {@link #setComponent} with an |
| 9191 | * explicit class name. |
| 9192 | * |
| 9193 | * @param packageContext A Context of the application package implementing |
| 9194 | * this class. |
| 9195 | * @param className The name of a class inside of the application package |
| 9196 | * that will be used as the component for this Intent. |
| 9197 | * |
| 9198 | * @return Returns the same Intent object, for chaining multiple calls |
| 9199 | * into a single statement. |
| 9200 | * |
| 9201 | * @see #setComponent |
| 9202 | * @see #setClass |
| 9203 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9204 | public @NonNull Intent setClassName(@NonNull Context packageContext, |
| 9205 | @NonNull String className) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9206 | mComponent = new ComponentName(packageContext, className); |
| 9207 | return this; |
| 9208 | } |
| 9209 | |
| 9210 | /** |
| 9211 | * Convenience for calling {@link #setComponent} with an |
| 9212 | * explicit application package name and class name. |
| 9213 | * |
| 9214 | * @param packageName The name of the package implementing the desired |
| 9215 | * component. |
| 9216 | * @param className The name of a class inside of the application package |
| 9217 | * that will be used as the component for this Intent. |
| 9218 | * |
| 9219 | * @return Returns the same Intent object, for chaining multiple calls |
| 9220 | * into a single statement. |
| 9221 | * |
| 9222 | * @see #setComponent |
| 9223 | * @see #setClass |
| 9224 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9225 | 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] | 9226 | mComponent = new ComponentName(packageName, className); |
| 9227 | return this; |
| 9228 | } |
| 9229 | |
| 9230 | /** |
| 9231 | * Convenience for calling {@link #setComponent(ComponentName)} with the |
| 9232 | * name returned by a {@link Class} object. |
| 9233 | * |
| 9234 | * @param packageContext A Context of the application package implementing |
| 9235 | * this class. |
| 9236 | * @param cls The class name to set, equivalent to |
| 9237 | * <code>setClassName(context, cls.getName())</code>. |
| 9238 | * |
| 9239 | * @return Returns the same Intent object, for chaining multiple calls |
| 9240 | * into a single statement. |
| 9241 | * |
| 9242 | * @see #setComponent |
| 9243 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9244 | 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] | 9245 | mComponent = new ComponentName(packageContext, cls); |
| 9246 | return this; |
| 9247 | } |
| 9248 | |
| 9249 | /** |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9250 | * Set the bounds of the sender of this intent, in screen coordinates. This can be |
| 9251 | * used as a hint to the receiver for animations and the like. Null means that there |
| 9252 | * is no source bounds. |
| 9253 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9254 | public void setSourceBounds(@Nullable Rect r) { |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9255 | if (r != null) { |
| 9256 | mSourceBounds = new Rect(r); |
| 9257 | } else { |
Daniel Lehmann | a5b58df | 2011-10-12 16:24:22 -0700 | [diff] [blame] | 9258 | mSourceBounds = null; |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9259 | } |
| 9260 | } |
| 9261 | |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 9262 | /** @hide */ |
Jeff Sharkey | ce8db99 | 2017-12-13 20:05:05 -0700 | [diff] [blame] | 9263 | @IntDef(flag = true, prefix = { "FILL_IN_" }, value = { |
| 9264 | FILL_IN_ACTION, |
| 9265 | FILL_IN_DATA, |
| 9266 | FILL_IN_CATEGORIES, |
| 9267 | FILL_IN_COMPONENT, |
| 9268 | FILL_IN_PACKAGE, |
| 9269 | FILL_IN_SOURCE_BOUNDS, |
| 9270 | FILL_IN_SELECTOR, |
| 9271 | FILL_IN_CLIP_DATA |
| 9272 | }) |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 9273 | @Retention(RetentionPolicy.SOURCE) |
| 9274 | public @interface FillInFlags {} |
| 9275 | |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9276 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9277 | * Use with {@link #fillIn} to allow the current action value to be |
| 9278 | * overwritten, even if it is already set. |
| 9279 | */ |
| 9280 | public static final int FILL_IN_ACTION = 1<<0; |
| 9281 | |
| 9282 | /** |
| 9283 | * Use with {@link #fillIn} to allow the current data or type value |
| 9284 | * overwritten, even if it is already set. |
| 9285 | */ |
| 9286 | public static final int FILL_IN_DATA = 1<<1; |
| 9287 | |
| 9288 | /** |
| 9289 | * Use with {@link #fillIn} to allow the current categories to be |
| 9290 | * overwritten, even if they are already set. |
| 9291 | */ |
| 9292 | public static final int FILL_IN_CATEGORIES = 1<<2; |
| 9293 | |
| 9294 | /** |
| 9295 | * Use with {@link #fillIn} to allow the current component value to be |
| 9296 | * overwritten, even if it is already set. |
| 9297 | */ |
| 9298 | public static final int FILL_IN_COMPONENT = 1<<3; |
| 9299 | |
| 9300 | /** |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9301 | * Use with {@link #fillIn} to allow the current package value to be |
| 9302 | * overwritten, even if it is already set. |
| 9303 | */ |
| 9304 | public static final int FILL_IN_PACKAGE = 1<<4; |
| 9305 | |
| 9306 | /** |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9307 | * Use with {@link #fillIn} to allow the current bounds rectangle to be |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9308 | * overwritten, even if it is already set. |
| 9309 | */ |
| 9310 | public static final int FILL_IN_SOURCE_BOUNDS = 1<<5; |
| 9311 | |
| 9312 | /** |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9313 | * Use with {@link #fillIn} to allow the current selector to be |
| 9314 | * overwritten, even if it is already set. |
| 9315 | */ |
| 9316 | public static final int FILL_IN_SELECTOR = 1<<6; |
| 9317 | |
| 9318 | /** |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9319 | * Use with {@link #fillIn} to allow the current ClipData to be |
| 9320 | * overwritten, even if it is already set. |
| 9321 | */ |
| 9322 | public static final int FILL_IN_CLIP_DATA = 1<<7; |
| 9323 | |
| 9324 | /** |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9325 | * Copy the contents of <var>other</var> in to this object, but only |
| 9326 | * where fields are not defined by this object. For purposes of a field |
| 9327 | * being defined, the following pieces of data in the Intent are |
| 9328 | * considered to be separate fields: |
| 9329 | * |
| 9330 | * <ul> |
| 9331 | * <li> action, as set by {@link #setAction}. |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 9332 | * <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] | 9333 | * {@link #setType(String)}, or {@link #setDataAndType(Uri, String)}. |
| 9334 | * <li> categories, as set by {@link #addCategory}. |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9335 | * <li> package, as set by {@link #setPackage}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9336 | * <li> component, as set by {@link #setComponent(ComponentName)} or |
| 9337 | * related methods. |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9338 | * <li> source bounds, as set by {@link #setSourceBounds}. |
| 9339 | * <li> selector, as set by {@link #setSelector(Intent)}. |
| 9340 | * <li> clip data, as set by {@link #setClipData(ClipData)}. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9341 | * <li> each top-level name in the associated extras. |
| 9342 | * </ul> |
| 9343 | * |
| 9344 | * <p>In addition, you can use the {@link #FILL_IN_ACTION}, |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9345 | * {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE}, |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9346 | * {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS}, |
| 9347 | * {@link #FILL_IN_SELECTOR}, and {@link #FILL_IN_CLIP_DATA} to override |
| 9348 | * the restriction where the corresponding field will not be replaced if |
| 9349 | * it is already set. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9350 | * |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9351 | * <p>Note: The component field will only be copied if {@link #FILL_IN_COMPONENT} |
| 9352 | * is explicitly specified. The selector will only be copied if |
| 9353 | * {@link #FILL_IN_SELECTOR} is explicitly specified. |
Brett Chabot | 3e39175 | 2009-07-21 16:07:23 -0700 | [diff] [blame] | 9354 | * |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9355 | * <p>For example, consider Intent A with {data="foo", categories="bar"} |
| 9356 | * and Intent B with {action="gotit", data-type="some/thing", |
| 9357 | * categories="one","two"}. |
| 9358 | * |
| 9359 | * <p>Calling A.fillIn(B, Intent.FILL_IN_DATA) will result in A now |
| 9360 | * containing: {action="gotit", data-type="some/thing", |
| 9361 | * categories="bar"}. |
| 9362 | * |
| 9363 | * @param other Another Intent whose values are to be used to fill in |
| 9364 | * the current one. |
| 9365 | * @param flags Options to control which fields can be filled in. |
| 9366 | * |
| 9367 | * @return Returns a bit mask of {@link #FILL_IN_ACTION}, |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9368 | * {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE}, |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 9369 | * {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS}, |
Elliot Waite | 54de774 | 2017-01-11 15:30:35 -0800 | [diff] [blame] | 9370 | * {@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] | 9371 | * changed. |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9372 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 9373 | @FillInFlags |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9374 | public int fillIn(@NonNull Intent other, @FillInFlags int flags) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9375 | int changes = 0; |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9376 | boolean mayHaveCopiedUris = false; |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9377 | if (other.mAction != null |
| 9378 | && (mAction == null || (flags&FILL_IN_ACTION) != 0)) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9379 | mAction = other.mAction; |
| 9380 | changes |= FILL_IN_ACTION; |
| 9381 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9382 | if ((other.mData != null || other.mType != null) |
| 9383 | && ((mData == null && mType == null) |
| 9384 | || (flags&FILL_IN_DATA) != 0)) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9385 | mData = other.mData; |
| 9386 | mType = other.mType; |
| 9387 | changes |= FILL_IN_DATA; |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9388 | mayHaveCopiedUris = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9389 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9390 | if (other.mCategories != null |
| 9391 | && (mCategories == null || (flags&FILL_IN_CATEGORIES) != 0)) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9392 | if (other.mCategories != null) { |
Dianne Hackborn | add005c | 2013-07-17 18:43:12 -0700 | [diff] [blame] | 9393 | mCategories = new ArraySet<String>(other.mCategories); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9394 | } |
| 9395 | changes |= FILL_IN_CATEGORIES; |
| 9396 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9397 | if (other.mPackage != null |
| 9398 | && (mPackage == null || (flags&FILL_IN_PACKAGE) != 0)) { |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9399 | // Only do this if mSelector is not set. |
| 9400 | if (mSelector == null) { |
| 9401 | mPackage = other.mPackage; |
| 9402 | changes |= FILL_IN_PACKAGE; |
| 9403 | } |
| 9404 | } |
| 9405 | // Selector is special: it can only be set if explicitly allowed, |
| 9406 | // for the same reason as the component name. |
| 9407 | if (other.mSelector != null && (flags&FILL_IN_SELECTOR) != 0) { |
| 9408 | if (mPackage == null) { |
| 9409 | mSelector = new Intent(other.mSelector); |
| 9410 | mPackage = null; |
| 9411 | changes |= FILL_IN_SELECTOR; |
| 9412 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9413 | } |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9414 | if (other.mClipData != null |
| 9415 | && (mClipData == null || (flags&FILL_IN_CLIP_DATA) != 0)) { |
| 9416 | mClipData = other.mClipData; |
| 9417 | changes |= FILL_IN_CLIP_DATA; |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9418 | mayHaveCopiedUris = true; |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9419 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9420 | // Component is special: it can -only- be set if explicitly allowed, |
| 9421 | // since otherwise the sender could force the intent somewhere the |
| 9422 | // originator didn't intend. |
| 9423 | if (other.mComponent != null && (flags&FILL_IN_COMPONENT) != 0) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9424 | mComponent = other.mComponent; |
| 9425 | changes |= FILL_IN_COMPONENT; |
| 9426 | } |
| 9427 | mFlags |= other.mFlags; |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9428 | if (other.mSourceBounds != null |
| 9429 | && (mSourceBounds == null || (flags&FILL_IN_SOURCE_BOUNDS) != 0)) { |
| 9430 | mSourceBounds = new Rect(other.mSourceBounds); |
| 9431 | changes |= FILL_IN_SOURCE_BOUNDS; |
| 9432 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9433 | if (mExtras == null) { |
| 9434 | if (other.mExtras != null) { |
| 9435 | mExtras = new Bundle(other.mExtras); |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9436 | mayHaveCopiedUris = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9437 | } |
| 9438 | } else if (other.mExtras != null) { |
| 9439 | try { |
| 9440 | Bundle newb = new Bundle(other.mExtras); |
| 9441 | newb.putAll(mExtras); |
| 9442 | mExtras = newb; |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9443 | mayHaveCopiedUris = true; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9444 | } catch (RuntimeException e) { |
| 9445 | // Modifying the extras can cause us to unparcel the contents |
| 9446 | // of the bundle, and if we do this in the system process that |
| 9447 | // may fail. We really should handle this (i.e., the Bundle |
| 9448 | // impl shouldn't be on top of a plain map), but for now just |
| 9449 | // ignore it and keep the original contents. :( |
| 9450 | Log.w("Intent", "Failure filling in extras", e); |
| 9451 | } |
| 9452 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9453 | if (mayHaveCopiedUris && mContentUserHint == UserHandle.USER_CURRENT |
| 9454 | && other.mContentUserHint != UserHandle.USER_CURRENT) { |
| 9455 | mContentUserHint = other.mContentUserHint; |
| 9456 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9457 | return changes; |
| 9458 | } |
| 9459 | |
| 9460 | /** |
| 9461 | * Wrapper class holding an Intent and implementing comparisons on it for |
| 9462 | * the purpose of filtering. The class implements its |
| 9463 | * {@link #equals equals()} and {@link #hashCode hashCode()} methods as |
| 9464 | * simple calls to {@link Intent#filterEquals(Intent)} filterEquals()} and |
| 9465 | * {@link android.content.Intent#filterHashCode()} filterHashCode()} |
| 9466 | * on the wrapped Intent. |
| 9467 | */ |
| 9468 | public static final class FilterComparison { |
| 9469 | private final Intent mIntent; |
| 9470 | private final int mHashCode; |
| 9471 | |
| 9472 | public FilterComparison(Intent intent) { |
| 9473 | mIntent = intent; |
| 9474 | mHashCode = intent.filterHashCode(); |
| 9475 | } |
| 9476 | |
| 9477 | /** |
| 9478 | * Return the Intent that this FilterComparison represents. |
| 9479 | * @return Returns the Intent held by the FilterComparison. Do |
| 9480 | * not modify! |
| 9481 | */ |
| 9482 | public Intent getIntent() { |
| 9483 | return mIntent; |
| 9484 | } |
| 9485 | |
| 9486 | @Override |
| 9487 | public boolean equals(Object obj) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 9488 | if (obj instanceof FilterComparison) { |
| 9489 | Intent other = ((FilterComparison)obj).mIntent; |
| 9490 | return mIntent.filterEquals(other); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9491 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 9492 | return false; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9493 | } |
| 9494 | |
| 9495 | @Override |
| 9496 | public int hashCode() { |
| 9497 | return mHashCode; |
| 9498 | } |
| 9499 | } |
| 9500 | |
| 9501 | /** |
| 9502 | * Determine if two intents are the same for the purposes of intent |
| 9503 | * resolution (filtering). That is, if their action, data, type, |
| 9504 | * class, and categories are the same. This does <em>not</em> compare |
| 9505 | * any extra data included in the intents. |
| 9506 | * |
| 9507 | * @param other The other Intent to compare against. |
| 9508 | * |
| 9509 | * @return Returns true if action, data, type, class, and categories |
| 9510 | * are the same. |
| 9511 | */ |
| 9512 | public boolean filterEquals(Intent other) { |
| 9513 | if (other == null) { |
| 9514 | return false; |
| 9515 | } |
Christopher Tate | 63d9ae1 | 2014-06-19 19:07:26 -0700 | [diff] [blame] | 9516 | if (!Objects.equals(this.mAction, other.mAction)) return false; |
| 9517 | if (!Objects.equals(this.mData, other.mData)) return false; |
| 9518 | if (!Objects.equals(this.mType, other.mType)) return false; |
| 9519 | if (!Objects.equals(this.mPackage, other.mPackage)) return false; |
| 9520 | if (!Objects.equals(this.mComponent, other.mComponent)) return false; |
| 9521 | if (!Objects.equals(this.mCategories, other.mCategories)) return false; |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9522 | |
| 9523 | return true; |
| 9524 | } |
| 9525 | |
| 9526 | /** |
| 9527 | * Generate hash code that matches semantics of filterEquals(). |
| 9528 | * |
| 9529 | * @return Returns the hash value of the action, data, type, class, and |
| 9530 | * categories. |
| 9531 | * |
| 9532 | * @see #filterEquals |
| 9533 | */ |
| 9534 | public int filterHashCode() { |
| 9535 | int code = 0; |
| 9536 | if (mAction != null) { |
| 9537 | code += mAction.hashCode(); |
| 9538 | } |
| 9539 | if (mData != null) { |
| 9540 | code += mData.hashCode(); |
| 9541 | } |
| 9542 | if (mType != null) { |
| 9543 | code += mType.hashCode(); |
| 9544 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9545 | if (mPackage != null) { |
| 9546 | code += mPackage.hashCode(); |
| 9547 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9548 | if (mComponent != null) { |
| 9549 | code += mComponent.hashCode(); |
| 9550 | } |
| 9551 | if (mCategories != null) { |
| 9552 | code += mCategories.hashCode(); |
| 9553 | } |
| 9554 | return code; |
| 9555 | } |
| 9556 | |
| 9557 | @Override |
| 9558 | public String toString() { |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 9559 | StringBuilder b = new StringBuilder(128); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9560 | |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9561 | b.append("Intent { "); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9562 | toShortString(b, true, true, true, false); |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9563 | b.append(" }"); |
| 9564 | |
| 9565 | return b.toString(); |
| 9566 | } |
| 9567 | |
| 9568 | /** @hide */ |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 9569 | @UnsupportedAppUsage |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 9570 | public String toInsecureString() { |
| 9571 | StringBuilder b = new StringBuilder(128); |
| 9572 | |
| 9573 | b.append("Intent { "); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9574 | toShortString(b, false, true, true, false); |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 9575 | b.append(" }"); |
| 9576 | |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9577 | return b.toString(); |
| 9578 | } |
Romain Guy | 4969af7 | 2009-06-17 10:53:19 -0700 | [diff] [blame] | 9579 | |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9580 | /** @hide */ |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9581 | public String toInsecureStringWithClip() { |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 9582 | StringBuilder b = new StringBuilder(128); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9583 | |
| 9584 | b.append("Intent { "); |
| 9585 | toShortString(b, false, true, true, true); |
| 9586 | b.append(" }"); |
| 9587 | |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 9588 | return b.toString(); |
| 9589 | } |
| 9590 | |
| 9591 | /** @hide */ |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9592 | public String toShortString(boolean secure, boolean comp, boolean extras, boolean clip) { |
| 9593 | StringBuilder b = new StringBuilder(128); |
| 9594 | toShortString(b, secure, comp, extras, clip); |
| 9595 | return b.toString(); |
| 9596 | } |
| 9597 | |
| 9598 | /** @hide */ |
| 9599 | public void toShortString(StringBuilder b, boolean secure, boolean comp, boolean extras, |
| 9600 | boolean clip) { |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9601 | boolean first = true; |
| 9602 | if (mAction != null) { |
| 9603 | b.append("act=").append(mAction); |
| 9604 | first = false; |
| 9605 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9606 | if (mCategories != null) { |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9607 | if (!first) { |
| 9608 | b.append(' '); |
| 9609 | } |
| 9610 | first = false; |
| 9611 | b.append("cat=["); |
Dianne Hackborn | add005c | 2013-07-17 18:43:12 -0700 | [diff] [blame] | 9612 | for (int i=0; i<mCategories.size(); i++) { |
| 9613 | if (i > 0) b.append(','); |
| 9614 | b.append(mCategories.valueAt(i)); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9615 | } |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9616 | b.append("]"); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9617 | } |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9618 | if (mData != null) { |
| 9619 | if (!first) { |
| 9620 | b.append(' '); |
| 9621 | } |
| 9622 | first = false; |
Wink Saville | a428807 | 2010-10-12 12:36:38 -0700 | [diff] [blame] | 9623 | b.append("dat="); |
Dianne Hackborn | 90c52de | 2011-09-23 12:57:44 -0700 | [diff] [blame] | 9624 | if (secure) { |
| 9625 | b.append(mData.toSafeString()); |
Wink Saville | a428807 | 2010-10-12 12:36:38 -0700 | [diff] [blame] | 9626 | } else { |
| 9627 | b.append(mData); |
| 9628 | } |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9629 | } |
| 9630 | if (mType != null) { |
| 9631 | if (!first) { |
| 9632 | b.append(' '); |
| 9633 | } |
| 9634 | first = false; |
| 9635 | b.append("typ=").append(mType); |
| 9636 | } |
| 9637 | if (mFlags != 0) { |
| 9638 | if (!first) { |
| 9639 | b.append(' '); |
| 9640 | } |
| 9641 | first = false; |
| 9642 | b.append("flg=0x").append(Integer.toHexString(mFlags)); |
| 9643 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9644 | if (mPackage != null) { |
| 9645 | if (!first) { |
| 9646 | b.append(' '); |
| 9647 | } |
| 9648 | first = false; |
| 9649 | b.append("pkg=").append(mPackage); |
| 9650 | } |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9651 | if (comp && mComponent != null) { |
| 9652 | if (!first) { |
| 9653 | b.append(' '); |
| 9654 | } |
| 9655 | first = false; |
| 9656 | b.append("cmp=").append(mComponent.flattenToShortString()); |
| 9657 | } |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9658 | if (mSourceBounds != null) { |
| 9659 | if (!first) { |
| 9660 | b.append(' '); |
| 9661 | } |
| 9662 | first = false; |
| 9663 | b.append("bnds=").append(mSourceBounds.toShortString()); |
| 9664 | } |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9665 | if (mClipData != null) { |
| 9666 | if (!first) { |
| 9667 | b.append(' '); |
| 9668 | } |
Dianne Hackborn | ae49872 | 2015-08-14 13:29:47 -0700 | [diff] [blame] | 9669 | b.append("clip={"); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9670 | if (clip) { |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9671 | mClipData.toShortString(b); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9672 | } else { |
Dianne Hackborn | ae49872 | 2015-08-14 13:29:47 -0700 | [diff] [blame] | 9673 | if (mClipData.getDescription() != null) { |
| 9674 | first = !mClipData.getDescription().toShortStringTypesOnly(b); |
| 9675 | } else { |
| 9676 | first = true; |
| 9677 | } |
| 9678 | mClipData.toShortStringShortItems(b, first); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9679 | } |
Dianne Hackborn | ae49872 | 2015-08-14 13:29:47 -0700 | [diff] [blame] | 9680 | first = false; |
| 9681 | b.append('}'); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9682 | } |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9683 | if (extras && mExtras != null) { |
| 9684 | if (!first) { |
| 9685 | b.append(' '); |
| 9686 | } |
| 9687 | first = false; |
| 9688 | b.append("(has extras)"); |
| 9689 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9690 | if (mContentUserHint != UserHandle.USER_CURRENT) { |
| 9691 | if (!first) { |
| 9692 | b.append(' '); |
| 9693 | } |
| 9694 | first = false; |
| 9695 | b.append("u=").append(mContentUserHint); |
| 9696 | } |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9697 | if (mSelector != null) { |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9698 | b.append(" sel="); |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9699 | mSelector.toShortString(b, secure, comp, extras, clip); |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9700 | b.append("}"); |
| 9701 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9702 | } |
| 9703 | |
Yi Jin | 129fc6c | 2017-09-28 15:48:38 -0700 | [diff] [blame] | 9704 | /** @hide */ |
Kweku Adams | 85f2fbc | 2017-12-18 12:04:12 -0800 | [diff] [blame] | 9705 | public void writeToProto(ProtoOutputStream proto, long fieldId) { |
| 9706 | // Same input parameters that toString() gives to toShortString(). |
| 9707 | writeToProto(proto, fieldId, true, true, true, false); |
| 9708 | } |
| 9709 | |
| 9710 | /** @hide */ |
Yi Jin | 129fc6c | 2017-09-28 15:48:38 -0700 | [diff] [blame] | 9711 | public void writeToProto(ProtoOutputStream proto, long fieldId, boolean secure, boolean comp, |
| 9712 | boolean extras, boolean clip) { |
| 9713 | long token = proto.start(fieldId); |
| 9714 | if (mAction != null) { |
| 9715 | proto.write(IntentProto.ACTION, mAction); |
| 9716 | } |
| 9717 | if (mCategories != null) { |
| 9718 | for (String category : mCategories) { |
| 9719 | proto.write(IntentProto.CATEGORIES, category); |
| 9720 | } |
| 9721 | } |
| 9722 | if (mData != null) { |
| 9723 | proto.write(IntentProto.DATA, secure ? mData.toSafeString() : mData.toString()); |
| 9724 | } |
| 9725 | if (mType != null) { |
| 9726 | proto.write(IntentProto.TYPE, mType); |
| 9727 | } |
| 9728 | if (mFlags != 0) { |
| 9729 | proto.write(IntentProto.FLAG, "0x" + Integer.toHexString(mFlags)); |
| 9730 | } |
| 9731 | if (mPackage != null) { |
| 9732 | proto.write(IntentProto.PACKAGE, mPackage); |
| 9733 | } |
| 9734 | if (comp && mComponent != null) { |
Yi Jin | 676d1ac | 2018-01-25 15:40:28 -0800 | [diff] [blame] | 9735 | mComponent.writeToProto(proto, IntentProto.COMPONENT); |
Yi Jin | 129fc6c | 2017-09-28 15:48:38 -0700 | [diff] [blame] | 9736 | } |
| 9737 | if (mSourceBounds != null) { |
| 9738 | proto.write(IntentProto.SOURCE_BOUNDS, mSourceBounds.toShortString()); |
| 9739 | } |
| 9740 | if (mClipData != null) { |
| 9741 | StringBuilder b = new StringBuilder(); |
| 9742 | if (clip) { |
| 9743 | mClipData.toShortString(b); |
| 9744 | } else { |
| 9745 | mClipData.toShortStringShortItems(b, false); |
| 9746 | } |
| 9747 | proto.write(IntentProto.CLIP_DATA, b.toString()); |
| 9748 | } |
| 9749 | if (extras && mExtras != null) { |
| 9750 | proto.write(IntentProto.EXTRAS, mExtras.toShortString()); |
| 9751 | } |
| 9752 | if (mContentUserHint != 0) { |
| 9753 | proto.write(IntentProto.CONTENT_USER_HINT, mContentUserHint); |
| 9754 | } |
| 9755 | if (mSelector != null) { |
| 9756 | proto.write(IntentProto.SELECTOR, mSelector.toShortString(secure, comp, extras, clip)); |
| 9757 | } |
| 9758 | proto.end(token); |
| 9759 | } |
| 9760 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9761 | /** |
| 9762 | * Call {@link #toUri} with 0 flags. |
| 9763 | * @deprecated Use {@link #toUri} instead. |
| 9764 | */ |
| 9765 | @Deprecated |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9766 | public String toURI() { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9767 | return toUri(0); |
| 9768 | } |
| 9769 | |
| 9770 | /** |
| 9771 | * Convert this Intent into a String holding a URI representation of it. |
| 9772 | * The returned URI string has been properly URI encoded, so it can be |
| 9773 | * used with {@link Uri#parse Uri.parse(String)}. The URI contains the |
| 9774 | * Intent's data as the base URI, with an additional fragment describing |
| 9775 | * the action, categories, type, flags, package, component, and extras. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 9776 | * |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9777 | * <p>You can convert the returned string back to an Intent with |
| 9778 | * {@link #getIntent}. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 9779 | * |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9780 | * @param flags Additional operating flags. |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 9781 | * |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9782 | * @return Returns a URI encoding URI string describing the entire contents |
| 9783 | * of the Intent. |
| 9784 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 9785 | public String toUri(@UriFlags int flags) { |
Dianne Hackborn | 1d442e0 | 2009-04-20 18:14:05 -0700 | [diff] [blame] | 9786 | StringBuilder uri = new StringBuilder(128); |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9787 | if ((flags&URI_ANDROID_APP_SCHEME) != 0) { |
| 9788 | if (mPackage == null) { |
| 9789 | throw new IllegalArgumentException( |
| 9790 | "Intent must include an explicit package name to build an android-app: " |
| 9791 | + this); |
| 9792 | } |
| 9793 | uri.append("android-app://"); |
| 9794 | uri.append(mPackage); |
| 9795 | String scheme = null; |
| 9796 | if (mData != null) { |
| 9797 | scheme = mData.getScheme(); |
| 9798 | if (scheme != null) { |
| 9799 | uri.append('/'); |
| 9800 | uri.append(scheme); |
| 9801 | String authority = mData.getEncodedAuthority(); |
| 9802 | if (authority != null) { |
| 9803 | uri.append('/'); |
| 9804 | uri.append(authority); |
| 9805 | String path = mData.getEncodedPath(); |
| 9806 | if (path != null) { |
| 9807 | uri.append(path); |
| 9808 | } |
| 9809 | String queryParams = mData.getEncodedQuery(); |
| 9810 | if (queryParams != null) { |
| 9811 | uri.append('?'); |
| 9812 | uri.append(queryParams); |
| 9813 | } |
| 9814 | String fragment = mData.getEncodedFragment(); |
| 9815 | if (fragment != null) { |
| 9816 | uri.append('#'); |
| 9817 | uri.append(fragment); |
| 9818 | } |
| 9819 | } |
| 9820 | } |
| 9821 | } |
| 9822 | toUriFragment(uri, null, scheme == null ? Intent.ACTION_MAIN : Intent.ACTION_VIEW, |
| 9823 | mPackage, flags); |
| 9824 | return uri.toString(); |
| 9825 | } |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9826 | String scheme = null; |
| 9827 | if (mData != null) { |
| 9828 | String data = mData.toString(); |
| 9829 | if ((flags&URI_INTENT_SCHEME) != 0) { |
| 9830 | final int N = data.length(); |
| 9831 | for (int i=0; i<N; i++) { |
| 9832 | char c = data.charAt(i); |
| 9833 | if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') |
Christopher Schuster | 42c3a6e | 2017-07-21 14:53:52 -0700 | [diff] [blame] | 9834 | || (c >= '0' && c <= '9') || c == '.' || c == '-' || c == '+') { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9835 | continue; |
| 9836 | } |
| 9837 | if (c == ':' && i > 0) { |
| 9838 | // Valid scheme. |
| 9839 | scheme = data.substring(0, i); |
| 9840 | uri.append("intent:"); |
| 9841 | data = data.substring(i+1); |
| 9842 | break; |
| 9843 | } |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 9844 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9845 | // No scheme. |
| 9846 | break; |
| 9847 | } |
| 9848 | } |
| 9849 | uri.append(data); |
Tom Taylor | d4a4729 | 2009-12-21 13:59:18 -0800 | [diff] [blame] | 9850 | |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9851 | } else if ((flags&URI_INTENT_SCHEME) != 0) { |
| 9852 | uri.append("intent:"); |
| 9853 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9854 | |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9855 | toUriFragment(uri, scheme, Intent.ACTION_VIEW, null, flags); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9856 | |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9857 | return uri.toString(); |
| 9858 | } |
| 9859 | |
| 9860 | private void toUriFragment(StringBuilder uri, String scheme, String defAction, |
| 9861 | String defPackage, int flags) { |
| 9862 | StringBuilder frag = new StringBuilder(128); |
| 9863 | |
| 9864 | toUriInner(frag, scheme, defAction, defPackage, flags); |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9865 | if (mSelector != null) { |
Dianne Hackborn | 80b1c56 | 2014-12-09 20:22:08 -0800 | [diff] [blame] | 9866 | frag.append("SEL;"); |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9867 | // Note that for now we are not going to try to handle the |
| 9868 | // data part; not clear how to represent this as a URI, and |
| 9869 | // not much utility in it. |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9870 | mSelector.toUriInner(frag, mSelector.mData != null ? mSelector.mData.getScheme() : null, |
| 9871 | null, null, flags); |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9872 | } |
| 9873 | |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9874 | if (frag.length() > 0) { |
| 9875 | uri.append("#Intent;"); |
| 9876 | uri.append(frag); |
| 9877 | uri.append("end"); |
| 9878 | } |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9879 | } |
| 9880 | |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9881 | private void toUriInner(StringBuilder uri, String scheme, String defAction, |
| 9882 | String defPackage, int flags) { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9883 | if (scheme != null) { |
| 9884 | uri.append("scheme=").append(scheme).append(';'); |
| 9885 | } |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9886 | if (mAction != null && !mAction.equals(defAction)) { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9887 | uri.append("action=").append(Uri.encode(mAction)).append(';'); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9888 | } |
| 9889 | if (mCategories != null) { |
Dianne Hackborn | add005c | 2013-07-17 18:43:12 -0700 | [diff] [blame] | 9890 | for (int i=0; i<mCategories.size(); i++) { |
| 9891 | 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] | 9892 | } |
| 9893 | } |
| 9894 | if (mType != null) { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9895 | uri.append("type=").append(Uri.encode(mType, "/")).append(';'); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9896 | } |
| 9897 | if (mFlags != 0) { |
| 9898 | uri.append("launchFlags=0x").append(Integer.toHexString(mFlags)).append(';'); |
| 9899 | } |
Dianne Hackborn | 85d558c | 2014-11-04 10:31:54 -0800 | [diff] [blame] | 9900 | if (mPackage != null && !mPackage.equals(defPackage)) { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9901 | uri.append("package=").append(Uri.encode(mPackage)).append(';'); |
| 9902 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9903 | if (mComponent != null) { |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9904 | uri.append("component=").append(Uri.encode( |
| 9905 | mComponent.flattenToShortString(), "/")).append(';'); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9906 | } |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9907 | if (mSourceBounds != null) { |
| 9908 | uri.append("sourceBounds=") |
| 9909 | .append(Uri.encode(mSourceBounds.flattenToString())) |
| 9910 | .append(';'); |
| 9911 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9912 | if (mExtras != null) { |
| 9913 | for (String key : mExtras.keySet()) { |
| 9914 | final Object value = mExtras.get(key); |
| 9915 | char entryType = |
| 9916 | value instanceof String ? 'S' : |
| 9917 | value instanceof Boolean ? 'B' : |
| 9918 | value instanceof Byte ? 'b' : |
| 9919 | value instanceof Character ? 'c' : |
| 9920 | value instanceof Double ? 'd' : |
| 9921 | value instanceof Float ? 'f' : |
| 9922 | value instanceof Integer ? 'i' : |
| 9923 | value instanceof Long ? 'l' : |
| 9924 | value instanceof Short ? 's' : |
| 9925 | '\0'; |
| 9926 | |
| 9927 | if (entryType != '\0') { |
| 9928 | uri.append(entryType); |
| 9929 | uri.append('.'); |
| 9930 | uri.append(Uri.encode(key)); |
| 9931 | uri.append('='); |
| 9932 | uri.append(Uri.encode(value.toString())); |
| 9933 | uri.append(';'); |
| 9934 | } |
| 9935 | } |
| 9936 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9937 | } |
The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 9938 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9939 | public int describeContents() { |
| 9940 | return (mExtras != null) ? mExtras.describeContents() : 0; |
| 9941 | } |
| 9942 | |
| 9943 | public void writeToParcel(Parcel out, int flags) { |
| 9944 | out.writeString(mAction); |
| 9945 | Uri.writeToParcel(out, mData); |
| 9946 | out.writeString(mType); |
| 9947 | out.writeInt(mFlags); |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 9948 | out.writeString(mPackage); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9949 | ComponentName.writeToParcel(mComponent, out); |
| 9950 | |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 9951 | if (mSourceBounds != null) { |
| 9952 | out.writeInt(1); |
| 9953 | mSourceBounds.writeToParcel(out, flags); |
| 9954 | } else { |
| 9955 | out.writeInt(0); |
| 9956 | } |
| 9957 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9958 | if (mCategories != null) { |
Dianne Hackborn | add005c | 2013-07-17 18:43:12 -0700 | [diff] [blame] | 9959 | final int N = mCategories.size(); |
| 9960 | out.writeInt(N); |
| 9961 | for (int i=0; i<N; i++) { |
| 9962 | out.writeString(mCategories.valueAt(i)); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9963 | } |
| 9964 | } else { |
| 9965 | out.writeInt(0); |
| 9966 | } |
| 9967 | |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 9968 | if (mSelector != null) { |
| 9969 | out.writeInt(1); |
| 9970 | mSelector.writeToParcel(out, flags); |
| 9971 | } else { |
| 9972 | out.writeInt(0); |
| 9973 | } |
| 9974 | |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 9975 | if (mClipData != null) { |
| 9976 | out.writeInt(1); |
| 9977 | mClipData.writeToParcel(out, flags); |
| 9978 | } else { |
| 9979 | out.writeInt(0); |
| 9980 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 9981 | out.writeInt(mContentUserHint); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9982 | out.writeBundle(mExtras); |
| 9983 | } |
| 9984 | |
| 9985 | public static final Parcelable.Creator<Intent> CREATOR |
| 9986 | = new Parcelable.Creator<Intent>() { |
| 9987 | public Intent createFromParcel(Parcel in) { |
| 9988 | return new Intent(in); |
| 9989 | } |
| 9990 | public Intent[] newArray(int size) { |
| 9991 | return new Intent[size]; |
| 9992 | } |
| 9993 | }; |
| 9994 | |
Dianne Hackborn | eb03465 | 2009-09-07 00:49:58 -0700 | [diff] [blame] | 9995 | /** @hide */ |
| 9996 | protected Intent(Parcel in) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 9997 | readFromParcel(in); |
| 9998 | } |
| 9999 | |
| 10000 | public void readFromParcel(Parcel in) { |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 10001 | setAction(in.readString()); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10002 | mData = Uri.CREATOR.createFromParcel(in); |
| 10003 | mType = in.readString(); |
| 10004 | mFlags = in.readInt(); |
Dianne Hackborn | c14b9cc | 2009-06-17 18:02:12 -0700 | [diff] [blame] | 10005 | mPackage = in.readString(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10006 | mComponent = ComponentName.readFromParcel(in); |
| 10007 | |
Joe Onorato | c7a63ee | 2009-12-02 21:13:17 -0800 | [diff] [blame] | 10008 | if (in.readInt() != 0) { |
| 10009 | mSourceBounds = Rect.CREATOR.createFromParcel(in); |
| 10010 | } |
| 10011 | |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10012 | int N = in.readInt(); |
| 10013 | if (N > 0) { |
Dianne Hackborn | add005c | 2013-07-17 18:43:12 -0700 | [diff] [blame] | 10014 | mCategories = new ArraySet<String>(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10015 | int i; |
| 10016 | for (i=0; i<N; i++) { |
Jeff Brown | 2c376fc | 2011-01-28 17:34:01 -0800 | [diff] [blame] | 10017 | mCategories.add(in.readString().intern()); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10018 | } |
| 10019 | } else { |
| 10020 | mCategories = null; |
| 10021 | } |
| 10022 | |
Dianne Hackborn | f5b8671 | 2011-12-05 17:42:41 -0800 | [diff] [blame] | 10023 | if (in.readInt() != 0) { |
| 10024 | mSelector = new Intent(in); |
| 10025 | } |
| 10026 | |
Dianne Hackborn | 21c241e | 2012-03-08 13:57:23 -0800 | [diff] [blame] | 10027 | if (in.readInt() != 0) { |
| 10028 | mClipData = new ClipData(in); |
| 10029 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10030 | mContentUserHint = in.readInt(); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10031 | mExtras = in.readBundle(); |
| 10032 | } |
| 10033 | |
| 10034 | /** |
| 10035 | * Parses the "intent" element (and its children) from XML and instantiates |
| 10036 | * an Intent object. The given XML parser should be located at the tag |
| 10037 | * where parsing should start (often named "intent"), from which the |
| 10038 | * basic action, data, type, and package and class name will be |
| 10039 | * retrieved. The function will then parse in to any child elements, |
| 10040 | * looking for <category android:name="xxx"> tags to add categories and |
| 10041 | * <extra android:name="xxx" android:value="yyy"> to attach extra data |
| 10042 | * to the intent. |
| 10043 | * |
| 10044 | * @param resources The Resources to use when inflating resources. |
| 10045 | * @param parser The XML parser pointing at an "intent" tag. |
| 10046 | * @param attrs The AttributeSet interface for retrieving extended |
| 10047 | * attribute data at the current <var>parser</var> location. |
| 10048 | * @return An Intent object matching the XML data. |
| 10049 | * @throws XmlPullParserException If there was an XML parsing error. |
| 10050 | * @throws IOException If there was an I/O error. |
| 10051 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 10052 | public static @NonNull Intent parseIntent(@NonNull Resources resources, |
| 10053 | @NonNull XmlPullParser parser, AttributeSet attrs) |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10054 | throws XmlPullParserException, IOException { |
| 10055 | Intent intent = new Intent(); |
| 10056 | |
| 10057 | TypedArray sa = resources.obtainAttributes(attrs, |
| 10058 | com.android.internal.R.styleable.Intent); |
| 10059 | |
| 10060 | intent.setAction(sa.getString(com.android.internal.R.styleable.Intent_action)); |
| 10061 | |
| 10062 | String data = sa.getString(com.android.internal.R.styleable.Intent_data); |
| 10063 | String mimeType = sa.getString(com.android.internal.R.styleable.Intent_mimeType); |
| 10064 | intent.setDataAndType(data != null ? Uri.parse(data) : null, mimeType); |
| 10065 | |
| 10066 | String packageName = sa.getString(com.android.internal.R.styleable.Intent_targetPackage); |
| 10067 | String className = sa.getString(com.android.internal.R.styleable.Intent_targetClass); |
| 10068 | if (packageName != null && className != null) { |
| 10069 | intent.setComponent(new ComponentName(packageName, className)); |
| 10070 | } |
| 10071 | |
| 10072 | sa.recycle(); |
| 10073 | |
| 10074 | int outerDepth = parser.getDepth(); |
| 10075 | int type; |
| 10076 | while ((type=parser.next()) != XmlPullParser.END_DOCUMENT |
| 10077 | && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) { |
| 10078 | if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) { |
| 10079 | continue; |
| 10080 | } |
| 10081 | |
| 10082 | String nodeName = parser.getName(); |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 10083 | if (nodeName.equals(TAG_CATEGORIES)) { |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10084 | sa = resources.obtainAttributes(attrs, |
| 10085 | com.android.internal.R.styleable.IntentCategory); |
| 10086 | String cat = sa.getString(com.android.internal.R.styleable.IntentCategory_name); |
| 10087 | sa.recycle(); |
| 10088 | |
| 10089 | if (cat != null) { |
| 10090 | intent.addCategory(cat); |
| 10091 | } |
| 10092 | XmlUtils.skipCurrentTag(parser); |
| 10093 | |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 10094 | } else if (nodeName.equals(TAG_EXTRA)) { |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 10095 | if (intent.mExtras == null) { |
| 10096 | intent.mExtras = new Bundle(); |
| 10097 | } |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 10098 | resources.parseBundleExtra(TAG_EXTRA, attrs, intent.mExtras); |
The Android Open Source Project | f013e1a | 2008-12-17 18:05:43 -0800 | [diff] [blame] | 10099 | XmlUtils.skipCurrentTag(parser); |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10100 | |
| 10101 | } else { |
| 10102 | XmlUtils.skipCurrentTag(parser); |
| 10103 | } |
| 10104 | } |
| 10105 | |
| 10106 | return intent; |
| 10107 | } |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 10108 | |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 10109 | /** @hide */ |
| 10110 | public void saveToXml(XmlSerializer out) throws IOException { |
| 10111 | if (mAction != null) { |
| 10112 | out.attribute(null, ATTR_ACTION, mAction); |
| 10113 | } |
| 10114 | if (mData != null) { |
| 10115 | out.attribute(null, ATTR_DATA, mData.toString()); |
| 10116 | } |
| 10117 | if (mType != null) { |
| 10118 | out.attribute(null, ATTR_TYPE, mType); |
| 10119 | } |
| 10120 | if (mComponent != null) { |
| 10121 | out.attribute(null, ATTR_COMPONENT, mComponent.flattenToShortString()); |
| 10122 | } |
| 10123 | out.attribute(null, ATTR_FLAGS, Integer.toHexString(getFlags())); |
| 10124 | |
| 10125 | if (mCategories != null) { |
| 10126 | out.startTag(null, TAG_CATEGORIES); |
| 10127 | for (int categoryNdx = mCategories.size() - 1; categoryNdx >= 0; --categoryNdx) { |
| 10128 | out.attribute(null, ATTR_CATEGORY, mCategories.valueAt(categoryNdx)); |
| 10129 | } |
Craig Mautner | 43e52ed | 2014-06-16 17:18:52 -0700 | [diff] [blame] | 10130 | out.endTag(null, TAG_CATEGORIES); |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 10131 | } |
| 10132 | } |
| 10133 | |
| 10134 | /** @hide */ |
| 10135 | public static Intent restoreFromXml(XmlPullParser in) throws IOException, |
| 10136 | XmlPullParserException { |
| 10137 | Intent intent = new Intent(); |
| 10138 | final int outerDepth = in.getDepth(); |
| 10139 | |
| 10140 | int attrCount = in.getAttributeCount(); |
| 10141 | for (int attrNdx = attrCount - 1; attrNdx >= 0; --attrNdx) { |
| 10142 | final String attrName = in.getAttributeName(attrNdx); |
| 10143 | final String attrValue = in.getAttributeValue(attrNdx); |
| 10144 | if (ATTR_ACTION.equals(attrName)) { |
| 10145 | intent.setAction(attrValue); |
| 10146 | } else if (ATTR_DATA.equals(attrName)) { |
| 10147 | intent.setData(Uri.parse(attrValue)); |
| 10148 | } else if (ATTR_TYPE.equals(attrName)) { |
| 10149 | intent.setType(attrValue); |
| 10150 | } else if (ATTR_COMPONENT.equals(attrName)) { |
| 10151 | intent.setComponent(ComponentName.unflattenFromString(attrValue)); |
| 10152 | } else if (ATTR_FLAGS.equals(attrName)) { |
Narayan Kamath | a09b4d2 | 2016-04-15 18:32:45 +0100 | [diff] [blame] | 10153 | intent.setFlags(Integer.parseInt(attrValue, 16)); |
Craig Mautner | 21d24a2 | 2014-04-23 11:45:37 -0700 | [diff] [blame] | 10154 | } else { |
| 10155 | Log.e("Intent", "restoreFromXml: unknown attribute=" + attrName); |
| 10156 | } |
| 10157 | } |
| 10158 | |
| 10159 | int event; |
| 10160 | String name; |
| 10161 | while (((event = in.next()) != XmlPullParser.END_DOCUMENT) && |
| 10162 | (event != XmlPullParser.END_TAG || in.getDepth() < outerDepth)) { |
| 10163 | if (event == XmlPullParser.START_TAG) { |
| 10164 | name = in.getName(); |
| 10165 | if (TAG_CATEGORIES.equals(name)) { |
| 10166 | attrCount = in.getAttributeCount(); |
| 10167 | for (int attrNdx = attrCount - 1; attrNdx >= 0; --attrNdx) { |
| 10168 | intent.addCategory(in.getAttributeValue(attrNdx)); |
| 10169 | } |
| 10170 | } else { |
| 10171 | Log.w("Intent", "restoreFromXml: unknown name=" + name); |
| 10172 | XmlUtils.skipCurrentTag(in); |
| 10173 | } |
| 10174 | } |
| 10175 | } |
| 10176 | |
| 10177 | return intent; |
| 10178 | } |
| 10179 | |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 10180 | /** |
| 10181 | * Normalize a MIME data type. |
| 10182 | * |
| 10183 | * <p>A normalized MIME type has white-space trimmed, |
| 10184 | * content-type parameters removed, and is lower-case. |
| 10185 | * This aligns the type with Android best practices for |
| 10186 | * intent filtering. |
| 10187 | * |
| 10188 | * <p>For example, "text/plain; charset=utf-8" becomes "text/plain". |
| 10189 | * "text/x-vCard" becomes "text/x-vcard". |
| 10190 | * |
| 10191 | * <p>All MIME types received from outside Android (such as user input, |
| 10192 | * or external sources like Bluetooth, NFC, or the Internet) should |
| 10193 | * be normalized before they are used to create an Intent. |
| 10194 | * |
| 10195 | * @param type MIME data type to normalize |
| 10196 | * @return normalized MIME data type, or null if the input was null |
John Spurlock | 125d133 | 2013-11-25 11:58:37 -0500 | [diff] [blame] | 10197 | * @see #setType |
| 10198 | * @see #setTypeAndNormalize |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 10199 | */ |
Jeff Sharkey | 30e06bb | 2017-04-24 11:18:03 -0600 | [diff] [blame] | 10200 | public static @Nullable String normalizeMimeType(@Nullable String type) { |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 10201 | if (type == null) { |
| 10202 | return null; |
| 10203 | } |
| 10204 | |
Elliott Hughes | cb64d43 | 2013-08-02 10:00:44 -0700 | [diff] [blame] | 10205 | type = type.trim().toLowerCase(Locale.ROOT); |
Nick Pelly | ccae412 | 2012-01-09 14:12:58 -0800 | [diff] [blame] | 10206 | |
| 10207 | final int semicolonIndex = type.indexOf(';'); |
| 10208 | if (semicolonIndex != -1) { |
| 10209 | type = type.substring(0, semicolonIndex); |
| 10210 | } |
| 10211 | return type; |
| 10212 | } |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10213 | |
| 10214 | /** |
Jeff Sharkey | a14acd2 | 2013-04-02 18:27:45 -0700 | [diff] [blame] | 10215 | * Prepare this {@link Intent} to leave an app process. |
| 10216 | * |
| 10217 | * @hide |
| 10218 | */ |
Mathew Inwood | 1c77a11 | 2018-08-14 14:06:26 +0100 | [diff] [blame] | 10219 | @UnsupportedAppUsage |
Jeff Sharkey | 344744b | 2016-01-28 19:03:30 -0700 | [diff] [blame] | 10220 | public void prepareToLeaveProcess(Context context) { |
| 10221 | final boolean leavingPackage = (mComponent == null) |
| 10222 | || !Objects.equals(mComponent.getPackageName(), context.getPackageName()); |
| 10223 | prepareToLeaveProcess(leavingPackage); |
| 10224 | } |
| 10225 | |
| 10226 | /** |
| 10227 | * Prepare this {@link Intent} to leave an app process. |
| 10228 | * |
| 10229 | * @hide |
| 10230 | */ |
| 10231 | public void prepareToLeaveProcess(boolean leavingPackage) { |
Jeff Sharkey | a14acd2 | 2013-04-02 18:27:45 -0700 | [diff] [blame] | 10232 | setAllowFds(false); |
| 10233 | |
| 10234 | if (mSelector != null) { |
Jeff Sharkey | 344744b | 2016-01-28 19:03:30 -0700 | [diff] [blame] | 10235 | mSelector.prepareToLeaveProcess(leavingPackage); |
Jeff Sharkey | a14acd2 | 2013-04-02 18:27:45 -0700 | [diff] [blame] | 10236 | } |
| 10237 | if (mClipData != null) { |
Jeff Sharkey | fb833f3 | 2016-12-01 14:59:59 -0700 | [diff] [blame] | 10238 | mClipData.prepareToLeaveProcess(leavingPackage, getFlags()); |
Jeff Sharkey | a14acd2 | 2013-04-02 18:27:45 -0700 | [diff] [blame] | 10239 | } |
| 10240 | |
Jeff Sharkey | c6fe23d | 2017-02-24 09:39:58 -0700 | [diff] [blame] | 10241 | if (mExtras != null && !mExtras.isParcelled()) { |
| 10242 | final Object intent = mExtras.get(Intent.EXTRA_INTENT); |
| 10243 | if (intent instanceof Intent) { |
| 10244 | ((Intent) intent).prepareToLeaveProcess(leavingPackage); |
| 10245 | } |
| 10246 | } |
| 10247 | |
Jeff Sharkey | a8b4278 | 2016-01-30 17:58:09 -0700 | [diff] [blame] | 10248 | if (mAction != null && mData != null && StrictMode.vmFileUriExposureEnabled() |
| 10249 | && leavingPackage) { |
Jeff Sharkey | 344744b | 2016-01-28 19:03:30 -0700 | [diff] [blame] | 10250 | switch (mAction) { |
| 10251 | case ACTION_MEDIA_REMOVED: |
| 10252 | case ACTION_MEDIA_UNMOUNTED: |
| 10253 | case ACTION_MEDIA_CHECKING: |
| 10254 | case ACTION_MEDIA_NOFS: |
| 10255 | case ACTION_MEDIA_MOUNTED: |
| 10256 | case ACTION_MEDIA_SHARED: |
| 10257 | case ACTION_MEDIA_UNSHARED: |
| 10258 | case ACTION_MEDIA_BAD_REMOVAL: |
| 10259 | case ACTION_MEDIA_UNMOUNTABLE: |
| 10260 | case ACTION_MEDIA_EJECT: |
| 10261 | case ACTION_MEDIA_SCANNER_STARTED: |
| 10262 | case ACTION_MEDIA_SCANNER_FINISHED: |
| 10263 | case ACTION_MEDIA_SCANNER_SCAN_FILE: |
Jeff Sharkey | 37355a9 | 2016-02-05 16:19:10 -0700 | [diff] [blame] | 10264 | case ACTION_PACKAGE_NEEDS_VERIFICATION: |
| 10265 | case ACTION_PACKAGE_VERIFIED: |
Jeff Sharkey | 344744b | 2016-01-28 19:03:30 -0700 | [diff] [blame] | 10266 | // Ignore legacy actions |
| 10267 | break; |
| 10268 | default: |
| 10269 | mData.checkFileUriExposed("Intent.getData()"); |
Jeff Sharkey | a14acd2 | 2013-04-02 18:27:45 -0700 | [diff] [blame] | 10270 | } |
| 10271 | } |
Jeff Sharkey | fb833f3 | 2016-12-01 14:59:59 -0700 | [diff] [blame] | 10272 | |
| 10273 | if (mAction != null && mData != null && StrictMode.vmContentUriWithoutPermissionEnabled() |
| 10274 | && leavingPackage) { |
| 10275 | switch (mAction) { |
| 10276 | case ACTION_PROVIDER_CHANGED: |
Makoto Onuki | 7d1911f | 2017-06-09 12:30:09 -0700 | [diff] [blame] | 10277 | case QuickContact.ACTION_QUICK_CONTACT: |
Jeff Sharkey | fb833f3 | 2016-12-01 14:59:59 -0700 | [diff] [blame] | 10278 | // Ignore actions that don't need to grant |
| 10279 | break; |
| 10280 | default: |
| 10281 | mData.checkContentUriWithoutPermission("Intent.getData()", getFlags()); |
| 10282 | } |
| 10283 | } |
Jeff Sharkey | a14acd2 | 2013-04-02 18:27:45 -0700 | [diff] [blame] | 10284 | } |
| 10285 | |
| 10286 | /** |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10287 | * @hide |
| 10288 | */ |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10289 | public void prepareToEnterProcess() { |
Jeff Sharkey | d136e51 | 2016-03-09 22:30:56 -0700 | [diff] [blame] | 10290 | // We just entered destination process, so we should be able to read all |
| 10291 | // parcelables inside. |
| 10292 | setDefusable(true); |
| 10293 | |
| 10294 | if (mSelector != null) { |
| 10295 | mSelector.prepareToEnterProcess(); |
| 10296 | } |
| 10297 | if (mClipData != null) { |
| 10298 | mClipData.prepareToEnterProcess(); |
| 10299 | } |
| 10300 | |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10301 | if (mContentUserHint != UserHandle.USER_CURRENT) { |
Nicolas Prevot | c4fc00a | 2014-10-31 12:01:32 +0000 | [diff] [blame] | 10302 | if (UserHandle.getAppId(Process.myUid()) != Process.SYSTEM_UID) { |
| 10303 | fixUris(mContentUserHint); |
| 10304 | mContentUserHint = UserHandle.USER_CURRENT; |
| 10305 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10306 | } |
| 10307 | } |
| 10308 | |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 10309 | /** @hide */ |
| 10310 | public boolean hasWebURI() { |
| 10311 | if (getData() == null) { |
| 10312 | return false; |
| 10313 | } |
| 10314 | final String scheme = getScheme(); |
| 10315 | if (TextUtils.isEmpty(scheme)) { |
| 10316 | return false; |
| 10317 | } |
| 10318 | return scheme.equals(IntentFilter.SCHEME_HTTP) || scheme.equals(IntentFilter.SCHEME_HTTPS); |
| 10319 | } |
| 10320 | |
| 10321 | /** @hide */ |
Patrick Baumann | 0da8537 | 2018-02-02 16:07:35 -0800 | [diff] [blame] | 10322 | public boolean isWebIntent() { |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 10323 | return ACTION_VIEW.equals(mAction) |
Patrick Baumann | 577d402 | 2018-01-31 16:55:10 +0000 | [diff] [blame] | 10324 | && hasWebURI(); |
| 10325 | } |
| 10326 | |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10327 | /** |
| 10328 | * @hide |
| 10329 | */ |
| 10330 | public void fixUris(int contentUserHint) { |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10331 | Uri data = getData(); |
| 10332 | if (data != null) { |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10333 | mData = maybeAddUserId(data, contentUserHint); |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10334 | } |
| 10335 | if (mClipData != null) { |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10336 | mClipData.fixUris(contentUserHint); |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10337 | } |
| 10338 | String action = getAction(); |
| 10339 | if (ACTION_SEND.equals(action)) { |
| 10340 | final Uri stream = getParcelableExtra(EXTRA_STREAM); |
| 10341 | if (stream != null) { |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10342 | putExtra(EXTRA_STREAM, maybeAddUserId(stream, contentUserHint)); |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10343 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10344 | } else if (ACTION_SEND_MULTIPLE.equals(action)) { |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10345 | final ArrayList<Uri> streams = getParcelableArrayListExtra(EXTRA_STREAM); |
| 10346 | if (streams != null) { |
| 10347 | ArrayList<Uri> newStreams = new ArrayList<Uri>(); |
| 10348 | for (int i = 0; i < streams.size(); i++) { |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10349 | newStreams.add(maybeAddUserId(streams.get(i), contentUserHint)); |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10350 | } |
| 10351 | putParcelableArrayListExtra(EXTRA_STREAM, newStreams); |
| 10352 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10353 | } else if (MediaStore.ACTION_IMAGE_CAPTURE.equals(action) |
| 10354 | || MediaStore.ACTION_IMAGE_CAPTURE_SECURE.equals(action) |
| 10355 | || MediaStore.ACTION_VIDEO_CAPTURE.equals(action)) { |
| 10356 | final Uri output = getParcelableExtra(MediaStore.EXTRA_OUTPUT); |
| 10357 | if (output != null) { |
| 10358 | putExtra(MediaStore.EXTRA_OUTPUT, maybeAddUserId(output, contentUserHint)); |
| 10359 | } |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10360 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10361 | } |
Nicolas Prevot | d85fc72 | 2014-04-16 19:52:08 +0100 | [diff] [blame] | 10362 | |
| 10363 | /** |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10364 | * Migrate any {@link #EXTRA_STREAM} in {@link #ACTION_SEND} and |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10365 | * {@link #ACTION_SEND_MULTIPLE} to {@link ClipData}. Also inspects nested |
| 10366 | * intents in {@link #ACTION_CHOOSER}. |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10367 | * |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10368 | * @return Whether any contents were migrated. |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10369 | * @hide |
| 10370 | */ |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10371 | public boolean migrateExtraStreamToClipData() { |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10372 | // Refuse to touch if extras already parcelled |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10373 | if (mExtras != null && mExtras.isParcelled()) return false; |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10374 | |
| 10375 | // Bail when someone already gave us ClipData |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10376 | if (getClipData() != null) return false; |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10377 | |
| 10378 | final String action = getAction(); |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10379 | if (ACTION_CHOOSER.equals(action)) { |
Jeff Sharkey | c004eef | 2014-09-23 16:40:50 -0700 | [diff] [blame] | 10380 | // Inspect contained intents to see if we need to migrate extras. We |
| 10381 | // don't promote ClipData to the parent, since ChooserActivity will |
| 10382 | // already start the picked item as the caller, and we can't combine |
| 10383 | // the flags in a safe way. |
| 10384 | |
| 10385 | boolean migrated = false; |
Jeff Sharkey | 1c29700 | 2012-05-18 13:55:47 -0700 | [diff] [blame] | 10386 | try { |
Jeff Sharkey | c004eef | 2014-09-23 16:40:50 -0700 | [diff] [blame] | 10387 | final Intent intent = getParcelableExtra(EXTRA_INTENT); |
| 10388 | if (intent != null) { |
| 10389 | migrated |= intent.migrateExtraStreamToClipData(); |
Jeff Sharkey | 1c29700 | 2012-05-18 13:55:47 -0700 | [diff] [blame] | 10390 | } |
| 10391 | } catch (ClassCastException e) { |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10392 | } |
Jeff Sharkey | c004eef | 2014-09-23 16:40:50 -0700 | [diff] [blame] | 10393 | try { |
| 10394 | final Parcelable[] intents = getParcelableArrayExtra(EXTRA_INITIAL_INTENTS); |
| 10395 | if (intents != null) { |
| 10396 | for (int i = 0; i < intents.length; i++) { |
| 10397 | final Intent intent = (Intent) intents[i]; |
| 10398 | if (intent != null) { |
| 10399 | migrated |= intent.migrateExtraStreamToClipData(); |
| 10400 | } |
| 10401 | } |
| 10402 | } |
| 10403 | } catch (ClassCastException e) { |
| 10404 | } |
| 10405 | return migrated; |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10406 | |
| 10407 | } else if (ACTION_SEND.equals(action)) { |
Jeff Sharkey | f27ea66 | 2012-03-27 10:34:24 -0700 | [diff] [blame] | 10408 | try { |
Jeff Sharkey | dd471e6 | 2012-05-01 13:07:01 -0700 | [diff] [blame] | 10409 | final Uri stream = getParcelableExtra(EXTRA_STREAM); |
| 10410 | final CharSequence text = getCharSequenceExtra(EXTRA_TEXT); |
| 10411 | final String htmlText = getStringExtra(EXTRA_HTML_TEXT); |
| 10412 | if (stream != null || text != null || htmlText != null) { |
| 10413 | final ClipData clipData = new ClipData( |
| 10414 | null, new String[] { getType() }, |
| 10415 | new ClipData.Item(text, htmlText, null, stream)); |
| 10416 | setClipData(clipData); |
| 10417 | addFlags(FLAG_GRANT_READ_URI_PERMISSION); |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10418 | return true; |
Jeff Sharkey | dd471e6 | 2012-05-01 13:07:01 -0700 | [diff] [blame] | 10419 | } |
Jeff Sharkey | f27ea66 | 2012-03-27 10:34:24 -0700 | [diff] [blame] | 10420 | } catch (ClassCastException e) { |
Jeff Sharkey | f27ea66 | 2012-03-27 10:34:24 -0700 | [diff] [blame] | 10421 | } |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10422 | |
| 10423 | } else if (ACTION_SEND_MULTIPLE.equals(action)) { |
Jeff Sharkey | f27ea66 | 2012-03-27 10:34:24 -0700 | [diff] [blame] | 10424 | try { |
Jeff Sharkey | dd471e6 | 2012-05-01 13:07:01 -0700 | [diff] [blame] | 10425 | final ArrayList<Uri> streams = getParcelableArrayListExtra(EXTRA_STREAM); |
| 10426 | final ArrayList<CharSequence> texts = getCharSequenceArrayListExtra(EXTRA_TEXT); |
| 10427 | final ArrayList<String> htmlTexts = getStringArrayListExtra(EXTRA_HTML_TEXT); |
| 10428 | int num = -1; |
| 10429 | if (streams != null) { |
| 10430 | num = streams.size(); |
| 10431 | } |
| 10432 | if (texts != null) { |
| 10433 | if (num >= 0 && num != texts.size()) { |
| 10434 | // Wha...! F- you. |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10435 | return false; |
Jeff Sharkey | dd471e6 | 2012-05-01 13:07:01 -0700 | [diff] [blame] | 10436 | } |
| 10437 | num = texts.size(); |
| 10438 | } |
| 10439 | if (htmlTexts != null) { |
| 10440 | if (num >= 0 && num != htmlTexts.size()) { |
| 10441 | // Wha...! F- you. |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10442 | return false; |
Jeff Sharkey | dd471e6 | 2012-05-01 13:07:01 -0700 | [diff] [blame] | 10443 | } |
| 10444 | num = htmlTexts.size(); |
| 10445 | } |
| 10446 | if (num > 0) { |
| 10447 | final ClipData clipData = new ClipData( |
| 10448 | null, new String[] { getType() }, |
| 10449 | makeClipItem(streams, texts, htmlTexts, 0)); |
| 10450 | |
| 10451 | for (int i = 1; i < num; i++) { |
| 10452 | clipData.addItem(makeClipItem(streams, texts, htmlTexts, i)); |
| 10453 | } |
| 10454 | |
| 10455 | setClipData(clipData); |
| 10456 | addFlags(FLAG_GRANT_READ_URI_PERMISSION); |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10457 | return true; |
Jeff Sharkey | dd471e6 | 2012-05-01 13:07:01 -0700 | [diff] [blame] | 10458 | } |
Jeff Sharkey | f27ea66 | 2012-03-27 10:34:24 -0700 | [diff] [blame] | 10459 | } catch (ClassCastException e) { |
Jeff Sharkey | f27ea66 | 2012-03-27 10:34:24 -0700 | [diff] [blame] | 10460 | } |
Nicolas Prevot | d1c99b1 | 2014-07-04 16:56:17 +0100 | [diff] [blame] | 10461 | } else if (MediaStore.ACTION_IMAGE_CAPTURE.equals(action) |
| 10462 | || MediaStore.ACTION_IMAGE_CAPTURE_SECURE.equals(action) |
| 10463 | || MediaStore.ACTION_VIDEO_CAPTURE.equals(action)) { |
| 10464 | final Uri output; |
| 10465 | try { |
| 10466 | output = getParcelableExtra(MediaStore.EXTRA_OUTPUT); |
| 10467 | } catch (ClassCastException e) { |
| 10468 | return false; |
| 10469 | } |
| 10470 | if (output != null) { |
| 10471 | setClipData(ClipData.newRawUri("", output)); |
| 10472 | addFlags(FLAG_GRANT_WRITE_URI_PERMISSION|FLAG_GRANT_READ_URI_PERMISSION); |
| 10473 | return true; |
| 10474 | } |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10475 | } |
Jeff Sharkey | 3b7d1ef | 2012-05-14 17:21:10 -0700 | [diff] [blame] | 10476 | |
| 10477 | return false; |
Jeff Sharkey | 678d04f | 2012-03-23 15:41:58 -0700 | [diff] [blame] | 10478 | } |
Dianne Hackborn | ac4243f | 2012-04-13 17:32:18 -0700 | [diff] [blame] | 10479 | |
Michael Wright | 1985976 | 2017-09-18 20:57:58 +0100 | [diff] [blame] | 10480 | /** |
| 10481 | * Convert the dock state to a human readable format. |
| 10482 | * @hide |
| 10483 | */ |
| 10484 | public static String dockStateToString(int dock) { |
| 10485 | switch (dock) { |
| 10486 | case EXTRA_DOCK_STATE_HE_DESK: |
| 10487 | return "EXTRA_DOCK_STATE_HE_DESK"; |
| 10488 | case EXTRA_DOCK_STATE_LE_DESK: |
| 10489 | return "EXTRA_DOCK_STATE_LE_DESK"; |
| 10490 | case EXTRA_DOCK_STATE_CAR: |
| 10491 | return "EXTRA_DOCK_STATE_CAR"; |
| 10492 | case EXTRA_DOCK_STATE_DESK: |
| 10493 | return "EXTRA_DOCK_STATE_DESK"; |
| 10494 | case EXTRA_DOCK_STATE_UNDOCKED: |
| 10495 | return "EXTRA_DOCK_STATE_UNDOCKED"; |
| 10496 | default: |
| 10497 | return Integer.toString(dock); |
| 10498 | } |
| 10499 | } |
| 10500 | |
Dianne Hackborn | ac4243f | 2012-04-13 17:32:18 -0700 | [diff] [blame] | 10501 | private static ClipData.Item makeClipItem(ArrayList<Uri> streams, ArrayList<CharSequence> texts, |
| 10502 | ArrayList<String> htmlTexts, int which) { |
| 10503 | Uri uri = streams != null ? streams.get(which) : null; |
| 10504 | CharSequence text = texts != null ? texts.get(which) : null; |
| 10505 | String htmlText = htmlTexts != null ? htmlTexts.get(which) : null; |
| 10506 | return new ClipData.Item(text, htmlText, null, uri); |
| 10507 | } |
Craig Mautner | d00f474 | 2014-03-12 14:17:26 -0700 | [diff] [blame] | 10508 | |
| 10509 | /** @hide */ |
| 10510 | public boolean isDocument() { |
| 10511 | return (mFlags & FLAG_ACTIVITY_NEW_DOCUMENT) == FLAG_ACTIVITY_NEW_DOCUMENT; |
| 10512 | } |
The Android Open Source Project | 54b6cfa | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 10513 | } |