Disable blurs during critical thermal state
Bug: 195642101 Test: adb shell cmd thermalservice override-status 0/1/2/3/4/5/6 Change-Id: I693e2f49accd4cd4cdd1fbc97b41320bf6334aac
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.os.PowerManager.THERMAL_STATUS_CRITICAL;
|
||||
import static android.view.CrossWindowBlurListeners.CROSS_WINDOW_BLUR_SUPPORTED;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -45,6 +46,7 @@ final class BlurController {
|
||||
private final Object mLock = new Object();
|
||||
private volatile boolean mBlurEnabled;
|
||||
private boolean mInPowerSaveMode;
|
||||
private boolean mCriticalThermalStatus;
|
||||
private boolean mBlurDisabledSetting;
|
||||
private boolean mTunnelModeEnabled = false;
|
||||
|
||||
@@ -89,6 +91,12 @@ final class BlurController {
|
||||
});
|
||||
mBlurDisabledSetting = getBlurDisabledSetting();
|
||||
|
||||
powerManager.addThermalStatusListener((status) -> {
|
||||
mCriticalThermalStatus = status >= THERMAL_STATUS_CRITICAL;
|
||||
updateBlurEnabled();
|
||||
});
|
||||
mCriticalThermalStatus = powerManager.getCurrentThermalStatus() >= THERMAL_STATUS_CRITICAL;
|
||||
|
||||
TunnelModeEnabledListener.register(mTunnelModeListener);
|
||||
|
||||
updateBlurEnabled();
|
||||
@@ -112,7 +120,7 @@ final class BlurController {
|
||||
private void updateBlurEnabled() {
|
||||
synchronized (mLock) {
|
||||
final boolean newEnabled = CROSS_WINDOW_BLUR_SUPPORTED && !mBlurDisabledSetting
|
||||
&& !mInPowerSaveMode && !mTunnelModeEnabled;
|
||||
&& !mInPowerSaveMode && !mTunnelModeEnabled && !mCriticalThermalStatus;
|
||||
if (mBlurEnabled == newEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user