3
0
Fork 0

display: Handle zero auto brightness adjustment

Some apps (such as miui camera) resets the auto brightness adjustment
to 0.0f instead of correctly using Float.NaN, causing auto brightness
animation to be disabled afterwards. Prevent this scenario by
overriding it to Float.NaN ourselves.

Change-Id: Idc39d120db306403482c7011db7c556f4f902468
This commit is contained in:
Adithya R 2023-09-07 14:43:18 +05:30 committed by ralph950412
parent 52d4e72859
commit 0cc9546ef8
1 changed files with 5 additions and 1 deletions

View File

@ -4607,7 +4607,11 @@ public final class DisplayManagerService extends SystemService {
@Override // Binder call
public void setTemporaryAutoBrightnessAdjustment(float adjustment) {
setTemporaryAutoBrightnessAdjustment_enforcePermission();
final long token = Binder.clearCallingIdentity();
if (adjustment == 0.0f) {
Slog.w(TAG, "Invalid auto brightness adjustment 0.0f, use Float.NaN instead!");
adjustment = Float.NaN;
}
final long token = Binder.clearCallingIdentity();
try {
synchronized (mSyncRoot) {
mDisplayPowerControllers.get(Display.DEFAULT_DISPLAY)