For intent ACTION_PACKAGE_CHANGED, there could be a lot of broadcasts related to enabling/disabling
components by apps which could result in thrashing on the PackageManager. For apps that
do not want to be restarted when such a broadcast is sent, we can just aggregate these broadcasts and
handle them at one go.
Changes include:
New structure to hold pending broadcasts by class name. If a component is enabled or disabled frequently
aggregate component enabled/disabled settings in this structure in a 10 second window and then
send out the accumulated list of broadcasts to the ActivityManager.
A new Handler implementation handles this message
Add new attribute name EXTRA_CHANGED_COMPONENT_NAME in broadcast intent Intent.ACTION_PACKAGE_CHANGED for
additional information for apps like Launcher.
Rename a couple of parameters, the names were too jarring.
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 59529be..2a17672 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1267,6 +1267,8 @@
* enabled or disabled. The data contains the name of the package.
* <ul>
* <li> {@link #EXTRA_UID} containing the integer uid assigned to the package.
+ * <li> {@link #EXTRA_CHANGED_COMPONENT_NAME} containing the class name of the changed component.
+ * <li> {@link #EXTRA_DONT_KILL_APP} containing boolean field to override the default action of restarting the application.
* </ul>
*
* <p class="note">This is a protected intent that can only be sent
@@ -2034,6 +2036,14 @@
public static final String EXTRA_REMOTE_INTENT_TOKEN =
"android.intent.extra.remote_intent_token";
+ /**
+ * Used as an int extra field in {@link android.content.Intent#ACTION_PACKAGE_CHANGED}
+ * intent to supply the name of the component that changed.
+ * @hide
+ */
+ public static final String EXTRA_CHANGED_COMPONENT_NAME =
+ "android.intent.extra.changed_component_name";
+
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Intent flags (see mFlags variable).