diff --git a/core/java/android/net/NetworkScoreManager.java b/core/java/android/net/NetworkScoreManager.java index c09492cfd14b6..c599dfccc6324 100644 --- a/core/java/android/net/NetworkScoreManager.java +++ b/core/java/android/net/NetworkScoreManager.java @@ -80,6 +80,13 @@ public class NetworkScoreManager { @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_SCORE_NETWORKS = "android.net.scoring.SCORE_NETWORKS"; + /** + * Extra used with {@link #ACTION_SCORE_NETWORKS} to specify the networks to be scored, as an + * array of {@link NetworkKey}s. Can be obtained with + * {@link android.content.Intent#getParcelableArrayExtra(String)}}. + */ + public static final String EXTRA_NETWORKS_TO_SCORE = "networksToScore"; + /** * Activity action: launch a custom activity for configuring a scorer before enabling it. * Scorer applications may choose to specify an activity for this action, in which case the @@ -92,11 +99,24 @@ public class NetworkScoreManager { public static final String ACTION_CUSTOM_ENABLE = "android.net.scoring.CUSTOM_ENABLE"; /** - * Extra used with {@link #ACTION_SCORE_NETWORKS} to specify the networks to be scored, as an - * array of {@link NetworkKey}s. Can be obtained with - * {@link android.content.Intent#getParcelableArrayExtra(String)}}. + * Broadcast action: the active scorer has been changed. Scorer apps may listen to this to + * perform initialization once selected as the active scorer, or clean up unneeded resources + * if another scorer has been selected. Note that it is unnecessary to clear existing scores as + * this is handled by the system. + * + *
The new scorer will be specified in {@link #EXTRA_NEW_SCORER}. + * + *
This is a protected intent that can only be sent by the system.
*/
- public static final String EXTRA_NETWORKS_TO_SCORE = "networksToScore";
+ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_SCORER_CHANGED = "android.net.scoring.SCORER_CHANGED";
+
+ /**
+ * Extra used with {@link #ACTION_SCORER_CHANGED} to specify the newly selected scorer's package
+ * name. Will be null if scoring was disabled. Can be obtained with
+ * {@link android.content.Intent#getStringExtra(String)}.
+ */
+ public static final String EXTRA_NEW_SCORER = "newScorer";
private final Context mContext;
private final INetworkScoreService mService;
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 450a889813086..e675dc7194c58 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -254,6 +254,7 @@