diff options
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/content/Intent.java | 42 | ||||
-rw-r--r-- | core/java/android/content/pm/ApplicationInfo.java | 6 | ||||
-rw-r--r-- | core/java/android/content/pm/IPackageManager.aidl | 6 | ||||
-rw-r--r-- | core/java/android/content/pm/PackageParser.java | 13 | ||||
-rw-r--r-- | core/java/android/server/BluetoothInputProfileHandler.java | 1 |
5 files changed, 68 insertions, 0 deletions
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index ce7f096..7bdd1b9 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -1312,6 +1312,17 @@ public class Intent implements Parcelable, Cloneable { @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED"; /** + * Broadcast Action: A new version of your application has been installed + * over an existing one. This is only sent to the application that was + * replaced. It does not contain any additional data; to receive it, just + * use an intent filter for this action. + * + * <p class="note">This is a protected intent that can only be sent + * by the system. + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_MY_PACKAGE_REPLACED = "android.intent.action.MY_PACKAGE_REPLACED"; + /** * Broadcast Action: An existing application package has been removed from * the device. The data contains the name of the package. The package * that is being installed does <em>not</em> receive this Intent. @@ -1403,6 +1414,17 @@ public class Intent implements Parcelable, Cloneable { public static final String ACTION_UID_REMOVED = "android.intent.action.UID_REMOVED"; /** + * Broadcast Action: Sent to the installer package of an application + * when that application is first launched (that is the first time it + * is moved out of the stopped state). The data contains the name of the package. + * + * <p class="note">This is a protected intent that can only be sent + * by the system. + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_PACKAGE_FIRST_LAUNCH = "android.intent.action.PACKAGE_FIRST_LAUNCH"; + + /** * Broadcast Action: Resources for a set of packages (which were * previously unavailable) are currently * available since the media on which they exist is available. @@ -2442,6 +2464,20 @@ public class Intent implements Parcelable, Cloneable { * been found to create the final resolved list. */ public static final int FLAG_DEBUG_LOG_RESOLUTION = 0x00000008; + /** + * If set, this intent will not match any components in packages that + * are currently stopped. If this is not set, then the default behavior + * is to include such applications in the result. + */ + public static final int FLAG_EXCLUDE_STOPPED_PACKAGES = 0x00000010; + /** + * If set, this intent will always match any components in packages that + * are currently stopped. This is the default behavior when + * {@link #FLAG_EXCLUDE_STOPPED_PACKAGES} is not set. If both of these + * flags are set, this one wins (it allows overriding of exclude for + * places where the framework may automatically set the exclude flag). + */ + public static final int FLAG_INCLUDE_STOPPED_PACKAGES = 0x00000020; /** * If set, the new activity is not kept in the history stack. As soon as @@ -3915,6 +3951,12 @@ public class Intent implements Parcelable, Cloneable { return mFlags; } + /** @hide */ + public boolean isExcludingStopped() { + return (mFlags&(FLAG_EXCLUDE_STOPPED_PACKAGES|FLAG_INCLUDE_STOPPED_PACKAGES)) + == FLAG_EXCLUDE_STOPPED_PACKAGES; + } + /** * Retrieve the application package name this Intent is limited to. When * resolving an Intent, if non-null this limits the resolution to only diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java index 2d95781..92b2c3b 100644 --- a/core/java/android/content/pm/ApplicationInfo.java +++ b/core/java/android/content/pm/ApplicationInfo.java @@ -278,6 +278,12 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { public static final int FLAG_LARGE_HEAP = 1<<20; /** + * Value for {@link #flags}: true if this application's package is in + * the stopped state. + */ + public static final int FLAG_STOPPED = 1<<21; + + /** * Value for {@link #flags}: Set to true if the application has been * installed using the forward lock option. * diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index 034525e..fbf8f92 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -210,6 +210,12 @@ interface IPackageManager { int getApplicationEnabledSetting(in String packageName); /** + * Set whether the given package should be considered stopped, making + * it not visible to implicit intents that filter out stopped packages. + */ + void setPackageStoppedState(String packageName, boolean stopped); + + /** * Free storage by deleting LRU sorted list of cache files across * all applications. If the currently available free storage * on the device is greater than or equal to the requested diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 7676258..7ebfda4 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -2817,6 +2817,9 @@ public class PackageParser { // User set enabled state. public int mSetEnabled = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT; + // Whether the package has been stopped. + public boolean mSetStopped = false; + // Additional data supplied by callers. public Object mExtras; @@ -3071,6 +3074,11 @@ public class PackageParser { if (!sCompatibilityModeEnabled) { p.applicationInfo.disableCompatibilityMode(); } + if (p.mSetStopped) { + p.applicationInfo.flags |= ApplicationInfo.FLAG_STOPPED; + } else { + p.applicationInfo.flags &= ~ApplicationInfo.FLAG_STOPPED; + } return p.applicationInfo; } @@ -3085,6 +3093,11 @@ public class PackageParser { if (!sCompatibilityModeEnabled) { ai.disableCompatibilityMode(); } + if (p.mSetStopped) { + p.applicationInfo.flags |= ApplicationInfo.FLAG_STOPPED; + } else { + p.applicationInfo.flags &= ~ApplicationInfo.FLAG_STOPPED; + } if (p.mSetEnabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) { ai.enabled = true; } else if (p.mSetEnabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED) { diff --git a/core/java/android/server/BluetoothInputProfileHandler.java b/core/java/android/server/BluetoothInputProfileHandler.java index cdc0f2d..e6513fd 100644 --- a/core/java/android/server/BluetoothInputProfileHandler.java +++ b/core/java/android/server/BluetoothInputProfileHandler.java @@ -187,6 +187,7 @@ final class BluetoothInputProfileHandler { intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); intent.putExtra(BluetoothInputDevice.EXTRA_PREVIOUS_STATE, prevState); intent.putExtra(BluetoothInputDevice.EXTRA_STATE, state); + intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); mContext.sendBroadcast(intent, BluetoothService.BLUETOOTH_PERM); debugLog("InputDevice state : device: " + device + " State:" + prevState + "->" + state); |