@@ -1689,6 +1689,11 @@ private int setScreenStateLocked(boolean on) {
16891689 // before showing it to the user. We want the light off
16901690 // until it is ready to be shown to the user, not it using
16911691 // whatever the last value it had.
1692+ if (DEBUG_SCREEN_ON ) {
1693+ Slog .i (TAG , "Forcing brightness 0: mPowerState=0x"
1694+ + Integer .toHexString (mPowerState )
1695+ + " mSkippedScreenOn=" + mSkippedScreenOn );
1696+ }
16921697 mScreenBrightness .forceValueLocked (Power .BRIGHTNESS_OFF );
16931698 }
16941699 }
@@ -2038,12 +2043,14 @@ private void updateLightsLocked(int newState, int forceState) {
20382043 } finally {
20392044 Binder .restoreCallingIdentity (identity );
20402045 }
2041- mScreenBrightness .setTargetLocked (brightness , steps ,
2042- INITIAL_SCREEN_BRIGHTNESS , nominalCurrentValue );
2043- if (DEBUG_SCREEN_ON ) {
2044- RuntimeException e = new RuntimeException ("here" );
2045- e .fillInStackTrace ();
2046- Slog .i (TAG , "Setting screen brightness: " + brightness , e );
2046+ if (!mSkippedScreenOn ) {
2047+ mScreenBrightness .setTargetLocked (brightness , steps ,
2048+ INITIAL_SCREEN_BRIGHTNESS , nominalCurrentValue );
2049+ if (DEBUG_SCREEN_ON ) {
2050+ RuntimeException e = new RuntimeException ("here" );
2051+ e .fillInStackTrace ();
2052+ Slog .i (TAG , "Setting screen brightness: " + brightness , e );
2053+ }
20472054 }
20482055 }
20492056
@@ -2086,6 +2093,11 @@ private void setLightBrightness(int mask, int value) {
20862093 ? LightsService .BRIGHTNESS_MODE_SENSOR
20872094 : LightsService .BRIGHTNESS_MODE_USER );
20882095 if ((mask & SCREEN_BRIGHT_BIT ) != 0 ) {
2096+ if (DEBUG_SCREEN_ON ) {
2097+ RuntimeException e = new RuntimeException ("here" );
2098+ e .fillInStackTrace ();
2099+ Slog .i (TAG , "Set LCD brightness: " + value , e );
2100+ }
20892101 mLcdLight .setBrightness (value , brightnessMode );
20902102 }
20912103 if ((mask & BUTTON_BRIGHT_BIT ) != 0 ) {
@@ -2137,7 +2149,7 @@ void setTargetLocked(int target, int stepsToTarget, int initialValue,
21372149 delta = (targetValue -
21382150 (nominalCurrentValue >= 0 ? nominalCurrentValue : curValue ))
21392151 / stepsToTarget ;
2140- if (mSpew ) {
2152+ if (mSpew || DEBUG_SCREEN_ON ) {
21412153 String noticeMe = nominalCurrentValue == curValue ? "" : " ******************" ;
21422154 Slog .i (TAG , "setTargetLocked mask=" + mask + " curValue=" + curValue
21432155 + " target=" + target + " targetValue=" + targetValue + " delta=" + delta
@@ -2527,8 +2539,10 @@ private void lightSensorChangedLocked(int value) {
25272539 }
25282540
25292541 if (mAutoBrightessEnabled && mScreenBrightnessOverride < 0 ) {
2530- mScreenBrightness .setTargetLocked (lcdValue , AUTOBRIGHTNESS_ANIM_STEPS ,
2531- INITIAL_SCREEN_BRIGHTNESS , (int )mScreenBrightness .curValue );
2542+ if (!mSkippedScreenOn ) {
2543+ mScreenBrightness .setTargetLocked (lcdValue , AUTOBRIGHTNESS_ANIM_STEPS ,
2544+ INITIAL_SCREEN_BRIGHTNESS , (int )mScreenBrightness .curValue );
2545+ }
25322546 }
25332547 if (mButtonBrightnessOverride < 0 ) {
25342548 mButtonLight .setBrightness (buttonValue );
0 commit comments