Rename BROADCAST_SCORE_NETWORKS to BROADCAST_NETWORK_PRIVILEGED.
This is necessary/desired for two reasons:
1. UX around network scoring shipped with L despite lacking underlying
platform support. We do not want network scoring applications to
trigger this UX on L devices, and therefore we must break the contract
of what defines a network scorer so that apps build against the new
contract don't trigger the old UX.
2. As a start towards generalizing the term "score" for a potentially
broader role in the future, though that role is very much undefined.
Bug: 18160480
Change-Id: If228977513e32e45bc44dbeda24aa18436fdfca6
diff --git a/services/core/java/com/android/server/NetworkScoreService.java b/services/core/java/com/android/server/NetworkScoreService.java
index 395e365..bb91a14 100644
--- a/services/core/java/com/android/server/NetworkScoreService.java
+++ b/services/core/java/com/android/server/NetworkScoreService.java
@@ -115,10 +115,10 @@
@Override
public boolean clearScores() {
- // Only the active scorer or the system (who can broadcast BROADCAST_SCORE_NETWORKS) should
- // be allowed to flush all scores.
+ // Only the active scorer or the system (who can broadcast BROADCAST_NETWORK_PRIVILEGED)
+ // should be allowed to flush all scores.
if (NetworkScorerAppManager.isCallerActiveScorer(mContext, getCallingUid()) ||
- mContext.checkCallingOrSelfPermission(permission.BROADCAST_SCORE_NETWORKS) ==
+ mContext.checkCallingOrSelfPermission(permission.BROADCAST_NETWORK_PRIVILEGED) ==
PackageManager.PERMISSION_GRANTED) {
clearInternal();
return true;
@@ -130,16 +130,16 @@
@Override
public boolean setActiveScorer(String packageName) {
- mContext.enforceCallingOrSelfPermission(permission.BROADCAST_SCORE_NETWORKS, TAG);
+ mContext.enforceCallingOrSelfPermission(permission.BROADCAST_NETWORK_PRIVILEGED, TAG);
return setScorerInternal(packageName);
}
@Override
public void disableScoring() {
- // Only the active scorer or the system (who can broadcast BROADCAST_SCORE_NETOWRKS) should
- // be allowed to disable scoring.
+ // Only the active scorer or the system (who can broadcast BROADCAST_NETWORK_PRIVILEGED)
+ // should be allowed to disable scoring.
if (NetworkScorerAppManager.isCallerActiveScorer(mContext, getCallingUid()) ||
- mContext.checkCallingOrSelfPermission(permission.BROADCAST_SCORE_NETWORKS) ==
+ mContext.checkCallingOrSelfPermission(permission.BROADCAST_NETWORK_PRIVILEGED) ==
PackageManager.PERMISSION_GRANTED) {
// The return value is discarded here because at this point, the call should always
// succeed. The only reason for failure is if the new package is not a valid scorer, but
@@ -188,7 +188,7 @@
@Override
public void registerNetworkScoreCache(int networkType, INetworkScoreCache scoreCache) {
- mContext.enforceCallingOrSelfPermission(permission.BROADCAST_SCORE_NETWORKS, TAG);
+ mContext.enforceCallingOrSelfPermission(permission.BROADCAST_NETWORK_PRIVILEGED, TAG);
synchronized (mScoreCaches) {
if (mScoreCaches.containsKey(networkType)) {
throw new IllegalArgumentException(