Add a setting to overrid emergency number for Emergency SOS

- Add a dialog preference and custom dialog to allow user input a phone
  number
- Use settingslib/emergencynumber util to set/get the user input into
  SettingsProvider

https://screenshot.googleplex.com/A9GmJrcSbp4jYfd.png

Bug: 172609395
Test: robotests
Change-Id: Iedd9bb9f32c212a310fd8fddffad852a997f3b0d
This commit is contained in:
Fan Zhang
2020-11-17 15:53:25 -08:00
parent 67a9908db4
commit 83275f2091
7 changed files with 407 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<!--
~ Copyright (C) 2020 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M16.02,14.46l-2.62,2.62c-2.75,-1.49 -5.01,-3.75 -6.5,-6.5l2.62,-2.62c0.24,-0.24 0.34,-0.58 0.27,-0.9L9.15,3.8c-0.1,-0.46 -0.51,-0.8 -0.98,-0.8H4.02c-0.56,0 -1.03,0.47 -1,1.03 0.17,2.91 1.04,5.63 2.43,8.01 1.57,2.69 3.81,4.93 6.5,6.5 2.38,1.39 5.1,2.26 8.01,2.43 0.56,0.03 1.03,-0.44 1.03,-1v-4.15c0,-0.48 -0.34,-0.89 -0.8,-0.98l-3.26,-0.65c-0.33,-0.07 -0.67,0.04 -0.91,0.27z"
android:fillColor="#455A64"/>
</vector>

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2020 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.
-->
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="24dp"
android:paddingVertical="8dp">
<EditText
android:id="@+id/emergency_gesture_number_override"
android:imeOptions="actionDone"
android:inputType="numberSigned"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingEnd="16dp"
android:importantForAccessibility="no"
android:src="@drawable/ic_info_outline_24"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/emergency_gesture_number_override_notes"/>
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@@ -11078,6 +11078,22 @@
<!-- Preference summary to enable generating noisy sound before calling emergency services at panic/distress moments[CHAR_LIMIT=NONE]-->
<string name="emergency_gesture_sound_setting_summary">Play a loud sound before calling</string>
<!-- Preference title listing a phone number to call during emergency gesture [CHAR_LIMIT=60]-->
<string name="emergency_gesture_call_for_help_title">Call for help</string>
<!-- Preference title listing a phone number to call during emergency gesture [CHAR_LIMIT=NONE]-->
<string name="emergency_gesture_call_for_help_dialog_title">Number to call for help</string>
<!-- Preference summary listing a phone number to call during emergency gesture, and clicking the perference will show a dialog to change this number [CHAR_LIMIT=NONE]-->
<string name="emergency_gesture_call_for_help_summary"><xliff:g id="phone_number" example="911">%1$s</xliff:g>. Tap to change</string>
<!-- Notes explaining limitations for emergency gesture number override [CHAR_LIMIT=NONE]-->
<string name="emergency_gesture_number_override_notes">
If you enter a non-emergency number:\n
• Your device must be unlocked to use emergency SOS\n
• Your call may not be answered
</string>
<!-- Title text for swiping downwards on fingerprint sensor for notifications [CHAR LIMIT=80]-->
<string name="fingerprint_swipe_for_notifications_title">Swipe fingerprint for notifications</string>
<!-- Title text for fingerprint gesture preference screen [CHAR LIMIT=25] -->

View File

@@ -40,4 +40,14 @@
app:controller="com.android.settings.gestures.EmergencyGestureSoundPreferenceController"
app:allowDividerAbove="true"/>
<com.android.settings.gestures.EmergencyGestureNumberOverridePreference
android:key="emregency_gesture_number_override"
android:title="@string/emergency_gesture_call_for_help_title"
android:summary="@string/summary_placeholder"
android:icon="@drawable/ic_call_grey_24dp"
android:dialogTitle="@string/emergency_gesture_call_for_help_dialog_title"
android:dialogLayout="@layout/emergency_gesture_number_override_dialog"
android:positiveButtonText="@string/save"
app:allowDividerAbove="true"
app:controller="com.android.settings.gestures.EmergencyGestureNumberOverridePreferenceController"/>
</PreferenceScreen>