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

Commit 32ed3d67 authored by Bill Lin's avatar Bill Lin
Browse files

DO NOT MERGE Implement USB High Temperature warning dialog(1/N)

When device USB adapter got electric short issue and overheating.
Popup overheat alarm dialog, with beep sound and vibration(optional)
to notify user unplug USB cable, this dialog will keep showing at
foreground until user click OK button or see care steps.

Test: manual adjust threshold to 35 degrees and trigger alarm
Test: atest SystemUITests
Test: atest PowerUITest
Test: atest PowerNotificationWarningsTest
Test: atest OverheatAlarmControllerTest
Test: atest OverheatAlarmDialogTest

Change-Id: I35e4269b2f3f2108043e2756d0f5a53f54d86e7d
Fix: b/117138158
parent 807672ac
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
<!--
     Copyright (C) 2018 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/contentPanel"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="48dp">

    <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/alarm_dialog_panel_padding"
        android:paddingEnd="?android:attr/dialogPreferredPadding"
        android:paddingStart="?android:attr/dialogPreferredPadding"
        android:clipToPadding="false">

        <TextView
            android:id="@android:id/message"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/high_temp_alarm_notify_message"
            style="@android:style/TextAppearance.Material.Subhead"/>
    </ScrollView>
</FrameLayout>
+46 −0
Original line number Diff line number Diff line
<!--
     Copyright (C) 2018 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/title_template"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:gravity="center_vertical|start"
    android:paddingStart="?android:attr/dialogPreferredPadding"
    android:paddingEnd="?android:attr/dialogPreferredPadding"
    android:paddingTop="@dimen/alarm_dialog_panel_padding">

    <ImageView
        android:id="@android:id/icon"
        android:layout_width="32dip"
        android:layout_height="32dip"
        android:layout_marginEnd="8dip"
        android:scaleType="fitCenter"
        android:tint="?android:attr/colorError"
        android:src="?android:attr/alertDialogIcon"/>

    <com.android.internal.widget.DialogTitle
        android:id="@+id/alertTitle"
        android:singleLine="true"
        android:ellipsize="end"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAlignment="viewStart"
        android:text="@string/high_temp_alarm_title"
        android:importantForAccessibility="noHideDescendants"
        style="?android:attr/windowTitleStyle"/>
</LinearLayout>
+53.7 KiB

File added.

No diff preview for this file type.

+14 −0
Original line number Diff line number Diff line
@@ -368,17 +368,31 @@

    <bool name="quick_settings_show_full_alarm">false</bool>

    <!-- Whether or not beep sound should be when overheat -->
    <bool name="config_alarmTemperatureBeepSound">false</bool>

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

    <!-- Whether to show a alarm dialog when device of usb cable reaches a certain temperature. -->
    <integer name="config_showTemperatureAlarm">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>

    <!-- Temp at which to show a alarm dialog if config_showTemperatureAlarm is true.
         If < 0, uses the skin temperature sensor shutdown value of index[1] from
         HardwarePropertiesManager#getDeviceTemperatures -->
    <integer name="config_alarmTemperature">60</integer>

    <!-- Fudge factor for how much below the shutdown temp to show the warning. -->
    <integer name="config_warningTemperatureTolerance">2</integer>

    <!-- Fudge factor for how much below the overheat temp to dismiss alarm. -->
    <integer name="config_alarmTemperatureTolerance">5</integer>

    <!-- Accessibility actions -->
    <item type="id" name="action_split_task_to_left" />
    <item type="id" name="action_split_task_to_right" />
+7 −0
Original line number Diff line number Diff line
@@ -1023,4 +1023,11 @@
    <!-- How much we expand the touchable region of the status bar below the notch to catch touches
         that just start below the notch. -->
    <dimen name="display_cutout_touchable_region_size">12dp</dimen>

    <!-- Padding for overheat alarm dialog message of content -->
    <dimen name="alarm_dialog_panel_padding">24dp</dimen>

    <!-- Padding for overheat alarm dialog message of content -->
    <dimen name="alarm_dialog_message_space">28dp</dimen>

</resources>
Loading