diff --git a/api/current.txt b/api/current.txt index 652ee890112d3..3e2b546869ebc 100644 --- a/api/current.txt +++ b/api/current.txt @@ -62,21 +62,17 @@ package android { field public static final java.lang.String INJECT_EVENTS = "android.permission.INJECT_EVENTS"; field public static final java.lang.String INSTALL_LOCATION_PROVIDER = "android.permission.INSTALL_LOCATION_PROVIDER"; field public static final java.lang.String INSTALL_PACKAGES = "android.permission.INSTALL_PACKAGES"; - field public static final java.lang.String INTERACT_ACROSS_USERS = "android.permission.INTERACT_ACROSS_USERS"; field public static final java.lang.String INTERNAL_SYSTEM_WINDOW = "android.permission.INTERNAL_SYSTEM_WINDOW"; field public static final java.lang.String INTERNET = "android.permission.INTERNET"; field public static final java.lang.String KILL_BACKGROUND_PROCESSES = "android.permission.KILL_BACKGROUND_PROCESSES"; field public static final java.lang.String MANAGE_ACCOUNTS = "android.permission.MANAGE_ACCOUNTS"; field public static final java.lang.String MANAGE_APP_TOKENS = "android.permission.MANAGE_APP_TOKENS"; - field public static final java.lang.String MANAGE_USERS = "android.permission.MANAGE_USERS"; field public static final java.lang.String MASTER_CLEAR = "android.permission.MASTER_CLEAR"; field public static final java.lang.String MODIFY_AUDIO_SETTINGS = "android.permission.MODIFY_AUDIO_SETTINGS"; field public static final java.lang.String MODIFY_PHONE_STATE = "android.permission.MODIFY_PHONE_STATE"; field public static final java.lang.String MOUNT_FORMAT_FILESYSTEMS = "android.permission.MOUNT_FORMAT_FILESYSTEMS"; field public static final java.lang.String MOUNT_UNMOUNT_FILESYSTEMS = "android.permission.MOUNT_UNMOUNT_FILESYSTEMS"; - field public static final java.lang.String NET_TUNNELING = "android.permission.NET_TUNNELING"; field public static final java.lang.String NFC = "android.permission.NFC"; - field public static final java.lang.String PACKAGE_VERIFICATION_AGENT = "android.permission.PACKAGE_VERIFICATION_AGENT"; field public static final deprecated java.lang.String PERSISTENT_ACTIVITY = "android.permission.PERSISTENT_ACTIVITY"; field public static final java.lang.String PROCESS_OUTGOING_CALLS = "android.permission.PROCESS_OUTGOING_CALLS"; field public static final java.lang.String READ_CALENDAR = "android.permission.READ_CALENDAR"; @@ -3901,11 +3897,12 @@ package android.app { method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int); method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int, android.os.Bundle); method public static android.app.PendingIntent getBroadcast(android.content.Context, int, android.content.Intent, int); + method public java.lang.String getCreatorPackage(); + method public int getCreatorUid(); + method public android.os.UserHandle getCreatorUserHandle(); method public android.content.IntentSender getIntentSender(); method public static android.app.PendingIntent getService(android.content.Context, int, android.content.Intent, int); - method public java.lang.String getTargetPackage(); - method public int getTargetUid(); - method public android.os.UserHandle getTargetUserHandle(); + method public deprecated java.lang.String getTargetPackage(); method public static android.app.PendingIntent readPendingIntentOrNullFromParcel(android.os.Parcel); method public void send() throws android.app.PendingIntent.CanceledException; method public void send(int) throws android.app.PendingIntent.CanceledException; @@ -6060,9 +6057,10 @@ package android.content { public class IntentSender implements android.os.Parcelable { method public int describeContents(); - method public java.lang.String getTargetPackage(); - method public int getTargetUid(); - method public android.os.UserHandle getTargetUserHandle(); + method public java.lang.String getCreatorPackage(); + method public int getCreatorUid(); + method public android.os.UserHandle getCreatorUserHandle(); + method public deprecated java.lang.String getTargetPackage(); method public static android.content.IntentSender readIntentSenderOrNullFromParcel(android.os.Parcel); method public void sendIntent(android.content.Context, int, android.content.Intent, android.content.IntentSender.OnFinished, android.os.Handler) throws android.content.IntentSender.SendIntentException; method public void sendIntent(android.content.Context, int, android.content.Intent, android.content.IntentSender.OnFinished, android.os.Handler, java.lang.String) throws android.content.IntentSender.SendIntentException; @@ -6705,17 +6703,6 @@ package android.content.pm { field public java.lang.String packageName; } - public class PackageUserState { - ctor public PackageUserState(); - ctor public PackageUserState(android.content.pm.PackageUserState); - field public java.util.HashSet disabledComponents; - field public int enabled; - field public java.util.HashSet enabledComponents; - field public boolean installed; - field public boolean notLaunched; - field public boolean stopped; - } - public class PathPermission extends android.os.PatternMatcher { ctor public PathPermission(java.lang.String, int, java.lang.String, java.lang.String); ctor public PathPermission(android.os.Parcel); diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java index a3c1838c3e9fd..e7cea570ae5de 100644 --- a/core/java/android/app/PendingIntent.java +++ b/core/java/android/app/PendingIntent.java @@ -32,8 +32,8 @@ import android.util.AndroidException; /** * A description of an Intent and target action to perform with it. Instances - * of this class are created with {@link #getActivity}, - * {@link #getBroadcast}, {@link #getService}; the returned object can be + * of this class are created with {@link #getActivity}, {@link #getActivities}, + * {@link #getBroadcast}, and {@link #getService}; the returned object can be * handed to other applications so that they can perform the action you * described on your behalf at a later time. * @@ -54,6 +54,34 @@ import android.util.AndroidException; * categories, and components, and same flags), it will receive a PendingIntent * representing the same token if that is still valid, and can thus call * {@link #cancel} to remove it. + * + *
Because of this behavior, it is important to know when two Intents + * are considered to be the same for purposes of retrieving a PendingIntent. + * A common mistake people make is to create multiple PendingIntent objects + * with Intents that only vary in their "extra" contents, expecting to get + * a different PendingIntent each time. This does not happen. The + * parts of the Intent that are used for matching are the same ones defined + * by {@link Intent#filterEquals(Intent) Intent.filterEquals}. If you use two + * Intent objects that are equivalent as per + * {@link Intent#filterEquals(Intent) Intent.filterEquals}, then you will get + * the same PendingIntent for both of them. + * + *
There are two typical ways to deal with this. + * + *
If you truly need multiple distinct PendingIntent objects active at + * the same time (such as to use as two notifications that are both shown + * at the same time), then you will need to ensure there is something that + * is different about them to associate them with different PendingIntents. + * This may be any of the Intent attributes considered by + * {@link Intent#filterEquals(Intent) Intent.filterEquals}, or different + * request code integers supplied to {@link #getActivity}, {@link #getActivities}, + * {@link #getBroadcast}, or {@link #getService}. + * + *
If you only need one PendingIntent active at a time for any of the + * Intents you will use, then you can alternatively use the flags + * {@link #FLAG_CANCEL_CURRENT} or {@link #FLAG_UPDATE_CURRENT} to either + * cancel or modify whatever current PendingIntent is associated with the + * Intent you are supplying. */ public final class PendingIntent implements Parcelable { private final IIntentSender mTarget; @@ -621,6 +649,20 @@ public final class PendingIntent implements Parcelable { } } + /** + * @deprecated Renamed to {@link #getCreatorPackage()}. + */ + @Deprecated + public String getTargetPackage() { + try { + return ActivityManagerNative.getDefault() + .getPackageForIntentSender(mTarget); + } catch (RemoteException e) { + // Should never happen. + return null; + } + } + /** * Return the package name of the application that created this * PendingIntent, that is the identity under which you will actually be @@ -630,7 +672,7 @@ public final class PendingIntent implements Parcelable { * @return The package name of the PendingIntent, or null if there is * none associated with it. */ - public String getTargetPackage() { + public String getCreatorPackage() { try { return ActivityManagerNative.getDefault() .getPackageForIntentSender(mTarget); @@ -649,7 +691,7 @@ public final class PendingIntent implements Parcelable { * @return The uid of the PendingIntent, or -1 if there is * none associated with it. */ - public int getTargetUid() { + public int getCreatorUid() { try { return ActivityManagerNative.getDefault() .getUidForIntentSender(mTarget); @@ -670,7 +712,7 @@ public final class PendingIntent implements Parcelable { * @return The user handle of the PendingIntent, or null if there is * none associated with it. */ - public UserHandle getTargetUserHandle() { + public UserHandle getCreatorUserHandle() { try { int uid = ActivityManagerNative.getDefault() .getUidForIntentSender(mTarget); diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 7438ba8314da4..161670fa95b12 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -856,8 +856,10 @@ public abstract class Context { public abstract void startActivity(Intent intent); /** - * Same as {@link #startActivity(Intent)}, but for a specific user. It requires holding - * the {@link android.Manifest.permission#INTERACT_ACROSS_USERS_FULL} permission. + * Version of {@link #startActivity(Intent)} that allows you to specify the + * user the activity will be started for. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS_FULL permission. * @param intent The description of the activity to start. * @param user The UserHandle of the user to start this activity for. * @throws ActivityNotFoundException @@ -895,8 +897,10 @@ public abstract class Context { public abstract void startActivity(Intent intent, Bundle options); /** - * Same as {@link #startActivity(Intent, Bundle)}, but for a specific user. It requires holding - * the {@link android.Manifest.permission#INTERACT_ACROSS_USERS_FULL} permission. + * Version of {@link #startActivity(Intent, Bundle)} that allows you to specify the + * user the activity will be started for. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS_FULL permission. * @param intent The description of the activity to start. * @param options Additional options for how the Activity should be started. * May be null if there are no options. See {@link android.app.ActivityOptions} @@ -1118,10 +1122,10 @@ public abstract class Context { Bundle initialExtras); /** - * Same as {@link #sendBroadcast(Intent)}, but for a specific user. This broadcast - * can only be sent to receivers that are part of the calling application. It - * requires holding the {@link android.Manifest.permission#INTERACT_ACROSS_USERS} - * permission. + * Version of {@link #sendBroadcast(Intent)} that allows you to specify the + * user the broadcast will be sent to. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS permission. * @param intent The intent to broadcast * @param user UserHandle to send the intent to. * @see #sendBroadcast(Intent) @@ -1129,10 +1133,10 @@ public abstract class Context { public abstract void sendBroadcastAsUser(Intent intent, UserHandle user); /** - * Same as {@link #sendBroadcast(Intent, String)}, but for a specific user. This broadcast - * can only be sent to receivers that are part of the calling application. It - * requires holding the {@link android.Manifest.permission#INTERACT_ACROSS_USERS} - * permission. + * Version of {@link #sendBroadcast(Intent, String)} that allows you to specify the + * user the broadcast will be sent to. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS permission. * * @param intent The Intent to broadcast; all receivers matching this * Intent will receive the broadcast. @@ -1147,12 +1151,12 @@ public abstract class Context { String receiverPermission); /** - * Same as - * {@link #sendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, int, String, Bundle)}, - * but for a specific user. This broadcast - * can only be sent to receivers that are part of the calling application. It - * requires holding the {@link android.Manifest.permission#INTERACT_ACROSS_USERS} - * permission. + * Version of + * {@link #sendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, int, String, Bundle)} + * that allows you to specify the + * user the broadcast will be sent to. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS permission. * *
See {@link BroadcastReceiver} for more information on Intent broadcasts. * @@ -1261,11 +1265,10 @@ public abstract class Context { public abstract void removeStickyBroadcast(Intent intent); /** - * Same as {@link #sendStickyBroadcast(Intent)}, - * but for a specific user. This broadcast - * can only be sent to receivers that are part of the calling application. It - * requires holding the {@link android.Manifest.permission#INTERACT_ACROSS_USERS} - * permission. + * Version of {@link #sendStickyBroadcast(Intent)} that allows you to specify the + * user the broadcast will be sent to. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS permission. * * @param intent The Intent to broadcast; all receivers matching this * Intent will receive the broadcast, and the Intent will be held to @@ -1277,12 +1280,12 @@ public abstract class Context { public abstract void sendStickyBroadcastAsUser(Intent intent, UserHandle user); /** - * Same as - * {@link #sendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, int, String, Bundle) - * but for a specific user. This broadcast - * can only be sent to receivers that are part of the calling application. It - * requires holding the {@link android.Manifest.permission#INTERACT_ACROSS_USERS} - * permission. + * Version of + * {@link #sendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, int, String, Bundle)} + * that allows you to specify the + * user the broadcast will be sent to. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS permission. * *
See {@link BroadcastReceiver} for more information on Intent broadcasts. * @@ -1309,12 +1312,10 @@ public abstract class Context { Bundle initialExtras); /** - * Same as - * {@link #sendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, int, String, Bundle) - * but for a specific user. This broadcast - * can only be sent to receivers that are part of the calling application. It - * requires holding the {@link android.Manifest.permission#INTERACT_ACROSS_USERS} - * permission. + * Version of {@link #removeStickyBroadcast(Intent)} that allows you to specify the + * user the broadcast will be sent to. This is not available to applications + * that are not pre-installed on the system image. Using it requires holding + * the INTERACT_ACROSS_USERS permission. * *
You must hold the {@link android.Manifest.permission#BROADCAST_STICKY}
* permission in order to use this API. If you do not hold that
diff --git a/core/java/android/content/IntentSender.java b/core/java/android/content/IntentSender.java
index 6c3cf997d44ad..166495ba94223 100644
--- a/core/java/android/content/IntentSender.java
+++ b/core/java/android/content/IntentSender.java
@@ -204,6 +204,20 @@ public class IntentSender implements Parcelable {
}
}
+ /**
+ * @deprecated Renamed to {@link #getCreatorPackage()}.
+ */
+ @Deprecated
+ public String getTargetPackage() {
+ try {
+ return ActivityManagerNative.getDefault()
+ .getPackageForIntentSender(mTarget);
+ } catch (RemoteException e) {
+ // Should never happen.
+ return null;
+ }
+ }
+
/**
* Return the package name of the application that created this
* IntentSender, that is the identity under which you will actually be
@@ -213,7 +227,7 @@ public class IntentSender implements Parcelable {
* @return The package name of the PendingIntent, or null if there is
* none associated with it.
*/
- public String getTargetPackage() {
+ public String getCreatorPackage() {
try {
return ActivityManagerNative.getDefault()
.getPackageForIntentSender(mTarget);
@@ -232,7 +246,7 @@ public class IntentSender implements Parcelable {
* @return The uid of the PendingIntent, or -1 if there is
* none associated with it.
*/
- public int getTargetUid() {
+ public int getCreatorUid() {
try {
return ActivityManagerNative.getDefault()
.getUidForIntentSender(mTarget);
@@ -253,7 +267,7 @@ public class IntentSender implements Parcelable {
* @return The user handle of the PendingIntent, or null if there is
* none associated with it.
*/
- public UserHandle getTargetUserHandle() {
+ public UserHandle getCreatorUserHandle() {
try {
int uid = ActivityManagerNative.getDefault()
.getUidForIntentSender(mTarget);
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 4784d7f5144b6..fd488ae8a9486 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -2434,8 +2434,7 @@ public abstract class PackageManager {
* @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
* or {@link PackageManager#VERIFICATION_REJECT}.
* @throws SecurityException if the caller does not have the
- * {@link android.Manifest.permission#PACKAGE_VERIFICATION_AGENT}
- * permission.
+ * PACKAGE_VERIFICATION_AGENT permission.
*/
public abstract void verifyPendingInstall(int id, int verificationCode);
@@ -2469,8 +2468,7 @@ public abstract class PackageManager {
* bounds value; namely, 0 or
* {@link PackageManager#MAXIMUM_VERIFICATION_TIMEOUT}.
* @throws SecurityException if the caller does not have the
- * {@link android.Manifest.permission#PACKAGE_VERIFICATION_AGENT}
- * permission.
+ * PACKAGE_VERIFICATION_AGENT permission.
*/
public abstract void extendVerificationTimeout(int id,
int verificationCodeAtTimeout, long millisecondsToDelay);
diff --git a/core/java/android/content/pm/PackageUserState.java b/core/java/android/content/pm/PackageUserState.java
index 1a71bfb480b04..357997781eda0 100644
--- a/core/java/android/content/pm/PackageUserState.java
+++ b/core/java/android/content/pm/PackageUserState.java
@@ -22,6 +22,7 @@ import java.util.HashSet;
/**
* Per-user state information about a package.
+ * @hide
*/
public class PackageUserState {
public boolean stopped;
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index cac1e07b9e29d..daec7eaa655e2 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -55,8 +55,9 @@ public class UserManager {
}
/**
- * Returns the user name of the user making this call.
- * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
+ * Returns the user name of the user making this call. This call is only
+ * available to applications on the system image; it requires the
+ * MANAGE_USERS permission.
* @return the user name
*/
public String getUserName() {
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 3702da95f592b..69f1eaf87ee06 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -981,7 +981,7 @@
android:protectionLevel="dangerous"
android:label="@string/permlab_getTasks"
android:description="@string/permdesc_getTasks" />
-
@@ -1000,7 +1000,7 @@
android:label="@string/permlab_interactAcrossUsersFull"
android:description="@string/permdesc_interactAcrossUsersFull" />
-