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

Commit 45b8c0b9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Do not invalidate isInteractive cache on power group events." into main

parents ed99751c 2fea7634
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2332,6 +2332,8 @@ public final class PowerManagerService extends SystemService
        Trace.traceBegin(Trace.TRACE_TAG_POWER, traceMethodName);
        try {
            // Phase 2: Handle wakefulness change and bookkeeping.
            // Under lock, invalidate before set ensures caches won't return stale values.
            mInjector.invalidateIsInteractiveCaches();
            mWakefulnessRaw = newWakefulness;
            mWakefulnessChanging = true;
            mDirty |= DIRTY_WAKEFULNESS;
@@ -2429,7 +2431,6 @@ public final class PowerManagerService extends SystemService
    void onPowerGroupEventLocked(int event, PowerGroup powerGroup) {
        mWakefulnessChanging = true;
        mDirty |= DIRTY_WAKEFULNESS;
        mInjector.invalidateIsInteractiveCaches();
        final int groupId = powerGroup.getGroupId();
        if (event == DisplayGroupPowerChangeListener.DISPLAY_GROUP_REMOVED) {
            mPowerGroups.delete(groupId);
+2 −4
Original line number Diff line number Diff line
@@ -2705,12 +2705,11 @@ public class PowerManagerServiceTest {
        verify(mInvalidateInteractiveCachesMock).call();

        listener.get().onDisplayGroupAdded(nonDefaultDisplayGroupId);
        verify(mInvalidateInteractiveCachesMock, times(2)).call();

        mService.setWakefulnessLocked(Display.DEFAULT_DISPLAY_GROUP, WAKEFULNESS_ASLEEP,
                mClock.now(), 0, PowerManager.GO_TO_SLEEP_REASON_APPLICATION, 0, null, null);

        verify(mInvalidateInteractiveCachesMock, times(3)).call();
        verify(mInvalidateInteractiveCachesMock, times(2)).call();
    }

    @Test
@@ -2732,12 +2731,11 @@ public class PowerManagerServiceTest {
        verify(mInvalidateInteractiveCachesMock).call();

        listener.get().onDisplayGroupAdded(nonDefaultDisplayGroupId);
        verify(mInvalidateInteractiveCachesMock, times(2)).call();

        mService.setWakefulnessLocked(nonDefaultDisplayGroupId, WAKEFULNESS_ASLEEP, mClock.now(),
                0, PowerManager.GO_TO_SLEEP_REASON_APPLICATION, 0, null, null);

        verify(mInvalidateInteractiveCachesMock, times(3)).call();
        verify(mInvalidateInteractiveCachesMock, times(2)).call();
    }

    @Test