Fix permission accessing getCurrentUser

Bug: 7174737
Change-Id: I0a6a9a46f4115743d16ada401cd67e3cf30fb380
This commit is contained in:
Irfan Sheriff
2012-09-16 17:39:26 -07:00
parent 61e8180b09
commit db831da426

View File

@@ -836,7 +836,11 @@ public class WifiService extends IWifiManager.Stub {
*/
public List<ScanResult> getScanResults() {
enforceAccessPermission();
if (UserHandle.getCallingUserId() != ActivityManager.getCurrentUser()) {
int userId = UserHandle.getCallingUserId();
long ident = Binder.clearCallingIdentity();
int currentUser = ActivityManager.getCurrentUser();
Binder.restoreCallingIdentity(ident);
if (userId != currentUser) {
return new ArrayList<ScanResult>();
} else {
return mWifiStateMachine.syncGetScanResultsList();