Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2635342d authored by Galia Peycheva's avatar Galia Peycheva Committed by Automerger Merge Worker
Browse files

Merge "Disable blurs during critical thermal state" into sc-dev am: 12740585

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15472902

Change-Id: I96ba30e98b38adc21398e2dc0cd62ccc7835c7b5
parents 377d2e66 12740585
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -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;
            }