Intent.java revision e1d7c711df3e3a2d2f195457882aa4ddb5626167
19258b6bc66e09368ada54001f619d53b4fc976d5ager@chromium.org/* 243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Copyright (C) 2006 The Android Open Source Project 343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Licensed under the Apache License, Version 2.0 (the "License"); 543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * you may not use this file except in compliance with the License. 643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * You may obtain a copy of the License at 743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * http://www.apache.org/licenses/LICENSE-2.0 943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 1043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Unless required by applicable law or agreed to in writing, software 1143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * distributed under the License is distributed on an "AS IS" BASIS, 1243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * See the License for the specific language governing permissions and 1443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * limitations under the License. 1543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 1643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 1743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenpackage android.content; 1843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 1943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport org.xmlpull.v1.XmlPullParser; 2043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport org.xmlpull.v1.XmlPullParserException; 2143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 2243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.annotation.SdkConstant; 2343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.annotation.SdkConstant.SdkConstantType; 2443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.content.pm.ActivityInfo; 2543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.content.pm.PackageManager; 2643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.content.pm.ResolveInfo; 2743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.content.res.Resources; 2843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.content.res.TypedArray; 2943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.graphics.Rect; 3043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.media.RemoteControlClient; 3143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.net.Uri; 3243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.os.Bundle; 3343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.os.IBinder; 3443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.os.Parcel; 3543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.os.Parcelable; 3643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.util.AttributeSet; 3743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport android.util.Log; 3843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 3943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport com.android.internal.util.XmlUtils; 4071affb54842da76b24f0bb3184e9f0960523f89dkasperl@chromium.org 4171affb54842da76b24f0bb3184e9f0960523f89dkasperl@chromium.orgimport java.io.IOException; 4243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport java.io.Serializable; 4343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport java.net.URISyntaxException; 4443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport java.util.ArrayList; 4543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport java.util.HashSet; 4643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport java.util.Iterator; 4743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport java.util.Locale; 4843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansenimport java.util.Set; 4943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 5043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen/** 5143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * An intent is an abstract description of an operation to be performed. It 5243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * can be used with {@link Context#startActivity(Intent) startActivity} to 5343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * launch an {@link android.app.Activity}, 5443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link android.content.Context#sendBroadcast(Intent) broadcastIntent} to 5543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * send it to any interested {@link BroadcastReceiver BroadcastReceiver} components, 5643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * and {@link android.content.Context#startService} or 5743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link android.content.Context#bindService} to communicate with a 5843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * background {@link android.app.Service}. 5943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 6043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>An Intent provides a facility for performing late runtime binding between the code in 6141044eb0969b0d7d5c041a077519a36efa6aff27kasperl@chromium.org * different applications. Its most significant use is in the launching of activities, where it 6243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * can be thought of as the glue between activities. It is basically a passive data structure 6343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * holding an abstract description of an action to be performed.</p> 6443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 6543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <div class="special reference"> 6643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <h3>Developer Guides</h3> 677c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org * <p>For information about how to create and resolve intents, read the 6843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <a href="{@docRoot}guide/topics/intents/intents-filters.html">Intents and Intent Filters</a> 6943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * developer guide.</p> 7043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </div> 7143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 7243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <a name="IntentStructure"></a> 7343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <h3>Intent Structure</h3> 7443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>The primary pieces of information in an intent are:</p> 7543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 7643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 7743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>action</b> -- The general action to be performed, such as 7843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #ACTION_VIEW}, {@link #ACTION_EDIT}, {@link #ACTION_MAIN}, 7943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * etc.</p> 8043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </li> 8143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>data</b> -- The data to operate on, such as a person record 8243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * in the contacts database, expressed as a {@link android.net.Uri}.</p> 8343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </li> 8443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ul> 8543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 8643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 8743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Some examples of action/data pairs are:</p> 8843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 8943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 9043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>{@link #ACTION_VIEW} <i>content://contacts/people/1</i></b> -- Display 9143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * information about the person whose identifier is "1".</p> 9243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </li> 9343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>{@link #ACTION_DIAL} <i>content://contacts/people/1</i></b> -- Display 949a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com * the phone dialer with the person filled in.</p> 9543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </li> 9643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>{@link #ACTION_VIEW} <i>tel:123</i></b> -- Display 9743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * the phone dialer with the given number filled in. Note how the 9843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * VIEW action does what what is considered the most reasonable thing for 9943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * a particular URI.</p> 10043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </li> 10143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>{@link #ACTION_DIAL} <i>tel:123</i></b> -- Display 10243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * the phone dialer with the given number filled in.</p> 10343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </li> 10443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>{@link #ACTION_EDIT} <i>content://contacts/people/1</i></b> -- Edit 10543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * information about the person whose identifier is "1".</p> 10643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </li> 10743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>{@link #ACTION_VIEW} <i>content://contacts/people/</i></b> -- Display 10843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * a list of people, which the user can browse through. This example is a 10943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * typical top-level entry into the Contacts application, showing you the 11043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * list of people. Selecting a particular person to view would result in a 11143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * new intent { <b>{@link #ACTION_VIEW} <i>content://contacts/N</i></b> } 11243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * being used to start an activity to display that person.</p> 11343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </li> 11443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ul> 11543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 11643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>In addition to these primary attributes, there are a number of secondary 11743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * attributes that you can also include with an intent:</p> 11843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 11943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 12043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>category</b> -- Gives additional information about the action 12143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * to execute. For example, {@link #CATEGORY_LAUNCHER} means it should 12243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * appear in the Launcher as a top-level application, while 12343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #CATEGORY_ALTERNATIVE} means it should be included in a list 12443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * of alternative actions the user can perform on a piece of data.</p> 12543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>type</b> -- Specifies an explicit type (a MIME type) of the 12643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * intent data. Normally the type is inferred from the data itself. 12743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * By setting this attribute, you disable that evaluation and force 12843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * an explicit type.</p> 12943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>component</b> -- Specifies an explicit name of a component 13043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * class to use for the intent. Normally this is determined by looking 13143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * at the other information in the intent (the action, data/type, and 13243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * categories) and matching that with a component that can handle it. 13343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * If this attribute is set then none of the evaluation is performed, 13443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * and this component is used exactly as is. By specifying this attribute, 13543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * all of the other Intent attributes become optional.</p> 13643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>extras</b> -- This is a {@link Bundle} of any additional information. 13743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * This can be used to provide extended information to the component. 13843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * For example, if we have a action to send an e-mail message, we could 13943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * also include extra pieces of data here to supply a subject, body, 14043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * etc.</p> 14143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ul> 14243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 14343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Here are some examples of other operations you can specify as intents 14443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * using these additional parameters:</p> 14543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 14643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 14743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>{@link #ACTION_MAIN} with category {@link #CATEGORY_HOME}</b> -- 14843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Launch the home screen.</p> 14943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </li> 15043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>{@link #ACTION_GET_CONTENT} with MIME type 15143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <i>{@link android.provider.Contacts.Phones#CONTENT_URI 15243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * vnd.android.cursor.item/phone}</i></b> 15343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * -- Display the list of people's phone numbers, allowing the user to 15443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * browse through them and pick one and return it to the parent activity.</p> 15543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </li> 15643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>{@link #ACTION_GET_CONTENT} with MIME type 15743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <i>*{@literal /}*</i> and category {@link #CATEGORY_OPENABLE}</b> 15843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * -- Display all pickers for data that can be opened with 15943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link ContentResolver#openInputStream(Uri) ContentResolver.openInputStream()}, 16043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * allowing the user to pick one of them and then some data inside of it 16143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * and returning the resulting URI to the caller. This can be used, 16243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * for example, in an e-mail application to allow the user to pick some 16343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * data to include as an attachment.</p> 16443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </li> 16543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ul> 16643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 16743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>There are a variety of standard Intent action and category constants 16843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * defined in the Intent class, but applications can also define their own. 16943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * These strings use java style scoping, to ensure they are unique -- for 17043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * example, the standard {@link #ACTION_VIEW} is called 17143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * "android.intent.action.VIEW".</p> 17243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 17343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Put together, the set of actions, data types, categories, and extra data 17443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * defines a language for the system allowing for the expression of phrases 17543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * such as "call john smith's cell". As applications are added to the system, 17643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * they can extend this language by adding new actions, types, and categories, or 17743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * they can modify the behavior of existing phrases by supplying their own 17843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * activities that handle them.</p> 17943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 18043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <a name="IntentResolution"></a> 18143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <h3>Intent Resolution</h3> 18243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 18343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>There are two primary forms of intents you will use. 18443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 18543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 18643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>Explicit Intents</b> have specified a component (via 18743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #setComponent} or {@link #setClass}), which provides the exact 18843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * class to be run. Often these will not include any other information, 18943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * simply being a way for an application to launch various internal 19043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * activities it has as the user interacts with the application. 19143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 19243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>Implicit Intents</b> have not specified a component; 19343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * instead, they must include enough information for the system to 19443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * determine which of the available components is best to run for that 19543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * intent. 19643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ul> 19743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 19843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>When using implicit intents, given such an arbitrary intent we need to 19943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * know what to do with it. This is handled by the process of <em>Intent 20043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * resolution</em>, which maps an Intent to an {@link android.app.Activity}, 20143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link BroadcastReceiver}, or {@link android.app.Service} (or sometimes two or 20243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * more activities/receivers) that can handle it.</p> 20343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 20443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>The intent resolution mechanism basically revolves around matching an 20543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Intent against all of the <intent-filter> descriptions in the 20643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * installed application packages. (Plus, in the case of broadcasts, any {@link BroadcastReceiver} 20743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * objects explicitly registered with {@link Context#registerReceiver}.) More 20843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * details on this can be found in the documentation on the {@link 2093bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org * IntentFilter} class.</p> 2103bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org * 2113bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org * <p>There are three pieces of information in the Intent that are used for 2123bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org * resolution: the action, type, and category. Using this information, a query 2133bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org * is done on the {@link PackageManager} for a component that can handle the 2143bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org * intent. The appropriate component is determined based on the intent 2153bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org * information supplied in the <code>AndroidManifest.xml</code> file as 2163bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org * follows:</p> 2173bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org * 21843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 2193bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org * <li> <p>The <b>action</b>, if given, must be listed by the component as 2203bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org * one it handles.</p> 22143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p>The <b>type</b> is retrieved from the Intent's data, if not 2223bf7b91c90e9bff46f53eec55055d2d1a1949215ager@chromium.org * already supplied in the Intent. Like the action, if a type is 22343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * included in the intent (either explicitly or implicitly in its 22443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * data), then this must be listed by the component as one it handles.</p> 22543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> For data that is not a <code>content:</code> URI and where no explicit 22643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * type is included in the Intent, instead the <b>scheme</b> of the 22743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * intent data (such as <code>http:</code> or <code>mailto:</code>) is 22843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * considered. Again like the action, if we are matching a scheme it 22943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * must be listed by the component as one it can handle. 23043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p>The <b>categories</b>, if supplied, must <em>all</em> be listed 23143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * by the activity as categories it handles. That is, if you include 23243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * the categories {@link #CATEGORY_LAUNCHER} and 23343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #CATEGORY_ALTERNATIVE}, then you will only resolve to components 23443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * with an intent that lists <em>both</em> of those categories. 23543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activities will very often need to support the 23643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #CATEGORY_DEFAULT} so that they can be found by 23743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link Context#startActivity Context.startActivity()}.</p> 23843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ul> 23943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 24043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>For example, consider the Note Pad sample application that 24143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * allows user to browse through a list of notes data and view details about 24243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * individual items. Text in italics indicate places were you would replace a 24343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * name with one specific to your own package.</p> 24443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 24543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <pre> <manifest xmlns:android="http://schemas.android.com/apk/res/android" 24643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * package="<i>com.android.notepad</i>"> 24743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <application android:icon="@drawable/app_notes" 24843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * android:label="@string/app_name"> 24943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 25043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <provider class=".NotePadProvider" 25143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * android:authorities="<i>com.google.provider.NotePad</i>" /> 25243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 25343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <activity class=".NotesList" android:label="@string/title_notes_list"> 25443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <intent-filter> 25543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="android.intent.action.MAIN" /> 25643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <category android:name="android.intent.category.LAUNCHER" /> 25743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </intent-filter> 25843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <intent-filter> 25943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="android.intent.action.VIEW" /> 26043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="android.intent.action.EDIT" /> 26143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="android.intent.action.PICK" /> 26243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <category android:name="android.intent.category.DEFAULT" /> 26343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <data android:mimeType="vnd.android.cursor.dir/<i>vnd.google.note</i>" /> 26443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </intent-filter> 26543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <intent-filter> 26643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="android.intent.action.GET_CONTENT" /> 26743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <category android:name="android.intent.category.DEFAULT" /> 26843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> 269ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * </intent-filter> 270ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * </activity> 271ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * 272ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * <activity class=".NoteEditor" android:label="@string/title_note"> 273ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * <intent-filter android:label="@string/resolve_edit"> 27443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="android.intent.action.VIEW" /> 27543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="android.intent.action.EDIT" /> 27643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <category android:name="android.intent.category.DEFAULT" /> 27743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> 27843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </intent-filter> 27943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 28043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <intent-filter> 28143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="android.intent.action.INSERT" /> 28243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <category android:name="android.intent.category.DEFAULT" /> 28343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <data android:mimeType="vnd.android.cursor.dir/<i>vnd.google.note</i>" /> 28443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </intent-filter> 28543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 28643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </activity> 28743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 28843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <activity class=".TitleEditor" android:label="@string/title_edit_title" 28943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * android:theme="@android:style/Theme.Dialog"> 29043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <intent-filter android:label="@string/resolve_title"> 29143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="<i>com.android.notepad.action.EDIT_TITLE</i>" /> 292cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager * <category android:name="android.intent.category.DEFAULT" /> 2935a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <category android:name="android.intent.category.ALTERNATIVE" /> 2945a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <category android:name="android.intent.category.SELECTED_ALTERNATIVE" /> 2955a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> 29643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </intent-filter> 29743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </activity> 29843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 29943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </application> 30043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </manifest></pre> 30143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 30243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>The first activity, 30343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <code>com.android.notepad.NotesList</code>, serves as our main 30443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * entry into the app. It can do three things as described by its three intent 30543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * templates: 30643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ol> 30743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li><pre> 30843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <intent-filter> 30943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="{@link #ACTION_MAIN android.intent.action.MAIN}" /> 31043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <category android:name="{@link #CATEGORY_LAUNCHER android.intent.category.LAUNCHER}" /> 311b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * </intent-filter></pre> 31243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>This provides a top-level entry into the NotePad application: the standard 31343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * MAIN action is a main entry point (not requiring any other information in 31443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * the Intent), and the LAUNCHER category says that this entry point should be 31543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * listed in the application launcher.</p> 31643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li><pre> 31743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <intent-filter> 31843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="{@link #ACTION_VIEW android.intent.action.VIEW}" /> 31943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="{@link #ACTION_EDIT android.intent.action.EDIT}" /> 32043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="{@link #ACTION_PICK android.intent.action.PICK}" /> 32143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> 32243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <data mimeType:name="vnd.android.cursor.dir/<i>vnd.google.note</i>" /> 32343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </intent-filter></pre> 32443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>This declares the things that the activity can do on a directory of 32543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * notes. The type being supported is given with the <type> tag, where 32643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <code>vnd.android.cursor.dir/vnd.google.note</code> is a URI from which 32743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * a Cursor of zero or more items (<code>vnd.android.cursor.dir</code>) can 32843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * be retrieved which holds our note pad data (<code>vnd.google.note</code>). 32943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * The activity allows the user to view or edit the directory of data (via 33043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * the VIEW and EDIT actions), or to pick a particular note and return it 33143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * to the caller (via the PICK action). Note also the DEFAULT category 33243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * supplied here: this is <em>required</em> for the 33343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link Context#startActivity Context.startActivity} method to resolve your 33443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * activity when its component name is not explicitly specified.</p> 33543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li><pre> 33643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <intent-filter> 33743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="{@link #ACTION_GET_CONTENT android.intent.action.GET_CONTENT}" /> 33843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> 33943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> 34043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </intent-filter></pre> 34143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>This filter describes the ability return to the caller a note selected by 34243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * the user without needing to know where it came from. The data type 34343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <code>vnd.android.cursor.item/vnd.google.note</code> is a URI from which 34443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * a Cursor of exactly one (<code>vnd.android.cursor.item</code>) item can 34543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * be retrieved which contains our note pad data (<code>vnd.google.note</code>). 34643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * The GET_CONTENT action is similar to the PICK action, where the activity 34743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * will return to its caller a piece of data selected by the user. Here, 34843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * however, the caller specifies the type of data they desire instead of 34943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * the type of data the user will be picking from.</p> 35043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ol> 35143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 35243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Given these capabilities, the following intents will resolve to the 35343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * NotesList activity:</p> 35443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 35543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 35643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>{ action=android.app.action.MAIN }</b> matches all of the 3575a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * activities that can be used as top-level entry points into an 3585a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * application.</p> 3595a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> <p><b>{ action=android.app.action.MAIN, 3605a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * category=android.app.category.LAUNCHER }</b> is the actual intent 3615a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * used by the Launcher to populate its top-level list.</p> 3625a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> <p><b>{ action=android.intent.action.VIEW 3635a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * data=content://com.google.provider.NotePad/notes }</b> 3645a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * displays a list of all the notes under 3655a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * "content://com.google.provider.NotePad/notes", which 3665a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * the user can browse through and see the details on.</p> 3675a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> <p><b>{ action=android.app.action.PICK 3685a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * data=content://com.google.provider.NotePad/notes }</b> 3695a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * provides a list of the notes under 3705a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * "content://com.google.provider.NotePad/notes", from which 3715a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * the user can pick a note whose data URL is returned back to the caller.</p> 3725a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> <p><b>{ action=android.app.action.GET_CONTENT 3735a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * type=vnd.android.cursor.item/vnd.google.note }</b> 3745a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * is similar to the pick action, but allows the caller to specify the 37543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * kind of data they want back so that the system can find the appropriate 37643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * activity to pick something of that data type.</p> 37743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ul> 37843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 37943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>The second activity, 3805a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <code>com.android.notepad.NoteEditor</code>, shows the user a single 38143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * note entry and allows them to edit it. It can do two things as described 38243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * by its two intent templates: 38343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ol> 38443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li><pre> 38543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <intent-filter android:label="@string/resolve_edit"> 38643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="{@link #ACTION_VIEW android.intent.action.VIEW}" /> 38743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="{@link #ACTION_EDIT android.intent.action.EDIT}" /> 38843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> 38943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> 39043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </intent-filter></pre> 39143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>The first, primary, purpose of this activity is to let the user interact 39243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * with a single note, as decribed by the MIME type 39343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <code>vnd.android.cursor.item/vnd.google.note</code>. The activity can 39443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * either VIEW a note or allow the user to EDIT it. Again we support the 39543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * DEFAULT category to allow the activity to be launched without explicitly 39643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * specifying its component.</p> 39743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li><pre> 39843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <intent-filter> 39943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="{@link #ACTION_INSERT android.intent.action.INSERT}" /> 40043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> 40143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <data android:mimeType="vnd.android.cursor.dir/<i>vnd.google.note</i>" /> 40243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </intent-filter></pre> 40343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>The secondary use of this activity is to insert a new note entry into 40443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * an existing directory of notes. This is used when the user creates a new 40543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * note: the INSERT action is executed on the directory of notes, causing 40643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * this activity to run and have the user create the new note data which 40743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * it then adds to the content provider.</p> 40843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ol> 40943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 41043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Given these capabilities, the following intents will resolve to the 41143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * NoteEditor activity:</p> 4129a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com * 4139a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com * <ul> 4149a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com * <li> <p><b>{ action=android.intent.action.VIEW 41543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * data=content://com.google.provider.NotePad/notes/<var>{ID}</var> }</b> 41643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * shows the user the content of note <var>{ID}</var>.</p> 41743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>{ action=android.app.action.EDIT 41843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * data=content://com.google.provider.NotePad/notes/<var>{ID}</var> }</b> 41943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * allows the user to edit the content of note <var>{ID}</var>.</p> 42043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>{ action=android.app.action.INSERT 42143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * data=content://com.google.provider.NotePad/notes }</b> 42243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * creates a new, empty note in the notes list at 42343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * "content://com.google.provider.NotePad/notes" 42443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * and allows the user to edit it. If they keep their changes, the URI 42543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * of the newly created note is returned to the caller.</p> 42643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ul> 42743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 42843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>The last activity, 42943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <code>com.android.notepad.TitleEditor</code>, allows the user to 43043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * edit the title of a note. This could be implemented as a class that the 43143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * application directly invokes (by explicitly setting its component in 43243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * the Intent), but here we show a way you can publish alternative 43343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * operations on existing data:</p> 43443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 43543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <pre> 43643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <intent-filter android:label="@string/resolve_title"> 43743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <action android:name="<i>com.android.notepad.action.EDIT_TITLE</i>" /> 43843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /> 43943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <category android:name="{@link #CATEGORY_ALTERNATIVE android.intent.category.ALTERNATIVE}" /> 44043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <category android:name="{@link #CATEGORY_SELECTED_ALTERNATIVE android.intent.category.SELECTED_ALTERNATIVE}" /> 44143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /> 44243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </intent-filter></pre> 44343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 44443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>In the single intent template here, we 44543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * have created our own private action called 44643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <code>com.android.notepad.action.EDIT_TITLE</code> which means to 44743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * edit the title of a note. It must be invoked on a specific note 44843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * (data type <code>vnd.android.cursor.item/vnd.google.note</code>) like the previous 44943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * view and edit actions, but here displays and edits the title contained 45043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * in the note data. 45143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 45243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>In addition to supporting the default category as usual, our title editor 45343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * also supports two other standard categories: ALTERNATIVE and 45443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * SELECTED_ALTERNATIVE. Implementing 45543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * these categories allows others to find the special action it provides 45643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * without directly knowing about it, through the 45743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link android.content.pm.PackageManager#queryIntentActivityOptions} method, or 45843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * more often to build dynamic menu items with 45943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link android.view.Menu#addIntentOptions}. Note that in the intent 46043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * template here was also supply an explicit name for the template 46143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * (via <code>android:label="@string/resolve_title"</code>) to better control 46243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * what the user sees when presented with this activity as an alternative 46343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * action to the data they are viewing. 46443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 46543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Given these capabilities, the following intent will resolve to the 46643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * TitleEditor activity:</p> 46743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 46843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 46943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> <p><b>{ action=com.android.notepad.action.EDIT_TITLE 47043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * data=content://com.google.provider.NotePad/notes/<var>{ID}</var> }</b> 47143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * displays and allows the user to edit the title associated 47243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * with note <var>{ID}</var>.</p> 47343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ul> 47443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 47543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <h3>Standard Activity Actions</h3> 47643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 47743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>These are the current standard actions that Intent defines for launching 47843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * activities (usually through {@link Context#startActivity}. The most 47943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * important, and by far most frequently used, are {@link #ACTION_MAIN} and 48043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #ACTION_EDIT}. 48143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 48243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 48343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_MAIN} 48443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_VIEW} 48543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_ATTACH_DATA} 48643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_EDIT} 48743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_PICK} 48843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_CHOOSER} 48943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_GET_CONTENT} 49043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_DIAL} 49143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_CALL} 49243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_SEND} 49343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_SENDTO} 49443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_ANSWER} 49543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_INSERT} 49643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_DELETE} 49743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_RUN} 49843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_SYNC} 49943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_PICK_ACTIVITY} 50043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_SEARCH} 50143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_WEB_SEARCH} 50243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_FACTORY_TEST} 50343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ul> 50443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 50543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <h3>Standard Broadcast Actions</h3> 50643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 50743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>These are the current standard actions that Intent defines for receiving 50843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * broadcasts (usually through {@link Context#registerReceiver} or a 5099a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com * <receiver> tag in a manifest). 5109a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com * 51143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 51243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_TIME_TICK} 51343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_TIME_CHANGED} 51443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_TIMEZONE_CHANGED} 51543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_BOOT_COMPLETED} 51643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_PACKAGE_ADDED} 51743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_PACKAGE_CHANGED} 51843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_PACKAGE_REMOVED} 51943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_PACKAGE_RESTARTED} 520b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * <li> {@link #ACTION_PACKAGE_DATA_CLEARED} 52143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #ACTION_UID_REMOVED} 522b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * <li> {@link #ACTION_BATTERY_CHANGED} 5237be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org * <li> {@link #ACTION_POWER_CONNECTED} 5247be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org * <li> {@link #ACTION_POWER_DISCONNECTED} 5257be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org * <li> {@link #ACTION_SHUTDOWN} 5267be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org * </ul> 5277276f14ca716596e0a0d17539516370c1f453847kasper.lund * 5287276f14ca716596e0a0d17539516370c1f453847kasper.lund * <h3>Standard Categories</h3> 529b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * 53043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>These are the current standard categories that can be used to further 53143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * clarify an Intent via {@link #addCategory}. 53243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 53343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 5343a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org * <li> {@link #CATEGORY_DEFAULT} 5359a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com * <li> {@link #CATEGORY_BROWSABLE} 53643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #CATEGORY_TAB} 53743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #CATEGORY_ALTERNATIVE} 53843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #CATEGORY_SELECTED_ALTERNATIVE} 53943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #CATEGORY_LAUNCHER} 54043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #CATEGORY_INFO} 5415a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #CATEGORY_HOME} 5425a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #CATEGORY_PREFERENCE} 5435a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #CATEGORY_TEST} 5445a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #CATEGORY_CAR_DOCK} 5455a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #CATEGORY_DESK_DOCK} 5465a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #CATEGORY_LE_DESK_DOCK} 5475a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #CATEGORY_HE_DESK_DOCK} 5485a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #CATEGORY_CAR_MODE} 5495a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #CATEGORY_APP_MARKET} 5505a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * </ul> 5515a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * 5525a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <h3>Standard Extra Data</h3> 5535a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * 5545a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <p>These are the current standard fields that can be used as extra data via 5555a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * {@link #putExtra}. 5565a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * 5575a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <ul> 5585a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_ALARM_COUNT} 55943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #EXTRA_BCC} 5605a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_CC} 5615a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_CHANGED_COMPONENT_NAME} 5625a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_DATA_REMOVED} 5635a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_DOCK_STATE} 5645a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_DOCK_STATE_HE_DESK} 5655a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_DOCK_STATE_LE_DESK} 5665a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_DOCK_STATE_CAR} 5675a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_DOCK_STATE_DESK} 5685a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_DOCK_STATE_UNDOCKED} 5695a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_DONT_KILL_APP} 5705a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_EMAIL} 5715a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_INITIAL_INTENTS} 5725a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_INTENT} 5735a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_KEY_EVENT} 5745a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_ORIGINATING_URL} 5755a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_PHONE_NUMBER} 5765a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_REFERRER} 5775a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_REMOTE_INTENT_TOKEN} 5785a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_REPLACING} 5795a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_SHORTCUT_ICON} 58043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #EXTRA_SHORTCUT_ICON_RESOURCE} 5815a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_SHORTCUT_INTENT} 5825a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_STREAM} 5835a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_SHORTCUT_NAME} 5845a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li> {@link #EXTRA_SUBJECT} 58543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #EXTRA_TEMPLATE} 58643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #EXTRA_TEXT} 58743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #EXTRA_TITLE} 58843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #EXTRA_UID} 58943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ul> 5905a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * 5915a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <h3>Flags</h3> 5925a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * 5935a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <p>These are the possible flags that can be used in the Intent via 5945a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * {@link #setFlags} and {@link #addFlags}. See {@link #setFlags} for a list 5955a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * of all possible flags. 5965a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org */ 5975a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.orgpublic class Intent implements Parcelable, Cloneable { 5985a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org // --------------------------------------------------------------------- 5995a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org // --------------------------------------------------------------------- 6005a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org // Standard intent activity actions (see action variable). 6015a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org 6025a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org /** 6035a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * Activity Action: Start as a main entry point, does not expect to 6045a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * receive data. 6055a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <p>Input: nothing 6065a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <p>Output: nothing 6075a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org */ 6085a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 6095a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org public static final String ACTION_MAIN = "android.intent.action.MAIN"; 6105a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org 6115a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org /** 612870a0b67c822d289024711912e2512af01b66c3bager@chromium.org * Activity Action: Display the data to the user. This is the most common 6135a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * action performed on data -- it is the generic action you can use on 6145a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * a piece of data to get the most reasonable thing to occur. For example, 6155a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * when used on a contacts entry it will view the entry; when used on a 6165a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * mailto: URI it will bring up a compose window filled with the information 6175a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * supplied by the URI; when used with a tel: URI it will invoke the 6185a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * dialer. 6195a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <p>Input: {@link #getData} is URI from which to retrieve data. 6205a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <p>Output: nothing. 6215a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org */ 6225a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 6235a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org public static final String ACTION_VIEW = "android.intent.action.VIEW"; 6245a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org 6255a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org /** 6265a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * A synonym for {@link #ACTION_VIEW}, the "standard" action that is 6275a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * performed on a piece of data. 6285a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org */ 6295a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org public static final String ACTION_DEFAULT = ACTION_VIEW; 6305a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org 6315a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org /** 6325a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * Used to indicate that some piece of data should be attached to some other 6335a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * place. For example, image data could be attached to a contact. It is up 63443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * to the recipient to decide where the data should be attached; the intent 63543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * does not specify the ultimate destination. 63643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: {@link #getData} is URI of data to be attached. 63743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: nothing. 63843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 63943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 64043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_ATTACH_DATA = "android.intent.action.ATTACH_DATA"; 64143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 64243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 64343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Provide explicit editable access to the given data. 6445a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <p>Input: {@link #getData} is URI of data to be edited. 6455a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <p>Output: nothing. 6465a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org */ 64743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 64843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_EDIT = "android.intent.action.EDIT"; 64943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 65043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 65143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Pick an existing item, or insert a new item, and then edit it. 65243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: {@link #getType} is the desired MIME type of the item to create or edit. 65343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * The extras can contain type specific data to pass through to the editing/creating 65443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * activity. 65543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: The URI of the item that was picked. This must be a content: 65643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * URI so that any receiver can access it. 65743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 65843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 65943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_INSERT_OR_EDIT = "android.intent.action.INSERT_OR_EDIT"; 66043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 66143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 66243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Pick an item from the data, returning what was selected. 66343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: {@link #getData} is URI containing a directory of data 664b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * (vnd.android.cursor.dir/*) from which to pick an item. 66543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: The URI of the item that was picked. 66643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 66743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 66843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_PICK = "android.intent.action.PICK"; 66943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 67043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 67143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Creates a shortcut. 67243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: Nothing.</p> 67343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: An Intent representing the shortcut. The intent must contain three 67443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * extras: SHORTCUT_INTENT (value: Intent), SHORTCUT_NAME (value: String), 67543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * and SHORTCUT_ICON (value: Bitmap) or SHORTCUT_ICON_RESOURCE 67643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * (value: ShortcutIconResource).</p> 67743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 67843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see #EXTRA_SHORTCUT_INTENT 67943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see #EXTRA_SHORTCUT_NAME 68043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see #EXTRA_SHORTCUT_ICON 68143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see #EXTRA_SHORTCUT_ICON_RESOURCE 68243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see android.content.Intent.ShortcutIconResource 68343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 68443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 68543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_CREATE_SHORTCUT = "android.intent.action.CREATE_SHORTCUT"; 68643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 68743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 68843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * The name of the extra used to define the Intent of a shortcut. 68943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 69043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see #ACTION_CREATE_SHORTCUT 69143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 69243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String EXTRA_SHORTCUT_INTENT = "android.intent.extra.shortcut.INTENT"; 69343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 69443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * The name of the extra used to define the name of a shortcut. 69543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 69643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see #ACTION_CREATE_SHORTCUT 69743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 69843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String EXTRA_SHORTCUT_NAME = "android.intent.extra.shortcut.NAME"; 69943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 70043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * The name of the extra used to define the icon, as a Bitmap, of a shortcut. 70143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 70243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see #ACTION_CREATE_SHORTCUT 70343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 70443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON"; 70543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 70643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * The name of the extra used to define the icon, as a ShortcutIconResource, of a shortcut. 70743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 70843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see #ACTION_CREATE_SHORTCUT 70943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see android.content.Intent.ShortcutIconResource 71043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 71143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String EXTRA_SHORTCUT_ICON_RESOURCE = 71243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen "android.intent.extra.shortcut.ICON_RESOURCE"; 71343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 71443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 71543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Represents a shortcut/live folder icon resource. 71643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 71743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see Intent#ACTION_CREATE_SHORTCUT 71843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see Intent#EXTRA_SHORTCUT_ICON_RESOURCE 71943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see android.provider.LiveFolders#ACTION_CREATE_LIVE_FOLDER 72043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see android.provider.LiveFolders#EXTRA_LIVE_FOLDER_ICON 72143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 72243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static class ShortcutIconResource implements Parcelable { 72343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 72443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * The package name of the application containing the icon. 72543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 72643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public String packageName; 72743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 72843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 72943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * The resource name of the icon, including package, name and type. 73043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 73143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public String resourceName; 73243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 73343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 73443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Creates a new ShortcutIconResource for the specified context and resource 73543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * identifier. 73643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 73743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @param context The context of the application. 738236ad9617a7359a463144a6ebeb5431a70f769cfager@chromium.org * @param resourceId The resource idenfitier for the icon. 73943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @return A new ShortcutIconResource with the specified's context package name 74043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * and icon resource idenfitier. 74143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 74243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static ShortcutIconResource fromContext(Context context, int resourceId) { 74343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen ShortcutIconResource icon = new ShortcutIconResource(); 74443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen icon.packageName = context.getPackageName(); 7453a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org icon.resourceName = context.getResources().getResourceName(resourceId); 7463a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org return icon; 7473a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org } 7483a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org 7493a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org /** 7503a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org * Used to read a ShortcutIconResource from a Parcel. 7513a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org */ 7523a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org public static final Parcelable.Creator<ShortcutIconResource> CREATOR = 7533a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org new Parcelable.Creator<ShortcutIconResource>() { 7543a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org 7553a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org public ShortcutIconResource createFromParcel(Parcel source) { 7563a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org ShortcutIconResource icon = new ShortcutIconResource(); 7573a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org icon.packageName = source.readString(); 75843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen icon.resourceName = source.readString(); 75943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen return icon; 76043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen } 76143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 76243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public ShortcutIconResource[] newArray(int size) { 76343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen return new ShortcutIconResource[size]; 76443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen } 76543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen }; 76643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 7675a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org /** 76843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * No special parcel contents. 7695a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org */ 7705a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org public int describeContents() { 7715a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org return 0; 7725a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org } 7735a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org 7745a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org public void writeToParcel(Parcel dest, int flags) { 7755a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org dest.writeString(packageName); 77643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen dest.writeString(resourceName); 7775a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org } 77843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 77943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @Override 78043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public String toString() { 78143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen return resourceName; 782727e995b7bba3c57fb1e5c156d386ca11894f781v } 7835a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org } 7845a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org 78543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 7865a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * Activity Action: Display an activity chooser, allowing the user to pick 7875a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * what they want to before proceeding. This can be used as an alternative 78843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * to the standard activity picker that is displayed by the system when 78943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * you try to start an activity with multiple possible matches, with these 7905a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * differences in behavior: 7915a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <ul> 7925a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li>You can specify the title that will appear in the activity chooser. 7935a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <li>The user does not have the option to make one of the matching 7945a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * activities a preferred activity, and all possible activities will 7955a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * always be shown even if one of them is currently marked as the 7965a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * preferred activity. 7975a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * </ul> 7985a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <p> 7995a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * This action should be used when the user will naturally expect to 8005a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * select an activity in order to proceed. An example if when not to use 8015a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * it is when the user clicks on a "mailto:" link. They would naturally 8025a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * expect to go directly to their mail app, so startActivity() should be 80343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * called directly: it will 80443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * either launch the current preferred app, or put up a dialog allowing the 80543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * user to pick an app to use and optionally marking that as preferred. 8065a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <p> 80743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * In contrast, if the user is selecting a menu item to send a picture 80843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * they are viewing to someone else, there are many different things they 80943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * may want to do at this point: send it through e-mail, upload it to a 81043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * web service, etc. In this case the CHOOSER action should be used, to 81143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * always present to the user a list of the things they can do, with a 81243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * nice title given by the caller such as "Send this photo with:". 8133291210ab99f306b74430ebbc4b7d939629e699fager@chromium.org * <p> 8143291210ab99f306b74430ebbc4b7d939629e699fager@chromium.org * If you need to grant URI permissions through a chooser, you must specify 8153291210ab99f306b74430ebbc4b7d939629e699fager@chromium.org * the permissions to be granted on the ACTION_CHOOSER Intent 8163291210ab99f306b74430ebbc4b7d939629e699fager@chromium.org * <em>in addition</em> to the EXTRA_INTENT inside. This means using 8173291210ab99f306b74430ebbc4b7d939629e699fager@chromium.org * {@link #setClipData} to specify the URIs to be granted as well as 81843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #FLAG_GRANT_READ_URI_PERMISSION} and/or 81943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #FLAG_GRANT_WRITE_URI_PERMISSION} as appropriate. 82043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 82143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * As a convenience, an Intent of this form can be created with the 82243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #createChooser} function. 82343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 82405521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * Input: No data should be specified. get*Extra must have 82505521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * a {@link #EXTRA_INTENT} field containing the Intent being executed, 82605521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * and can optionally have a {@link #EXTRA_TITLE} field containing the 82705521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * title text to display in the chooser. 82805521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * <p> 82905521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * Output: Depends on the protocol of {@link #EXTRA_INTENT}. 83005521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org */ 83105521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 83205521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org public static final String ACTION_CHOOSER = "android.intent.action.CHOOSER"; 83305521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org 83405521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org /** 83505521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * Convenience function for creating a {@link #ACTION_CHOOSER} Intent. 83605521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * 83705521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * <p>Builds a new {@link #ACTION_CHOOSER} Intent that wraps the given 83805521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * target intent, also optionally supplying a title. If the target 83905521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * intent has specified {@link #FLAG_GRANT_READ_URI_PERMISSION} or 84005521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * {@link #FLAG_GRANT_WRITE_URI_PERMISSION}, then these flags will also be 84105521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * set in the returned chooser intent, with its ClipData set appropriately: 84205521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * either a direct reflection of {@link #getClipData()} if that is non-null, 84305521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * or a new ClipData build from {@link #getData()}. 84405521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * 84505521fcc4bd495d3dc2b3ae7a6bc7e52ccb7937bsgjesse@chromium.org * @param target The Intent that the user will be selecting an activity 84643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * to perform. 84743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @param title Optional title that will be displayed in the chooser. 84843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @return Return a new Intent object that you can hand to 84943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link Context#startActivity(Intent) Context.startActivity()} and 85043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * related methods. 8519085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org */ 8529085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org public static Intent createChooser(Intent target, CharSequence title) { 8539085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org Intent intent = new Intent(ACTION_CHOOSER); 85443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen intent.putExtra(EXTRA_INTENT, target); 85543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen if (title != null) { 85643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen intent.putExtra(EXTRA_TITLE, title); 85743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen } 85843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 85943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen // Migrate any clip data and flags from target. 86043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen int permFlags = target.getFlags() 86143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen & (FLAG_GRANT_READ_URI_PERMISSION | FLAG_GRANT_WRITE_URI_PERMISSION); 86243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen if (permFlags != 0) { 86343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen ClipData targetClipData = target.getClipData(); 86443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen if (targetClipData == null && target.getData() != null) { 86543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen ClipData.Item item = new ClipData.Item(target.getData()); 86665dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org String[] mimeTypes; 86743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen if (target.getType() != null) { 86865dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org mimeTypes = new String[] { target.getType() }; 86943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen } else { 87043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen mimeTypes = new String[] { }; 87143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen } 87243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen targetClipData = new ClipData(null, mimeTypes, item); 87365dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org } 87443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen if (targetClipData != null) { 87565dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org intent.setClipData(targetClipData); 87643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen intent.addFlags(permFlags); 87743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen } 87843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen } 87943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 88043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen return intent; 88143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen } 88243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 88343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 88443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Allow the user to select a particular kind of data and 88543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * return it. This is different than {@link #ACTION_PICK} in that here we 88643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * just say what kind of data is desired, not a URI of existing data from 88743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * which the user can pick. A ACTION_GET_CONTENT could allow the user to 88843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * create the data as it runs (for example taking a picture or recording a 88943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * sound), let them browse over the web and download the desired data, 89043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * etc. 8915ec4892aef9cca42940d7d92302abf674365f6b7ager@chromium.org * <p> 89243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * There are two main ways to use this action: if you want a specific kind 89343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * of data, such as a person contact, you set the MIME type to the kind of 89443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * data you want and launch it with {@link Context#startActivity(Intent)}. 89543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * The system will then launch the best application to select that kind 89643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * of data for you. 89743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 89843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * You may also be interested in any of a set of types of content the user 89943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * can pick. For example, an e-mail application that wants to allow the 90043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * user to add an attachment to an e-mail message can use this action to 90143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * bring up a list of all of the types of content the user can attach. 90243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 90343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * In this case, you should wrap the GET_CONTENT intent with a chooser 90443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * (through {@link #createChooser}), which will give the proper interface 9059a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com * for the user to pick how to send your data and allow you to specify 9069a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com * a prompt indicating what they are doing. You will usually specify a 90743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * broad MIME type (such as image/* or {@literal *}/*), resulting in a 90843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * broad range of content types the user can select from. 90943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 91043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * When using such a broad GET_CONTENT action, it is often desirable to 91143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * only pick from data that can be represented as a stream. This is 91243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * accomplished by requiring the {@link #CATEGORY_OPENABLE} in the Intent. 91343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 9149a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com * Callers can optionally specify {@link #EXTRA_LOCAL_ONLY} to request that 9159a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com * the launched content chooser only returns results representing data that 91643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * is locally available on the device. For example, if this extra is set 91743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * to true then an image picker should not show any pictures that are available 91843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * from a remote server but not already on the local device (thus requiring 91943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * they be downloaded when opened). 92043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 92143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Input: {@link #getType} is the desired MIME type to retrieve. Note 92243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * that no URI is supplied in the intent, as there are no constraints on 92343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * where the returned data originally comes from. You may also include the 92443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #CATEGORY_OPENABLE} if you can only accept data that can be 92543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * opened as a stream. You may use {@link #EXTRA_LOCAL_ONLY} to limit content 92643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * selection to local data. 92743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 92843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Output: The URI of the item that was picked. This must be a content: 92943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * URI so that any receiver can access it. 93043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 93143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 93243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT"; 93343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 93443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Dial a number as specified by the data. This shows a 93543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * UI with the number being dialed, allowing the user to explicitly 93643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * initiate the call. 93743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: If nothing, an empty dialer is started; else {@link #getData} 93843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * is URI of a phone number to be dialed or a tel: URI of an explicit phone 93943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * number. 94043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: nothing. 94143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 94243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 94343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_DIAL = "android.intent.action.DIAL"; 94443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 94543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Perform a call to someone specified by the data. 94643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: If nothing, an empty dialer is started; else {@link #getData} 94743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * is URI of a phone number to be dialed or a tel: URI of an explicit phone 94843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * number. 94943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: nothing. 95043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 95143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Note: there will be restrictions on which applications can initiate a 95243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * call; most applications should use the {@link #ACTION_DIAL}. 95343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Note: this Intent <strong>cannot</strong> be used to call emergency 95443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * numbers. Applications can <strong>dial</strong> emergency numbers using 95543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #ACTION_DIAL}, however. 95643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 95743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 95843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_CALL = "android.intent.action.CALL"; 95943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 96043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Perform a call to an emergency number specified by the 96143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * data. 96243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: {@link #getData} is URI of a phone number to be dialed or a 96343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * tel: URI of an explicit phone number. 96443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: nothing. 96543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @hide 96643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 96743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_CALL_EMERGENCY = "android.intent.action.CALL_EMERGENCY"; 96843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 96943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity action: Perform a call to any number (emergency or not) 97043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * specified by the data. 97143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: {@link #getData} is URI of a phone number to be dialed or a 97243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * tel: URI of an explicit phone number. 97343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: nothing. 9745a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * @hide 97543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 97643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_CALL_PRIVILEGED = "android.intent.action.CALL_PRIVILEGED"; 97743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 97843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Send a message to someone specified by the data. 97943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: {@link #getData} is URI describing the target. 98043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: nothing. 98143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 98243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 98343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_SENDTO = "android.intent.action.SENDTO"; 98443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 98543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Deliver some data to someone else. Who the data is 98643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * being delivered to is not specified; it is up to the receiver of this 98743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * action to ask the user where the data should be sent. 98843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 98943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * When launching a SEND intent, you should usually wrap it in a chooser 99043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * (through {@link #createChooser}), which will give the proper interface 99143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * for the user to pick how to send your data and allow you to specify 99243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * a prompt indicating what they are doing. 99343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 99443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Input: {@link #getType} is the MIME type of the data being sent. 99543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * get*Extra can have either a {@link #EXTRA_TEXT} 99643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * or {@link #EXTRA_STREAM} field, containing the data to be sent. If 99743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * using EXTRA_TEXT, the MIME type should be "text/plain"; otherwise it 99843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * should be the MIME type of the data in EXTRA_STREAM. Use {@literal *}/* 99943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * if the MIME type is unknown (this will only allow senders that can 100043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * handle generic data streams). If using {@link #EXTRA_TEXT}, you can 100143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * also optionally supply {@link #EXTRA_HTML_TEXT} for clients to retrieve 100243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * your text with HTML formatting. 100343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 100443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, the data 100543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * being sent can be supplied through {@link #setClipData(ClipData)}. This 100643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * allows you to use {@link #FLAG_GRANT_READ_URI_PERMISSION} when sharing 100743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * content: URIs and other advanced features of {@link ClipData}. If 100843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * using this approach, you still must supply the same data through the 100943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #EXTRA_TEXT} or {@link #EXTRA_STREAM} fields described below 101043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * for compatibility with old applications. If you don't set a ClipData, 101143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * it will be copied there for you when calling {@link Context#startActivity(Intent)}. 101243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 101343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Optional standard extras, which may be interpreted by some recipients as 101443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * appropriate, are: {@link #EXTRA_EMAIL}, {@link #EXTRA_CC}, 101543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #EXTRA_BCC}, {@link #EXTRA_SUBJECT}. 101643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 101743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Output: nothing. 101843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 101943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 102043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_SEND = "android.intent.action.SEND"; 10217be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org /** 102243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Deliver multiple data to someone else. 102343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 102443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Like {@link #ACTION_SEND}, except the data is multiple. 102543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 10267be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org * Input: {@link #getType} is the MIME type of the data being sent. 10277be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org * get*ArrayListExtra can have either a {@link #EXTRA_TEXT} or {@link 10287be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org * #EXTRA_STREAM} field, containing the data to be sent. If using 10297be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org * {@link #EXTRA_TEXT}, you can also optionally supply {@link #EXTRA_HTML_TEXT} 10307be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org * for clients to retrieve your text with HTML formatting. 10317be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org * <p> 10327be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org * Multiple types are supported, and receivers should handle mixed types 10337be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org * whenever possible. The right way for the receiver to check them is to 103443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * use the content resolver on each URI. The intent sender should try to 103543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * put the most concrete mime type in the intent type, but it can fall 103643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * back to {@literal <type>/*} or {@literal *}/* as needed. 103743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 103843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * e.g. if you are sending image/jpg and image/jpg, the intent's type can 103943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * be image/jpg, but if you are sending image/jpg and image/png, then the 104043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * intent's type should be image/*. 104143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 104243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, the data 104343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * being sent can be supplied through {@link #setClipData(ClipData)}. This 104443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * allows you to use {@link #FLAG_GRANT_READ_URI_PERMISSION} when sharing 104543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * content: URIs and other advanced features of {@link ClipData}. If 104643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * using this approach, you still must supply the same data through the 104743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #EXTRA_TEXT} or {@link #EXTRA_STREAM} fields described below 104843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * for compatibility with old applications. If you don't set a ClipData, 104943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * it will be copied there for you when calling {@link Context#startActivity(Intent)}. 105043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 105165dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org * Optional standard extras, which may be interpreted by some recipients as 105265dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org * appropriate, are: {@link #EXTRA_EMAIL}, {@link #EXTRA_CC}, 105365dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org * {@link #EXTRA_BCC}, {@link #EXTRA_SUBJECT}. 105465dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org * <p> 105565dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org * Output: nothing. 105665dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org */ 105765dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 105843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_SEND_MULTIPLE = "android.intent.action.SEND_MULTIPLE"; 105943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 106043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Handle an incoming phone call. 106143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: nothing. 106243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: nothing. 106343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 106443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1065245aa859d34fd516161c48ef4c69d38d9b889284iposva@chromium.org public static final String ACTION_ANSWER = "android.intent.action.ANSWER"; 1066245aa859d34fd516161c48ef4c69d38d9b889284iposva@chromium.org /** 1067245aa859d34fd516161c48ef4c69d38d9b889284iposva@chromium.org * Activity Action: Insert an empty item into the given container. 1068245aa859d34fd516161c48ef4c69d38d9b889284iposva@chromium.org * <p>Input: {@link #getData} is URI of the directory (vnd.android.cursor.dir/*) 1069245aa859d34fd516161c48ef4c69d38d9b889284iposva@chromium.org * in which to place the data. 1070245aa859d34fd516161c48ef4c69d38d9b889284iposva@chromium.org * <p>Output: URI of the new data that was created. 1071245aa859d34fd516161c48ef4c69d38d9b889284iposva@chromium.org */ 1072245aa859d34fd516161c48ef4c69d38d9b889284iposva@chromium.org @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 10739085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org public static final String ACTION_INSERT = "android.intent.action.INSERT"; 10749085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org /** 10759085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org * Activity Action: Create a new item in the given container, initializing it 10769085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org * from the current contents of the clipboard. 10779085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org * <p>Input: {@link #getData} is URI of the directory (vnd.android.cursor.dir/*) 10789085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org * in which to place the data. 10799085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org * <p>Output: URI of the new data that was created. 10809085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org */ 108143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 108243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_PASTE = "android.intent.action.PASTE"; 108343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 108443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Delete the given data from its container. 108543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: {@link #getData} is URI of data to be deleted. 108643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: nothing. 10877be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org */ 108843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 108943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_DELETE = "android.intent.action.DELETE"; 109043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 109171affb54842da76b24f0bb3184e9f0960523f89dkasperl@chromium.org * Activity Action: Run the data, whatever that means. 109271affb54842da76b24f0bb3184e9f0960523f89dkasperl@chromium.org * <p>Input: ? (Note: this is currently specific to the test harness.) 109371affb54842da76b24f0bb3184e9f0960523f89dkasperl@chromium.org * <p>Output: nothing. 109471affb54842da76b24f0bb3184e9f0960523f89dkasperl@chromium.org */ 109571affb54842da76b24f0bb3184e9f0960523f89dkasperl@chromium.org @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 109671affb54842da76b24f0bb3184e9f0960523f89dkasperl@chromium.org public static final String ACTION_RUN = "android.intent.action.RUN"; 109743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 109843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Perform a data synchronization. 109943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: ? 110043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: ? 110143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 110243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 110343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_SYNC = "android.intent.action.SYNC"; 110443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 110543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Pick an activity given an intent, returning the class 110643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * selected. 110743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: get*Extra field {@link #EXTRA_INTENT} is an Intent 110843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * used with {@link PackageManager#queryIntentActivities} to determine the 11095a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * set of activities from which to pick. 111043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: Class name of the activity that was selected. 111143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 111243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 11135a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org public static final String ACTION_PICK_ACTIVITY = "android.intent.action.PICK_ACTIVITY"; 11143a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org /** 11153a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org * Activity Action: Perform a search. 11163a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org * <p>Input: {@link android.app.SearchManager#QUERY getStringExtra(SearchManager.QUERY)} 11173a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org * is the text to search for. If empty, simply 111843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * enter your search results Activity with the search UI activated. 111943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: nothing. 112043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 112143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 112243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_SEARCH = "android.intent.action.SEARCH"; 112343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 112443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Start the platform-defined tutorial 112543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: {@link android.app.SearchManager#QUERY getStringExtra(SearchManager.QUERY)} 112643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * is the text to search for. If empty, simply 112743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * enter your search results Activity with the search UI activated. 112843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: nothing. 112943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 113043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 113143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_SYSTEM_TUTORIAL = "android.intent.action.SYSTEM_TUTORIAL"; 113243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 113343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Perform a web search. 113443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 113543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Input: {@link android.app.SearchManager#QUERY 113643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * getStringExtra(SearchManager.QUERY)} is the text to search for. If it is 1137b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * a url starts with http or https, the site will be opened. If it is plain 1138b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * text, Google search will be applied. 1139b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * <p> 1140b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * Output: nothing. 114143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 114243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1143b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org public static final String ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH"; 1144b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org /** 114543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Perform assist action. 1146b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * <p> 1147b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * Input: nothing 1148b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * Output: nothing. 1149b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org */ 1150b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1151b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org public static final String ACTION_ASSIST = "android.intent.action.ASSIST"; 1152b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org /** 1153b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * Activity Action: List all available applications 1154b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * <p>Input: Nothing. 115543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: nothing. 115643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 115743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 115843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_ALL_APPS = "android.intent.action.ALL_APPS"; 1159b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org /** 116043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Show settings for choosing wallpaper 116143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: Nothing. 11623291210ab99f306b74430ebbc4b7d939629e699fager@chromium.org * <p>Output: Nothing. 1163b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org */ 1164b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1165b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org public static final String ACTION_SET_WALLPAPER = "android.intent.action.SET_WALLPAPER"; 1166b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org 1167b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org /** 116843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Show activity for reporting a bug. 116943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: Nothing. 117043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: Nothing. 117143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 117243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 117343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_BUG_REPORT = "android.intent.action.BUG_REPORT"; 117443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 117543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 117643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Main entry point for factory tests. Only used when 117743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * the device is booting in factory test node. The implementing package 117843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * must be installed in the system image. 117943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: nothing 118043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: nothing 1181cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager */ 1182cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager public static final String ACTION_FACTORY_TEST = "android.intent.action.FACTORY_TEST"; 11835a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org 1184cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager /** 1185cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager * Activity Action: The user pressed the "call" button to go to the dialer 1186cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager * or other appropriate UI for placing a call. 1187cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager * <p>Input: Nothing. 1188cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager * <p>Output: Nothing. 11895a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org */ 11905a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1191cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager public static final String ACTION_CALL_BUTTON = "android.intent.action.CALL_BUTTON"; 1192cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager 119365dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org /** 1194cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager * Activity Action: Start Voice Command. 1195cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager * <p>Input: Nothing. 1196cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager * <p>Output: Nothing. 1197cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager */ 1198cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 1199cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager public static final String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND"; 12005a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org 12015a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org /** 12025a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * Activity Action: Start action associated with long pressing on the 12035a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * search key. 12045a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <p>Input: Nothing. 12055a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <p>Output: Nothing. 1206cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager */ 1207cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 12085a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org public static final String ACTION_SEARCH_LONG_PRESS = "android.intent.action.SEARCH_LONG_PRESS"; 12095a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org 1210cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager /** 121165dad4b091d2925543c6326db635d0f7cf9e1edcager@chromium.org * Activity Action: The user pressed the "Report" button in the crash/ANR dialog. 1212cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager * This intent is delivered to the package which installed the application, usually 1213cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager * Google Play. 1214cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager * <p>Input: No data is specified. The bug report is passed in using 1215cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager * an {@link #EXTRA_BUG_REPORT} field. 1216cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager * <p>Output: Nothing. 121743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 121843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see #EXTRA_BUG_REPORT 121943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 122043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 122143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_APP_ERROR = "android.intent.action.APP_ERROR"; 122243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 122343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 122443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Show power usage information to the user. 122543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: Nothing. 122643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: Nothing. 122743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 122843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 122943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_POWER_USAGE_SUMMARY = "android.intent.action.POWER_USAGE_SUMMARY"; 123043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 123143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 123243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Setup wizard to launch after a platform update. This 123343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * activity should have a string meta-data field associated with it, 123443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #METADATA_SETUP_VERSION}, which defines the current version of 123543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * the platform for setup. The activity will be launched only if 123643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link android.provider.Settings.Secure#LAST_SETUP_SHOWN} is not the 123743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * same value. 123843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: Nothing. 123943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Output: Nothing. 124043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @hide 124143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 124243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 124343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_UPGRADE_SETUP = "android.intent.action.UPGRADE_SETUP"; 124443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 124543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 124643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Show settings for managing network data usage of a 124743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * specific application. Applications should define an activity that offers 124843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * options to control data usage. 124943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 125043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 125143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_MANAGE_NETWORK_USAGE = 125243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen "android.intent.action.MANAGE_NETWORK_USAGE"; 125343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 125443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 125543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Activity Action: Launch application installer. 125643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 125743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Input: The data must be a content: or file: URI at which the application 125843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * can be retrieved. You can optionally supply 125943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #EXTRA_INSTALLER_PACKAGE_NAME}, {@link #EXTRA_NOT_UNKNOWN_SOURCE}, 126043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #EXTRA_ALLOW_REPLACE}, and {@link #EXTRA_RETURN_RESULT}. 126143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p> 126243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Output: If {@link #EXTRA_RETURN_RESULT}, returns whether the install 126343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * succeeded. 126443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 126543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see #EXTRA_INSTALLER_PACKAGE_NAME 126643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see #EXTRA_NOT_UNKNOWN_SOURCE 126743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @see #EXTRA_RETURN_RESULT 126843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 126943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 127043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_INSTALL_PACKAGE = "android.intent.action.INSTALL_PACKAGE"; 127143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 127243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 127343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Used as a string extra field with {@link #ACTION_INSTALL_PACKAGE} to install a 127443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * package. Specifies the installer package name; this package will receive the 127543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #ACTION_APP_ERROR} intent. 127643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 127743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String EXTRA_INSTALLER_PACKAGE_NAME 127843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen = "android.intent.extra.INSTALLER_PACKAGE_NAME"; 127943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 128043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 128143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Used as a boolean extra field with {@link #ACTION_INSTALL_PACKAGE} to install a 128243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * package. Specifies that the application being installed should not be 128343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * treated as coming from an unknown source, but as coming from the app 128443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * invoking the Intent. For this to work you must start the installer with 128543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * startActivityForResult(). 128643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 128743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String EXTRA_NOT_UNKNOWN_SOURCE 128843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen = "android.intent.extra.NOT_UNKNOWN_SOURCE"; 128943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 129043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 129143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Used as a string extra field with {@link #ACTION_INSTALL_PACKAGE} and 129243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #ACTION_VIEW} to indicate the URL from which the local APK in the Intent 129343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * data field originated from. 129443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 129543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String EXTRA_ORIGINATING_URL 129643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen = "android.intent.extra.ORIGINATING_URL"; 129743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 129843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 129943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Used as a string extra field with {@link #ACTION_INSTALL_PACKAGE} and 130043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #ACTION_VIEW} to indicate the HTTP referrer associated with the Intent 13015a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * data field or {@link #EXTRA_ORIGINATING_URL}. 13025a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org */ 13035a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org public static final String EXTRA_REFERRER 13045a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org = "android.intent.extra.REFERRER"; 13055a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org 13065a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org /** 13075a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * Used as a boolean extra field with {@link #ACTION_INSTALL_PACKAGE} to install a 13085a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * package. Tells the installer UI to skip the confirmation with the user 13095a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * if the .apk is replacing an existing one. 13105a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * @deprecated As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, Android 13115a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * will no longer show an interstitial message about updating existing 13125a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * applications so this is no longer needed. 13135a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org */ 13145a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org @Deprecated 13155a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org public static final String EXTRA_ALLOW_REPLACE 13165a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org = "android.intent.extra.ALLOW_REPLACE"; 13175a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org 13185a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org /** 13195a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * Used as a boolean extra field with {@link #ACTION_INSTALL_PACKAGE} or 132043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #ACTION_UNINSTALL_PACKAGE}. Specifies that the installer UI should 132143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * return to the application the result code of the install/uninstall. The returned result 13225a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * code will be {@link android.app.Activity#RESULT_OK} on success or 13235a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * {@link android.app.Activity#RESULT_FIRST_USER} on failure. 13245a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org */ 13255a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org public static final String EXTRA_RETURN_RESULT 13265a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org = "android.intent.extra.RETURN_RESULT"; 13275a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org 13285a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org /** 13295a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * Package manager install result code. @hide because result codes are not 13305a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * yet ready to be exposed. 13315a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org */ 13325a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org public static final String EXTRA_INSTALL_RESULT 13335a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org = "android.intent.extra.INSTALL_RESULT"; 13345a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org 13355a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org /** 13365a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * Activity Action: Launch application uninstaller. 13375a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <p> 13385a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * Input: The data must be a package: URI whose scheme specific part is 13395a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * the package name of the current installed package to be uninstalled. 13405a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * You can optionally supply {@link #EXTRA_RETURN_RESULT}. 13415a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * <p> 13425a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org * Output: If {@link #EXTRA_RETURN_RESULT}, returns whether the install 134343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * succeeded. 134443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 134543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 134643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_UNINSTALL_PACKAGE = "android.intent.action.UNINSTALL_PACKAGE"; 134743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 134843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 134943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * A string associated with a {@link #ACTION_UPGRADE_SETUP} activity 135043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * describing the last run version of the platform that was setup. 135143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @hide 135243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 135343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String METADATA_SETUP_VERSION = "android.SETUP_VERSION"; 135443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 135543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen // --------------------------------------------------------------------- 135643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen // --------------------------------------------------------------------- 135743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen // Standard intent broadcast actions (see action variable). 135843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 135943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 136043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Broadcast Action: Sent after the screen turns off. 136143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 136243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p class="note">This is a protected intent that can only be sent 136343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * by the system. 136443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 136543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 136643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_SCREEN_OFF = "android.intent.action.SCREEN_OFF"; 13677c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org /** 136843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Broadcast Action: Sent after the screen turns on. 136943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 137043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p class="note">This is a protected intent that can only be sent 137143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * by the system. 137243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 137343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 137443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_SCREEN_ON = "android.intent.action.SCREEN_ON"; 137543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 137643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 137743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Broadcast Action: Sent when the user is present after device wakes up (e.g when the 137843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * keyguard is gone). 137943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 138043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p class="note">This is a protected intent that can only be sent 138143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * by the system. 138243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 138343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 138443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_USER_PRESENT = "android.intent.action.USER_PRESENT"; 138543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen 138643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 138743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Broadcast Action: The current time has changed. Sent every 138843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * minute. You can <em>not</em> receive this through components declared 138943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * in manifests, only by exlicitly registering for it with 139043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) 139143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Context.registerReceiver()}. 139243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 139343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p class="note">This is a protected intent that can only be sent 139443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * by the system. 139543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 139643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 139743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_TIME_TICK = "android.intent.action.TIME_TICK"; 13989a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com /** 13999a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com * Broadcast Action: The time was set. 140043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 140143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 140243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_TIME_CHANGED = "android.intent.action.TIME_SET"; 140343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 140443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Broadcast Action: The date has changed. 140543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 140643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 140743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_DATE_CHANGED = "android.intent.action.DATE_CHANGED"; 140843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 140943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Broadcast Action: The timezone has changed. The intent will have the following extra values:</p> 141043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 141143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li><em>time-zone</em> - The java.util.TimeZone.getID() value identifying the new time zone.</li> 141243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ul> 141343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 141443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p class="note">This is a protected intent that can only be sent 141543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * by the system. 141643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 141743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 141843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_TIMEZONE_CHANGED = "android.intent.action.TIMEZONE_CHANGED"; 141943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 142043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Clear DNS Cache Action: This is broadcast when networks have changed and old 142143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * DNS entries should be tossed. 142243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @hide 142343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 142443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 142543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_CLEAR_DNS_CACHE = "android.intent.action.CLEAR_DNS_CACHE"; 142643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 142743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Alarm Changed Action: This is broadcast when the AlarmClock 142843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * application's alarm is set or unset. It is used by the 142943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * AlarmClock application and the StatusBar service. 143043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @hide 143143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 143243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 143343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_ALARM_CHANGED = "android.intent.action.ALARM_CHANGED"; 143443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 143543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Sync State Changed Action: This is broadcast when the sync starts or stops or when one has 143643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * been failing for a long time. It is used by the SyncManager and the StatusBar service. 143743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @hide 143843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 143943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 144043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_SYNC_STATE_CHANGED 144143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen = "android.intent.action.SYNC_STATE_CHANGED"; 144243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 144343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Broadcast Action: This is broadcast once, after the system has finished 144443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * booting. It can be used to perform application-specific initialization, 144543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * such as installing alarms. You must hold the 144643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link android.Manifest.permission#RECEIVE_BOOT_COMPLETED} permission 144743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * in order to receive this broadcast. 144843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 144943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p class="note">This is a protected intent that can only be sent 145043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * by the system. 145143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 145243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 14539a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com public static final String ACTION_BOOT_COMPLETED = "android.intent.action.BOOT_COMPLETED"; 145443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 145543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Broadcast Action: This is broadcast when a user action should request a 145643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * temporary system dialog to dismiss. Some examples of temporary system 145743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * dialogs are the notification window-shade and the recent tasks dialog. 145843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 145943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS"; 146043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 14617276f14ca716596e0a0d17539516370c1f453847kasper.lund * Broadcast Action: Trigger the download and eventual installation 146243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * of a package. 146343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>Input: {@link #getData} is the URI of the package file to download. 146443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 14657276f14ca716596e0a0d17539516370c1f453847kasper.lund * <p class="note">This is a protected intent that can only be sent 14663a37e9b96c768f6b5b6b09542e1cb1a1ece7a022ager@chromium.org * by the system. 146743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 146843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * @deprecated This constant has never been used. 146943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 147043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @Deprecated 147143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 147243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_PACKAGE_INSTALL = "android.intent.action.PACKAGE_INSTALL"; 147343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 1474b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * Broadcast Action: A new application package has been installed on the 147543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * device. The data contains the name of the package. Note that the 147643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * newly installed package does <em>not</em> receive this broadcast. 147743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>My include the following extras: 147843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 147943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #EXTRA_UID} containing the integer uid assigned to the new package. 148043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #EXTRA_REPLACING} is set to true if this is following 148143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * an {@link #ACTION_PACKAGE_REMOVED} broadcast for the same package. 148243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ul> 1483b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * 148443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p class="note">This is a protected intent that can only be sent 148543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * by the system. 148643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 148743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 148843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_PACKAGE_ADDED = "android.intent.action.PACKAGE_ADDED"; 148943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 149043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Broadcast Action: A new version of an application package has been 149143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * installed, replacing an existing version that was previously installed. 149243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * The data contains the name of the package. 149343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p>My include the following extras: 149443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 149543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #EXTRA_UID} containing the integer uid assigned to the new package. 149643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ul> 149743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 149843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p class="note">This is a protected intent that can only be sent 149943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * by the system. 150043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 150143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 150243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED"; 150343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 150443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Broadcast Action: A new version of your application has been installed 15059085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org * over an existing one. This is only sent to the application that was 150643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * replaced. It does not contain any additional data; to receive it, just 15079085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org * use an intent filter for this action. 15089085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org * 15099085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org * <p class="note">This is a protected intent that can only be sent 15109085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org * by the system. 15119085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org */ 15129085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 15139085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org public static final String ACTION_MY_PACKAGE_REPLACED = "android.intent.action.MY_PACKAGE_REPLACED"; 15149085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org /** 15159085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org * Broadcast Action: An existing application package has been removed from 15169085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org * the device. The data contains the name of the package. The package 1517b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * that is being installed does <em>not</em> receive this Intent. 15189085a016223a6b72bf580d5781c93ec7b9e54422ager@chromium.org * <ul> 1519b912362e2b2e704d09faac4290e027fd744bf587kasperl@chromium.org * <li> {@link #EXTRA_UID} containing the integer uid previously assigned 152043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * to the package. 152143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #EXTRA_DATA_REMOVED} is set to true if the entire 152243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * application -- data and code -- is being removed. 152343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #EXTRA_REPLACING} is set to true if this will be followed 152443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * by an {@link #ACTION_PACKAGE_ADDED} broadcast for the same package. 152543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * </ul> 152643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 15273291210ab99f306b74430ebbc4b7d939629e699fager@chromium.org * <p class="note">This is a protected intent that can only be sent 152843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * by the system. 152943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 153043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 153143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen public static final String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED"; 153243d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 153371affb54842da76b24f0bb3184e9f0960523f89dkasperl@chromium.org * Broadcast Action: An existing application package has been completely 153471affb54842da76b24f0bb3184e9f0960523f89dkasperl@chromium.org * removed from the device. The data contains the name of the package. 153543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * This is like {@link #ACTION_PACKAGE_REMOVED}, but only set when 153643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #EXTRA_DATA_REMOVED} is true and 153743d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * {@link #EXTRA_REPLACING} is false of that broadcast. 153843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 153943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 154043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #EXTRA_UID} containing the integer uid previously assigned 154143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * to the package. 154271affb54842da76b24f0bb3184e9f0960523f89dkasperl@chromium.org * </ul> 154343d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * 154443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <p class="note">This is a protected intent that can only be sent 154543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * by the system. 154643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen */ 15475a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 15485a8ca6c70c6fc9716f18f6223c98d1fef5752cf6kasperl@chromium.org public static final String ACTION_PACKAGE_FULLY_REMOVED 154943d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen = "android.intent.action.PACKAGE_FULLY_REMOVED"; 155043d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 155143d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * Broadcast Action: An existing application package has been changed (e.g. 1552cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager * a component has been enabled or disabled). The data contains the name of 1553cbaa060d2827a6c7aab497845a1fe6ae6f2dfab4mads.s.ager * the package. 155443d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <ul> 155543d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. 155643d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen * <li> {@link #EXTRA_CHANGED_COMPONENT_NAME_LIST} containing the class name 1557ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * of the changed components. 1558ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * <li> {@link #EXTRA_DONT_KILL_APP} containing boolean field to override the 1559ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * default action of restarting the application. 1560ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * </ul> 1561ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * 1562ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * <p class="note">This is a protected intent that can only be sent 1563ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * by the system. 1564ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org */ 1565ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1566ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org public static final String ACTION_PACKAGE_CHANGED = "android.intent.action.PACKAGE_CHANGED"; 1567ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org /** 1568ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * @hide 1569ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * Broadcast Action: Ask system services if there is any reason to 1570ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * restart the given package. The data contains the name of the 1571ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * package. 1572ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * <ul> 1573ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. 1574ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * <li> {@link #EXTRA_PACKAGES} String array of all packages to check. 1575ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * </ul> 1576ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * 1577ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * <p class="note">This is a protected intent that can only be sent 1578ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * by the system. 1579ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org */ 1580ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1581ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org public static final String ACTION_QUERY_PACKAGE_RESTART = "android.intent.action.QUERY_PACKAGE_RESTART"; 1582ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org /** 1583ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * Broadcast Action: The user has restarted a package, and all of its 1584ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * processes have been killed. All runtime state 1585ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * associated with it (processes, alarms, notifications, etc) should 1586ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * be removed. Note that the restarted package does <em>not</em> 1587ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * receive this broadcast. 1588ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * The data contains the name of the package. 1589ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * <ul> 1590ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. 1591ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * </ul> 1592ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * 1593ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * <p class="note">This is a protected intent that can only be sent 1594ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org * by the system. 1595ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org */ 1596ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1597ddb913d619a6e602f53dd17b0fe71158ce66888dager@chromium.org public static final String ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED"; 159843d26ecc3563a46f62a0224030667c8f8f3f6cebchristian.plesner.hansen /** 1599 * Broadcast Action: The user has cleared the data of a package. This should 1600 * be preceded by {@link #ACTION_PACKAGE_RESTARTED}, after which all of 1601 * its persistent data is erased and this broadcast sent. 1602 * Note that the cleared package does <em>not</em> 1603 * receive this broadcast. The data contains the name of the package. 1604 * <ul> 1605 * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package. 1606 * </ul> 1607 * 1608 * <p class="note">This is a protected intent that can only be sent 1609 * by the system. 1610 */ 1611 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1612 public static final String ACTION_PACKAGE_DATA_CLEARED = "android.intent.action.PACKAGE_DATA_CLEARED"; 1613 /** 1614 * Broadcast Action: A user ID has been removed from the system. The user 1615 * ID number is stored in the extra data under {@link #EXTRA_UID}. 1616 * 1617 * <p class="note">This is a protected intent that can only be sent 1618 * by the system. 1619 */ 1620 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1621 public static final String ACTION_UID_REMOVED = "android.intent.action.UID_REMOVED"; 1622 1623 /** 1624 * Broadcast Action: Sent to the installer package of an application 1625 * when that application is first launched (that is the first time it 1626 * is moved out of the stopped state). The data contains the name of the package. 1627 * 1628 * <p class="note">This is a protected intent that can only be sent 1629 * by the system. 1630 */ 1631 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1632 public static final String ACTION_PACKAGE_FIRST_LAUNCH = "android.intent.action.PACKAGE_FIRST_LAUNCH"; 1633 1634 /** 1635 * Broadcast Action: Sent to the system package verifier when a package 1636 * needs to be verified. The data contains the package URI. 1637 * <p class="note"> 1638 * This is a protected intent that can only be sent by the system. 1639 * </p> 1640 */ 1641 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1642 public static final String ACTION_PACKAGE_NEEDS_VERIFICATION = "android.intent.action.PACKAGE_NEEDS_VERIFICATION"; 1643 1644 /** 1645 * Broadcast Action: Resources for a set of packages (which were 1646 * previously unavailable) are currently 1647 * available since the media on which they exist is available. 1648 * The extra data {@link #EXTRA_CHANGED_PACKAGE_LIST} contains a 1649 * list of packages whose availability changed. 1650 * The extra data {@link #EXTRA_CHANGED_UID_LIST} contains a 1651 * list of uids of packages whose availability changed. 1652 * Note that the 1653 * packages in this list do <em>not</em> receive this broadcast. 1654 * The specified set of packages are now available on the system. 1655 * <p>Includes the following extras: 1656 * <ul> 1657 * <li> {@link #EXTRA_CHANGED_PACKAGE_LIST} is the set of packages 1658 * whose resources(were previously unavailable) are currently available. 1659 * {@link #EXTRA_CHANGED_UID_LIST} is the set of uids of the 1660 * packages whose resources(were previously unavailable) 1661 * are currently available. 1662 * </ul> 1663 * 1664 * <p class="note">This is a protected intent that can only be sent 1665 * by the system. 1666 */ 1667 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1668 public static final String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE = 1669 "android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE"; 1670 1671 /** 1672 * Broadcast Action: Resources for a set of packages are currently 1673 * unavailable since the media on which they exist is unavailable. 1674 * The extra data {@link #EXTRA_CHANGED_PACKAGE_LIST} contains a 1675 * list of packages whose availability changed. 1676 * The extra data {@link #EXTRA_CHANGED_UID_LIST} contains a 1677 * list of uids of packages whose availability changed. 1678 * The specified set of packages can no longer be 1679 * launched and are practically unavailable on the system. 1680 * <p>Inclues the following extras: 1681 * <ul> 1682 * <li> {@link #EXTRA_CHANGED_PACKAGE_LIST} is the set of packages 1683 * whose resources are no longer available. 1684 * {@link #EXTRA_CHANGED_UID_LIST} is the set of packages 1685 * whose resources are no longer available. 1686 * </ul> 1687 * 1688 * <p class="note">This is a protected intent that can only be sent 1689 * by the system. 1690 */ 1691 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1692 public static final String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE = 1693 "android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE"; 1694 1695 /** 1696 * Broadcast Action: The current system wallpaper has changed. See 1697 * {@link android.app.WallpaperManager} for retrieving the new wallpaper. 1698 * This should <em>only</em> be used to determine when the wallpaper 1699 * has changed to show the new wallpaper to the user. You should certainly 1700 * never, in response to this, change the wallpaper or other attributes of 1701 * it such as the suggested size. That would be crazy, right? You'd cause 1702 * all kinds of loops, especially if other apps are doing similar things, 1703 * right? Of course. So please don't do this. 1704 * 1705 * @deprecated Modern applications should use 1706 * {@link android.view.WindowManager.LayoutParams#FLAG_SHOW_WALLPAPER 1707 * WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER} to have the wallpaper 1708 * shown behind their UI, rather than watching for this broadcast and 1709 * rendering the wallpaper on their own. 1710 */ 1711 @Deprecated @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1712 public static final String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED"; 1713 /** 1714 * Broadcast Action: The current device {@link android.content.res.Configuration} 1715 * (orientation, locale, etc) has changed. When such a change happens, the 1716 * UIs (view hierarchy) will need to be rebuilt based on this new 1717 * information; for the most part, applications don't need to worry about 1718 * this, because the system will take care of stopping and restarting the 1719 * application to make sure it sees the new changes. Some system code that 1720 * can not be restarted will need to watch for this action and handle it 1721 * appropriately. 1722 * 1723 * <p class="note"> 1724 * You can <em>not</em> receive this through components declared 1725 * in manifests, only by explicitly registering for it with 1726 * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) 1727 * Context.registerReceiver()}. 1728 * 1729 * <p class="note">This is a protected intent that can only be sent 1730 * by the system. 1731 * 1732 * @see android.content.res.Configuration 1733 */ 1734 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1735 public static final String ACTION_CONFIGURATION_CHANGED = "android.intent.action.CONFIGURATION_CHANGED"; 1736 /** 1737 * Broadcast Action: The current device's locale has changed. 1738 * 1739 * <p class="note">This is a protected intent that can only be sent 1740 * by the system. 1741 */ 1742 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1743 public static final String ACTION_LOCALE_CHANGED = "android.intent.action.LOCALE_CHANGED"; 1744 /** 1745 * Broadcast Action: This is a <em>sticky broadcast</em> containing the 1746 * charging state, level, and other information about the battery. 1747 * See {@link android.os.BatteryManager} for documentation on the 1748 * contents of the Intent. 1749 * 1750 * <p class="note"> 1751 * You can <em>not</em> receive this through components declared 1752 * in manifests, only by explicitly registering for it with 1753 * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter) 1754 * Context.registerReceiver()}. See {@link #ACTION_BATTERY_LOW}, 1755 * {@link #ACTION_BATTERY_OKAY}, {@link #ACTION_POWER_CONNECTED}, 1756 * and {@link #ACTION_POWER_DISCONNECTED} for distinct battery-related 1757 * broadcasts that are sent and can be received through manifest 1758 * receivers. 1759 * 1760 * <p class="note">This is a protected intent that can only be sent 1761 * by the system. 1762 */ 1763 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1764 public static final String ACTION_BATTERY_CHANGED = "android.intent.action.BATTERY_CHANGED"; 1765 /** 1766 * Broadcast Action: Indicates low battery condition on the device. 1767 * This broadcast corresponds to the "Low battery warning" system dialog. 1768 * 1769 * <p class="note">This is a protected intent that can only be sent 1770 * by the system. 1771 */ 1772 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1773 public static final String ACTION_BATTERY_LOW = "android.intent.action.BATTERY_LOW"; 1774 /** 1775 * Broadcast Action: Indicates the battery is now okay after being low. 1776 * This will be sent after {@link #ACTION_BATTERY_LOW} once the battery has 1777 * gone back up to an okay state. 1778 * 1779 * <p class="note">This is a protected intent that can only be sent 1780 * by the system. 1781 */ 1782 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1783 public static final String ACTION_BATTERY_OKAY = "android.intent.action.BATTERY_OKAY"; 1784 /** 1785 * Broadcast Action: External power has been connected to the device. 1786 * This is intended for applications that wish to register specifically to this notification. 1787 * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to 1788 * stay active to receive this notification. This action can be used to implement actions 1789 * that wait until power is available to trigger. 1790 * 1791 * <p class="note">This is a protected intent that can only be sent 1792 * by the system. 1793 */ 1794 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1795 public static final String ACTION_POWER_CONNECTED = "android.intent.action.ACTION_POWER_CONNECTED"; 1796 /** 1797 * Broadcast Action: External power has been removed from the device. 1798 * This is intended for applications that wish to register specifically to this notification. 1799 * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to 1800 * stay active to receive this notification. This action can be used to implement actions 1801 * that wait until power is available to trigger. 1802 * 1803 * <p class="note">This is a protected intent that can only be sent 1804 * by the system. 1805 */ 1806 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1807 public static final String ACTION_POWER_DISCONNECTED = 1808 "android.intent.action.ACTION_POWER_DISCONNECTED"; 1809 /** 1810 * Broadcast Action: Device is shutting down. 1811 * This is broadcast when the device is being shut down (completely turned 1812 * off, not sleeping). Once the broadcast is complete, the final shutdown 1813 * will proceed and all unsaved data lost. Apps will not normally need 1814 * to handle this, since the foreground activity will be paused as well. 1815 * 1816 * <p class="note">This is a protected intent that can only be sent 1817 * by the system. 1818 */ 1819 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1820 public static final String ACTION_SHUTDOWN = "android.intent.action.ACTION_SHUTDOWN"; 1821 /** 1822 * Activity Action: Start this activity to request system shutdown. 1823 * The optional boolean extra field {@link #EXTRA_KEY_CONFIRM} can be set to true 1824 * to request confirmation from the user before shutting down. 1825 * 1826 * <p class="note">This is a protected intent that can only be sent 1827 * by the system. 1828 * 1829 * {@hide} 1830 */ 1831 public static final String ACTION_REQUEST_SHUTDOWN = "android.intent.action.ACTION_REQUEST_SHUTDOWN"; 1832 /** 1833 * Broadcast Action: A sticky broadcast that indicates low memory 1834 * condition on the device 1835 * 1836 * <p class="note">This is a protected intent that can only be sent 1837 * by the system. 1838 */ 1839 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1840 public static final String ACTION_DEVICE_STORAGE_LOW = "android.intent.action.DEVICE_STORAGE_LOW"; 1841 /** 1842 * Broadcast Action: Indicates low memory condition on the device no longer exists 1843 * 1844 * <p class="note">This is a protected intent that can only be sent 1845 * by the system. 1846 */ 1847 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1848 public static final String ACTION_DEVICE_STORAGE_OK = "android.intent.action.DEVICE_STORAGE_OK"; 1849 /** 1850 * Broadcast Action: A sticky broadcast that indicates a memory full 1851 * condition on the device. This is intended for activities that want 1852 * to be able to fill the data partition completely, leaving only 1853 * enough free space to prevent system-wide SQLite failures. 1854 * 1855 * <p class="note">This is a protected intent that can only be sent 1856 * by the system. 1857 * 1858 * {@hide} 1859 */ 1860 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1861 public static final String ACTION_DEVICE_STORAGE_FULL = "android.intent.action.DEVICE_STORAGE_FULL"; 1862 /** 1863 * Broadcast Action: Indicates memory full condition on the device 1864 * no longer exists. 1865 * 1866 * <p class="note">This is a protected intent that can only be sent 1867 * by the system. 1868 * 1869 * {@hide} 1870 */ 1871 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1872 public static final String ACTION_DEVICE_STORAGE_NOT_FULL = "android.intent.action.DEVICE_STORAGE_NOT_FULL"; 1873 /** 1874 * Broadcast Action: Indicates low memory condition notification acknowledged by user 1875 * and package management should be started. 1876 * This is triggered by the user from the ACTION_DEVICE_STORAGE_LOW 1877 * notification. 1878 */ 1879 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1880 public static final String ACTION_MANAGE_PACKAGE_STORAGE = "android.intent.action.MANAGE_PACKAGE_STORAGE"; 1881 /** 1882 * Broadcast Action: The device has entered USB Mass Storage mode. 1883 * This is used mainly for the USB Settings panel. 1884 * Apps should listen for ACTION_MEDIA_MOUNTED and ACTION_MEDIA_UNMOUNTED broadcasts to be notified 1885 * when the SD card file system is mounted or unmounted 1886 * @deprecated replaced by android.os.storage.StorageEventListener 1887 */ 1888 @Deprecated 1889 public static final String ACTION_UMS_CONNECTED = "android.intent.action.UMS_CONNECTED"; 1890 1891 /** 1892 * Broadcast Action: The device has exited USB Mass Storage mode. 1893 * This is used mainly for the USB Settings panel. 1894 * Apps should listen for ACTION_MEDIA_MOUNTED and ACTION_MEDIA_UNMOUNTED broadcasts to be notified 1895 * when the SD card file system is mounted or unmounted 1896 * @deprecated replaced by android.os.storage.StorageEventListener 1897 */ 1898 @Deprecated 1899 public static final String ACTION_UMS_DISCONNECTED = "android.intent.action.UMS_DISCONNECTED"; 1900 1901 /** 1902 * Broadcast Action: External media has been removed. 1903 * The path to the mount point for the removed media is contained in the Intent.mData field. 1904 */ 1905 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1906 public static final String ACTION_MEDIA_REMOVED = "android.intent.action.MEDIA_REMOVED"; 1907 1908 /** 1909 * Broadcast Action: External media is present, but not mounted at its mount point. 1910 * The path to the mount point for the removed media is contained in the Intent.mData field. 1911 */ 1912 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1913 public static final String ACTION_MEDIA_UNMOUNTED = "android.intent.action.MEDIA_UNMOUNTED"; 1914 1915 /** 1916 * Broadcast Action: External media is present, and being disk-checked 1917 * The path to the mount point for the checking media is contained in the Intent.mData field. 1918 */ 1919 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1920 public static final String ACTION_MEDIA_CHECKING = "android.intent.action.MEDIA_CHECKING"; 1921 1922 /** 1923 * Broadcast Action: External media is present, but is using an incompatible fs (or is blank) 1924 * The path to the mount point for the checking media is contained in the Intent.mData field. 1925 */ 1926 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1927 public static final String ACTION_MEDIA_NOFS = "android.intent.action.MEDIA_NOFS"; 1928 1929 /** 1930 * Broadcast Action: External media is present and mounted at its mount point. 1931 * The path to the mount point for the removed media is contained in the Intent.mData field. 1932 * The Intent contains an extra with name "read-only" and Boolean value to indicate if the 1933 * media was mounted read only. 1934 */ 1935 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1936 public static final String ACTION_MEDIA_MOUNTED = "android.intent.action.MEDIA_MOUNTED"; 1937 1938 /** 1939 * Broadcast Action: External media is unmounted because it is being shared via USB mass storage. 1940 * The path to the mount point for the shared media is contained in the Intent.mData field. 1941 */ 1942 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1943 public static final String ACTION_MEDIA_SHARED = "android.intent.action.MEDIA_SHARED"; 1944 1945 /** 1946 * Broadcast Action: External media is no longer being shared via USB mass storage. 1947 * The path to the mount point for the previously shared media is contained in the Intent.mData field. 1948 * 1949 * @hide 1950 */ 1951 public static final String ACTION_MEDIA_UNSHARED = "android.intent.action.MEDIA_UNSHARED"; 1952 1953 /** 1954 * Broadcast Action: External media was removed from SD card slot, but mount point was not unmounted. 1955 * The path to the mount point for the removed media is contained in the Intent.mData field. 1956 */ 1957 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1958 public static final String ACTION_MEDIA_BAD_REMOVAL = "android.intent.action.MEDIA_BAD_REMOVAL"; 1959 1960 /** 1961 * Broadcast Action: External media is present but cannot be mounted. 1962 * The path to the mount point for the removed media is contained in the Intent.mData field. 1963 */ 1964 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1965 public static final String ACTION_MEDIA_UNMOUNTABLE = "android.intent.action.MEDIA_UNMOUNTABLE"; 1966 1967 /** 1968 * Broadcast Action: User has expressed the desire to remove the external storage media. 1969 * Applications should close all files they have open within the mount point when they receive this intent. 1970 * The path to the mount point for the media to be ejected is contained in the Intent.mData field. 1971 */ 1972 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1973 public static final String ACTION_MEDIA_EJECT = "android.intent.action.MEDIA_EJECT"; 1974 1975 /** 1976 * Broadcast Action: The media scanner has started scanning a directory. 1977 * The path to the directory being scanned is contained in the Intent.mData field. 1978 */ 1979 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1980 public static final String ACTION_MEDIA_SCANNER_STARTED = "android.intent.action.MEDIA_SCANNER_STARTED"; 1981 1982 /** 1983 * Broadcast Action: The media scanner has finished scanning a directory. 1984 * The path to the scanned directory is contained in the Intent.mData field. 1985 */ 1986 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1987 public static final String ACTION_MEDIA_SCANNER_FINISHED = "android.intent.action.MEDIA_SCANNER_FINISHED"; 1988 1989 /** 1990 * Broadcast Action: Request the media scanner to scan a file and add it to the media database. 1991 * The path to the file is contained in the Intent.mData field. 1992 */ 1993 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1994 public static final String ACTION_MEDIA_SCANNER_SCAN_FILE = "android.intent.action.MEDIA_SCANNER_SCAN_FILE"; 1995 1996 /** 1997 * Broadcast Action: The "Media Button" was pressed. Includes a single 1998 * extra field, {@link #EXTRA_KEY_EVENT}, containing the key event that 1999 * caused the broadcast. 2000 */ 2001 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2002 public static final String ACTION_MEDIA_BUTTON = "android.intent.action.MEDIA_BUTTON"; 2003 2004 /** 2005 * Broadcast Action: The "Camera Button" was pressed. Includes a single 2006 * extra field, {@link #EXTRA_KEY_EVENT}, containing the key event that 2007 * caused the broadcast. 2008 */ 2009 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2010 public static final String ACTION_CAMERA_BUTTON = "android.intent.action.CAMERA_BUTTON"; 2011 2012 // *** NOTE: @todo(*) The following really should go into a more domain-specific 2013 // location; they are not general-purpose actions. 2014 2015 /** 2016 * Broadcast Action: A GTalk connection has been established. 2017 */ 2018 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2019 public static final String ACTION_GTALK_SERVICE_CONNECTED = 2020 "android.intent.action.GTALK_CONNECTED"; 2021 2022 /** 2023 * Broadcast Action: A GTalk connection has been disconnected. 2024 */ 2025 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2026 public static final String ACTION_GTALK_SERVICE_DISCONNECTED = 2027 "android.intent.action.GTALK_DISCONNECTED"; 2028 2029 /** 2030 * Broadcast Action: An input method has been changed. 2031 */ 2032 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2033 public static final String ACTION_INPUT_METHOD_CHANGED = 2034 "android.intent.action.INPUT_METHOD_CHANGED"; 2035 2036 /** 2037 * <p>Broadcast Action: The user has switched the phone into or out of Airplane Mode. One or 2038 * more radios have been turned off or on. The intent will have the following extra value:</p> 2039 * <ul> 2040 * <li><em>state</em> - A boolean value indicating whether Airplane Mode is on. If true, 2041 * then cell radio and possibly other radios such as bluetooth or WiFi may have also been 2042 * turned off</li> 2043 * </ul> 2044 * 2045 * <p class="note">This is a protected intent that can only be sent 2046 * by the system. 2047 */ 2048 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2049 public static final String ACTION_AIRPLANE_MODE_CHANGED = "android.intent.action.AIRPLANE_MODE"; 2050 2051 /** 2052 * Broadcast Action: Some content providers have parts of their namespace 2053 * where they publish new events or items that the user may be especially 2054 * interested in. For these things, they may broadcast this action when the 2055 * set of interesting items change. 2056 * 2057 * For example, GmailProvider sends this notification when the set of unread 2058 * mail in the inbox changes. 2059 * 2060 * <p>The data of the intent identifies which part of which provider 2061 * changed. When queried through the content resolver, the data URI will 2062 * return the data set in question. 2063 * 2064 * <p>The intent will have the following extra values: 2065 * <ul> 2066 * <li><em>count</em> - The number of items in the data set. This is the 2067 * same as the number of items in the cursor returned by querying the 2068 * data URI. </li> 2069 * </ul> 2070 * 2071 * This intent will be sent at boot (if the count is non-zero) and when the 2072 * data set changes. It is possible for the data set to change without the 2073 * count changing (for example, if a new unread message arrives in the same 2074 * sync operation in which a message is archived). The phone should still 2075 * ring/vibrate/etc as normal in this case. 2076 */ 2077 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2078 public static final String ACTION_PROVIDER_CHANGED = 2079 "android.intent.action.PROVIDER_CHANGED"; 2080 2081 /** 2082 * Broadcast Action: Wired Headset plugged in or unplugged. 2083 * 2084 * <p>The intent will have the following extra values: 2085 * <ul> 2086 * <li><em>state</em> - 0 for unplugged, 1 for plugged. </li> 2087 * <li><em>name</em> - Headset type, human readable string </li> 2088 * <li><em>microphone</em> - 1 if headset has a microphone, 0 otherwise </li> 2089 * </ul> 2090 * </ul> 2091 */ 2092 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2093 public static final String ACTION_HEADSET_PLUG = 2094 "android.intent.action.HEADSET_PLUG"; 2095 2096 /** 2097 * Broadcast Action: An analog audio speaker/headset plugged in or unplugged. 2098 * 2099 * <p>The intent will have the following extra values: 2100 * <ul> 2101 * <li><em>state</em> - 0 for unplugged, 1 for plugged. </li> 2102 * <li><em>name</em> - Headset type, human readable string </li> 2103 * </ul> 2104 * </ul> 2105 * @hide 2106 */ 2107 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2108 public static final String ACTION_ANALOG_AUDIO_DOCK_PLUG = 2109 "android.intent.action.ANALOG_AUDIO_DOCK_PLUG"; 2110 2111 /** 2112 * Broadcast Action: A digital audio speaker/headset plugged in or unplugged. 2113 * 2114 * <p>The intent will have the following extra values: 2115 * <ul> 2116 * <li><em>state</em> - 0 for unplugged, 1 for plugged. </li> 2117 * <li><em>name</em> - Headset type, human readable string </li> 2118 * </ul> 2119 * </ul> 2120 * @hide 2121 */ 2122 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2123 public static final String ACTION_DIGITAL_AUDIO_DOCK_PLUG = 2124 "android.intent.action.DIGITAL_AUDIO_DOCK_PLUG"; 2125 2126 /** 2127 * Broadcast Action: A HMDI cable was plugged or unplugged 2128 * 2129 * <p>The intent will have the following extra values: 2130 * <ul> 2131 * <li><em>state</em> - 0 for unplugged, 1 for plugged. </li> 2132 * <li><em>name</em> - HDMI cable, human readable string </li> 2133 * </ul> 2134 * </ul> 2135 * @hide 2136 */ 2137 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2138 public static final String ACTION_HDMI_AUDIO_PLUG = 2139 "android.intent.action.HDMI_AUDIO_PLUG"; 2140 2141 /** 2142 * Broadcast Action: A USB audio accessory was plugged in or unplugged. 2143 * 2144 * <p>The intent will have the following extra values: 2145 * <ul> 2146 * <li><em>state</em> - 0 for unplugged, 1 for plugged. </li> 2147 * <li><em>card</em> - ALSA card number (integer) </li> 2148 * <li><em>device</em> - ALSA device number (integer) </li> 2149 * </ul> 2150 * </ul> 2151 * @hide 2152 */ 2153 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2154 public static final String ACTION_USB_AUDIO_ACCESSORY_PLUG = 2155 "android.intent.action.USB_AUDIO_ACCESSORY_PLUG"; 2156 2157 /** 2158 * Broadcast Action: A USB audio device was plugged in or unplugged. 2159 * 2160 * <p>The intent will have the following extra values: 2161 * <ul> 2162 * <li><em>state</em> - 0 for unplugged, 1 for plugged. </li> 2163 * <li><em>card</em> - ALSA card number (integer) </li> 2164 * <li><em>device</em> - ALSA device number (integer) </li> 2165 * </ul> 2166 * </ul> 2167 * @hide 2168 */ 2169 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2170 public static final String ACTION_USB_AUDIO_DEVICE_PLUG = 2171 "android.intent.action.USB_AUDIO_DEVICE_PLUG"; 2172 2173 /** 2174 * <p>Broadcast Action: The user has switched on advanced settings in the settings app:</p> 2175 * <ul> 2176 * <li><em>state</em> - A boolean value indicating whether the settings is on or off.</li> 2177 * </ul> 2178 * 2179 * <p class="note">This is a protected intent that can only be sent 2180 * by the system. 2181 * 2182 * @hide 2183 */ 2184 //@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2185 public static final String ACTION_ADVANCED_SETTINGS_CHANGED 2186 = "android.intent.action.ADVANCED_SETTINGS"; 2187 2188 /** 2189 * Broadcast Action: An outgoing call is about to be placed. 2190 * 2191 * <p>The Intent will have the following extra value: 2192 * <ul> 2193 * <li><em>{@link android.content.Intent#EXTRA_PHONE_NUMBER}</em> - 2194 * the phone number originally intended to be dialed.</li> 2195 * </ul> 2196 * <p>Once the broadcast is finished, the resultData is used as the actual 2197 * number to call. If <code>null</code>, no call will be placed.</p> 2198 * <p>It is perfectly acceptable for multiple receivers to process the 2199 * outgoing call in turn: for example, a parental control application 2200 * might verify that the user is authorized to place the call at that 2201 * time, then a number-rewriting application might add an area code if 2202 * one was not specified.</p> 2203 * <p>For consistency, any receiver whose purpose is to prohibit phone 2204 * calls should have a priority of 0, to ensure it will see the final 2205 * phone number to be dialed. 2206 * Any receiver whose purpose is to rewrite phone numbers to be called 2207 * should have a positive priority. 2208 * Negative priorities are reserved for the system for this broadcast; 2209 * using them may cause problems.</p> 2210 * <p>Any BroadcastReceiver receiving this Intent <em>must not</em> 2211 * abort the broadcast.</p> 2212 * <p>Emergency calls cannot be intercepted using this mechanism, and 2213 * other calls cannot be modified to call emergency numbers using this 2214 * mechanism. 2215 * <p>You must hold the 2216 * {@link android.Manifest.permission#PROCESS_OUTGOING_CALLS} 2217 * permission to receive this Intent.</p> 2218 * 2219 * <p class="note">This is a protected intent that can only be sent 2220 * by the system. 2221 */ 2222 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2223 public static final String ACTION_NEW_OUTGOING_CALL = 2224 "android.intent.action.NEW_OUTGOING_CALL"; 2225 2226 /** 2227 * Broadcast Action: Have the device reboot. This is only for use by 2228 * system code. 2229 * 2230 * <p class="note">This is a protected intent that can only be sent 2231 * by the system. 2232 */ 2233 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2234 public static final String ACTION_REBOOT = 2235 "android.intent.action.REBOOT"; 2236 2237 /** 2238 * Broadcast Action: A sticky broadcast for changes in the physical 2239 * docking state of the device. 2240 * 2241 * <p>The intent will have the following extra values: 2242 * <ul> 2243 * <li><em>{@link #EXTRA_DOCK_STATE}</em> - the current dock 2244 * state, indicating which dock the device is physically in.</li> 2245 * </ul> 2246 * <p>This is intended for monitoring the current physical dock state. 2247 * See {@link android.app.UiModeManager} for the normal API dealing with 2248 * dock mode changes. 2249 */ 2250 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2251 public static final String ACTION_DOCK_EVENT = 2252 "android.intent.action.DOCK_EVENT"; 2253 2254 /** 2255 * Broadcast Action: a remote intent is to be broadcasted. 2256 * 2257 * A remote intent is used for remote RPC between devices. The remote intent 2258 * is serialized and sent from one device to another device. The receiving 2259 * device parses the remote intent and broadcasts it. Note that anyone can 2260 * broadcast a remote intent. However, if the intent receiver of the remote intent 2261 * does not trust intent broadcasts from arbitrary intent senders, it should require 2262 * the sender to hold certain permissions so only trusted sender's broadcast will be 2263 * let through. 2264 * @hide 2265 */ 2266 public static final String ACTION_REMOTE_INTENT = 2267 "com.google.android.c2dm.intent.RECEIVE"; 2268 2269 /** 2270 * Broadcast Action: hook for permforming cleanup after a system update. 2271 * 2272 * The broadcast is sent when the system is booting, before the 2273 * BOOT_COMPLETED broadcast. It is only sent to receivers in the system 2274 * image. A receiver for this should do its work and then disable itself 2275 * so that it does not get run again at the next boot. 2276 * @hide 2277 */ 2278 public static final String ACTION_PRE_BOOT_COMPLETED = 2279 "android.intent.action.PRE_BOOT_COMPLETED"; 2280 2281 /** 2282 * Broadcast sent to the system when a user is added. Carries an extra EXTRA_USERID that has the 2283 * userid of the new user. 2284 * @hide 2285 */ 2286 public static final String ACTION_USER_ADDED = 2287 "android.intent.action.USER_ADDED"; 2288 2289 /** 2290 * Broadcast sent to the system when a user is removed. Carries an extra EXTRA_USERID that has 2291 * the userid of the user. 2292 * @hide 2293 */ 2294 public static final String ACTION_USER_REMOVED = 2295 "android.intent.action.USER_REMOVED"; 2296 2297 /** 2298 * Broadcast sent to the system when the user switches. Carries an extra EXTRA_USERID that has 2299 * the userid of the user to become the current one. 2300 * @hide 2301 */ 2302 public static final String ACTION_USER_SWITCHED = 2303 "android.intent.action.USER_SWITCHED"; 2304 2305 // --------------------------------------------------------------------- 2306 // --------------------------------------------------------------------- 2307 // Standard intent categories (see addCategory()). 2308 2309 /** 2310 * Set if the activity should be an option for the default action 2311 * (center press) to perform on a piece of data. Setting this will 2312 * hide from the user any activities without it set when performing an 2313 * action on some data. Note that this is normal -not- set in the 2314 * Intent when initiating an action -- it is for use in intent filters 2315 * specified in packages. 2316 */ 2317 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2318 public static final String CATEGORY_DEFAULT = "android.intent.category.DEFAULT"; 2319 /** 2320 * Activities that can be safely invoked from a browser must support this 2321 * category. For example, if the user is viewing a web page or an e-mail 2322 * and clicks on a link in the text, the Intent generated execute that 2323 * link will require the BROWSABLE category, so that only activities 2324 * supporting this category will be considered as possible actions. By 2325 * supporting this category, you are promising that there is nothing 2326 * damaging (without user intervention) that can happen by invoking any 2327 * matching Intent. 2328 */ 2329 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2330 public static final String CATEGORY_BROWSABLE = "android.intent.category.BROWSABLE"; 2331 /** 2332 * Set if the activity should be considered as an alternative action to 2333 * the data the user is currently viewing. See also 2334 * {@link #CATEGORY_SELECTED_ALTERNATIVE} for an alternative action that 2335 * applies to the selection in a list of items. 2336 * 2337 * <p>Supporting this category means that you would like your activity to be 2338 * displayed in the set of alternative things the user can do, usually as 2339 * part of the current activity's options menu. You will usually want to 2340 * include a specific label in the <intent-filter> of this action 2341 * describing to the user what it does. 2342 * 2343 * <p>The action of IntentFilter with this category is important in that it 2344 * describes the specific action the target will perform. This generally 2345 * should not be a generic action (such as {@link #ACTION_VIEW}, but rather 2346 * a specific name such as "com.android.camera.action.CROP. Only one 2347 * alternative of any particular action will be shown to the user, so using 2348 * a specific action like this makes sure that your alternative will be 2349 * displayed while also allowing other applications to provide their own 2350 * overrides of that particular action. 2351 */ 2352 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2353 public static final String CATEGORY_ALTERNATIVE = "android.intent.category.ALTERNATIVE"; 2354 /** 2355 * Set if the activity should be considered as an alternative selection 2356 * action to the data the user has currently selected. This is like 2357 * {@link #CATEGORY_ALTERNATIVE}, but is used in activities showing a list 2358 * of items from which the user can select, giving them alternatives to the 2359 * default action that will be performed on it. 2360 */ 2361 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2362 public static final String CATEGORY_SELECTED_ALTERNATIVE = "android.intent.category.SELECTED_ALTERNATIVE"; 2363 /** 2364 * Intended to be used as a tab inside of a containing TabActivity. 2365 */ 2366 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2367 public static final String CATEGORY_TAB = "android.intent.category.TAB"; 2368 /** 2369 * Should be displayed in the top-level launcher. 2370 */ 2371 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2372 public static final String CATEGORY_LAUNCHER = "android.intent.category.LAUNCHER"; 2373 /** 2374 * Provides information about the package it is in; typically used if 2375 * a package does not contain a {@link #CATEGORY_LAUNCHER} to provide 2376 * a front-door to the user without having to be shown in the all apps list. 2377 */ 2378 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2379 public static final String CATEGORY_INFO = "android.intent.category.INFO"; 2380 /** 2381 * This is the home activity, that is the first activity that is displayed 2382 * when the device boots. 2383 */ 2384 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2385 public static final String CATEGORY_HOME = "android.intent.category.HOME"; 2386 /** 2387 * This activity is a preference panel. 2388 */ 2389 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2390 public static final String CATEGORY_PREFERENCE = "android.intent.category.PREFERENCE"; 2391 /** 2392 * This activity is a development preference panel. 2393 */ 2394 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2395 public static final String CATEGORY_DEVELOPMENT_PREFERENCE = "android.intent.category.DEVELOPMENT_PREFERENCE"; 2396 /** 2397 * Capable of running inside a parent activity container. 2398 */ 2399 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2400 public static final String CATEGORY_EMBED = "android.intent.category.EMBED"; 2401 /** 2402 * This activity allows the user to browse and download new applications. 2403 */ 2404 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2405 public static final String CATEGORY_APP_MARKET = "android.intent.category.APP_MARKET"; 2406 /** 2407 * This activity may be exercised by the monkey or other automated test tools. 2408 */ 2409 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2410 public static final String CATEGORY_MONKEY = "android.intent.category.MONKEY"; 2411 /** 2412 * To be used as a test (not part of the normal user experience). 2413 */ 2414 public static final String CATEGORY_TEST = "android.intent.category.TEST"; 2415 /** 2416 * To be used as a unit test (run through the Test Harness). 2417 */ 2418 public static final String CATEGORY_UNIT_TEST = "android.intent.category.UNIT_TEST"; 2419 /** 2420 * To be used as a sample code example (not part of the normal user 2421 * experience). 2422 */ 2423 public static final String CATEGORY_SAMPLE_CODE = "android.intent.category.SAMPLE_CODE"; 2424 /** 2425 * Used to indicate that a GET_CONTENT intent only wants URIs that can be opened with 2426 * ContentResolver.openInputStream. Openable URIs must support the columns in OpenableColumns 2427 * when queried, though it is allowable for those columns to be blank. 2428 */ 2429 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2430 public static final String CATEGORY_OPENABLE = "android.intent.category.OPENABLE"; 2431 2432 /** 2433 * To be used as code under test for framework instrumentation tests. 2434 */ 2435 public static final String CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST = 2436 "android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST"; 2437 /** 2438 * An activity to run when device is inserted into a car dock. 2439 * Used with {@link #ACTION_MAIN} to launch an activity. For more 2440 * information, see {@link android.app.UiModeManager}. 2441 */ 2442 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2443 public static final String CATEGORY_CAR_DOCK = "android.intent.category.CAR_DOCK"; 2444 /** 2445 * An activity to run when device is inserted into a car dock. 2446 * Used with {@link #ACTION_MAIN} to launch an activity. For more 2447 * information, see {@link android.app.UiModeManager}. 2448 */ 2449 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2450 public static final String CATEGORY_DESK_DOCK = "android.intent.category.DESK_DOCK"; 2451 /** 2452 * An activity to run when device is inserted into a analog (low end) dock. 2453 * Used with {@link #ACTION_MAIN} to launch an activity. For more 2454 * information, see {@link android.app.UiModeManager}. 2455 */ 2456 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2457 public static final String CATEGORY_LE_DESK_DOCK = "android.intent.category.LE_DESK_DOCK"; 2458 2459 /** 2460 * An activity to run when device is inserted into a digital (high end) dock. 2461 * Used with {@link #ACTION_MAIN} to launch an activity. For more 2462 * information, see {@link android.app.UiModeManager}. 2463 */ 2464 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2465 public static final String CATEGORY_HE_DESK_DOCK = "android.intent.category.HE_DESK_DOCK"; 2466 2467 /** 2468 * Used to indicate that the activity can be used in a car environment. 2469 */ 2470 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2471 public static final String CATEGORY_CAR_MODE = "android.intent.category.CAR_MODE"; 2472 2473 // --------------------------------------------------------------------- 2474 // --------------------------------------------------------------------- 2475 // Application launch intent categories (see addCategory()). 2476 2477 /** 2478 * Used with {@link #ACTION_MAIN} to launch the browser application. 2479 * The activity should be able to browse the Internet. 2480 * <p>NOTE: This should not be used as the primary key of an Intent, 2481 * since it will not result in the app launching with the correct 2482 * action and category. Instead, use this with 2483 * {@link #makeMainSelectorActivity(String, String)} to generate a main 2484 * Intent with this category in the selector.</p> 2485 */ 2486 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2487 public static final String CATEGORY_APP_BROWSER = "android.intent.category.APP_BROWSER"; 2488 2489 /** 2490 * Used with {@link #ACTION_MAIN} to launch the calculator application. 2491 * The activity should be able to perform standard arithmetic operations. 2492 * <p>NOTE: This should not be used as the primary key of an Intent, 2493 * since it will not result in the app launching with the correct 2494 * action and category. Instead, use this with 2495 * {@link #makeMainSelectorActivity(String, String)} to generate a main 2496 * Intent with this category in the selector.</p> 2497 */ 2498 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2499 public static final String CATEGORY_APP_CALCULATOR = "android.intent.category.APP_CALCULATOR"; 2500 2501 /** 2502 * Used with {@link #ACTION_MAIN} to launch the calendar application. 2503 * The activity should be able to view and manipulate calendar entries. 2504 * <p>NOTE: This should not be used as the primary key of an Intent, 2505 * since it will not result in the app launching with the correct 2506 * action and category. Instead, use this with 2507 * {@link #makeMainSelectorActivity(String, String)} to generate a main 2508 * Intent with this category in the selector.</p> 2509 */ 2510 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2511 public static final String CATEGORY_APP_CALENDAR = "android.intent.category.APP_CALENDAR"; 2512 2513 /** 2514 * Used with {@link #ACTION_MAIN} to launch the contacts application. 2515 * The activity should be able to view and manipulate address book entries. 2516 * <p>NOTE: This should not be used as the primary key of an Intent, 2517 * since it will not result in the app launching with the correct 2518 * action and category. Instead, use this with 2519 * {@link #makeMainSelectorActivity(String, String)} to generate a main 2520 * Intent with this category in the selector.</p> 2521 */ 2522 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2523 public static final String CATEGORY_APP_CONTACTS = "android.intent.category.APP_CONTACTS"; 2524 2525 /** 2526 * Used with {@link #ACTION_MAIN} to launch the email application. 2527 * The activity should be able to send and receive email. 2528 * <p>NOTE: This should not be used as the primary key of an Intent, 2529 * since it will not result in the app launching with the correct 2530 * action and category. Instead, use this with 2531 * {@link #makeMainSelectorActivity(String, String)} to generate a main 2532 * Intent with this category in the selector.</p> 2533 */ 2534 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2535 public static final String CATEGORY_APP_EMAIL = "android.intent.category.APP_EMAIL"; 2536 2537 /** 2538 * Used with {@link #ACTION_MAIN} to launch the gallery application. 2539 * The activity should be able to view and manipulate image and video files 2540 * stored on the device. 2541 * <p>NOTE: This should not be used as the primary key of an Intent, 2542 * since it will not result in the app launching with the correct 2543 * action and category. Instead, use this with 2544 * {@link #makeMainSelectorActivity(String, String)} to generate a main 2545 * Intent with this category in the selector.</p> 2546 */ 2547 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2548 public static final String CATEGORY_APP_GALLERY = "android.intent.category.APP_GALLERY"; 2549 2550 /** 2551 * Used with {@link #ACTION_MAIN} to launch the maps application. 2552 * The activity should be able to show the user's current location and surroundings. 2553 * <p>NOTE: This should not be used as the primary key of an Intent, 2554 * since it will not result in the app launching with the correct 2555 * action and category. Instead, use this with 2556 * {@link #makeMainSelectorActivity(String, String)} to generate a main 2557 * Intent with this category in the selector.</p> 2558 */ 2559 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2560 public static final String CATEGORY_APP_MAPS = "android.intent.category.APP_MAPS"; 2561 2562 /** 2563 * Used with {@link #ACTION_MAIN} to launch the messaging application. 2564 * The activity should be able to send and receive text messages. 2565 * <p>NOTE: This should not be used as the primary key of an Intent, 2566 * since it will not result in the app launching with the correct 2567 * action and category. Instead, use this with 2568 * {@link #makeMainSelectorActivity(String, String)} to generate a main 2569 * Intent with this category in the selector.</p> 2570 */ 2571 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2572 public static final String CATEGORY_APP_MESSAGING = "android.intent.category.APP_MESSAGING"; 2573 2574 /** 2575 * Used with {@link #ACTION_MAIN} to launch the music application. 2576 * The activity should be able to play, browse, or manipulate music files 2577 * stored on the device. 2578 * <p>NOTE: This should not be used as the primary key of an Intent, 2579 * since it will not result in the app launching with the correct 2580 * action and category. Instead, use this with 2581 * {@link #makeMainSelectorActivity(String, String)} to generate a main 2582 * Intent with this category in the selector.</p> 2583 */ 2584 @SdkConstant(SdkConstantType.INTENT_CATEGORY) 2585 public static final String CATEGORY_APP_MUSIC = "android.intent.category.APP_MUSIC"; 2586 2587 // --------------------------------------------------------------------- 2588 // --------------------------------------------------------------------- 2589 // Standard extra data keys. 2590 2591 /** 2592 * The initial data to place in a newly created record. Use with 2593 * {@link #ACTION_INSERT}. The data here is a Map containing the same 2594 * fields as would be given to the underlying ContentProvider.insert() 2595 * call. 2596 */ 2597 public static final String EXTRA_TEMPLATE = "android.intent.extra.TEMPLATE"; 2598 2599 /** 2600 * A constant CharSequence that is associated with the Intent, used with 2601 * {@link #ACTION_SEND} to supply the literal data to be sent. Note that 2602 * this may be a styled CharSequence, so you must use 2603 * {@link Bundle#getCharSequence(String) Bundle.getCharSequence()} to 2604 * retrieve it. 2605 */ 2606 public static final String EXTRA_TEXT = "android.intent.extra.TEXT"; 2607 2608 /** 2609 * A constant String that is associated with the Intent, used with 2610 * {@link #ACTION_SEND} to supply an alternative to {@link #EXTRA_TEXT} 2611 * as HTML formatted text. Note that you <em>must</em> also supply 2612 * {@link #EXTRA_TEXT}. 2613 */ 2614 public static final String EXTRA_HTML_TEXT = "android.intent.extra.HTML_TEXT"; 2615 2616 /** 2617 * A content: URI holding a stream of data associated with the Intent, 2618 * used with {@link #ACTION_SEND} to supply the data being sent. 2619 */ 2620 public static final String EXTRA_STREAM = "android.intent.extra.STREAM"; 2621 2622 /** 2623 * A String[] holding e-mail addresses that should be delivered to. 2624 */ 2625 public static final String EXTRA_EMAIL = "android.intent.extra.EMAIL"; 2626 2627 /** 2628 * A String[] holding e-mail addresses that should be carbon copied. 2629 */ 2630 public static final String EXTRA_CC = "android.intent.extra.CC"; 2631 2632 /** 2633 * A String[] holding e-mail addresses that should be blind carbon copied. 2634 */ 2635 public static final String EXTRA_BCC = "android.intent.extra.BCC"; 2636 2637 /** 2638 * A constant string holding the desired subject line of a message. 2639 */ 2640 public static final String EXTRA_SUBJECT = "android.intent.extra.SUBJECT"; 2641 2642 /** 2643 * An Intent describing the choices you would like shown with 2644 * {@link #ACTION_PICK_ACTIVITY}. 2645 */ 2646 public static final String EXTRA_INTENT = "android.intent.extra.INTENT"; 2647 2648 /** 2649 * A CharSequence dialog title to provide to the user when used with a 2650 * {@link #ACTION_CHOOSER}. 2651 */ 2652 public static final String EXTRA_TITLE = "android.intent.extra.TITLE"; 2653 2654 /** 2655 * A Parcelable[] of {@link Intent} or 2656 * {@link android.content.pm.LabeledIntent} objects as set with 2657 * {@link #putExtra(String, Parcelable[])} of additional activities to place 2658 * a the front of the list of choices, when shown to the user with a 2659 * {@link #ACTION_CHOOSER}. 2660 */ 2661 public static final String EXTRA_INITIAL_INTENTS = "android.intent.extra.INITIAL_INTENTS"; 2662 2663 /** 2664 * A {@link android.view.KeyEvent} object containing the event that 2665 * triggered the creation of the Intent it is in. 2666 */ 2667 public static final String EXTRA_KEY_EVENT = "android.intent.extra.KEY_EVENT"; 2668 2669 /** 2670 * Set to true in {@link #ACTION_REQUEST_SHUTDOWN} to request confirmation from the user 2671 * before shutting down. 2672 * 2673 * {@hide} 2674 */ 2675 public static final String EXTRA_KEY_CONFIRM = "android.intent.extra.KEY_CONFIRM"; 2676 2677 /** 2678 * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} or 2679 * {@link android.content.Intent#ACTION_PACKAGE_CHANGED} intents to override the default action 2680 * of restarting the application. 2681 */ 2682 public static final String EXTRA_DONT_KILL_APP = "android.intent.extra.DONT_KILL_APP"; 2683 2684 /** 2685 * A String holding the phone number originally entered in 2686 * {@link android.content.Intent#ACTION_NEW_OUTGOING_CALL}, or the actual 2687 * number to call in a {@link android.content.Intent#ACTION_CALL}. 2688 */ 2689 public static final String EXTRA_PHONE_NUMBER = "android.intent.extra.PHONE_NUMBER"; 2690 2691 /** 2692 * Used as an int extra field in {@link android.content.Intent#ACTION_UID_REMOVED} 2693 * intents to supply the uid the package had been assigned. Also an optional 2694 * extra in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} or 2695 * {@link android.content.Intent#ACTION_PACKAGE_CHANGED} for the same 2696 * purpose. 2697 */ 2698 public static final String EXTRA_UID = "android.intent.extra.UID"; 2699 2700 /** 2701 * @hide String array of package names. 2702 */ 2703 public static final String EXTRA_PACKAGES = "android.intent.extra.PACKAGES"; 2704 2705 /** 2706 * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} 2707 * intents to indicate whether this represents a full uninstall (removing 2708 * both the code and its data) or a partial uninstall (leaving its data, 2709 * implying that this is an update). 2710 */ 2711 public static final String EXTRA_DATA_REMOVED = "android.intent.extra.DATA_REMOVED"; 2712 2713 /** 2714 * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED} 2715 * intents to indicate that this is a replacement of the package, so this 2716 * broadcast will immediately be followed by an add broadcast for a 2717 * different version of the same package. 2718 */ 2719 public static final String EXTRA_REPLACING = "android.intent.extra.REPLACING"; 2720 2721 /** 2722 * Used as an int extra field in {@link android.app.AlarmManager} intents 2723 * to tell the application being invoked how many pending alarms are being 2724 * delievered with the intent. For one-shot alarms this will always be 1. 2725 * For recurring alarms, this might be greater than 1 if the device was 2726 * asleep or powered off at the time an earlier alarm would have been 2727 * delivered. 2728 */ 2729 public static final String EXTRA_ALARM_COUNT = "android.intent.extra.ALARM_COUNT"; 2730 2731 /** 2732 * Used as an int extra field in {@link android.content.Intent#ACTION_DOCK_EVENT} 2733 * intents to request the dock state. Possible values are 2734 * {@link android.content.Intent#EXTRA_DOCK_STATE_UNDOCKED}, 2735 * {@link android.content.Intent#EXTRA_DOCK_STATE_DESK}, or 2736 * {@link android.content.Intent#EXTRA_DOCK_STATE_CAR}, or 2737 * {@link android.content.Intent#EXTRA_DOCK_STATE_LE_DESK}, or 2738 * {@link android.content.Intent#EXTRA_DOCK_STATE_HE_DESK}. 2739 */ 2740 public static final String EXTRA_DOCK_STATE = "android.intent.extra.DOCK_STATE"; 2741 2742 /** 2743 * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} 2744 * to represent that the phone is not in any dock. 2745 */ 2746 public static final int EXTRA_DOCK_STATE_UNDOCKED = 0; 2747 2748 /** 2749 * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} 2750 * to represent that the phone is in a desk dock. 2751 */ 2752 public static final int EXTRA_DOCK_STATE_DESK = 1; 2753 2754 /** 2755 * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} 2756 * to represent that the phone is in a car dock. 2757 */ 2758 public static final int EXTRA_DOCK_STATE_CAR = 2; 2759 2760 /** 2761 * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} 2762 * to represent that the phone is in a analog (low end) dock. 2763 */ 2764 public static final int EXTRA_DOCK_STATE_LE_DESK = 3; 2765 2766 /** 2767 * Used as an int value for {@link android.content.Intent#EXTRA_DOCK_STATE} 2768 * to represent that the phone is in a digital (high end) dock. 2769 */ 2770 public static final int EXTRA_DOCK_STATE_HE_DESK = 4; 2771 2772 /** 2773 * Boolean that can be supplied as meta-data with a dock activity, to 2774 * indicate that the dock should take over the home key when it is active. 2775 */ 2776 public static final String METADATA_DOCK_HOME = "android.dock_home"; 2777 2778 /** 2779 * Used as a parcelable extra field in {@link #ACTION_APP_ERROR}, containing 2780 * the bug report. 2781 */ 2782 public static final String EXTRA_BUG_REPORT = "android.intent.extra.BUG_REPORT"; 2783 2784 /** 2785 * Used in the extra field in the remote intent. It's astring token passed with the 2786 * remote intent. 2787 */ 2788 public static final String EXTRA_REMOTE_INTENT_TOKEN = 2789 "android.intent.extra.remote_intent_token"; 2790 2791 /** 2792 * @deprecated See {@link #EXTRA_CHANGED_COMPONENT_NAME_LIST}; this field 2793 * will contain only the first name in the list. 2794 */ 2795 @Deprecated public static final String EXTRA_CHANGED_COMPONENT_NAME = 2796 "android.intent.extra.changed_component_name"; 2797 2798 /** 2799 * This field is part of {@link android.content.Intent#ACTION_PACKAGE_CHANGED}, 2800 * and contains a string array of all of the components that have changed. 2801 */ 2802 public static final String EXTRA_CHANGED_COMPONENT_NAME_LIST = 2803 "android.intent.extra.changed_component_name_list"; 2804 2805 /** 2806 * This field is part of 2807 * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_AVAILABLE}, 2808 * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE} 2809 * and contains a string array of all of the components that have changed. 2810 */ 2811 public static final String EXTRA_CHANGED_PACKAGE_LIST = 2812 "android.intent.extra.changed_package_list"; 2813 2814 /** 2815 * This field is part of 2816 * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_AVAILABLE}, 2817 * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE} 2818 * and contains an integer array of uids of all of the components 2819 * that have changed. 2820 */ 2821 public static final String EXTRA_CHANGED_UID_LIST = 2822 "android.intent.extra.changed_uid_list"; 2823 2824 /** 2825 * @hide 2826 * Magic extra system code can use when binding, to give a label for 2827 * who it is that has bound to a service. This is an integer giving 2828 * a framework string resource that can be displayed to the user. 2829 */ 2830 public static final String EXTRA_CLIENT_LABEL = 2831 "android.intent.extra.client_label"; 2832 2833 /** 2834 * @hide 2835 * Magic extra system code can use when binding, to give a PendingIntent object 2836 * that can be launched for the user to disable the system's use of this 2837 * service. 2838 */ 2839 public static final String EXTRA_CLIENT_INTENT = 2840 "android.intent.extra.client_intent"; 2841 2842 /** 2843 * Used to indicate that a {@link #ACTION_GET_CONTENT} intent should only return 2844 * data that is on the local device. This is a boolean extra; the default 2845 * is false. If true, an implementation of ACTION_GET_CONTENT should only allow 2846 * the user to select media that is already on the device, not requiring it 2847 * be downloaded from a remote service when opened. Another way to look 2848 * at it is that such content should generally have a "_data" column to the 2849 * path of the content on local external storage. 2850 */ 2851 public static final String EXTRA_LOCAL_ONLY = 2852 "android.intent.extra.LOCAL_ONLY"; 2853 2854 /** 2855 * The userid carried with broadcast intents related to addition, removal and switching of users 2856 * - {@link #ACTION_USER_ADDED}, {@link #ACTION_USER_REMOVED} and {@link #ACTION_USER_SWITCHED}. 2857 * @hide 2858 */ 2859 public static final String EXTRA_USERID = 2860 "android.intent.extra.user_id"; 2861 2862 // --------------------------------------------------------------------- 2863 // --------------------------------------------------------------------- 2864 // Intent flags (see mFlags variable). 2865 2866 /** 2867 * If set, the recipient of this Intent will be granted permission to 2868 * perform read operations on the Uri in the Intent's data and any URIs 2869 * specified in its ClipData. When applying to an Intent's ClipData, 2870 * all URIs as well as recursive traversals through data or other ClipData 2871 * in Intent items will be granted; only the grant flags of the top-level 2872 * Intent are used. 2873 */ 2874 public static final int FLAG_GRANT_READ_URI_PERMISSION = 0x00000001; 2875 /** 2876 * If set, the recipient of this Intent will be granted permission to 2877 * perform write operations on the Uri in the Intent's data and any URIs 2878 * specified in its ClipData. When applying to an Intent's ClipData, 2879 * all URIs as well as recursive traversals through data or other ClipData 2880 * in Intent items will be granted; only the grant flags of the top-level 2881 * Intent are used. 2882 */ 2883 public static final int FLAG_GRANT_WRITE_URI_PERMISSION = 0x00000002; 2884 /** 2885 * Can be set by the caller to indicate that this Intent is coming from 2886 * a background operation, not from direct user interaction. 2887 */ 2888 public static final int FLAG_FROM_BACKGROUND = 0x00000004; 2889 /** 2890 * A flag you can enable for debugging: when set, log messages will be 2891 * printed during the resolution of this intent to show you what has 2892 * been found to create the final resolved list. 2893 */ 2894 public static final int FLAG_DEBUG_LOG_RESOLUTION = 0x00000008; 2895 /** 2896 * If set, this intent will not match any components in packages that 2897 * are currently stopped. If this is not set, then the default behavior 2898 * is to include such applications in the result. 2899 */ 2900 public static final int FLAG_EXCLUDE_STOPPED_PACKAGES = 0x00000010; 2901 /** 2902 * If set, this intent will always match any components in packages that 2903 * are currently stopped. This is the default behavior when 2904 * {@link #FLAG_EXCLUDE_STOPPED_PACKAGES} is not set. If both of these 2905 * flags are set, this one wins (it allows overriding of exclude for 2906 * places where the framework may automatically set the exclude flag). 2907 */ 2908 public static final int FLAG_INCLUDE_STOPPED_PACKAGES = 0x00000020; 2909 2910 /** 2911 * If set, the new activity is not kept in the history stack. As soon as 2912 * the user navigates away from it, the activity is finished. This may also 2913 * be set with the {@link android.R.styleable#AndroidManifestActivity_noHistory 2914 * noHistory} attribute. 2915 */ 2916 public static final int FLAG_ACTIVITY_NO_HISTORY = 0x40000000; 2917 /** 2918 * If set, the activity will not be launched if it is already running 2919 * at the top of the history stack. 2920 */ 2921 public static final int FLAG_ACTIVITY_SINGLE_TOP = 0x20000000; 2922 /** 2923 * If set, this activity will become the start of a new task on this 2924 * history stack. A task (from the activity that started it to the 2925 * next task activity) defines an atomic group of activities that the 2926 * user can move to. Tasks can be moved to the foreground and background; 2927 * all of the activities inside of a particular task always remain in 2928 * the same order. See 2929 * <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back 2930 * Stack</a> for more information about tasks. 2931 * 2932 * <p>This flag is generally used by activities that want 2933 * to present a "launcher" style behavior: they give the user a list of 2934 * separate things that can be done, which otherwise run completely 2935 * independently of the activity launching them. 2936 * 2937 * <p>When using this flag, if a task is already running for the activity 2938 * you are now starting, then a new activity will not be started; instead, 2939 * the current task will simply be brought to the front of the screen with 2940 * the state it was last in. See {@link #FLAG_ACTIVITY_MULTIPLE_TASK} for a flag 2941 * to disable this behavior. 2942 * 2943 * <p>This flag can not be used when the caller is requesting a result from 2944 * the activity being launched. 2945 */ 2946 public static final int FLAG_ACTIVITY_NEW_TASK = 0x10000000; 2947 /** 2948 * <strong>Do not use this flag unless you are implementing your own 2949 * top-level application launcher.</strong> Used in conjunction with 2950 * {@link #FLAG_ACTIVITY_NEW_TASK} to disable the 2951 * behavior of bringing an existing task to the foreground. When set, 2952 * a new task is <em>always</em> started to host the Activity for the 2953 * Intent, regardless of whether there is already an existing task running 2954 * the same thing. 2955 * 2956 * <p><strong>Because the default system does not include graphical task management, 2957 * you should not use this flag unless you provide some way for a user to 2958 * return back to the tasks you have launched.</strong> 2959 * 2960 * <p>This flag is ignored if 2961 * {@link #FLAG_ACTIVITY_NEW_TASK} is not set. 2962 * 2963 * <p>See 2964 * <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back 2965 * Stack</a> for more information about tasks. 2966 */ 2967 public static final int FLAG_ACTIVITY_MULTIPLE_TASK = 0x08000000; 2968 /** 2969 * If set, and the activity being launched is already running in the 2970 * current task, then instead of launching a new instance of that activity, 2971 * all of the other activities on top of it will be closed and this Intent 2972 * will be delivered to the (now on top) old activity as a new Intent. 2973 * 2974 * <p>For example, consider a task consisting of the activities: A, B, C, D. 2975 * If D calls startActivity() with an Intent that resolves to the component 2976 * of activity B, then C and D will be finished and B receive the given 2977 * Intent, resulting in the stack now being: A, B. 2978 * 2979 * <p>The currently running instance of activity B in the above example will 2980 * either receive the new intent you are starting here in its 2981 * onNewIntent() method, or be itself finished and restarted with the 2982 * new intent. If it has declared its launch mode to be "multiple" (the 2983 * default) and you have not set {@link #FLAG_ACTIVITY_SINGLE_TOP} in 2984 * the same intent, then it will be finished and re-created; for all other 2985 * launch modes or if {@link #FLAG_ACTIVITY_SINGLE_TOP} is set then this 2986 * Intent will be delivered to the current instance's onNewIntent(). 2987 * 2988 * <p>This launch mode can also be used to good effect in conjunction with 2989 * {@link #FLAG_ACTIVITY_NEW_TASK}: if used to start the root activity 2990 * of a task, it will bring any currently running instance of that task 2991 * to the foreground, and then clear it to its root state. This is 2992 * especially useful, for example, when launching an activity from the 2993 * notification manager. 2994 * 2995 * <p>See 2996 * <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back 2997 * Stack</a> for more information about tasks. 2998 */ 2999 public static final int FLAG_ACTIVITY_CLEAR_TOP = 0x04000000; 3000 /** 3001 * If set and this intent is being used to launch a new activity from an 3002 * existing one, then the reply target of the existing activity will be 3003 * transfered to the new activity. This way the new activity can call 3004 * {@link android.app.Activity#setResult} and have that result sent back to 3005 * the reply target of the original activity. 3006 */ 3007 public static final int FLAG_ACTIVITY_FORWARD_RESULT = 0x02000000; 3008 /** 3009 * If set and this intent is being used to launch a new activity from an 3010 * existing one, the current activity will not be counted as the top 3011 * activity for deciding whether the new intent should be delivered to 3012 * the top instead of starting a new one. The previous activity will 3013 * be used as the top, with the assumption being that the current activity 3014 * will finish itself immediately. 3015 */ 3016 public static final int FLAG_ACTIVITY_PREVIOUS_IS_TOP = 0x01000000; 3017 /** 3018 * If set, the new activity is not kept in the list of recently launched 3019 * activities. 3020 */ 3021 public static final int FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS = 0x00800000; 3022 /** 3023 * This flag is not normally set by application code, but set for you by 3024 * the system as described in the 3025 * {@link android.R.styleable#AndroidManifestActivity_launchMode 3026 * launchMode} documentation for the singleTask mode. 3027 */ 3028 public static final int FLAG_ACTIVITY_BROUGHT_TO_FRONT = 0x00400000; 3029 /** 3030 * If set, and this activity is either being started in a new task or 3031 * bringing to the top an existing task, then it will be launched as 3032 * the front door of the task. This will result in the application of 3033 * any affinities needed to have that task in the proper state (either 3034 * moving activities to or from it), or simply resetting that task to 3035 * its initial state if needed. 3036 */ 3037 public static final int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED = 0x00200000; 3038 /** 3039 * This flag is not normally set by application code, but set for you by 3040 * the system if this activity is being launched from history 3041 * (longpress home key). 3042 */ 3043 public static final int FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY = 0x00100000; 3044 /** 3045 * If set, this marks a point in the task's activity stack that should 3046 * be cleared when the task is reset. That is, the next time the task 3047 * is brought to the foreground with 3048 * {@link #FLAG_ACTIVITY_RESET_TASK_IF_NEEDED} (typically as a result of 3049 * the user re-launching it from home), this activity and all on top of 3050 * it will be finished so that the user does not return to them, but 3051 * instead returns to whatever activity preceeded it. 3052 * 3053 * <p>This is useful for cases where you have a logical break in your 3054 * application. For example, an e-mail application may have a command 3055 * to view an attachment, which launches an image view activity to 3056 * display it. This activity should be part of the e-mail application's 3057 * task, since it is a part of the task the user is involved in. However, 3058 * if the user leaves that task, and later selects the e-mail app from 3059 * home, we may like them to return to the conversation they were 3060 * viewing, not the picture attachment, since that is confusing. By 3061 * setting this flag when launching the image viewer, that viewer and 3062 * any activities it starts will be removed the next time the user returns 3063 * to mail. 3064 */ 3065 public static final int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET = 0x00080000; 3066 /** 3067 * If set, this flag will prevent the normal {@link android.app.Activity#onUserLeaveHint} 3068 * callback from occurring on the current frontmost activity before it is 3069 * paused as the newly-started activity is brought to the front. 3070 * 3071 * <p>Typically, an activity can rely on that callback to indicate that an 3072 * explicit user action has caused their activity to be moved out of the 3073 * foreground. The callback marks an appropriate point in the activity's 3074 * lifecycle for it to dismiss any notifications that it intends to display 3075 * "until the user has seen them," such as a blinking LED. 3076 * 3077 * <p>If an activity is ever started via any non-user-driven events such as 3078 * phone-call receipt or an alarm handler, this flag should be passed to {@link 3079 * Context#startActivity Context.startActivity}, ensuring that the pausing 3080 * activity does not think the user has acknowledged its notification. 3081 */ 3082 public static final int FLAG_ACTIVITY_NO_USER_ACTION = 0x00040000; 3083 /** 3084 * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, 3085 * this flag will cause the launched activity to be brought to the front of its 3086 * task's history stack if it is already running. 3087 * 3088 * <p>For example, consider a task consisting of four activities: A, B, C, D. 3089 * If D calls startActivity() with an Intent that resolves to the component 3090 * of activity B, then B will be brought to the front of the history stack, 3091 * with this resulting order: A, C, D, B. 3092 * 3093 * This flag will be ignored if {@link #FLAG_ACTIVITY_CLEAR_TOP} is also 3094 * specified. 3095 */ 3096 public static final int FLAG_ACTIVITY_REORDER_TO_FRONT = 0X00020000; 3097 /** 3098 * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, 3099 * this flag will prevent the system from applying an activity transition 3100 * animation to go to the next activity state. This doesn't mean an 3101 * animation will never run -- if another activity change happens that doesn't 3102 * specify this flag before the activity started here is displayed, then 3103 * that transition will be used. This flag can be put to good use 3104 * when you are going to do a series of activity operations but the 3105 * animation seen by the user shouldn't be driven by the first activity 3106 * change but rather a later one. 3107 */ 3108 public static final int FLAG_ACTIVITY_NO_ANIMATION = 0X00010000; 3109 /** 3110 * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, 3111 * this flag will cause any existing task that would be associated with the 3112 * activity to be cleared before the activity is started. That is, the activity 3113 * becomes the new root of an otherwise empty task, and any old activities 3114 * are finished. This can only be used in conjunction with {@link #FLAG_ACTIVITY_NEW_TASK}. 3115 */ 3116 public static final int FLAG_ACTIVITY_CLEAR_TASK = 0X00008000; 3117 /** 3118 * If set in an Intent passed to {@link Context#startActivity Context.startActivity()}, 3119 * this flag will cause a newly launching task to be placed on top of the current 3120 * home activity task (if there is one). That is, pressing back from the task 3121 * will always return the user to home even if that was not the last activity they 3122 * saw. This can only be used in conjunction with {@link #FLAG_ACTIVITY_NEW_TASK}. 3123 */ 3124 public static final int FLAG_ACTIVITY_TASK_ON_HOME = 0X00004000; 3125 /** 3126 * If set, when sending a broadcast only registered receivers will be 3127 * called -- no BroadcastReceiver components will be launched. 3128 */ 3129 public static final int FLAG_RECEIVER_REGISTERED_ONLY = 0x40000000; 3130 /** 3131 * If set, when sending a broadcast the new broadcast will replace 3132 * any existing pending broadcast that matches it. Matching is defined 3133 * by {@link Intent#filterEquals(Intent) Intent.filterEquals} returning 3134 * true for the intents of the two broadcasts. When a match is found, 3135 * the new broadcast (and receivers associated with it) will replace the 3136 * existing one in the pending broadcast list, remaining at the same 3137 * position in the list. 3138 * 3139 * <p>This flag is most typically used with sticky broadcasts, which 3140 * only care about delivering the most recent values of the broadcast 3141 * to their receivers. 3142 */ 3143 public static final int FLAG_RECEIVER_REPLACE_PENDING = 0x20000000; 3144 /** 3145 * If set, when sending a broadcast the recipient is allowed to run at 3146 * foreground priority, with a shorter timeout interval. During normal 3147 * broadcasts the receivers are not automatically hoisted out of the 3148 * background priority class. 3149 */ 3150 public static final int FLAG_RECEIVER_FOREGROUND = 0x10000000; 3151 /** 3152 * If set, when sending a broadcast <i>before boot has completed</i> only 3153 * registered receivers will be called -- no BroadcastReceiver components 3154 * will be launched. Sticky intent state will be recorded properly even 3155 * if no receivers wind up being called. If {@link #FLAG_RECEIVER_REGISTERED_ONLY} 3156 * is specified in the broadcast intent, this flag is unnecessary. 3157 * 3158 * <p>This flag is only for use by system sevices as a convenience to 3159 * avoid having to implement a more complex mechanism around detection 3160 * of boot completion. 3161 * 3162 * @hide 3163 */ 3164 public static final int FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT = 0x08000000; 3165 /** 3166 * Set when this broadcast is for a boot upgrade, a special mode that 3167 * allows the broadcast to be sent before the system is ready and launches 3168 * the app process with no providers running in it. 3169 * @hide 3170 */ 3171 public static final int FLAG_RECEIVER_BOOT_UPGRADE = 0x04000000; 3172 3173 /** 3174 * @hide Flags that can't be changed with PendingIntent. 3175 */ 3176 public static final int IMMUTABLE_FLAGS = 3177 FLAG_GRANT_READ_URI_PERMISSION 3178 | FLAG_GRANT_WRITE_URI_PERMISSION; 3179 3180 // --------------------------------------------------------------------- 3181 // --------------------------------------------------------------------- 3182 // toUri() and parseUri() options. 3183 3184 /** 3185 * Flag for use with {@link #toUri} and {@link #parseUri}: the URI string 3186 * always has the "intent:" scheme. This syntax can be used when you want 3187 * to later disambiguate between URIs that are intended to describe an 3188 * Intent vs. all others that should be treated as raw URIs. When used 3189 * with {@link #parseUri}, any other scheme will result in a generic 3190 * VIEW action for that raw URI. 3191 */ 3192 public static final int URI_INTENT_SCHEME = 1<<0; 3193 3194 // --------------------------------------------------------------------- 3195 3196 private String mAction; 3197 private Uri mData; 3198 private String mType; 3199 private String mPackage; 3200 private ComponentName mComponent; 3201 private int mFlags; 3202 private HashSet<String> mCategories; 3203 private Bundle mExtras; 3204 private Rect mSourceBounds; 3205 private Intent mSelector; 3206 private ClipData mClipData; 3207 3208 // --------------------------------------------------------------------- 3209 3210 /** 3211 * Create an empty intent. 3212 */ 3213 public Intent() { 3214 } 3215 3216 /** 3217 * Copy constructor. 3218 */ 3219 public Intent(Intent o) { 3220 this.mAction = o.mAction; 3221 this.mData = o.mData; 3222 this.mType = o.mType; 3223 this.mPackage = o.mPackage; 3224 this.mComponent = o.mComponent; 3225 this.mFlags = o.mFlags; 3226 if (o.mCategories != null) { 3227 this.mCategories = new HashSet<String>(o.mCategories); 3228 } 3229 if (o.mExtras != null) { 3230 this.mExtras = new Bundle(o.mExtras); 3231 } 3232 if (o.mSourceBounds != null) { 3233 this.mSourceBounds = new Rect(o.mSourceBounds); 3234 } 3235 if (o.mSelector != null) { 3236 this.mSelector = new Intent(o.mSelector); 3237 } 3238 if (o.mClipData != null) { 3239 this.mClipData = new ClipData(o.mClipData); 3240 } 3241 } 3242 3243 @Override 3244 public Object clone() { 3245 return new Intent(this); 3246 } 3247 3248 private Intent(Intent o, boolean all) { 3249 this.mAction = o.mAction; 3250 this.mData = o.mData; 3251 this.mType = o.mType; 3252 this.mPackage = o.mPackage; 3253 this.mComponent = o.mComponent; 3254 if (o.mCategories != null) { 3255 this.mCategories = new HashSet<String>(o.mCategories); 3256 } 3257 } 3258 3259 /** 3260 * Make a clone of only the parts of the Intent that are relevant for 3261 * filter matching: the action, data, type, component, and categories. 3262 */ 3263 public Intent cloneFilter() { 3264 return new Intent(this, false); 3265 } 3266 3267 /** 3268 * Create an intent with a given action. All other fields (data, type, 3269 * class) are null. Note that the action <em>must</em> be in a 3270 * namespace because Intents are used globally in the system -- for 3271 * example the system VIEW action is android.intent.action.VIEW; an 3272 * application's custom action would be something like 3273 * com.google.app.myapp.CUSTOM_ACTION. 3274 * 3275 * @param action The Intent action, such as ACTION_VIEW. 3276 */ 3277 public Intent(String action) { 3278 setAction(action); 3279 } 3280 3281 /** 3282 * Create an intent with a given action and for a given data url. Note 3283 * that the action <em>must</em> be in a namespace because Intents are 3284 * used globally in the system -- for example the system VIEW action is 3285 * android.intent.action.VIEW; an application's custom action would be 3286 * something like com.google.app.myapp.CUSTOM_ACTION. 3287 * 3288 * <p><em>Note: scheme and host name matching in the Android framework is 3289 * case-sensitive, unlike the formal RFC. As a result, 3290 * you should always ensure that you write your Uri with these elements 3291 * using lower case letters, and normalize any Uris you receive from 3292 * outside of Android to ensure the scheme and host is lower case.</em></p> 3293 * 3294 * @param action The Intent action, such as ACTION_VIEW. 3295 * @param uri The Intent data URI. 3296 */ 3297 public Intent(String action, Uri uri) { 3298 setAction(action); 3299 mData = uri; 3300 } 3301 3302 /** 3303 * Create an intent for a specific component. All other fields (action, data, 3304 * type, class) are null, though they can be modified later with explicit 3305 * calls. This provides a convenient way to create an intent that is 3306 * intended to execute a hard-coded class name, rather than relying on the 3307 * system to find an appropriate class for you; see {@link #setComponent} 3308 * for more information on the repercussions of this. 3309 * 3310 * @param packageContext A Context of the application package implementing 3311 * this class. 3312 * @param cls The component class that is to be used for the intent. 3313 * 3314 * @see #setClass 3315 * @see #setComponent 3316 * @see #Intent(String, android.net.Uri , Context, Class) 3317 */ 3318 public Intent(Context packageContext, Class<?> cls) { 3319 mComponent = new ComponentName(packageContext, cls); 3320 } 3321 3322 /** 3323 * Create an intent for a specific component with a specified action and data. 3324 * This is equivalent using {@link #Intent(String, android.net.Uri)} to 3325 * construct the Intent and then calling {@link #setClass} to set its 3326 * class. 3327 * 3328 * <p><em>Note: scheme and host name matching in the Android framework is 3329 * case-sensitive, unlike the formal RFC. As a result, 3330 * you should always ensure that you write your Uri with these elements 3331 * using lower case letters, and normalize any Uris you receive from 3332 * outside of Android to ensure the scheme and host is lower case.</em></p> 3333 * 3334 * @param action The Intent action, such as ACTION_VIEW. 3335 * @param uri The Intent data URI. 3336 * @param packageContext A Context of the application package implementing 3337 * this class. 3338 * @param cls The component class that is to be used for the intent. 3339 * 3340 * @see #Intent(String, android.net.Uri) 3341 * @see #Intent(Context, Class) 3342 * @see #setClass 3343 * @see #setComponent 3344 */ 3345 public Intent(String action, Uri uri, 3346 Context packageContext, Class<?> cls) { 3347 setAction(action); 3348 mData = uri; 3349 mComponent = new ComponentName(packageContext, cls); 3350 } 3351 3352 /** 3353 * Create an intent to launch the main (root) activity of a task. This 3354 * is the Intent that is started when the application's is launched from 3355 * Home. For anything else that wants to launch an application in the 3356 * same way, it is important that they use an Intent structured the same 3357 * way, and can use this function to ensure this is the case. 3358 * 3359 * <p>The returned Intent has the given Activity component as its explicit 3360 * component, {@link #ACTION_MAIN} as its action, and includes the 3361 * category {@link #CATEGORY_LAUNCHER}. This does <em>not</em> have 3362 * {@link #FLAG_ACTIVITY_NEW_TASK} set, though typically you will want 3363 * to do that through {@link #addFlags(int)} on the returned Intent. 3364 * 3365 * @param mainActivity The main activity component that this Intent will 3366 * launch. 3367 * @return Returns a newly created Intent that can be used to launch the 3368 * activity as a main application entry. 3369 * 3370 * @see #setClass 3371 * @see #setComponent 3372 */ 3373 public static Intent makeMainActivity(ComponentName mainActivity) { 3374 Intent intent = new Intent(ACTION_MAIN); 3375 intent.setComponent(mainActivity); 3376 intent.addCategory(CATEGORY_LAUNCHER); 3377 return intent; 3378 } 3379 3380 /** 3381 * Make an Intent for the main activity of an application, without 3382 * specifying a specific activity to run but giving a selector to find 3383 * the activity. This results in a final Intent that is structured 3384 * the same as when the application is launched from 3385 * Home. For anything else that wants to launch an application in the 3386 * same way, it is important that they use an Intent structured the same 3387 * way, and can use this function to ensure this is the case. 3388 * 3389 * <p>The returned Intent has {@link #ACTION_MAIN} as its action, and includes the 3390 * category {@link #CATEGORY_LAUNCHER}. This does <em>not</em> have 3391 * {@link #FLAG_ACTIVITY_NEW_TASK} set, though typically you will want 3392 * to do that through {@link #addFlags(int)} on the returned Intent. 3393 * 3394 * @param selectorAction The action name of the Intent's selector. 3395 * @param selectorCategory The name of a category to add to the Intent's 3396 * selector. 3397 * @return Returns a newly created Intent that can be used to launch the 3398 * activity as a main application entry. 3399 * 3400 * @see #setSelector(Intent) 3401 */ 3402 public static Intent makeMainSelectorActivity(String selectorAction, 3403 String selectorCategory) { 3404 Intent intent = new Intent(ACTION_MAIN); 3405 intent.addCategory(CATEGORY_LAUNCHER); 3406 Intent selector = new Intent(); 3407 selector.setAction(selectorAction); 3408 selector.addCategory(selectorCategory); 3409 intent.setSelector(selector); 3410 return intent; 3411 } 3412 3413 /** 3414 * Make an Intent that can be used to re-launch an application's task 3415 * in its base state. This is like {@link #makeMainActivity(ComponentName)}, 3416 * but also sets the flags {@link #FLAG_ACTIVITY_NEW_TASK} and 3417 * {@link #FLAG_ACTIVITY_CLEAR_TASK}. 3418 * 3419 * @param mainActivity The activity component that is the root of the 3420 * task; this is the activity that has been published in the application's 3421 * manifest as the main launcher icon. 3422 * 3423 * @return Returns a newly created Intent that can be used to relaunch the 3424 * activity's task in its root state. 3425 */ 3426 public static Intent makeRestartActivityTask(ComponentName mainActivity) { 3427 Intent intent = makeMainActivity(mainActivity); 3428 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK 3429 | Intent.FLAG_ACTIVITY_CLEAR_TASK); 3430 return intent; 3431 } 3432 3433 /** 3434 * Call {@link #parseUri} with 0 flags. 3435 * @deprecated Use {@link #parseUri} instead. 3436 */ 3437 @Deprecated 3438 public static Intent getIntent(String uri) throws URISyntaxException { 3439 return parseUri(uri, 0); 3440 } 3441 3442 /** 3443 * Create an intent from a URI. This URI may encode the action, 3444 * category, and other intent fields, if it was returned by 3445 * {@link #toUri}. If the Intent was not generate by toUri(), its data 3446 * will be the entire URI and its action will be ACTION_VIEW. 3447 * 3448 * <p>The URI given here must not be relative -- that is, it must include 3449 * the scheme and full path. 3450 * 3451 * @param uri The URI to turn into an Intent. 3452 * @param flags Additional processing flags. Either 0 or 3453 * {@link #URI_INTENT_SCHEME}. 3454 * 3455 * @return Intent The newly created Intent object. 3456 * 3457 * @throws URISyntaxException Throws URISyntaxError if the basic URI syntax 3458 * it bad (as parsed by the Uri class) or the Intent data within the 3459 * URI is invalid. 3460 * 3461 * @see #toUri 3462 */ 3463 public static Intent parseUri(String uri, int flags) throws URISyntaxException { 3464 int i = 0; 3465 try { 3466 // Validate intent scheme for if requested. 3467 if ((flags&URI_INTENT_SCHEME) != 0) { 3468 if (!uri.startsWith("intent:")) { 3469 Intent intent = new Intent(ACTION_VIEW); 3470 try { 3471 intent.setData(Uri.parse(uri)); 3472 } catch (IllegalArgumentException e) { 3473 throw new URISyntaxException(uri, e.getMessage()); 3474 } 3475 return intent; 3476 } 3477 } 3478 3479 // simple case 3480 i = uri.lastIndexOf("#"); 3481 if (i == -1) return new Intent(ACTION_VIEW, Uri.parse(uri)); 3482 3483 // old format Intent URI 3484 if (!uri.startsWith("#Intent;", i)) return getIntentOld(uri); 3485 3486 // new format 3487 Intent intent = new Intent(ACTION_VIEW); 3488 Intent baseIntent = intent; 3489 3490 // fetch data part, if present 3491 String data = i >= 0 ? uri.substring(0, i) : null; 3492 String scheme = null; 3493 i += "#Intent;".length(); 3494 3495 // loop over contents of Intent, all name=value; 3496 while (!uri.startsWith("end", i)) { 3497 int eq = uri.indexOf('=', i); 3498 if (eq < 0) eq = i-1; 3499 int semi = uri.indexOf(';', i); 3500 String value = eq < semi ? Uri.decode(uri.substring(eq + 1, semi)) : ""; 3501 3502 // action 3503 if (uri.startsWith("action=", i)) { 3504 intent.setAction(value); 3505 } 3506 3507 // categories 3508 else if (uri.startsWith("category=", i)) { 3509 intent.addCategory(value); 3510 } 3511 3512 // type 3513 else if (uri.startsWith("type=", i)) { 3514 intent.mType = value; 3515 } 3516 3517 // launch flags 3518 else if (uri.startsWith("launchFlags=", i)) { 3519 intent.mFlags = Integer.decode(value).intValue(); 3520 } 3521 3522 // package 3523 else if (uri.startsWith("package=", i)) { 3524 intent.mPackage = value; 3525 } 3526 3527 // component 3528 else if (uri.startsWith("component=", i)) { 3529 intent.mComponent = ComponentName.unflattenFromString(value); 3530 } 3531 3532 // scheme 3533 else if (uri.startsWith("scheme=", i)) { 3534 scheme = value; 3535 } 3536 3537 // source bounds 3538 else if (uri.startsWith("sourceBounds=", i)) { 3539 intent.mSourceBounds = Rect.unflattenFromString(value); 3540 } 3541 3542 // selector 3543 else if (semi == (i+3) && uri.startsWith("SEL", i)) { 3544 intent = new Intent(); 3545 } 3546 3547 // extra 3548 else { 3549 String key = Uri.decode(uri.substring(i + 2, eq)); 3550 // create Bundle if it doesn't already exist 3551 if (intent.mExtras == null) intent.mExtras = new Bundle(); 3552 Bundle b = intent.mExtras; 3553 // add EXTRA 3554 if (uri.startsWith("S.", i)) b.putString(key, value); 3555 else if (uri.startsWith("B.", i)) b.putBoolean(key, Boolean.parseBoolean(value)); 3556 else if (uri.startsWith("b.", i)) b.putByte(key, Byte.parseByte(value)); 3557 else if (uri.startsWith("c.", i)) b.putChar(key, value.charAt(0)); 3558 else if (uri.startsWith("d.", i)) b.putDouble(key, Double.parseDouble(value)); 3559 else if (uri.startsWith("f.", i)) b.putFloat(key, Float.parseFloat(value)); 3560 else if (uri.startsWith("i.", i)) b.putInt(key, Integer.parseInt(value)); 3561 else if (uri.startsWith("l.", i)) b.putLong(key, Long.parseLong(value)); 3562 else if (uri.startsWith("s.", i)) b.putShort(key, Short.parseShort(value)); 3563 else throw new URISyntaxException(uri, "unknown EXTRA type", i); 3564 } 3565 3566 // move to the next item 3567 i = semi + 1; 3568 } 3569 3570 if (intent != baseIntent) { 3571 // The Intent had a selector; fix it up. 3572 baseIntent.setSelector(intent); 3573 intent = baseIntent; 3574 } 3575 3576 if (data != null) { 3577 if (data.startsWith("intent:")) { 3578 data = data.substring(7); 3579 if (scheme != null) { 3580 data = scheme + ':' + data; 3581 } 3582 } 3583 3584 if (data.length() > 0) { 3585 try { 3586 intent.mData = Uri.parse(data); 3587 } catch (IllegalArgumentException e) { 3588 throw new URISyntaxException(uri, e.getMessage()); 3589 } 3590 } 3591 } 3592 3593 return intent; 3594 3595 } catch (IndexOutOfBoundsException e) { 3596 throw new URISyntaxException(uri, "illegal Intent URI format", i); 3597 } 3598 } 3599 3600 public static Intent getIntentOld(String uri) throws URISyntaxException { 3601 Intent intent; 3602 3603 int i = uri.lastIndexOf('#'); 3604 if (i >= 0) { 3605 String action = null; 3606 final int intentFragmentStart = i; 3607 boolean isIntentFragment = false; 3608 3609 i++; 3610 3611 if (uri.regionMatches(i, "action(", 0, 7)) { 3612 isIntentFragment = true; 3613 i += 7; 3614 int j = uri.indexOf(')', i); 3615 action = uri.substring(i, j); 3616 i = j + 1; 3617 } 3618 3619 intent = new Intent(action); 3620 3621 if (uri.regionMatches(i, "categories(", 0, 11)) { 3622 isIntentFragment = true; 3623 i += 11; 3624 int j = uri.indexOf(')', i); 3625 while (i < j) { 3626 int sep = uri.indexOf('!', i); 3627 if (sep < 0) sep = j; 3628 if (i < sep) { 3629 intent.addCategory(uri.substring(i, sep)); 3630 } 3631 i = sep + 1; 3632 } 3633 i = j + 1; 3634 } 3635 3636 if (uri.regionMatches(i, "type(", 0, 5)) { 3637 isIntentFragment = true; 3638 i += 5; 3639 int j = uri.indexOf(')', i); 3640 intent.mType = uri.substring(i, j); 3641 i = j + 1; 3642 } 3643 3644 if (uri.regionMatches(i, "launchFlags(", 0, 12)) { 3645 isIntentFragment = true; 3646 i += 12; 3647 int j = uri.indexOf(')', i); 3648 intent.mFlags = Integer.decode(uri.substring(i, j)).intValue(); 3649 i = j + 1; 3650 } 3651 3652 if (uri.regionMatches(i, "component(", 0, 10)) { 3653 isIntentFragment = true; 3654 i += 10; 3655 int j = uri.indexOf(')', i); 3656 int sep = uri.indexOf('!', i); 3657 if (sep >= 0 && sep < j) { 3658 String pkg = uri.substring(i, sep); 3659 String cls = uri.substring(sep + 1, j); 3660 intent.mComponent = new ComponentName(pkg, cls); 3661 } 3662 i = j + 1; 3663 } 3664 3665 if (uri.regionMatches(i, "extras(", 0, 7)) { 3666 isIntentFragment = true; 3667 i += 7; 3668 3669 final int closeParen = uri.indexOf(')', i); 3670 if (closeParen == -1) throw new URISyntaxException(uri, 3671 "EXTRA missing trailing ')'", i); 3672 3673 while (i < closeParen) { 3674 // fetch the key value 3675 int j = uri.indexOf('=', i); 3676 if (j <= i + 1 || i >= closeParen) { 3677 throw new URISyntaxException(uri, "EXTRA missing '='", i); 3678 } 3679 char type = uri.charAt(i); 3680 i++; 3681 String key = uri.substring(i, j); 3682 i = j + 1; 3683 3684 // get type-value 3685 j = uri.indexOf('!', i); 3686 if (j == -1 || j >= closeParen) j = closeParen; 3687 if (i >= j) throw new URISyntaxException(uri, "EXTRA missing '!'", i); 3688 String value = uri.substring(i, j); 3689 i = j; 3690 3691 // create Bundle if it doesn't already exist 3692 if (intent.mExtras == null) intent.mExtras = new Bundle(); 3693 3694 // add item to bundle 3695 try { 3696 switch (type) { 3697 case 'S': 3698 intent.mExtras.putString(key, Uri.decode(value)); 3699 break; 3700 case 'B': 3701 intent.mExtras.putBoolean(key, Boolean.parseBoolean(value)); 3702 break; 3703 case 'b': 3704 intent.mExtras.putByte(key, Byte.parseByte(value)); 3705 break; 3706 case 'c': 3707 intent.mExtras.putChar(key, Uri.decode(value).charAt(0)); 3708 break; 3709 case 'd': 3710 intent.mExtras.putDouble(key, Double.parseDouble(value)); 3711 break; 3712 case 'f': 3713 intent.mExtras.putFloat(key, Float.parseFloat(value)); 3714 break; 3715 case 'i': 3716 intent.mExtras.putInt(key, Integer.parseInt(value)); 3717 break; 3718 case 'l': 3719 intent.mExtras.putLong(key, Long.parseLong(value)); 3720 break; 3721 case 's': 3722 intent.mExtras.putShort(key, Short.parseShort(value)); 3723 break; 3724 default: 3725 throw new URISyntaxException(uri, "EXTRA has unknown type", i); 3726 } 3727 } catch (NumberFormatException e) { 3728 throw new URISyntaxException(uri, "EXTRA value can't be parsed", i); 3729 } 3730 3731 char ch = uri.charAt(i); 3732 if (ch == ')') break; 3733 if (ch != '!') throw new URISyntaxException(uri, "EXTRA missing '!'", i); 3734 i++; 3735 } 3736 } 3737 3738 if (isIntentFragment) { 3739 intent.mData = Uri.parse(uri.substring(0, intentFragmentStart)); 3740 } else { 3741 intent.mData = Uri.parse(uri); 3742 } 3743 3744 if (intent.mAction == null) { 3745 // By default, if no action is specified, then use VIEW. 3746 intent.mAction = ACTION_VIEW; 3747 } 3748 3749 } else { 3750 intent = new Intent(ACTION_VIEW, Uri.parse(uri)); 3751 } 3752 3753 return intent; 3754 } 3755 3756 /** 3757 * Retrieve the general action to be performed, such as 3758 * {@link #ACTION_VIEW}. The action describes the general way the rest of 3759 * the information in the intent should be interpreted -- most importantly, 3760 * what to do with the data returned by {@link #getData}. 3761 * 3762 * @return The action of this intent or null if none is specified. 3763 * 3764 * @see #setAction 3765 */ 3766 public String getAction() { 3767 return mAction; 3768 } 3769 3770 /** 3771 * Retrieve data this intent is operating on. This URI specifies the name 3772 * of the data; often it uses the content: scheme, specifying data in a 3773 * content provider. Other schemes may be handled by specific activities, 3774 * such as http: by the web browser. 3775 * 3776 * @return The URI of the data this intent is targeting or null. 3777 * 3778 * @see #getScheme 3779 * @see #setData 3780 */ 3781 public Uri getData() { 3782 return mData; 3783 } 3784 3785 /** 3786 * The same as {@link #getData()}, but returns the URI as an encoded 3787 * String. 3788 */ 3789 public String getDataString() { 3790 return mData != null ? mData.toString() : null; 3791 } 3792 3793 /** 3794 * Return the scheme portion of the intent's data. If the data is null or 3795 * does not include a scheme, null is returned. Otherwise, the scheme 3796 * prefix without the final ':' is returned, i.e. "http". 3797 * 3798 * <p>This is the same as calling getData().getScheme() (and checking for 3799 * null data). 3800 * 3801 * @return The scheme of this intent. 3802 * 3803 * @see #getData 3804 */ 3805 public String getScheme() { 3806 return mData != null ? mData.getScheme() : null; 3807 } 3808 3809 /** 3810 * Retrieve any explicit MIME type included in the intent. This is usually 3811 * null, as the type is determined by the intent data. 3812 * 3813 * @return If a type was manually set, it is returned; else null is 3814 * returned. 3815 * 3816 * @see #resolveType(ContentResolver) 3817 * @see #setType 3818 */ 3819 public String getType() { 3820 return mType; 3821 } 3822 3823 /** 3824 * Return the MIME data type of this intent. If the type field is 3825 * explicitly set, that is simply returned. Otherwise, if the data is set, 3826 * the type of that data is returned. If neither fields are set, a null is 3827 * returned. 3828 * 3829 * @return The MIME type of this intent. 3830 * 3831 * @see #getType 3832 * @see #resolveType(ContentResolver) 3833 */ 3834 public String resolveType(Context context) { 3835 return resolveType(context.getContentResolver()); 3836 } 3837 3838 /** 3839 * Return the MIME data type of this intent. If the type field is 3840 * explicitly set, that is simply returned. Otherwise, if the data is set, 3841 * the type of that data is returned. If neither fields are set, a null is 3842 * returned. 3843 * 3844 * @param resolver A ContentResolver that can be used to determine the MIME 3845 * type of the intent's data. 3846 * 3847 * @return The MIME type of this intent. 3848 * 3849 * @see #getType 3850 * @see #resolveType(Context) 3851 */ 3852 public String resolveType(ContentResolver resolver) { 3853 if (mType != null) { 3854 return mType; 3855 } 3856 if (mData != null) { 3857 if ("content".equals(mData.getScheme())) { 3858 return resolver.getType(mData); 3859 } 3860 } 3861 return null; 3862 } 3863 3864 /** 3865 * Return the MIME data type of this intent, only if it will be needed for 3866 * intent resolution. This is not generally useful for application code; 3867 * it is used by the frameworks for communicating with back-end system 3868 * services. 3869 * 3870 * @param resolver A ContentResolver that can be used to determine the MIME 3871 * type of the intent's data. 3872 * 3873 * @return The MIME type of this intent, or null if it is unknown or not 3874 * needed. 3875 */ 3876 public String resolveTypeIfNeeded(ContentResolver resolver) { 3877 if (mComponent != null) { 3878 return mType; 3879 } 3880 return resolveType(resolver); 3881 } 3882 3883 /** 3884 * Check if a category exists in the intent. 3885 * 3886 * @param category The category to check. 3887 * 3888 * @return boolean True if the intent contains the category, else false. 3889 * 3890 * @see #getCategories 3891 * @see #addCategory 3892 */ 3893 public boolean hasCategory(String category) { 3894 return mCategories != null && mCategories.contains(category); 3895 } 3896 3897 /** 3898 * Return the set of all categories in the intent. If there are no categories, 3899 * returns NULL. 3900 * 3901 * @return The set of categories you can examine. Do not modify! 3902 * 3903 * @see #hasCategory 3904 * @see #addCategory 3905 */ 3906 public Set<String> getCategories() { 3907 return mCategories; 3908 } 3909 3910 /** 3911 * Return the specific selector associated with this Intent. If there is 3912 * none, returns null. See {@link #setSelector} for more information. 3913 * 3914 * @see #setSelector 3915 */ 3916 public Intent getSelector() { 3917 return mSelector; 3918 } 3919 3920 /** 3921 * Return the {@link ClipData} associated with this Intent. If there is 3922 * none, returns null. See {@link #setClipData} for more information. 3923 * 3924 * @see #setClipData; 3925 */ 3926 public ClipData getClipData() { 3927 return mClipData; 3928 } 3929 3930 /** 3931 * Sets the ClassLoader that will be used when unmarshalling 3932 * any Parcelable values from the extras of this Intent. 3933 * 3934 * @param loader a ClassLoader, or null to use the default loader 3935 * at the time of unmarshalling. 3936 */ 3937 public void setExtrasClassLoader(ClassLoader loader) { 3938 if (mExtras != null) { 3939 mExtras.setClassLoader(loader); 3940 } 3941 } 3942 3943 /** 3944 * Returns true if an extra value is associated with the given name. 3945 * @param name the extra's name 3946 * @return true if the given extra is present. 3947 */ 3948 public boolean hasExtra(String name) { 3949 return mExtras != null && mExtras.containsKey(name); 3950 } 3951 3952 /** 3953 * Returns true if the Intent's extras contain a parcelled file descriptor. 3954 * @return true if the Intent contains a parcelled file descriptor. 3955 */ 3956 public boolean hasFileDescriptors() { 3957 return mExtras != null && mExtras.hasFileDescriptors(); 3958 } 3959 3960 /** @hide */ 3961 public void setAllowFds(boolean allowFds) { 3962 if (mExtras != null) { 3963 mExtras.setAllowFds(allowFds); 3964 } 3965 } 3966 3967 /** 3968 * Retrieve extended data from the intent. 3969 * 3970 * @param name The name of the desired item. 3971 * 3972 * @return the value of an item that previously added with putExtra() 3973 * or null if none was found. 3974 * 3975 * @deprecated 3976 * @hide 3977 */ 3978 @Deprecated 3979 public Object getExtra(String name) { 3980 return getExtra(name, null); 3981 } 3982 3983 /** 3984 * Retrieve extended data from the intent. 3985 * 3986 * @param name The name of the desired item. 3987 * @param defaultValue the value to be returned if no value of the desired 3988 * type is stored with the given name. 3989 * 3990 * @return the value of an item that previously added with putExtra() 3991 * or the default value if none was found. 3992 * 3993 * @see #putExtra(String, boolean) 3994 */ 3995 public boolean getBooleanExtra(String name, boolean defaultValue) { 3996 return mExtras == null ? defaultValue : 3997 mExtras.getBoolean(name, defaultValue); 3998 } 3999 4000 /** 4001 * Retrieve extended data from the intent. 4002 * 4003 * @param name The name of the desired item. 4004 * @param defaultValue the value to be returned if no value of the desired 4005 * type is stored with the given name. 4006 * 4007 * @return the value of an item that previously added with putExtra() 4008 * or the default value if none was found. 4009 * 4010 * @see #putExtra(String, byte) 4011 */ 4012 public byte getByteExtra(String name, byte defaultValue) { 4013 return mExtras == null ? defaultValue : 4014 mExtras.getByte(name, defaultValue); 4015 } 4016 4017 /** 4018 * Retrieve extended data from the intent. 4019 * 4020 * @param name The name of the desired item. 4021 * @param defaultValue the value to be returned if no value of the desired 4022 * type is stored with the given name. 4023 * 4024 * @return the value of an item that previously added with putExtra() 4025 * or the default value if none was found. 4026 * 4027 * @see #putExtra(String, short) 4028 */ 4029 public short getShortExtra(String name, short defaultValue) { 4030 return mExtras == null ? defaultValue : 4031 mExtras.getShort(name, defaultValue); 4032 } 4033 4034 /** 4035 * Retrieve extended data from the intent. 4036 * 4037 * @param name The name of the desired item. 4038 * @param defaultValue the value to be returned if no value of the desired 4039 * type is stored with the given name. 4040 * 4041 * @return the value of an item that previously added with putExtra() 4042 * or the default value if none was found. 4043 * 4044 * @see #putExtra(String, char) 4045 */ 4046 public char getCharExtra(String name, char defaultValue) { 4047 return mExtras == null ? defaultValue : 4048 mExtras.getChar(name, defaultValue); 4049 } 4050 4051 /** 4052 * Retrieve extended data from the intent. 4053 * 4054 * @param name The name of the desired item. 4055 * @param defaultValue the value to be returned if no value of the desired 4056 * type is stored with the given name. 4057 * 4058 * @return the value of an item that previously added with putExtra() 4059 * or the default value if none was found. 4060 * 4061 * @see #putExtra(String, int) 4062 */ 4063 public int getIntExtra(String name, int defaultValue) { 4064 return mExtras == null ? defaultValue : 4065 mExtras.getInt(name, defaultValue); 4066 } 4067 4068 /** 4069 * Retrieve extended data from the intent. 4070 * 4071 * @param name The name of the desired item. 4072 * @param defaultValue the value to be returned if no value of the desired 4073 * type is stored with the given name. 4074 * 4075 * @return the value of an item that previously added with putExtra() 4076 * or the default value if none was found. 4077 * 4078 * @see #putExtra(String, long) 4079 */ 4080 public long getLongExtra(String name, long defaultValue) { 4081 return mExtras == null ? defaultValue : 4082 mExtras.getLong(name, defaultValue); 4083 } 4084 4085 /** 4086 * Retrieve extended data from the intent. 4087 * 4088 * @param name The name of the desired item. 4089 * @param defaultValue the value to be returned if no value of the desired 4090 * type is stored with the given name. 4091 * 4092 * @return the value of an item that previously added with putExtra(), 4093 * or the default value if no such item is present 4094 * 4095 * @see #putExtra(String, float) 4096 */ 4097 public float getFloatExtra(String name, float defaultValue) { 4098 return mExtras == null ? defaultValue : 4099 mExtras.getFloat(name, defaultValue); 4100 } 4101 4102 /** 4103 * Retrieve extended data from the intent. 4104 * 4105 * @param name The name of the desired item. 4106 * @param defaultValue the value to be returned if no value of the desired 4107 * type is stored with the given name. 4108 * 4109 * @return the value of an item that previously added with putExtra() 4110 * or the default value if none was found. 4111 * 4112 * @see #putExtra(String, double) 4113 */ 4114 public double getDoubleExtra(String name, double defaultValue) { 4115 return mExtras == null ? defaultValue : 4116 mExtras.getDouble(name, defaultValue); 4117 } 4118 4119 /** 4120 * Retrieve extended data from the intent. 4121 * 4122 * @param name The name of the desired item. 4123 * 4124 * @return the value of an item that previously added with putExtra() 4125 * or null if no String value was found. 4126 * 4127 * @see #putExtra(String, String) 4128 */ 4129 public String getStringExtra(String name) { 4130 return mExtras == null ? null : mExtras.getString(name); 4131 } 4132 4133 /** 4134 * Retrieve extended data from the intent. 4135 * 4136 * @param name The name of the desired item. 4137 * 4138 * @return the value of an item that previously added with putExtra() 4139 * or null if no CharSequence value was found. 4140 * 4141 * @see #putExtra(String, CharSequence) 4142 */ 4143 public CharSequence getCharSequenceExtra(String name) { 4144 return mExtras == null ? null : mExtras.getCharSequence(name); 4145 } 4146 4147 /** 4148 * Retrieve extended data from the intent. 4149 * 4150 * @param name The name of the desired item. 4151 * 4152 * @return the value of an item that previously added with putExtra() 4153 * or null if no Parcelable value was found. 4154 * 4155 * @see #putExtra(String, Parcelable) 4156 */ 4157 public <T extends Parcelable> T getParcelableExtra(String name) { 4158 return mExtras == null ? null : mExtras.<T>getParcelable(name); 4159 } 4160 4161 /** 4162 * Retrieve extended data from the intent. 4163 * 4164 * @param name The name of the desired item. 4165 * 4166 * @return the value of an item that previously added with putExtra() 4167 * or null if no Parcelable[] value was found. 4168 * 4169 * @see #putExtra(String, Parcelable[]) 4170 */ 4171 public Parcelable[] getParcelableArrayExtra(String name) { 4172 return mExtras == null ? null : mExtras.getParcelableArray(name); 4173 } 4174 4175 /** 4176 * Retrieve extended data from the intent. 4177 * 4178 * @param name The name of the desired item. 4179 * 4180 * @return the value of an item that previously added with putExtra() 4181 * or null if no ArrayList<Parcelable> value was found. 4182 * 4183 * @see #putParcelableArrayListExtra(String, ArrayList) 4184 */ 4185 public <T extends Parcelable> ArrayList<T> getParcelableArrayListExtra(String name) { 4186 return mExtras == null ? null : mExtras.<T>getParcelableArrayList(name); 4187 } 4188 4189 /** 4190 * Retrieve extended data from the intent. 4191 * 4192 * @param name The name of the desired item. 4193 * 4194 * @return the value of an item that previously added with putExtra() 4195 * or null if no Serializable value was found. 4196 * 4197 * @see #putExtra(String, Serializable) 4198 */ 4199 public Serializable getSerializableExtra(String name) { 4200 return mExtras == null ? null : mExtras.getSerializable(name); 4201 } 4202 4203 /** 4204 * Retrieve extended data from the intent. 4205 * 4206 * @param name The name of the desired item. 4207 * 4208 * @return the value of an item that previously added with putExtra() 4209 * or null if no ArrayList<Integer> value was found. 4210 * 4211 * @see #putIntegerArrayListExtra(String, ArrayList) 4212 */ 4213 public ArrayList<Integer> getIntegerArrayListExtra(String name) { 4214 return mExtras == null ? null : mExtras.getIntegerArrayList(name); 4215 } 4216 4217 /** 4218 * Retrieve extended data from the intent. 4219 * 4220 * @param name The name of the desired item. 4221 * 4222 * @return the value of an item that previously added with putExtra() 4223 * or null if no ArrayList<String> value was found. 4224 * 4225 * @see #putStringArrayListExtra(String, ArrayList) 4226 */ 4227 public ArrayList<String> getStringArrayListExtra(String name) { 4228 return mExtras == null ? null : mExtras.getStringArrayList(name); 4229 } 4230 4231 /** 4232 * Retrieve extended data from the intent. 4233 * 4234 * @param name The name of the desired item. 4235 * 4236 * @return the value of an item that previously added with putExtra() 4237 * or null if no ArrayList<CharSequence> value was found. 4238 * 4239 * @see #putCharSequenceArrayListExtra(String, ArrayList) 4240 */ 4241 public ArrayList<CharSequence> getCharSequenceArrayListExtra(String name) { 4242 return mExtras == null ? null : mExtras.getCharSequenceArrayList(name); 4243 } 4244 4245 /** 4246 * Retrieve extended data from the intent. 4247 * 4248 * @param name The name of the desired item. 4249 * 4250 * @return the value of an item that previously added with putExtra() 4251 * or null if no boolean array value was found. 4252 * 4253 * @see #putExtra(String, boolean[]) 4254 */ 4255 public boolean[] getBooleanArrayExtra(String name) { 4256 return mExtras == null ? null : mExtras.getBooleanArray(name); 4257 } 4258 4259 /** 4260 * Retrieve extended data from the intent. 4261 * 4262 * @param name The name of the desired item. 4263 * 4264 * @return the value of an item that previously added with putExtra() 4265 * or null if no byte array value was found. 4266 * 4267 * @see #putExtra(String, byte[]) 4268 */ 4269 public byte[] getByteArrayExtra(String name) { 4270 return mExtras == null ? null : mExtras.getByteArray(name); 4271 } 4272 4273 /** 4274 * Retrieve extended data from the intent. 4275 * 4276 * @param name The name of the desired item. 4277 * 4278 * @return the value of an item that previously added with putExtra() 4279 * or null if no short array value was found. 4280 * 4281 * @see #putExtra(String, short[]) 4282 */ 4283 public short[] getShortArrayExtra(String name) { 4284 return mExtras == null ? null : mExtras.getShortArray(name); 4285 } 4286 4287 /** 4288 * Retrieve extended data from the intent. 4289 * 4290 * @param name The name of the desired item. 4291 * 4292 * @return the value of an item that previously added with putExtra() 4293 * or null if no char array value was found. 4294 * 4295 * @see #putExtra(String, char[]) 4296 */ 4297 public char[] getCharArrayExtra(String name) { 4298 return mExtras == null ? null : mExtras.getCharArray(name); 4299 } 4300 4301 /** 4302 * Retrieve extended data from the intent. 4303 * 4304 * @param name The name of the desired item. 4305 * 4306 * @return the value of an item that previously added with putExtra() 4307 * or null if no int array value was found. 4308 * 4309 * @see #putExtra(String, int[]) 4310 */ 4311 public int[] getIntArrayExtra(String name) { 4312 return mExtras == null ? null : mExtras.getIntArray(name); 4313 } 4314 4315 /** 4316 * Retrieve extended data from the intent. 4317 * 4318 * @param name The name of the desired item. 4319 * 4320 * @return the value of an item that previously added with putExtra() 4321 * or null if no long array value was found. 4322 * 4323 * @see #putExtra(String, long[]) 4324 */ 4325 public long[] getLongArrayExtra(String name) { 4326 return mExtras == null ? null : mExtras.getLongArray(name); 4327 } 4328 4329 /** 4330 * Retrieve extended data from the intent. 4331 * 4332 * @param name The name of the desired item. 4333 * 4334 * @return the value of an item that previously added with putExtra() 4335 * or null if no float array value was found. 4336 * 4337 * @see #putExtra(String, float[]) 4338 */ 4339 public float[] getFloatArrayExtra(String name) { 4340 return mExtras == null ? null : mExtras.getFloatArray(name); 4341 } 4342 4343 /** 4344 * Retrieve extended data from the intent. 4345 * 4346 * @param name The name of the desired item. 4347 * 4348 * @return the value of an item that previously added with putExtra() 4349 * or null if no double array value was found. 4350 * 4351 * @see #putExtra(String, double[]) 4352 */ 4353 public double[] getDoubleArrayExtra(String name) { 4354 return mExtras == null ? null : mExtras.getDoubleArray(name); 4355 } 4356 4357 /** 4358 * Retrieve extended data from the intent. 4359 * 4360 * @param name The name of the desired item. 4361 * 4362 * @return the value of an item that previously added with putExtra() 4363 * or null if no String array value was found. 4364 * 4365 * @see #putExtra(String, String[]) 4366 */ 4367 public String[] getStringArrayExtra(String name) { 4368 return mExtras == null ? null : mExtras.getStringArray(name); 4369 } 4370 4371 /** 4372 * Retrieve extended data from the intent. 4373 * 4374 * @param name The name of the desired item. 4375 * 4376 * @return the value of an item that previously added with putExtra() 4377 * or null if no CharSequence array value was found. 4378 * 4379 * @see #putExtra(String, CharSequence[]) 4380 */ 4381 public CharSequence[] getCharSequenceArrayExtra(String name) { 4382 return mExtras == null ? null : mExtras.getCharSequenceArray(name); 4383 } 4384 4385 /** 4386 * Retrieve extended data from the intent. 4387 * 4388 * @param name The name of the desired item. 4389 * 4390 * @return the value of an item that previously added with putExtra() 4391 * or null if no Bundle value was found. 4392 * 4393 * @see #putExtra(String, Bundle) 4394 */ 4395 public Bundle getBundleExtra(String name) { 4396 return mExtras == null ? null : mExtras.getBundle(name); 4397 } 4398 4399 /** 4400 * Retrieve extended data from the intent. 4401 * 4402 * @param name The name of the desired item. 4403 * 4404 * @return the value of an item that previously added with putExtra() 4405 * or null if no IBinder value was found. 4406 * 4407 * @see #putExtra(String, IBinder) 4408 * 4409 * @deprecated 4410 * @hide 4411 */ 4412 @Deprecated 4413 public IBinder getIBinderExtra(String name) { 4414 return mExtras == null ? null : mExtras.getIBinder(name); 4415 } 4416 4417 /** 4418 * Retrieve extended data from the intent. 4419 * 4420 * @param name The name of the desired item. 4421 * @param defaultValue The default value to return in case no item is 4422 * associated with the key 'name' 4423 * 4424 * @return the value of an item that previously added with putExtra() 4425 * or defaultValue if none was found. 4426 * 4427 * @see #putExtra 4428 * 4429 * @deprecated 4430 * @hide 4431 */ 4432 @Deprecated 4433 public Object getExtra(String name, Object defaultValue) { 4434 Object result = defaultValue; 4435 if (mExtras != null) { 4436 Object result2 = mExtras.get(name); 4437 if (result2 != null) { 4438 result = result2; 4439 } 4440 } 4441 4442 return result; 4443 } 4444 4445 /** 4446 * Retrieves a map of extended data from the intent. 4447 * 4448 * @return the map of all extras previously added with putExtra(), 4449 * or null if none have been added. 4450 */ 4451 public Bundle getExtras() { 4452 return (mExtras != null) 4453 ? new Bundle(mExtras) 4454 : null; 4455 } 4456 4457 /** 4458 * Retrieve any special flags associated with this intent. You will 4459 * normally just set them with {@link #setFlags} and let the system 4460 * take the appropriate action with them. 4461 * 4462 * @return int The currently set flags. 4463 * 4464 * @see #setFlags 4465 */ 4466 public int getFlags() { 4467 return mFlags; 4468 } 4469 4470 /** @hide */ 4471 public boolean isExcludingStopped() { 4472 return (mFlags&(FLAG_EXCLUDE_STOPPED_PACKAGES|FLAG_INCLUDE_STOPPED_PACKAGES)) 4473 == FLAG_EXCLUDE_STOPPED_PACKAGES; 4474 } 4475 4476 /** 4477 * Retrieve the application package name this Intent is limited to. When 4478 * resolving an Intent, if non-null this limits the resolution to only 4479 * components in the given application package. 4480 * 4481 * @return The name of the application package for the Intent. 4482 * 4483 * @see #resolveActivity 4484 * @see #setPackage 4485 */ 4486 public String getPackage() { 4487 return mPackage; 4488 } 4489 4490 /** 4491 * Retrieve the concrete component associated with the intent. When receiving 4492 * an intent, this is the component that was found to best handle it (that is, 4493 * yourself) and will always be non-null; in all other cases it will be 4494 * null unless explicitly set. 4495 * 4496 * @return The name of the application component to handle the intent. 4497 * 4498 * @see #resolveActivity 4499 * @see #setComponent 4500 */ 4501 public ComponentName getComponent() { 4502 return mComponent; 4503 } 4504 4505 /** 4506 * Get the bounds of the sender of this intent, in screen coordinates. This can be 4507 * used as a hint to the receiver for animations and the like. Null means that there 4508 * is no source bounds. 4509 */ 4510 public Rect getSourceBounds() { 4511 return mSourceBounds; 4512 } 4513 4514 /** 4515 * Return the Activity component that should be used to handle this intent. 4516 * The appropriate component is determined based on the information in the 4517 * intent, evaluated as follows: 4518 * 4519 * <p>If {@link #getComponent} returns an explicit class, that is returned 4520 * without any further consideration. 4521 * 4522 * <p>The activity must handle the {@link Intent#CATEGORY_DEFAULT} Intent 4523 * category to be considered. 4524 * 4525 * <p>If {@link #getAction} is non-NULL, the activity must handle this 4526 * action. 4527 * 4528 * <p>If {@link #resolveType} returns non-NULL, the activity must handle 4529 * this type. 4530 * 4531 * <p>If {@link #addCategory} has added any categories, the activity must 4532 * handle ALL of the categories specified. 4533 * 4534 * <p>If {@link #getPackage} is non-NULL, only activity components in 4535 * that application package will be considered. 4536 * 4537 * <p>If there are no activities that satisfy all of these conditions, a 4538 * null string is returned. 4539 * 4540 * <p>If multiple activities are found to satisfy the intent, the one with 4541 * the highest priority will be used. If there are multiple activities 4542 * with the same priority, the system will either pick the best activity 4543 * based on user preference, or resolve to a system class that will allow 4544 * the user to pick an activity and forward from there. 4545 * 4546 * <p>This method is implemented simply by calling 4547 * {@link PackageManager#resolveActivity} with the "defaultOnly" parameter 4548 * true.</p> 4549 * <p> This API is called for you as part of starting an activity from an 4550 * intent. You do not normally need to call it yourself.</p> 4551 * 4552 * @param pm The package manager with which to resolve the Intent. 4553 * 4554 * @return Name of the component implementing an activity that can 4555 * display the intent. 4556 * 4557 * @see #setComponent 4558 * @see #getComponent 4559 * @see #resolveActivityInfo 4560 */ 4561 public ComponentName resolveActivity(PackageManager pm) { 4562 if (mComponent != null) { 4563 return mComponent; 4564 } 4565 4566 ResolveInfo info = pm.resolveActivity( 4567 this, PackageManager.MATCH_DEFAULT_ONLY); 4568 if (info != null) { 4569 return new ComponentName( 4570 info.activityInfo.applicationInfo.packageName, 4571 info.activityInfo.name); 4572 } 4573 4574 return null; 4575 } 4576 4577 /** 4578 * Resolve the Intent into an {@link ActivityInfo} 4579 * describing the activity that should execute the intent. Resolution 4580 * follows the same rules as described for {@link #resolveActivity}, but 4581 * you get back the completely information about the resolved activity 4582 * instead of just its class name. 4583 * 4584 * @param pm The package manager with which to resolve the Intent. 4585 * @param flags Addition information to retrieve as per 4586 * {@link PackageManager#getActivityInfo(ComponentName, int) 4587 * PackageManager.getActivityInfo()}. 4588 * 4589 * @return PackageManager.ActivityInfo 4590 * 4591 * @see #resolveActivity 4592 */ 4593 public ActivityInfo resolveActivityInfo(PackageManager pm, int flags) { 4594 ActivityInfo ai = null; 4595 if (mComponent != null) { 4596 try { 4597 ai = pm.getActivityInfo(mComponent, flags); 4598 } catch (PackageManager.NameNotFoundException e) { 4599 // ignore 4600 } 4601 } else { 4602 ResolveInfo info = pm.resolveActivity( 4603 this, PackageManager.MATCH_DEFAULT_ONLY | flags); 4604 if (info != null) { 4605 ai = info.activityInfo; 4606 } 4607 } 4608 4609 return ai; 4610 } 4611 4612 /** 4613 * Set the general action to be performed. 4614 * 4615 * @param action An action name, such as ACTION_VIEW. Application-specific 4616 * actions should be prefixed with the vendor's package name. 4617 * 4618 * @return Returns the same Intent object, for chaining multiple calls 4619 * into a single statement. 4620 * 4621 * @see #getAction 4622 */ 4623 public Intent setAction(String action) { 4624 mAction = action != null ? action.intern() : null; 4625 return this; 4626 } 4627 4628 /** 4629 * Set the data this intent is operating on. This method automatically 4630 * clears any type that was previously set by {@link #setType} or 4631 * {@link #setTypeAndNormalize}. 4632 * 4633 * <p><em>Note: scheme matching in the Android framework is 4634 * case-sensitive, unlike the formal RFC. As a result, 4635 * you should always write your Uri with a lower case scheme, 4636 * or use {@link Uri#normalizeScheme} or 4637 * {@link #setDataAndNormalize} 4638 * to ensure that the scheme is converted to lower case.</em> 4639 * 4640 * @param data The Uri of the data this intent is now targeting. 4641 * 4642 * @return Returns the same Intent object, for chaining multiple calls 4643 * into a single statement. 4644 * 4645 * @see #getData 4646 * @see #setDataAndNormalize 4647 * @see android.net.Intent#normalize 4648 */ 4649 public Intent setData(Uri data) { 4650 mData = data; 4651 mType = null; 4652 return this; 4653 } 4654 4655 /** 4656 * Normalize and set the data this intent is operating on. 4657 * 4658 * <p>This method automatically clears any type that was 4659 * previously set (for example, by {@link #setType}). 4660 * 4661 * <p>The data Uri is normalized using 4662 * {@link android.net.Uri#normalizeScheme} before it is set, 4663 * so really this is just a convenience method for 4664 * <pre> 4665 * setData(data.normalize()) 4666 * </pre> 4667 * 4668 * @param data The Uri of the data this intent is now targeting. 4669 * 4670 * @return Returns the same Intent object, for chaining multiple calls 4671 * into a single statement. 4672 * 4673 * @see #getData 4674 * @see #setType 4675 * @see android.net.Uri#normalizeScheme 4676 */ 4677 public Intent setDataAndNormalize(Uri data) { 4678 return setData(data.normalizeScheme()); 4679 } 4680 4681 /** 4682 * Set an explicit MIME data type. 4683 * 4684 * <p>This is used to create intents that only specify a type and not data, 4685 * for example to indicate the type of data to return. 4686 * 4687 * <p>This method automatically clears any data that was 4688 * previously set (for example by {@link #setData}). 4689 * 4690 * <p><em>Note: MIME type matching in the Android framework is 4691 * case-sensitive, unlike formal RFC MIME types. As a result, 4692 * you should always write your MIME types with lower case letters, 4693 * or use {@link #normalizeMimeType} or {@link #setTypeAndNormalize} 4694 * to ensure that it is converted to lower case.</em> 4695 * 4696 * @param type The MIME type of the data being handled by this intent. 4697 * 4698 * @return Returns the same Intent object, for chaining multiple calls 4699 * into a single statement. 4700 * 4701 * @see #getType 4702 * @see #setTypeAndNormalize 4703 * @see #setDataAndType 4704 * @see #normalizeMimeType 4705 */ 4706 public Intent setType(String type) { 4707 mData = null; 4708 mType = type; 4709 return this; 4710 } 4711 4712 /** 4713 * Normalize and set an explicit MIME data type. 4714 * 4715 * <p>This is used to create intents that only specify a type and not data, 4716 * for example to indicate the type of data to return. 4717 * 4718 * <p>This method automatically clears any data that was 4719 * previously set (for example by {@link #setData}). 4720 * 4721 * <p>The MIME type is normalized using 4722 * {@link #normalizeMimeType} before it is set, 4723 * so really this is just a convenience method for 4724 * <pre> 4725 * setType(Intent.normalizeMimeType(type)) 4726 * </pre> 4727 * 4728 * @param type The MIME type of the data being handled by this intent. 4729 * 4730 * @return Returns the same Intent object, for chaining multiple calls 4731 * into a single statement. 4732 * 4733 * @see #getType 4734 * @see #setData 4735 * @see #normalizeMimeType 4736 */ 4737 public Intent setTypeAndNormalize(String type) { 4738 return setType(normalizeMimeType(type)); 4739 } 4740 4741 /** 4742 * (Usually optional) Set the data for the intent along with an explicit 4743 * MIME data type. This method should very rarely be used -- it allows you 4744 * to override the MIME type that would ordinarily be inferred from the 4745 * data with your own type given here. 4746 * 4747 * <p><em>Note: MIME type and Uri scheme matching in the 4748 * Android framework is case-sensitive, unlike the formal RFC definitions. 4749 * As a result, you should always write these elements with lower case letters, 4750 * or use {@link #normalizeMimeType} or {@link android.net.Uri#normalizeScheme} or 4751 * {@link #setDataAndTypeAndNormalize} 4752 * to ensure that they are converted to lower case.</em> 4753 * 4754 * @param data The Uri of the data this intent is now targeting. 4755 * @param type The MIME type of the data being handled by this intent. 4756 * 4757 * @return Returns the same Intent object, for chaining multiple calls 4758 * into a single statement. 4759 * 4760 * @see #setType 4761 * @see #setData 4762 * @see #normalizeMimeType 4763 * @see android.net.Uri#normalizeScheme 4764 * @see #setDataAndTypeAndNormalize 4765 */ 4766 public Intent setDataAndType(Uri data, String type) { 4767 mData = data; 4768 mType = type; 4769 return this; 4770 } 4771 4772 /** 4773 * (Usually optional) Normalize and set both the data Uri and an explicit 4774 * MIME data type. This method should very rarely be used -- it allows you 4775 * to override the MIME type that would ordinarily be inferred from the 4776 * data with your own type given here. 4777 * 4778 * <p>The data Uri and the MIME type are normalize using 4779 * {@link android.net.Uri#normalizeScheme} and {@link #normalizeMimeType} 4780 * before they are set, so really this is just a convenience method for 4781 * <pre> 4782 * setDataAndType(data.normalize(), Intent.normalizeMimeType(type)) 4783 * </pre> 4784 * 4785 * @param data The Uri of the data this intent is now targeting. 4786 * @param type The MIME type of the data being handled by this intent. 4787 * 4788 * @return Returns the same Intent object, for chaining multiple calls 4789 * into a single statement. 4790 * 4791 * @see #setType 4792 * @see #setData 4793 * @see #setDataAndType 4794 * @see #normalizeMimeType 4795 * @see android.net.Uri#normalizeScheme 4796 */ 4797 public Intent setDataAndTypeAndNormalize(Uri data, String type) { 4798 return setDataAndType(data.normalizeScheme(), normalizeMimeType(type)); 4799 } 4800 4801 /** 4802 * Add a new category to the intent. Categories provide additional detail 4803 * about the action the intent performs. When resolving an intent, only 4804 * activities that provide <em>all</em> of the requested categories will be 4805 * used. 4806 * 4807 * @param category The desired category. This can be either one of the 4808 * predefined Intent categories, or a custom category in your own 4809 * namespace. 4810 * 4811 * @return Returns the same Intent object, for chaining multiple calls 4812 * into a single statement. 4813 * 4814 * @see #hasCategory 4815 * @see #removeCategory 4816 */ 4817 public Intent addCategory(String category) { 4818 if (mCategories == null) { 4819 mCategories = new HashSet<String>(); 4820 } 4821 mCategories.add(category.intern()); 4822 return this; 4823 } 4824 4825 /** 4826 * Remove a category from an intent. 4827 * 4828 * @param category The category to remove. 4829 * 4830 * @see #addCategory 4831 */ 4832 public void removeCategory(String category) { 4833 if (mCategories != null) { 4834 mCategories.remove(category); 4835 if (mCategories.size() == 0) { 4836 mCategories = null; 4837 } 4838 } 4839 } 4840 4841 /** 4842 * Set a selector for this Intent. This is a modification to the kinds of 4843 * things the Intent will match. If the selector is set, it will be used 4844 * when trying to find entities that can handle the Intent, instead of the 4845 * main contents of the Intent. This allows you build an Intent containing 4846 * a generic protocol while targeting it more specifically. 4847 * 4848 * <p>An example of where this may be used is with things like 4849 * {@link #CATEGORY_APP_BROWSER}. This category allows you to build an 4850 * Intent that will launch the Browser application. However, the correct 4851 * main entry point of an application is actually {@link #ACTION_MAIN} 4852 * {@link #CATEGORY_LAUNCHER} with {@link #setComponent(ComponentName)} 4853 * used to specify the actual Activity to launch. If you launch the browser 4854 * with something different, undesired behavior may happen if the user has 4855 * previously or later launches it the normal way, since they do not match. 4856 * Instead, you can build an Intent with the MAIN action (but no ComponentName 4857 * yet specified) and set a selector with {@link #ACTION_MAIN} and 4858 * {@link #CATEGORY_APP_BROWSER} to point it specifically to the browser activity. 4859 * 4860 * <p>Setting a selector does not impact the behavior of 4861 * {@link #filterEquals(Intent)} and {@link #filterHashCode()}. This is part of the 4862 * desired behavior of a selector -- it does not impact the base meaning 4863 * of the Intent, just what kinds of things will be matched against it 4864 * when determining who can handle it.</p> 4865 * 4866 * <p>You can not use both a selector and {@link #setPackage(String)} on 4867 * the same base Intent.</p> 4868 * 4869 * @param selector The desired selector Intent; set to null to not use 4870 * a special selector. 4871 */ 4872 public void setSelector(Intent selector) { 4873 if (selector == this) { 4874 throw new IllegalArgumentException( 4875 "Intent being set as a selector of itself"); 4876 } 4877 if (selector != null && mPackage != null) { 4878 throw new IllegalArgumentException( 4879 "Can't set selector when package name is already set"); 4880 } 4881 mSelector = selector; 4882 } 4883 4884 /** 4885 * Set a {@link ClipData} associated with this Intent. This replaces any 4886 * previously set ClipData. 4887 * 4888 * <p>The ClipData in an intent is not used for Intent matching or other 4889 * such operations. Semantically it is like extras, used to transmit 4890 * additional data with the Intent. The main feature of using this over 4891 * the extras for data is that {@link #FLAG_GRANT_READ_URI_PERMISSION} 4892 * and {@link #FLAG_GRANT_WRITE_URI_PERMISSION} will operate on any URI 4893 * items included in the clip data. This is useful, in particular, if 4894 * you want to transmit an Intent containing multiple <code>content:</code> 4895 * URIs for which the recipient may not have global permission to access the 4896 * content provider. 4897 * 4898 * <p>If the ClipData contains items that are themselves Intents, any 4899 * grant flags in those Intents will be ignored. Only the top-level flags 4900 * of the main Intent are respected, and will be applied to all Uri or 4901 * Intent items in the clip (or sub-items of the clip). 4902 * 4903 * <p>The MIME type, label, and icon in the ClipData object are not 4904 * directly used by Intent. Applications should generally rely on the 4905 * MIME type of the Intent itself, not what it may find in the ClipData. 4906 * A common practice is to construct a ClipData for use with an Intent 4907 * with a MIME type of "*\/*". 4908 * 4909 * @param clip The new clip to set. May be null to clear the current clip. 4910 */ 4911 public void setClipData(ClipData clip) { 4912 mClipData = clip; 4913 } 4914 4915 /** 4916 * Add extended data to the intent. The name must include a package 4917 * prefix, for example the app com.android.contacts would use names 4918 * like "com.android.contacts.ShowAll". 4919 * 4920 * @param name The name of the extra data, with package prefix. 4921 * @param value The boolean data value. 4922 * 4923 * @return Returns the same Intent object, for chaining multiple calls 4924 * into a single statement. 4925 * 4926 * @see #putExtras 4927 * @see #removeExtra 4928 * @see #getBooleanExtra(String, boolean) 4929 */ 4930 public Intent putExtra(String name, boolean value) { 4931 if (mExtras == null) { 4932 mExtras = new Bundle(); 4933 } 4934 mExtras.putBoolean(name, value); 4935 return this; 4936 } 4937 4938 /** 4939 * Add extended data to the intent. The name must include a package 4940 * prefix, for example the app com.android.contacts would use names 4941 * like "com.android.contacts.ShowAll". 4942 * 4943 * @param name The name of the extra data, with package prefix. 4944 * @param value The byte data value. 4945 * 4946 * @return Returns the same Intent object, for chaining multiple calls 4947 * into a single statement. 4948 * 4949 * @see #putExtras 4950 * @see #removeExtra 4951 * @see #getByteExtra(String, byte) 4952 */ 4953 public Intent putExtra(String name, byte value) { 4954 if (mExtras == null) { 4955 mExtras = new Bundle(); 4956 } 4957 mExtras.putByte(name, value); 4958 return this; 4959 } 4960 4961 /** 4962 * Add extended data to the intent. The name must include a package 4963 * prefix, for example the app com.android.contacts would use names 4964 * like "com.android.contacts.ShowAll". 4965 * 4966 * @param name The name of the extra data, with package prefix. 4967 * @param value The char data value. 4968 * 4969 * @return Returns the same Intent object, for chaining multiple calls 4970 * into a single statement. 4971 * 4972 * @see #putExtras 4973 * @see #removeExtra 4974 * @see #getCharExtra(String, char) 4975 */ 4976 public Intent putExtra(String name, char value) { 4977 if (mExtras == null) { 4978 mExtras = new Bundle(); 4979 } 4980 mExtras.putChar(name, value); 4981 return this; 4982 } 4983 4984 /** 4985 * Add extended data to the intent. The name must include a package 4986 * prefix, for example the app com.android.contacts would use names 4987 * like "com.android.contacts.ShowAll". 4988 * 4989 * @param name The name of the extra data, with package prefix. 4990 * @param value The short data value. 4991 * 4992 * @return Returns the same Intent object, for chaining multiple calls 4993 * into a single statement. 4994 * 4995 * @see #putExtras 4996 * @see #removeExtra 4997 * @see #getShortExtra(String, short) 4998 */ 4999 public Intent putExtra(String name, short value) { 5000 if (mExtras == null) { 5001 mExtras = new Bundle(); 5002 } 5003 mExtras.putShort(name, value); 5004 return this; 5005 } 5006 5007 /** 5008 * Add extended data to the intent. The name must include a package 5009 * prefix, for example the app com.android.contacts would use names 5010 * like "com.android.contacts.ShowAll". 5011 * 5012 * @param name The name of the extra data, with package prefix. 5013 * @param value The integer data value. 5014 * 5015 * @return Returns the same Intent object, for chaining multiple calls 5016 * into a single statement. 5017 * 5018 * @see #putExtras 5019 * @see #removeExtra 5020 * @see #getIntExtra(String, int) 5021 */ 5022 public Intent putExtra(String name, int value) { 5023 if (mExtras == null) { 5024 mExtras = new Bundle(); 5025 } 5026 mExtras.putInt(name, value); 5027 return this; 5028 } 5029 5030 /** 5031 * Add extended data to the intent. The name must include a package 5032 * prefix, for example the app com.android.contacts would use names 5033 * like "com.android.contacts.ShowAll". 5034 * 5035 * @param name The name of the extra data, with package prefix. 5036 * @param value The long data value. 5037 * 5038 * @return Returns the same Intent object, for chaining multiple calls 5039 * into a single statement. 5040 * 5041 * @see #putExtras 5042 * @see #removeExtra 5043 * @see #getLongExtra(String, long) 5044 */ 5045 public Intent putExtra(String name, long value) { 5046 if (mExtras == null) { 5047 mExtras = new Bundle(); 5048 } 5049 mExtras.putLong(name, value); 5050 return this; 5051 } 5052 5053 /** 5054 * Add extended data to the intent. The name must include a package 5055 * prefix, for example the app com.android.contacts would use names 5056 * like "com.android.contacts.ShowAll". 5057 * 5058 * @param name The name of the extra data, with package prefix. 5059 * @param value The float data value. 5060 * 5061 * @return Returns the same Intent object, for chaining multiple calls 5062 * into a single statement. 5063 * 5064 * @see #putExtras 5065 * @see #removeExtra 5066 * @see #getFloatExtra(String, float) 5067 */ 5068 public Intent putExtra(String name, float value) { 5069 if (mExtras == null) { 5070 mExtras = new Bundle(); 5071 } 5072 mExtras.putFloat(name, value); 5073 return this; 5074 } 5075 5076 /** 5077 * Add extended data to the intent. The name must include a package 5078 * prefix, for example the app com.android.contacts would use names 5079 * like "com.android.contacts.ShowAll". 5080 * 5081 * @param name The name of the extra data, with package prefix. 5082 * @param value The double data value. 5083 * 5084 * @return Returns the same Intent object, for chaining multiple calls 5085 * into a single statement. 5086 * 5087 * @see #putExtras 5088 * @see #removeExtra 5089 * @see #getDoubleExtra(String, double) 5090 */ 5091 public Intent putExtra(String name, double value) { 5092 if (mExtras == null) { 5093 mExtras = new Bundle(); 5094 } 5095 mExtras.putDouble(name, value); 5096 return this; 5097 } 5098 5099 /** 5100 * Add extended data to the intent. The name must include a package 5101 * prefix, for example the app com.android.contacts would use names 5102 * like "com.android.contacts.ShowAll". 5103 * 5104 * @param name The name of the extra data, with package prefix. 5105 * @param value The String data value. 5106 * 5107 * @return Returns the same Intent object, for chaining multiple calls 5108 * into a single statement. 5109 * 5110 * @see #putExtras 5111 * @see #removeExtra 5112 * @see #getStringExtra(String) 5113 */ 5114 public Intent putExtra(String name, String value) { 5115 if (mExtras == null) { 5116 mExtras = new Bundle(); 5117 } 5118 mExtras.putString(name, value); 5119 return this; 5120 } 5121 5122 /** 5123 * Add extended data to the intent. The name must include a package 5124 * prefix, for example the app com.android.contacts would use names 5125 * like "com.android.contacts.ShowAll". 5126 * 5127 * @param name The name of the extra data, with package prefix. 5128 * @param value The CharSequence data value. 5129 * 5130 * @return Returns the same Intent object, for chaining multiple calls 5131 * into a single statement. 5132 * 5133 * @see #putExtras 5134 * @see #removeExtra 5135 * @see #getCharSequenceExtra(String) 5136 */ 5137 public Intent putExtra(String name, CharSequence value) { 5138 if (mExtras == null) { 5139 mExtras = new Bundle(); 5140 } 5141 mExtras.putCharSequence(name, value); 5142 return this; 5143 } 5144 5145 /** 5146 * Add extended data to the intent. The name must include a package 5147 * prefix, for example the app com.android.contacts would use names 5148 * like "com.android.contacts.ShowAll". 5149 * 5150 * @param name The name of the extra data, with package prefix. 5151 * @param value The Parcelable data value. 5152 * 5153 * @return Returns the same Intent object, for chaining multiple calls 5154 * into a single statement. 5155 * 5156 * @see #putExtras 5157 * @see #removeExtra 5158 * @see #getParcelableExtra(String) 5159 */ 5160 public Intent putExtra(String name, Parcelable value) { 5161 if (mExtras == null) { 5162 mExtras = new Bundle(); 5163 } 5164 mExtras.putParcelable(name, value); 5165 return this; 5166 } 5167 5168 /** 5169 * Add extended data to the intent. The name must include a package 5170 * prefix, for example the app com.android.contacts would use names 5171 * like "com.android.contacts.ShowAll". 5172 * 5173 * @param name The name of the extra data, with package prefix. 5174 * @param value The Parcelable[] data value. 5175 * 5176 * @return Returns the same Intent object, for chaining multiple calls 5177 * into a single statement. 5178 * 5179 * @see #putExtras 5180 * @see #removeExtra 5181 * @see #getParcelableArrayExtra(String) 5182 */ 5183 public Intent putExtra(String name, Parcelable[] value) { 5184 if (mExtras == null) { 5185 mExtras = new Bundle(); 5186 } 5187 mExtras.putParcelableArray(name, value); 5188 return this; 5189 } 5190 5191 /** 5192 * Add extended data to the intent. The name must include a package 5193 * prefix, for example the app com.android.contacts would use names 5194 * like "com.android.contacts.ShowAll". 5195 * 5196 * @param name The name of the extra data, with package prefix. 5197 * @param value The ArrayList<Parcelable> data value. 5198 * 5199 * @return Returns the same Intent object, for chaining multiple calls 5200 * into a single statement. 5201 * 5202 * @see #putExtras 5203 * @see #removeExtra 5204 * @see #getParcelableArrayListExtra(String) 5205 */ 5206 public Intent putParcelableArrayListExtra(String name, ArrayList<? extends Parcelable> value) { 5207 if (mExtras == null) { 5208 mExtras = new Bundle(); 5209 } 5210 mExtras.putParcelableArrayList(name, value); 5211 return this; 5212 } 5213 5214 /** 5215 * Add extended data to the intent. The name must include a package 5216 * prefix, for example the app com.android.contacts would use names 5217 * like "com.android.contacts.ShowAll". 5218 * 5219 * @param name The name of the extra data, with package prefix. 5220 * @param value The ArrayList<Integer> data value. 5221 * 5222 * @return Returns the same Intent object, for chaining multiple calls 5223 * into a single statement. 5224 * 5225 * @see #putExtras 5226 * @see #removeExtra 5227 * @see #getIntegerArrayListExtra(String) 5228 */ 5229 public Intent putIntegerArrayListExtra(String name, ArrayList<Integer> value) { 5230 if (mExtras == null) { 5231 mExtras = new Bundle(); 5232 } 5233 mExtras.putIntegerArrayList(name, value); 5234 return this; 5235 } 5236 5237 /** 5238 * Add extended data to the intent. The name must include a package 5239 * prefix, for example the app com.android.contacts would use names 5240 * like "com.android.contacts.ShowAll". 5241 * 5242 * @param name The name of the extra data, with package prefix. 5243 * @param value The ArrayList<String> data value. 5244 * 5245 * @return Returns the same Intent object, for chaining multiple calls 5246 * into a single statement. 5247 * 5248 * @see #putExtras 5249 * @see #removeExtra 5250 * @see #getStringArrayListExtra(String) 5251 */ 5252 public Intent putStringArrayListExtra(String name, ArrayList<String> value) { 5253 if (mExtras == null) { 5254 mExtras = new Bundle(); 5255 } 5256 mExtras.putStringArrayList(name, value); 5257 return this; 5258 } 5259 5260 /** 5261 * Add extended data to the intent. The name must include a package 5262 * prefix, for example the app com.android.contacts would use names 5263 * like "com.android.contacts.ShowAll". 5264 * 5265 * @param name The name of the extra data, with package prefix. 5266 * @param value The ArrayList<CharSequence> data value. 5267 * 5268 * @return Returns the same Intent object, for chaining multiple calls 5269 * into a single statement. 5270 * 5271 * @see #putExtras 5272 * @see #removeExtra 5273 * @see #getCharSequenceArrayListExtra(String) 5274 */ 5275 public Intent putCharSequenceArrayListExtra(String name, ArrayList<CharSequence> value) { 5276 if (mExtras == null) { 5277 mExtras = new Bundle(); 5278 } 5279 mExtras.putCharSequenceArrayList(name, value); 5280 return this; 5281 } 5282 5283 /** 5284 * Add extended data to the intent. The name must include a package 5285 * prefix, for example the app com.android.contacts would use names 5286 * like "com.android.contacts.ShowAll". 5287 * 5288 * @param name The name of the extra data, with package prefix. 5289 * @param value The Serializable data value. 5290 * 5291 * @return Returns the same Intent object, for chaining multiple calls 5292 * into a single statement. 5293 * 5294 * @see #putExtras 5295 * @see #removeExtra 5296 * @see #getSerializableExtra(String) 5297 */ 5298 public Intent putExtra(String name, Serializable value) { 5299 if (mExtras == null) { 5300 mExtras = new Bundle(); 5301 } 5302 mExtras.putSerializable(name, value); 5303 return this; 5304 } 5305 5306 /** 5307 * Add extended data to the intent. The name must include a package 5308 * prefix, for example the app com.android.contacts would use names 5309 * like "com.android.contacts.ShowAll". 5310 * 5311 * @param name The name of the extra data, with package prefix. 5312 * @param value The boolean array data value. 5313 * 5314 * @return Returns the same Intent object, for chaining multiple calls 5315 * into a single statement. 5316 * 5317 * @see #putExtras 5318 * @see #removeExtra 5319 * @see #getBooleanArrayExtra(String) 5320 */ 5321 public Intent putExtra(String name, boolean[] value) { 5322 if (mExtras == null) { 5323 mExtras = new Bundle(); 5324 } 5325 mExtras.putBooleanArray(name, value); 5326 return this; 5327 } 5328 5329 /** 5330 * Add extended data to the intent. The name must include a package 5331 * prefix, for example the app com.android.contacts would use names 5332 * like "com.android.contacts.ShowAll". 5333 * 5334 * @param name The name of the extra data, with package prefix. 5335 * @param value The byte array data value. 5336 * 5337 * @return Returns the same Intent object, for chaining multiple calls 5338 * into a single statement. 5339 * 5340 * @see #putExtras 5341 * @see #removeExtra 5342 * @see #getByteArrayExtra(String) 5343 */ 5344 public Intent putExtra(String name, byte[] value) { 5345 if (mExtras == null) { 5346 mExtras = new Bundle(); 5347 } 5348 mExtras.putByteArray(name, value); 5349 return this; 5350 } 5351 5352 /** 5353 * Add extended data to the intent. The name must include a package 5354 * prefix, for example the app com.android.contacts would use names 5355 * like "com.android.contacts.ShowAll". 5356 * 5357 * @param name The name of the extra data, with package prefix. 5358 * @param value The short array data value. 5359 * 5360 * @return Returns the same Intent object, for chaining multiple calls 5361 * into a single statement. 5362 * 5363 * @see #putExtras 5364 * @see #removeExtra 5365 * @see #getShortArrayExtra(String) 5366 */ 5367 public Intent putExtra(String name, short[] value) { 5368 if (mExtras == null) { 5369 mExtras = new Bundle(); 5370 } 5371 mExtras.putShortArray(name, value); 5372 return this; 5373 } 5374 5375 /** 5376 * Add extended data to the intent. The name must include a package 5377 * prefix, for example the app com.android.contacts would use names 5378 * like "com.android.contacts.ShowAll". 5379 * 5380 * @param name The name of the extra data, with package prefix. 5381 * @param value The char array data value. 5382 * 5383 * @return Returns the same Intent object, for chaining multiple calls 5384 * into a single statement. 5385 * 5386 * @see #putExtras 5387 * @see #removeExtra 5388 * @see #getCharArrayExtra(String) 5389 */ 5390 public Intent putExtra(String name, char[] value) { 5391 if (mExtras == null) { 5392 mExtras = new Bundle(); 5393 } 5394 mExtras.putCharArray(name, value); 5395 return this; 5396 } 5397 5398 /** 5399 * Add extended data to the intent. The name must include a package 5400 * prefix, for example the app com.android.contacts would use names 5401 * like "com.android.contacts.ShowAll". 5402 * 5403 * @param name The name of the extra data, with package prefix. 5404 * @param value The int array data value. 5405 * 5406 * @return Returns the same Intent object, for chaining multiple calls 5407 * into a single statement. 5408 * 5409 * @see #putExtras 5410 * @see #removeExtra 5411 * @see #getIntArrayExtra(String) 5412 */ 5413 public Intent putExtra(String name, int[] value) { 5414 if (mExtras == null) { 5415 mExtras = new Bundle(); 5416 } 5417 mExtras.putIntArray(name, value); 5418 return this; 5419 } 5420 5421 /** 5422 * Add extended data to the intent. The name must include a package 5423 * prefix, for example the app com.android.contacts would use names 5424 * like "com.android.contacts.ShowAll". 5425 * 5426 * @param name The name of the extra data, with package prefix. 5427 * @param value The byte array data value. 5428 * 5429 * @return Returns the same Intent object, for chaining multiple calls 5430 * into a single statement. 5431 * 5432 * @see #putExtras 5433 * @see #removeExtra 5434 * @see #getLongArrayExtra(String) 5435 */ 5436 public Intent putExtra(String name, long[] value) { 5437 if (mExtras == null) { 5438 mExtras = new Bundle(); 5439 } 5440 mExtras.putLongArray(name, value); 5441 return this; 5442 } 5443 5444 /** 5445 * Add extended data to the intent. The name must include a package 5446 * prefix, for example the app com.android.contacts would use names 5447 * like "com.android.contacts.ShowAll". 5448 * 5449 * @param name The name of the extra data, with package prefix. 5450 * @param value The float array data value. 5451 * 5452 * @return Returns the same Intent object, for chaining multiple calls 5453 * into a single statement. 5454 * 5455 * @see #putExtras 5456 * @see #removeExtra 5457 * @see #getFloatArrayExtra(String) 5458 */ 5459 public Intent putExtra(String name, float[] value) { 5460 if (mExtras == null) { 5461 mExtras = new Bundle(); 5462 } 5463 mExtras.putFloatArray(name, value); 5464 return this; 5465 } 5466 5467 /** 5468 * Add extended data to the intent. The name must include a package 5469 * prefix, for example the app com.android.contacts would use names 5470 * like "com.android.contacts.ShowAll". 5471 * 5472 * @param name The name of the extra data, with package prefix. 5473 * @param value The double array data value. 5474 * 5475 * @return Returns the same Intent object, for chaining multiple calls 5476 * into a single statement. 5477 * 5478 * @see #putExtras 5479 * @see #removeExtra 5480 * @see #getDoubleArrayExtra(String) 5481 */ 5482 public Intent putExtra(String name, double[] value) { 5483 if (mExtras == null) { 5484 mExtras = new Bundle(); 5485 } 5486 mExtras.putDoubleArray(name, value); 5487 return this; 5488 } 5489 5490 /** 5491 * Add extended data to the intent. The name must include a package 5492 * prefix, for example the app com.android.contacts would use names 5493 * like "com.android.contacts.ShowAll". 5494 * 5495 * @param name The name of the extra data, with package prefix. 5496 * @param value The String array data value. 5497 * 5498 * @return Returns the same Intent object, for chaining multiple calls 5499 * into a single statement. 5500 * 5501 * @see #putExtras 5502 * @see #removeExtra 5503 * @see #getStringArrayExtra(String) 5504 */ 5505 public Intent putExtra(String name, String[] value) { 5506 if (mExtras == null) { 5507 mExtras = new Bundle(); 5508 } 5509 mExtras.putStringArray(name, value); 5510 return this; 5511 } 5512 5513 /** 5514 * Add extended data to the intent. The name must include a package 5515 * prefix, for example the app com.android.contacts would use names 5516 * like "com.android.contacts.ShowAll". 5517 * 5518 * @param name The name of the extra data, with package prefix. 5519 * @param value The CharSequence array data value. 5520 * 5521 * @return Returns the same Intent object, for chaining multiple calls 5522 * into a single statement. 5523 * 5524 * @see #putExtras 5525 * @see #removeExtra 5526 * @see #getCharSequenceArrayExtra(String) 5527 */ 5528 public Intent putExtra(String name, CharSequence[] value) { 5529 if (mExtras == null) { 5530 mExtras = new Bundle(); 5531 } 5532 mExtras.putCharSequenceArray(name, value); 5533 return this; 5534 } 5535 5536 /** 5537 * Add extended data to the intent. The name must include a package 5538 * prefix, for example the app com.android.contacts would use names 5539 * like "com.android.contacts.ShowAll". 5540 * 5541 * @param name The name of the extra data, with package prefix. 5542 * @param value The Bundle data value. 5543 * 5544 * @return Returns the same Intent object, for chaining multiple calls 5545 * into a single statement. 5546 * 5547 * @see #putExtras 5548 * @see #removeExtra 5549 * @see #getBundleExtra(String) 5550 */ 5551 public Intent putExtra(String name, Bundle value) { 5552 if (mExtras == null) { 5553 mExtras = new Bundle(); 5554 } 5555 mExtras.putBundle(name, value); 5556 return this; 5557 } 5558 5559 /** 5560 * Add extended data to the intent. The name must include a package 5561 * prefix, for example the app com.android.contacts would use names 5562 * like "com.android.contacts.ShowAll". 5563 * 5564 * @param name The name of the extra data, with package prefix. 5565 * @param value The IBinder data value. 5566 * 5567 * @return Returns the same Intent object, for chaining multiple calls 5568 * into a single statement. 5569 * 5570 * @see #putExtras 5571 * @see #removeExtra 5572 * @see #getIBinderExtra(String) 5573 * 5574 * @deprecated 5575 * @hide 5576 */ 5577 @Deprecated 5578 public Intent putExtra(String name, IBinder value) { 5579 if (mExtras == null) { 5580 mExtras = new Bundle(); 5581 } 5582 mExtras.putIBinder(name, value); 5583 return this; 5584 } 5585 5586 /** 5587 * Copy all extras in 'src' in to this intent. 5588 * 5589 * @param src Contains the extras to copy. 5590 * 5591 * @see #putExtra 5592 */ 5593 public Intent putExtras(Intent src) { 5594 if (src.mExtras != null) { 5595 if (mExtras == null) { 5596 mExtras = new Bundle(src.mExtras); 5597 } else { 5598 mExtras.putAll(src.mExtras); 5599 } 5600 } 5601 return this; 5602 } 5603 5604 /** 5605 * Add a set of extended data to the intent. The keys must include a package 5606 * prefix, for example the app com.android.contacts would use names 5607 * like "com.android.contacts.ShowAll". 5608 * 5609 * @param extras The Bundle of extras to add to this intent. 5610 * 5611 * @see #putExtra 5612 * @see #removeExtra 5613 */ 5614 public Intent putExtras(Bundle extras) { 5615 if (mExtras == null) { 5616 mExtras = new Bundle(); 5617 } 5618 mExtras.putAll(extras); 5619 return this; 5620 } 5621 5622 /** 5623 * Completely replace the extras in the Intent with the extras in the 5624 * given Intent. 5625 * 5626 * @param src The exact extras contained in this Intent are copied 5627 * into the target intent, replacing any that were previously there. 5628 */ 5629 public Intent replaceExtras(Intent src) { 5630 mExtras = src.mExtras != null ? new Bundle(src.mExtras) : null; 5631 return this; 5632 } 5633 5634 /** 5635 * Completely replace the extras in the Intent with the given Bundle of 5636 * extras. 5637 * 5638 * @param extras The new set of extras in the Intent, or null to erase 5639 * all extras. 5640 */ 5641 public Intent replaceExtras(Bundle extras) { 5642 mExtras = extras != null ? new Bundle(extras) : null; 5643 return this; 5644 } 5645 5646 /** 5647 * Remove extended data from the intent. 5648 * 5649 * @see #putExtra 5650 */ 5651 public void removeExtra(String name) { 5652 if (mExtras != null) { 5653 mExtras.remove(name); 5654 if (mExtras.size() == 0) { 5655 mExtras = null; 5656 } 5657 } 5658 } 5659 5660 /** 5661 * Set special flags controlling how this intent is handled. Most values 5662 * here depend on the type of component being executed by the Intent, 5663 * specifically the FLAG_ACTIVITY_* flags are all for use with 5664 * {@link Context#startActivity Context.startActivity()} and the 5665 * FLAG_RECEIVER_* flags are all for use with 5666 * {@link Context#sendBroadcast(Intent) Context.sendBroadcast()}. 5667 * 5668 * <p>See the 5669 * <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back 5670 * Stack</a> documentation for important information on how some of these options impact 5671 * the behavior of your application. 5672 * 5673 * @param flags The desired flags. 5674 * 5675 * @return Returns the same Intent object, for chaining multiple calls 5676 * into a single statement. 5677 * 5678 * @see #getFlags 5679 * @see #addFlags 5680 * 5681 * @see #FLAG_GRANT_READ_URI_PERMISSION 5682 * @see #FLAG_GRANT_WRITE_URI_PERMISSION 5683 * @see #FLAG_DEBUG_LOG_RESOLUTION 5684 * @see #FLAG_FROM_BACKGROUND 5685 * @see #FLAG_ACTIVITY_BROUGHT_TO_FRONT 5686 * @see #FLAG_ACTIVITY_CLEAR_TASK 5687 * @see #FLAG_ACTIVITY_CLEAR_TOP 5688 * @see #FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET 5689 * @see #FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS 5690 * @see #FLAG_ACTIVITY_FORWARD_RESULT 5691 * @see #FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY 5692 * @see #FLAG_ACTIVITY_MULTIPLE_TASK 5693 * @see #FLAG_ACTIVITY_NEW_TASK 5694 * @see #FLAG_ACTIVITY_NO_ANIMATION 5695 * @see #FLAG_ACTIVITY_NO_HISTORY 5696 * @see #FLAG_ACTIVITY_NO_USER_ACTION 5697 * @see #FLAG_ACTIVITY_PREVIOUS_IS_TOP 5698 * @see #FLAG_ACTIVITY_RESET_TASK_IF_NEEDED 5699 * @see #FLAG_ACTIVITY_REORDER_TO_FRONT 5700 * @see #FLAG_ACTIVITY_SINGLE_TOP 5701 * @see #FLAG_ACTIVITY_TASK_ON_HOME 5702 * @see #FLAG_RECEIVER_REGISTERED_ONLY 5703 */ 5704 public Intent setFlags(int flags) { 5705 mFlags = flags; 5706 return this; 5707 } 5708 5709 /** 5710 * Add additional flags to the intent (or with existing flags 5711 * value). 5712 * 5713 * @param flags The new flags to set. 5714 * 5715 * @return Returns the same Intent object, for chaining multiple calls 5716 * into a single statement. 5717 * 5718 * @see #setFlags 5719 */ 5720 public Intent addFlags(int flags) { 5721 mFlags |= flags; 5722 return this; 5723 } 5724 5725 /** 5726 * (Usually optional) Set an explicit application package name that limits 5727 * the components this Intent will resolve to. If left to the default 5728 * value of null, all components in all applications will considered. 5729 * If non-null, the Intent can only match the components in the given 5730 * application package. 5731 * 5732 * @param packageName The name of the application package to handle the 5733 * intent, or null to allow any application package. 5734 * 5735 * @return Returns the same Intent object, for chaining multiple calls 5736 * into a single statement. 5737 * 5738 * @see #getPackage 5739 * @see #resolveActivity 5740 */ 5741 public Intent setPackage(String packageName) { 5742 if (packageName != null && mSelector != null) { 5743 throw new IllegalArgumentException( 5744 "Can't set package name when selector is already set"); 5745 } 5746 mPackage = packageName; 5747 return this; 5748 } 5749 5750 /** 5751 * (Usually optional) Explicitly set the component to handle the intent. 5752 * If left with the default value of null, the system will determine the 5753 * appropriate class to use based on the other fields (action, data, 5754 * type, categories) in the Intent. If this class is defined, the 5755 * specified class will always be used regardless of the other fields. You 5756 * should only set this value when you know you absolutely want a specific 5757 * class to be used; otherwise it is better to let the system find the 5758 * appropriate class so that you will respect the installed applications 5759 * and user preferences. 5760 * 5761 * @param component The name of the application component to handle the 5762 * intent, or null to let the system find one for you. 5763 * 5764 * @return Returns the same Intent object, for chaining multiple calls 5765 * into a single statement. 5766 * 5767 * @see #setClass 5768 * @see #setClassName(Context, String) 5769 * @see #setClassName(String, String) 5770 * @see #getComponent 5771 * @see #resolveActivity 5772 */ 5773 public Intent setComponent(ComponentName component) { 5774 mComponent = component; 5775 return this; 5776 } 5777 5778 /** 5779 * Convenience for calling {@link #setComponent} with an 5780 * explicit class name. 5781 * 5782 * @param packageContext A Context of the application package implementing 5783 * this class. 5784 * @param className The name of a class inside of the application package 5785 * that will be used as the component for this Intent. 5786 * 5787 * @return Returns the same Intent object, for chaining multiple calls 5788 * into a single statement. 5789 * 5790 * @see #setComponent 5791 * @see #setClass 5792 */ 5793 public Intent setClassName(Context packageContext, String className) { 5794 mComponent = new ComponentName(packageContext, className); 5795 return this; 5796 } 5797 5798 /** 5799 * Convenience for calling {@link #setComponent} with an 5800 * explicit application package name and class name. 5801 * 5802 * @param packageName The name of the package implementing the desired 5803 * component. 5804 * @param className The name of a class inside of the application package 5805 * that will be used as the component for this Intent. 5806 * 5807 * @return Returns the same Intent object, for chaining multiple calls 5808 * into a single statement. 5809 * 5810 * @see #setComponent 5811 * @see #setClass 5812 */ 5813 public Intent setClassName(String packageName, String className) { 5814 mComponent = new ComponentName(packageName, className); 5815 return this; 5816 } 5817 5818 /** 5819 * Convenience for calling {@link #setComponent(ComponentName)} with the 5820 * name returned by a {@link Class} object. 5821 * 5822 * @param packageContext A Context of the application package implementing 5823 * this class. 5824 * @param cls The class name to set, equivalent to 5825 * <code>setClassName(context, cls.getName())</code>. 5826 * 5827 * @return Returns the same Intent object, for chaining multiple calls 5828 * into a single statement. 5829 * 5830 * @see #setComponent 5831 */ 5832 public Intent setClass(Context packageContext, Class<?> cls) { 5833 mComponent = new ComponentName(packageContext, cls); 5834 return this; 5835 } 5836 5837 /** 5838 * Set the bounds of the sender of this intent, in screen coordinates. This can be 5839 * used as a hint to the receiver for animations and the like. Null means that there 5840 * is no source bounds. 5841 */ 5842 public void setSourceBounds(Rect r) { 5843 if (r != null) { 5844 mSourceBounds = new Rect(r); 5845 } else { 5846 mSourceBounds = null; 5847 } 5848 } 5849 5850 /** 5851 * Use with {@link #fillIn} to allow the current action value to be 5852 * overwritten, even if it is already set. 5853 */ 5854 public static final int FILL_IN_ACTION = 1<<0; 5855 5856 /** 5857 * Use with {@link #fillIn} to allow the current data or type value 5858 * overwritten, even if it is already set. 5859 */ 5860 public static final int FILL_IN_DATA = 1<<1; 5861 5862 /** 5863 * Use with {@link #fillIn} to allow the current categories to be 5864 * overwritten, even if they are already set. 5865 */ 5866 public static final int FILL_IN_CATEGORIES = 1<<2; 5867 5868 /** 5869 * Use with {@link #fillIn} to allow the current component value to be 5870 * overwritten, even if it is already set. 5871 */ 5872 public static final int FILL_IN_COMPONENT = 1<<3; 5873 5874 /** 5875 * Use with {@link #fillIn} to allow the current package value to be 5876 * overwritten, even if it is already set. 5877 */ 5878 public static final int FILL_IN_PACKAGE = 1<<4; 5879 5880 /** 5881 * Use with {@link #fillIn} to allow the current bounds rectangle to be 5882 * overwritten, even if it is already set. 5883 */ 5884 public static final int FILL_IN_SOURCE_BOUNDS = 1<<5; 5885 5886 /** 5887 * Use with {@link #fillIn} to allow the current selector to be 5888 * overwritten, even if it is already set. 5889 */ 5890 public static final int FILL_IN_SELECTOR = 1<<6; 5891 5892 /** 5893 * Use with {@link #fillIn} to allow the current ClipData to be 5894 * overwritten, even if it is already set. 5895 */ 5896 public static final int FILL_IN_CLIP_DATA = 1<<7; 5897 5898 /** 5899 * Copy the contents of <var>other</var> in to this object, but only 5900 * where fields are not defined by this object. For purposes of a field 5901 * being defined, the following pieces of data in the Intent are 5902 * considered to be separate fields: 5903 * 5904 * <ul> 5905 * <li> action, as set by {@link #setAction}. 5906 * <li> data Uri and MIME type, as set by {@link #setData(Uri)}, 5907 * {@link #setType(String)}, or {@link #setDataAndType(Uri, String)}. 5908 * <li> categories, as set by {@link #addCategory}. 5909 * <li> package, as set by {@link #setPackage}. 5910 * <li> component, as set by {@link #setComponent(ComponentName)} or 5911 * related methods. 5912 * <li> source bounds, as set by {@link #setSourceBounds}. 5913 * <li> selector, as set by {@link #setSelector(Intent)}. 5914 * <li> clip data, as set by {@link #setClipData(ClipData)}. 5915 * <li> each top-level name in the associated extras. 5916 * </ul> 5917 * 5918 * <p>In addition, you can use the {@link #FILL_IN_ACTION}, 5919 * {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE}, 5920 * {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS}, 5921 * {@link #FILL_IN_SELECTOR}, and {@link #FILL_IN_CLIP_DATA} to override 5922 * the restriction where the corresponding field will not be replaced if 5923 * it is already set. 5924 * 5925 * <p>Note: The component field will only be copied if {@link #FILL_IN_COMPONENT} 5926 * is explicitly specified. The selector will only be copied if 5927 * {@link #FILL_IN_SELECTOR} is explicitly specified. 5928 * 5929 * <p>For example, consider Intent A with {data="foo", categories="bar"} 5930 * and Intent B with {action="gotit", data-type="some/thing", 5931 * categories="one","two"}. 5932 * 5933 * <p>Calling A.fillIn(B, Intent.FILL_IN_DATA) will result in A now 5934 * containing: {action="gotit", data-type="some/thing", 5935 * categories="bar"}. 5936 * 5937 * @param other Another Intent whose values are to be used to fill in 5938 * the current one. 5939 * @param flags Options to control which fields can be filled in. 5940 * 5941 * @return Returns a bit mask of {@link #FILL_IN_ACTION}, 5942 * {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE}, 5943 * {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS}, and 5944 * {@link #FILL_IN_SELECTOR} indicating which fields were changed. 5945 */ 5946 public int fillIn(Intent other, int flags) { 5947 int changes = 0; 5948 if (other.mAction != null 5949 && (mAction == null || (flags&FILL_IN_ACTION) != 0)) { 5950 mAction = other.mAction; 5951 changes |= FILL_IN_ACTION; 5952 } 5953 if ((other.mData != null || other.mType != null) 5954 && ((mData == null && mType == null) 5955 || (flags&FILL_IN_DATA) != 0)) { 5956 mData = other.mData; 5957 mType = other.mType; 5958 changes |= FILL_IN_DATA; 5959 } 5960 if (other.mCategories != null 5961 && (mCategories == null || (flags&FILL_IN_CATEGORIES) != 0)) { 5962 if (other.mCategories != null) { 5963 mCategories = new HashSet<String>(other.mCategories); 5964 } 5965 changes |= FILL_IN_CATEGORIES; 5966 } 5967 if (other.mPackage != null 5968 && (mPackage == null || (flags&FILL_IN_PACKAGE) != 0)) { 5969 // Only do this if mSelector is not set. 5970 if (mSelector == null) { 5971 mPackage = other.mPackage; 5972 changes |= FILL_IN_PACKAGE; 5973 } 5974 } 5975 // Selector is special: it can only be set if explicitly allowed, 5976 // for the same reason as the component name. 5977 if (other.mSelector != null && (flags&FILL_IN_SELECTOR) != 0) { 5978 if (mPackage == null) { 5979 mSelector = new Intent(other.mSelector); 5980 mPackage = null; 5981 changes |= FILL_IN_SELECTOR; 5982 } 5983 } 5984 if (other.mClipData != null 5985 && (mClipData == null || (flags&FILL_IN_CLIP_DATA) != 0)) { 5986 mClipData = other.mClipData; 5987 changes |= FILL_IN_CLIP_DATA; 5988 } 5989 // Component is special: it can -only- be set if explicitly allowed, 5990 // since otherwise the sender could force the intent somewhere the 5991 // originator didn't intend. 5992 if (other.mComponent != null && (flags&FILL_IN_COMPONENT) != 0) { 5993 mComponent = other.mComponent; 5994 changes |= FILL_IN_COMPONENT; 5995 } 5996 mFlags |= other.mFlags; 5997 if (other.mSourceBounds != null 5998 && (mSourceBounds == null || (flags&FILL_IN_SOURCE_BOUNDS) != 0)) { 5999 mSourceBounds = new Rect(other.mSourceBounds); 6000 changes |= FILL_IN_SOURCE_BOUNDS; 6001 } 6002 if (mExtras == null) { 6003 if (other.mExtras != null) { 6004 mExtras = new Bundle(other.mExtras); 6005 } 6006 } else if (other.mExtras != null) { 6007 try { 6008 Bundle newb = new Bundle(other.mExtras); 6009 newb.putAll(mExtras); 6010 mExtras = newb; 6011 } catch (RuntimeException e) { 6012 // Modifying the extras can cause us to unparcel the contents 6013 // of the bundle, and if we do this in the system process that 6014 // may fail. We really should handle this (i.e., the Bundle 6015 // impl shouldn't be on top of a plain map), but for now just 6016 // ignore it and keep the original contents. :( 6017 Log.w("Intent", "Failure filling in extras", e); 6018 } 6019 } 6020 return changes; 6021 } 6022 6023 /** 6024 * Wrapper class holding an Intent and implementing comparisons on it for 6025 * the purpose of filtering. The class implements its 6026 * {@link #equals equals()} and {@link #hashCode hashCode()} methods as 6027 * simple calls to {@link Intent#filterEquals(Intent)} filterEquals()} and 6028 * {@link android.content.Intent#filterHashCode()} filterHashCode()} 6029 * on the wrapped Intent. 6030 */ 6031 public static final class FilterComparison { 6032 private final Intent mIntent; 6033 private final int mHashCode; 6034 6035 public FilterComparison(Intent intent) { 6036 mIntent = intent; 6037 mHashCode = intent.filterHashCode(); 6038 } 6039 6040 /** 6041 * Return the Intent that this FilterComparison represents. 6042 * @return Returns the Intent held by the FilterComparison. Do 6043 * not modify! 6044 */ 6045 public Intent getIntent() { 6046 return mIntent; 6047 } 6048 6049 @Override 6050 public boolean equals(Object obj) { 6051 if (obj instanceof FilterComparison) { 6052 Intent other = ((FilterComparison)obj).mIntent; 6053 return mIntent.filterEquals(other); 6054 } 6055 return false; 6056 } 6057 6058 @Override 6059 public int hashCode() { 6060 return mHashCode; 6061 } 6062 } 6063 6064 /** 6065 * Determine if two intents are the same for the purposes of intent 6066 * resolution (filtering). That is, if their action, data, type, 6067 * class, and categories are the same. This does <em>not</em> compare 6068 * any extra data included in the intents. 6069 * 6070 * @param other The other Intent to compare against. 6071 * 6072 * @return Returns true if action, data, type, class, and categories 6073 * are the same. 6074 */ 6075 public boolean filterEquals(Intent other) { 6076 if (other == null) { 6077 return false; 6078 } 6079 if (mAction != other.mAction) { 6080 if (mAction != null) { 6081 if (!mAction.equals(other.mAction)) { 6082 return false; 6083 } 6084 } else { 6085 if (!other.mAction.equals(mAction)) { 6086 return false; 6087 } 6088 } 6089 } 6090 if (mData != other.mData) { 6091 if (mData != null) { 6092 if (!mData.equals(other.mData)) { 6093 return false; 6094 } 6095 } else { 6096 if (!other.mData.equals(mData)) { 6097 return false; 6098 } 6099 } 6100 } 6101 if (mType != other.mType) { 6102 if (mType != null) { 6103 if (!mType.equals(other.mType)) { 6104 return false; 6105 } 6106 } else { 6107 if (!other.mType.equals(mType)) { 6108 return false; 6109 } 6110 } 6111 } 6112 if (mPackage != other.mPackage) { 6113 if (mPackage != null) { 6114 if (!mPackage.equals(other.mPackage)) { 6115 return false; 6116 } 6117 } else { 6118 if (!other.mPackage.equals(mPackage)) { 6119 return false; 6120 } 6121 } 6122 } 6123 if (mComponent != other.mComponent) { 6124 if (mComponent != null) { 6125 if (!mComponent.equals(other.mComponent)) { 6126 return false; 6127 } 6128 } else { 6129 if (!other.mComponent.equals(mComponent)) { 6130 return false; 6131 } 6132 } 6133 } 6134 if (mCategories != other.mCategories) { 6135 if (mCategories != null) { 6136 if (!mCategories.equals(other.mCategories)) { 6137 return false; 6138 } 6139 } else { 6140 if (!other.mCategories.equals(mCategories)) { 6141 return false; 6142 } 6143 } 6144 } 6145 6146 return true; 6147 } 6148 6149 /** 6150 * Generate hash code that matches semantics of filterEquals(). 6151 * 6152 * @return Returns the hash value of the action, data, type, class, and 6153 * categories. 6154 * 6155 * @see #filterEquals 6156 */ 6157 public int filterHashCode() { 6158 int code = 0; 6159 if (mAction != null) { 6160 code += mAction.hashCode(); 6161 } 6162 if (mData != null) { 6163 code += mData.hashCode(); 6164 } 6165 if (mType != null) { 6166 code += mType.hashCode(); 6167 } 6168 if (mPackage != null) { 6169 code += mPackage.hashCode(); 6170 } 6171 if (mComponent != null) { 6172 code += mComponent.hashCode(); 6173 } 6174 if (mCategories != null) { 6175 code += mCategories.hashCode(); 6176 } 6177 return code; 6178 } 6179 6180 @Override 6181 public String toString() { 6182 StringBuilder b = new StringBuilder(128); 6183 6184 b.append("Intent { "); 6185 toShortString(b, true, true, true, false); 6186 b.append(" }"); 6187 6188 return b.toString(); 6189 } 6190 6191 /** @hide */ 6192 public String toInsecureString() { 6193 StringBuilder b = new StringBuilder(128); 6194 6195 b.append("Intent { "); 6196 toShortString(b, false, true, true, false); 6197 b.append(" }"); 6198 6199 return b.toString(); 6200 } 6201 6202 /** @hide */ 6203 public String toInsecureStringWithClip() { 6204 StringBuilder b = new StringBuilder(128); 6205 6206 b.append("Intent { "); 6207 toShortString(b, false, true, true, true); 6208 b.append(" }"); 6209 6210 return b.toString(); 6211 } 6212 6213 /** @hide */ 6214 public String toShortString(boolean secure, boolean comp, boolean extras, boolean clip) { 6215 StringBuilder b = new StringBuilder(128); 6216 toShortString(b, secure, comp, extras, clip); 6217 return b.toString(); 6218 } 6219 6220 /** @hide */ 6221 public void toShortString(StringBuilder b, boolean secure, boolean comp, boolean extras, 6222 boolean clip) { 6223 boolean first = true; 6224 if (mAction != null) { 6225 b.append("act=").append(mAction); 6226 first = false; 6227 } 6228 if (mCategories != null) { 6229 if (!first) { 6230 b.append(' '); 6231 } 6232 first = false; 6233 b.append("cat=["); 6234 Iterator<String> i = mCategories.iterator(); 6235 boolean didone = false; 6236 while (i.hasNext()) { 6237 if (didone) b.append(","); 6238 didone = true; 6239 b.append(i.next()); 6240 } 6241 b.append("]"); 6242 } 6243 if (mData != null) { 6244 if (!first) { 6245 b.append(' '); 6246 } 6247 first = false; 6248 b.append("dat="); 6249 if (secure) { 6250 b.append(mData.toSafeString()); 6251 } else { 6252 b.append(mData); 6253 } 6254 } 6255 if (mType != null) { 6256 if (!first) { 6257 b.append(' '); 6258 } 6259 first = false; 6260 b.append("typ=").append(mType); 6261 } 6262 if (mFlags != 0) { 6263 if (!first) { 6264 b.append(' '); 6265 } 6266 first = false; 6267 b.append("flg=0x").append(Integer.toHexString(mFlags)); 6268 } 6269 if (mPackage != null) { 6270 if (!first) { 6271 b.append(' '); 6272 } 6273 first = false; 6274 b.append("pkg=").append(mPackage); 6275 } 6276 if (comp && mComponent != null) { 6277 if (!first) { 6278 b.append(' '); 6279 } 6280 first = false; 6281 b.append("cmp=").append(mComponent.flattenToShortString()); 6282 } 6283 if (mSourceBounds != null) { 6284 if (!first) { 6285 b.append(' '); 6286 } 6287 first = false; 6288 b.append("bnds=").append(mSourceBounds.toShortString()); 6289 } 6290 if (mClipData != null) { 6291 if (!first) { 6292 b.append(' '); 6293 } 6294 first = false; 6295 if (clip) { 6296 b.append("clip={"); 6297 mClipData.toShortString(b); 6298 b.append('}'); 6299 } else { 6300 b.append("(has clip)"); 6301 } 6302 } 6303 if (extras && mExtras != null) { 6304 if (!first) { 6305 b.append(' '); 6306 } 6307 first = false; 6308 b.append("(has extras)"); 6309 } 6310 if (mSelector != null) { 6311 b.append(" sel={"); 6312 mSelector.toShortString(b, secure, comp, extras, clip); 6313 b.append("}"); 6314 } 6315 } 6316 6317 /** 6318 * Call {@link #toUri} with 0 flags. 6319 * @deprecated Use {@link #toUri} instead. 6320 */ 6321 @Deprecated 6322 public String toURI() { 6323 return toUri(0); 6324 } 6325 6326 /** 6327 * Convert this Intent into a String holding a URI representation of it. 6328 * The returned URI string has been properly URI encoded, so it can be 6329 * used with {@link Uri#parse Uri.parse(String)}. The URI contains the 6330 * Intent's data as the base URI, with an additional fragment describing 6331 * the action, categories, type, flags, package, component, and extras. 6332 * 6333 * <p>You can convert the returned string back to an Intent with 6334 * {@link #getIntent}. 6335 * 6336 * @param flags Additional operating flags. Either 0 or 6337 * {@link #URI_INTENT_SCHEME}. 6338 * 6339 * @return Returns a URI encoding URI string describing the entire contents 6340 * of the Intent. 6341 */ 6342 public String toUri(int flags) { 6343 StringBuilder uri = new StringBuilder(128); 6344 String scheme = null; 6345 if (mData != null) { 6346 String data = mData.toString(); 6347 if ((flags&URI_INTENT_SCHEME) != 0) { 6348 final int N = data.length(); 6349 for (int i=0; i<N; i++) { 6350 char c = data.charAt(i); 6351 if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') 6352 || c == '.' || c == '-') { 6353 continue; 6354 } 6355 if (c == ':' && i > 0) { 6356 // Valid scheme. 6357 scheme = data.substring(0, i); 6358 uri.append("intent:"); 6359 data = data.substring(i+1); 6360 break; 6361 } 6362 6363 // No scheme. 6364 break; 6365 } 6366 } 6367 uri.append(data); 6368 6369 } else if ((flags&URI_INTENT_SCHEME) != 0) { 6370 uri.append("intent:"); 6371 } 6372 6373 uri.append("#Intent;"); 6374 6375 toUriInner(uri, scheme, flags); 6376 if (mSelector != null) { 6377 uri.append("SEL;"); 6378 // Note that for now we are not going to try to handle the 6379 // data part; not clear how to represent this as a URI, and 6380 // not much utility in it. 6381 mSelector.toUriInner(uri, null, flags); 6382 } 6383 6384 uri.append("end"); 6385 6386 return uri.toString(); 6387 } 6388 6389 private void toUriInner(StringBuilder uri, String scheme, int flags) { 6390 if (scheme != null) { 6391 uri.append("scheme=").append(scheme).append(';'); 6392 } 6393 if (mAction != null) { 6394 uri.append("action=").append(Uri.encode(mAction)).append(';'); 6395 } 6396 if (mCategories != null) { 6397 for (String category : mCategories) { 6398 uri.append("category=").append(Uri.encode(category)).append(';'); 6399 } 6400 } 6401 if (mType != null) { 6402 uri.append("type=").append(Uri.encode(mType, "/")).append(';'); 6403 } 6404 if (mFlags != 0) { 6405 uri.append("launchFlags=0x").append(Integer.toHexString(mFlags)).append(';'); 6406 } 6407 if (mPackage != null) { 6408 uri.append("package=").append(Uri.encode(mPackage)).append(';'); 6409 } 6410 if (mComponent != null) { 6411 uri.append("component=").append(Uri.encode( 6412 mComponent.flattenToShortString(), "/")).append(';'); 6413 } 6414 if (mSourceBounds != null) { 6415 uri.append("sourceBounds=") 6416 .append(Uri.encode(mSourceBounds.flattenToString())) 6417 .append(';'); 6418 } 6419 if (mExtras != null) { 6420 for (String key : mExtras.keySet()) { 6421 final Object value = mExtras.get(key); 6422 char entryType = 6423 value instanceof String ? 'S' : 6424 value instanceof Boolean ? 'B' : 6425 value instanceof Byte ? 'b' : 6426 value instanceof Character ? 'c' : 6427 value instanceof Double ? 'd' : 6428 value instanceof Float ? 'f' : 6429 value instanceof Integer ? 'i' : 6430 value instanceof Long ? 'l' : 6431 value instanceof Short ? 's' : 6432 '\0'; 6433 6434 if (entryType != '\0') { 6435 uri.append(entryType); 6436 uri.append('.'); 6437 uri.append(Uri.encode(key)); 6438 uri.append('='); 6439 uri.append(Uri.encode(value.toString())); 6440 uri.append(';'); 6441 } 6442 } 6443 } 6444 } 6445 6446 public int describeContents() { 6447 return (mExtras != null) ? mExtras.describeContents() : 0; 6448 } 6449 6450 public void writeToParcel(Parcel out, int flags) { 6451 out.writeString(mAction); 6452 Uri.writeToParcel(out, mData); 6453 out.writeString(mType); 6454 out.writeInt(mFlags); 6455 out.writeString(mPackage); 6456 ComponentName.writeToParcel(mComponent, out); 6457 6458 if (mSourceBounds != null) { 6459 out.writeInt(1); 6460 mSourceBounds.writeToParcel(out, flags); 6461 } else { 6462 out.writeInt(0); 6463 } 6464 6465 if (mCategories != null) { 6466 out.writeInt(mCategories.size()); 6467 for (String category : mCategories) { 6468 out.writeString(category); 6469 } 6470 } else { 6471 out.writeInt(0); 6472 } 6473 6474 if (mSelector != null) { 6475 out.writeInt(1); 6476 mSelector.writeToParcel(out, flags); 6477 } else { 6478 out.writeInt(0); 6479 } 6480 6481 if (mClipData != null) { 6482 out.writeInt(1); 6483 mClipData.writeToParcel(out, flags); 6484 } else { 6485 out.writeInt(0); 6486 } 6487 6488 out.writeBundle(mExtras); 6489 } 6490 6491 public static final Parcelable.Creator<Intent> CREATOR 6492 = new Parcelable.Creator<Intent>() { 6493 public Intent createFromParcel(Parcel in) { 6494 return new Intent(in); 6495 } 6496 public Intent[] newArray(int size) { 6497 return new Intent[size]; 6498 } 6499 }; 6500 6501 /** @hide */ 6502 protected Intent(Parcel in) { 6503 readFromParcel(in); 6504 } 6505 6506 public void readFromParcel(Parcel in) { 6507 setAction(in.readString()); 6508 mData = Uri.CREATOR.createFromParcel(in); 6509 mType = in.readString(); 6510 mFlags = in.readInt(); 6511 mPackage = in.readString(); 6512 mComponent = ComponentName.readFromParcel(in); 6513 6514 if (in.readInt() != 0) { 6515 mSourceBounds = Rect.CREATOR.createFromParcel(in); 6516 } 6517 6518 int N = in.readInt(); 6519 if (N > 0) { 6520 mCategories = new HashSet<String>(); 6521 int i; 6522 for (i=0; i<N; i++) { 6523 mCategories.add(in.readString().intern()); 6524 } 6525 } else { 6526 mCategories = null; 6527 } 6528 6529 if (in.readInt() != 0) { 6530 mSelector = new Intent(in); 6531 } 6532 6533 if (in.readInt() != 0) { 6534 mClipData = new ClipData(in); 6535 } 6536 6537 mExtras = in.readBundle(); 6538 } 6539 6540 /** 6541 * Parses the "intent" element (and its children) from XML and instantiates 6542 * an Intent object. The given XML parser should be located at the tag 6543 * where parsing should start (often named "intent"), from which the 6544 * basic action, data, type, and package and class name will be 6545 * retrieved. The function will then parse in to any child elements, 6546 * looking for <category android:name="xxx"> tags to add categories and 6547 * <extra android:name="xxx" android:value="yyy"> to attach extra data 6548 * to the intent. 6549 * 6550 * @param resources The Resources to use when inflating resources. 6551 * @param parser The XML parser pointing at an "intent" tag. 6552 * @param attrs The AttributeSet interface for retrieving extended 6553 * attribute data at the current <var>parser</var> location. 6554 * @return An Intent object matching the XML data. 6555 * @throws XmlPullParserException If there was an XML parsing error. 6556 * @throws IOException If there was an I/O error. 6557 */ 6558 public static Intent parseIntent(Resources resources, XmlPullParser parser, AttributeSet attrs) 6559 throws XmlPullParserException, IOException { 6560 Intent intent = new Intent(); 6561 6562 TypedArray sa = resources.obtainAttributes(attrs, 6563 com.android.internal.R.styleable.Intent); 6564 6565 intent.setAction(sa.getString(com.android.internal.R.styleable.Intent_action)); 6566 6567 String data = sa.getString(com.android.internal.R.styleable.Intent_data); 6568 String mimeType = sa.getString(com.android.internal.R.styleable.Intent_mimeType); 6569 intent.setDataAndType(data != null ? Uri.parse(data) : null, mimeType); 6570 6571 String packageName = sa.getString(com.android.internal.R.styleable.Intent_targetPackage); 6572 String className = sa.getString(com.android.internal.R.styleable.Intent_targetClass); 6573 if (packageName != null && className != null) { 6574 intent.setComponent(new ComponentName(packageName, className)); 6575 } 6576 6577 sa.recycle(); 6578 6579 int outerDepth = parser.getDepth(); 6580 int type; 6581 while ((type=parser.next()) != XmlPullParser.END_DOCUMENT 6582 && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) { 6583 if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) { 6584 continue; 6585 } 6586 6587 String nodeName = parser.getName(); 6588 if (nodeName.equals("category")) { 6589 sa = resources.obtainAttributes(attrs, 6590 com.android.internal.R.styleable.IntentCategory); 6591 String cat = sa.getString(com.android.internal.R.styleable.IntentCategory_name); 6592 sa.recycle(); 6593 6594 if (cat != null) { 6595 intent.addCategory(cat); 6596 } 6597 XmlUtils.skipCurrentTag(parser); 6598 6599 } else if (nodeName.equals("extra")) { 6600 if (intent.mExtras == null) { 6601 intent.mExtras = new Bundle(); 6602 } 6603 resources.parseBundleExtra("extra", attrs, intent.mExtras); 6604 XmlUtils.skipCurrentTag(parser); 6605 6606 } else { 6607 XmlUtils.skipCurrentTag(parser); 6608 } 6609 } 6610 6611 return intent; 6612 } 6613 6614 /** 6615 * Normalize a MIME data type. 6616 * 6617 * <p>A normalized MIME type has white-space trimmed, 6618 * content-type parameters removed, and is lower-case. 6619 * This aligns the type with Android best practices for 6620 * intent filtering. 6621 * 6622 * <p>For example, "text/plain; charset=utf-8" becomes "text/plain". 6623 * "text/x-vCard" becomes "text/x-vcard". 6624 * 6625 * <p>All MIME types received from outside Android (such as user input, 6626 * or external sources like Bluetooth, NFC, or the Internet) should 6627 * be normalized before they are used to create an Intent. 6628 * 6629 * @param type MIME data type to normalize 6630 * @return normalized MIME data type, or null if the input was null 6631 * @see {@link #setType} 6632 * @see {@link #setTypeAndNormalize} 6633 */ 6634 public static String normalizeMimeType(String type) { 6635 if (type == null) { 6636 return null; 6637 } 6638 6639 type = type.trim().toLowerCase(Locale.US); 6640 6641 final int semicolonIndex = type.indexOf(';'); 6642 if (semicolonIndex != -1) { 6643 type = type.substring(0, semicolonIndex); 6644 } 6645 return type; 6646 } 6647 6648 /** 6649 * Migrate any {@link #EXTRA_STREAM} in {@link #ACTION_SEND} and 6650 * {@link #ACTION_SEND_MULTIPLE} to {@link ClipData}. Also inspects nested 6651 * intents in {@link #ACTION_CHOOSER}. 6652 * 6653 * @return Whether any contents were migrated. 6654 * @hide 6655 */ 6656 public boolean migrateExtraStreamToClipData() { 6657 // Refuse to touch if extras already parcelled 6658 if (mExtras != null && mExtras.isParcelled()) return false; 6659 6660 // Bail when someone already gave us ClipData 6661 if (getClipData() != null) return false; 6662 6663 final String action = getAction(); 6664 if (ACTION_CHOOSER.equals(action)) { 6665 try { 6666 // Inspect target intent to see if we need to migrate 6667 final Intent target = getParcelableExtra(EXTRA_INTENT); 6668 if (target != null && target.migrateExtraStreamToClipData()) { 6669 // Since we migrated in child, we need to promote ClipData 6670 // and flags to ourselves to grant. 6671 setClipData(target.getClipData()); 6672 addFlags(target.getFlags() 6673 & (FLAG_GRANT_READ_URI_PERMISSION | FLAG_GRANT_WRITE_URI_PERMISSION)); 6674 return true; 6675 } else { 6676 return false; 6677 } 6678 } catch (ClassCastException e) { 6679 } 6680 6681 } else if (ACTION_SEND.equals(action)) { 6682 try { 6683 final Uri stream = getParcelableExtra(EXTRA_STREAM); 6684 final CharSequence text = getCharSequenceExtra(EXTRA_TEXT); 6685 final String htmlText = getStringExtra(EXTRA_HTML_TEXT); 6686 if (stream != null || text != null || htmlText != null) { 6687 final ClipData clipData = new ClipData( 6688 null, new String[] { getType() }, 6689 new ClipData.Item(text, htmlText, null, stream)); 6690 setClipData(clipData); 6691 addFlags(FLAG_GRANT_READ_URI_PERMISSION); 6692 return true; 6693 } 6694 } catch (ClassCastException e) { 6695 } 6696 6697 } else if (ACTION_SEND_MULTIPLE.equals(action)) { 6698 try { 6699 final ArrayList<Uri> streams = getParcelableArrayListExtra(EXTRA_STREAM); 6700 final ArrayList<CharSequence> texts = getCharSequenceArrayListExtra(EXTRA_TEXT); 6701 final ArrayList<String> htmlTexts = getStringArrayListExtra(EXTRA_HTML_TEXT); 6702 int num = -1; 6703 if (streams != null) { 6704 num = streams.size(); 6705 } 6706 if (texts != null) { 6707 if (num >= 0 && num != texts.size()) { 6708 // Wha...! F- you. 6709 return false; 6710 } 6711 num = texts.size(); 6712 } 6713 if (htmlTexts != null) { 6714 if (num >= 0 && num != htmlTexts.size()) { 6715 // Wha...! F- you. 6716 return false; 6717 } 6718 num = htmlTexts.size(); 6719 } 6720 if (num > 0) { 6721 final ClipData clipData = new ClipData( 6722 null, new String[] { getType() }, 6723 makeClipItem(streams, texts, htmlTexts, 0)); 6724 6725 for (int i = 1; i < num; i++) { 6726 clipData.addItem(makeClipItem(streams, texts, htmlTexts, i)); 6727 } 6728 6729 setClipData(clipData); 6730 addFlags(FLAG_GRANT_READ_URI_PERMISSION); 6731 return true; 6732 } 6733 } catch (ClassCastException e) { 6734 } 6735 } 6736 6737 return false; 6738 } 6739 6740 private static ClipData.Item makeClipItem(ArrayList<Uri> streams, ArrayList<CharSequence> texts, 6741 ArrayList<String> htmlTexts, int which) { 6742 Uri uri = streams != null ? streams.get(which) : null; 6743 CharSequence text = texts != null ? texts.get(which) : null; 6744 String htmlText = htmlTexts != null ? htmlTexts.get(which) : null; 6745 return new ClipData.Item(text, htmlText, null, uri); 6746 } 6747} 6748