Skip to content

Commit

Permalink
mButtonLights could be null check before setBrightness
Browse files Browse the repository at this point in the history
This is cause of system_server crashing for devices like mi10 that will end into continuos soft bootlooping.

Change-Id: I31630b597de7ea602d360b1dfbf4cac744a6b9f0
  • Loading branch information
framework-res committed Nov 27, 2020
1 parent 4b6b957 commit 260f178
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -894,11 +894,13 @@ private void updatePowerState() {
if (state == Display.STATE_OFF) {
brightnessState = PowerManager.BRIGHTNESS_OFF_FLOAT;
mBrightnessReasonTemp.setReason(BrightnessReason.REASON_SCREEN_OFF);
if (mLights.getLight(LightsManager.LIGHT_ID_BUTTONS)!=null)
mLights.getLight(LightsManager.LIGHT_ID_BUTTONS).setBrightness(brightnessState);
}

// Disable button lights when dozing
if (state == Display.STATE_DOZE || state == Display.STATE_DOZE_SUSPEND) {
if (mLights.getLight(LightsManager.LIGHT_ID_BUTTONS)!=null)
mLights.getLight(LightsManager.LIGHT_ID_BUTTONS)
.setBrightness(PowerManager.BRIGHTNESS_OFF_FLOAT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2432,11 +2432,13 @@ private void updateUserActivitySummaryLocked(long now, int dirty) {
mLastButtonActivityTime : mLastUserActivityTime;
if (mButtonTimeout != 0 &&
now > mLastButtonActivityTime + mButtonTimeout) {
if(mButtonsLight!=null)
mButtonsLight.setBrightness(PowerManager.BRIGHTNESS_OFF_FLOAT);
mButtonOn = false;
} else {
if ((!mButtonLightOnKeypressOnly || mButtonPressed) &&
!mProximityPositive) {
if(mButtonsLight!=null)
mButtonsLight.setBrightness(buttonBrightness);
mButtonPressed = false;
if (buttonBrightness != PowerManager.BRIGHTNESS_OFF_FLOAT &&
Expand All @@ -2457,6 +2459,7 @@ private void updateUserActivitySummaryLocked(long now, int dirty) {
if (now < nextTimeout) {
mUserActivitySummary = USER_ACTIVITY_SCREEN_DIM;
if (getWakefulnessLocked() == WAKEFULNESS_AWAKE) {
if(mButtonsLight!=null)
mButtonsLight.setBrightness(PowerManager.BRIGHTNESS_OFF_FLOAT);
mButtonOn = false;
}
Expand Down

0 comments on commit 260f178

Please sign in to comment.