diff options
| author | Treehugger Robot <treehugger-gerrit@google.com> | 2016-12-08 02:09:39 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-12-08 02:09:40 +0000 |
| commit | 78f3f0049e572298e87f00946dda5bd2bed2b902 (patch) | |
| tree | a98da98cdb14bdc009993c6791f9ff049a562268 /core/java/android | |
| parent | faf3aa697fc569180cc029c09affe08ade9c5e82 (diff) | |
| parent | 972e236e84fd4073f7ecc40f2de326b388203dfb (diff) | |
Merge "Support multiple caches in NetworkScoreService."
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/net/INetworkScoreService.aidl | 13 | ||||
| -rw-r--r-- | core/java/android/net/NetworkScoreManager.java | 18 |
2 files changed, 29 insertions, 2 deletions
diff --git a/core/java/android/net/INetworkScoreService.aidl b/core/java/android/net/INetworkScoreService.aidl index 59cbf6e93894..542a0a7d4040 100644 --- a/core/java/android/net/INetworkScoreService.aidl +++ b/core/java/android/net/INetworkScoreService.aidl @@ -56,17 +56,26 @@ interface INetworkScoreService void disableScoring(); /** - * Register a network subsystem for scoring. + * Register a cache to receive scoring updates. * * @param networkType the type of network this cache can handle. See {@link NetworkKey#type}. * @param scoreCache implementation of {@link INetworkScoreCache} to store the scores. * @throws SecurityException if the caller is not the system. - * @throws IllegalArgumentException if a score cache is already registed for this type. * @hide */ void registerNetworkScoreCache(int networkType, INetworkScoreCache scoreCache); /** + * Unregister a cache to receive scoring updates. + * + * @param networkType the type of network this cache can handle. See {@link NetworkKey#type}. + * @param scoreCache implementation of {@link INetworkScoreCache} to store the scores. + * @throws SecurityException if the caller is not the system. + * @hide + */ + void unregisterNetworkScoreCache(int networkType, INetworkScoreCache scoreCache); + + /** * Request a recommendation for the best network to connect to * taking into account the inputs from the {@link RecommendationRequest}. * diff --git a/core/java/android/net/NetworkScoreManager.java b/core/java/android/net/NetworkScoreManager.java index c301fe3b73fe..af21cefce7ed 100644 --- a/core/java/android/net/NetworkScoreManager.java +++ b/core/java/android/net/NetworkScoreManager.java @@ -279,6 +279,24 @@ public class NetworkScoreManager { } /** + * Unregister a network score cache. + * + * @param networkType the type of network this cache can handle. See {@link NetworkKey#type}. + * @param scoreCache implementation of {@link INetworkScoreCache} to store the scores. + * @throws SecurityException if the caller does not hold the + * {@link android.Manifest.permission#BROADCAST_NETWORK_PRIVILEGED} permission. + * @throws IllegalArgumentException if a score cache is already registered for this type. + * @hide + */ + public void unregisterNetworkScoreCache(int networkType, INetworkScoreCache scoreCache) { + try { + mService.unregisterNetworkScoreCache(networkType, scoreCache); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** * Request a recommendation for which network to connect to. * * @param request a {@link RecommendationRequest} instance containing additional |
