From 2cd918a63ec87dd4e13bd803626f2742a0f35fab Mon Sep 17 00:00:00 2001 From: Amin Shaikh Date: Thu, 5 Jan 2017 14:28:47 -0800 Subject: Fix NetworkScorerAppManager#isCallerActiveScorer. The current implementation checks whether the caller's uid has the SCORE_NETWORKS permission instead of checking the passed in callingUid. I removed this check entirely because the getActiveScorer method already checks whether the scorer's package has the SCORE_NETWORKS permission. There is no way callingUid can equal the active scoring package's uid without also having the SCORE_NETWORKS permission. Bug: 34107721 Test: runtest --path core/tests/coretests/src/android/net/NetworkScorerAppManagerTest.java Change-Id: Ifd427792169837c84a10a76b208c76137db06ae9 --- core/java/android/net/NetworkScorerAppManager.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/net/NetworkScorerAppManager.java b/core/java/android/net/NetworkScorerAppManager.java index 4282ca75f2b6..ec0bb25d28eb 100644 --- a/core/java/android/net/NetworkScorerAppManager.java +++ b/core/java/android/net/NetworkScorerAppManager.java @@ -231,13 +231,7 @@ public class NetworkScorerAppManager { if (defaultApp == null) { return false; } - if (callingUid != defaultApp.packageUid) { - return false; - } - // To be extra safe, ensure the caller holds the SCORE_NETWORKS permission. It always - // should, since it couldn't become the active scorer otherwise, but this can't hurt. - return mContext.checkCallingPermission(Manifest.permission.SCORE_NETWORKS) == - PackageManager.PERMISSION_GRANTED; + return callingUid == defaultApp.packageUid; } private boolean isNetworkRecommendationsDisabled() { -- cgit v1.2.3