Loading services/core/java/com/android/server/display/DisplayPowerController2.java +8 −22 Original line number Diff line number Diff line Loading @@ -267,12 +267,10 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal // Must only be accessed on the handler thread. private DisplayPowerState mPowerState; // The currently active screen on unblocker. This field is non-null whenever // we are waiting for a callback to release it and unblock the screen. private ScreenOnUnblocker mPendingScreenOnUnblocker; private ScreenOffUnblocker mPendingScreenOffUnblocker; private WindowManagerPolicy.ScreenOnListener mPendingScreenOnUnblocker; private WindowManagerPolicy.ScreenOffListener mPendingScreenOffUnblocker; // True if we were in the process of turning off the screen. // This allows us to recover more gracefully from situations where we abort Loading Loading @@ -1758,7 +1756,9 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal private void blockScreenOn() { if (mPendingScreenOnUnblocker == null) { Trace.asyncTraceBegin(Trace.TRACE_TAG_POWER, SCREEN_ON_BLOCKED_TRACE_NAME, 0); mPendingScreenOnUnblocker = new ScreenOnUnblocker(); mPendingScreenOnUnblocker = () -> { mHandler.obtainMessage(MSG_SCREEN_ON_UNBLOCKED, this).sendToTarget(); }; mScreenOnBlockStartRealTime = SystemClock.elapsedRealtime(); Slog.i(mTag, "Blocking screen on until initial contents have been drawn."); } Loading @@ -1776,7 +1776,9 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal private void blockScreenOff() { if (mPendingScreenOffUnblocker == null) { Trace.asyncTraceBegin(Trace.TRACE_TAG_POWER, SCREEN_OFF_BLOCKED_TRACE_NAME, 0); mPendingScreenOffUnblocker = new ScreenOffUnblocker(); mPendingScreenOffUnblocker = () -> { mHandler.obtainMessage(MSG_SCREEN_ON_UNBLOCKED, this).sendToTarget(); }; mScreenOffBlockStartRealTime = SystemClock.elapsedRealtime(); Slog.i(mTag, "Blocking screen off"); } Loading Loading @@ -2560,22 +2562,6 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal } } private final class ScreenOnUnblocker implements WindowManagerPolicy.ScreenOnListener { @Override public void onScreenOn() { Message msg = mHandler.obtainMessage(MSG_SCREEN_ON_UNBLOCKED, this); mHandler.sendMessage(msg); } } private final class ScreenOffUnblocker implements WindowManagerPolicy.ScreenOffListener { @Override public void onScreenOff() { Message msg = mHandler.obtainMessage(MSG_SCREEN_OFF_UNBLOCKED, this); mHandler.sendMessage(msg); } } @Override public void setAutoBrightnessLoggingEnabled(boolean enabled) { if (mAutomaticBrightnessController != null) { Loading services/tests/mockingservicestests/src/com/android/server/display/DisplayPowerController2Test.java +1 −2 Original line number Diff line number Diff line Loading @@ -16,12 +16,11 @@ package com.android.server.display; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.content.Context; Loading services/tests/mockingservicestests/src/com/android/server/display/DisplayPowerControllerTest.java +1 −3 Original line number Diff line number Diff line Loading @@ -16,13 +16,11 @@ package com.android.server.display; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.content.Context; Loading Loading
services/core/java/com/android/server/display/DisplayPowerController2.java +8 −22 Original line number Diff line number Diff line Loading @@ -267,12 +267,10 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal // Must only be accessed on the handler thread. private DisplayPowerState mPowerState; // The currently active screen on unblocker. This field is non-null whenever // we are waiting for a callback to release it and unblock the screen. private ScreenOnUnblocker mPendingScreenOnUnblocker; private ScreenOffUnblocker mPendingScreenOffUnblocker; private WindowManagerPolicy.ScreenOnListener mPendingScreenOnUnblocker; private WindowManagerPolicy.ScreenOffListener mPendingScreenOffUnblocker; // True if we were in the process of turning off the screen. // This allows us to recover more gracefully from situations where we abort Loading Loading @@ -1758,7 +1756,9 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal private void blockScreenOn() { if (mPendingScreenOnUnblocker == null) { Trace.asyncTraceBegin(Trace.TRACE_TAG_POWER, SCREEN_ON_BLOCKED_TRACE_NAME, 0); mPendingScreenOnUnblocker = new ScreenOnUnblocker(); mPendingScreenOnUnblocker = () -> { mHandler.obtainMessage(MSG_SCREEN_ON_UNBLOCKED, this).sendToTarget(); }; mScreenOnBlockStartRealTime = SystemClock.elapsedRealtime(); Slog.i(mTag, "Blocking screen on until initial contents have been drawn."); } Loading @@ -1776,7 +1776,9 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal private void blockScreenOff() { if (mPendingScreenOffUnblocker == null) { Trace.asyncTraceBegin(Trace.TRACE_TAG_POWER, SCREEN_OFF_BLOCKED_TRACE_NAME, 0); mPendingScreenOffUnblocker = new ScreenOffUnblocker(); mPendingScreenOffUnblocker = () -> { mHandler.obtainMessage(MSG_SCREEN_ON_UNBLOCKED, this).sendToTarget(); }; mScreenOffBlockStartRealTime = SystemClock.elapsedRealtime(); Slog.i(mTag, "Blocking screen off"); } Loading Loading @@ -2560,22 +2562,6 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal } } private final class ScreenOnUnblocker implements WindowManagerPolicy.ScreenOnListener { @Override public void onScreenOn() { Message msg = mHandler.obtainMessage(MSG_SCREEN_ON_UNBLOCKED, this); mHandler.sendMessage(msg); } } private final class ScreenOffUnblocker implements WindowManagerPolicy.ScreenOffListener { @Override public void onScreenOff() { Message msg = mHandler.obtainMessage(MSG_SCREEN_OFF_UNBLOCKED, this); mHandler.sendMessage(msg); } } @Override public void setAutoBrightnessLoggingEnabled(boolean enabled) { if (mAutomaticBrightnessController != null) { Loading
services/tests/mockingservicestests/src/com/android/server/display/DisplayPowerController2Test.java +1 −2 Original line number Diff line number Diff line Loading @@ -16,12 +16,11 @@ package com.android.server.display; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.content.Context; Loading
services/tests/mockingservicestests/src/com/android/server/display/DisplayPowerControllerTest.java +1 −3 Original line number Diff line number Diff line Loading @@ -16,13 +16,11 @@ package com.android.server.display; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.content.Context; Loading