public final class NetworkScorerAppManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
NetworkScorerAppManager.NetworkScorerAppData |
Modifier and Type | Method and Description |
---|---|
static NetworkScorerAppManager.NetworkScorerAppData |
getActiveScorer(Context context)
Get the application to use for scoring networks.
|
static Collection<NetworkScorerAppManager.NetworkScorerAppData> |
getAllValidScorers(Context context)
Returns the list of available scorer apps.
|
static NetworkScorerAppManager.NetworkScorerAppData |
getScorer(Context context,
String packageName)
Returns the
NetworkScorerAppManager.NetworkScorerAppData for the given app, or null if it's not a scorer. |
static boolean |
isCallerActiveScorer(Context context,
int callingUid)
Determine whether the application with the given UID is the enabled scorer.
|
static boolean |
setActiveScorer(Context context,
String packageName)
Set the specified package as the default scorer application.
|
public static Collection<NetworkScorerAppManager.NetworkScorerAppData> getAllValidScorers(Context context)
A network scorer is any application which:
android.Manifest.permission#SCORE_NETWORKS
permission.
NetworkScoreManager.ACTION_SCORE_NETWORKS
guarded by the
android.Manifest.permission#BROADCAST_NETWORK_PRIVILEGED
permission.
public static NetworkScorerAppManager.NetworkScorerAppData getActiveScorer(Context context)
public static boolean setActiveScorer(Context context, String packageName)
The caller must have permission to write to Settings.Global
.
context
- the context of the calling applicationpackageName
- the packageName of the new scorer to use. If null, scoring will be
disabled. Otherwise, the scorer will only be set if it is a valid scorer application.public static boolean isCallerActiveScorer(Context context, int callingUid)
public static NetworkScorerAppManager.NetworkScorerAppData getScorer(Context context, String packageName)
NetworkScorerAppManager.NetworkScorerAppData
for the given app, or null if it's not a scorer.