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

Commit e3352561 authored by Andrew Sapperstein's avatar Andrew Sapperstein
Browse files

Add Settings.Global configs to high temp warning.

Test: manual
Bug: 34480261
Change-Id: Icfd08c1c7dae456920b3978918ee01469e1dec95
parent 540dbd08
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -10015,6 +10015,17 @@ public final class Settings {
            EPHEMERAL_SETTINGS.add(EPHEMERAL_COOKIE_MAX_SIZE_BYTES);
            EPHEMERAL_SETTINGS.add(EPHEMERAL_COOKIE_MAX_SIZE_BYTES);
        }
        }


        /**
         * Whether to show the high temperature warning notification.
         * @hide
         */
        public static final String SHOW_TEMPERATURE_WARNING = "show_temperature_warning";

        /**
         * Temperature at which the high temperature warning notification should be shown.
         * @hide
         */
        public static final String WARNING_TEMPERATURE = "warning_temperature";
    }
    }


    /**
    /**
+1 −1
Original line number Original line Diff line number Diff line
@@ -291,7 +291,7 @@
    <bool name="quick_settings_show_full_alarm">false</bool>
    <bool name="quick_settings_show_full_alarm">false</bool>


    <!-- Whether to show a warning notification when the device reaches a certain temperature. -->
    <!-- Whether to show a warning notification when the device reaches a certain temperature. -->
    <bool name="config_showTemperatureWarning">false</bool>
    <integer name="config_showTemperatureWarning">0</integer>


    <!-- Temp at which to show a warning notification if config_showTemperatureWarning is true.
    <!-- Temp at which to show a warning notification if config_showTemperatureWarning is true.
         If < 0, uses the value from HardwarePropertiesManager#getDeviceTemperatures. -->
         If < 0, uses the value from HardwarePropertiesManager#getDeviceTemperatures. -->
+7 −2
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.database.ContentObserver;
import android.os.BatteryManager;
import android.os.BatteryManager;
import android.os.Handler;
import android.os.Handler;
@@ -221,11 +222,15 @@ public class PowerUI extends SystemUI {
    };
    };


    private void initTemperatureWarning() {
    private void initTemperatureWarning() {
        if (!mContext.getResources().getBoolean(R.bool.config_showTemperatureWarning)) {
        ContentResolver resolver = mContext.getContentResolver();
        Resources resources = mContext.getResources();
        if (Settings.Global.getInt(resolver, Settings.Global.SHOW_TEMPERATURE_WARNING,
                resources.getInteger(R.integer.config_showTemperatureWarning)) == 0) {
            return;
            return;
        }
        }


        mThrottlingTemp = mContext.getResources().getInteger(R.integer.config_warningTemperature);
        mThrottlingTemp = Settings.Global.getFloat(resolver, Settings.Global.WARNING_TEMPERATURE,
                resources.getInteger(R.integer.config_warningTemperature));


        if (mThrottlingTemp < 0f) {
        if (mThrottlingTemp < 0f) {
            // Get the throttling temperature. No need to check if we're not throttling.
            // Get the throttling temperature. No need to check if we're not throttling.