diff options
author | Amin Shaikh <ashaikh@google.com> | 2016-12-01 02:10:59 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-12-01 02:10:59 +0000 |
commit | adfcb42a9088564cb2afdc12c40bafb6d209e16b (patch) | |
tree | 179ebc6940a9b00830fe5e1f185e4f1c88e91bb8 /service | |
parent | cdcce5b5fc6d232d9dfd663d8a75ca97b73dce75 (diff) | |
parent | 9333b67ffda8534ee84c383dc3bbad23aee198a2 (diff) |
Merge "Refactor NetworkScoreAppManager for testing."
am: 9333b67ffd
Change-Id: Ib1cca73dce31490448882a33162e1042fce4542e
Diffstat (limited to 'service')
3 files changed, 8 insertions, 16 deletions
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java index 63787dfb0..3d1356463 100644 --- a/service/java/com/android/server/wifi/WifiInjector.java +++ b/service/java/com/android/server/wifi/WifiInjector.java @@ -17,6 +17,7 @@ package com.android.server.wifi; import android.content.Context; +import android.net.NetworkScorerAppManager; import android.net.wifi.IApInterface; import android.net.wifi.IWifiScanner; import android.net.wifi.IWificond; @@ -167,7 +168,7 @@ public class WifiInjector { BatteryStatsService.getService()); mWifiPermissionsWrapper = new WifiPermissionsWrapper(mContext); mWifiPermissionsUtil = new WifiPermissionsUtil(mWifiPermissionsWrapper, mContext, - mSettingsStore, UserManager.get(mContext)); + mSettingsStore, UserManager.get(mContext), new NetworkScorerAppManager(mContext)); mSimAccessor = new SIMAccessor(mContext); mPasspointManager = new PasspointManager(mContext, this, mSimAccessor); } diff --git a/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java b/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java index 827afb42e..4bb828891 100644 --- a/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java +++ b/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java @@ -21,6 +21,7 @@ import android.app.AppOpsManager; import android.content.Context; import android.content.pm.PackageManager; import android.content.pm.UserInfo; +import android.net.NetworkScorerAppManager; import android.os.UserManager; import android.provider.Settings; @@ -41,16 +42,19 @@ public class WifiPermissionsUtil { private final AppOpsManager mAppOps; private final UserManager mUserManager; private final WifiSettingsStore mSettingsStore; + private final NetworkScorerAppManager mNetworkScorerAppManager; private WifiLog mLog; public WifiPermissionsUtil(WifiPermissionsWrapper wifiPermissionsWrapper, - Context context, WifiSettingsStore settingsStore, UserManager userManager) { + Context context, WifiSettingsStore settingsStore, UserManager userManager, + NetworkScorerAppManager networkScorerAppManager) { mWifiPermissionsWrapper = wifiPermissionsWrapper; mContext = context; mUserManager = userManager; mAppOps = (AppOpsManager) mContext.getSystemService(Context.APP_OPS_SERVICE); mSettingsStore = settingsStore; mLog = WifiInjector.getInstance().makeLog(TAG); + mNetworkScorerAppManager = networkScorerAppManager; } /** @@ -108,7 +112,7 @@ public class WifiPermissionsUtil { * Returns true if the caller is an Active Network Scorer. */ private boolean isCallerActiveNwScorer(int uid) { - return mWifiPermissionsWrapper.isCallerActiveNwScorer(uid); + return mNetworkScorerAppManager.isCallerActiveScorer(uid); } /** diff --git a/service/java/com/android/server/wifi/util/WifiPermissionsWrapper.java b/service/java/com/android/server/wifi/util/WifiPermissionsWrapper.java index 20d201ccd..be10aefa4 100644 --- a/service/java/com/android/server/wifi/util/WifiPermissionsWrapper.java +++ b/service/java/com/android/server/wifi/util/WifiPermissionsWrapper.java @@ -18,7 +18,6 @@ package com.android.server.wifi.util; import android.app.ActivityManager; import android.content.Context; -import android.net.NetworkScorerAppManager; import android.os.UserHandle; import java.util.List; @@ -35,18 +34,6 @@ public class WifiPermissionsWrapper { mContext = context; } - /** - * Invokes the static API from NetworkScorer App - * Manager to determine if the caller is an active - * network scorer - * @param uid of the caller - * @return boolean indicating if the caller is an - * active network scorer - */ - public boolean isCallerActiveNwScorer(int uid) { - return NetworkScorerAppManager.isCallerActiveScorer(mContext, uid); - } - public int getCurrentUser() { return ActivityManager.getCurrentUser(); } |