summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorAlexander Mishkovets <amishkovets@google.com>2021-01-28 19:45:31 +0100
committerAlexander Mishkovets <amishkovets@google.com>2021-02-03 17:26:11 +0000
commit8fc937c91ba2f226dc8ddb195ad99945d224bb32 (patch)
tree2ea77de2325abdf854898573f64c21f402041dc9 /res
parent66e98b80f071c0b9fc1d65aa18fd52d1b0ae3d61 (diff)
downloadDialer-8fc937c91ba2f226dc8ddb195ad99945d224bb32.tar.gz
Handle NO_DIALPAD UX restriction
Add a flag "config_no_dialpad_uxr_max_allow_digits" to control the NO_DIALPAD UXR behavior: * if the value is less than 0, ignore the restriction; * if it is equal 0, entirely disable dialing, when NO_DIALPAD restriction is enforced; * allow dialing up to a given number of digits, when the restriction is in effect; If the app is configured to enforce the "no dialpad" restiction, disable the dialpad on in-call screen. Bug: 145596044 Test: manual Change-Id: I240ba06fcba4dfef59ceeee788eaa9c574a27a44 (cherry picked from commit d02011a7632cb99ea88656a1634a16389b67a3f8)
Diffstat (limited to 'res')
-rw-r--r--res/drawable/restricted_dialing_mode_label_background.xml20
-rw-r--r--res/layout/dialpad_info.xml11
-rw-r--r--res/layout/keypad_button.xml4
-rw-r--r--res/layout/restricted_dialing_mode_label.xml27
-rw-r--r--res/values/configs.xml5
-rw-r--r--res/values/strings.xml5
-rw-r--r--res/xml/keypad_button_state_animation.xml34
7 files changed, 105 insertions, 1 deletions
diff --git a/res/drawable/restricted_dialing_mode_label_background.xml b/res/drawable/restricted_dialing_mode_label_background.xml
new file mode 100644
index 00000000..159babba
--- /dev/null
+++ b/res/drawable/restricted_dialing_mode_label_background.xml
@@ -0,0 +1,20 @@
+<!--
+ ~ Copyright (C) 2021 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.
+ -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <corners android:radius="4dp"/>
+ <solid android:color="@color/emergency_text_color"/>
+</shape>
diff --git a/res/layout/dialpad_info.xml b/res/layout/dialpad_info.xml
index 25001c44..6849c7b6 100644
--- a/res/layout/dialpad_info.xml
+++ b/res/layout/dialpad_info.xml
@@ -72,4 +72,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
+ <include
+ layout="@layout/restricted_dialing_mode_label"
+ android:id="@+id/restricted_dialing_mode_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:layout_constraintTop_toBottomOf="@id/title"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ android:layout_marginTop="8dp"
+ android:visibility="invisible"/>
+
</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/layout/keypad_button.xml b/res/layout/keypad_button.xml
index b8a32ae1..d902ddd4 100644
--- a/res/layout/keypad_button.xml
+++ b/res/layout/keypad_button.xml
@@ -18,7 +18,9 @@ limitations under the License.
android:orientation="vertical"
android:layout_gravity="center"
android:layout_width="@dimen/keypad_minimum_size"
- android:layout_height="@dimen/keypad_minimum_size">
+ android:layout_height="@dimen/keypad_minimum_size"
+ android:stateListAnimator="@xml/keypad_button_state_animation"
+ android:duplicateParentState="true">
<TextView
android:id="@+id/keypad_number"
diff --git a/res/layout/restricted_dialing_mode_label.xml b/res/layout/restricted_dialing_mode_label.xml
new file mode 100644
index 00000000..189814fa
--- /dev/null
+++ b/res/layout/restricted_dialing_mode_label.xml
@@ -0,0 +1,27 @@
+<!--
+ ~ Copyright (C) 2021 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.
+ -->
+
+<TextView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/restricted_dialing_mode_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:padding="8dp"
+ android:textAppearance="@style/TextAppearance.Body2"
+ android:text="@string/restricted_dialing_mode_label"
+ android:alpha="0.8"
+ android:background="@drawable/restricted_dialing_mode_label_background"/>
diff --git a/res/values/configs.xml b/res/values/configs.xml
index 9ea27bfd..af8bef40 100644
--- a/res/values/configs.xml
+++ b/res/values/configs.xml
@@ -66,4 +66,9 @@
<!-- A config determines whether to show user profile for input number only when type down is
not showing. This config works only when config_show_type_down_list_on_dialpad is false. -->
<bool name="config_show_detailed_user_profile_on_dialpad">false</bool>
+
+ <!-- Maximum allowed digits to dial, when "no dialpad" UXR restriction is enforced. If
+ the parameter is set to "0", the dialing is restricted entirely, when the restriction is
+ in effect. "-1" or any other negative value means "ignore no dialpad" restriction. -->
+ <integer name="config_no_dialpad_uxr_max_allow_digits">-1</integer>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 086d0847..ad9e3ce5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -246,4 +246,9 @@
<string name="ongoing_conf_title">Conference</string>
<string name="ongoing_conf_title_format">%1$s (%2$d) -\u0020</string>
+ <!-- Dialing disabled warning [CHAR LIMIT=40] -->
+ <string name="dialing_disabled_warning">Dialing disabled</string>
+ <!-- Restricted dialing mode description -->
+ <string name="restricted_dialing_mode_label">Dialpad usage is restricted while driving</string>
+
</resources>
diff --git a/res/xml/keypad_button_state_animation.xml b/res/xml/keypad_button_state_animation.xml
new file mode 100644
index 00000000..a04b29ea
--- /dev/null
+++ b/res/xml/keypad_button_state_animation.xml
@@ -0,0 +1,34 @@
+<!--
+ ~ Copyright (C) 2021 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.
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_enabled="false">
+ <set>
+ <objectAnimator android:propertyName="alpha"
+ android:duration="@android:integer/config_shortAnimTime"
+ android:valueTo="?android:attr/disabledAlpha"
+ android:valueType="floatType"/>
+ </set>
+ </item>
+ <item>
+ <set>
+ <objectAnimator android:propertyName="alpha"
+ android:duration="@android:integer/config_shortAnimTime"
+ android:valueTo="1"
+ android:valueType="floatType"/>
+ </set>
+ </item>
+</selector>