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

Commit 227afd3a authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am 1188f5e7: Merge "Fix problem where power manager was calling battery stats...

am 1188f5e7: Merge "Fix problem where power manager was calling battery stats with bad wl type." into gingerbread

Merge commit '1188f5e7' into gingerbread-plus-aosp

* commit '1188f5e7':
  Fix problem where power manager was calling battery stats with bad wl type.
parents 86e19914 1188f5e7
Loading
Loading
Loading
Loading
+36 −38
Original line number Diff line number Diff line
@@ -660,6 +660,8 @@ class PowerManagerService extends IPowerManager.Stub
    }

    void noteStartWakeLocked(WakeLock wl, WorkSource ws) {
        if (wl.monitorType >= 0) {
            long origId = Binder.clearCallingIdentity();
            try {
                if (ws != null) {
                    mBatteryStats.noteStartWakelockFromSource(ws, wl.pid, wl.tag,
@@ -669,10 +671,15 @@ class PowerManagerService extends IPowerManager.Stub
                }
            } catch (RemoteException e) {
                // Ignore
            } finally {
                Binder.restoreCallingIdentity(origId);
            }
        }
    }

    void noteStopWakeLocked(WakeLock wl, WorkSource ws) {
        if (wl.monitorType >= 0) {
            long origId = Binder.clearCallingIdentity();
            try {
                if (ws != null) {
                    mBatteryStats.noteStopWakelockFromSource(ws, wl.pid, wl.tag,
@@ -682,6 +689,9 @@ class PowerManagerService extends IPowerManager.Stub
                }
            } catch (RemoteException e) {
                // Ignore
            } finally {
                Binder.restoreCallingIdentity(origId);
            }
        }
    }

@@ -813,8 +823,6 @@ class PowerManagerService extends IPowerManager.Stub
        if (ws != null) {
            enforceWakeSourcePermission(uid, pid);
        }
        long ident = Binder.clearCallingIdentity();
        try {
        synchronized (mLocks) {
            int index = mLocks.getIndex(lock);
            if (index < 0) {
@@ -826,9 +834,6 @@ class PowerManagerService extends IPowerManager.Stub
            noteStopWakeLocked(wl, oldsource);
            noteStartWakeLocked(wl, ws);
        }
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
    }

    public void releaseWakeLock(IBinder lock, int flags) {
@@ -884,14 +889,7 @@ class PowerManagerService extends IPowerManager.Stub
        // Unlink the lock from the binder.
        wl.binder.unlinkToDeath(wl, 0);

        if (wl.monitorType >= 0) {
            long origId = Binder.clearCallingIdentity();
            try {
        noteStopWakeLocked(wl, wl.ws);
            } finally {
                Binder.restoreCallingIdentity(origId);
            }
        }
    }

    private class PokeLock implements IBinder.DeathRecipient