summaryrefslogtreecommitdiffstats
path: root/core/java/android/net
diff options
context:
space:
mode:
authorJeff Davidson <jpd@google.com>2014-07-29 09:39:52 -0700
committerJeff Davidson <jpd@google.com>2014-07-29 16:03:19 -0700
commit26fd143326a11c9dd7942e31acca6df56288d194 (patch)
treeb5c0489caebba03bffbca58dcc9ad18e4cffad63 /core/java/android/net
parent40495e054591ed4bc110c710c46996ef163664c1 (diff)
downloadframeworks_base-26fd143326a11c9dd7942e31acca6df56288d194.zip
frameworks_base-26fd143326a11c9dd7942e31acca6df56288d194.tar.gz
frameworks_base-26fd143326a11c9dd7942e31acca6df56288d194.tar.bz2
Add NetworkScoreManager.disableScoring().
Allows the active scorer app to disable itself. Change-Id: I7bcdc3aafb95af4ea0b110b01b08ab4daf7a137f
Diffstat (limited to 'core/java/android/net')
-rw-r--r--core/java/android/net/INetworkScoreService.aidl6
-rw-r--r--core/java/android/net/NetworkScoreManager.java14
2 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/net/INetworkScoreService.aidl b/core/java/android/net/INetworkScoreService.aidl
index 626bd2a..43869264 100644
--- a/core/java/android/net/INetworkScoreService.aidl
+++ b/core/java/android/net/INetworkScoreService.aidl
@@ -48,6 +48,12 @@ interface INetworkScoreService
boolean setActiveScorer(in String packageName);
/**
+ * Disable the current active scorer and clear existing scores.
+ * @throws SecurityException if the caller is not the current scorer or the system.
+ */
+ void disableScoring();
+
+ /**
* Register a network subsystem for scoring.
*
* @param networkType the type of network this cache can handle. See {@link NetworkKey#type}.
diff --git a/core/java/android/net/NetworkScoreManager.java b/core/java/android/net/NetworkScoreManager.java
index b497c6e..2fc3892 100644
--- a/core/java/android/net/NetworkScoreManager.java
+++ b/core/java/android/net/NetworkScoreManager.java
@@ -205,6 +205,20 @@ public class NetworkScoreManager {
}
/**
+ * Turn off network scoring.
+ *
+ * <p>May only be called by the current scorer app, or the system.
+ *
+ * @throws SecurityException if the caller is neither the active scorer nor the system.
+ */
+ public void disableScoring() throws SecurityException {
+ try {
+ mService.disableScoring();
+ } catch (RemoteException e) {
+ }
+ }
+
+ /**
* Request scoring for networks.
*
* <p>Note that this is just a helper method to assemble the broadcast, and will run in the