Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 65bdf4e6 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am c58e9bff: am db56b9bd: Merge "Maybe fix #3076572: phone process crashes in...

am c58e9bff: am db56b9bd: Merge "Maybe fix #3076572: phone process crashes in SipService, trying to get wifi lock" into gingerbread

Merge commit 'c58e9bff'

* commit 'c58e9bff':
  Maybe fix #3076572: phone process crashes in SipService, trying to get wifi lock
parents fae998c8 c58e9bff
Loading
Loading
Loading
Loading
+22 −18
Original line number Diff line number Diff line
@@ -1148,12 +1148,12 @@ public class WifiService extends IWifiManager.Stub {
        if (lockMode != WifiManager.WIFI_MODE_FULL && lockMode != WifiManager.WIFI_MODE_SCAN_ONLY) {
            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());
        }
@@ -1201,10 +1201,6 @@ public class WifiService extends IWifiManager.Stub {
                ++mScanLocksAcquired;
                break;
            }
        } catch (RemoteException e) {
        } finally {
            Binder.restoreCallingIdentity(ident);
        }

            // Be aggressive about adding new locks into the accounted state...
            // we want to over-report rather than under-report.
@@ -1212,6 +1208,11 @@ public class WifiService extends IWifiManager.Stub {

            updateWifiState();
            return true;
        } catch (RemoteException e) {
            return false;
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
    }

    public void updateWifiLockWorkSource(IBinder lock, WorkSource ws) {
@@ -1257,9 +1258,9 @@ public class WifiService extends IWifiManager.Stub {

        hadLock = (wifiLock != null);

        if (hadLock) {
        long ident = Binder.clearCallingIdentity();
        try {
            if (hadLock) {
                noteAcquireWifiLock(wifiLock);
                switch(wifiLock.mMode) {
                    case WifiManager.WIFI_MODE_FULL:
@@ -1269,13 +1270,16 @@ public class WifiService extends IWifiManager.Stub {
                        ++mScanLocksReleased;
                        break;
                }
            }

            // 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;
    }