Cache the default launcher.
Originally we always checked with PM for the default launcher,
which would take ~2ms.
Now we cache the result, and clears the cache when (any) preferred
activities change.
Bug 30126557
Change-Id: Iceef288cd372c8bb9b119aa493e5173d894f2302
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index c140f1b..4d9db98 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -2219,6 +2219,22 @@
"android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE";
/**
+ * Broadcast Action: preferred activities have changed *explicitly*.
+ *
+ * <p>Note there are cases where a preferred activity is invalidated *implicitly*, e.g.
+ * when an app is installed or uninstalled, but in such cases this broadcast will *not*
+ * be sent.
+ *
+ * {@link #EXTRA_USER_HANDLE} contains the user ID in question.
+ *
+ * @hide
+ */
+ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_PREFERRED_ACTIVITY_CHANGED =
+ "android.intent.action.ACTION_PREFERRED_ACTIVITY_CHANGED";
+
+
+ /**
* Broadcast Action: The current system wallpaper has changed. See
* {@link android.app.WallpaperManager} for retrieving the new wallpaper.
* This should <em>only</em> be used to determine when the wallpaper