summaryrefslogtreecommitdiffstats
path: root/service
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2014-12-05 13:26:41 -0500
committerJason Monk <jmonk@google.com>2014-12-05 18:20:31 -0500
commitf8704c368e0fee0c7cf7e294d109dece6b72e832 (patch)
tree8371609c63c95ec9f933229ddbb704616dbd985f /service
parente3939cb40d9ba3842be105a6e85172dc06e14758 (diff)
downloadandroid_frameworks_opt_net_wifi-f8704c368e0fee0c7cf7e294d109dece6b72e832.tar.gz
android_frameworks_opt_net_wifi-f8704c368e0fee0c7cf7e294d109dece6b72e832.tar.bz2
android_frameworks_opt_net_wifi-f8704c368e0fee0c7cf7e294d109dece6b72e832.zip
Allow interact-users-full access to scan results
Allow callers that hold INTERACT_ACROSS_USERS_FULL access to scan results even if they aren't on the current user. Bug: 16559573 Change-Id: I27fae71b3cdc1c084777242f21fe4bb692ab7135
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index bcaab925a..8066b4c4b 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -508,13 +508,14 @@ public final class WifiServiceImpl extends IWifiManager.Stub {
if (mBatchedScanSupported == false) return new ArrayList<BatchedScanResult>();
int uid = Binder.getCallingUid();
int userId = UserHandle.getCallingUserId();
+ boolean hasInteractUsersFull = checkInteractAcrossUsersFull();
long ident = Binder.clearCallingIdentity();
try {
if (mAppOps.noteOp(AppOpsManager.OP_WIFI_SCAN, uid, callingPackage)
!= AppOpsManager.MODE_ALLOWED) {
return new ArrayList<BatchedScanResult>();
}
- if (!isCurrentProfile(userId)) {
+ if (!isCurrentProfile(userId) && !hasInteractUsersFull) {
return new ArrayList<BatchedScanResult>();
}
return mWifiStateMachine.syncGetBatchedScanResultsList();
@@ -974,13 +975,14 @@ public final class WifiServiceImpl extends IWifiManager.Stub {
enforceAccessPermission();
int userId = UserHandle.getCallingUserId();
int uid = Binder.getCallingUid();
+ boolean hasInteractUsersFull = checkInteractAcrossUsersFull();
long ident = Binder.clearCallingIdentity();
try {
if (mAppOps.noteOp(AppOpsManager.OP_WIFI_SCAN, uid, callingPackage)
!= AppOpsManager.MODE_ALLOWED) {
return new ArrayList<ScanResult>();
}
- if (!isCurrentProfile(userId)) {
+ if (!isCurrentProfile(userId) && !hasInteractUsersFull) {
return new ArrayList<ScanResult>();
}
return mWifiStateMachine.syncGetScanResultsList();
@@ -990,6 +992,15 @@ public final class WifiServiceImpl extends IWifiManager.Stub {
}
/**
+ * Returns true if the caller holds INTERACT_ACROSS_USERS_FULL.
+ */
+ private boolean checkInteractAcrossUsersFull() {
+ return mContext.checkCallingOrSelfPermission(
+ android.Manifest.permission.INTERACT_ACROSS_USERS_FULL)
+ == PackageManager.PERMISSION_GRANTED;
+ }
+
+ /**
* Returns true if the calling user is the current one or a profile of the
* current user..
*/