Merge "Ignore brightness change thresholds for manual changes." into qt-dev

This commit is contained in:
Santos Cordon
2019-06-09 23:58:14 +00:00
committed by Android (Google) Code Review

View File

@@ -322,7 +322,7 @@ class AutomaticBrightnessController {
} }
changed |= setLightSensorEnabled(enable && !dozing); changed |= setLightSensorEnabled(enable && !dozing);
if (changed) { if (changed) {
updateAutoBrightness(false /*sendUpdate*/); updateAutoBrightness(false /*sendUpdate*/, userInitiatedChange);
} }
} }
@@ -667,7 +667,7 @@ class AutomaticBrightnessController {
"mAmbientLightRingBuffer=" + mAmbientLightRingBuffer + ", " + "mAmbientLightRingBuffer=" + mAmbientLightRingBuffer + ", " +
"mAmbientLux=" + mAmbientLux); "mAmbientLux=" + mAmbientLux);
} }
updateAutoBrightness(true); updateAutoBrightness(true /* sendUpdate */, false /* isManuallySet */);
} }
long nextBrightenTransition = nextAmbientLightBrighteningTransition(time); long nextBrightenTransition = nextAmbientLightBrighteningTransition(time);
@@ -697,7 +697,7 @@ class AutomaticBrightnessController {
+ "mAmbientLightRingBuffer=" + mAmbientLightRingBuffer + ", " + "mAmbientLightRingBuffer=" + mAmbientLightRingBuffer + ", "
+ "mAmbientLux=" + mAmbientLux); + "mAmbientLux=" + mAmbientLux);
} }
updateAutoBrightness(true); updateAutoBrightness(true /* sendUpdate */, false /* isManuallySet */);
nextBrightenTransition = nextAmbientLightBrighteningTransition(time); nextBrightenTransition = nextAmbientLightBrighteningTransition(time);
nextDarkenTransition = nextAmbientLightDarkeningTransition(time); nextDarkenTransition = nextAmbientLightDarkeningTransition(time);
} }
@@ -717,7 +717,7 @@ class AutomaticBrightnessController {
mHandler.sendEmptyMessageAtTime(MSG_UPDATE_AMBIENT_LUX, nextTransitionTime); mHandler.sendEmptyMessageAtTime(MSG_UPDATE_AMBIENT_LUX, nextTransitionTime);
} }
private void updateAutoBrightness(boolean sendUpdate) { private void updateAutoBrightness(boolean sendUpdate, boolean isManuallySet) {
if (!mAmbientLuxValid) { if (!mAmbientLuxValid) {
return; return;
} }
@@ -732,6 +732,7 @@ class AutomaticBrightnessController {
// in which case we ignore the new screen brightness if it doesn't differ enough from the // in which case we ignore the new screen brightness if it doesn't differ enough from the
// previous one. // previous one.
if (mScreenAutoBrightness != -1 if (mScreenAutoBrightness != -1
&& !isManuallySet
&& newScreenAutoBrightness > mScreenDarkeningThreshold && newScreenAutoBrightness > mScreenDarkeningThreshold
&& newScreenAutoBrightness < mScreenBrighteningThreshold) { && newScreenAutoBrightness < mScreenBrighteningThreshold) {
if (mLoggingEnabled) { if (mLoggingEnabled) {
@@ -879,7 +880,7 @@ class AutomaticBrightnessController {
mPendingForegroundAppPackageName = null; mPendingForegroundAppPackageName = null;
mForegroundAppCategory = mPendingForegroundAppCategory; mForegroundAppCategory = mPendingForegroundAppCategory;
mPendingForegroundAppCategory = ApplicationInfo.CATEGORY_UNDEFINED; mPendingForegroundAppCategory = ApplicationInfo.CATEGORY_UNDEFINED;
updateAutoBrightness(true /* sendUpdate */); updateAutoBrightness(true /* sendUpdate */, false /* isManuallySet */);
} }
private final class AutomaticBrightnessHandler extends Handler { private final class AutomaticBrightnessHandler extends Handler {