diff options
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/net/INetworkScoreService.aidl | 9 | ||||
| -rw-r--r-- | core/java/android/net/NetworkScoreManager.java | 15 | ||||
| -rw-r--r-- | core/java/android/net/NetworkScorerAppManager.java | 4 |
3 files changed, 27 insertions, 1 deletions
diff --git a/core/java/android/net/INetworkScoreService.aidl b/core/java/android/net/INetworkScoreService.aidl index 932f03116f15..b097f12d460e 100644 --- a/core/java/android/net/INetworkScoreService.aidl +++ b/core/java/android/net/INetworkScoreService.aidl @@ -100,4 +100,13 @@ interface INetworkScoreService * @hide */ boolean requestScores(in NetworkKey[] networks); + + /** + * Determine whether the application with the given UID is the enabled scorer. + * + * @param callingUid the UID to check + * @return true if the provided UID is the active scorer, false otherwise. + * @hide + */ + boolean isCallerActiveScorer(int callingUid); } diff --git a/core/java/android/net/NetworkScoreManager.java b/core/java/android/net/NetworkScoreManager.java index 9a6dca013882..af0306e35aaa 100644 --- a/core/java/android/net/NetworkScoreManager.java +++ b/core/java/android/net/NetworkScoreManager.java @@ -341,4 +341,19 @@ public class NetworkScoreManager { throw e.rethrowFromSystemServer(); } } + + /** + * Determine whether the application with the given UID is the enabled scorer. + * + * @param callingUid the UID to check + * @return true if the provided UID is the active scorer, false otherwise. + * @hide + */ + public boolean isCallerActiveScorer(int callingUid) { + try { + return mService.isCallerActiveScorer(callingUid); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } } diff --git a/core/java/android/net/NetworkScorerAppManager.java b/core/java/android/net/NetworkScorerAppManager.java index ec0bb25d28eb..23d5af55641c 100644 --- a/core/java/android/net/NetworkScorerAppManager.java +++ b/core/java/android/net/NetworkScorerAppManager.java @@ -16,7 +16,6 @@ package android.net; -import android.Manifest; import android.Manifest.permission; import android.annotation.Nullable; import android.content.ContentResolver; @@ -28,7 +27,9 @@ import android.os.UserHandle; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; + import com.android.internal.R; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -226,6 +227,7 @@ public class NetworkScorerAppManager { } /** Determine whether the application with the given UID is the enabled scorer. */ + @Deprecated // Use NetworkScoreManager.isCallerActiveScorer() public boolean isCallerActiveScorer(int callingUid) { NetworkScorerAppData defaultApp = getActiveScorer(); if (defaultApp == null) { |
