Loading core/java/android/hardware/display/BrightnessInfo.java +4 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,8 @@ public final class BrightnessInfo implements Parcelable { @IntDef(prefix = {"BRIGHTNESS_MAX_REASON_"}, value = { BRIGHTNESS_MAX_REASON_NONE, BRIGHTNESS_MAX_REASON_THERMAL, BRIGHTNESS_MAX_REASON_POWER_IC BRIGHTNESS_MAX_REASON_POWER_IC, BRIGHTNESS_MAX_REASON_WEAR_BEDTIME_MODE }) @Retention(RetentionPolicy.SOURCE) public @interface BrightnessMaxReason {} Loading Loading @@ -157,6 +158,8 @@ public final class BrightnessInfo implements Parcelable { return "thermal"; case BRIGHTNESS_MAX_REASON_POWER_IC: return "power IC"; case BRIGHTNESS_MAX_REASON_WEAR_BEDTIME_MODE: return "wear bedtime"; } return "invalid"; } Loading core/jni/android_util_Process.cpp +31 −21 Original line number Diff line number Diff line Loading @@ -1063,8 +1063,8 @@ jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz, } env->ReleaseStringUTFChars(file, file8); // Most proc files we read are small, so we only go through the // loop once and use the stack buffer. We allocate a buffer big // Most proc files we read are small, so we go through the loop // with the stack buffer firstly. We allocate a buffer big // enough for the whole file. char readBufferStack[kProcReadStackBufferSize]; Loading @@ -1072,30 +1072,38 @@ jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz, char* readBuffer = &readBufferStack[0]; ssize_t readBufferSize = kProcReadStackBufferSize; ssize_t numberBytesRead; off_t offset = 0; for (;;) { ssize_t requestedBufferSize = readBufferSize - offset; // By using pread, we can avoid an lseek to rewind the FD // before retry, saving a system call. numberBytesRead = pread(fd, readBuffer, readBufferSize, 0); if (numberBytesRead < 0 && errno == EINTR) { continue; } numberBytesRead = TEMP_FAILURE_RETRY(pread(fd, readBuffer + offset, requestedBufferSize, offset)); if (numberBytesRead < 0) { if (kDebugProc) { ALOGW("Unable to open process file: %s fd=%d\n", file8, fd.get()); ALOGW("Unable to read process file err: %s file: %s fd=%d\n", strerror_r(errno, &readBufferStack[0], sizeof(readBufferStack)), file8, fd.get()); } return JNI_FALSE; } if (numberBytesRead < readBufferSize) { if (numberBytesRead == 0) { // End of file. numberBytesRead = offset; break; } if (numberBytesRead < requestedBufferSize) { // Read less bytes than requested, it's not an error per pread(2). offset += numberBytesRead; } else { // Buffer is fully used, try to grow it. if (readBufferSize > std::numeric_limits<ssize_t>::max() / 2) { if (kDebugProc) { ALOGW("Proc file too big: %s fd=%d\n", file8, fd.get()); } return JNI_FALSE; } readBufferSize = std::max(readBufferSize * 2, kProcReadMinHeapBufferSize); readBufferSize = std::max(readBufferSize * 2, kProcReadMinHeapBufferSize); readBufferHeap.reset(); // Free address space before getting more. readBufferHeap = std::make_unique<char[]>(readBufferSize); if (!readBufferHeap) { Loading @@ -1103,6 +1111,8 @@ jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz, return JNI_FALSE; } readBuffer = readBufferHeap.get(); offset = 0; } } // parseProcLineArray below modifies the buffer while parsing! Loading services/core/java/com/android/server/display/DisplayBrightnessState.java +36 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.display; import android.hardware.display.BrightnessInfo; import android.text.TextUtils; import com.android.server.display.brightness.BrightnessEvent; Loading Loading @@ -50,6 +51,8 @@ public final class DisplayBrightnessState { private final boolean mIsUserInitiatedChange; private @BrightnessInfo.BrightnessMaxReason int mBrightnessMaxReason; private DisplayBrightnessState(Builder builder) { mBrightness = builder.getBrightness(); mHdrBrightness = builder.getHdrBrightness(); Loading @@ -64,6 +67,7 @@ public final class DisplayBrightnessState { mBrightnessEvent = builder.getBrightnessEvent(); mBrightnessAdjustmentFlag = builder.getBrightnessAdjustmentFlag(); mIsUserInitiatedChange = builder.isUserInitiatedChange(); mBrightnessMaxReason = builder.getBrightnessMaxReason(); } /** Loading Loading @@ -159,6 +163,13 @@ public final class DisplayBrightnessState { return mIsUserInitiatedChange; } /** * Gets reason for max brightness restriction */ public @BrightnessInfo.BrightnessMaxReason int getBrightnessMaxReason() { return mBrightnessMaxReason; } @Override public String toString() { StringBuilder stringBuilder = new StringBuilder("DisplayBrightnessState:"); Loading @@ -180,6 +191,8 @@ public final class DisplayBrightnessState { .append(Objects.toString(mBrightnessEvent, "null")); stringBuilder.append("\n mBrightnessAdjustmentFlag:").append(mBrightnessAdjustmentFlag); stringBuilder.append("\n mIsUserInitiatedChange:").append(mIsUserInitiatedChange); stringBuilder.append("\n mBrightnessMaxReason:") .append(BrightnessInfo.briMaxReasonToString(mBrightnessMaxReason)); return stringBuilder.toString(); } Loading Loading @@ -212,7 +225,8 @@ public final class DisplayBrightnessState { == otherState.shouldUpdateScreenBrightnessSetting() && Objects.equals(mBrightnessEvent, otherState.getBrightnessEvent()) && mBrightnessAdjustmentFlag == otherState.getBrightnessAdjustmentFlag() && mIsUserInitiatedChange == otherState.isUserInitiatedChange(); && mIsUserInitiatedChange == otherState.isUserInitiatedChange() && mBrightnessMaxReason == otherState.getBrightnessMaxReason(); } @Override Loading @@ -221,7 +235,7 @@ public final class DisplayBrightnessState { mShouldUseAutoBrightness, mIsSlowChange, mMaxBrightness, mMinBrightness, mCustomAnimationRate, mShouldUpdateScreenBrightnessSetting, mBrightnessEvent, mBrightnessAdjustmentFlag, mIsUserInitiatedChange); mIsUserInitiatedChange, mBrightnessMaxReason); } /** Loading @@ -245,12 +259,11 @@ public final class DisplayBrightnessState { private float mMinBrightness; private float mCustomAnimationRate = CUSTOM_ANIMATION_RATE_NOT_SET; private boolean mShouldUpdateScreenBrightnessSetting; private BrightnessEvent mBrightnessEvent; public int mBrightnessAdjustmentFlag = 0; private int mBrightnessAdjustmentFlag = 0; private boolean mIsUserInitiatedChange; private @BrightnessInfo.BrightnessMaxReason int mBrightnessMaxReason = BrightnessInfo.BRIGHTNESS_MAX_REASON_NONE; /** * Create a builder starting with the values from the specified {@link Loading @@ -274,6 +287,7 @@ public final class DisplayBrightnessState { builder.setBrightnessEvent(state.getBrightnessEvent()); builder.setBrightnessAdjustmentFlag(state.getBrightnessAdjustmentFlag()); builder.setIsUserInitiatedChange(state.isUserInitiatedChange()); builder.setBrightnessMaxReason(state.getBrightnessMaxReason()); return builder; } Loading Loading @@ -496,5 +510,21 @@ public final class DisplayBrightnessState { mIsUserInitiatedChange = isUserInitiatedChange; return this; } /** * Gets reason for max brightness restriction */ public @BrightnessInfo.BrightnessMaxReason int getBrightnessMaxReason() { return mBrightnessMaxReason; } /** * Sets reason for max brightness restriction */ public Builder setBrightnessMaxReason( @BrightnessInfo.BrightnessMaxReason int brightnessMaxReason) { mBrightnessMaxReason = brightnessMaxReason; return this; } } } services/core/java/com/android/server/display/DisplayPowerController.java +9 −5 Original line number Diff line number Diff line Loading @@ -1580,7 +1580,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call // brightness sources (such as an app override) are not saved to the setting, but should be // reflected in HBM calculations. mBrightnessRangeController.onBrightnessChanged(brightnessState, unthrottledBrightnessState, mBrightnessClamperController.getBrightnessMaxReason()); clampedState.getBrightnessMaxReason()); // Animate the screen brightness when the screen is on or dozing. // Skip the animation when the screen is off or suspended. Loading Loading @@ -1783,7 +1783,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call if (userSetBrightnessChanged || newEvent.getReason().getReason() != BrightnessReason.REASON_TEMPORARY) { logBrightnessEvent(newEvent, unthrottledBrightnessState); logBrightnessEvent(newEvent, unthrottledBrightnessState, clampedState); } if (mBrightnessEventRingBuffer != null) { mBrightnessEventRingBuffer.append(newEvent); Loading Loading @@ -1976,6 +1976,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call synchronized (mCachedBrightnessInfo) { float stateMax = state != null ? state.getMaxBrightness() : PowerManager.BRIGHTNESS_MAX; float stateMin = state != null ? state.getMinBrightness() : PowerManager.BRIGHTNESS_MAX; @BrightnessInfo.BrightnessMaxReason int maxReason = state != null ? state.getBrightnessMaxReason() : BrightnessInfo.BRIGHTNESS_MAX_REASON_NONE; final float minBrightness = Math.max(stateMin, Math.min( mBrightnessRangeController.getCurrentBrightnessMin(), stateMax)); final float maxBrightness = Math.min( Loading @@ -2002,7 +2005,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mBrightnessRangeController.getTransitionPoint()); changed |= mCachedBrightnessInfo.checkAndSetInt(mCachedBrightnessInfo.brightnessMaxReason, mBrightnessClamperController.getBrightnessMaxReason()); maxReason); return changed; } } Loading Loading @@ -2902,7 +2905,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call return FrameworkStatsLog.DISPLAY_BRIGHTNESS_CHANGED__ENTIRE_REASON__REASON_UNKNOWN; } private void logBrightnessEvent(BrightnessEvent event, float unmodifiedBrightness) { private void logBrightnessEvent(BrightnessEvent event, float unmodifiedBrightness, DisplayBrightnessState brightnessState) { int modifier = event.getReason().getModifier(); int flags = event.getFlags(); // It's easier to check if the brightness is at maximum level using the brightness Loading Loading @@ -2939,7 +2943,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call event.getHbmMode() == BrightnessInfo.HIGH_BRIGHTNESS_MODE_SUNLIGHT, event.getHbmMode() == BrightnessInfo.HIGH_BRIGHTNESS_MODE_HDR, (modifier & BrightnessReason.MODIFIER_LOW_POWER) > 0, mBrightnessClamperController.getBrightnessMaxReason(), brightnessState.getBrightnessMaxReason(), // TODO: (flc) add brightnessMinReason here too. (modifier & BrightnessReason.MODIFIER_DIMMED) > 0, event.isRbcEnabled(), Loading services/core/java/com/android/server/display/brightness/clamper/BrightnessClamperController.java +2 −12 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ public class BrightnessClamperController { builder.setBrightness(cappedBrightness); builder.setMaxBrightness(mBrightnessCap); builder.setCustomAnimationRate(mCustomAnimationRate); builder.setBrightnessMaxReason(getBrightnessMaxReason()); if (mClamperType != null) { builder.getBrightnessReason().addModifier(BrightnessReason.MODIFIER_THROTTLED); Loading @@ -163,19 +164,8 @@ public class BrightnessClamperController { return builder.build(); } /** * See BrightnessThrottler.getBrightnessMaxReason: * used in: * 1) DPC2.CachedBrightnessInfo to determine changes * 2) DPC2.logBrightnessEvent * 3) HBMController - for logging * Method is called in mHandler thread (DisplayControllerHandler), in the same thread * recalculateBrightnessCap and DPC2.updatePowerStateInternal are called. * Should be moved to DisplayBrightnessState OR derived from DisplayBrightnessState * TODO: b/263362199 */ @BrightnessInfo.BrightnessMaxReason public int getBrightnessMaxReason() { private int getBrightnessMaxReason() { if (mClamperType == null) { return BrightnessInfo.BRIGHTNESS_MAX_REASON_NONE; } else if (mClamperType == Type.THERMAL) { Loading Loading
core/java/android/hardware/display/BrightnessInfo.java +4 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,8 @@ public final class BrightnessInfo implements Parcelable { @IntDef(prefix = {"BRIGHTNESS_MAX_REASON_"}, value = { BRIGHTNESS_MAX_REASON_NONE, BRIGHTNESS_MAX_REASON_THERMAL, BRIGHTNESS_MAX_REASON_POWER_IC BRIGHTNESS_MAX_REASON_POWER_IC, BRIGHTNESS_MAX_REASON_WEAR_BEDTIME_MODE }) @Retention(RetentionPolicy.SOURCE) public @interface BrightnessMaxReason {} Loading Loading @@ -157,6 +158,8 @@ public final class BrightnessInfo implements Parcelable { return "thermal"; case BRIGHTNESS_MAX_REASON_POWER_IC: return "power IC"; case BRIGHTNESS_MAX_REASON_WEAR_BEDTIME_MODE: return "wear bedtime"; } return "invalid"; } Loading
core/jni/android_util_Process.cpp +31 −21 Original line number Diff line number Diff line Loading @@ -1063,8 +1063,8 @@ jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz, } env->ReleaseStringUTFChars(file, file8); // Most proc files we read are small, so we only go through the // loop once and use the stack buffer. We allocate a buffer big // Most proc files we read are small, so we go through the loop // with the stack buffer firstly. We allocate a buffer big // enough for the whole file. char readBufferStack[kProcReadStackBufferSize]; Loading @@ -1072,30 +1072,38 @@ jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz, char* readBuffer = &readBufferStack[0]; ssize_t readBufferSize = kProcReadStackBufferSize; ssize_t numberBytesRead; off_t offset = 0; for (;;) { ssize_t requestedBufferSize = readBufferSize - offset; // By using pread, we can avoid an lseek to rewind the FD // before retry, saving a system call. numberBytesRead = pread(fd, readBuffer, readBufferSize, 0); if (numberBytesRead < 0 && errno == EINTR) { continue; } numberBytesRead = TEMP_FAILURE_RETRY(pread(fd, readBuffer + offset, requestedBufferSize, offset)); if (numberBytesRead < 0) { if (kDebugProc) { ALOGW("Unable to open process file: %s fd=%d\n", file8, fd.get()); ALOGW("Unable to read process file err: %s file: %s fd=%d\n", strerror_r(errno, &readBufferStack[0], sizeof(readBufferStack)), file8, fd.get()); } return JNI_FALSE; } if (numberBytesRead < readBufferSize) { if (numberBytesRead == 0) { // End of file. numberBytesRead = offset; break; } if (numberBytesRead < requestedBufferSize) { // Read less bytes than requested, it's not an error per pread(2). offset += numberBytesRead; } else { // Buffer is fully used, try to grow it. if (readBufferSize > std::numeric_limits<ssize_t>::max() / 2) { if (kDebugProc) { ALOGW("Proc file too big: %s fd=%d\n", file8, fd.get()); } return JNI_FALSE; } readBufferSize = std::max(readBufferSize * 2, kProcReadMinHeapBufferSize); readBufferSize = std::max(readBufferSize * 2, kProcReadMinHeapBufferSize); readBufferHeap.reset(); // Free address space before getting more. readBufferHeap = std::make_unique<char[]>(readBufferSize); if (!readBufferHeap) { Loading @@ -1103,6 +1111,8 @@ jboolean android_os_Process_readProcFile(JNIEnv* env, jobject clazz, return JNI_FALSE; } readBuffer = readBufferHeap.get(); offset = 0; } } // parseProcLineArray below modifies the buffer while parsing! Loading
services/core/java/com/android/server/display/DisplayBrightnessState.java +36 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.display; import android.hardware.display.BrightnessInfo; import android.text.TextUtils; import com.android.server.display.brightness.BrightnessEvent; Loading Loading @@ -50,6 +51,8 @@ public final class DisplayBrightnessState { private final boolean mIsUserInitiatedChange; private @BrightnessInfo.BrightnessMaxReason int mBrightnessMaxReason; private DisplayBrightnessState(Builder builder) { mBrightness = builder.getBrightness(); mHdrBrightness = builder.getHdrBrightness(); Loading @@ -64,6 +67,7 @@ public final class DisplayBrightnessState { mBrightnessEvent = builder.getBrightnessEvent(); mBrightnessAdjustmentFlag = builder.getBrightnessAdjustmentFlag(); mIsUserInitiatedChange = builder.isUserInitiatedChange(); mBrightnessMaxReason = builder.getBrightnessMaxReason(); } /** Loading Loading @@ -159,6 +163,13 @@ public final class DisplayBrightnessState { return mIsUserInitiatedChange; } /** * Gets reason for max brightness restriction */ public @BrightnessInfo.BrightnessMaxReason int getBrightnessMaxReason() { return mBrightnessMaxReason; } @Override public String toString() { StringBuilder stringBuilder = new StringBuilder("DisplayBrightnessState:"); Loading @@ -180,6 +191,8 @@ public final class DisplayBrightnessState { .append(Objects.toString(mBrightnessEvent, "null")); stringBuilder.append("\n mBrightnessAdjustmentFlag:").append(mBrightnessAdjustmentFlag); stringBuilder.append("\n mIsUserInitiatedChange:").append(mIsUserInitiatedChange); stringBuilder.append("\n mBrightnessMaxReason:") .append(BrightnessInfo.briMaxReasonToString(mBrightnessMaxReason)); return stringBuilder.toString(); } Loading Loading @@ -212,7 +225,8 @@ public final class DisplayBrightnessState { == otherState.shouldUpdateScreenBrightnessSetting() && Objects.equals(mBrightnessEvent, otherState.getBrightnessEvent()) && mBrightnessAdjustmentFlag == otherState.getBrightnessAdjustmentFlag() && mIsUserInitiatedChange == otherState.isUserInitiatedChange(); && mIsUserInitiatedChange == otherState.isUserInitiatedChange() && mBrightnessMaxReason == otherState.getBrightnessMaxReason(); } @Override Loading @@ -221,7 +235,7 @@ public final class DisplayBrightnessState { mShouldUseAutoBrightness, mIsSlowChange, mMaxBrightness, mMinBrightness, mCustomAnimationRate, mShouldUpdateScreenBrightnessSetting, mBrightnessEvent, mBrightnessAdjustmentFlag, mIsUserInitiatedChange); mIsUserInitiatedChange, mBrightnessMaxReason); } /** Loading @@ -245,12 +259,11 @@ public final class DisplayBrightnessState { private float mMinBrightness; private float mCustomAnimationRate = CUSTOM_ANIMATION_RATE_NOT_SET; private boolean mShouldUpdateScreenBrightnessSetting; private BrightnessEvent mBrightnessEvent; public int mBrightnessAdjustmentFlag = 0; private int mBrightnessAdjustmentFlag = 0; private boolean mIsUserInitiatedChange; private @BrightnessInfo.BrightnessMaxReason int mBrightnessMaxReason = BrightnessInfo.BRIGHTNESS_MAX_REASON_NONE; /** * Create a builder starting with the values from the specified {@link Loading @@ -274,6 +287,7 @@ public final class DisplayBrightnessState { builder.setBrightnessEvent(state.getBrightnessEvent()); builder.setBrightnessAdjustmentFlag(state.getBrightnessAdjustmentFlag()); builder.setIsUserInitiatedChange(state.isUserInitiatedChange()); builder.setBrightnessMaxReason(state.getBrightnessMaxReason()); return builder; } Loading Loading @@ -496,5 +510,21 @@ public final class DisplayBrightnessState { mIsUserInitiatedChange = isUserInitiatedChange; return this; } /** * Gets reason for max brightness restriction */ public @BrightnessInfo.BrightnessMaxReason int getBrightnessMaxReason() { return mBrightnessMaxReason; } /** * Sets reason for max brightness restriction */ public Builder setBrightnessMaxReason( @BrightnessInfo.BrightnessMaxReason int brightnessMaxReason) { mBrightnessMaxReason = brightnessMaxReason; return this; } } }
services/core/java/com/android/server/display/DisplayPowerController.java +9 −5 Original line number Diff line number Diff line Loading @@ -1580,7 +1580,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call // brightness sources (such as an app override) are not saved to the setting, but should be // reflected in HBM calculations. mBrightnessRangeController.onBrightnessChanged(brightnessState, unthrottledBrightnessState, mBrightnessClamperController.getBrightnessMaxReason()); clampedState.getBrightnessMaxReason()); // Animate the screen brightness when the screen is on or dozing. // Skip the animation when the screen is off or suspended. Loading Loading @@ -1783,7 +1783,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call if (userSetBrightnessChanged || newEvent.getReason().getReason() != BrightnessReason.REASON_TEMPORARY) { logBrightnessEvent(newEvent, unthrottledBrightnessState); logBrightnessEvent(newEvent, unthrottledBrightnessState, clampedState); } if (mBrightnessEventRingBuffer != null) { mBrightnessEventRingBuffer.append(newEvent); Loading Loading @@ -1976,6 +1976,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call synchronized (mCachedBrightnessInfo) { float stateMax = state != null ? state.getMaxBrightness() : PowerManager.BRIGHTNESS_MAX; float stateMin = state != null ? state.getMinBrightness() : PowerManager.BRIGHTNESS_MAX; @BrightnessInfo.BrightnessMaxReason int maxReason = state != null ? state.getBrightnessMaxReason() : BrightnessInfo.BRIGHTNESS_MAX_REASON_NONE; final float minBrightness = Math.max(stateMin, Math.min( mBrightnessRangeController.getCurrentBrightnessMin(), stateMax)); final float maxBrightness = Math.min( Loading @@ -2002,7 +2005,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mBrightnessRangeController.getTransitionPoint()); changed |= mCachedBrightnessInfo.checkAndSetInt(mCachedBrightnessInfo.brightnessMaxReason, mBrightnessClamperController.getBrightnessMaxReason()); maxReason); return changed; } } Loading Loading @@ -2902,7 +2905,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call return FrameworkStatsLog.DISPLAY_BRIGHTNESS_CHANGED__ENTIRE_REASON__REASON_UNKNOWN; } private void logBrightnessEvent(BrightnessEvent event, float unmodifiedBrightness) { private void logBrightnessEvent(BrightnessEvent event, float unmodifiedBrightness, DisplayBrightnessState brightnessState) { int modifier = event.getReason().getModifier(); int flags = event.getFlags(); // It's easier to check if the brightness is at maximum level using the brightness Loading Loading @@ -2939,7 +2943,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call event.getHbmMode() == BrightnessInfo.HIGH_BRIGHTNESS_MODE_SUNLIGHT, event.getHbmMode() == BrightnessInfo.HIGH_BRIGHTNESS_MODE_HDR, (modifier & BrightnessReason.MODIFIER_LOW_POWER) > 0, mBrightnessClamperController.getBrightnessMaxReason(), brightnessState.getBrightnessMaxReason(), // TODO: (flc) add brightnessMinReason here too. (modifier & BrightnessReason.MODIFIER_DIMMED) > 0, event.isRbcEnabled(), Loading
services/core/java/com/android/server/display/brightness/clamper/BrightnessClamperController.java +2 −12 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ public class BrightnessClamperController { builder.setBrightness(cappedBrightness); builder.setMaxBrightness(mBrightnessCap); builder.setCustomAnimationRate(mCustomAnimationRate); builder.setBrightnessMaxReason(getBrightnessMaxReason()); if (mClamperType != null) { builder.getBrightnessReason().addModifier(BrightnessReason.MODIFIER_THROTTLED); Loading @@ -163,19 +164,8 @@ public class BrightnessClamperController { return builder.build(); } /** * See BrightnessThrottler.getBrightnessMaxReason: * used in: * 1) DPC2.CachedBrightnessInfo to determine changes * 2) DPC2.logBrightnessEvent * 3) HBMController - for logging * Method is called in mHandler thread (DisplayControllerHandler), in the same thread * recalculateBrightnessCap and DPC2.updatePowerStateInternal are called. * Should be moved to DisplayBrightnessState OR derived from DisplayBrightnessState * TODO: b/263362199 */ @BrightnessInfo.BrightnessMaxReason public int getBrightnessMaxReason() { private int getBrightnessMaxReason() { if (mClamperType == null) { return BrightnessInfo.BRIGHTNESS_MAX_REASON_NONE; } else if (mClamperType == Type.THERMAL) { Loading