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

Commit ce02ed3a authored by Sherry Huang's avatar Sherry Huang
Browse files

Implement USB-C overheat warning

When device USB-C port is susceptible to short circuits and
overheating, pop up a warning dialog and keep showing until
user clicks OK button or see care steps.

Test: manually set the emulated temperature to trigger warning
Test: atest SystemUITests

Change-Id: I4f6080187196a9716f12a9817dc10d3265dc202b
Bug: 110134720
Bug: 116866524
Bug: 77790357
Bug: 117178820
parent 3d11ee48
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -14056,17 +14056,16 @@ public final class Settings {
        public static final String SHOW_TEMPERATURE_WARNING = "show_temperature_warning";
        /**
         * Temperature at which the high temperature warning notification should be shown.
         * Whether to show the usb high temperature alarm notification.
         * @hide
         */
        public static final String WARNING_TEMPERATURE = "warning_temperature";
        public static final String SHOW_USB_TEMPERATURE_ALARM = "show_usb_temperature_alarm";
        /**
         * USB Temperature at which the high temperature alarm notification should be shown.
         * Temperature at which the high temperature warning notification should be shown.
         * @hide
         */
        public static final String USB_ALARM_TEMPERATURE = "usb_alarm_temperature";
        public static final String WARNING_TEMPERATURE = "warning_temperature";
        /**
         * Whether the diskstats logging task is enabled/disabled.
+1 −2
Original line number Diff line number Diff line
@@ -918,8 +918,7 @@ message GlobalSettingsProto {
        // Temperature at which the high temperature warning notification should
        // be shown.
        optional SettingProto warning_temperature_level = 2 [ (android.privacy).dest = DEST_AUTOMATIC ];
        // USB temperature at which the high temperature alarm notification should be shown.
        optional SettingProto usb_alarm_temperature_level = 3 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto show_usb_temperature_alarm = 3 [ (android.privacy).dest = DEST_AUTOMATIC ];
    }
    optional TemperatureWarning temperature_warning = 119;

+1 −1
Original line number Diff line number Diff line
@@ -428,6 +428,7 @@ public class SettingsBackupTest {
                    Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS,
                    Settings.Global.SHOW_RESTART_IN_CRASH_DIALOG,
                    Settings.Global.SHOW_TEMPERATURE_WARNING,
                    Settings.Global.SHOW_USB_TEMPERATURE_ALARM,
                    Settings.Global.SIGNED_CONFIG_VERSION,
                    Settings.Global.SMART_SELECTION_UPDATE_CONTENT_URL,
                    Settings.Global.SMART_SELECTION_UPDATE_METADATA_URL,
@@ -502,7 +503,6 @@ public class SettingsBackupTest {
                    Settings.Global.USER_SWITCHER_ENABLED,
                    Settings.Global.NETWORK_ACCESS_TIMEOUT_MS,
                    Settings.Global.WARNING_TEMPERATURE,
                    Settings.Global.USB_ALARM_TEMPERATURE,
                    Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY,
                    Settings.Global.WEBVIEW_FALLBACK_LOGIC_ENABLED,
                    Settings.Global.WEBVIEW_MULTIPROCESS,
+3 −3
Original line number Diff line number Diff line
@@ -1349,12 +1349,12 @@ class SettingsProtoDumpUtil {
        dumpSetting(s, p,
                Settings.Global.SHOW_TEMPERATURE_WARNING,
                GlobalSettingsProto.TemperatureWarning.SHOW_TEMPERATURE_WARNING);
        dumpSetting(s, p,
                Settings.Global.SHOW_USB_TEMPERATURE_ALARM,
                GlobalSettingsProto.TemperatureWarning.SHOW_USB_TEMPERATURE_ALARM);
        dumpSetting(s, p,
                Settings.Global.WARNING_TEMPERATURE,
                GlobalSettingsProto.TemperatureWarning.WARNING_TEMPERATURE_LEVEL);
        dumpSetting(s, p,
                Settings.Global.USB_ALARM_TEMPERATURE,
                GlobalSettingsProto.TemperatureWarning.USB_ALARM_TEMPERATURE_LEVEL);
        p.end(tempWarningToken);

        final long tetherToken = p.start(GlobalSettingsProto.TETHER);
+4 −8
Original line number Diff line number Diff line
@@ -328,16 +328,11 @@

    <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 device's skin temperature is high. -->
    <integer name="config_showTemperatureWarning">0</integer>

    <!-- Temp at which to show a warning notification if config_showTemperatureWarning is true.
         If < 0, uses the skin temperature sensor shutdown value from
         HardwarePropertiesManager#getDeviceTemperatures - config_warningTemperatureTolerance. -->
    <integer name="config_warningTemperature">-1</integer>

    <!-- Fudge factor for how much below the shutdown temp to show the warning. -->
    <integer name="config_warningTemperatureTolerance">2</integer>
    <!-- Whether to show a alarm dialog when device's usb port is overheating. -->
    <integer name="config_showUsbPortAlarm">0</integer>

    <!-- Accessibility actions -->
    <item type="id" name="action_split_task_to_left" />
@@ -484,4 +479,5 @@
    </string-array>

    <integer name="ongoing_appops_dialog_max_apps">5</integer>

</resources>
Loading