Merge "Import translations. DO NOT MERGE ANYWHERE"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index f4a7ea5..9d74a33 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -3737,7 +3737,7 @@
<!-- Show channel-level notification settings (channel passed in as extras) -->
<activity android:name=".notification.app.ChannelPanelActivity"
android:label="@string/notification_channel_title"
- android:theme="@style/Theme.Panel"
+ android:theme="@style/Theme.Panel.Material"
android:excludeFromRecents="true"
android:configChanges="keyboardHidden|screenSize"
android:exported="true">
diff --git a/res/drawable/button_border_selected.xml b/res/drawable/button_border_selected.xml
index 0cd4aa5..1402380 100644
--- a/res/drawable/button_border_selected.xml
+++ b/res/drawable/button_border_selected.xml
@@ -15,10 +15,7 @@
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:shape="rectangle">
- <solid
- android:color="?androidprv:attr/materialColorSurfaceContainer" />
<stroke
android:width="2dp"
android:color="?android:attr/colorAccent"/>
diff --git a/res/drawable/button_border_unselected.xml b/res/drawable/button_border_unselected.xml
index 2c2ef3d..d0ce75b 100644
--- a/res/drawable/button_border_unselected.xml
+++ b/res/drawable/button_border_unselected.xml
@@ -18,7 +18,7 @@
android:shape="rectangle">
<stroke
android:width="1dp"
- android:color="@color/notification_importance_button_unselected"/>
+ android:color="?android:attr/colorAccent"/>
<corners android:radius="@dimen/rect_button_radius" />
</shape>
diff --git a/res/layout/modifier_key_item.xml b/res/layout/modifier_key_item.xml
index a189479..683f631 100644
--- a/res/layout/modifier_key_item.xml
+++ b/res/layout/modifier_key_item.xml
@@ -19,8 +19,7 @@
android:layout_marginTop="8dip"
android:layout_marginBottom="8dip"
android:minHeight="?android:attr/listPreferredItemHeight"
- android:paddingEnd="?android:attr/scrollbarSize"
- android:layout_weight="1">
+ android:paddingEnd="?android:attr/scrollbarSize">
<ImageView
android:id="@+id/modifier_key_check_icon"
@@ -36,7 +35,7 @@
<TextView
android:id="@+id/modifier_key_text"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:textDirection="locale"
@@ -46,4 +45,38 @@
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
+ <TextView
+ android:id="@+id/modifier_key_left_bracket"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:textDirection="locale"
+ android:padding="1dp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:layout_toEndOf="@+id/modifier_key_text"
+ android:fadingEdge="horizontal" />
+
+ <ImageView
+ android:id="@+id/modifier_key_action_key_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_toEndOf="@+id/modifier_key_left_bracket"
+ android:fadingEdge="horizontal"
+ android:tint="?android:attr/textColorPrimary"/>
+
+ <TextView
+ android:id="@+id/modifier_key_right_bracket"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:textDirection="locale"
+ android:padding="1dp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:layout_toEndOf="@+id/modifier_key_action_key_icon"
+ android:fadingEdge="horizontal" />
+
+ <View android:layout_width="wrap_content"
+ android:layout_height="match_parent" />
+
</RelativeLayout>
diff --git a/res/layout/modifier_keys_custom_key.xml b/res/layout/modifier_keys_custom_key.xml
new file mode 100644
index 0000000..f390c00
--- /dev/null
+++ b/res/layout/modifier_keys_custom_key.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 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"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:gravity="center_vertical"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:background="?android:attr/selectableItemBackground">
+
+ <FrameLayout
+ android:id="@+id/icon_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+ <androidx.preference.internal.PreferenceImageView
+ android:id="@android:id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:maxWidth="48dp"
+ app:maxHeight="48dp" />
+ </FrameLayout>
+
+ <RelativeLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:layout_weight="1">
+
+ <TextView android:id="@+id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="?android:attr/textColorPrimary"
+ android:fadingEdge="horizontal" />
+
+ <TextView android:id="@+id/summary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/title"
+ android:layout_alignStart="@+id/title"
+ android:layout_alignLeft="@+id/title"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"
+ android:maxLines="4" />
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingStart="15dp"
+ android:layout_toEndOf="@+id/title"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/modifier_key_left_bracket"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textDirection="locale"
+ android:paddingStart="1dp"
+ android:paddingEnd="1dp"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="?android:attr/textColorPrimary"
+ android:fadingEdge="horizontal" />
+
+ <ImageView
+ android:id="@+id/modifier_key_action_key_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:fadingEdge="horizontal"
+ android:tint="?android:attr/textColorPrimary"/>
+
+ <TextView
+ android:id="@+id/modifier_key_right_bracket"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textDirection="locale"
+ android:paddingStart="1dp"
+ android:paddingEnd="1dp"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="?android:attr/textColorPrimary"
+ android:fadingEdge="horizontal" />
+ </LinearLayout>
+ </RelativeLayout>
+
+ <!-- Preference should place its actual preference widget here. -->
+ <LinearLayout android:id="@android:id/widget_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical"
+ android:orientation="vertical" />
+</LinearLayout>
diff --git a/res/values-be/arrays.xml b/res/values-be/arrays.xml
index b1fa80a..9b85ddc 100644
--- a/res/values-be/arrays.xml
+++ b/res/values-be/arrays.xml
@@ -400,8 +400,8 @@
</string-array>
<string-array name="wifi_metered_entries">
<item msgid="3237321077949659241">"Вызначаць аўтаматычна"</item>
- <item msgid="3779092145391320375">"Лімітная"</item>
- <item msgid="2047166446768045816">"Безлімітная"</item>
+ <item msgid="3779092145391320375">"З падлікам трафіка"</item>
+ <item msgid="2047166446768045816">"Без падліку трафіка"</item>
</string-array>
<string-array name="wifi_privacy_entries">
<item msgid="3485945604919292489">"Выпадковы MAC-адрас (стандартна)"</item>
diff --git a/res/values-bg/arrays.xml b/res/values-bg/arrays.xml
index 1979403..5031ee1 100644
--- a/res/values-bg/arrays.xml
+++ b/res/values-bg/arrays.xml
@@ -404,7 +404,7 @@
<item msgid="2047166446768045816">"Третиране като мрежа без отчитане"</item>
</string-array>
<string-array name="wifi_privacy_entries">
- <item msgid="3485945604919292489">"Рандомизиран MAC адрес (станд.)"</item>
+ <item msgid="3485945604919292489">"Рандомиз. MAC адрес (станд.)"</item>
<item msgid="741680937828608749">"Използване на MAC адреса на устройството"</item>
</string-array>
<string-array name="wifi_hidden_entries">
diff --git a/res/values-es/arrays.xml b/res/values-es/arrays.xml
index 078edf4..caf220d 100644
--- a/res/values-es/arrays.xml
+++ b/res/values-es/arrays.xml
@@ -86,7 +86,7 @@
<item msgid="6702740528496186521">"5"</item>
</string-array>
<string-array name="bluetooth_audio_routing_titles">
- <item msgid="3488687531285795335">"Usa la configuración predeterminada de la aplicación"</item>
+ <item msgid="3488687531285795335">"Usar la configuración predeterminada de la aplicación"</item>
<item msgid="5112879855377353813">"Reproducir en el audífono"</item>
<item msgid="4853360663119482646">"Reproducir en el altavoz del teléfono"</item>
</string-array>
diff --git a/res/values-eu/arrays.xml b/res/values-eu/arrays.xml
index dad6ca1..ae23035 100644
--- a/res/values-eu/arrays.xml
+++ b/res/values-eu/arrays.xml
@@ -87,7 +87,7 @@
</string-array>
<string-array name="bluetooth_audio_routing_titles">
<item msgid="3488687531285795335">"Erabili aplikazioaren hobespen lehenetsiak"</item>
- <item msgid="5112879855377353813">"Erreproduzitu audifonoan"</item>
+ <item msgid="5112879855377353813">"Erreproduzitu entzumen-gailuan"</item>
<item msgid="4853360663119482646">"Erreproduzitu telefonoaren bozgorailuan"</item>
</string-array>
<string-array name="wifi_signal">
@@ -404,7 +404,7 @@
<item msgid="2047166446768045816">"Tratatu neurtu gabeko sare gisa"</item>
</string-array>
<string-array name="wifi_privacy_entries">
- <item msgid="3485945604919292489">"Erabili ausaz aukeratutako MAC helbide bat (lehenetsia)"</item>
+ <item msgid="3485945604919292489">"Ausaz aukeratutako MAC helbide bat (lehenetsia)"</item>
<item msgid="741680937828608749">"Erabili gailuaren MAC helbidea"</item>
</string-array>
<string-array name="wifi_hidden_entries">
diff --git a/res/values-fr/arrays.xml b/res/values-fr/arrays.xml
index b9aab07..561dfed 100644
--- a/res/values-fr/arrays.xml
+++ b/res/values-fr/arrays.xml
@@ -87,7 +87,7 @@
</string-array>
<string-array name="bluetooth_audio_routing_titles">
<item msgid="3488687531285795335">"Utiliser le paramètre par défaut de l\'appli"</item>
- <item msgid="5112879855377353813">"Écouter via la prothèse auditive"</item>
+ <item msgid="5112879855377353813">"Écouter via l\'appareil auditif"</item>
<item msgid="4853360663119482646">"Écouter via le haut-parleur du téléphone"</item>
</string-array>
<string-array name="wifi_signal">
diff --git a/res/values-in/arrays.xml b/res/values-in/arrays.xml
index 8ec582e..15ed51f 100644
--- a/res/values-in/arrays.xml
+++ b/res/values-in/arrays.xml
@@ -400,8 +400,8 @@
</string-array>
<string-array name="wifi_metered_entries">
<item msgid="3237321077949659241">"Deteksi otomatis"</item>
- <item msgid="3779092145391320375">"Perlakukan sebagai berbayar"</item>
- <item msgid="2047166446768045816">"Perlakukan sebagai tidak berbayar"</item>
+ <item msgid="3779092145391320375">"Perlakukan sebagai berkuota"</item>
+ <item msgid="2047166446768045816">"Perlakukan sebagai tanpa kuota"</item>
</string-array>
<string-array name="wifi_privacy_entries">
<item msgid="3485945604919292489">"Gunakan MAC acak (default)"</item>
diff --git a/res/values-it/arrays.xml b/res/values-it/arrays.xml
index 568fc1e..b246a4c 100644
--- a/res/values-it/arrays.xml
+++ b/res/values-it/arrays.xml
@@ -88,7 +88,7 @@
<string-array name="bluetooth_audio_routing_titles">
<item msgid="3488687531285795335">"Usa valore predefinito dell\'app"</item>
<item msgid="5112879855377353813">"Riproduci su protesi uditiva"</item>
- <item msgid="4853360663119482646">"Riproduci su altoparlante del telefono"</item>
+ <item msgid="4853360663119482646">"Riproduci su altoparlante dello smartphone"</item>
</string-array>
<string-array name="wifi_signal">
<item msgid="199360311367724149">"Scadente"</item>
diff --git a/res/values-iw/arrays.xml b/res/values-iw/arrays.xml
index c8c8de6..9d016bb 100644
--- a/res/values-iw/arrays.xml
+++ b/res/values-iw/arrays.xml
@@ -405,7 +405,7 @@
</string-array>
<string-array name="wifi_privacy_entries">
<item msgid="3485945604919292489">"שימוש בכתובת MAC אקראית (ברירת מחדל)"</item>
- <item msgid="741680937828608749">"שימוש בכתובת MAC של המכשיר"</item>
+ <item msgid="741680937828608749">"שימוש בכתובת ה-MAC של המכשיר"</item>
</string-array>
<string-array name="wifi_hidden_entries">
<item msgid="342232116597649254">"לא"</item>
diff --git a/res/values-lv/arrays.xml b/res/values-lv/arrays.xml
index aa1e0e1..fdd5bf8 100644
--- a/res/values-lv/arrays.xml
+++ b/res/values-lv/arrays.xml
@@ -404,7 +404,7 @@
<item msgid="2047166446768045816">"Bezmaksas"</item>
</string-array>
<string-array name="wifi_privacy_entries">
- <item msgid="3485945604919292489">"Izmantot nejaušā secībā atlasītu MAC adresi (noklusējums)"</item>
+ <item msgid="3485945604919292489">"Nejauša MAC adrese (noklusējums)"</item>
<item msgid="741680937828608749">"Izmantot ierīces MAC adresi"</item>
</string-array>
<string-array name="wifi_hidden_entries">
diff --git a/res/values-mk/arrays.xml b/res/values-mk/arrays.xml
index abbbe94..25a86b2 100644
--- a/res/values-mk/arrays.xml
+++ b/res/values-mk/arrays.xml
@@ -87,8 +87,8 @@
</string-array>
<string-array name="bluetooth_audio_routing_titles">
<item msgid="3488687531285795335">"Користи ги стандардните поставки на апликацијата"</item>
- <item msgid="5112879855377353813">"Пушти на слушно помагало"</item>
- <item msgid="4853360663119482646">"Пушти на звучник на телефонот"</item>
+ <item msgid="5112879855377353813">"Пуштај на слушното помагало"</item>
+ <item msgid="4853360663119482646">"Пуштај на звучникот на телефонот"</item>
</string-array>
<string-array name="wifi_signal">
<item msgid="199360311367724149">"Слаба"</item>
diff --git a/res/values-mr/arrays.xml b/res/values-mr/arrays.xml
index b03ea4c..b83f493 100644
--- a/res/values-mr/arrays.xml
+++ b/res/values-mr/arrays.xml
@@ -121,7 +121,7 @@
<string-array name="wifi_proxy_settings">
<item msgid="4669222334822978847">"काहीही नाही"</item>
<item msgid="6242198071587397280">"मॅन्युअल"</item>
- <item msgid="464383874780058242">"प्रॉक्सी ऑटो-कॉन्फिग"</item>
+ <item msgid="464383874780058242">"प्रॉक्सी ऑटो-कॉंफिग"</item>
</string-array>
<string-array name="apn_auth_entries">
<item msgid="2900892411844440682">"काहीही नाही"</item>
diff --git a/res/values-nl/arrays.xml b/res/values-nl/arrays.xml
index b00f9de..6e2ca64 100644
--- a/res/values-nl/arrays.xml
+++ b/res/values-nl/arrays.xml
@@ -86,9 +86,9 @@
<item msgid="6702740528496186521">"5"</item>
</string-array>
<string-array name="bluetooth_audio_routing_titles">
- <item msgid="3488687531285795335">"App-standaard gebruiken"</item>
- <item msgid="5112879855377353813">"Afspelen via hoortoestel"</item>
- <item msgid="4853360663119482646">"Afspelen via telefoonspeaker"</item>
+ <item msgid="3488687531285795335">"Gebruik app-standaard"</item>
+ <item msgid="5112879855377353813">"Speel af via hoortoestel"</item>
+ <item msgid="4853360663119482646">"Speel af via telefoonspeaker"</item>
</string-array>
<string-array name="wifi_signal">
<item msgid="199360311367724149">"Slecht"</item>
diff --git a/res/values-pa/arrays.xml b/res/values-pa/arrays.xml
index 7a799af..13330f5 100644
--- a/res/values-pa/arrays.xml
+++ b/res/values-pa/arrays.xml
@@ -50,7 +50,7 @@
<string-array name="wifi_status">
<item msgid="1201478116293383426"></item>
<item msgid="7388036070768806193">"ਸਕੈਨ ਕੀਤਾ ਜਾ ਰਿਹਾ ਹੈ..."</item>
- <item msgid="1656176059757237036">"ਕਨੈਕਟ ਕਰ ਰਿਹਾ ਹੈ…"</item>
+ <item msgid="1656176059757237036">"ਕਨੈਕਟ ਕੀਤਾ ਜਾ ਰਿਹਾ ਹੈ…"</item>
<item msgid="3249903732481917388">"ਪ੍ਰਮਾਣਿਤ ਕਰ ਰਿਹਾ ਹੈ…"</item>
<item msgid="7789156794775399931">"IP ਪਤਾ ਪ੍ਰਾਪਤ ਕਰ ਰਿਹਾ ਹੈ..."</item>
<item msgid="492518447401534767">"ਕਨੈਕਟ ਕੀਤਾ"</item>
@@ -362,7 +362,7 @@
<string-array name="vpn_states">
<item msgid="2262719249581510939">"ਡਿਸਕਨੈਕਟ ਕੀਤਾ"</item>
<item msgid="9141074028293812365">"ਅਰੰਭ ਕਰ ਰਿਹਾ ਹੈ..."</item>
- <item msgid="2234425878608626285">"ਕਨੈਕਟ ਕਰ ਰਿਹਾ ਹੈ…"</item>
+ <item msgid="2234425878608626285">"ਕਨੈਕਟ ਕੀਤਾ ਜਾ ਰਿਹਾ ਹੈ…"</item>
<item msgid="27547778933579155">"ਕਨੈਕਟ ਕੀਤਾ"</item>
<item msgid="893506841727300393">"ਸਮਾਂ ਸਮਾਪਤ"</item>
<item msgid="2974952010554140659">"ਅਸਫਲ"</item>
diff --git a/res/values-pl/arrays.xml b/res/values-pl/arrays.xml
index e5477b7..0086582 100644
--- a/res/values-pl/arrays.xml
+++ b/res/values-pl/arrays.xml
@@ -362,7 +362,7 @@
<string-array name="vpn_states">
<item msgid="2262719249581510939">"Rozłączono"</item>
<item msgid="9141074028293812365">"Inicjowanie…"</item>
- <item msgid="2234425878608626285">"Łączenie…"</item>
+ <item msgid="2234425878608626285">"Łączę…"</item>
<item msgid="27547778933579155">"Połączono"</item>
<item msgid="893506841727300393">"Przekroczono czas oczekiwania"</item>
<item msgid="2974952010554140659">"Niepowodzenie"</item>
diff --git a/res/values-ro/arrays.xml b/res/values-ro/arrays.xml
index 3c35c18..62384de 100644
--- a/res/values-ro/arrays.xml
+++ b/res/values-ro/arrays.xml
@@ -87,7 +87,7 @@
</string-array>
<string-array name="bluetooth_audio_routing_titles">
<item msgid="3488687531285795335">"Folosește setarea prestabilită a aplicației"</item>
- <item msgid="5112879855377353813">"Redă pe aparatul auditiv"</item>
+ <item msgid="5112879855377353813">"Redă în aparatul auditiv"</item>
<item msgid="4853360663119482646">"Redă în difuzorul telefonului"</item>
</string-array>
<string-array name="wifi_signal">
diff --git a/res/values-ru/arrays.xml b/res/values-ru/arrays.xml
index ed18bab..b4b05f1 100644
--- a/res/values-ru/arrays.xml
+++ b/res/values-ru/arrays.xml
@@ -86,7 +86,7 @@
<item msgid="6702740528496186521">"5"</item>
</string-array>
<string-array name="bluetooth_audio_routing_titles">
- <item msgid="3488687531285795335">"Использовать настройки по умолчанию"</item>
+ <item msgid="3488687531285795335">"Зависит от приложения"</item>
<item msgid="5112879855377353813">"Воспроизведение через слуховой аппарат"</item>
<item msgid="4853360663119482646">"Воспроизведение через динамик телефона"</item>
</string-array>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index e3c1b20..5cf4532 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -229,6 +229,9 @@
<item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>
</style>
+ <style name="Theme.Panel.Material" parent="Theme.Panel" >
+ <item name="android:switchStyle">@style/Switch.SettingsLib</item>
+ </style>
<!-- Material theme for the pages containing TabLayout and ViewPager -->
<style name="Theme.TabTheme" parent="@style/Theme.MaterialComponents.DayNight">
<item name="colorPrimary">@*android:color/edge_effect_device_default_light</item>
diff --git a/res/xml/modifier_keys_settings.xml b/res/xml/modifier_keys_settings.xml
index 63e7ee1..25525ae 100644
--- a/res/xml/modifier_keys_settings.xml
+++ b/res/xml/modifier_keys_settings.xml
@@ -21,25 +21,22 @@
android:title="@string/modifier_keys_settings"
android:key="modifier_keys_all"
settings:controller="com.android.settings.inputmethod.ModifierKeysPreferenceController">
- <Preference
+
+ <com.android.settingslib.widget.LayoutPreference
android:key="modifier_keys_caps_lock"
- android:title="@string/modifier_keys_caps_lock"
- android:summary="@string/modifier_keys_default_summary"/>
+ android:layout="@layout/modifier_keys_custom_key" />
- <Preference
+ <com.android.settingslib.widget.LayoutPreference
android:key="modifier_keys_ctrl"
- android:title="@string/modifier_keys_ctrl"
- android:summary="@string/modifier_keys_default_summary"/>
+ android:layout="@layout/modifier_keys_custom_key" />
- <Preference
+ <com.android.settingslib.widget.LayoutPreference
android:key="modifier_keys_meta"
- android:title="@string/modifier_keys_meta"
- android:summary="@string/modifier_keys_default_summary"/>
+ android:layout="@layout/modifier_keys_custom_key" />
- <Preference
+ <com.android.settingslib.widget.LayoutPreference
android:key="modifier_keys_alt"
- android:title="@string/modifier_keys_alt"
- android:summary="@string/modifier_keys_default_summary"/>
+ android:layout="@layout/modifier_keys_custom_key" />
<Preference
android:key="modifier_keys_restore"
diff --git a/src/com/android/settings/fuelgauge/BatteryUtils.java b/src/com/android/settings/fuelgauge/BatteryUtils.java
index 12760b1..f5d3950 100644
--- a/src/com/android/settings/fuelgauge/BatteryUtils.java
+++ b/src/com/android/settings/fuelgauge/BatteryUtils.java
@@ -451,12 +451,10 @@
@VisibleForTesting
Estimate getEnhancedEstimate() {
- Estimate estimate = null;
- // Get enhanced prediction if available
- if (Duration.between(Estimate.getLastCacheUpdateTime(mContext), Instant.now())
- .compareTo(Duration.ofSeconds(10)) < 0) {
- estimate = Estimate.getCachedEstimateIfAvailable(mContext);
- } else if (mPowerUsageFeatureProvider != null &&
+ // Align the same logic in the BatteryControllerImpl.updateEstimate()
+ Estimate estimate = Estimate.getCachedEstimateIfAvailable(mContext);
+ if (estimate == null &&
+ mPowerUsageFeatureProvider != null &&
mPowerUsageFeatureProvider.isEnhancedBatteryPredictionEnabled(mContext)) {
estimate = mPowerUsageFeatureProvider.getEnhancedBatteryPrediction(mContext);
if (estimate != null) {
diff --git a/src/com/android/settings/inputmethod/KeyboardSettingsFeatureProvider.java b/src/com/android/settings/inputmethod/KeyboardSettingsFeatureProvider.java
index 52e9c18..7255107 100644
--- a/src/com/android/settings/inputmethod/KeyboardSettingsFeatureProvider.java
+++ b/src/com/android/settings/inputmethod/KeyboardSettingsFeatureProvider.java
@@ -17,7 +17,9 @@
package com.android.settings.inputmethod;
import android.content.Context;
+import android.graphics.drawable.Drawable;
+import androidx.annotation.Nullable;
import androidx.preference.PreferenceScreen;
/**
@@ -41,4 +43,14 @@
* @return true if the category is added successfully.
*/
boolean addFirmwareUpdateCategory(Context context, PreferenceScreen screen);
+
+ /**
+ * Get custom action key icon.
+ *
+ * @param context Context for accessing resources.
+ *
+ * @return Returns the image of the icon, or null if there is no any custom icon.
+ */
+ @Nullable
+ Drawable getActionKeyIcon(Context context);
}
diff --git a/src/com/android/settings/inputmethod/KeyboardSettingsFeatureProviderImpl.java b/src/com/android/settings/inputmethod/KeyboardSettingsFeatureProviderImpl.java
index b0eb31b..26b10e5 100644
--- a/src/com/android/settings/inputmethod/KeyboardSettingsFeatureProviderImpl.java
+++ b/src/com/android/settings/inputmethod/KeyboardSettingsFeatureProviderImpl.java
@@ -17,6 +17,7 @@
package com.android.settings.inputmethod;
import android.content.Context;
+import android.graphics.drawable.Drawable;
import androidx.preference.PreferenceScreen;
@@ -34,4 +35,9 @@
public boolean addFirmwareUpdateCategory(Context context, PreferenceScreen screen) {
return false;
}
+
+ @Override
+ public Drawable getActionKeyIcon(Context context) {
+ return null;
+ };
}
diff --git a/src/com/android/settings/inputmethod/ModifierKeysPickerDialogFragment.java b/src/com/android/settings/inputmethod/ModifierKeysPickerDialogFragment.java
index 949e656..076173a 100644
--- a/src/com/android/settings/inputmethod/ModifierKeysPickerDialogFragment.java
+++ b/src/com/android/settings/inputmethod/ModifierKeysPickerDialogFragment.java
@@ -22,6 +22,7 @@
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
+import android.graphics.drawable.Drawable;
import android.hardware.input.InputManager;
import android.os.Bundle;
import android.text.Spannable;
@@ -39,10 +40,12 @@
import android.widget.ListView;
import android.widget.TextView;
+import androidx.core.graphics.drawable.DrawableCompat;
import androidx.fragment.app.DialogFragment;
import androidx.preference.Preference;
import com.android.settings.R;
+import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.Utils;
import java.util.ArrayList;
@@ -60,6 +63,11 @@
private String mKeyDefaultName;
private String mKeyFocus;
private Activity mActivity;
+ private KeyboardSettingsFeatureProvider mFeatureProvider;
+ private Drawable mActionKeyDrawable;
+ private TextView mLeftBracket;
+ private TextView mRightBracket;
+ private ImageView mActionKeyIcon;
private List<int[]> mRemappableKeyList =
new ArrayList<>(Arrays.asList(
@@ -83,6 +91,8 @@
super.onCreateDialog(savedInstanceState);
mActivity = getActivity();
+ FeatureFactory featureFactory = FeatureFactory.getFactory(mActivity);
+ mFeatureProvider = featureFactory.getKeyboardSettingsFeatureProvider();
InputManager inputManager = mActivity.getSystemService(InputManager.class);
mKeyDefaultName = getArguments().getString(DEFAULT_KEY);
mKeyFocus = getArguments().getString(SELECTION_KEY);
@@ -97,6 +107,10 @@
for (int i = 0; i < modifierKeys.size(); i++) {
mRemappableKeyMap.put(modifierKeys.get(i), mRemappableKeyList.get(i));
}
+ Drawable drawable = mFeatureProvider.getActionKeyIcon(mActivity);
+ if (drawable != null) {
+ mActionKeyDrawable = DrawableCompat.wrap(drawable);
+ }
View dialoglayout =
LayoutInflater.from(mActivity).inflate(R.layout.modifier_key_picker_dialog, null);
@@ -226,10 +240,18 @@
checkIcon.setImageAlpha(255);
view.setBackground(
mActivity.getDrawable(R.drawable.modifier_key_lisetview_background));
+ if (mActionKeyDrawable != null && i == 2) {
+ setActionKeyIcon(view);
+ setActionKeyColor(getColorOfMaterialColorPrimary());
+ }
} else {
textView.setTextColor(getColorOfTextColorPrimary());
checkIcon.setImageAlpha(0);
view.setBackground(null);
+ if (mActionKeyDrawable != null && i == 2) {
+ setActionKeyIcon(view);
+ setActionKeyColor(getColorOfTextColorPrimary());
+ }
}
return view;
}
@@ -243,6 +265,21 @@
}
}
+ private void setActionKeyIcon(View view) {
+ mLeftBracket = view.findViewById(R.id.modifier_key_left_bracket);
+ mRightBracket = view.findViewById(R.id.modifier_key_right_bracket);
+ mActionKeyIcon = view.findViewById(R.id.modifier_key_action_key_icon);
+ mLeftBracket.setText("(");
+ mRightBracket.setText(")");
+ mActionKeyIcon.setImageDrawable(mActionKeyDrawable);
+ }
+
+ private void setActionKeyColor(int color) {
+ mLeftBracket.setTextColor(color);
+ mRightBracket.setTextColor(color);
+ DrawableCompat.setTint(mActionKeyDrawable, color);
+ }
+
private int getColorOfTextColorPrimary() {
return Utils.getColorAttrDefaultColor(mActivity, android.R.attr.textColorPrimary);
}
diff --git a/src/com/android/settings/inputmethod/ModifierKeysPreferenceController.java b/src/com/android/settings/inputmethod/ModifierKeysPreferenceController.java
index 5d8149a..77def48 100644
--- a/src/com/android/settings/inputmethod/ModifierKeysPreferenceController.java
+++ b/src/com/android/settings/inputmethod/ModifierKeysPreferenceController.java
@@ -17,12 +17,16 @@
package com.android.settings.inputmethod;
import android.content.Context;
+import android.graphics.drawable.Drawable;
import android.hardware.input.InputManager;
import android.os.Bundle;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
+import android.util.Pair;
import android.view.KeyEvent;
+import android.widget.ImageView;
+import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
@@ -31,7 +35,9 @@
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
+import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.Utils;
+import com.android.settingslib.widget.LayoutPreference;
import java.util.ArrayList;
import java.util.Arrays;
@@ -53,6 +59,7 @@
private FragmentManager mFragmentManager;
private final InputManager mIm;
private PreferenceScreen mScreen;
+ private Drawable mDrawable;
private final List<Integer> mRemappableKeys = new ArrayList<>(
Arrays.asList(
@@ -61,6 +68,14 @@
KeyEvent.KEYCODE_ALT_LEFT, KeyEvent.KEYCODE_ALT_RIGHT,
KeyEvent.KEYCODE_CAPS_LOCK));
+ private final List<Pair<String, Integer>> mKeys = new ArrayList<>(
+ Arrays.asList(
+ Pair.create(KEY_PREFERENCE_CTRL, R.string.modifier_keys_ctrl),
+ Pair.create(KEY_PREFERENCE_META, R.string.modifier_keys_meta),
+ Pair.create(KEY_PREFERENCE_ALT, R.string.modifier_keys_alt),
+ Pair.create(KEY_PREFERENCE_CAPS_LOCK, R.string.modifier_keys_caps_lock)
+ ));
+
private String[] mKeyNames = new String[] {
mContext.getString(R.string.modifier_keys_ctrl),
mContext.getString(R.string.modifier_keys_ctrl),
@@ -74,6 +89,9 @@
super(context, key);
mIm = context.getSystemService(InputManager.class);
Objects.requireNonNull(mIm, "InputManager service cannot be null");
+ KeyboardSettingsFeatureProvider featureProvider =
+ FeatureFactory.getFactory(context).getKeyboardSettingsFeatureProvider();
+ mDrawable = featureProvider.getActionKeyIcon(context);
}
public void setFragment(Fragment parent) {
@@ -91,33 +109,59 @@
}
private void refreshUi() {
+ initDefaultKeysName();
for (Map.Entry<Integer, Integer> entry : mIm.getModifierKeyRemapping().entrySet()) {
int fromKey = entry.getKey();
int toKey = entry.getValue();
int index = mRemappableKeys.indexOf(toKey);
if (isCtrl(fromKey) && mRemappableKeys.contains(toKey)) {
- Preference preference = mScreen.findPreference(KEY_PREFERENCE_CTRL);
- preference.setSummary(changeSummaryColor(mKeyNames[index]));
+ setSummaryColor(KEY_PREFERENCE_CTRL, index);
}
if (isMeta(fromKey) && mRemappableKeys.contains(toKey)) {
- Preference preference = mScreen.findPreference(KEY_PREFERENCE_META);
- preference.setSummary(changeSummaryColor(mKeyNames[index]));
+ setSummaryColor(KEY_PREFERENCE_META, index);
}
if (isAlt(fromKey) && mRemappableKeys.contains(toKey)) {
- Preference preference = mScreen.findPreference(KEY_PREFERENCE_ALT);
- preference.setSummary(changeSummaryColor(mKeyNames[index]));
+ setSummaryColor(KEY_PREFERENCE_ALT, index);
}
if (isCapLock(fromKey) && mRemappableKeys.contains(toKey)) {
- Preference preference = mScreen.findPreference(KEY_PREFERENCE_CAPS_LOCK);
- preference.setSummary(changeSummaryColor(mKeyNames[index]));
+ setSummaryColor(KEY_PREFERENCE_CAPS_LOCK, index);
}
}
}
+ private void initDefaultKeysName() {
+ for (Pair<String, Integer> key : mKeys) {
+ LayoutPreference layoutPreference = mScreen.findPreference(key.first);
+ TextView title = layoutPreference.findViewById(R.id.title);
+ TextView summary = layoutPreference.findViewById(R.id.summary);
+ title.setText(key.second);
+ summary.setText(R.string.modifier_keys_default_summary);
+
+ if (key.first.equals(KEY_PREFERENCE_META) && mDrawable != null) {
+ setActionKeyIcon(layoutPreference, mDrawable);
+ }
+ }
+ }
+
+ private static void setActionKeyIcon(LayoutPreference preference, Drawable drawable) {
+ TextView leftBracket = preference.findViewById(R.id.modifier_key_left_bracket);
+ TextView rightBracket = preference.findViewById(R.id.modifier_key_right_bracket);
+ ImageView actionKeyIcon = preference.findViewById(R.id.modifier_key_action_key_icon);
+ leftBracket.setText("(");
+ rightBracket.setText(")");
+ actionKeyIcon.setImageDrawable(drawable);
+ }
+
+ private void setSummaryColor(String key, int targetIndex) {
+ LayoutPreference layoutPreference = mScreen.findPreference(key);
+ TextView summary = layoutPreference.findViewById(R.id.summary);
+ summary.setText(changeSummaryColor(mKeyNames[targetIndex]));
+ }
+
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
if (preference.getKey().equals(KEY_RESTORE_PREFERENCE)) {
@@ -137,12 +181,14 @@
ModifierKeysPickerDialogFragment fragment = new ModifierKeysPickerDialogFragment();
fragment.setTargetFragment(mParent, 0);
Bundle bundle = new Bundle();
+ TextView title = ((LayoutPreference) preference).findViewById(R.id.title);
+ TextView summary = ((LayoutPreference) preference).findViewById(R.id.summary);
bundle.putString(
ModifierKeysPickerDialogFragment.DEFAULT_KEY,
- preference.getTitle().toString());
+ title.getText().toString());
bundle.putString(
ModifierKeysPickerDialogFragment.SELECTION_KEY,
- preference.getSummary().toString());
+ summary.getText().toString());
fragment.setArguments(bundle);
fragment.show(mFragmentManager, KEY_TAG);
}
diff --git a/src/com/android/settings/network/telephony/AbstractSubscriptionPreferenceController.java b/src/com/android/settings/network/telephony/AbstractSubscriptionPreferenceController.java
new file mode 100644
index 0000000..5f6c0ee
--- /dev/null
+++ b/src/com/android/settings/network/telephony/AbstractSubscriptionPreferenceController.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+
+package com.android.settings.network.telephony;
+
+import android.content.Context;
+
+/**
+ * {@link TelephonyBasePreferenceController} used to add vendor preference controllers in {@link
+ * MobileNetworkSettings}.
+ */
+public abstract class AbstractSubscriptionPreferenceController
+ extends TelephonyBasePreferenceController {
+ public AbstractSubscriptionPreferenceController(Context context, String key) {
+ super(context, key);
+ }
+
+ public void init(int subId) {
+ mSubId = subId;
+ }
+}
diff --git a/src/com/android/settings/network/telephony/MobileNetworkSettings.java b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
index d6d9df4..1d862f3 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkSettings.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
@@ -300,6 +300,13 @@
if (convertToEsimPreferenceController != null) {
convertToEsimPreferenceController.init(mSubId, mSubscriptionInfoEntity);
}
+
+ List<AbstractSubscriptionPreferenceController> subscriptionPreferenceControllers =
+ useAll(AbstractSubscriptionPreferenceController.class);
+ for (AbstractSubscriptionPreferenceController controller :
+ subscriptionPreferenceControllers) {
+ controller.init(mSubId);
+ }
}
@Override
diff --git a/tests/robotests/src/com/android/settings/accessibility/TopLevelAccessibilityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/TopLevelAccessibilityPreferenceControllerTest.java
index 3acc02c..1249894 100644
--- a/tests/robotests/src/com/android/settings/accessibility/TopLevelAccessibilityPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/TopLevelAccessibilityPreferenceControllerTest.java
@@ -21,24 +21,33 @@
import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
import android.content.Context;
+import android.content.res.Resources;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
@RunWith(RobolectricTestRunner.class)
public class TopLevelAccessibilityPreferenceControllerTest {
private Context mContext;
+ private Resources mResources;
private TopLevelAccessibilityPreferenceController mController;
@Before
public void setUp() {
- mContext = RuntimeEnvironment.application;
+ mContext = spy(ApplicationProvider.getApplicationContext());
+ mResources = spy(mContext.getResources());
+ when(mContext.getResources()).thenReturn(mResources);
mController = new TopLevelAccessibilityPreferenceController(mContext, "test_key");
}
@@ -48,8 +57,9 @@
}
@Test
- @Config(qualifiers = "mcc999")
public void getAvailabilityStatus_unsupportedWhenSet() {
+ when(mResources.getBoolean(R.bool.config_show_top_level_accessibility)).thenReturn(false);
+
assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
}
}
diff --git a/tests/unit/src/com/android/settings/inputmethod/KeyboardSettingsFeatureProviderImplTest.java b/tests/unit/src/com/android/settings/inputmethod/KeyboardSettingsFeatureProviderImplTest.java
index 72facc3..6675d5a 100644
--- a/tests/unit/src/com/android/settings/inputmethod/KeyboardSettingsFeatureProviderImplTest.java
+++ b/tests/unit/src/com/android/settings/inputmethod/KeyboardSettingsFeatureProviderImplTest.java
@@ -57,4 +57,9 @@
assertThat(mFeatureProvider.addFirmwareUpdateCategory(mContext, screen)).isFalse();
}
+
+ @Test
+ public void getActionKeyIcon_defaultValue_returnsNull() {
+ assertThat(mFeatureProvider.getActionKeyIcon(mContext)).isNull();
+ }
}