Loading core/java/android/net/NetworkScoreManager.java +5 −2 Original line number Diff line number Diff line Loading @@ -192,12 +192,15 @@ public class NetworkScoreManager { /** * Set the active scorer to a new package and clear existing scores. * * <p>Should never be called directly without obtaining user consent. This can be done by using * the {@link #ACTION_CHANGE_ACTIVE} broadcast, or using a custom configuration activity. * * @return true if the operation succeeded, or false if the new package is not a valid scorer. * @throws SecurityException if the caller does not hold the * {@link android.Manifest.permission#BROADCAST_NETWORK_PRIVILEGED} permission * indicating that it can manage scorer applications. * {@link android.Manifest.permission#SCORE_NETWORKS} permission. * @hide */ @SystemApi public boolean setActiveScorer(String packageName) throws SecurityException { try { return mService.setActiveScorer(packageName); Loading services/core/java/com/android/server/NetworkScoreService.java +10 −1 Original line number Diff line number Diff line Loading @@ -130,7 +130,16 @@ public class NetworkScoreService extends INetworkScoreService.Stub { @Override public boolean setActiveScorer(String packageName) { mContext.enforceCallingOrSelfPermission(permission.BROADCAST_NETWORK_PRIVILEGED, TAG); // TODO: For now, since SCORE_NETWORKS requires an app to be privileged, we allow such apps // to directly set the scorer app rather than having to use the consent dialog. The // assumption is that anyone bundling a scorer app with the system is trusted by the OEM to // do the right thing and not enable this feature without explaining it to the user. // In the future, should this API be opened to 3p apps, we will need to lock this down and // figure out another way to streamline the UX. // mContext.enforceCallingOrSelfPermission(permission.BROADCAST_NETWORK_PRIVILEGED, TAG); mContext.enforceCallingOrSelfPermission(permission.SCORE_NETWORKS, TAG); return setScorerInternal(packageName); } Loading Loading
core/java/android/net/NetworkScoreManager.java +5 −2 Original line number Diff line number Diff line Loading @@ -192,12 +192,15 @@ public class NetworkScoreManager { /** * Set the active scorer to a new package and clear existing scores. * * <p>Should never be called directly without obtaining user consent. This can be done by using * the {@link #ACTION_CHANGE_ACTIVE} broadcast, or using a custom configuration activity. * * @return true if the operation succeeded, or false if the new package is not a valid scorer. * @throws SecurityException if the caller does not hold the * {@link android.Manifest.permission#BROADCAST_NETWORK_PRIVILEGED} permission * indicating that it can manage scorer applications. * {@link android.Manifest.permission#SCORE_NETWORKS} permission. * @hide */ @SystemApi public boolean setActiveScorer(String packageName) throws SecurityException { try { return mService.setActiveScorer(packageName); Loading
services/core/java/com/android/server/NetworkScoreService.java +10 −1 Original line number Diff line number Diff line Loading @@ -130,7 +130,16 @@ public class NetworkScoreService extends INetworkScoreService.Stub { @Override public boolean setActiveScorer(String packageName) { mContext.enforceCallingOrSelfPermission(permission.BROADCAST_NETWORK_PRIVILEGED, TAG); // TODO: For now, since SCORE_NETWORKS requires an app to be privileged, we allow such apps // to directly set the scorer app rather than having to use the consent dialog. The // assumption is that anyone bundling a scorer app with the system is trusted by the OEM to // do the right thing and not enable this feature without explaining it to the user. // In the future, should this API be opened to 3p apps, we will need to lock this down and // figure out another way to streamline the UX. // mContext.enforceCallingOrSelfPermission(permission.BROADCAST_NETWORK_PRIVILEGED, TAG); mContext.enforceCallingOrSelfPermission(permission.SCORE_NETWORKS, TAG); return setScorerInternal(packageName); } Loading