From 08675a3376819a82aa5ab344bc3e7b1635c30b05 Mon Sep 17 00:00:00 2001 From: Suchi Amalapurapu Date: Thu, 28 Jan 2010 09:57:30 -0800 Subject: Apps on sdcard: Add new broadcasts Add new broadcasts ACTION_MEDIA_RESOURCES_AVAILABLE and ACTION_MEDIA_RESOURCES_UNAVAILABLE that get broadcast by PackageManagerService when sdcard gets mounted/unmounted by MountService so that packages on sdcard get recognized by various system services as being installed/available or removed/unavailable by the system. The broadcasts are sent before the actual package cleanup which includes mounting/unmounting the packages and we force a gc right after so that any lingering file references to resources on sdcard get released. --- core/java/android/content/Intent.java | 77 ++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) (limited to 'core/java/android/content/Intent.java') diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index bbd359b..e957e20 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -1355,6 +1355,60 @@ public class Intent implements Parcelable, Cloneable { */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_UID_REMOVED = "android.intent.action.UID_REMOVED"; + + /** + * Broadcast Action: Resources for a set of packages (which were + * previously unavailable) are currently + * available since the media on which they exist is available. + * The extra data {@link #EXTRA_CHANGED_PACKAGE_LIST} contains a + * list of packages whose availability changed. + * The extra data {@link #EXTRA_CHANGED_UID_LIST} contains a + * list of uids of packages whose availability changed. + * Note that the + * packages in this list do not receive this broadcast. + * The specified set of packages are now available on the system. + *

Includes the following extras: + *

+ * + *

This is a protected intent that can only be sent + * by the system. + * @hide + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_MEDIA_RESOURCES_AVAILABLE = + "android.intent.action.MEDIA_RESOURCES_AVAILABILE"; + + /** + * Broadcast Action: Resources for a set of packages are currently + * unavailable since the media on which they exist is unavailable. + * The extra data {@link #EXTRA_CHANGED_PACKAGE_LIST} contains a + * list of packages whose availability changed. + * The extra data {@link #EXTRA_CHANGED_UID_LIST} contains a + * list of uids of packages whose availability changed. + * The specified set of packages can no longer be + * launched and are practically unavailable on the system. + *

Inclues the following extras: + *

+ * + *

This is a protected intent that can only be sent + * by the system. + * @hide + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_MEDIA_RESOURCES_UNAVAILABLE = + "android.intent.action.MEDIA_RESOURCES_UNAVAILABILE"; + /** * Broadcast Action: The current system wallpaper has changed. See * {@link android.app.WallpaperManager} for retrieving the new wallpaper. @@ -2136,13 +2190,34 @@ public class Intent implements Parcelable, Cloneable { "android.intent.extra.changed_component_name"; /** - * This field is part of {@link android.content.Intent#ACTION_PACKAGE_CHANGED} + * This field is part of {@link android.content.Intent#ACTION_PACKAGE_CHANGED}, * and contains a string array of all of the components that have changed. */ public static final String EXTRA_CHANGED_COMPONENT_NAME_LIST = "android.intent.extra.changed_component_name_list"; /** + * This field is part of + * {@link android.content.Intent#ACTION_MEDIA_RESOURCES_AVAILABLE}, + * {@link android.content.Intent#ACTION_MEDIA_RESOURCES_UNAVAILABLE} + * and contains a string array of all of the components that have changed. + * @hide + */ + public static final String EXTRA_CHANGED_PACKAGE_LIST = + "android.intent.extra.changed_package_list"; + + /** + * This field is part of + * {@link android.content.Intent#ACTION_MEDIA_RESOURCES_AVAILABLE}, + * {@link android.content.Intent#ACTION_MEDIA_RESOURCES_UNAVAILABLE} + * and contains an integer array of uids of all of the components + * that have changed. + * @hide + */ + public static final String EXTRA_CHANGED_UID_LIST = + "android.intent.extra.changed_uid_list"; + + /** * @hide * Magic extra system code can use when binding, to give a label for * who it is that has bound to a service. This is an integer giving -- cgit v1.1