diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-10-08 15:09:23 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-10-08 15:09:23 -0700 |
commit | db56b9bd39e739474684987b83f386f50596aa5d (patch) | |
tree | edbd4f75423b5d6b9c5f717ebbd847d1c51f93da /services | |
parent | d8d60da616343b3520b666c385d0005db860be83 (diff) | |
parent | ecfd7f7d9588728a4579fab8af1722cefeb32d40 (diff) | |
download | frameworks_base-db56b9bd39e739474684987b83f386f50596aa5d.zip frameworks_base-db56b9bd39e739474684987b83f386f50596aa5d.tar.gz frameworks_base-db56b9bd39e739474684987b83f386f50596aa5d.tar.bz2 |
Merge "Maybe fix #3076572: phone process crashes in SipService, trying to get wifi lock" into gingerbread
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/WifiService.java | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java index 3d95bf0..a63b3d8 100644 --- a/services/java/com/android/server/WifiService.java +++ b/services/java/com/android/server/WifiService.java @@ -2163,12 +2163,12 @@ public class WifiService extends IWifiManager.Stub { if (DBG) throw new IllegalArgumentException("lockMode=" + lockMode); return false; } - if (ws != null) { - enforceWakeSourcePermission(Binder.getCallingUid(), Binder.getCallingPid()); - } if (ws != null && ws.size() == 0) { ws = null; } + if (ws != null) { + enforceWakeSourcePermission(Binder.getCallingUid(), Binder.getCallingPid()); + } if (ws == null) { ws = new WorkSource(Binder.getCallingUid()); } @@ -2227,17 +2227,18 @@ public class WifiService extends IWifiManager.Stub { ++mScanLocksAcquired; break; } + + // Be aggressive about adding new locks into the accounted state... + // we want to over-report rather than under-report. + reportStartWorkSource(); + + updateWifiState(); + return true; } catch (RemoteException e) { + return false; } finally { Binder.restoreCallingIdentity(ident); } - - // Be aggressive about adding new locks into the accounted state... - // we want to over-report rather than under-report. - reportStartWorkSource(); - - updateWifiState(); - return true; } public void updateWifiLockWorkSource(IBinder lock, WorkSource ws) { @@ -2283,9 +2284,9 @@ public class WifiService extends IWifiManager.Stub { hadLock = (wifiLock != null); - if (hadLock) { - long ident = Binder.clearCallingIdentity(); - try { + long ident = Binder.clearCallingIdentity(); + try { + if (hadLock) { noteAcquireWifiLock(wifiLock); switch(wifiLock.mMode) { case WifiManager.WIFI_MODE_FULL: @@ -2298,13 +2299,16 @@ public class WifiService extends IWifiManager.Stub { ++mScanLocksReleased; break; } - } catch (RemoteException e) { - } finally { - Binder.restoreCallingIdentity(ident); } + + // TODO - should this only happen if you hadLock? + updateWifiState(); + + } catch (RemoteException e) { + } finally { + Binder.restoreCallingIdentity(ident); } - // TODO - should this only happen if you hadLock? - updateWifiState(); + return hadLock; } |