diff options
author | Jason Monk <jmonk@google.com> | 2014-12-08 14:01:30 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-12-08 14:01:31 +0000 |
commit | 88c9369cb6b94c30324893337aa25b1e37a15ff6 (patch) | |
tree | 8a15e7d30a1ded0c07870ec76dfe93cb1c274f00 /service | |
parent | 4724608dce2e37b9c0b260c2c7dcf3161f474df2 (diff) | |
parent | f8704c368e0fee0c7cf7e294d109dece6b72e832 (diff) | |
download | android_frameworks_opt_net_wifi-88c9369cb6b94c30324893337aa25b1e37a15ff6.tar.gz android_frameworks_opt_net_wifi-88c9369cb6b94c30324893337aa25b1e37a15ff6.tar.bz2 android_frameworks_opt_net_wifi-88c9369cb6b94c30324893337aa25b1e37a15ff6.zip |
Merge "Allow interact-users-full access to scan results" into lmp-mr1-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiServiceImpl.java | 15 |
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 11d0259e1..cc5824e67 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.. */ |