Loading services/core/java/com/android/server/display/DisplayPowerController.java +6 −7 Original line number Diff line number Diff line Loading @@ -65,7 +65,6 @@ import android.util.IndentingPrintWriter; import android.util.MathUtils; import android.util.MutableFloat; import android.util.MutableInt; import android.util.Pair; import android.util.Slog; import android.util.SparseArray; import android.view.Display; Loading Loading @@ -97,6 +96,7 @@ import com.android.server.display.feature.DisplayManagerFlags; import com.android.server.display.layout.Layout; import com.android.server.display.plugin.PluginManager; import com.android.server.display.state.DisplayStateController; import com.android.server.display.state.DisplayStateController.DisplayState; import com.android.server.display.utils.DebugUtils; import com.android.server.display.utils.SensorUtils; import com.android.server.display.whitebalance.DisplayWhiteBalanceController; Loading Loading @@ -1365,10 +1365,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mustNotify = !mDisplayReadyLocked; } final Pair<Integer, Integer> stateAndReason = mDisplayStateController .updateDisplayState(mPowerRequest, mIsEnabled, mIsInTransition); int state = stateAndReason.first; final DisplayState displayState = mDisplayStateController.updateDisplayState( mPowerRequest, mIsEnabled, mIsInTransition); int state = displayState.state(); // Initialize things the first time the power state is changed. if (mustInitialize) { Loading @@ -1379,7 +1378,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call // The transition may be deferred, so after this point we will use the // actual state instead of the desired one. animateScreenStateChange( state, /* reason= */ stateAndReason.second, state, displayState.reason(), mDisplayStateController.shouldPerformScreenOffTransition()); state = mPowerState.getScreenState(); Loading Loading @@ -1806,7 +1805,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mTempBrightnessEvent.setPhysicalDisplayId(mUniqueDisplayId); mTempBrightnessEvent.setPhysicalDisplayName(mPhysicalDisplayName); mTempBrightnessEvent.setDisplayState(state); mTempBrightnessEvent.setDisplayStateReason(stateAndReason.second); mTempBrightnessEvent.setDisplayStateReason(displayState.reason()); mTempBrightnessEvent.setDisplayPolicy(mPowerRequest.policy); mTempBrightnessEvent.setReason(mBrightnessReason); mTempBrightnessEvent.setHbmMax(hbmMax); Loading services/core/java/com/android/server/display/state/DisplayStateController.java +5 −5 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.server.display.state; import android.hardware.display.DisplayManagerInternal; import android.util.IndentingPrintWriter; import android.util.Pair; import android.view.Display; import com.android.server.display.DisplayPowerProximityStateController; Loading Loading @@ -52,10 +51,9 @@ public class DisplayStateController { * @param isDisplayEnabled A boolean flag representing if the display is enabled * @param isDisplayInTransition A boolean flag representing if the display is undergoing the * transition phase * @return a {@link Pair} of integers, the first being the updated display state, and the second * being the reason behind the new display state. * @return the display state and reason */ public Pair<Integer, Integer> updateDisplayState( public DisplayState updateDisplayState( DisplayManagerInternal.DisplayPowerRequest displayPowerRequest, boolean isDisplayEnabled, boolean isDisplayInTransition) { Loading Loading @@ -96,7 +94,7 @@ public class DisplayStateController { state = Display.STATE_OFF; } return new Pair(state, reason); return new DisplayState(state, reason); } /** Overrides the doze screen state with a given reason. */ Loading Loading @@ -129,4 +127,6 @@ public class DisplayStateController { mDisplayPowerProximityStateController.dumpLocal(ipw); } } public record DisplayState(int state, @Display.StateReason int reason) {} } services/tests/displayservicetests/src/com/android/server/display/state/DisplayStateControllerTest.java +32 −33 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.hardware.display.DisplayManagerInternal; import android.util.Pair; import android.view.Display; import androidx.test.filters.SmallTest; Loading Loading @@ -66,11 +65,11 @@ public final class DisplayStateControllerTest { displayPowerRequest.policy = DisplayManagerInternal.DisplayPowerRequest.POLICY_OFF; displayPowerRequest.policyReason = Display.STATE_REASON_KEY; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_OFF == stateAndReason.first); assertTrue(Display.STATE_REASON_KEY == stateAndReason.second); assertTrue(Display.STATE_OFF == displayState.state()); assertTrue(Display.STATE_REASON_KEY == displayState.reason()); verify(mDisplayPowerProximityStateController).updateProximityState(displayPowerRequest, Display.STATE_OFF); assertEquals(true, mDisplayStateController.shouldPerformScreenOffTransition()); Loading Loading @@ -109,11 +108,11 @@ public final class DisplayStateControllerTest { displayPowerRequest.policy = DisplayManagerInternal.DisplayPowerRequest.POLICY_BRIGHT; displayPowerRequest.policyReason = Display.STATE_REASON_KEY; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, !DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_OFF == stateAndReason.first); assertTrue(Display.STATE_REASON_KEY == stateAndReason.second); assertTrue(Display.STATE_OFF == displayState.state()); assertTrue(Display.STATE_REASON_KEY == displayState.reason()); verify(mDisplayPowerProximityStateController).updateProximityState(displayPowerRequest, Display.STATE_ON); assertEquals(false, mDisplayStateController.shouldPerformScreenOffTransition()); Loading @@ -128,11 +127,11 @@ public final class DisplayStateControllerTest { displayPowerRequest.policy = DisplayManagerInternal.DisplayPowerRequest.POLICY_BRIGHT; displayPowerRequest.policyReason = Display.STATE_REASON_MOTION; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_OFF == stateAndReason.first); assertTrue(Display.STATE_REASON_MOTION == stateAndReason.second); assertTrue(Display.STATE_OFF == displayState.state()); assertTrue(Display.STATE_REASON_MOTION == displayState.reason()); verify(mDisplayPowerProximityStateController).updateProximityState(displayPowerRequest, Display.STATE_ON); assertEquals(false, mDisplayStateController.shouldPerformScreenOffTransition()); Loading @@ -147,11 +146,11 @@ public final class DisplayStateControllerTest { displayPowerRequest.policy = DisplayManagerInternal.DisplayPowerRequest.POLICY_BRIGHT; displayPowerRequest.policyReason = Display.STATE_REASON_DEFAULT_POLICY; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_OFF == stateAndReason.first); assertTrue(Display.STATE_REASON_DEFAULT_POLICY == stateAndReason.second); assertTrue(Display.STATE_OFF == displayState.state()); assertTrue(Display.STATE_REASON_DEFAULT_POLICY == displayState.reason()); verify(mDisplayPowerProximityStateController).updateProximityState(displayPowerRequest, Display.STATE_ON); assertEquals(false, mDisplayStateController.shouldPerformScreenOffTransition()); Loading @@ -166,12 +165,12 @@ public final class DisplayStateControllerTest { mDisplayStateController.overrideDozeScreenState( Display.STATE_DOZE_SUSPEND, Display.STATE_REASON_OFFLOAD); Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_DOZE_SUSPEND == stateAndReason.first); assertTrue(Display.STATE_REASON_OFFLOAD == stateAndReason.second); assertTrue(Display.STATE_DOZE_SUSPEND == displayState.state()); assertTrue(Display.STATE_REASON_OFFLOAD == displayState.reason()); } @Test Loading @@ -183,12 +182,12 @@ public final class DisplayStateControllerTest { mDisplayStateController.overrideDozeScreenState( Display.STATE_DOZE_SUSPEND, Display.STATE_REASON_DRAW_WAKE_LOCK); Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_OFF == stateAndReason.first); assertTrue(Display.STATE_REASON_DEFAULT_POLICY == stateAndReason.second); assertTrue(Display.STATE_OFF == displayState.state()); assertTrue(Display.STATE_REASON_DEFAULT_POLICY == displayState.reason()); } @Test Loading @@ -198,12 +197,12 @@ public final class DisplayStateControllerTest { displayPowerRequest.policy = DisplayManagerInternal.DisplayPowerRequest.POLICY_OFF; displayPowerRequest.policyReason = Display.STATE_REASON_KEY; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_OFF == stateAndReason.first); assertTrue(Display.STATE_REASON_KEY == stateAndReason.second); assertTrue(Display.STATE_OFF == displayState.state()); assertTrue(Display.STATE_REASON_KEY == displayState.reason()); } @Test Loading @@ -213,12 +212,12 @@ public final class DisplayStateControllerTest { displayPowerRequest.policy = DisplayManagerInternal.DisplayPowerRequest.POLICY_BRIGHT; displayPowerRequest.policyReason = Display.STATE_REASON_DREAM_MANAGER; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_ON == stateAndReason.first); assertTrue(Display.STATE_REASON_DREAM_MANAGER == stateAndReason.second); assertTrue(Display.STATE_ON == displayState.state()); assertTrue(Display.STATE_REASON_DREAM_MANAGER == displayState.reason()); } @Test Loading @@ -230,12 +229,12 @@ public final class DisplayStateControllerTest { displayPowerRequest.dozeScreenState = Display.STATE_ON; displayPowerRequest.dozeScreenStateReason = Display.STATE_REASON_OFFLOAD; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_ON == stateAndReason.first); assertTrue(Display.STATE_REASON_OFFLOAD == stateAndReason.second); assertTrue(Display.STATE_ON == displayState.state()); assertTrue(Display.STATE_REASON_OFFLOAD == displayState.reason()); } @Test Loading Loading @@ -270,17 +269,17 @@ public final class DisplayStateControllerTest { assertEquals(false, mDisplayStateController.shouldPerformScreenOffTransition()); } private void validDisplayState(int policy, int displayState, boolean isEnabled, private void validDisplayState(int policy, int state, boolean isEnabled, boolean isInTransition) { DisplayManagerInternal.DisplayPowerRequest displayPowerRequest = mock( DisplayManagerInternal.DisplayPowerRequest.class); displayPowerRequest.policy = policy; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, isEnabled, isInTransition); assertTrue(displayState == stateAndReason.first); verify(mDisplayPowerProximityStateController).updateProximityState(displayPowerRequest, displayState); assertTrue(state == displayState.state()); verify(mDisplayPowerProximityStateController).updateProximityState( displayPowerRequest, state); assertEquals(false, mDisplayStateController.shouldPerformScreenOffTransition()); } } Loading
services/core/java/com/android/server/display/DisplayPowerController.java +6 −7 Original line number Diff line number Diff line Loading @@ -65,7 +65,6 @@ import android.util.IndentingPrintWriter; import android.util.MathUtils; import android.util.MutableFloat; import android.util.MutableInt; import android.util.Pair; import android.util.Slog; import android.util.SparseArray; import android.view.Display; Loading Loading @@ -97,6 +96,7 @@ import com.android.server.display.feature.DisplayManagerFlags; import com.android.server.display.layout.Layout; import com.android.server.display.plugin.PluginManager; import com.android.server.display.state.DisplayStateController; import com.android.server.display.state.DisplayStateController.DisplayState; import com.android.server.display.utils.DebugUtils; import com.android.server.display.utils.SensorUtils; import com.android.server.display.whitebalance.DisplayWhiteBalanceController; Loading Loading @@ -1365,10 +1365,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mustNotify = !mDisplayReadyLocked; } final Pair<Integer, Integer> stateAndReason = mDisplayStateController .updateDisplayState(mPowerRequest, mIsEnabled, mIsInTransition); int state = stateAndReason.first; final DisplayState displayState = mDisplayStateController.updateDisplayState( mPowerRequest, mIsEnabled, mIsInTransition); int state = displayState.state(); // Initialize things the first time the power state is changed. if (mustInitialize) { Loading @@ -1379,7 +1378,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call // The transition may be deferred, so after this point we will use the // actual state instead of the desired one. animateScreenStateChange( state, /* reason= */ stateAndReason.second, state, displayState.reason(), mDisplayStateController.shouldPerformScreenOffTransition()); state = mPowerState.getScreenState(); Loading Loading @@ -1806,7 +1805,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mTempBrightnessEvent.setPhysicalDisplayId(mUniqueDisplayId); mTempBrightnessEvent.setPhysicalDisplayName(mPhysicalDisplayName); mTempBrightnessEvent.setDisplayState(state); mTempBrightnessEvent.setDisplayStateReason(stateAndReason.second); mTempBrightnessEvent.setDisplayStateReason(displayState.reason()); mTempBrightnessEvent.setDisplayPolicy(mPowerRequest.policy); mTempBrightnessEvent.setReason(mBrightnessReason); mTempBrightnessEvent.setHbmMax(hbmMax); Loading
services/core/java/com/android/server/display/state/DisplayStateController.java +5 −5 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.server.display.state; import android.hardware.display.DisplayManagerInternal; import android.util.IndentingPrintWriter; import android.util.Pair; import android.view.Display; import com.android.server.display.DisplayPowerProximityStateController; Loading Loading @@ -52,10 +51,9 @@ public class DisplayStateController { * @param isDisplayEnabled A boolean flag representing if the display is enabled * @param isDisplayInTransition A boolean flag representing if the display is undergoing the * transition phase * @return a {@link Pair} of integers, the first being the updated display state, and the second * being the reason behind the new display state. * @return the display state and reason */ public Pair<Integer, Integer> updateDisplayState( public DisplayState updateDisplayState( DisplayManagerInternal.DisplayPowerRequest displayPowerRequest, boolean isDisplayEnabled, boolean isDisplayInTransition) { Loading Loading @@ -96,7 +94,7 @@ public class DisplayStateController { state = Display.STATE_OFF; } return new Pair(state, reason); return new DisplayState(state, reason); } /** Overrides the doze screen state with a given reason. */ Loading Loading @@ -129,4 +127,6 @@ public class DisplayStateController { mDisplayPowerProximityStateController.dumpLocal(ipw); } } public record DisplayState(int state, @Display.StateReason int reason) {} }
services/tests/displayservicetests/src/com/android/server/display/state/DisplayStateControllerTest.java +32 −33 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.hardware.display.DisplayManagerInternal; import android.util.Pair; import android.view.Display; import androidx.test.filters.SmallTest; Loading Loading @@ -66,11 +65,11 @@ public final class DisplayStateControllerTest { displayPowerRequest.policy = DisplayManagerInternal.DisplayPowerRequest.POLICY_OFF; displayPowerRequest.policyReason = Display.STATE_REASON_KEY; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_OFF == stateAndReason.first); assertTrue(Display.STATE_REASON_KEY == stateAndReason.second); assertTrue(Display.STATE_OFF == displayState.state()); assertTrue(Display.STATE_REASON_KEY == displayState.reason()); verify(mDisplayPowerProximityStateController).updateProximityState(displayPowerRequest, Display.STATE_OFF); assertEquals(true, mDisplayStateController.shouldPerformScreenOffTransition()); Loading Loading @@ -109,11 +108,11 @@ public final class DisplayStateControllerTest { displayPowerRequest.policy = DisplayManagerInternal.DisplayPowerRequest.POLICY_BRIGHT; displayPowerRequest.policyReason = Display.STATE_REASON_KEY; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, !DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_OFF == stateAndReason.first); assertTrue(Display.STATE_REASON_KEY == stateAndReason.second); assertTrue(Display.STATE_OFF == displayState.state()); assertTrue(Display.STATE_REASON_KEY == displayState.reason()); verify(mDisplayPowerProximityStateController).updateProximityState(displayPowerRequest, Display.STATE_ON); assertEquals(false, mDisplayStateController.shouldPerformScreenOffTransition()); Loading @@ -128,11 +127,11 @@ public final class DisplayStateControllerTest { displayPowerRequest.policy = DisplayManagerInternal.DisplayPowerRequest.POLICY_BRIGHT; displayPowerRequest.policyReason = Display.STATE_REASON_MOTION; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_OFF == stateAndReason.first); assertTrue(Display.STATE_REASON_MOTION == stateAndReason.second); assertTrue(Display.STATE_OFF == displayState.state()); assertTrue(Display.STATE_REASON_MOTION == displayState.reason()); verify(mDisplayPowerProximityStateController).updateProximityState(displayPowerRequest, Display.STATE_ON); assertEquals(false, mDisplayStateController.shouldPerformScreenOffTransition()); Loading @@ -147,11 +146,11 @@ public final class DisplayStateControllerTest { displayPowerRequest.policy = DisplayManagerInternal.DisplayPowerRequest.POLICY_BRIGHT; displayPowerRequest.policyReason = Display.STATE_REASON_DEFAULT_POLICY; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_OFF == stateAndReason.first); assertTrue(Display.STATE_REASON_DEFAULT_POLICY == stateAndReason.second); assertTrue(Display.STATE_OFF == displayState.state()); assertTrue(Display.STATE_REASON_DEFAULT_POLICY == displayState.reason()); verify(mDisplayPowerProximityStateController).updateProximityState(displayPowerRequest, Display.STATE_ON); assertEquals(false, mDisplayStateController.shouldPerformScreenOffTransition()); Loading @@ -166,12 +165,12 @@ public final class DisplayStateControllerTest { mDisplayStateController.overrideDozeScreenState( Display.STATE_DOZE_SUSPEND, Display.STATE_REASON_OFFLOAD); Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_DOZE_SUSPEND == stateAndReason.first); assertTrue(Display.STATE_REASON_OFFLOAD == stateAndReason.second); assertTrue(Display.STATE_DOZE_SUSPEND == displayState.state()); assertTrue(Display.STATE_REASON_OFFLOAD == displayState.reason()); } @Test Loading @@ -183,12 +182,12 @@ public final class DisplayStateControllerTest { mDisplayStateController.overrideDozeScreenState( Display.STATE_DOZE_SUSPEND, Display.STATE_REASON_DRAW_WAKE_LOCK); Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_OFF == stateAndReason.first); assertTrue(Display.STATE_REASON_DEFAULT_POLICY == stateAndReason.second); assertTrue(Display.STATE_OFF == displayState.state()); assertTrue(Display.STATE_REASON_DEFAULT_POLICY == displayState.reason()); } @Test Loading @@ -198,12 +197,12 @@ public final class DisplayStateControllerTest { displayPowerRequest.policy = DisplayManagerInternal.DisplayPowerRequest.POLICY_OFF; displayPowerRequest.policyReason = Display.STATE_REASON_KEY; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_OFF == stateAndReason.first); assertTrue(Display.STATE_REASON_KEY == stateAndReason.second); assertTrue(Display.STATE_OFF == displayState.state()); assertTrue(Display.STATE_REASON_KEY == displayState.reason()); } @Test Loading @@ -213,12 +212,12 @@ public final class DisplayStateControllerTest { displayPowerRequest.policy = DisplayManagerInternal.DisplayPowerRequest.POLICY_BRIGHT; displayPowerRequest.policyReason = Display.STATE_REASON_DREAM_MANAGER; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_ON == stateAndReason.first); assertTrue(Display.STATE_REASON_DREAM_MANAGER == stateAndReason.second); assertTrue(Display.STATE_ON == displayState.state()); assertTrue(Display.STATE_REASON_DREAM_MANAGER == displayState.reason()); } @Test Loading @@ -230,12 +229,12 @@ public final class DisplayStateControllerTest { displayPowerRequest.dozeScreenState = Display.STATE_ON; displayPowerRequest.dozeScreenStateReason = Display.STATE_REASON_OFFLOAD; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, DISPLAY_ENABLED, !DISPLAY_IN_TRANSITION); assertTrue(Display.STATE_ON == stateAndReason.first); assertTrue(Display.STATE_REASON_OFFLOAD == stateAndReason.second); assertTrue(Display.STATE_ON == displayState.state()); assertTrue(Display.STATE_REASON_OFFLOAD == displayState.reason()); } @Test Loading Loading @@ -270,17 +269,17 @@ public final class DisplayStateControllerTest { assertEquals(false, mDisplayStateController.shouldPerformScreenOffTransition()); } private void validDisplayState(int policy, int displayState, boolean isEnabled, private void validDisplayState(int policy, int state, boolean isEnabled, boolean isInTransition) { DisplayManagerInternal.DisplayPowerRequest displayPowerRequest = mock( DisplayManagerInternal.DisplayPowerRequest.class); displayPowerRequest.policy = policy; Pair<Integer, Integer> stateAndReason = var displayState = mDisplayStateController.updateDisplayState( displayPowerRequest, isEnabled, isInTransition); assertTrue(displayState == stateAndReason.first); verify(mDisplayPowerProximityStateController).updateProximityState(displayPowerRequest, displayState); assertTrue(state == displayState.state()); verify(mDisplayPowerProximityStateController).updateProximityState( displayPowerRequest, state); assertEquals(false, mDisplayStateController.shouldPerformScreenOffTransition()); } }