diff options
author | Sohani Rao <sohanirao@google.com> | 2016-11-02 17:10:20 -0700 |
---|---|---|
committer | Sohani Rao <sohanirao@google.com> | 2016-11-10 12:53:57 -0800 |
commit | 862b2876315938851baf9b8f4e69a2b64261f9c8 (patch) | |
tree | 0f4e6ee7797575edfd220d3be833ea964d289009 | |
parent | 88723c5e3ecadc1b057e5cd849cc88c92a5b06b9 (diff) |
Trace permissions check to access scan results
To help debug denial of permission to access scan results, add logging
to WifiPermissionsUtil.
Bug: 32616662
Test: Unit tests and verified logging in verbose mode
Change-Id: I4e7c16ee46b8c6e01c250308c4ada994ffb53156
-rw-r--r-- | service/java/com/android/server/wifi/util/WifiPermissionsUtil.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java b/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java index 110e9575e..827afb42e 100644 --- a/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java +++ b/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java @@ -24,6 +24,8 @@ import android.content.pm.UserInfo; import android.os.UserManager; import android.provider.Settings; +import com.android.server.wifi.WifiInjector; +import com.android.server.wifi.WifiLog; import com.android.server.wifi.WifiSettingsStore; import java.util.List; @@ -39,6 +41,7 @@ public class WifiPermissionsUtil { private final AppOpsManager mAppOps; private final UserManager mUserManager; private final WifiSettingsStore mSettingsStore; + private WifiLog mLog; public WifiPermissionsUtil(WifiPermissionsWrapper wifiPermissionsWrapper, Context context, WifiSettingsStore settingsStore, UserManager userManager) { @@ -47,6 +50,7 @@ public class WifiPermissionsUtil { mUserManager = userManager; mAppOps = (AppOpsManager) mContext.getSystemService(Context.APP_OPS_SERVICE); mSettingsStore = settingsStore; + mLog = WifiInjector.getInstance().makeLog(TAG); } /** @@ -74,15 +78,18 @@ public class WifiPermissionsUtil { // If neither caller or app has location access, there is no need to check // any other permissions. Deny access to scan results. if (!canCallingUidAccessLocation && !canAppPackageUseLocation) { + mLog.tC("Denied: no location permission"); return false; } // Check if Wifi Scan request is an operation allowed for this App. if (!isScanAllowedbyApps(pkgName, uid)) { + mLog.tC("Denied: app wifi scan not allowed"); return false; } // If the User or profile is current, permission is granted // Otherwise, uid must have INTERACT_ACROSS_USERS_FULL permission. if (!isCurrentProfile(uid) && !checkInteractAcrossUsersFull(uid)) { + mLog.tC("Denied: Profile not permitted"); return false; } return true; |