Merge "Maybe fix #3076572: phone process crashes in SipService, trying to get wifi lock" into gingerbread
This commit is contained in:
committed by
Android (Google) Code Review
commit
db56b9bd39
@@ -2163,12 +2163,12 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
if (DBG) throw new IllegalArgumentException("lockMode=" + lockMode);
|
if (DBG) throw new IllegalArgumentException("lockMode=" + lockMode);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ws != null) {
|
|
||||||
enforceWakeSourcePermission(Binder.getCallingUid(), Binder.getCallingPid());
|
|
||||||
}
|
|
||||||
if (ws != null && ws.size() == 0) {
|
if (ws != null && ws.size() == 0) {
|
||||||
ws = null;
|
ws = null;
|
||||||
}
|
}
|
||||||
|
if (ws != null) {
|
||||||
|
enforceWakeSourcePermission(Binder.getCallingUid(), Binder.getCallingPid());
|
||||||
|
}
|
||||||
if (ws == null) {
|
if (ws == null) {
|
||||||
ws = new WorkSource(Binder.getCallingUid());
|
ws = new WorkSource(Binder.getCallingUid());
|
||||||
}
|
}
|
||||||
@@ -2227,10 +2227,6 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
++mScanLocksAcquired;
|
++mScanLocksAcquired;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
|
||||||
} finally {
|
|
||||||
Binder.restoreCallingIdentity(ident);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Be aggressive about adding new locks into the accounted state...
|
// Be aggressive about adding new locks into the accounted state...
|
||||||
// we want to over-report rather than under-report.
|
// we want to over-report rather than under-report.
|
||||||
@@ -2238,6 +2234,11 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
|
|
||||||
updateWifiState();
|
updateWifiState();
|
||||||
return true;
|
return true;
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(ident);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateWifiLockWorkSource(IBinder lock, WorkSource ws) {
|
public void updateWifiLockWorkSource(IBinder lock, WorkSource ws) {
|
||||||
@@ -2283,9 +2284,9 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
|
|
||||||
hadLock = (wifiLock != null);
|
hadLock = (wifiLock != null);
|
||||||
|
|
||||||
if (hadLock) {
|
|
||||||
long ident = Binder.clearCallingIdentity();
|
long ident = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
|
if (hadLock) {
|
||||||
noteAcquireWifiLock(wifiLock);
|
noteAcquireWifiLock(wifiLock);
|
||||||
switch(wifiLock.mMode) {
|
switch(wifiLock.mMode) {
|
||||||
case WifiManager.WIFI_MODE_FULL:
|
case WifiManager.WIFI_MODE_FULL:
|
||||||
@@ -2298,13 +2299,16 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
++mScanLocksReleased;
|
++mScanLocksReleased;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO - should this only happen if you hadLock?
|
||||||
|
updateWifiState();
|
||||||
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(ident);
|
Binder.restoreCallingIdentity(ident);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// TODO - should this only happen if you hadLock?
|
|
||||||
updateWifiState();
|
|
||||||
return hadLock;
|
return hadLock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user