From 35f34eab716895c81a4f9e9ebfcf58b4aa1447af Mon Sep 17 00:00:00 2001 From: Jeremy Joslin Date: Fri, 3 Feb 2017 09:13:51 -0800 Subject: [PATCH] Rename isCallerSystemUid(). The method wasn't actually checking if the caller was Process.SYSTEM_UID, nor was that it's intent. Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest Change-Id: I341f2fb1d1dca0a460140992a68831316daa4eb8 --- .../core/java/com/android/server/NetworkScoreService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/NetworkScoreService.java b/services/core/java/com/android/server/NetworkScoreService.java index 25016f6b9cf50..81d4ca3d74e9d 100644 --- a/services/core/java/com/android/server/NetworkScoreService.java +++ b/services/core/java/com/android/server/NetworkScoreService.java @@ -625,7 +625,7 @@ public class NetworkScoreService extends INetworkScoreService.Stub { } } - private boolean isCallerSystemUid() { + private boolean callerCanRequestScores() { // REQUEST_NETWORK_SCORES is a signature only permission. return mContext.checkCallingOrSelfPermission(permission.REQUEST_NETWORK_SCORES) == PackageManager.PERMISSION_GRANTED; @@ -634,7 +634,7 @@ public class NetworkScoreService extends INetworkScoreService.Stub { @Override public boolean clearScores() { // Only the active scorer or the system should be allowed to flush all scores. - if (isCallerActiveScorer(getCallingUid()) || isCallerSystemUid()) { + if (isCallerActiveScorer(getCallingUid()) || callerCanRequestScores()) { final long token = Binder.clearCallingIdentity(); try { clearInternal(); @@ -695,7 +695,7 @@ public class NetworkScoreService extends INetworkScoreService.Stub { @Override public void disableScoring() { // Only the active scorer or the system should be allowed to disable scoring. - if (isCallerActiveScorer(getCallingUid()) || isCallerSystemUid()) { + if (isCallerActiveScorer(getCallingUid()) || callerCanRequestScores()) { // no-op for now but we could write to the setting if needed. } else { throw new SecurityException(