am 89c82814: Merge "Add restoreCallingIdentity under finally" into jb-mr1-dev

* commit '89c82814dbdfd807b1611a8379be0421cd2f512d':
  Add restoreCallingIdentity under finally
This commit is contained in:
Irfan Sheriff
2012-09-16 18:56:03 -07:00
committed by Android Git Automerger

View File

@@ -640,8 +640,11 @@ public class WifiService extends IWifiManager.Stub {
*/
long ident = Binder.clearCallingIdentity();
handleWifiToggled(enable);
Binder.restoreCallingIdentity(ident);
try {
handleWifiToggled(enable);
} finally {
Binder.restoreCallingIdentity(ident);
}
if (enable) {
if (!mIsReceiverRegistered) {
@@ -838,12 +841,15 @@ public class WifiService extends IWifiManager.Stub {
enforceAccessPermission();
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();
try {
int currentUser = ActivityManager.getCurrentUser();
if (userId != currentUser) {
return new ArrayList<ScanResult>();
} else {
return mWifiStateMachine.syncGetScanResultsList();
}
} finally {
Binder.restoreCallingIdentity(ident);
}
}