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

Commit 54c8ac3d authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Power manager always needs to allow wake locks for services, receivers"

parents 3b59466f 951ea690
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -2631,9 +2631,18 @@ public final class PowerManagerService extends SystemService
                state = new UidState(uid);
                mUidState.put(uid, state);
            }
            final boolean oldShouldAllow = state.mProcState
                    <= ActivityManager.PROCESS_STATE_RECEIVER;
            state.mProcState = procState;
            if (mDeviceIdleMode && state.mNumWakeLocks > 0) {
            if (state.mNumWakeLocks > 0) {
                if (mDeviceIdleMode) {
                    handleUidStateChangeLocked();
                } else if (!state.mActive && oldShouldAllow !=
                        (procState <= ActivityManager.PROCESS_STATE_RECEIVER)) {
                    // If this uid is not active, but the process state has changed such
                    // that we may still want to allow it to hold a wake lock, then take care of it.
                    handleUidStateChangeLocked();
                }
            }
        }
    }
@@ -2721,7 +2730,8 @@ public final class PowerManagerService extends SystemService
                        disabled = true;
                    }
                } else {
                    disabled = !wakeLock.mUidState.mActive;
                    disabled = !wakeLock.mUidState.mActive &&
                            wakeLock.mUidState.mProcState > ActivityManager.PROCESS_STATE_RECEIVER;
                }
            }
            if (wakeLock.mDisabled != disabled) {