Merge "Moved isCallerActiveScorer() to the score service."

am: 663b444196

Change-Id: I44134284edc88567703435ce663b3d0efd9cff26
This commit is contained in:
Jeremy Joslin
2017-01-11 01:41:14 +00:00
committed by android-build-merger
5 changed files with 88 additions and 14 deletions

View File

@@ -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);
}

View File

@@ -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();
}
}
}

View File

@@ -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) {