Merge "Implement querySiteMapPairs for indexableProvider."
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 2d031ed1..05c5075 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -202,6 +202,31 @@
android:value="true" />
</activity>
+ <activity android:name=".Settings$ConnectedDeviceDashboardActivityOld"
+ android:taskAffinity="com.android.settings"
+ android:label="@string/connected_devices_dashboard_title"
+ android:icon="@drawable/ic_devices_other"
+ android:parentActivityName="Settings">
+ <intent-filter android:priority="1">
+ <action android:name="android.settings.NFC_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.VOICE_LAUNCH" />
+ </intent-filter>
+ <intent-filter android:priority="10">
+ <action android:name="com.android.settings.action.SETTINGS"/>
+ </intent-filter>
+ <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+ android:value="com.android.settings.connecteddevice.ConnectedDeviceDashboardFragmentOld"/>
+ <meta-data android:name="com.android.settings.category"
+ android:value="com.android.settings.category.ia.homepage"/>
+ <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
+ android:value="true" />
+ </activity>
+
<activity android:name="AirplaneModeVoiceActivity"
android:label="@string/wireless_networks_settings_title"
android:theme="@*android:style/Theme.DeviceDefault.Light.Voice"
@@ -251,6 +276,8 @@
android:value="com.android.settings.wifi.WifiSettings" />
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" />
+ <meta-data android:name="android.metadata.SLICE_URI"
+ android:value="content://com.android.settings.slices/wifi" />
</activity>
<!-- Keep compatibility with old shortcuts. -->
@@ -1893,7 +1920,8 @@
android:label="@string/development_settings_title"
android:icon="@drawable/ic_settings_development"
android:taskAffinity="com.android.settings"
- android:parentActivityName="Settings">
+ android:parentActivityName="Settings"
+ android:enabled="false">
<intent-filter android:priority="1">
<action android:name="android.settings.APPLICATION_DEVELOPMENT_SETTINGS" />
<action android:name="com.android.settings.APPLICATION_DEVELOPMENT_SETTINGS" />
@@ -1962,15 +1990,6 @@
android:value="com.android.settings.print.PrintJobSettingsFragment" />
</activity>
- <!-- Keep compatibility with old shortcuts. -->
- <activity-alias android:name="DevelopmentSettings"
- android:exported="true"
- android:label="@string/development_settings_title"
- android:targetActivity="Settings$DevelopmentSettingsDashboardActivity">
- <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
- android:value="com.android.settings.development.DevelopmentSettingsDashboardFragment" />
- </activity-alias>
-
<activity android:name=".development.AppPicker"
android:label="@string/select_application"
android:theme="@android:style/Theme.DeviceDefault.Light.Dialog" />
@@ -1979,15 +1998,6 @@
android:label="@string/select_webview_provider_dialog_title">
</activity>
- <!-- Keep compatibility with old shortcuts. -->
- <activity-alias android:name="UsbSettings"
- android:exported="true"
- android:label="@string/storage_title_usb"
- android:targetActivity="Settings$DevelopmentSettingsDashboardActivity">
- <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
- android:value="com.android.settings.deviceinfo.UsbSettings" />
- </activity-alias>
-
<!-- Bluetooth stuff -->
<activity android:name=".bluetooth.BluetoothPairingDialog"
@@ -3283,6 +3293,18 @@
</intent-filter>
</activity>
+ <provider android:name=".SettingsSliceProvider"
+ android:authorities="com.android.settings.slices"
+ android:exported="true">
+ </provider>
+
+ <receiver
+ android:name=".SliceBroadcastReceiver" >
+ <intent-filter>
+ <action android:name="com.android.settings.slice.action.WIFI_CHANGED"/>
+ </intent-filter>
+ </receiver>
+
<!-- This is the longest AndroidManifest.xml ever. -->
</application>
</manifest>
diff --git a/res/layout-land/fingerprint_enroll_enrolling.xml b/res/layout-land/fingerprint_enroll_enrolling.xml
index fb6c78b..8b902f1 100644
--- a/res/layout-land/fingerprint_enroll_enrolling.xml
+++ b/res/layout-land/fingerprint_enroll_enrolling.xml
@@ -110,10 +110,11 @@
<com.android.setupwizardlib.view.FillContentLayout
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
+ android:layout_marginVertical="24dp"
+ android:layout_weight="1"
android:paddingTop="0dp"
- android:paddingBottom="0dp"
- android:layout_marginVertical="24dp">
+ android:paddingBottom="0dp">
<include layout="@layout/fingerprint_enroll_enrolling_content"
android:layout_width="match_parent"
diff --git a/res/layout/preference_dropdown_material_settings.xml b/res/layout/preference_dropdown_material_settings.xml
deleted file mode 100644
index a3f5ab9..0000000
--- a/res/layout/preference_dropdown_material_settings.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2016 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.
- -->
-
-
-<!-- Based off frameworks/base/core/res/res/layout/preference_dropdown_material.xml
- except that icon space in this layout is always reserved -->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <Spinner
- android:id="@+id/spinner"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_marginStart="@dimen/preference_no_icon_padding_start"
- android:visibility="invisible" />
-
- <include layout="@layout/preference_material"/>
-
-</FrameLayout>
\ No newline at end of file
diff --git a/res/layout/search_slice_item.xml b/res/layout/search_slice_item.xml
new file mode 100644
index 0000000..1607209
--- /dev/null
+++ b/res/layout/search_slice_item.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:background="?android:attr/selectableItemBackground"
+ android:clipToPadding="false">
+
+ <include layout="@layout/search_icon_view"/>
+
+ <android.app.slice.widget.SliceView
+ android:id="@android:id/content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/settings_main_dashboard.xml b/res/layout/settings_main_dashboard.xml
index 8e83cff..7c34803 100644
--- a/res/layout/settings_main_dashboard.xml
+++ b/res/layout/settings_main_dashboard.xml
@@ -32,7 +32,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/search_bar_margin"
- app:cardCornerRadius="2dp"
+ app:cardCornerRadius="@dimen/search_bar_half_height"
app:cardBackgroundColor="?android:attr/colorBackground"
app:cardElevation="2dp">
<Toolbar
diff --git a/res/values-ar/strings.xml b/res/values-ar/strings.xml
index 56ba8a6..f610f60 100644
--- a/res/values-ar/strings.xml
+++ b/res/values-ar/strings.xml
@@ -1199,17 +1199,21 @@
<string name="storage_settings_title" msgid="8746016738388094064">"إعدادات وحدة التخزين"</string>
<string name="storage_settings_summary" product="nosdcard" msgid="3543813623294870759">"إلغاء تركيب وحدة تخزين USB، وعرض سعة التخزين المتاحة"</string>
<string name="storage_settings_summary" product="default" msgid="9176693537325988610">"إلغاء تحميل بطاقة SD، عرض سعة التخزين المتاحة"</string>
- <string name="imei_multi_sim_slot_1" msgid="8062257124383430433">"IMEI (المنفذ ١ لشريحة SIM)"</string>
- <string name="imei_multi_sim_slot_2" msgid="7008494345236276520">"IMEI (المنفذ ٢ لشريحة SIM)"</string>
+ <!-- no translation found for imei_multi_sim (6387012961838800539) -->
+ <skip />
<string name="status_number" product="tablet" msgid="1138837891091222272">"MDN (رقم دليل الجوال)"</string>
<string name="status_number" product="default" msgid="5948892105546651296">"رقم الهاتف"</string>
+ <!-- no translation found for status_number_sim_slot (2755592991367858860) -->
+ <skip />
+ <!-- no translation found for status_number_sim_slot (1898212200138025729) -->
+ <skip />
<string name="status_number_sim_status" product="tablet" msgid="1367110147304523864">"رقم دليل الجوّال على SIM"</string>
<string name="status_number_sim_status" product="default" msgid="9123351360569466330">"رقم الهاتف على شريحة SIM"</string>
<string name="status_min_number" msgid="3519504522179420597">"دقيقة"</string>
<string name="status_msid_number" msgid="909010114445780530">"MSID"</string>
<string name="status_prl_version" msgid="1007470446618081441">"إصدار PRL"</string>
- <string name="meid_multi_sim_sim_slot_1" msgid="6104414476212608482">"MEID (المنفذ ١ لشريحة SIM)"</string>
- <string name="meid_multi_sim_sim_slot_2" msgid="6405908831055261637">"MEID (المنفذ ٢ لشريحة SIM)"</string>
+ <!-- no translation found for meid_multi_sim (748999971744491771) -->
+ <skip />
<string name="status_meid_number" msgid="1751442889111731088">"MEID"</string>
<string name="status_icc_id" msgid="943368755577172747">"ICCID"</string>
<string name="status_network_type" msgid="3279383550222116235">"نوع شبكة الجوال"</string>
@@ -2823,8 +2827,8 @@
<string name="color_purple" msgid="3888532466427762504">"أرجواني"</string>
<string name="sim_no_inserted_msg" msgid="210316755353227087">"لم يتم إدراج بطاقات SIM"</string>
<string name="sim_status_title" msgid="6744870675182447160">"وضع شريحة SIM"</string>
- <string name="sim_status_title_sim_slot_1" msgid="4055743730444965036">"حالة شريحة SIM (المنفذ ١ لشريحة SIM)"</string>
- <string name="sim_status_title_sim_slot_2" msgid="6795077269765759628">"حالة شريحة SIM (المنفذ ٢ لشريحة SIM)"</string>
+ <!-- no translation found for sim_status_title_sim_slot (5725659316463979194) -->
+ <skip />
<string name="sim_call_back_title" msgid="5181549885999280334">"رد الاتصال عبر شريحة SIM الافتراضية"</string>
<string name="sim_outgoing_call_title" msgid="1019763076116874255">"شريحة SIM للمكالمات الصادرة"</string>
<string name="sim_other_call_settings" msgid="8247802316114482477">"إعدادات المكالمات الأخرى"</string>
@@ -2838,6 +2842,8 @@
<string name="sim_pref_divider" msgid="6778907671867621874">"شريحة SIM المفضلة لـ"</string>
<string name="sim_calls_ask_first_prefs_title" msgid="7941299533514115976">"طرح السؤال كل مرة"</string>
<string name="sim_selection_required_pref" msgid="3446721423206414652">"يلزم التحديد"</string>
+ <!-- no translation found for sim_selection_channel_title (2760909074892782589) -->
+ <skip />
<string name="dashboard_title" msgid="5453710313046681820">"الإعدادات"</string>
<plurals name="settings_suggestion_header_summary_hidden_items" formatted="false" msgid="5597356221942118048">
<item quantity="zero">عرض %d عنصر مخفي</item>
@@ -2908,7 +2914,14 @@
<string name="keywords_payment_settings" msgid="5220104934130446416">"دفع، نقر، دفعات"</string>
<string name="keywords_backup" msgid="470070289135403022">"نسخ احتياطية، نسخة احتياطية"</string>
<string name="keywords_assist_gesture_launch" msgid="813968759791342591">"إيماءة"</string>
- <string name="keywords_imei_info" msgid="5244879602514442076">"imei، meid"</string>
+ <!-- no translation found for keywords_imei_info (7230982940217544527) -->
+ <skip />
+ <!-- no translation found for keywords_sim_status (1474422416860990564) -->
+ <skip />
+ <!-- no translation found for keywords_model_and_hardware (1459248377212829642) -->
+ <skip />
+ <!-- no translation found for keywords_android_version (5591055570309015111) -->
+ <skip />
<string name="setup_wifi_nfc_tag" msgid="9028353016222911016">"إعداد علامة NFC عبر Wi-Fi"</string>
<string name="write_tag" msgid="8571858602896222537">"كتابة"</string>
<string name="status_awaiting_tap" msgid="2130145523773160617">"انقر على كلمة علامة لكتابة..."</string>
@@ -2973,6 +2986,20 @@
<string name="zen_mode_visual_interruptions_settings_title" msgid="6751708745442997940">"حظر الإشعارات المرئية"</string>
<string name="zen_mode_visual_signals_settings_subtitle" msgid="6308824824208120508">"السماح بالإشارات المرئية"</string>
<string name="zen_mode_add" msgid="90014394953272517">"إضافة"</string>
+ <!-- no translation found for zen_mode_button_turn_on (5074744714613374902) -->
+ <skip />
+ <!-- no translation found for zen_mode_button_turn_off (1995551537320422792) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_end_time_next_day (3090599225533484203) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_indefinite (2746903915016850399) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule (3856133183910726786) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_app (7112871101701453067) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_multiple (5792308957602984360) -->
+ <skip />
<string name="sound_work_settings" msgid="6774324553228566442">"أصوات الملف الشخصي للعمل"</string>
<string name="work_use_personal_sounds_title" msgid="1148331221338458874">"استخدام أصوات الملف الشخصي"</string>
<string name="work_use_personal_sounds_summary" msgid="6207040454949823153">"يتم استخدام الأصوات نفسها للملف الشخصي وملف العمل الشخصي"</string>
diff --git a/res/values-fr-rCA/strings.xml b/res/values-fr-rCA/strings.xml
index 50e6d1c..3f725bf 100644
--- a/res/values-fr-rCA/strings.xml
+++ b/res/values-fr-rCA/strings.xml
@@ -1147,17 +1147,21 @@
<string name="storage_settings_title" msgid="8746016738388094064">"Paramètres de stockage"</string>
<string name="storage_settings_summary" product="nosdcard" msgid="3543813623294870759">"Désinstaller la mémoire de stockage USB, afficher l\'espace disponible"</string>
<string name="storage_settings_summary" product="default" msgid="9176693537325988610">"Désinstaller la carte SD, afficher la mémoire disponible"</string>
- <string name="imei_multi_sim_slot_1" msgid="8062257124383430433">"Code IIEM (fente SIM n° 1)"</string>
- <string name="imei_multi_sim_slot_2" msgid="7008494345236276520">"Code IIEM (fente SIM n° 2)"</string>
+ <!-- no translation found for imei_multi_sim (6387012961838800539) -->
+ <skip />
<string name="status_number" product="tablet" msgid="1138837891091222272">"MDN"</string>
<string name="status_number" product="default" msgid="5948892105546651296">"Numéro de téléphone"</string>
+ <!-- no translation found for status_number_sim_slot (2755592991367858860) -->
+ <skip />
+ <!-- no translation found for status_number_sim_slot (1898212200138025729) -->
+ <skip />
<string name="status_number_sim_status" product="tablet" msgid="1367110147304523864">"NRM sur la carte SIM"</string>
<string name="status_number_sim_status" product="default" msgid="9123351360569466330">"N° de tél. sur la carte SIM"</string>
<string name="status_min_number" msgid="3519504522179420597">"MIN"</string>
<string name="status_msid_number" msgid="909010114445780530">"MSID"</string>
<string name="status_prl_version" msgid="1007470446618081441">"Version de la liste d\'itinérance préférée"</string>
- <string name="meid_multi_sim_sim_slot_1" msgid="6104414476212608482">"Code IDEM (fente SIM n° 1)"</string>
- <string name="meid_multi_sim_sim_slot_2" msgid="6405908831055261637">"Code IDEM (fente SIM n° 2)"</string>
+ <!-- no translation found for meid_multi_sim (748999971744491771) -->
+ <skip />
<string name="status_meid_number" msgid="1751442889111731088">"MEID"</string>
<string name="status_icc_id" msgid="943368755577172747">"ICCID"</string>
<string name="status_network_type" msgid="3279383550222116235">"Type de réseau mobile"</string>
@@ -2723,8 +2727,8 @@
<string name="color_purple" msgid="3888532466427762504">"Mauve"</string>
<string name="sim_no_inserted_msg" msgid="210316755353227087">"Aucune carte SIM insérée"</string>
<string name="sim_status_title" msgid="6744870675182447160">"État de la carte SIM"</string>
- <string name="sim_status_title_sim_slot_1" msgid="4055743730444965036">"État de la carte SIM (fente SIM n° 1)"</string>
- <string name="sim_status_title_sim_slot_2" msgid="6795077269765759628">"État de la carte SIM (fente SIM n° 2)"</string>
+ <!-- no translation found for sim_status_title_sim_slot (5725659316463979194) -->
+ <skip />
<string name="sim_call_back_title" msgid="5181549885999280334">"Rappeler avec la carte SIM par défaut"</string>
<string name="sim_outgoing_call_title" msgid="1019763076116874255">"Carte SIM pour les appels sortants"</string>
<string name="sim_other_call_settings" msgid="8247802316114482477">"Autres paramètres d\'appel"</string>
@@ -2738,6 +2742,8 @@
<string name="sim_pref_divider" msgid="6778907671867621874">"Carte SIM préférée pour"</string>
<string name="sim_calls_ask_first_prefs_title" msgid="7941299533514115976">"Toujours demander"</string>
<string name="sim_selection_required_pref" msgid="3446721423206414652">"Veuillez indiquer votre préférence"</string>
+ <!-- no translation found for sim_selection_channel_title (2760909074892782589) -->
+ <skip />
<string name="dashboard_title" msgid="5453710313046681820">"Paramètres"</string>
<plurals name="settings_suggestion_header_summary_hidden_items" formatted="false" msgid="5597356221942118048">
<item quantity="one">Afficher %d élément masqué</item>
@@ -2804,7 +2810,14 @@
<string name="keywords_payment_settings" msgid="5220104934130446416">"payer, toucher, paiements"</string>
<string name="keywords_backup" msgid="470070289135403022">"sauvegarde, sauvegarder"</string>
<string name="keywords_assist_gesture_launch" msgid="813968759791342591">"geste"</string>
- <string name="keywords_imei_info" msgid="5244879602514442076">"iiem, idem"</string>
+ <!-- no translation found for keywords_imei_info (7230982940217544527) -->
+ <skip />
+ <!-- no translation found for keywords_sim_status (1474422416860990564) -->
+ <skip />
+ <!-- no translation found for keywords_model_and_hardware (1459248377212829642) -->
+ <skip />
+ <!-- no translation found for keywords_android_version (5591055570309015111) -->
+ <skip />
<string name="setup_wifi_nfc_tag" msgid="9028353016222911016">"Créer une balise NFC par Wi-Fi"</string>
<string name="write_tag" msgid="8571858602896222537">"Écrire"</string>
<string name="status_awaiting_tap" msgid="2130145523773160617">"Touchez une balise pour pour écrire..."</string>
@@ -2865,6 +2878,20 @@
<string name="zen_mode_visual_interruptions_settings_title" msgid="6751708745442997940">"Bloquer dérangements visuels"</string>
<string name="zen_mode_visual_signals_settings_subtitle" msgid="6308824824208120508">"Autoriser les signaux visuels"</string>
<string name="zen_mode_add" msgid="90014394953272517">"Ajouter"</string>
+ <!-- no translation found for zen_mode_button_turn_on (5074744714613374902) -->
+ <skip />
+ <!-- no translation found for zen_mode_button_turn_off (1995551537320422792) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_end_time_next_day (3090599225533484203) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_indefinite (2746903915016850399) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule (3856133183910726786) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_app (7112871101701453067) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_multiple (5792308957602984360) -->
+ <skip />
<string name="sound_work_settings" msgid="6774324553228566442">"Sons du profil professionnel"</string>
<string name="work_use_personal_sounds_title" msgid="1148331221338458874">"Utiliser sons du profil perso"</string>
<string name="work_use_personal_sounds_summary" msgid="6207040454949823153">"Les sons du profil professionnel sont les mêmes que ceux du profil personnel"</string>
diff --git a/res/values-hi/strings.xml b/res/values-hi/strings.xml
index 60338ff..7504796 100644
--- a/res/values-hi/strings.xml
+++ b/res/values-hi/strings.xml
@@ -1147,17 +1147,21 @@
<string name="storage_settings_title" msgid="8746016738388094064">"मेमोरी सेटिंग"</string>
<string name="storage_settings_summary" product="nosdcard" msgid="3543813623294870759">"USB मेमोरी अनमाउंट करें, उपलब्ध मेमोरी देखें"</string>
<string name="storage_settings_summary" product="default" msgid="9176693537325988610">"SD कार्ड अनमाउंट करें, उपलब्ध मेमोरी देखें"</string>
- <string name="imei_multi_sim_slot_1" msgid="8062257124383430433">"IMEI (सिम लगाने की जगह 1)"</string>
- <string name="imei_multi_sim_slot_2" msgid="7008494345236276520">"IMEI (सिम लगाने की जगह 2)"</string>
+ <!-- no translation found for imei_multi_sim (6387012961838800539) -->
+ <skip />
<string name="status_number" product="tablet" msgid="1138837891091222272">"MDN"</string>
<string name="status_number" product="default" msgid="5948892105546651296">"फ़ोन नंबर"</string>
+ <!-- no translation found for status_number_sim_slot (2755592991367858860) -->
+ <skip />
+ <!-- no translation found for status_number_sim_slot (1898212200138025729) -->
+ <skip />
<string name="status_number_sim_status" product="tablet" msgid="1367110147304523864">"सिम का MDN"</string>
<string name="status_number_sim_status" product="default" msgid="9123351360569466330">"सिम का फ़ोन नंबर"</string>
<string name="status_min_number" msgid="3519504522179420597">"MIN"</string>
<string name="status_msid_number" msgid="909010114445780530">"MSID"</string>
<string name="status_prl_version" msgid="1007470446618081441">"PRL वर्शन"</string>
- <string name="meid_multi_sim_sim_slot_1" msgid="6104414476212608482">"MEID (सिम लगाने की जगह 1)"</string>
- <string name="meid_multi_sim_sim_slot_2" msgid="6405908831055261637">"MEID (सिम लगाने की जगह 2)"</string>
+ <!-- no translation found for meid_multi_sim (748999971744491771) -->
+ <skip />
<string name="status_meid_number" msgid="1751442889111731088">"MEID"</string>
<string name="status_icc_id" msgid="943368755577172747">"ICCID"</string>
<string name="status_network_type" msgid="3279383550222116235">"मोबाइल नेटवर्क प्रकार"</string>
@@ -2723,8 +2727,8 @@
<string name="color_purple" msgid="3888532466427762504">"बैंगनी"</string>
<string name="sim_no_inserted_msg" msgid="210316755353227087">"कोई सिम कार्ड नहीं डाला गया"</string>
<string name="sim_status_title" msgid="6744870675182447160">"सिम स्थिति"</string>
- <string name="sim_status_title_sim_slot_1" msgid="4055743730444965036">"सिम की स्थिति (सिम लगाने की जगह 1)"</string>
- <string name="sim_status_title_sim_slot_2" msgid="6795077269765759628">"सिम की स्थिति (सिम लगाने की जगह 2)"</string>
+ <!-- no translation found for sim_status_title_sim_slot (5725659316463979194) -->
+ <skip />
<string name="sim_call_back_title" msgid="5181549885999280334">"डिफ़ॉल्ट सिम से कॉल करें"</string>
<string name="sim_outgoing_call_title" msgid="1019763076116874255">"किया जाने वाला कॉल (आउटगोइंग) के लिए सिम"</string>
<string name="sim_other_call_settings" msgid="8247802316114482477">"अन्य कॉल सेटिंग"</string>
@@ -2738,6 +2742,8 @@
<string name="sim_pref_divider" msgid="6778907671867621874">"इसके लिए पसंदीदा सिम"</string>
<string name="sim_calls_ask_first_prefs_title" msgid="7941299533514115976">"हर बार पूछें"</string>
<string name="sim_selection_required_pref" msgid="3446721423206414652">"चयन आवश्यक है"</string>
+ <!-- no translation found for sim_selection_channel_title (2760909074892782589) -->
+ <skip />
<string name="dashboard_title" msgid="5453710313046681820">"सेटिंग"</string>
<plurals name="settings_suggestion_header_summary_hidden_items" formatted="false" msgid="5597356221942118048">
<item quantity="one">छिपे हुए %d आइटम दिखाएं</item>
@@ -2804,7 +2810,14 @@
<string name="keywords_payment_settings" msgid="5220104934130446416">"भुगतान करें, टैप करें, भुगतान"</string>
<string name="keywords_backup" msgid="470070289135403022">"बैकअप, बैक अप"</string>
<string name="keywords_assist_gesture_launch" msgid="813968759791342591">"जेस्चर"</string>
- <string name="keywords_imei_info" msgid="5244879602514442076">"imei, meid"</string>
+ <!-- no translation found for keywords_imei_info (7230982940217544527) -->
+ <skip />
+ <!-- no translation found for keywords_sim_status (1474422416860990564) -->
+ <skip />
+ <!-- no translation found for keywords_model_and_hardware (1459248377212829642) -->
+ <skip />
+ <!-- no translation found for keywords_android_version (5591055570309015111) -->
+ <skip />
<string name="setup_wifi_nfc_tag" msgid="9028353016222911016">"वाई-फ़ाई NFC टैग सेट करें"</string>
<string name="write_tag" msgid="8571858602896222537">"लिखें"</string>
<string name="status_awaiting_tap" msgid="2130145523773160617">"लिखने के लिए टैग टैप करें..."</string>
@@ -2865,6 +2878,20 @@
<string name="zen_mode_visual_interruptions_settings_title" msgid="6751708745442997940">"मैसेज पर स्क्रीन चमकने से रोकें"</string>
<string name="zen_mode_visual_signals_settings_subtitle" msgid="6308824824208120508">"संकेत दिखाए जाने की अनुमति दें"</string>
<string name="zen_mode_add" msgid="90014394953272517">"जोड़ें"</string>
+ <!-- no translation found for zen_mode_button_turn_on (5074744714613374902) -->
+ <skip />
+ <!-- no translation found for zen_mode_button_turn_off (1995551537320422792) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_end_time_next_day (3090599225533484203) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_indefinite (2746903915016850399) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule (3856133183910726786) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_app (7112871101701453067) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_multiple (5792308957602984360) -->
+ <skip />
<string name="sound_work_settings" msgid="6774324553228566442">"कार्य प्रोफ़ाइल की ध्वनियां"</string>
<string name="work_use_personal_sounds_title" msgid="1148331221338458874">"व्यक्तिगत प्रोफाइल ध्वनि काम में लें"</string>
<string name="work_use_personal_sounds_summary" msgid="6207040454949823153">"कार्य और व्यक्तिगत प्रोफ़ाइल के लिए ध्वनियां एक समान होती हैं"</string>
diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml
index e7dc84a..279ab44 100644
--- a/res/values-ja/strings.xml
+++ b/res/values-ja/strings.xml
@@ -1147,17 +1147,21 @@
<string name="storage_settings_title" msgid="8746016738388094064">"ストレージの設定"</string>
<string name="storage_settings_summary" product="nosdcard" msgid="3543813623294870759">"USBストレージのマウントを解除し、使用できるストレージを表示"</string>
<string name="storage_settings_summary" product="default" msgid="9176693537325988610">"SDカードの取り外し、空き容量の表示"</string>
- <string name="imei_multi_sim_slot_1" msgid="8062257124383430433">"IMEI(SIM スロット 1)"</string>
- <string name="imei_multi_sim_slot_2" msgid="7008494345236276520">"IMEI(SIM スロット 2)"</string>
+ <!-- no translation found for imei_multi_sim (6387012961838800539) -->
+ <skip />
<string name="status_number" product="tablet" msgid="1138837891091222272">"MDN"</string>
<string name="status_number" product="default" msgid="5948892105546651296">"電話番号"</string>
+ <!-- no translation found for status_number_sim_slot (2755592991367858860) -->
+ <skip />
+ <!-- no translation found for status_number_sim_slot (1898212200138025729) -->
+ <skip />
<string name="status_number_sim_status" product="tablet" msgid="1367110147304523864">"SIM の MDN"</string>
<string name="status_number_sim_status" product="default" msgid="9123351360569466330">"SIM の電話番号"</string>
<string name="status_min_number" msgid="3519504522179420597">"MIN"</string>
<string name="status_msid_number" msgid="909010114445780530">"MSID"</string>
<string name="status_prl_version" msgid="1007470446618081441">"PRLバージョン:"</string>
- <string name="meid_multi_sim_sim_slot_1" msgid="6104414476212608482">"MEID(SIM スロット 1)"</string>
- <string name="meid_multi_sim_sim_slot_2" msgid="6405908831055261637">"MEID(SIM スロット 2)"</string>
+ <!-- no translation found for meid_multi_sim (748999971744491771) -->
+ <skip />
<string name="status_meid_number" msgid="1751442889111731088">"MEID"</string>
<string name="status_icc_id" msgid="943368755577172747">"ICCID"</string>
<string name="status_network_type" msgid="3279383550222116235">"モバイルネットワークの種類"</string>
@@ -2727,8 +2731,8 @@
<string name="color_purple" msgid="3888532466427762504">"パープル"</string>
<string name="sim_no_inserted_msg" msgid="210316755353227087">"SIMカードが挿入されていません"</string>
<string name="sim_status_title" msgid="6744870675182447160">"SIMのステータス"</string>
- <string name="sim_status_title_sim_slot_1" msgid="4055743730444965036">"SIM ステータス(SIM スロット 1)"</string>
- <string name="sim_status_title_sim_slot_2" msgid="6795077269765759628">"SIM ステータス(SIM スロット 2)"</string>
+ <!-- no translation found for sim_status_title_sim_slot (5725659316463979194) -->
+ <skip />
<string name="sim_call_back_title" msgid="5181549885999280334">"デフォルトのSIMからコールバック"</string>
<string name="sim_outgoing_call_title" msgid="1019763076116874255">"発信用のSIM"</string>
<string name="sim_other_call_settings" msgid="8247802316114482477">"その他の通話設定"</string>
@@ -2742,6 +2746,8 @@
<string name="sim_pref_divider" msgid="6778907671867621874">"優先SIM:"</string>
<string name="sim_calls_ask_first_prefs_title" msgid="7941299533514115976">"その都度確認"</string>
<string name="sim_selection_required_pref" msgid="3446721423206414652">"選択してください"</string>
+ <!-- no translation found for sim_selection_channel_title (2760909074892782589) -->
+ <skip />
<string name="dashboard_title" msgid="5453710313046681820">"設定"</string>
<plurals name="settings_suggestion_header_summary_hidden_items" formatted="false" msgid="5597356221942118048">
<item quantity="other">%d 件の非表示のアイテムを表示</item>
@@ -2808,7 +2814,14 @@
<string name="keywords_payment_settings" msgid="5220104934130446416">"支払い, タップ, ペイメント"</string>
<string name="keywords_backup" msgid="470070289135403022">"バックアップ, バック アップ"</string>
<string name="keywords_assist_gesture_launch" msgid="813968759791342591">"操作"</string>
- <string name="keywords_imei_info" msgid="5244879602514442076">"imei, meid"</string>
+ <!-- no translation found for keywords_imei_info (7230982940217544527) -->
+ <skip />
+ <!-- no translation found for keywords_sim_status (1474422416860990564) -->
+ <skip />
+ <!-- no translation found for keywords_model_and_hardware (1459248377212829642) -->
+ <skip />
+ <!-- no translation found for keywords_android_version (5591055570309015111) -->
+ <skip />
<string name="setup_wifi_nfc_tag" msgid="9028353016222911016">"Wi-Fi NFCタグのセットアップ"</string>
<string name="write_tag" msgid="8571858602896222537">"書き込む"</string>
<string name="status_awaiting_tap" msgid="2130145523773160617">"書き込むにはタグをタップしてください..."</string>
@@ -2869,6 +2882,20 @@
<string name="zen_mode_visual_interruptions_settings_title" msgid="6751708745442997940">"視覚的な通知のブロック"</string>
<string name="zen_mode_visual_signals_settings_subtitle" msgid="6308824824208120508">"視覚的な割り込みを許可"</string>
<string name="zen_mode_add" msgid="90014394953272517">"追加"</string>
+ <!-- no translation found for zen_mode_button_turn_on (5074744714613374902) -->
+ <skip />
+ <!-- no translation found for zen_mode_button_turn_off (1995551537320422792) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_end_time_next_day (3090599225533484203) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_indefinite (2746903915016850399) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule (3856133183910726786) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_app (7112871101701453067) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_multiple (5792308957602984360) -->
+ <skip />
<string name="sound_work_settings" msgid="6774324553228566442">"仕事用プロファイルの音"</string>
<string name="work_use_personal_sounds_title" msgid="1148331221338458874">"個人用プロファイルの音の使用"</string>
<string name="work_use_personal_sounds_summary" msgid="6207040454949823153">"仕事用プロファイルと個人用プロファイルの音は同じです"</string>
diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml
index c3a040a..c96fe1c 100644
--- a/res/values-ko/strings.xml
+++ b/res/values-ko/strings.xml
@@ -1147,17 +1147,21 @@
<string name="storage_settings_title" msgid="8746016738388094064">"저장소 설정"</string>
<string name="storage_settings_summary" product="nosdcard" msgid="3543813623294870759">"USB 저장소를 마운트 해제하고 사용 가능한 저장공간을 봅니다."</string>
<string name="storage_settings_summary" product="default" msgid="9176693537325988610">"SD 카드 마운트 해제, 사용 가능한 저장공간 보기"</string>
- <string name="imei_multi_sim_slot_1" msgid="8062257124383430433">"IMEI(SIM 슬롯 1)"</string>
- <string name="imei_multi_sim_slot_2" msgid="7008494345236276520">"IMEI(SIM 슬롯 2)"</string>
+ <!-- no translation found for imei_multi_sim (6387012961838800539) -->
+ <skip />
<string name="status_number" product="tablet" msgid="1138837891091222272">"MDN"</string>
<string name="status_number" product="default" msgid="5948892105546651296">"전화번호"</string>
+ <!-- no translation found for status_number_sim_slot (2755592991367858860) -->
+ <skip />
+ <!-- no translation found for status_number_sim_slot (1898212200138025729) -->
+ <skip />
<string name="status_number_sim_status" product="tablet" msgid="1367110147304523864">"SIM의 MDN"</string>
<string name="status_number_sim_status" product="default" msgid="9123351360569466330">"SIM의 전화번호"</string>
<string name="status_min_number" msgid="3519504522179420597">"MIN"</string>
<string name="status_msid_number" msgid="909010114445780530">"MSID"</string>
<string name="status_prl_version" msgid="1007470446618081441">"PRL 버전"</string>
- <string name="meid_multi_sim_sim_slot_1" msgid="6104414476212608482">"MEID(SIM 슬롯 1)"</string>
- <string name="meid_multi_sim_sim_slot_2" msgid="6405908831055261637">"MEID(SIM 슬롯 2)"</string>
+ <!-- no translation found for meid_multi_sim (748999971744491771) -->
+ <skip />
<string name="status_meid_number" msgid="1751442889111731088">"MEID"</string>
<string name="status_icc_id" msgid="943368755577172747">"ICCID"</string>
<string name="status_network_type" msgid="3279383550222116235">"모바일 네트워크 유형"</string>
@@ -2723,8 +2727,8 @@
<string name="color_purple" msgid="3888532466427762504">"보라색"</string>
<string name="sim_no_inserted_msg" msgid="210316755353227087">"SIM 카드가 장착되지 않음"</string>
<string name="sim_status_title" msgid="6744870675182447160">"SIM 상태"</string>
- <string name="sim_status_title_sim_slot_1" msgid="4055743730444965036">"SIM 상태(SIM 슬롯 1)"</string>
- <string name="sim_status_title_sim_slot_2" msgid="6795077269765759628">"SIM 상태(SIM 슬롯 2)"</string>
+ <!-- no translation found for sim_status_title_sim_slot (5725659316463979194) -->
+ <skip />
<string name="sim_call_back_title" msgid="5181549885999280334">"기본 SIM에서 다시 전화하기"</string>
<string name="sim_outgoing_call_title" msgid="1019763076116874255">"발신 전화용 SIM"</string>
<string name="sim_other_call_settings" msgid="8247802316114482477">"기타 통화 설정"</string>
@@ -2738,6 +2742,8 @@
<string name="sim_pref_divider" msgid="6778907671867621874">"다음 작업에 대하여 선호하는 SIM"</string>
<string name="sim_calls_ask_first_prefs_title" msgid="7941299533514115976">"항상 확인"</string>
<string name="sim_selection_required_pref" msgid="3446721423206414652">"선택 필요"</string>
+ <!-- no translation found for sim_selection_channel_title (2760909074892782589) -->
+ <skip />
<string name="dashboard_title" msgid="5453710313046681820">"설정"</string>
<plurals name="settings_suggestion_header_summary_hidden_items" formatted="false" msgid="5597356221942118048">
<item quantity="other">%d개의 숨겨진 항목 표시</item>
@@ -2804,7 +2810,14 @@
<string name="keywords_payment_settings" msgid="5220104934130446416">"결제, 탭, 결제"</string>
<string name="keywords_backup" msgid="470070289135403022">"백업, 백 업"</string>
<string name="keywords_assist_gesture_launch" msgid="813968759791342591">"동작"</string>
- <string name="keywords_imei_info" msgid="5244879602514442076">"IMEI, MEID"</string>
+ <!-- no translation found for keywords_imei_info (7230982940217544527) -->
+ <skip />
+ <!-- no translation found for keywords_sim_status (1474422416860990564) -->
+ <skip />
+ <!-- no translation found for keywords_model_and_hardware (1459248377212829642) -->
+ <skip />
+ <!-- no translation found for keywords_android_version (5591055570309015111) -->
+ <skip />
<string name="setup_wifi_nfc_tag" msgid="9028353016222911016">"Wi-Fi NFC 태그 설정"</string>
<string name="write_tag" msgid="8571858602896222537">"쓰기"</string>
<string name="status_awaiting_tap" msgid="2130145523773160617">"태그를 탭하여 작성하세요..."</string>
@@ -2865,6 +2878,20 @@
<string name="zen_mode_visual_interruptions_settings_title" msgid="6751708745442997940">"시각적 방해 차단"</string>
<string name="zen_mode_visual_signals_settings_subtitle" msgid="6308824824208120508">"시각적 신호 허용"</string>
<string name="zen_mode_add" msgid="90014394953272517">"추가"</string>
+ <!-- no translation found for zen_mode_button_turn_on (5074744714613374902) -->
+ <skip />
+ <!-- no translation found for zen_mode_button_turn_off (1995551537320422792) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_end_time_next_day (3090599225533484203) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_indefinite (2746903915016850399) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule (3856133183910726786) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_app (7112871101701453067) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_multiple (5792308957602984360) -->
+ <skip />
<string name="sound_work_settings" msgid="6774324553228566442">"직장 프로필 사운드"</string>
<string name="work_use_personal_sounds_title" msgid="1148331221338458874">"개인 프로필 사운드 사용"</string>
<string name="work_use_personal_sounds_summary" msgid="6207040454949823153">"직장 프로필과 개인 프로필의 소리가 같습니다."</string>
diff --git a/res/values-sw/strings.xml b/res/values-sw/strings.xml
index 9903a85..dc86aa0 100644
--- a/res/values-sw/strings.xml
+++ b/res/values-sw/strings.xml
@@ -1147,17 +1147,21 @@
<string name="storage_settings_title" msgid="8746016738388094064">"Hifadhi mipangilio"</string>
<string name="storage_settings_summary" product="nosdcard" msgid="3543813623294870759">"Ondoa hifadhi ya USB, angalia hifadhi inayopatikana"</string>
<string name="storage_settings_summary" product="default" msgid="9176693537325988610">"Ondoa SIM kadi, angalia hifadhi iliyopo"</string>
- <string name="imei_multi_sim_slot_1" msgid="8062257124383430433">"IMEI (Sehemu ya sim 1)"</string>
- <string name="imei_multi_sim_slot_2" msgid="7008494345236276520">"IMEI (sehemu ya sim 2)"</string>
+ <!-- no translation found for imei_multi_sim (6387012961838800539) -->
+ <skip />
<string name="status_number" product="tablet" msgid="1138837891091222272">"MDN"</string>
<string name="status_number" product="default" msgid="5948892105546651296">"Nambari ya simu"</string>
+ <!-- no translation found for status_number_sim_slot (2755592991367858860) -->
+ <skip />
+ <!-- no translation found for status_number_sim_slot (1898212200138025729) -->
+ <skip />
<string name="status_number_sim_status" product="tablet" msgid="1367110147304523864">"MDN kwenye SIM"</string>
<string name="status_number_sim_status" product="default" msgid="9123351360569466330">"Nambari ya simu kwenye SIM"</string>
<string name="status_min_number" msgid="3519504522179420597">"NDOGO"</string>
<string name="status_msid_number" msgid="909010114445780530">"MSID"</string>
<string name="status_prl_version" msgid="1007470446618081441">"Toleo la PRL"</string>
- <string name="meid_multi_sim_sim_slot_1" msgid="6104414476212608482">"MEID (sehemu ya sim 1)"</string>
- <string name="meid_multi_sim_sim_slot_2" msgid="6405908831055261637">"MEID (sehemu ya sim 2)"</string>
+ <!-- no translation found for meid_multi_sim (748999971744491771) -->
+ <skip />
<string name="status_meid_number" msgid="1751442889111731088">"MEID"</string>
<string name="status_icc_id" msgid="943368755577172747">"ICCID"</string>
<string name="status_network_type" msgid="3279383550222116235">"Aina ya mtandao wa simu ya mkononi"</string>
@@ -2723,8 +2727,8 @@
<string name="color_purple" msgid="3888532466427762504">"Zambarau"</string>
<string name="sim_no_inserted_msg" msgid="210316755353227087">"Hakuna SIM kadi zilizoingizwa"</string>
<string name="sim_status_title" msgid="6744870675182447160">"Hali ya SIM"</string>
- <string name="sim_status_title_sim_slot_1" msgid="4055743730444965036">"Hali ya SIM (sehemu ya sim 1)"</string>
- <string name="sim_status_title_sim_slot_2" msgid="6795077269765759628">"Hali ya SIM (sehemu ya sim 2)"</string>
+ <!-- no translation found for sim_status_title_sim_slot (5725659316463979194) -->
+ <skip />
<string name="sim_call_back_title" msgid="5181549885999280334">"Piga simu kwa kutumia SIM kadi chaguo-msingi"</string>
<string name="sim_outgoing_call_title" msgid="1019763076116874255">"SIM ya kutumia kupiga simu"</string>
<string name="sim_other_call_settings" msgid="8247802316114482477">"Mipangilio mingine ya simu"</string>
@@ -2738,6 +2742,8 @@
<string name="sim_pref_divider" msgid="6778907671867621874">"SIM inayopendelewa kwa"</string>
<string name="sim_calls_ask_first_prefs_title" msgid="7941299533514115976">"Uliza kila wakati"</string>
<string name="sim_selection_required_pref" msgid="3446721423206414652">"Uteuzi unahitajika"</string>
+ <!-- no translation found for sim_selection_channel_title (2760909074892782589) -->
+ <skip />
<string name="dashboard_title" msgid="5453710313046681820">"Mipangilio"</string>
<plurals name="settings_suggestion_header_summary_hidden_items" formatted="false" msgid="5597356221942118048">
<item quantity="other">Onyesha vipengee %d vilivyofichwa</item>
@@ -2804,7 +2810,14 @@
<string name="keywords_payment_settings" msgid="5220104934130446416">"lipa, gusa, malipo"</string>
<string name="keywords_backup" msgid="470070289135403022">"hifadhi rudufu, hifadhi nakala"</string>
<string name="keywords_assist_gesture_launch" msgid="813968759791342591">"ishara"</string>
- <string name="keywords_imei_info" msgid="5244879602514442076">"imei, meid"</string>
+ <!-- no translation found for keywords_imei_info (7230982940217544527) -->
+ <skip />
+ <!-- no translation found for keywords_sim_status (1474422416860990564) -->
+ <skip />
+ <!-- no translation found for keywords_model_and_hardware (1459248377212829642) -->
+ <skip />
+ <!-- no translation found for keywords_android_version (5591055570309015111) -->
+ <skip />
<string name="setup_wifi_nfc_tag" msgid="9028353016222911016">"Sanidi tagi ya NFC ya Wi-Fi"</string>
<string name="write_tag" msgid="8571858602896222537">"Andika"</string>
<string name="status_awaiting_tap" msgid="2130145523773160617">"Gusa tagi ya NFC ili uandike..."</string>
@@ -2865,6 +2878,20 @@
<string name="zen_mode_visual_interruptions_settings_title" msgid="6751708745442997940">"Zuia ukatizaji wa maonyesho"</string>
<string name="zen_mode_visual_signals_settings_subtitle" msgid="6308824824208120508">"Ruhusu ishara zinazoonekena"</string>
<string name="zen_mode_add" msgid="90014394953272517">"Ongeza"</string>
+ <!-- no translation found for zen_mode_button_turn_on (5074744714613374902) -->
+ <skip />
+ <!-- no translation found for zen_mode_button_turn_off (1995551537320422792) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_end_time_next_day (3090599225533484203) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_indefinite (2746903915016850399) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule (3856133183910726786) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_app (7112871101701453067) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_multiple (5792308957602984360) -->
+ <skip />
<string name="sound_work_settings" msgid="6774324553228566442">"Sauti za wasifu wa kazi"</string>
<string name="work_use_personal_sounds_title" msgid="1148331221338458874">"Tumia sauti za wasifu wako binafsi"</string>
<string name="work_use_personal_sounds_summary" msgid="6207040454949823153">"Sauti za wasifu wa binafsi na wa kazini ni sawa"</string>
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index 4d30969..1f78abd 100755
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -60,6 +60,7 @@
<dimen name="switchbar_subsettings_margin_end">24dp</dimen>
<dimen name="search_bar_height">64dp</dimen>
+ <dimen name="search_bar_half_height">32dp</dimen>
<!-- Dimensions for Wifi Assistant Card -->
<dimen name="wifi_assistant_padding_top_bottom">24dp</dimen>
diff --git a/res/values-th/strings.xml b/res/values-th/strings.xml
index 504f6da..5d110af 100644
--- a/res/values-th/strings.xml
+++ b/res/values-th/strings.xml
@@ -1147,17 +1147,21 @@
<string name="storage_settings_title" msgid="8746016738388094064">"การตั้งค่าที่เก็บข้อมูล"</string>
<string name="storage_settings_summary" product="nosdcard" msgid="3543813623294870759">"ยกเลิกการต่อเชื่อมที่เก็บข้อมูล USB ดูที่เก็บข้อมูลที่ใช้งานได้"</string>
<string name="storage_settings_summary" product="default" msgid="9176693537325988610">"ยกเลิกการต่อเชื่อมการ์ด SD ดูที่จัดเก็บข้อมูลที่ใช้ได้"</string>
- <string name="imei_multi_sim_slot_1" msgid="8062257124383430433">"IMEI (ช่องซิม 1)"</string>
- <string name="imei_multi_sim_slot_2" msgid="7008494345236276520">"IMEI (ช่องซิม 2)"</string>
+ <!-- no translation found for imei_multi_sim (6387012961838800539) -->
+ <skip />
<string name="status_number" product="tablet" msgid="1138837891091222272">"MDN"</string>
<string name="status_number" product="default" msgid="5948892105546651296">"หมายเลขโทรศัพท์"</string>
+ <!-- no translation found for status_number_sim_slot (2755592991367858860) -->
+ <skip />
+ <!-- no translation found for status_number_sim_slot (1898212200138025729) -->
+ <skip />
<string name="status_number_sim_status" product="tablet" msgid="1367110147304523864">"MDN ในซิม"</string>
<string name="status_number_sim_status" product="default" msgid="9123351360569466330">"หมายเลขโทรศัพท์ในซิม"</string>
<string name="status_min_number" msgid="3519504522179420597">"นาที"</string>
<string name="status_msid_number" msgid="909010114445780530">"MSID"</string>
<string name="status_prl_version" msgid="1007470446618081441">"รุ่น PRL"</string>
- <string name="meid_multi_sim_sim_slot_1" msgid="6104414476212608482">"MEID (ช่องซิม 1)"</string>
- <string name="meid_multi_sim_sim_slot_2" msgid="6405908831055261637">"MEID (ช่องซิม 2)"</string>
+ <!-- no translation found for meid_multi_sim (748999971744491771) -->
+ <skip />
<string name="status_meid_number" msgid="1751442889111731088">"MEID"</string>
<string name="status_icc_id" msgid="943368755577172747">"ICCID"</string>
<string name="status_network_type" msgid="3279383550222116235">"ประเภทเครือข่ายมือถือ"</string>
@@ -2723,8 +2727,8 @@
<string name="color_purple" msgid="3888532466427762504">"ม่วง"</string>
<string name="sim_no_inserted_msg" msgid="210316755353227087">"ไม่ได้เสียบซิมการ์ด"</string>
<string name="sim_status_title" msgid="6744870675182447160">"สถานะซิม"</string>
- <string name="sim_status_title_sim_slot_1" msgid="4055743730444965036">"สถานะซิม (ช่องซิม 1)"</string>
- <string name="sim_status_title_sim_slot_2" msgid="6795077269765759628">"สถานะซิม (ช่องซิม 2)"</string>
+ <!-- no translation found for sim_status_title_sim_slot (5725659316463979194) -->
+ <skip />
<string name="sim_call_back_title" msgid="5181549885999280334">"โทรกลับจากซิมเริ่มต้น"</string>
<string name="sim_outgoing_call_title" msgid="1019763076116874255">"ซิมสำหรับการโทรออก"</string>
<string name="sim_other_call_settings" msgid="8247802316114482477">"การตั้งค่าการโทรอื่นๆ"</string>
@@ -2738,6 +2742,8 @@
<string name="sim_pref_divider" msgid="6778907671867621874">"ซิมที่แนะนำสำหรับ"</string>
<string name="sim_calls_ask_first_prefs_title" msgid="7941299533514115976">"ถามทุกครั้ง"</string>
<string name="sim_selection_required_pref" msgid="3446721423206414652">"ต้องเลือก"</string>
+ <!-- no translation found for sim_selection_channel_title (2760909074892782589) -->
+ <skip />
<string name="dashboard_title" msgid="5453710313046681820">"การตั้งค่า"</string>
<plurals name="settings_suggestion_header_summary_hidden_items" formatted="false" msgid="5597356221942118048">
<item quantity="other">แสดงรายการที่ซ่อน %d รายการ</item>
@@ -2804,7 +2810,14 @@
<string name="keywords_payment_settings" msgid="5220104934130446416">"ชำระเงิน แตะ การชำระเงิน"</string>
<string name="keywords_backup" msgid="470070289135403022">"ข้อมูลสำรอง, สำรองข้อมูล"</string>
<string name="keywords_assist_gesture_launch" msgid="813968759791342591">"ท่าทางสัมผัส"</string>
- <string name="keywords_imei_info" msgid="5244879602514442076">"IMEI, MEID"</string>
+ <!-- no translation found for keywords_imei_info (7230982940217544527) -->
+ <skip />
+ <!-- no translation found for keywords_sim_status (1474422416860990564) -->
+ <skip />
+ <!-- no translation found for keywords_model_and_hardware (1459248377212829642) -->
+ <skip />
+ <!-- no translation found for keywords_android_version (5591055570309015111) -->
+ <skip />
<string name="setup_wifi_nfc_tag" msgid="9028353016222911016">"ตั้งค่าแท็ก NFC สำหรับ Wi-Fi"</string>
<string name="write_tag" msgid="8571858602896222537">"เขียน"</string>
<string name="status_awaiting_tap" msgid="2130145523773160617">"แตะแท็กเพื่อเขียน..."</string>
@@ -2865,6 +2878,20 @@
<string name="zen_mode_visual_interruptions_settings_title" msgid="6751708745442997940">"บล็อกสิ่งรบกวนการมองเห็น"</string>
<string name="zen_mode_visual_signals_settings_subtitle" msgid="6308824824208120508">"อนุญาตสัญญาณที่มองเห็น"</string>
<string name="zen_mode_add" msgid="90014394953272517">"เพิ่ม"</string>
+ <!-- no translation found for zen_mode_button_turn_on (5074744714613374902) -->
+ <skip />
+ <!-- no translation found for zen_mode_button_turn_off (1995551537320422792) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_end_time_next_day (3090599225533484203) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_indefinite (2746903915016850399) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule (3856133183910726786) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_app (7112871101701453067) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_multiple (5792308957602984360) -->
+ <skip />
<string name="sound_work_settings" msgid="6774324553228566442">"เสียงในโปรไฟล์งาน"</string>
<string name="work_use_personal_sounds_title" msgid="1148331221338458874">"ใช้เสียงในโปรไฟล์ส่วนตัว"</string>
<string name="work_use_personal_sounds_summary" msgid="6207040454949823153">"เสียงในโปรไฟล์งานและโปรไฟล์ส่วนตัวเหมือนกัน"</string>
diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml
index 5129033..f586a1d 100644
--- a/res/values-zh-rTW/strings.xml
+++ b/res/values-zh-rTW/strings.xml
@@ -1147,17 +1147,21 @@
<string name="storage_settings_title" msgid="8746016738388094064">"儲存設定"</string>
<string name="storage_settings_summary" product="nosdcard" msgid="3543813623294870759">"卸載 USB 儲存裝置、查看可用的儲存空間"</string>
<string name="storage_settings_summary" product="default" msgid="9176693537325988610">"卸載 SD 卡,檢視可用儲存媒體。"</string>
- <string name="imei_multi_sim_slot_1" msgid="8062257124383430433">"IMEI (SIM 卡插槽 1)"</string>
- <string name="imei_multi_sim_slot_2" msgid="7008494345236276520">"IMEI (SIM 卡插槽 2)"</string>
+ <!-- no translation found for imei_multi_sim (6387012961838800539) -->
+ <skip />
<string name="status_number" product="tablet" msgid="1138837891091222272">"MDN"</string>
<string name="status_number" product="default" msgid="5948892105546651296">"電話號碼"</string>
+ <!-- no translation found for status_number_sim_slot (2755592991367858860) -->
+ <skip />
+ <!-- no translation found for status_number_sim_slot (1898212200138025729) -->
+ <skip />
<string name="status_number_sim_status" product="tablet" msgid="1367110147304523864">"SIM 卡上的 MDN"</string>
<string name="status_number_sim_status" product="default" msgid="9123351360569466330">"SIM 卡上的電話號碼"</string>
<string name="status_min_number" msgid="3519504522179420597">"MIN"</string>
<string name="status_msid_number" msgid="909010114445780530">"MSID"</string>
<string name="status_prl_version" msgid="1007470446618081441">"PRL 版本"</string>
- <string name="meid_multi_sim_sim_slot_1" msgid="6104414476212608482">"MEID (SIM 卡插槽 1)"</string>
- <string name="meid_multi_sim_sim_slot_2" msgid="6405908831055261637">"MEID (SIM 卡插槽 2)"</string>
+ <!-- no translation found for meid_multi_sim (748999971744491771) -->
+ <skip />
<string name="status_meid_number" msgid="1751442889111731088">"MEID"</string>
<string name="status_icc_id" msgid="943368755577172747">"ICCID"</string>
<string name="status_network_type" msgid="3279383550222116235">"行動網路類型"</string>
@@ -2727,8 +2731,8 @@
<string name="color_purple" msgid="3888532466427762504">"紫色"</string>
<string name="sim_no_inserted_msg" msgid="210316755353227087">"尚未插入 SIM 卡"</string>
<string name="sim_status_title" msgid="6744870675182447160">"SIM 卡狀態"</string>
- <string name="sim_status_title_sim_slot_1" msgid="4055743730444965036">"SIM 卡狀態 (SIM 卡插槽 1)"</string>
- <string name="sim_status_title_sim_slot_2" msgid="6795077269765759628">"SIM 卡狀態 (SIM 卡插槽 2)"</string>
+ <!-- no translation found for sim_status_title_sim_slot (5725659316463979194) -->
+ <skip />
<string name="sim_call_back_title" msgid="5181549885999280334">"使用預設 SIM 卡回撥"</string>
<string name="sim_outgoing_call_title" msgid="1019763076116874255">"用於撥出電話的 SIM 卡"</string>
<string name="sim_other_call_settings" msgid="8247802316114482477">"其他通話設定"</string>
@@ -2742,6 +2746,8 @@
<string name="sim_pref_divider" msgid="6778907671867621874">"適用於以下用途的偏好 SIM 卡"</string>
<string name="sim_calls_ask_first_prefs_title" msgid="7941299533514115976">"每次都詢問"</string>
<string name="sim_selection_required_pref" msgid="3446721423206414652">"請選取偏好設定"</string>
+ <!-- no translation found for sim_selection_channel_title (2760909074892782589) -->
+ <skip />
<string name="dashboard_title" msgid="5453710313046681820">"設定"</string>
<plurals name="settings_suggestion_header_summary_hidden_items" formatted="false" msgid="5597356221942118048">
<item quantity="other">顯示 %d 個隱藏項目</item>
@@ -2808,7 +2814,14 @@
<string name="keywords_payment_settings" msgid="5220104934130446416">"支付、輕觸、付款"</string>
<string name="keywords_backup" msgid="470070289135403022">"備份內容, 備份"</string>
<string name="keywords_assist_gesture_launch" msgid="813968759791342591">"手勢"</string>
- <string name="keywords_imei_info" msgid="5244879602514442076">"IMEI、MEID"</string>
+ <!-- no translation found for keywords_imei_info (7230982940217544527) -->
+ <skip />
+ <!-- no translation found for keywords_sim_status (1474422416860990564) -->
+ <skip />
+ <!-- no translation found for keywords_model_and_hardware (1459248377212829642) -->
+ <skip />
+ <!-- no translation found for keywords_android_version (5591055570309015111) -->
+ <skip />
<string name="setup_wifi_nfc_tag" msgid="9028353016222911016">"設定 Wi-Fi NFC 標記"</string>
<string name="write_tag" msgid="8571858602896222537">"寫入"</string>
<string name="status_awaiting_tap" msgid="2130145523773160617">"輕觸標記即可寫入..."</string>
@@ -2869,6 +2882,20 @@
<string name="zen_mode_visual_interruptions_settings_title" msgid="6751708745442997940">"封鎖視覺干擾"</string>
<string name="zen_mode_visual_signals_settings_subtitle" msgid="6308824824208120508">"允許視覺信號"</string>
<string name="zen_mode_add" msgid="90014394953272517">"新增"</string>
+ <!-- no translation found for zen_mode_button_turn_on (5074744714613374902) -->
+ <skip />
+ <!-- no translation found for zen_mode_button_turn_off (1995551537320422792) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_end_time_next_day (3090599225533484203) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_manual_indefinite (2746903915016850399) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule (3856133183910726786) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_app (7112871101701453067) -->
+ <skip />
+ <!-- no translation found for zen_mode_settings_dnd_automatic_rule_multiple (5792308957602984360) -->
+ <skip />
<string name="sound_work_settings" msgid="6774324553228566442">"Work 設定檔音效"</string>
<string name="work_use_personal_sounds_title" msgid="1148331221338458874">"使用個人設定檔音效"</string>
<string name="work_use_personal_sounds_summary" msgid="6207040454949823153">"Work 設定檔和個人設定檔使用相同的音效"</string>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 0d4289a..2f00297 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -121,6 +121,7 @@
<dimen name="search_bar_negative_margin">-8dp</dimen>
<dimen name="search_bar_height">48dp</dimen>
+ <dimen name="search_bar_half_height">24dp</dimen>
<dimen name="search_bar_text_size">16dp</dimen>
<!-- Dimensions for Wifi Assistant Card -->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 43827e3..3fb50e5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -394,6 +394,11 @@
<!-- Title for pairing bluetooth device page [CHAR LIMIT=none] -->
<string name="bluetooth_pairing_page_title">Pair new device</string>
+ <!-- Title for connected device group [CHAR LIMIT=none]-->
+ <string name="connected_device_connected_title">Currently connected</string>
+ <!-- Title for connected device group [CHAR LIMIT=none]-->
+ <string name="connected_device_saved_title">Saved devices</string>
+
<!-- Date & time settings screen title -->
<string name="date_and_time">Date & time</string>
<!-- The title of the activity to pick a time zone. -->
@@ -2671,13 +2676,13 @@
<string name="status_imei_sv">IMEI SV</string>
<!-- Do not translate. About phone, status item title -->
<string name="status_iccid">ICCID</string>
- <!-- About tablet, status item title. The Mobile Directory Number [CHAR LIMIT=30] -->
+ <!-- About tablet, status item title. The Mobile Directory Number [CHAR LIMIT=40] -->
<string name="status_number" product="tablet">MDN</string>
- <!-- About phone, status item title. The phone number of the current device [CHAR LIMIT=30] -->
+ <!-- About phone, status item title. The phone number of the current device [CHAR LIMIT=40] -->
<string name="status_number" product="default">Phone number</string>
- <!-- About tablet, status item title for multi-sim devices. The Mobile Directory Number [CHAR LIMIT=30] -->
+ <!-- About tablet, status item title for multi-sim devices. The Mobile Directory Number [CHAR LIMIT=40] -->
<string name="status_number_sim_slot" product="tablet">MDN (sim slot %1$d)</string>
- <!-- About phone, status item title for multi-sim devices. The phone number of the current device [CHAR LIMIT=30] -->
+ <!-- About phone, status item title for multi-sim devices. The phone number of the current device [CHAR LIMIT=40] -->
<string name="status_number_sim_slot" product="default">Phone number (sim slot %1$d)</string>
<!-- About tablet, status item title. The Mobile Directory Number [CHAR LIMIT=30] -->
<string name="status_number_sim_status" product="tablet">MDN on SIM</string>
@@ -4970,7 +4975,7 @@
<string name="process_dex2oat_label">App optimization</string>
<!-- [CHAR_LIMIT=40] Battery saver: Label for feature, title + menu item -->
- <string name="battery_saver">Battery saver</string>
+ <string name="battery_saver">Battery Saver</string>
<!-- [CHAR_LIMIT=40] Battery saver: Title for automatic entry option -->
<string name="battery_saver_turn_on_automatically_title">Turn on automatically</string>
@@ -6578,7 +6583,7 @@
<string name="keywords_imei_info">imei, meid, min, prl version, imei sv</string>
<string name="keywords_sim_status">network, mobile network state, service state, signal strength, mobile network type, roaming, iccid</string>
<string name="keywords_model_and_hardware">serial number, hardware version</string>
- <string name="keywords_android_version">android security patch level, baseband version, kernel version, </string>
+ <string name="keywords_android_version">android security patch level, baseband version, kernel version</string>
<!-- NFC Wi-Fi pairing/setup strings-->
diff --git a/res/values/styles_preference.xml b/res/values/styles_preference.xml
index 056d55a..b8b9eb3 100644
--- a/res/values/styles_preference.xml
+++ b/res/values/styles_preference.xml
@@ -20,19 +20,19 @@
<resources>
<!-- Fragment style -->
- <style name="SettingsPreferenceFragmentStyle" parent="@style/PreferenceFragmentStyle.SettingsBase">
+ <style name="SettingsPreferenceFragmentStyle" parent="@style/PreferenceFragment.Material">
<item name="android:layout">@layout/preference_list_fragment</item>
</style>
- <style name="ApnPreference" parent="Preference.SettingsBase">
+ <style name="ApnPreference" parent="@style/Preference.Material">
<item name="android:layout">@layout/apn_preference_layout</item>
</style>
- <style name="SettingsSeekBarPreference" parent="Preference.SettingsBase">
+ <style name="SettingsSeekBarPreference" parent="@style/Preference.Material">
<item name="android:layout">@layout/preference_widget_seekbar_settings</item>
</style>
- <style name="SyncSwitchPreference" parent="Preference.SettingsBase">
+ <style name="SyncSwitchPreference" parent="@style/Preference.Material">
<item name="android:widgetLayout">@layout/preference_widget_sync_toggle</item>
</style>
diff --git a/res/xml/connected_devices.xml b/res/xml/connected_devices.xml
index 3eb62ea..d24dd51 100644
--- a/res/xml/connected_devices.xml
+++ b/res/xml/connected_devices.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
+<!-- Copyright (C) 2017 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.
@@ -19,45 +19,7 @@
android:key="connected_devices_screen"
android:title="@string/connected_devices_dashboard_title">
- <com.android.settings.widget.MasterSwitchPreference
- android:key="toggle_bluetooth"
- android:title="@string/bluetooth_settings_title"
- android:icon="@drawable/ic_settings_bluetooth"
- android:order="-7"/>
-
- <SwitchPreference
- android:key="toggle_nfc"
- android:title="@string/nfc_quick_toggle_title"
- android:icon="@drawable/ic_nfc"
- android:summary="@string/nfc_quick_toggle_summary"
- android:order="-5"/>
-
- <com.android.settingslib.RestrictedPreference
- android:fragment="com.android.settings.nfc.AndroidBeam"
- android:key="android_beam_settings"
- android:title="@string/android_beam_settings_title"
- android:icon="@drawable/ic_android"
- android:order="-4"/>
-
- <Preference
- android:key="sms_mirroring"
- android:title="@string/sms_mirroring_pref"
- android:icon="@drawable/ic_sms_mirroring_24dp"
- android:summary="@string/summary_placeholder"
- android:order="-3"/>
-
- <Preference
- android:key="usb_mode"
- android:title="@string/usb_pref"
- android:icon="@drawable/ic_usb"
- android:order="-2">
- <intent android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.settings"
- android:targetClass="com.android.settings.deviceinfo.UsbModeChooserActivity"/>
- </Preference>
-
<PreferenceCategory
- android:key="dashboard_tile_placeholder"
- android:order="50"/>
-
+ android:key="connected_device_list"
+ android:title="@string/connected_device_connected_title"/>
</PreferenceScreen>
diff --git a/res/xml/connected_devices_old.xml b/res/xml/connected_devices_old.xml
new file mode 100644
index 0000000..3eb62ea
--- /dev/null
+++ b/res/xml/connected_devices_old.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:key="connected_devices_screen"
+ android:title="@string/connected_devices_dashboard_title">
+
+ <com.android.settings.widget.MasterSwitchPreference
+ android:key="toggle_bluetooth"
+ android:title="@string/bluetooth_settings_title"
+ android:icon="@drawable/ic_settings_bluetooth"
+ android:order="-7"/>
+
+ <SwitchPreference
+ android:key="toggle_nfc"
+ android:title="@string/nfc_quick_toggle_title"
+ android:icon="@drawable/ic_nfc"
+ android:summary="@string/nfc_quick_toggle_summary"
+ android:order="-5"/>
+
+ <com.android.settingslib.RestrictedPreference
+ android:fragment="com.android.settings.nfc.AndroidBeam"
+ android:key="android_beam_settings"
+ android:title="@string/android_beam_settings_title"
+ android:icon="@drawable/ic_android"
+ android:order="-4"/>
+
+ <Preference
+ android:key="sms_mirroring"
+ android:title="@string/sms_mirroring_pref"
+ android:icon="@drawable/ic_sms_mirroring_24dp"
+ android:summary="@string/summary_placeholder"
+ android:order="-3"/>
+
+ <Preference
+ android:key="usb_mode"
+ android:title="@string/usb_pref"
+ android:icon="@drawable/ic_usb"
+ android:order="-2">
+ <intent android:action="android.intent.action.MAIN"
+ android:targetPackage="com.android.settings"
+ android:targetClass="com.android.settings.deviceinfo.UsbModeChooserActivity"/>
+ </Preference>
+
+ <PreferenceCategory
+ android:key="dashboard_tile_placeholder"
+ android:order="50"/>
+
+</PreferenceScreen>
diff --git a/res/xml/date_time_prefs.xml b/res/xml/date_time_prefs.xml
index d74e8c2..5219caa 100644
--- a/res/xml/date_time_prefs.xml
+++ b/res/xml/date_time_prefs.xml
@@ -29,32 +29,37 @@
android:summaryOn="@string/date_time_auto_summaryOn"
android:summaryOff="@string/date_time_auto_summaryOff"
settings:useAdditionalSummary="true"
- settings:restrictedSwitchSummary="@string/enabled_by_admin" />
+ settings:restrictedSwitchSummary="@string/enabled_by_admin"
+ settings:userRestriction="no_config_date_time" />
- <Preference
+ <com.android.settingslib.RestrictedPreference
android:key="date"
android:title="@string/date_time_set_date"
- android:summary="@string/summary_placeholder" />
+ android:summary="@string/summary_placeholder"
+ settings:userRestriction="no_config_date_time" />
- <Preference
+ <com.android.settingslib.RestrictedPreference
android:key="time"
android:title="@string/date_time_set_time"
- android:summary="@string/summary_placeholder" />
+ android:summary="@string/summary_placeholder"
+ settings:userRestriction="no_config_date_time" />
</PreferenceCategory>
<PreferenceCategory
android:key="time_zone_preference_category">
- <SwitchPreference
+ <com.android.settingslib.RestrictedSwitchPreference
android:key="auto_zone"
android:title="@string/zone_auto"
android:summaryOn="@string/zone_auto_summaryOn"
- android:summaryOff="@string/zone_auto_summaryOff" />
+ android:summaryOff="@string/zone_auto_summaryOff"
+ settings:userRestriction="no_config_date_time" />
- <Preference
+ <com.android.settingslib.RestrictedPreference
android:fragment="com.android.settings.datetime.ZonePicker"
android:key="timezone"
android:title="@string/date_time_set_timezone"
- android:summary="GMT-8:00" />
+ android:summary="GMT-8:00"
+ settings:userRestriction="no_config_date_time" />
</PreferenceCategory>
<PreferenceCategory
diff --git a/src/com/android/settings/CredentialStorage.java b/src/com/android/settings/CredentialStorage.java
index e5d40b7..ffbd2ce 100644
--- a/src/com/android/settings/CredentialStorage.java
+++ b/src/com/android/settings/CredentialStorage.java
@@ -275,6 +275,16 @@
Log.e(TAG, "Failed to install " + key + " as uid " + uid);
return;
}
+ // The key was prepended USER_PRIVATE_KEY by the CredentialHelper. However,
+ // KeyChain internally uses the raw alias name and only prepends USER_PRIVATE_KEY
+ // to the key name when interfacing with KeyStore.
+ // This is generally a symptom of CredentialStorage and CredentialHelper relying
+ // on internal implementation details of KeyChain and imitating its functionality
+ // rather than delegating to KeyChain for the certificate installation.
+ if (uid == Process.SYSTEM_UID || uid == KeyStore.UID_SELF) {
+ new MarkKeyAsUserSelectable(
+ key.replaceFirst("^" + Credentials.USER_PRIVATE_KEY, "")).execute();
+ }
}
int flags = KeyStore.FLAG_NONE;
@@ -391,6 +401,33 @@
}
/**
+ * Background task to mark a given key alias as user-selectable, so that
+ * it can be selected by users from the Certificate Selection prompt.
+ */
+ private class MarkKeyAsUserSelectable extends AsyncTask<Void, Void, Boolean> {
+ final String mAlias;
+
+ public MarkKeyAsUserSelectable(String alias) {
+ mAlias = alias;
+ }
+
+ @Override
+ protected Boolean doInBackground(Void... unused) {
+ try (KeyChainConnection keyChainConnection = KeyChain.bind(CredentialStorage.this)) {
+ keyChainConnection.getService().setUserSelectable(mAlias, true);
+ return true;
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed to mark key " + mAlias + " as user-selectable.");
+ return false;
+ } catch (InterruptedException e) {
+ Log.w(TAG, "Failed to mark key " + mAlias + " as user-selectable.");
+ Thread.currentThread().interrupt();
+ return false;
+ }
+ }
+ }
+
+ /**
* Check that the caller is either certinstaller or Settings running in a profile of this user.
*/
private boolean checkCallerIsCertInstallerOrSelfInProfile() {
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 54bdc77..da35c4b 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -16,7 +16,10 @@
package com.android.settings;
+import static com.android.settings.core.FeatureFlags.CONNECTED_DEVICE_V2;
+
import android.os.Bundle;
+import android.util.FeatureFlagUtils;
import com.android.settings.enterprise.EnterprisePrivacySettings;
@@ -165,7 +168,12 @@
// Top level categories for new IA
public static class NetworkDashboardActivity extends SettingsActivity {}
- public static class ConnectedDeviceDashboardActivity extends SettingsActivity {}
+ public static class ConnectedDeviceDashboardActivity extends SettingsActivity {
+ public static final boolean isEnabled() {
+ return FeatureFlagUtils.isEnabled(null /* context */, CONNECTED_DEVICE_V2);
+ }
+ }
+ public static class ConnectedDeviceDashboardActivityOld extends SettingsActivity {}
public static class AppAndNotificationDashboardActivity extends SettingsActivity {}
public static class StorageDashboardActivity extends SettingsActivity {}
public static class UserAndAccountDashboardActivity extends SettingsActivity {}
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 78c9c21..193c2b3 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -789,6 +789,21 @@
Utils.isBandwidthControlEnabled() /* enabled */,
isAdmin) || somethingChanged;
+ final boolean isConnectedDeviceV2Enabled =
+ Settings.ConnectedDeviceDashboardActivity.isEnabled();
+ // Enable new connected page if v2 enabled
+ somethingChanged = setTileEnabled(
+ new ComponentName(packageName,
+ Settings.ConnectedDeviceDashboardActivity.class.getName()),
+ isConnectedDeviceV2Enabled && !UserManager.isDeviceInDemoMode(this) /* enabled */,
+ isAdmin) || somethingChanged;
+ // Enable old connected page if v2 disabled
+ somethingChanged = setTileEnabled(
+ new ComponentName(packageName,
+ Settings.ConnectedDeviceDashboardActivityOld.class.getName()),
+ !isConnectedDeviceV2Enabled && !UserManager.isDeviceInDemoMode(this) /* enabled */,
+ isAdmin) || somethingChanged;
+
somethingChanged = setTileEnabled(new ComponentName(packageName,
Settings.SimSettingsActivity.class.getName()),
Utils.showSimCardTile(this), isAdmin)
@@ -810,11 +825,6 @@
|| somethingChanged;
somethingChanged = setTileEnabled(new ComponentName(packageName,
- Settings.ConnectedDeviceDashboardActivity.class.getName()),
- !UserManager.isDeviceInDemoMode(this), isAdmin)
- || somethingChanged;
-
- somethingChanged = setTileEnabled(new ComponentName(packageName,
Settings.DateTimeSettingsActivity.class.getName()),
!UserManager.isDeviceInDemoMode(this), isAdmin)
|| somethingChanged;
@@ -825,7 +835,8 @@
|| somethingChanged;
final boolean showDev = DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(this)
- && !um.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES);
+ && !um.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)
+ && !Utils.isMonkeyRunning();
somethingChanged = setTileEnabled(new ComponentName(packageName,
Settings.DevelopmentSettingsDashboardActivity.class.getName()),
diff --git a/src/com/android/settings/SettingsSliceProvider.java b/src/com/android/settings/SettingsSliceProvider.java
new file mode 100644
index 0000000..845dacd
--- /dev/null
+++ b/src/com/android/settings/SettingsSliceProvider.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2017 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;
+
+import android.app.PendingIntent;
+import android.app.slice.Slice;
+import android.app.slice.SliceProvider;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.drawable.Icon;
+import android.net.Uri;
+import android.net.wifi.WifiInfo;
+import android.net.wifi.WifiManager;
+
+public class SettingsSliceProvider extends SliceProvider {
+ public static final String SLICE_AUTHORITY = "com.android.settings.slices";
+
+ public static final String PATH_WIFI = "wifi";
+ public static final String ACTION_WIFI_CHANGED =
+ "com.android.settings.slice.action.WIFI_CHANGED";
+ // TODO -- Associate slice URI with search result instead of separate hardcoded thing
+ public static final String[] WIFI_SEARCH_TERMS = {"wi-fi", "wifi", "internet"};
+
+ public static Uri getUri(String path) {
+ return new Uri.Builder()
+ .scheme(ContentResolver.SCHEME_CONTENT)
+ .authority(SLICE_AUTHORITY)
+ .appendPath(path).build();
+ }
+
+ @Override
+ public boolean onCreate() {
+ return true;
+ }
+
+ @Override
+ public Slice onBindSlice(Uri sliceUri) {
+ String path = sliceUri.getPath();
+ switch (path) {
+ case "/" + PATH_WIFI:
+ return createWifi(sliceUri);
+
+ }
+ throw new IllegalArgumentException("Unrecognized slice uri: " + sliceUri);
+ }
+
+ private Slice createWifi(Uri uri) {
+ // Get wifi state
+ String[] toggleHints;
+ WifiManager wifiManager = (WifiManager) getContext().getSystemService(Context.WIFI_SERVICE);
+ int wifiState = wifiManager.getWifiState();
+ boolean wifiEnabled = false;
+ String state;
+ switch (wifiState) {
+ case WifiManager.WIFI_STATE_DISABLED:
+ case WifiManager.WIFI_STATE_DISABLING:
+ state = getContext().getString(R.string.disconnected);
+ break;
+ case WifiManager.WIFI_STATE_ENABLED:
+ case WifiManager.WIFI_STATE_ENABLING:
+ state = wifiManager.getConnectionInfo().getSSID();
+ WifiInfo.removeDoubleQuotes(state);
+ wifiEnabled = true;
+ break;
+ case WifiManager.WIFI_STATE_UNKNOWN:
+ default:
+ state = ""; // just don't show anything?
+ break;
+ }
+ if (wifiEnabled) {
+ toggleHints = new String[] {Slice.HINT_TOGGLE, Slice.HINT_SELECTED};
+ } else {
+ toggleHints = new String[] {Slice.HINT_TOGGLE};
+ }
+ // Construct the slice
+ Slice.Builder b = new Slice.Builder(uri);
+ b.addSubSlice(new Slice.Builder(b)
+ .addAction(getIntent("android.settings.WIFI_SETTINGS"),
+ new Slice.Builder(b)
+ .addText(getContext().getString(R.string.wifi_settings), null)
+ .addText(state, null)
+ .addIcon(Icon.createWithResource(getContext(),
+ R.drawable.ic_settings_wireless), null, Slice.HINT_HIDDEN)
+ .addHints(Slice.HINT_TITLE)
+ .build())
+ .addAction(getBroadcastIntent(ACTION_WIFI_CHANGED),
+ new Slice.Builder(b)
+ .addHints(toggleHints)
+ .build())
+ .build());
+ return b.build();
+ }
+
+ private PendingIntent getIntent(String action) {
+ Intent intent = new Intent(action);
+ PendingIntent pi = PendingIntent.getActivity(getContext(), 0, intent, 0);
+ return pi;
+ }
+
+ private PendingIntent getBroadcastIntent(String action) {
+ Intent intent = new Intent(action);
+ intent.setClass(getContext(), SliceBroadcastReceiver.class);
+ return PendingIntent.getBroadcast(getContext(), 0, intent,
+ PendingIntent.FLAG_CANCEL_CURRENT);
+ }
+}
diff --git a/src/com/android/settings/SliceBroadcastReceiver.java b/src/com/android/settings/SliceBroadcastReceiver.java
new file mode 100644
index 0000000..f43e3a3
--- /dev/null
+++ b/src/com/android/settings/SliceBroadcastReceiver.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2017 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;
+
+import static com.android.settings.SettingsSliceProvider.ACTION_WIFI_CHANGED;
+
+import android.app.slice.Slice;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.net.wifi.WifiManager;
+import android.os.Handler;
+
+/**
+ * Responds to actions performed on slices and notifies slices of updates in state changes.
+ */
+public class SliceBroadcastReceiver extends BroadcastReceiver {
+
+ @Override
+ public void onReceive(Context context, Intent i) {
+ String action = i.getAction();
+ switch (action) {
+ case ACTION_WIFI_CHANGED:
+ WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
+ boolean newState = i.getBooleanExtra(Slice.EXTRA_TOGGLE_STATE, wm.isWifiEnabled());
+ wm.setWifiEnabled(newState);
+ // Wait a bit for wifi to update (TODO: is there a better way to do this?)
+ Handler h = new Handler();
+ h.postDelayed(() -> {
+ Uri uri = SettingsSliceProvider.getUri(SettingsSliceProvider.PATH_WIFI);
+ context.getContentResolver().notifyChange(uri, null);
+ }, 1000);
+ break;
+ }
+ }
+}
diff --git a/src/com/android/settings/applications/AppInfoWithHeader.java b/src/com/android/settings/applications/AppInfoWithHeader.java
index 3df81c7..af0cf5b 100644
--- a/src/com/android/settings/applications/AppInfoWithHeader.java
+++ b/src/com/android/settings/applications/AppInfoWithHeader.java
@@ -16,6 +16,8 @@
package com.android.settings.applications;
+import static com.android.settings.widget.EntityHeaderController.ActionType;
+
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.preference.Preference;
@@ -25,8 +27,6 @@
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.applications.AppUtils;
-import static com.android.settings.widget.EntityHeaderController.ActionType;
-
public abstract class AppInfoWithHeader extends AppInfoBase {
private boolean mCreated;
@@ -44,7 +44,7 @@
final Preference pref = EntityHeaderController
.newInstance(activity, this, null /* header */)
.setRecyclerView(getListView(), getLifecycle())
- .setIcon(IconDrawableFactory.newInstance(activity)
+ .setIcon(IconDrawableFactory.newInstance(getContext())
.getBadgedIcon(mPackageInfo.applicationInfo))
.setLabel(mPackageInfo.applicationInfo.loadLabel(mPm))
.setSummary(mPackageInfo)
diff --git a/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java b/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
new file mode 100644
index 0000000..e053bc9
--- /dev/null
+++ b/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2017 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.bluetooth;
+
+import android.bluetooth.BluetoothDevice;
+import android.content.Context;
+import android.os.Bundle;
+import android.os.SystemProperties;
+import android.support.annotation.VisibleForTesting;
+import android.support.v7.preference.Preference;
+
+import com.android.settings.R;
+import com.android.settings.SettingsActivity;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.connecteddevice.DevicePreferenceCallback;
+import com.android.settings.widget.GearPreference;
+import com.android.settingslib.bluetooth.BluetoothCallback;
+import com.android.settingslib.bluetooth.BluetoothDeviceFilter;
+import com.android.settingslib.bluetooth.CachedBluetoothDevice;
+import com.android.settingslib.bluetooth.LocalBluetoothManager;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Update the bluetooth devices. It gets bluetooth event from {@link LocalBluetoothManager} using
+ * {@link BluetoothCallback}. It notifies the upper level whether to add/remove the preference
+ * through {@link DevicePreferenceCallback}
+ *
+ * In {@link BluetoothDeviceUpdater}, it uses {@link BluetoothDeviceFilter.Filter} to detect
+ * whether the {@link CachedBluetoothDevice} is relevant.
+ */
+public abstract class BluetoothDeviceUpdater implements BluetoothCallback {
+ private static final String BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_PROPERTY =
+ "persist.bluetooth.showdeviceswithoutnames";
+
+ protected final LocalBluetoothManager mLocalManager;
+ protected final DevicePreferenceCallback mDevicePreferenceCallback;
+ protected final Map<BluetoothDevice, Preference> mPreferenceMap;
+ protected Context mPrefContext;
+
+ private final boolean mShowDeviceWithoutNames;
+ private DashboardFragment mFragment;
+
+ @VisibleForTesting
+ final GearPreference.OnGearClickListener mDeviceProfilesListener = pref -> {
+ final CachedBluetoothDevice device =
+ ((BluetoothDevicePreference) pref).getBluetoothDevice();
+ if (device == null) {
+ return;
+ }
+ final Bundle args = new Bundle();
+ args.putString(BluetoothDeviceDetailsFragment.KEY_DEVICE_ADDRESS,
+ device.getDevice().getAddress());
+ final SettingsActivity activity = (SettingsActivity) mFragment.getActivity();
+ activity.startPreferencePanel(mFragment,
+ BluetoothDeviceDetailsFragment.class.getName(), args,
+ R.string.device_details_title, null, null, 0);
+
+ };
+
+ public BluetoothDeviceUpdater(DashboardFragment fragment,
+ DevicePreferenceCallback devicePreferenceCallback) {
+ this(fragment, devicePreferenceCallback, Utils.getLocalBtManager(fragment.getContext()));
+ }
+
+ @VisibleForTesting
+ BluetoothDeviceUpdater(DashboardFragment fragment,
+ DevicePreferenceCallback devicePreferenceCallback, LocalBluetoothManager localManager) {
+ mFragment = fragment;
+ mDevicePreferenceCallback = devicePreferenceCallback;
+ mShowDeviceWithoutNames = SystemProperties.getBoolean(
+ BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_PROPERTY, false);
+ mPreferenceMap = new HashMap<>();
+ mLocalManager = localManager;
+ }
+
+ /**
+ * Register the bluetooth event callback and update the list
+ */
+ public void registerCallback() {
+ mLocalManager.setForegroundActivity(mFragment.getContext());
+ mLocalManager.getEventManager().registerCallback(this);
+ forceUpdate();
+ }
+
+ /**
+ * Unregister the bluetooth event callback
+ */
+ public void unregisterCallback() {
+ mLocalManager.setForegroundActivity(null);
+ mLocalManager.getEventManager().unregisterCallback(this);
+ }
+
+ /**
+ * Force to update the list of bluetooth devices
+ */
+ public void forceUpdate() {
+ Collection<CachedBluetoothDevice> cachedDevices =
+ mLocalManager.getCachedDeviceManager().getCachedDevicesCopy();
+ for (CachedBluetoothDevice cachedBluetoothDevice : cachedDevices) {
+ update(cachedBluetoothDevice);
+ }
+ }
+
+ @Override
+ public void onBluetoothStateChanged(int bluetoothState) {
+ forceUpdate();
+ }
+
+ @Override
+ public void onScanningStateChanged(boolean started) {}
+
+ @Override
+ public void onDeviceAdded(CachedBluetoothDevice cachedDevice) {
+ update(cachedDevice);
+ }
+
+ @Override
+ public void onDeviceDeleted(CachedBluetoothDevice cachedDevice) {}
+
+ @Override
+ public void onDeviceBondStateChanged(CachedBluetoothDevice cachedDevice, int bondState) {
+ update(cachedDevice);
+ }
+
+ @Override
+ public void onConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) {}
+
+ /**
+ * Set the context to generate the {@link Preference}, so it could get the correct theme.
+ */
+ public void setPrefContext(Context context) {
+ mPrefContext = context;
+ }
+
+ /**
+ * Update whether to show {@cde cachedBluetoothDevice} in the list.
+ */
+ abstract public void update(CachedBluetoothDevice cachedBluetoothDevice);
+
+ /**
+ * Add the {@link Preference} that represents the {@code cachedDevice}
+ */
+ protected void addPreference(CachedBluetoothDevice cachedDevice) {
+ final BluetoothDevice device = cachedDevice.getDevice();
+ if (!mPreferenceMap.containsKey(device)) {
+ BluetoothDevicePreference btPreference =
+ new BluetoothDevicePreference(mPrefContext, cachedDevice,
+ mShowDeviceWithoutNames);
+ btPreference.setOnGearClickListener(mDeviceProfilesListener);
+ mPreferenceMap.put(device, btPreference);
+ mDevicePreferenceCallback.onDeviceAdded(btPreference);
+ }
+ }
+
+ /**
+ * Remove the {@link Preference} that represents the {@code cachedDevice}
+ */
+ protected void removePreference(CachedBluetoothDevice cachedDevice) {
+ final BluetoothDevice device = cachedDevice.getDevice();
+ if (mPreferenceMap.containsKey(device)) {
+ mDevicePreferenceCallback.onDeviceRemoved(mPreferenceMap.get(device));
+ mPreferenceMap.remove(device);
+ }
+ }
+}
diff --git a/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java b/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java
index 8d9e1c4..c4962d6 100644
--- a/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java
+++ b/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java
@@ -14,4 +14,4 @@
public boolean isDeviceDetailPageEnabled() {
return false;
}
-}
+}
\ No newline at end of file
diff --git a/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdater.java b/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdater.java
new file mode 100644
index 0000000..239e405
--- /dev/null
+++ b/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdater.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2017 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.bluetooth;
+
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.support.annotation.VisibleForTesting;
+
+import com.android.settings.connecteddevice.DevicePreferenceCallback;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settingslib.bluetooth.CachedBluetoothDevice;
+import com.android.settingslib.bluetooth.LocalBluetoothManager;
+
+/**
+ * Controller to maintain connected bluetooth devices
+ */
+public class ConnectedBluetoothDeviceUpdater extends BluetoothDeviceUpdater {
+
+ public ConnectedBluetoothDeviceUpdater(DashboardFragment fragment,
+ DevicePreferenceCallback devicePreferenceCallback) {
+ super(fragment, devicePreferenceCallback);
+ }
+
+ @VisibleForTesting
+ ConnectedBluetoothDeviceUpdater(DashboardFragment fragment,
+ DevicePreferenceCallback devicePreferenceCallback,
+ LocalBluetoothManager localBluetoothManager) {
+ super(fragment, devicePreferenceCallback, localBluetoothManager);
+ }
+
+ @Override
+ public void onConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) {
+ if (state == BluetoothAdapter.STATE_CONNECTED) {
+ addPreference(cachedDevice);
+ } else if (state == BluetoothAdapter.STATE_DISCONNECTED) {
+ removePreference(cachedDevice);
+ }
+ }
+
+ @Override
+ public void update(CachedBluetoothDevice cachedDevice) {
+ final BluetoothDevice device = cachedDevice.getDevice();
+ final boolean filterMatch =
+ device.getBondState() == BluetoothDevice.BOND_BONDED && device.isConnected();
+
+ if (filterMatch) {
+ // Add the preference if it is new one
+ addPreference(cachedDevice);
+ } else {
+ removePreference(cachedDevice);
+ }
+ }
+}
diff --git a/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
index 483b00c..14acd89 100644
--- a/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
+++ b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
@@ -17,33 +17,25 @@
import android.app.Activity;
import android.content.Context;
-import android.content.pm.PackageManager;
import android.provider.SearchIndexableResource;
import android.support.annotation.VisibleForTesting;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.SettingsActivity;
-import com.android.settings.bluetooth.BluetoothMasterSwitchPreferenceController;
-import com.android.settings.bluetooth.Utils;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.SummaryLoader;
-import com.android.settings.deviceinfo.UsbBackend;
import com.android.settings.nfc.NfcPreferenceController;
-import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
public class ConnectedDeviceDashboardFragment extends DashboardFragment {
private static final String TAG = "ConnectedDeviceFrag";
- private UsbModePreferenceController mUsbPrefController;
@Override
public int getMetricsCategory() {
@@ -69,26 +61,12 @@
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
final Lifecycle lifecycle = getLifecycle();
- final NfcPreferenceController nfcPreferenceController =
- new NfcPreferenceController(context);
- lifecycle.addObserver(nfcPreferenceController);
- controllers.add(nfcPreferenceController);
- mUsbPrefController = new UsbModePreferenceController(context, new UsbBackend(context));
- lifecycle.addObserver(mUsbPrefController);
- controllers.add(mUsbPrefController);
- final BluetoothMasterSwitchPreferenceController bluetoothPreferenceController =
- new BluetoothMasterSwitchPreferenceController(
- context, Utils.getLocalBtManager(context), this,
- (SettingsActivity) getActivity());
- lifecycle.addObserver(bluetoothPreferenceController);
- controllers.add(bluetoothPreferenceController);
- SmsMirroringFeatureProvider smsMirroringFeatureProvider =
- FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
- AbstractPreferenceController smsMirroringController =
- smsMirroringFeatureProvider.getController(context);
- controllers.add(smsMirroringController);
+ final ConnectedDeviceGroupController connectedDeviceGroupController =
+ new ConnectedDeviceGroupController(this, lifecycle);
+ controllers.add(connectedDeviceGroupController);
return controllers;
+
}
@VisibleForTesting
@@ -131,33 +109,26 @@
/**
* For Search.
*/
+ //TODO(b/69333961): update the index for this new fragment
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider() {
@Override
public List<SearchIndexableResource> getXmlResourcesToIndex(
Context context, boolean enabled) {
- final SearchIndexableResource sir = new SearchIndexableResource(context);
- sir.xmlResId = R.xml.connected_devices;
- return Arrays.asList(sir);
+ return new ArrayList<>();
}
@Override
public List<String> getNonIndexableKeys(Context context) {
- final List<String> keys = super.getNonIndexableKeys(context);
- PackageManager pm = context.getPackageManager();
- if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC)) {
- keys.add(NfcPreferenceController.KEY_TOGGLE_NFC);
- keys.add(NfcPreferenceController.KEY_ANDROID_BEAM_SETTINGS);
- }
- keys.add(BluetoothMasterSwitchPreferenceController.KEY_TOGGLE_BLUETOOTH);
- SmsMirroringFeatureProvider smsMirroringFeatureProvider =
- FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
- SmsMirroringPreferenceController smsMirroringController =
- smsMirroringFeatureProvider.getController(context);
- smsMirroringController.updateNonIndexableKeys(keys);
+ return new ArrayList<>();
+ }
- return keys;
+ @Override
+ public List<AbstractPreferenceController> getPreferenceControllers(
+ Context context) {
+ //TODO(b/69333961): update the index for controllers
+ return super.getPreferenceControllers(context);
}
};
}
diff --git a/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentOld.java b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentOld.java
new file mode 100644
index 0000000..6a8f26d
--- /dev/null
+++ b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentOld.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2016 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.connecteddevice;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.provider.SearchIndexableResource;
+import android.support.annotation.VisibleForTesting;
+
+import com.android.internal.logging.nano.MetricsProto;
+import com.android.settings.R;
+import com.android.settings.SettingsActivity;
+import com.android.settings.bluetooth.BluetoothMasterSwitchPreferenceController;
+import com.android.settings.bluetooth.Utils;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.dashboard.SummaryLoader;
+import com.android.settings.deviceinfo.UsbBackend;
+import com.android.settings.nfc.NfcPreferenceController;
+import com.android.settings.overlay.FeatureFactory;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is the previous {@link ConnectedDeviceDashboardFragment} in Android O, in Android P the
+ * main entry will be {@link ConnectedDeviceDashboardFragment}
+ *
+ * @deprecated
+ */
+@Deprecated
+public class ConnectedDeviceDashboardFragmentOld extends DashboardFragment {
+
+ private static final String TAG = "ConnectedDeviceFrag2";
+ private UsbModePreferenceController mUsbPrefController;
+
+ @Override
+ public int getMetricsCategory() {
+ return MetricsProto.MetricsEvent.SETTINGS_CONNECTED_DEVICE_CATEGORY;
+ }
+
+ @Override
+ protected String getLogTag() {
+ return TAG;
+ }
+
+ @Override
+ protected int getHelpResource() {
+ return R.string.help_url_connected_devices;
+ }
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.connected_devices_old;
+ }
+
+ @Override
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
+ final Lifecycle lifecycle = getLifecycle();
+ final NfcPreferenceController nfcPreferenceController =
+ new NfcPreferenceController(context);
+ lifecycle.addObserver(nfcPreferenceController);
+ controllers.add(nfcPreferenceController);
+ mUsbPrefController = new UsbModePreferenceController(context, new UsbBackend(context));
+ lifecycle.addObserver(mUsbPrefController);
+ controllers.add(mUsbPrefController);
+ final BluetoothMasterSwitchPreferenceController bluetoothPreferenceController =
+ new BluetoothMasterSwitchPreferenceController(
+ context, Utils.getLocalBtManager(context), this,
+ (SettingsActivity) getActivity());
+ lifecycle.addObserver(bluetoothPreferenceController);
+ controllers.add(bluetoothPreferenceController);
+
+ SmsMirroringFeatureProvider smsMirroringFeatureProvider =
+ FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
+ AbstractPreferenceController smsMirroringController =
+ smsMirroringFeatureProvider.getController(context);
+ controllers.add(smsMirroringController);
+ return controllers;
+ }
+
+ @VisibleForTesting
+ static class SummaryProvider implements SummaryLoader.SummaryProvider {
+
+ private final Context mContext;
+ private final SummaryLoader mSummaryLoader;
+ private final NfcPreferenceController mNfcPreferenceController;
+
+ public SummaryProvider(Context context, SummaryLoader summaryLoader) {
+ mContext = context;
+ mSummaryLoader = summaryLoader;
+ mNfcPreferenceController = new NfcPreferenceController(context);
+ }
+
+ @Override
+ public void setListening(boolean listening) {
+ if (listening) {
+ if (mNfcPreferenceController.isAvailable()) {
+ mSummaryLoader.setSummary(this,
+ mContext.getString(R.string.connected_devices_dashboard_summary));
+ } else {
+ mSummaryLoader.setSummary(this, mContext.getString(
+ R.string.connected_devices_dashboard_no_nfc_summary));
+ }
+ }
+ }
+ }
+
+ public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY
+ = new SummaryLoader.SummaryProviderFactory() {
+ @Override
+ public SummaryLoader.SummaryProvider createSummaryProvider(Activity activity,
+ SummaryLoader summaryLoader) {
+ return new SummaryProvider(activity, summaryLoader);
+ }
+ };
+
+ /**
+ * For Search.
+ */
+ public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider() {
+ @Override
+ public List<SearchIndexableResource> getXmlResourcesToIndex(
+ Context context, boolean enabled) {
+ final SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.connected_devices_old;
+ return Arrays.asList(sir);
+ }
+
+ @Override
+ public List<String> getNonIndexableKeys(Context context) {
+ final List<String> keys = super.getNonIndexableKeys(context);
+ PackageManager pm = context.getPackageManager();
+ if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC)) {
+ keys.add(NfcPreferenceController.KEY_TOGGLE_NFC);
+ keys.add(NfcPreferenceController.KEY_ANDROID_BEAM_SETTINGS);
+ }
+ keys.add(BluetoothMasterSwitchPreferenceController.KEY_TOGGLE_BLUETOOTH);
+
+ SmsMirroringFeatureProvider smsMirroringFeatureProvider =
+ FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
+ SmsMirroringPreferenceController smsMirroringController =
+ smsMirroringFeatureProvider.getController(context);
+ smsMirroringController.updateNonIndexableKeys(keys);
+
+ return keys;
+ }
+ };
+}
diff --git a/src/com/android/settings/connecteddevice/ConnectedDeviceGroupController.java b/src/com/android/settings/connecteddevice/ConnectedDeviceGroupController.java
new file mode 100644
index 0000000..a0b5cb8
--- /dev/null
+++ b/src/com/android/settings/connecteddevice/ConnectedDeviceGroupController.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2017 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.connecteddevice;
+
+import android.support.annotation.VisibleForTesting;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceScreen;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settings.bluetooth.BluetoothDeviceUpdater;
+import com.android.settings.bluetooth.ConnectedBluetoothDeviceUpdater;
+import com.android.settingslib.core.AbstractPreferenceController;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.core.lifecycle.LifecycleObserver;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settingslib.core.lifecycle.events.OnStart;
+import com.android.settingslib.core.lifecycle.events.OnStop;
+
+/**
+ * Controller to maintain the {@link android.support.v7.preference.PreferenceGroup} for all
+ * connected devices. It uses {@link DevicePreferenceCallback} to add/remove {@link Preference}
+ */
+public class ConnectedDeviceGroupController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnStart, OnStop,
+ DevicePreferenceCallback {
+
+ private static final String KEY = "connected_device_list";
+
+ @VisibleForTesting
+ PreferenceGroup mPreferenceGroup;
+ private BluetoothDeviceUpdater mBluetoothDeviceUpdater;
+
+ public ConnectedDeviceGroupController(DashboardFragment fragment, Lifecycle lifecycle) {
+ super(fragment.getContext());
+ init(lifecycle, new ConnectedBluetoothDeviceUpdater(fragment, this));
+ }
+
+ @VisibleForTesting
+ ConnectedDeviceGroupController(DashboardFragment fragment, Lifecycle lifecycle,
+ BluetoothDeviceUpdater bluetoothDeviceUpdater) {
+ super(fragment.getContext());
+ init(lifecycle, bluetoothDeviceUpdater);
+ }
+
+ @Override
+ public void onStart() {
+ mBluetoothDeviceUpdater.registerCallback();
+ }
+
+ @Override
+ public void onStop() {
+ mBluetoothDeviceUpdater.unregisterCallback();
+ }
+
+ @Override
+ public void displayPreference(PreferenceScreen screen) {
+ super.displayPreference(screen);
+ mPreferenceGroup = (PreferenceGroup) screen.findPreference(KEY);
+ mPreferenceGroup.setVisible(false);
+ mBluetoothDeviceUpdater.setPrefContext(screen.getContext());
+ mBluetoothDeviceUpdater.forceUpdate();
+ }
+
+ @Override
+ public boolean isAvailable() {
+ return true;
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return KEY;
+ }
+
+ @Override
+ public void onDeviceAdded(Preference preference) {
+ if (mPreferenceGroup.getPreferenceCount() == 0) {
+ mPreferenceGroup.setVisible(true);
+ }
+ mPreferenceGroup.addPreference(preference);
+ }
+
+ @Override
+ public void onDeviceRemoved(Preference preference) {
+ mPreferenceGroup.removePreference(preference);
+ if (mPreferenceGroup.getPreferenceCount() == 0) {
+ mPreferenceGroup.setVisible(false);
+ }
+ }
+
+ private void init(Lifecycle lifecycle, BluetoothDeviceUpdater bluetoothDeviceUpdater) {
+ if (lifecycle != null) {
+ lifecycle.addObserver(this);
+ }
+ mBluetoothDeviceUpdater = bluetoothDeviceUpdater;
+ }
+}
diff --git a/src/com/android/settings/connecteddevice/DevicePreferenceCallback.java b/src/com/android/settings/connecteddevice/DevicePreferenceCallback.java
new file mode 100644
index 0000000..5f04700
--- /dev/null
+++ b/src/com/android/settings/connecteddevice/DevicePreferenceCallback.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2017 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.connecteddevice;
+
+import android.support.v7.preference.Preference;
+
+/**
+ * Callback to add or remove {@link Preference} in device group.
+ */
+public interface DevicePreferenceCallback {
+ /**
+ * Called when a device(i.e. bluetooth, usb) is added
+ * @param preference present the device
+ */
+ void onDeviceAdded(Preference preference);
+
+ /**
+ * Called when a device(i.e. bluetooth, usb) is removed
+ * @param preference present the device
+ */
+ void onDeviceRemoved(Preference preference);
+}
diff --git a/src/com/android/settings/core/FeatureFlags.java b/src/com/android/settings/core/FeatureFlags.java
index 58ca7d1..547318f 100644
--- a/src/com/android/settings/core/FeatureFlags.java
+++ b/src/com/android/settings/core/FeatureFlags.java
@@ -24,4 +24,5 @@
public static final String SEARCH_V2 = "settings_search_v2";
public static final String SUGGESTIONS_V2 = "new_settings_suggestion";
public static final String APP_INFO_V2 = "settings_app_info_v2";
+ public static final String CONNECTED_DEVICE_V2 = "settings_connected_device_v2";
}
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index 52ae57f..37cd431 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -58,6 +58,7 @@
import com.android.settings.bluetooth.BluetoothDeviceDetailsFragment;
import com.android.settings.bluetooth.BluetoothSettings;
import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment;
+import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragmentOld;
import com.android.settings.dashboard.SupportFragment;
import com.android.settings.datausage.DataPlanUsageSummary;
import com.android.settings.datausage.DataUsageList;
@@ -248,6 +249,7 @@
SystemDashboardFragment.class.getName(),
NetworkDashboardFragment.class.getName(),
ConnectedDeviceDashboardFragment.class.getName(),
+ ConnectedDeviceDashboardFragmentOld.class.getName(),
AppAndNotificationDashboardFragment.class.getName(),
UserAndAccountDashboardFragment.class.getName(),
EnterprisePrivacySettings.class.getName(),
@@ -261,6 +263,7 @@
// Home page
Settings.NetworkDashboardActivity.class.getName(),
Settings.ConnectedDeviceDashboardActivity.class.getName(),
+ Settings.ConnectedDeviceDashboardActivityOld.class.getName(),
Settings.AppAndNotificationDashboardActivity.class.getName(),
Settings.DisplaySettingsActivity.class.getName(),
Settings.SoundSettingsActivity.class.getName(),
diff --git a/src/com/android/settings/dashboard/DashboardFragmentRegistry.java b/src/com/android/settings/dashboard/DashboardFragmentRegistry.java
index d56a402..af00dc6 100644
--- a/src/com/android/settings/dashboard/DashboardFragmentRegistry.java
+++ b/src/com/android/settings/dashboard/DashboardFragmentRegistry.java
@@ -23,7 +23,7 @@
import com.android.settings.accounts.UserAndAccountDashboardFragment;
import com.android.settings.applications.AppAndNotificationDashboardFragment;
import com.android.settings.applications.DefaultAppSettings;
-import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment;
+import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragmentOld;
import com.android.settings.development.DevelopmentSettingsDashboardFragment;
import com.android.settings.deviceinfo.StorageDashboardFragment;
import com.android.settings.fuelgauge.PowerUsageSummary;
@@ -59,7 +59,8 @@
PARENT_TO_CATEGORY_KEY_MAP = new ArrayMap<>();
PARENT_TO_CATEGORY_KEY_MAP.put(
NetworkDashboardFragment.class.getName(), CategoryKey.CATEGORY_NETWORK);
- PARENT_TO_CATEGORY_KEY_MAP.put(ConnectedDeviceDashboardFragment.class.getName(),
+ //TODO(b/69471219): update ConnectedDeviceDashboardFragment once new feature is done.
+ PARENT_TO_CATEGORY_KEY_MAP.put(ConnectedDeviceDashboardFragmentOld.class.getName(),
CategoryKey.CATEGORY_DEVICE);
PARENT_TO_CATEGORY_KEY_MAP.put(AppAndNotificationDashboardFragment.class.getName(),
CategoryKey.CATEGORY_APPS);
diff --git a/src/com/android/settings/datetime/AutoTimePreferenceController.java b/src/com/android/settings/datetime/AutoTimePreferenceController.java
index 0b70f45..3da712a 100644
--- a/src/com/android/settings/datetime/AutoTimePreferenceController.java
+++ b/src/com/android/settings/datetime/AutoTimePreferenceController.java
@@ -46,8 +46,10 @@
if (!(preference instanceof RestrictedSwitchPreference)) {
return;
}
- ((RestrictedSwitchPreference) preference).setDisabledByAdmin(
- getEnforcedAdminProperty());
+ if (!((RestrictedSwitchPreference) preference).isDisabledByAdmin()) {
+ ((RestrictedSwitchPreference) preference).setDisabledByAdmin(
+ getEnforcedAdminProperty());
+ }
((RestrictedSwitchPreference) preference).setChecked(isEnabled());
}
diff --git a/src/com/android/settings/datetime/DatePreferenceController.java b/src/com/android/settings/datetime/DatePreferenceController.java
index 9582e9e..d2a8686 100644
--- a/src/com/android/settings/datetime/DatePreferenceController.java
+++ b/src/com/android/settings/datetime/DatePreferenceController.java
@@ -27,6 +27,7 @@
import android.widget.DatePicker;
import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.RestrictedPreference;
import com.android.settingslib.core.AbstractPreferenceController;
import java.util.Calendar;
@@ -59,9 +60,14 @@
@Override
public void updateState(Preference preference) {
+ if (!(preference instanceof RestrictedPreference)) {
+ return;
+ }
final Calendar now = Calendar.getInstance();
preference.setSummary(DateFormat.getLongDateFormat(mContext).format(now.getTime()));
- preference.setEnabled(!mAutoTimePreferenceController.isEnabled());
+ if (!((RestrictedPreference) preference).isDisabledByAdmin()) {
+ preference.setEnabled(!mAutoTimePreferenceController.isEnabled());
+ }
}
@Override
diff --git a/src/com/android/settings/datetime/TimePreferenceController.java b/src/com/android/settings/datetime/TimePreferenceController.java
index 9bb5689..684ad0c 100644
--- a/src/com/android/settings/datetime/TimePreferenceController.java
+++ b/src/com/android/settings/datetime/TimePreferenceController.java
@@ -26,6 +26,7 @@
import android.widget.TimePicker;
import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.RestrictedPreference;
import com.android.settingslib.core.AbstractPreferenceController;
import java.util.Calendar;
@@ -60,9 +61,14 @@
@Override
public void updateState(Preference preference) {
+ if (!(preference instanceof RestrictedPreference)) {
+ return;
+ }
final Calendar now = Calendar.getInstance();
preference.setSummary(DateFormat.getTimeFormat(mContext).format(now.getTime()));
- preference.setEnabled(!mAutoTimePreferenceController.isEnabled());
+ if (!((RestrictedPreference) preference).isDisabledByAdmin()) {
+ preference.setEnabled(!mAutoTimePreferenceController.isEnabled());
+ }
}
@Override
diff --git a/src/com/android/settings/datetime/TimeZonePreferenceController.java b/src/com/android/settings/datetime/TimeZonePreferenceController.java
index 987132b..435b1fe 100644
--- a/src/com/android/settings/datetime/TimeZonePreferenceController.java
+++ b/src/com/android/settings/datetime/TimeZonePreferenceController.java
@@ -21,6 +21,7 @@
import android.support.v7.preference.Preference;
import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.RestrictedPreference;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.datetime.ZoneGetter;
@@ -41,8 +42,13 @@
@Override
public void updateState(Preference preference) {
+ if (!(preference instanceof RestrictedPreference)) {
+ return;
+ }
preference.setSummary(getTimeZoneOffsetAndName());
- preference.setEnabled(!mAutoTimeZonePreferenceController.isEnabled());
+ if( !((RestrictedPreference) preference).isDisabledByAdmin()) {
+ preference.setEnabled(!mAutoTimeZonePreferenceController.isEnabled());
+ }
}
@Override
diff --git a/src/com/android/settings/development/BugReportInPowerPreferenceControllerV2.java b/src/com/android/settings/development/BugReportInPowerPreferenceController.java
similarity index 96%
rename from src/com/android/settings/development/BugReportInPowerPreferenceControllerV2.java
rename to src/com/android/settings/development/BugReportInPowerPreferenceController.java
index 0ab826f..31b618b 100644
--- a/src/com/android/settings/development/BugReportInPowerPreferenceControllerV2.java
+++ b/src/com/android/settings/development/BugReportInPowerPreferenceController.java
@@ -30,7 +30,7 @@
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
import com.android.settingslib.wrapper.PackageManagerWrapper;
-public class BugReportInPowerPreferenceControllerV2 extends
+public class BugReportInPowerPreferenceController extends
DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener,
PreferenceControllerMixin {
@@ -48,7 +48,7 @@
private final UserManager mUserManager;
private SwitchPreference mPreference;
- public BugReportInPowerPreferenceControllerV2(Context context) {
+ public BugReportInPowerPreferenceController(Context context) {
super(context);
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
mPackageManager = new PackageManagerWrapper(context.getPackageManager());
diff --git a/src/com/android/settings/development/BugReportPreferenceControllerV2.java b/src/com/android/settings/development/BugReportPreferenceController.java
similarity index 89%
rename from src/com/android/settings/development/BugReportPreferenceControllerV2.java
rename to src/com/android/settings/development/BugReportPreferenceController.java
index 5876f84..ac2ae0d 100644
--- a/src/com/android/settings/development/BugReportPreferenceControllerV2.java
+++ b/src/com/android/settings/development/BugReportPreferenceController.java
@@ -22,14 +22,14 @@
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-public class BugReportPreferenceControllerV2 extends DeveloperOptionsPreferenceController implements
+public class BugReportPreferenceController extends DeveloperOptionsPreferenceController implements
PreferenceControllerMixin {
private static final String KEY_BUGREPORT = "bugreport";
private final UserManager mUserManager;
- public BugReportPreferenceControllerV2(Context context) {
+ public BugReportPreferenceController(Context context) {
super(context);
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
diff --git a/src/com/android/settings/development/CameraLaserSensorPreferenceControllerV2.java b/src/com/android/settings/development/CameraLaserSensorPreferenceController.java
similarity index 96%
rename from src/com/android/settings/development/CameraLaserSensorPreferenceControllerV2.java
rename to src/com/android/settings/development/CameraLaserSensorPreferenceController.java
index 43943ac..41a7983 100644
--- a/src/com/android/settings/development/CameraLaserSensorPreferenceControllerV2.java
+++ b/src/com/android/settings/development/CameraLaserSensorPreferenceController.java
@@ -29,7 +29,7 @@
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-public class CameraLaserSensorPreferenceControllerV2 extends
+public class CameraLaserSensorPreferenceController extends
DeveloperOptionsPreferenceController implements
Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
@@ -51,7 +51,7 @@
private SwitchPreference mPreference;
- public CameraLaserSensorPreferenceControllerV2(Context context) {
+ public CameraLaserSensorPreferenceController(Context context) {
super(context);
}
diff --git a/src/com/android/settings/development/ConnectivityMonitorPreferenceControllerV2.java b/src/com/android/settings/development/ConnectivityMonitorPreferenceController.java
similarity index 96%
rename from src/com/android/settings/development/ConnectivityMonitorPreferenceControllerV2.java
rename to src/com/android/settings/development/ConnectivityMonitorPreferenceController.java
index fdcecfb..075af2b 100644
--- a/src/com/android/settings/development/ConnectivityMonitorPreferenceControllerV2.java
+++ b/src/com/android/settings/development/ConnectivityMonitorPreferenceController.java
@@ -29,7 +29,7 @@
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-public class ConnectivityMonitorPreferenceControllerV2 extends
+public class ConnectivityMonitorPreferenceController extends
DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener,
PreferenceControllerMixin {
@@ -55,7 +55,7 @@
private SwitchPreference mPreference;
- public ConnectivityMonitorPreferenceControllerV2(Context context) {
+ public ConnectivityMonitorPreferenceController(Context context) {
super(context);
}
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 72eb30a..237f9ba 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -257,15 +257,15 @@
@Override
public void onDisableLogPersistDialogConfirmed() {
- final LogPersistPreferenceControllerV2 controller = getDevelopmentOptionsController(
- LogPersistPreferenceControllerV2.class);
+ final LogPersistPreferenceController controller = getDevelopmentOptionsController(
+ LogPersistPreferenceController.class);
controller.onDisableLogPersistDialogConfirmed();
}
@Override
public void onDisableLogPersistDialogRejected() {
- final LogPersistPreferenceControllerV2 controller = getDevelopmentOptionsController(
- LogPersistPreferenceControllerV2.class);
+ final LogPersistPreferenceController controller = getDevelopmentOptionsController(
+ LogPersistPreferenceController.class);
controller.onDisableLogPersistDialogRejected();
}
@@ -298,12 +298,15 @@
@Override
protected int getPreferenceScreenResId() {
- Log.d(TAG, "Creating pref screen");
- return R.xml.development_settings;
+ return Utils.isMonkeyRunning()? R.xml.placeholder_prefs : R.xml.development_settings;
}
@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ if (Utils.isMonkeyRunning()) {
+ mPreferenceControllers = new ArrayList<>();
+ return null;
+ }
mPreferenceControllers = buildPreferenceControllers(context, getActivity(), getLifecycle(),
this /* devOptionsDashboardFragment */,
new BluetoothA2dpConfigStore());
@@ -326,6 +329,9 @@
}
private void enableDeveloperOptions() {
+ if (Utils.isMonkeyRunning()) {
+ return;
+ }
DevelopmentSettingsEnabler.setDevelopmentSettingsEnabled(getContext(), true);
for (AbstractPreferenceController controller : mPreferenceControllers) {
if (controller instanceof DeveloperOptionsPreferenceController) {
@@ -335,6 +341,9 @@
}
private void disableDeveloperOptions() {
+ if (Utils.isMonkeyRunning()) {
+ return;
+ }
DevelopmentSettingsEnabler.setDevelopmentSettingsEnabled(getContext(), false);
final SystemPropPoker poker = SystemPropPoker.getInstance();
poker.blockPokes();
@@ -362,7 +371,7 @@
BluetoothA2dpConfigStore bluetoothA2dpConfigStore) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new MemoryUsagePreferenceController(context));
- controllers.add(new BugReportPreferenceControllerV2(context));
+ controllers.add(new BugReportPreferenceController(context));
controllers.add(new LocalBackupPasswordPreferenceController(context));
controllers.add(new StayAwakePreferenceController(context, lifecycle));
controllers.add(new HdcpCheckingPreferenceController(context));
@@ -370,23 +379,23 @@
controllers.add(new OemUnlockPreferenceController(context, activity, fragment));
controllers.add(new FileEncryptionPreferenceController(context));
controllers.add(new PictureColorModePreferenceController(context, lifecycle));
- controllers.add(new WebViewAppPreferenceControllerV2(context));
+ controllers.add(new WebViewAppPreferenceController(context));
controllers.add(new CoolColorTemperaturePreferenceController(context));
controllers.add(new DisableAutomaticUpdatesPreferenceController(context));
controllers.add(new AdbPreferenceController(context, fragment));
controllers.add(new ClearAdbKeysPreferenceController(context, fragment));
controllers.add(new LocalTerminalPreferenceController(context));
- controllers.add(new BugReportInPowerPreferenceControllerV2(context));
+ controllers.add(new BugReportInPowerPreferenceController(context));
controllers.add(new MockLocationAppPreferenceController(context, fragment));
controllers.add(new DebugViewAttributesPreferenceController(context));
controllers.add(new SelectDebugAppPreferenceController(context, fragment));
controllers.add(new WaitForDebuggerPreferenceController(context));
controllers.add(new EnableGpuDebugLayersPreferenceController(context));
- controllers.add(new VerifyAppsOverUsbPreferenceControllerV2(context));
- controllers.add(new LogdSizePreferenceControllerV2(context));
- controllers.add(new LogPersistPreferenceControllerV2(context, fragment, lifecycle));
- controllers.add(new ConnectivityMonitorPreferenceControllerV2(context));
- controllers.add(new CameraLaserSensorPreferenceControllerV2(context));
+ controllers.add(new VerifyAppsOverUsbPreferenceController(context));
+ controllers.add(new LogdSizePreferenceController(context));
+ controllers.add(new LogPersistPreferenceController(context, fragment, lifecycle));
+ controllers.add(new ConnectivityMonitorPreferenceController(context));
+ controllers.add(new CameraLaserSensorPreferenceController(context));
controllers.add(new WifiDisplayCertificationPreferenceController(context));
controllers.add(new WifiVerboseLoggingPreferenceController(context));
controllers.add(new WifiAggressiveHandoverPreferenceController(context));
diff --git a/src/com/android/settings/development/LogPersistPreferenceControllerV2.java b/src/com/android/settings/development/LogPersistPreferenceController.java
similarity index 95%
rename from src/com/android/settings/development/LogPersistPreferenceControllerV2.java
rename to src/com/android/settings/development/LogPersistPreferenceController.java
index 537b71b..a958379 100644
--- a/src/com/android/settings/development/LogPersistPreferenceControllerV2.java
+++ b/src/com/android/settings/development/LogPersistPreferenceController.java
@@ -26,14 +26,14 @@
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.development.AbstractLogpersistPreferenceController;
-public class LogPersistPreferenceControllerV2 extends
+public class LogPersistPreferenceController extends
AbstractLogpersistPreferenceController implements PreferenceControllerMixin {
private final DevelopmentSettingsDashboardFragment mFragment;
private ListPreference mPreference;
- public LogPersistPreferenceControllerV2(Context context,
+ public LogPersistPreferenceController(Context context,
DevelopmentSettingsDashboardFragment fragment, Lifecycle lifecycle) {
super(context, lifecycle);
diff --git a/src/com/android/settings/development/LogdSizePreferenceControllerV2.java b/src/com/android/settings/development/LogdSizePreferenceController.java
similarity index 91%
rename from src/com/android/settings/development/LogdSizePreferenceControllerV2.java
rename to src/com/android/settings/development/LogdSizePreferenceController.java
index 8194c48..6522800 100644
--- a/src/com/android/settings/development/LogdSizePreferenceControllerV2.java
+++ b/src/com/android/settings/development/LogdSizePreferenceController.java
@@ -24,12 +24,12 @@
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.development.AbstractLogdSizePreferenceController;
-public class LogdSizePreferenceControllerV2 extends AbstractLogdSizePreferenceController implements
+public class LogdSizePreferenceController extends AbstractLogdSizePreferenceController implements
Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
private ListPreference mPreference;
- public LogdSizePreferenceControllerV2(Context context) {
+ public LogdSizePreferenceController(Context context) {
super(context);
}
diff --git a/src/com/android/settings/development/SelectUsbConfigPreferenceController.java b/src/com/android/settings/development/SelectUsbConfigPreferenceController.java
index 87b206c..77a9a75 100644
--- a/src/com/android/settings/development/SelectUsbConfigPreferenceController.java
+++ b/src/com/android/settings/development/SelectUsbConfigPreferenceController.java
@@ -20,6 +20,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.pm.PackageManager;
import android.hardware.usb.UsbManager;
import android.os.Bundle;
import android.support.annotation.VisibleForTesting;
@@ -110,6 +111,14 @@
}
@Override
+ public boolean isAvailable() {
+ final PackageManager packageManager = mContext.getPackageManager();
+
+ return packageManager.hasSystemFeature(PackageManager.FEATURE_USB_HOST)
+ || packageManager.hasSystemFeature(PackageManager.FEATURE_USB_ACCESSORY);
+ }
+
+ @Override
protected void onDeveloperOptionsSwitchEnabled() {
mPreference.setEnabled(true);
}
diff --git a/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerV2.java b/src/com/android/settings/development/VerifyAppsOverUsbPreferenceController.java
similarity index 97%
rename from src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerV2.java
rename to src/com/android/settings/development/VerifyAppsOverUsbPreferenceController.java
index 6e3035e..f01da0d 100644
--- a/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerV2.java
+++ b/src/com/android/settings/development/VerifyAppsOverUsbPreferenceController.java
@@ -38,7 +38,7 @@
/**
* Controller to manage the state of "Verify apps over USB" toggle.
*/
-public class VerifyAppsOverUsbPreferenceControllerV2 extends
+public class VerifyAppsOverUsbPreferenceController extends
DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener,
AdbOnChangeListener, PreferenceControllerMixin {
private static final String VERIFY_APPS_OVER_USB_KEY = "verify_apps_over_usb";
@@ -70,7 +70,7 @@
// This field is accessed using reflection in the test, please keep name in sync.
private final PackageManagerWrapper mPackageManager;
- public VerifyAppsOverUsbPreferenceControllerV2(Context context) {
+ public VerifyAppsOverUsbPreferenceController(Context context) {
super(context);
mPackageManager = new PackageManagerWrapper(context.getPackageManager());
diff --git a/src/com/android/settings/development/WebViewAppPreferenceControllerV2.java b/src/com/android/settings/development/WebViewAppPreferenceController.java
similarity index 96%
rename from src/com/android/settings/development/WebViewAppPreferenceControllerV2.java
rename to src/com/android/settings/development/WebViewAppPreferenceController.java
index d061281..9ccb20b 100644
--- a/src/com/android/settings/development/WebViewAppPreferenceControllerV2.java
+++ b/src/com/android/settings/development/WebViewAppPreferenceController.java
@@ -31,7 +31,7 @@
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
import com.android.settingslib.wrapper.PackageManagerWrapper;
-public class WebViewAppPreferenceControllerV2 extends
+public class WebViewAppPreferenceController extends
DeveloperOptionsPreferenceController implements PreferenceControllerMixin {
private static final String TAG = "WebViewAppPrefCtrl";
@@ -42,7 +42,7 @@
private Preference mPreference;
- public WebViewAppPreferenceControllerV2(Context context) {
+ public WebViewAppPreferenceController(Context context) {
super(context);
mPackageManager = new PackageManagerWrapper(context.getPackageManager());
diff --git a/src/com/android/settings/fuelgauge/FakeUid.java b/src/com/android/settings/fuelgauge/FakeUid.java
index 2c3e3cf..2b5afe1 100644
--- a/src/com/android/settings/fuelgauge/FakeUid.java
+++ b/src/com/android/settings/fuelgauge/FakeUid.java
@@ -51,6 +51,11 @@
}
@Override
+ public Timer getMulticastWakelockStats() {
+ return null;
+ }
+
+ @Override
public ArrayMap<String, ? extends Timer> getSyncStats() {
return null;
}
diff --git a/src/com/android/settings/notification/EmergencyBroadcastPreferenceController.java b/src/com/android/settings/notification/EmergencyBroadcastPreferenceController.java
index d6291a8..2eb9f6a 100644
--- a/src/com/android/settings/notification/EmergencyBroadcastPreferenceController.java
+++ b/src/com/android/settings/notification/EmergencyBroadcastPreferenceController.java
@@ -40,7 +40,6 @@
private AccountRestrictionHelper mHelper;
private UserManager mUserManager;
private PackageManager mPm;
- private boolean mCellBroadcastAppLinkEnabled;
public EmergencyBroadcastPreferenceController(Context context, String prefKey) {
this(context, new AccountRestrictionHelper(context), prefKey);
@@ -54,8 +53,6 @@
mHelper = helper;
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
mPm = mContext.getPackageManager();
- // Enable link to CMAS app settings depending on the value in config.xml.
- mCellBroadcastAppLinkEnabled = isCellBroadcastAppLinkEnabled();
}
@Override
@@ -79,12 +76,13 @@
@Override
public boolean isAvailable() {
- return mUserManager.isAdminUser() && mCellBroadcastAppLinkEnabled
+ return mUserManager.isAdminUser() && isCellBroadcastAppLinkEnabled()
&& !mHelper.hasBaseUserRestriction(
UserManager.DISALLOW_CONFIG_CELL_BROADCASTS, UserHandle.myUserId());
}
private boolean isCellBroadcastAppLinkEnabled() {
+ // Enable link to CMAS app settings depending on the value in config.xml.
boolean enabled = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_cellBroadcastAppLinks);
if (enabled) {
diff --git a/src/com/android/settings/search/SearchIndexableResources.java b/src/com/android/settings/search/SearchIndexableResources.java
index 5bad807..7512c13 100644
--- a/src/com/android/settings/search/SearchIndexableResources.java
+++ b/src/com/android/settings/search/SearchIndexableResources.java
@@ -34,6 +34,7 @@
import com.android.settings.backup.BackupSettingsFragment;
import com.android.settings.bluetooth.BluetoothSettings;
import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment;
+import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragmentOld;
import com.android.settings.datausage.DataUsageMeteredSettings;
import com.android.settings.datausage.DataUsageSummary;
import com.android.settings.deletionhelper.AutomaticStorageManagerSettings;
@@ -154,6 +155,7 @@
addIndex(ResetDashboardFragment.class);
addIndex(StorageDashboardFragment.class);
addIndex(ConnectedDeviceDashboardFragment.class);
+ addIndex(ConnectedDeviceDashboardFragmentOld.class);
addIndex(EnterprisePrivacySettings.class);
addIndex(PaymentSettings.class);
addIndex(TextToSpeechSettings.class);
diff --git a/src/com/android/settings/webview/WebViewAppPreferenceController.java b/src/com/android/settings/webview/WebViewAppPreferenceController.java
index 9410af7..18d874e 100644
--- a/src/com/android/settings/webview/WebViewAppPreferenceController.java
+++ b/src/com/android/settings/webview/WebViewAppPreferenceController.java
@@ -23,7 +23,7 @@
import com.android.settings.applications.defaultapps.DefaultAppPreferenceController;
/**
- * Deprecated in favor of {@link com.android.settings.development.WebViewAppPreferenceControllerV2}
+ * Deprecated in favor of {@link com.android.settings.development.WebViewAppPreferenceController}
*/
@Deprecated
public class WebViewAppPreferenceController extends DefaultAppPreferenceController {
diff --git a/tests/robotests/res/values-mcc999/config.xml b/tests/robotests/res/values-mcc999/config.xml
index c2909ac..4113c90 100644
--- a/tests/robotests/res/values-mcc999/config.xml
+++ b/tests/robotests/res/values-mcc999/config.xml
@@ -15,7 +15,9 @@
-->
<resources>
+ <bool name="config_tintSettingIcon">false</bool>
<bool name="config_enableColorTemperature">false</bool>
<bool name="config_show_camera_laser_sensor">false</bool>
<bool name="config_show_connectivity_monitor">false</bool>
+ <bool name="config_display_recent_apps">false</bool>
</resources>
\ No newline at end of file
diff --git a/tests/robotests/res/values/config.xml b/tests/robotests/res/values/config.xml
index 9e2d911..4004106 100644
--- a/tests/robotests/res/values/config.xml
+++ b/tests/robotests/res/values/config.xml
@@ -20,4 +20,5 @@
<bool name="config_enableColorTemperature">true</bool>
<bool name="config_show_camera_laser_sensor">true</bool>
<bool name="config_show_connectivity_monitor">true</bool>
+ <bool name="config_display_recent_apps">true</bool>
</resources>
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/DeviceAdminAddTest.java b/tests/robotests/src/com/android/settings/DeviceAdminAddTest.java
index cd891be..82b8e1b 100644
--- a/tests/robotests/src/com/android/settings/DeviceAdminAddTest.java
+++ b/tests/robotests/src/com/android/settings/DeviceAdminAddTest.java
@@ -36,7 +36,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DeviceAdminAddTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/DisplaySettingsTest.java b/tests/robotests/src/com/android/settings/DisplaySettingsTest.java
index 0d8cb92..a956aa7 100644
--- a/tests/robotests/src/com/android/settings/DisplaySettingsTest.java
+++ b/tests/robotests/src/com/android/settings/DisplaySettingsTest.java
@@ -21,7 +21,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DisplaySettingsTest {
@Test
diff --git a/tests/robotests/src/com/android/settings/HelpTrampolineTest.java b/tests/robotests/src/com/android/settings/HelpTrampolineTest.java
index e10b878..11f5c7b 100644
--- a/tests/robotests/src/com/android/settings/HelpTrampolineTest.java
+++ b/tests/robotests/src/com/android/settings/HelpTrampolineTest.java
@@ -34,7 +34,7 @@
import static org.robolectric.Shadows.shadowOf;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {
ShadowHelpUtils.class
})
diff --git a/tests/robotests/src/com/android/settings/LegalSettingsTest.java b/tests/robotests/src/com/android/settings/LegalSettingsTest.java
index 3d50c63..f457c08 100644
--- a/tests/robotests/src/com/android/settings/LegalSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/LegalSettingsTest.java
@@ -29,7 +29,7 @@
import static com.google.common.truth.Truth.assertThat;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class LegalSettingsTest {
@Test
diff --git a/tests/robotests/src/com/android/settings/LicenseHtmlGeneratorFromXmlTest.java b/tests/robotests/src/com/android/settings/LicenseHtmlGeneratorFromXmlTest.java
index ea4b272..7d82b27 100644
--- a/tests/robotests/src/com/android/settings/LicenseHtmlGeneratorFromXmlTest.java
+++ b/tests/robotests/src/com/android/settings/LicenseHtmlGeneratorFromXmlTest.java
@@ -34,7 +34,7 @@
import org.xmlpull.v1.XmlPullParserException;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class LicenseHtmlGeneratorFromXmlTest {
private static final String VAILD_XML_STRING =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
diff --git a/tests/robotests/src/com/android/settings/LicenseHtmlLoaderTest.java b/tests/robotests/src/com/android/settings/LicenseHtmlLoaderTest.java
index b16d315..2fd655f 100644
--- a/tests/robotests/src/com/android/settings/LicenseHtmlLoaderTest.java
+++ b/tests/robotests/src/com/android/settings/LicenseHtmlLoaderTest.java
@@ -39,7 +39,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class LicenseHtmlLoaderTest {
@Mock
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/MasterClearTest.java b/tests/robotests/src/com/android/settings/MasterClearTest.java
index 838b1e8..bfdf25e 100644
--- a/tests/robotests/src/com/android/settings/MasterClearTest.java
+++ b/tests/robotests/src/com/android/settings/MasterClearTest.java
@@ -51,7 +51,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(
manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {ShadowUtils.class}
)
public class MasterClearTest {
diff --git a/tests/robotests/src/com/android/settings/PrivacySettingsTest.java b/tests/robotests/src/com/android/settings/PrivacySettingsTest.java
index c52204d..4eaa781 100644
--- a/tests/robotests/src/com/android/settings/PrivacySettingsTest.java
+++ b/tests/robotests/src/com/android/settings/PrivacySettingsTest.java
@@ -33,7 +33,7 @@
import com.android.settings.testutils.SettingsRobolectricTestRunner;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class PrivacySettingsTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/SettingsActivityTest.java b/tests/robotests/src/com/android/settings/SettingsActivityTest.java
index 509ecda..8d595bc 100644
--- a/tests/robotests/src/com/android/settings/SettingsActivityTest.java
+++ b/tests/robotests/src/com/android/settings/SettingsActivityTest.java
@@ -45,7 +45,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SettingsActivityTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/SettingsDialogFragmentTest.java b/tests/robotests/src/com/android/settings/SettingsDialogFragmentTest.java
index 942634a..a5a7280 100644
--- a/tests/robotests/src/com/android/settings/SettingsDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/SettingsDialogFragmentTest.java
@@ -33,7 +33,7 @@
import com.android.settings.testutils.SettingsRobolectricTestRunner;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SettingsDialogFragmentTest {
private static final int DIALOG_ID = 15;
diff --git a/tests/robotests/src/com/android/settings/SettingsDumpServiceTest.java b/tests/robotests/src/com/android/settings/SettingsDumpServiceTest.java
index 0d0f22c..38e78e4 100644
--- a/tests/robotests/src/com/android/settings/SettingsDumpServiceTest.java
+++ b/tests/robotests/src/com/android/settings/SettingsDumpServiceTest.java
@@ -37,7 +37,7 @@
import com.android.settings.testutils.SettingsRobolectricTestRunner;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SettingsDumpServiceTest {
private static final String PACKAGE_BROWSER = "com.android.test.browser";
private static final String PACKAGE_NULL = "android";
diff --git a/tests/robotests/src/com/android/settings/SettingsLicenseActivityTest.java b/tests/robotests/src/com/android/settings/SettingsLicenseActivityTest.java
index ecda97e..6d28bd5 100644
--- a/tests/robotests/src/com/android/settings/SettingsLicenseActivityTest.java
+++ b/tests/robotests/src/com/android/settings/SettingsLicenseActivityTest.java
@@ -43,7 +43,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SettingsLicenseActivityTest {
private ActivityController<SettingsLicenseActivity> mActivityController;
private SettingsLicenseActivity mActivity;
diff --git a/tests/robotests/src/com/android/settings/SetupChooseLockPatternTest.java b/tests/robotests/src/com/android/settings/SetupChooseLockPatternTest.java
index 206ba95..17d1021 100644
--- a/tests/robotests/src/com/android/settings/SetupChooseLockPatternTest.java
+++ b/tests/robotests/src/com/android/settings/SetupChooseLockPatternTest.java
@@ -30,6 +30,7 @@
import com.android.settings.password.SetupChooseLockPattern;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.SettingsShadowResources;
+import com.android.settings.testutils.shadow.SettingsShadowResourcesImpl;
import com.android.settings.testutils.shadow.ShadowEventLogWriter;
import com.android.settings.testutils.shadow.ShadowUtils;
@@ -44,9 +45,10 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(
manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {
SettingsShadowResources.class,
+ SettingsShadowResourcesImpl.class,
SettingsShadowResources.SettingsShadowTheme.class,
ShadowEventLogWriter.class,
ShadowUtils.class
@@ -62,7 +64,7 @@
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
- mActivity = Robolectric.buildActivity(
+ mActivity = Robolectric.buildActivity(
SetupChooseLockPattern.class,
SetupChooseLockPattern.modifyIntentForSetup(
application,
diff --git a/tests/robotests/src/com/android/settings/SetupWizardUtilsTest.java b/tests/robotests/src/com/android/settings/SetupWizardUtilsTest.java
index 21061c1..4238a4c 100644
--- a/tests/robotests/src/com/android/settings/SetupWizardUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/SetupWizardUtilsTest.java
@@ -34,7 +34,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(
manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {
SettingsShadowSystemProperties.class
})
diff --git a/tests/robotests/src/com/android/settings/SummaryPreferenceTest.java b/tests/robotests/src/com/android/settings/SummaryPreferenceTest.java
index 59a5867..94e4785 100644
--- a/tests/robotests/src/com/android/settings/SummaryPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/SummaryPreferenceTest.java
@@ -35,7 +35,7 @@
import com.android.settings.testutils.shadow.SettingsShadowResources;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {
SettingsShadowResources.class,
SettingsShadowResources.SettingsShadowTheme.class
diff --git a/tests/robotests/src/com/android/settings/TetherServiceTest.java b/tests/robotests/src/com/android/settings/TetherServiceTest.java
index 0275c15..a888c30 100644
--- a/tests/robotests/src/com/android/settings/TetherServiceTest.java
+++ b/tests/robotests/src/com/android/settings/TetherServiceTest.java
@@ -37,7 +37,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class TetherServiceTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/UtilsTest.java b/tests/robotests/src/com/android/settings/UtilsTest.java
index f813457..3d66dea 100644
--- a/tests/robotests/src/com/android/settings/UtilsTest.java
+++ b/tests/robotests/src/com/android/settings/UtilsTest.java
@@ -44,7 +44,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class UtilsTest {
private static final String PACKAGE_NAME = "com.android.app";
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
index fb32da1..6616537 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
@@ -33,7 +33,7 @@
import static com.google.common.truth.Truth.assertThat;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AccessibilitySettingsTest {
@Test
diff --git a/tests/robotests/src/com/android/settings/accessibility/ShortcutServicePickerFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ShortcutServicePickerFragmentTest.java
index 66621a0..2e95c73 100644
--- a/tests/robotests/src/com/android/settings/accessibility/ShortcutServicePickerFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/ShortcutServicePickerFragmentTest.java
@@ -41,7 +41,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ShortcutServicePickerFragmentTest {
private static final String TEST_SERVICE_KEY_1 = "abc/123";
diff --git a/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java
index 5ef5a12..8d1d174 100644
--- a/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java
@@ -38,7 +38,7 @@
import org.robolectric.util.FragmentTestUtil;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {
SettingsShadowResources.class,
SettingsShadowResources.SettingsShadowTheme.class,
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountDetailDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/accounts/AccountDetailDashboardFragmentTest.java
index cfed83b..8924551 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountDetailDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountDetailDashboardFragmentTest.java
@@ -55,7 +55,7 @@
import static org.robolectric.Shadows.shadowOf;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AccountDetailDashboardFragmentTest {
private static final String METADATA_CATEGORY = "com.android.settings.category";
@@ -63,8 +63,6 @@
private static final String METADATA_USER_HANDLE = "user_handle";
@Mock(answer = RETURNS_DEEP_STUBS)
- private Activity mActivity;
- @Mock(answer = RETURNS_DEEP_STUBS)
private AccountManager mAccountManager;
@Mock
private Preference mPreference;
@@ -129,11 +127,11 @@
@Test
public void refreshDashboardTiles_HasAccountType_shouldAddAccountNameToIntent() {
- FakeFeatureFactory.setupForTest(mActivity);
+ FakeFeatureFactory.setupForTest(mContext);
final FakeFeatureFactory featureFactory =
- (FakeFeatureFactory) FakeFeatureFactory.getFactory(mActivity);
+ (FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext);
final DashboardFeatureProviderImpl dashboardFeatureProvider =
- new DashboardFeatureProviderImpl(mActivity);
+ new DashboardFeatureProviderImpl(mContext);
final PackageManager packageManager = mock(PackageManager.class);
ReflectionHelpers.setField(dashboardFeatureProvider, "mPackageManager", packageManager);
when(packageManager.resolveActivity(any(Intent.class), anyInt()))
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountHeaderPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/AccountHeaderPreferenceControllerTest.java
index 4380e5c..1b20e96 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountHeaderPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountHeaderPreferenceControllerTest.java
@@ -56,7 +56,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(
manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = AccountHeaderPreferenceControllerTest.ShadowAuthenticatorHelper.class
)
public class AccountHeaderPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/AccountPreferenceControllerTest.java
index 139bee7..6daaeca 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountPreferenceControllerTest.java
@@ -68,7 +68,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
public class AccountPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountPreferenceTest.java b/tests/robotests/src/com/android/settings/accounts/AccountPreferenceTest.java
index 0778043..4399580 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountPreferenceTest.java
@@ -35,7 +35,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AccountPreferenceTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountSyncPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/AccountSyncPreferenceControllerTest.java
index 5fbd3a7..dde68f5 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountSyncPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountSyncPreferenceControllerTest.java
@@ -47,7 +47,7 @@
import org.robolectric.shadows.ShadowApplication;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
public class AccountSyncPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountTypePreferenceLoaderTest.java b/tests/robotests/src/com/android/settings/accounts/AccountTypePreferenceLoaderTest.java
index fff73b7..2e7f0fa 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountTypePreferenceLoaderTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountTypePreferenceLoaderTest.java
@@ -50,7 +50,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AccountTypePreferenceLoaderTest {
@Mock(answer = RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/accounts/AddUserWhenLockedPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/AddUserWhenLockedPreferenceControllerTest.java
index faaf7db..e00a0ae 100644
--- a/tests/robotests/src/com/android/settings/accounts/AddUserWhenLockedPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AddUserWhenLockedPreferenceControllerTest.java
@@ -41,7 +41,7 @@
import org.robolectric.shadows.ShadowApplication;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AddUserWhenLockedPreferenceControllerTest {
@Mock(answer = RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/accounts/AutoSyncDataPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/AutoSyncDataPreferenceControllerTest.java
index 4715f88..336de21 100644
--- a/tests/robotests/src/com/android/settings/accounts/AutoSyncDataPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AutoSyncDataPreferenceControllerTest.java
@@ -44,14 +44,14 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AutoSyncDataPreferenceControllerTest {
@Mock(answer = RETURNS_DEEP_STUBS)
private PreferenceScreen mScreen;
@Mock(answer = RETURNS_DEEP_STUBS)
private UserManager mUserManager;
- @Mock(answer = RETURNS_DEEP_STUBS)
+ @Mock
private Fragment mFragment;
private Preference mPreference;
diff --git a/tests/robotests/src/com/android/settings/accounts/AutoSyncPersonalDataPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/AutoSyncPersonalDataPreferenceControllerTest.java
index 597fbd4..50d4df8 100644
--- a/tests/robotests/src/com/android/settings/accounts/AutoSyncPersonalDataPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AutoSyncPersonalDataPreferenceControllerTest.java
@@ -42,7 +42,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AutoSyncPersonalDataPreferenceControllerTest {
@Mock(answer = RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/accounts/AutoSyncWorkDataPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/AutoSyncWorkDataPreferenceControllerTest.java
index a25aa28..35a8bb6 100644
--- a/tests/robotests/src/com/android/settings/accounts/AutoSyncWorkDataPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AutoSyncWorkDataPreferenceControllerTest.java
@@ -42,7 +42,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AutoSyncWorkDataPreferenceControllerTest {
private static int MANAGED_PROFILE_ID = 10;
diff --git a/tests/robotests/src/com/android/settings/accounts/ProviderPreferenceTest.java b/tests/robotests/src/com/android/settings/accounts/ProviderPreferenceTest.java
index 4e4bb4f..4d1667f 100644
--- a/tests/robotests/src/com/android/settings/accounts/ProviderPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/ProviderPreferenceTest.java
@@ -32,7 +32,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ProviderPreferenceTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/accounts/RemoveAccountPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/RemoveAccountPreferenceControllerTest.java
index d4e866f..8250340 100644
--- a/tests/robotests/src/com/android/settings/accounts/RemoveAccountPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/RemoveAccountPreferenceControllerTest.java
@@ -40,6 +40,7 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.support.v14.preference.PreferenceFragment;
+import android.support.v7.preference.PreferenceManager;
import android.support.v7.preference.PreferenceScreen;
import android.widget.Button;
@@ -60,7 +61,7 @@
import org.robolectric.shadows.ShadowApplication;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class RemoveAccountPreferenceControllerTest {
private static final String KEY_REMOVE_ACCOUNT = "remove_account";
@@ -70,9 +71,11 @@
private AccountManager mAccountManager;
@Mock
private DevicePolicyManagerWrapper mDevicePolicyManager;
- @Mock(answer = RETURNS_DEEP_STUBS)
+ @Mock
private PreferenceFragment mFragment;
@Mock
+ private PreferenceManager mPreferenceManager;
+ @Mock
private PreferenceScreen mScreen;
@Mock
private FragmentManager mFragmentManager;
@@ -92,7 +95,8 @@
mContext = spy(shadowContext.getApplicationContext());
when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
- when(mFragment.getPreferenceManager().getContext()).thenReturn(mContext);
+ when(mFragment.getPreferenceManager()).thenReturn(mPreferenceManager);
+ when(mPreferenceManager.getContext()).thenReturn(mContext);
when(mFragment.getFragmentManager()).thenReturn(mFragmentManager);
when(mFragmentManager.beginTransaction()).thenReturn(mFragmentTransaction);
when(mAccountManager.getAuthenticatorTypesAsUser(anyInt())).thenReturn(
diff --git a/tests/robotests/src/com/android/settings/accounts/RemoveUserFragmentTest.java b/tests/robotests/src/com/android/settings/accounts/RemoveUserFragmentTest.java
index cd73068..ef23d22 100644
--- a/tests/robotests/src/com/android/settings/accounts/RemoveUserFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/RemoveUserFragmentTest.java
@@ -28,7 +28,7 @@
import static com.google.common.truth.Truth.assertThat;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class RemoveUserFragmentTest {
@Test
diff --git a/tests/robotests/src/com/android/settings/accounts/UserAndAccountDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/accounts/UserAndAccountDashboardFragmentTest.java
index 8dba2f2..2383ed1 100644
--- a/tests/robotests/src/com/android/settings/accounts/UserAndAccountDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/UserAndAccountDashboardFragmentTest.java
@@ -43,7 +43,7 @@
import static org.mockito.Mockito.when;
@RunWith(RobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class UserAndAccountDashboardFragmentTest {
private static final String METADATA_CATEGORY = "com.android.settings.category";
diff --git a/tests/robotests/src/com/android/settings/applications/AppAndNotificationDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/applications/AppAndNotificationDashboardFragmentTest.java
index 5a798f9..55141f7 100644
--- a/tests/robotests/src/com/android/settings/applications/AppAndNotificationDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppAndNotificationDashboardFragmentTest.java
@@ -16,32 +16,35 @@
package com.android.settings.applications;
-import android.content.Context;
+import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
import android.os.UserManager;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
+import com.android.settings.notification.EmergencyBroadcastPreferenceController;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.XmlTestUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
-import org.robolectric.util.ReflectionHelpers;
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
import java.util.List;
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppAndNotificationDashboardFragmentTest {
@Test
+ @Config(shadows = {ShadowEmergencyBroadcastPreferenceController.class})
public void testNonIndexableKeys_existInXmlLayout() {
final Context context = spy(RuntimeEnvironment.application);
UserManager manager = mock(UserManager.class);
@@ -56,4 +59,13 @@
assertThat(keys).containsAllIn(niks);
}
+
+ @Implements(EmergencyBroadcastPreferenceController.class)
+ public static class ShadowEmergencyBroadcastPreferenceController {
+
+ @Implementation
+ public boolean isAvailable() {
+ return true;
+ }
+ }
}
diff --git a/tests/robotests/src/com/android/settings/applications/AppInfoWithHeaderTest.java b/tests/robotests/src/com/android/settings/applications/AppInfoWithHeaderTest.java
index 62395f3..75ae458 100644
--- a/tests/robotests/src/com/android/settings/applications/AppInfoWithHeaderTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppInfoWithHeaderTest.java
@@ -16,6 +16,13 @@
package com.android.settings.applications;
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -49,14 +56,8 @@
import org.robolectric.shadows.ShadowApplication;
import org.robolectric.util.ReflectionHelpers;
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = ShadowEntityHeaderController.class)
public class AppInfoWithHeaderTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/AppPermissionsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/AppPermissionsPreferenceControllerTest.java
index 2e52214..b0f0d0c 100644
--- a/tests/robotests/src/com/android/settings/applications/AppPermissionsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppPermissionsPreferenceControllerTest.java
@@ -46,7 +46,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppPermissionsPreferenceControllerTest {
private static final String PERM_LOCATION = "android.permission-group.LOCATION";
diff --git a/tests/robotests/src/com/android/settings/applications/AppStateAppOpsBridgeTest.java b/tests/robotests/src/com/android/settings/applications/AppStateAppOpsBridgeTest.java
index d63697e..6fadb43 100644
--- a/tests/robotests/src/com/android/settings/applications/AppStateAppOpsBridgeTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppStateAppOpsBridgeTest.java
@@ -37,7 +37,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class AppStateAppOpsBridgeTest {
@Mock private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/applications/AppStateInstallAppsBridgeTest.java b/tests/robotests/src/com/android/settings/applications/AppStateInstallAppsBridgeTest.java
index 62623e5..c88f878 100644
--- a/tests/robotests/src/com/android/settings/applications/AppStateInstallAppsBridgeTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppStateInstallAppsBridgeTest.java
@@ -28,7 +28,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppStateInstallAppsBridgeTest {
@Test
diff --git a/tests/robotests/src/com/android/settings/applications/AppStorageSettingsTest.java b/tests/robotests/src/com/android/settings/applications/AppStorageSettingsTest.java
index 1f6aea4..d254074 100644
--- a/tests/robotests/src/com/android/settings/applications/AppStorageSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppStorageSettingsTest.java
@@ -45,7 +45,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppStorageSettingsTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/applications/AppStorageSizesControllerTest.java b/tests/robotests/src/com/android/settings/applications/AppStorageSizesControllerTest.java
index 027bd33..62cb26c 100644
--- a/tests/robotests/src/com/android/settings/applications/AppStorageSizesControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppStorageSizesControllerTest.java
@@ -8,8 +8,10 @@
import android.content.Context;
import android.support.v7.preference.Preference;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.R;
import com.android.settings.TestConfig;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settingslib.applications.StorageStatsSource.AppStorageStats;
import org.junit.Before;
import org.junit.Test;
@@ -18,11 +20,8 @@
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
-import com.android.settings.R;
-import com.android.settingslib.applications.StorageStatsSource.AppStorageStats;
-
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppStorageSizesControllerTest {
private static final String COMPUTING = "Computing…";
private static final String INVALID_SIZE = "Couldn’t compute package size.";
@@ -85,9 +84,9 @@
mController.setResult(result);
mController.updateUi(mContext);
- assertThat(mAppPreference.getSummary()).isEqualTo("1.00 B");
- assertThat(mCachePreference.getSummary()).isEqualTo("10.00 B");
- assertThat(mDataPreference.getSummary()).isEqualTo("90.00 B");
+ assertThat(mAppPreference.getSummary()).isEqualTo("1 B");
+ assertThat(mCachePreference.getSummary()).isEqualTo("10 B");
+ assertThat(mDataPreference.getSummary()).isEqualTo("90 B");
assertThat(mTotalPreference.getSummary()).isEqualTo("101 B");
}
@@ -103,10 +102,10 @@
mController.setCacheCleared(true);
mController.updateUi(mContext);
- assertThat(mAppPreference.getSummary()).isEqualTo("1.00 B");
- assertThat(mCachePreference.getSummary()).isEqualTo("0.00 B");
- assertThat(mDataPreference.getSummary()).isEqualTo("90.00 B");
- assertThat(mTotalPreference.getSummary()).isEqualTo("91.00 B");
+ assertThat(mAppPreference.getSummary()).isEqualTo("1 B");
+ assertThat(mCachePreference.getSummary()).isEqualTo("0 B");
+ assertThat(mDataPreference.getSummary()).isEqualTo("90 B");
+ assertThat(mTotalPreference.getSummary()).isEqualTo("91 B");
}
@Test
@@ -121,9 +120,9 @@
mController.setDataCleared(true);
mController.updateUi(mContext);
- assertThat(mAppPreference.getSummary()).isEqualTo("1.00 B");
- assertThat(mCachePreference.getSummary()).isEqualTo("0.00 B");
- assertThat(mDataPreference.getSummary()).isEqualTo("0.00 B");
- assertThat(mTotalPreference.getSummary()).isEqualTo("1.00 B");
+ assertThat(mAppPreference.getSummary()).isEqualTo("1 B");
+ assertThat(mCachePreference.getSummary()).isEqualTo("0 B");
+ assertThat(mDataPreference.getSummary()).isEqualTo("0 B");
+ assertThat(mTotalPreference.getSummary()).isEqualTo("1 B");
}
}
diff --git a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java
index 33d261f..eb3d94f 100644
--- a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java
@@ -56,7 +56,7 @@
* Tests for {@link InstalledAppCounter}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class AppWithAdminGrantedPermissionsCounterTest {
private final String APP_1 = "app1";
diff --git a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsListerTest.java b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsListerTest.java
index 2e9328a..d7c8059 100644
--- a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsListerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsListerTest.java
@@ -55,7 +55,7 @@
* Tests for {@link AppWithAdminGrantedPermissionsLister}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class AppWithAdminGrantedPermissionsListerTest {
private final String APP_1 = "app1";
diff --git a/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
index e5b7a66..dad02ef 100644
--- a/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
@@ -55,7 +55,7 @@
* Tests for {@link ApplicationFeatureProviderImpl}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {ShadowUserManager.class})
public final class ApplicationFeatureProviderImplTest {
diff --git a/tests/robotests/src/com/android/settings/applications/DefaultAppSettingsTest.java b/tests/robotests/src/com/android/settings/applications/DefaultAppSettingsTest.java
index 9441707..78ec265 100644
--- a/tests/robotests/src/com/android/settings/applications/DefaultAppSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/DefaultAppSettingsTest.java
@@ -52,7 +52,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultAppSettingsTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/applications/DrawOverlayDetailsTest.java b/tests/robotests/src/com/android/settings/applications/DrawOverlayDetailsTest.java
index 5d20a4c..38c0128 100644
--- a/tests/robotests/src/com/android/settings/applications/DrawOverlayDetailsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/DrawOverlayDetailsTest.java
@@ -46,7 +46,7 @@
import org.robolectric.shadows.ShadowApplication;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DrawOverlayDetailsTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/EnterpriseDefaultAppsTest.java b/tests/robotests/src/com/android/settings/applications/EnterpriseDefaultAppsTest.java
index 10caf13..8014dbb 100644
--- a/tests/robotests/src/com/android/settings/applications/EnterpriseDefaultAppsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/EnterpriseDefaultAppsTest.java
@@ -27,7 +27,7 @@
import static junit.framework.Assert.assertTrue;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class EnterpriseDefaultAppsTest {
@Test
public void testNumberOfIntentsCorrelateWithUI() throws Exception {
diff --git a/tests/robotests/src/com/android/settings/applications/FetchPackageStorageAsyncLoaderTest.java b/tests/robotests/src/com/android/settings/applications/FetchPackageStorageAsyncLoaderTest.java
index 3269acb..d34b2eb 100644
--- a/tests/robotests/src/com/android/settings/applications/FetchPackageStorageAsyncLoaderTest.java
+++ b/tests/robotests/src/com/android/settings/applications/FetchPackageStorageAsyncLoaderTest.java
@@ -44,7 +44,7 @@
import java.io.IOException;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class FetchPackageStorageAsyncLoaderTest {
private static final String PACKAGE_NAME = "com.test.package";
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java b/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java
index 58c4386..def8758 100644
--- a/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java
+++ b/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java
@@ -61,7 +61,7 @@
* Tests for {@link InstalledAppCounter}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {ShadowUserManager.class})
public final class InstalledAppCounterTest {
diff --git a/tests/robotests/src/com/android/settings/applications/InstalledAppDetailsTest.java b/tests/robotests/src/com/android/settings/applications/InstalledAppDetailsTest.java
index 58a9577..b8a27b9 100644
--- a/tests/robotests/src/com/android/settings/applications/InstalledAppDetailsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/InstalledAppDetailsTest.java
@@ -17,6 +17,7 @@
package com.android.settings.applications;
import static com.google.common.truth.Truth.assertThat;
+
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.anyDouble;
import static org.mockito.Matchers.anyInt;
@@ -83,9 +84,9 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(
- manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
- shadows = InstalledAppDetailsTest.ShadowUtils.class
+ manifest = TestConfig.MANIFEST_PATH,
+ sdk = TestConfig.SDK_VERSION_O,
+ shadows = InstalledAppDetailsTest.ShadowUtils.class
)
public final class InstalledAppDetailsTest {
@@ -192,7 +193,7 @@
when(stats.getTotalBytes()).thenReturn(1L);
assertThat(InstalledAppDetails.getStorageSummary(context, stats, true))
- .isEqualTo("1.00 B used in external storage");
+ .isEqualTo("1 B used in external storage");
}
@Test
@@ -202,7 +203,7 @@
when(stats.getTotalBytes()).thenReturn(1L);
assertThat(InstalledAppDetails.getStorageSummary(context, stats, false))
- .isEqualTo("1.00 B used in internal storage");
+ .isEqualTo("1 B used in internal storage");
}
@Test
diff --git a/tests/robotests/src/com/android/settings/applications/InstalledAppListerTest.java b/tests/robotests/src/com/android/settings/applications/InstalledAppListerTest.java
index c74deae..6a5cfeb 100644
--- a/tests/robotests/src/com/android/settings/applications/InstalledAppListerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/InstalledAppListerTest.java
@@ -57,7 +57,7 @@
* Tests for {@link InstalledAppLister}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class InstalledAppListerTest {
private final String APP_1 = "app1";
diff --git a/tests/robotests/src/com/android/settings/applications/NotificationAppsTest.java b/tests/robotests/src/com/android/settings/applications/NotificationAppsTest.java
index 11d757f..735a811 100644
--- a/tests/robotests/src/com/android/settings/applications/NotificationAppsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/NotificationAppsTest.java
@@ -49,7 +49,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class NotificationAppsTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/applications/PictureInPictureDetailsTest.java b/tests/robotests/src/com/android/settings/applications/PictureInPictureDetailsTest.java
index 02b8c7a..b998b81e 100644
--- a/tests/robotests/src/com/android/settings/applications/PictureInPictureDetailsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/PictureInPictureDetailsTest.java
@@ -39,7 +39,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class PictureInPictureDetailsTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/PictureInPictureSettingsTest.java b/tests/robotests/src/com/android/settings/applications/PictureInPictureSettingsTest.java
index d379dbd..85b398a 100644
--- a/tests/robotests/src/com/android/settings/applications/PictureInPictureSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/PictureInPictureSettingsTest.java
@@ -51,7 +51,7 @@
import java.util.Collections;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class PictureInPictureSettingsTest {
private static final int PRIMARY_USER_ID = 0;
diff --git a/tests/robotests/src/com/android/settings/applications/PremiumSmsAccessTest.java b/tests/robotests/src/com/android/settings/applications/PremiumSmsAccessTest.java
index 30ebcde..dedb61d 100644
--- a/tests/robotests/src/com/android/settings/applications/PremiumSmsAccessTest.java
+++ b/tests/robotests/src/com/android/settings/applications/PremiumSmsAccessTest.java
@@ -38,7 +38,7 @@
import org.robolectric.shadows.ShadowApplication;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class PremiumSmsAccessTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java
index 5e85f9b..d0d8a3b 100644
--- a/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java
@@ -16,13 +16,30 @@
package com.android.settings.applications;
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
import android.app.Application;
import android.app.usage.UsageStats;
import android.app.usage.UsageStatsManager;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
-import android.content.res.Configuration;
import android.os.UserHandle;
import android.os.UserManager;
import android.support.v7.preference.Preference;
@@ -31,14 +48,13 @@
import android.text.TextUtils;
import com.android.settings.R;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.applications.ApplicationsState;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Answers;
import org.mockito.ArgumentMatcher;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -47,25 +63,9 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.Locale;
-
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class RecentAppsPreferenceControllerTest {
@Mock
@@ -76,14 +76,18 @@
private Preference mSeeAllPref;
@Mock
private PreferenceCategory mDivider;
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private Context mMockContext;
@Mock
private UsageStatsManager mUsageStatsManager;
@Mock
private UserManager mUserManager;
@Mock
private ApplicationsState mAppState;
+ @Mock
+ private PackageManager mPackageManager;
+ @Mock
+ private ApplicationsState.AppEntry mAppEntry;
+ @Mock
+ private ApplicationInfo mApplicationInfo;
private Context mContext;
private RecentAppsPreferenceController mController;
@@ -91,12 +95,11 @@
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
- when(mMockContext.getSystemService(Context.USAGE_STATS_SERVICE))
- .thenReturn(mUsageStatsManager);
- when(mMockContext.getSystemService(Context.USER_SERVICE))
- .thenReturn(mUserManager);
+ mContext = spy(RuntimeEnvironment.application);
+ doReturn(mUsageStatsManager).when(mContext).getSystemService(Context.USAGE_STATS_SERVICE);
+ doReturn(mUserManager).when(mContext).getSystemService(Context.USER_SERVICE);
+ doReturn(mPackageManager).when(mContext).getPackageManager();
- mContext = RuntimeEnvironment.application;
mController = new RecentAppsPreferenceController(mContext, mAppState, null);
when(mScreen.findPreference(anyString())).thenReturn(mCategory);
@@ -125,7 +128,7 @@
@Test
public void onDisplayAndUpdateState_shouldRefreshUi() {
mController = spy(
- new RecentAppsPreferenceController(mMockContext, (Application) null, null));
+ new RecentAppsPreferenceController(mContext, (Application) null, null));
doNothing().when(mController).refreshUi(mContext);
@@ -136,11 +139,8 @@
}
@Test
+ @Config(qualifiers = "mcc999")
public void display_shouldNotShowRecents_showAppInfoPreference() {
- mController = new RecentAppsPreferenceController(mMockContext, mAppState, null);
- when(mMockContext.getResources().getBoolean(R.bool.config_display_recent_apps))
- .thenReturn(false);
-
mController.displayPreference(mScreen);
verify(mCategory, never()).addPreference(any(Preference.class));
@@ -152,8 +152,6 @@
@Test
public void display_showRecents() {
- when(mMockContext.getResources().getBoolean(R.bool.config_display_recent_apps))
- .thenReturn(true);
final List<UsageStats> stats = new ArrayList<>();
final UsageStats stat1 = new UsageStats();
final UsageStats stat2 = new UsageStats();
@@ -172,20 +170,17 @@
// stat1, stat2 are valid apps. stat3 is invalid.
when(mAppState.getEntry(stat1.mPackageName, UserHandle.myUserId()))
- .thenReturn(mock(ApplicationsState.AppEntry.class));
+ .thenReturn(mAppEntry);
when(mAppState.getEntry(stat2.mPackageName, UserHandle.myUserId()))
- .thenReturn(mock(ApplicationsState.AppEntry.class));
+ .thenReturn(mAppEntry);
when(mAppState.getEntry(stat3.mPackageName, UserHandle.myUserId()))
.thenReturn(null);
- when(mMockContext.getPackageManager().resolveActivity(any(Intent.class), anyInt()))
- .thenReturn(new ResolveInfo());
+ when(mPackageManager.resolveActivity(any(Intent.class), anyInt())).thenReturn(
+ new ResolveInfo());
when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong()))
.thenReturn(stats);
- final Configuration configuration = new Configuration();
- configuration.locale = Locale.US;
- when(mMockContext.getResources().getConfiguration()).thenReturn(configuration);
+ mAppEntry.info = mApplicationInfo;
- mController = new RecentAppsPreferenceController(mMockContext, mAppState, null);
mController.displayPreference(mScreen);
verify(mCategory).setTitle(R.string.recent_app_category_title);
@@ -200,8 +195,6 @@
@Test
public void display_hasRecentButNoneDisplayable_showAppInfo() {
- when(mMockContext.getResources().getBoolean(R.bool.config_display_recent_apps))
- .thenReturn(true);
final List<UsageStats> stats = new ArrayList<>();
final UsageStats stat1 = new UsageStats();
final UsageStats stat2 = new UsageStats();
@@ -218,12 +211,11 @@
.thenReturn(mock(ApplicationsState.AppEntry.class));
when(mAppState.getEntry(stat2.mPackageName, UserHandle.myUserId()))
.thenReturn(mock(ApplicationsState.AppEntry.class));
- when(mMockContext.getPackageManager().resolveActivity(any(Intent.class), anyInt()))
- .thenReturn(new ResolveInfo());
+ when(mPackageManager.resolveActivity(any(Intent.class), anyInt())).thenReturn(
+ new ResolveInfo());
when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong()))
.thenReturn(stats);
- mController = new RecentAppsPreferenceController(mMockContext, mAppState, null);
mController.displayPreference(mScreen);
verify(mCategory, never()).addPreference(any(Preference.class));
@@ -234,8 +226,6 @@
@Test
public void display_showRecents_formatSummary() {
- when(mMockContext.getResources().getBoolean(R.bool.config_display_recent_apps))
- .thenReturn(true);
final List<UsageStats> stats = new ArrayList<>();
final UsageStats stat1 = new UsageStats();
stat1.mLastTimeUsed = System.currentTimeMillis();
@@ -243,17 +233,13 @@
stats.add(stat1);
when(mAppState.getEntry(stat1.mPackageName, UserHandle.myUserId()))
- .thenReturn(mock(ApplicationsState.AppEntry.class));
- when(mMockContext.getPackageManager().resolveActivity(any(Intent.class), anyInt()))
- .thenReturn(new ResolveInfo());
+ .thenReturn(mAppEntry);
+ when(mPackageManager.resolveActivity(any(Intent.class), anyInt())).thenReturn(
+ new ResolveInfo());
when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong()))
- .thenReturn(stats);
+ .thenReturn(stats);
+ mAppEntry.info = mApplicationInfo;
- final Configuration configuration = new Configuration();
- configuration.locale = Locale.US;
- when(mMockContext.getResources().getConfiguration()).thenReturn(configuration);
-
- mController = new RecentAppsPreferenceController(mMockContext, mAppState, null);
mController.displayPreference(mScreen);
verify(mCategory).addPreference(argThat(summaryMatches("0 min. ago")));
diff --git a/tests/robotests/src/com/android/settings/applications/SpecialAppAccessPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/SpecialAppAccessPreferenceControllerTest.java
index f17addd..09bfc29 100644
--- a/tests/robotests/src/com/android/settings/applications/SpecialAppAccessPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/SpecialAppAccessPreferenceControllerTest.java
@@ -36,7 +36,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SpecialAppAccessPreferenceControllerTest {
private Context mContext;
@Mock
diff --git a/tests/robotests/src/com/android/settings/applications/UsageAccessDetailsTest.java b/tests/robotests/src/com/android/settings/applications/UsageAccessDetailsTest.java
index 1a3aeb5..64ef4ff 100644
--- a/tests/robotests/src/com/android/settings/applications/UsageAccessDetailsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/UsageAccessDetailsTest.java
@@ -41,7 +41,7 @@
import org.robolectric.shadows.ShadowApplication;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class UsageAccessDetailsTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/VrListenerSettingsTest.java b/tests/robotests/src/com/android/settings/applications/VrListenerSettingsTest.java
index d2f1bbd..5f9ec95 100644
--- a/tests/robotests/src/com/android/settings/applications/VrListenerSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/VrListenerSettingsTest.java
@@ -36,7 +36,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class VrListenerSettingsTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/WriteSettingsDetailsTest.java b/tests/robotests/src/com/android/settings/applications/WriteSettingsDetailsTest.java
index a995394..6cd07e3 100644
--- a/tests/robotests/src/com/android/settings/applications/WriteSettingsDetailsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/WriteSettingsDetailsTest.java
@@ -36,7 +36,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WriteSettingsDetailsTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/assist/AssistContextPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/assist/AssistContextPreferenceControllerTest.java
index c59ac18..253d6ea 100644
--- a/tests/robotests/src/com/android/settings/applications/assist/AssistContextPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/assist/AssistContextPreferenceControllerTest.java
@@ -46,7 +46,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AssistContextPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/applications/assist/AssistFlashScreenPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/assist/AssistFlashScreenPreferenceControllerTest.java
index 1dec8d0..e062291 100644
--- a/tests/robotests/src/com/android/settings/applications/assist/AssistFlashScreenPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/assist/AssistFlashScreenPreferenceControllerTest.java
@@ -51,7 +51,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AssistFlashScreenPreferenceControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/assist/AssistSettingObserverTest.java b/tests/robotests/src/com/android/settings/applications/assist/AssistSettingObserverTest.java
index f0956c7..431cfba 100644
--- a/tests/robotests/src/com/android/settings/applications/assist/AssistSettingObserverTest.java
+++ b/tests/robotests/src/com/android/settings/applications/assist/AssistSettingObserverTest.java
@@ -29,7 +29,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AssistSettingObserverTest {
private AssistSettingObserver mObserver;
diff --git a/tests/robotests/src/com/android/settings/applications/assist/DefaultAssistPickerTest.java b/tests/robotests/src/com/android/settings/applications/assist/DefaultAssistPickerTest.java
index 65f0b46..1018872 100644
--- a/tests/robotests/src/com/android/settings/applications/assist/DefaultAssistPickerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/assist/DefaultAssistPickerTest.java
@@ -40,7 +40,7 @@
import static org.mockito.Mockito.spy;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultAssistPickerTest {
private static ComponentName sTestAssist;
diff --git a/tests/robotests/src/com/android/settings/applications/assist/DefaultAssistPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/assist/DefaultAssistPreferenceControllerTest.java
index 180abbb..199862f 100644
--- a/tests/robotests/src/com/android/settings/applications/assist/DefaultAssistPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/assist/DefaultAssistPreferenceControllerTest.java
@@ -56,7 +56,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultAssistPreferenceControllerTest {
private static final String TEST_KEY = "test_pref_key";
diff --git a/tests/robotests/src/com/android/settings/applications/assist/ManageAssistTest.java b/tests/robotests/src/com/android/settings/applications/assist/ManageAssistTest.java
index 1b4fb09..6abf09d 100644
--- a/tests/robotests/src/com/android/settings/applications/assist/ManageAssistTest.java
+++ b/tests/robotests/src/com/android/settings/applications/assist/ManageAssistTest.java
@@ -29,7 +29,7 @@
import static com.google.common.truth.Truth.assertThat;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ManageAssistTest {
private ManageAssist mSettings;
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppInfoTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppInfoTest.java
index d4cd6da..0b933c6 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppInfoTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppInfoTest.java
@@ -17,11 +17,17 @@
package com.android.settings.applications.defaultapps;
import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.content.ComponentName;
import android.content.Context;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageItemInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
@@ -39,7 +45,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultAppInfoTest {
@Mock
@@ -50,15 +56,24 @@
private PackageManager mPackageManager;
@Mock
private PackageManagerWrapper mPackageManagerWrapper;
+ @Mock
+ private ApplicationInfo mApplicationInfo;
+ @Mock
+ private Drawable mIcon;
private Context mContext;
private DefaultAppInfo mInfo;
@Before
- public void setUp() {
+ public void setUp() throws PackageManager.NameNotFoundException {
MockitoAnnotations.initMocks(this);
- mContext = RuntimeEnvironment.application;
+ mContext = spy(RuntimeEnvironment.application);
+ doReturn(mPackageManager).when(mContext).getPackageManager();
when(mPackageManagerWrapper.getPackageManager()).thenReturn(mPackageManager);
+ when(mPackageManagerWrapper.getApplicationInfoAsUser(anyString(), anyInt(),
+ anyInt())).thenReturn(mApplicationInfo);
+ when(mPackageManager.loadUnbadgedItemIcon(mPackageItemInfo, mApplicationInfo)).thenReturn(
+ mIcon);
}
@Test
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragmentTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragmentTest.java
index 42a6225..804df51 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragmentTest.java
@@ -51,7 +51,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultAppPickerFragmentTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceControllerTest.java
index a02a2de..f16c05e 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceControllerTest.java
@@ -39,7 +39,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultAppPreferenceControllerTest {
private static final String TEST_APP_NAME = "test";
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPickerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPickerTest.java
index 06d3b8b..61d7f34 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPickerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPickerTest.java
@@ -43,7 +43,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultAutofillPickerTest {
private static final String TEST_APP_KEY = "foo.bar/foo.bar.Baz";
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceControllerTest.java
index bc72ee4..8a181d8 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceControllerTest.java
@@ -46,7 +46,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultAutofillPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPickerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPickerTest.java
index e8a6c1e..934c4c6 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPickerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPickerTest.java
@@ -39,7 +39,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultBrowserPickerTest {
private static final String TEST_APP_KEY = "";
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java
index 8d527ff..b3406a1 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java
@@ -48,7 +48,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultBrowserPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultEmergencyPickerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultEmergencyPickerTest.java
index 124817a..d499ac2 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultEmergencyPickerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultEmergencyPickerTest.java
@@ -41,7 +41,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultEmergencyPickerTest {
private static final String TEST_APP_KEY = "test_app";
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePickerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePickerTest.java
index 4b82f1a..4680a08 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePickerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePickerTest.java
@@ -59,7 +59,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultHomePickerTest {
private static final String TEST_APP_KEY = "com.android.settings/DefaultEmergencyPickerTest";
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceControllerTest.java
index 8a8cc29..cf19655 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceControllerTest.java
@@ -51,7 +51,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultHomePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPaymentSettingsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPaymentSettingsPreferenceControllerTest.java
index 6a73269..025d50a 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPaymentSettingsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPaymentSettingsPreferenceControllerTest.java
@@ -42,7 +42,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultPaymentSettingsPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPhonePickerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPhonePickerTest.java
index f2b7db8..b1bea25 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPhonePickerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPhonePickerTest.java
@@ -43,7 +43,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultPhonePickerTest {
private static final String TEST_APP_KEY = "com.android.settings/PickerTest";
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultSmsPickerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultSmsPickerTest.java
index 91e68ea..e9bdfe3 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultSmsPickerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultSmsPickerTest.java
@@ -42,7 +42,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultSmsPickerTest {
private static final String TEST_APP_KEY = "com.android.settings/PickerTest";
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterItemTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterItemTest.java
index 982fb56..2dde6f4 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterItemTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterItemTest.java
@@ -35,7 +35,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppFilterItemTest {
@Test
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterRegistryTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterRegistryTest.java
index 3fe5e67..ccd8470 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterRegistryTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterRegistryTest.java
@@ -60,7 +60,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppFilterRegistryTest {
@Test
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/ApplicationViewHolderTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/ApplicationViewHolderTest.java
index c32b262..ebc0ddc 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/ApplicationViewHolderTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/ApplicationViewHolderTest.java
@@ -37,7 +37,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ApplicationViewHolderTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
index dfe8e4c..d208194 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
@@ -73,7 +73,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
// TODO: Consider making the shadow class set global using a robolectric.properties file.
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {
SettingsShadowResources.class,
SettingsShadowTheme.class,
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/MusicViewHolderControllerTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/MusicViewHolderControllerTest.java
index fc761cc..c7f2f53 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/MusicViewHolderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/MusicViewHolderControllerTest.java
@@ -17,6 +17,7 @@
package com.android.settings.applications.manageapplications;
import static com.google.common.truth.Truth.assertThat;
+
import static org.mockito.Matchers.nullable;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -27,6 +28,7 @@
import android.os.UserHandle;
import android.os.storage.VolumeInfo;
import android.provider.DocumentsContract;
+import android.text.format.Formatter;
import android.view.View;
import android.widget.FrameLayout;
@@ -46,7 +48,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class MusicViewHolderControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private Fragment mFragment;
@@ -75,7 +77,8 @@
public void storageShouldBeZeroBytesIfQueriedBeforeStorageQueryFinishes() {
mController.setupView(mHolder);
- assertThat(mHolder.mSummary.getText().toString()).isEqualTo("0.00 B");
+ assertThat(mHolder.mSummary.getText().toString()).isEqualTo(
+ Formatter.formatFileSize(mContext, 0));
}
@Test
@@ -86,7 +89,8 @@
mController.queryStats();
mController.setupView(mHolder);
- assertThat(mHolder.mSummary.getText().toString()).isEqualTo("1.00 B");
+ assertThat(mHolder.mSummary.getText().toString()).isEqualTo(
+ Formatter.formatFileSize(mContext, 1));
}
@Test
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/PhotosViewHolderControllerTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/PhotosViewHolderControllerTest.java
index 0a147ac..fd25921 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/PhotosViewHolderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/PhotosViewHolderControllerTest.java
@@ -17,6 +17,7 @@
package com.android.settings.applications.manageapplications;
import static com.google.common.truth.Truth.assertThat;
+
import static org.mockito.Matchers.nullable;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -26,6 +27,7 @@
import android.content.Intent;
import android.os.UserHandle;
import android.os.storage.VolumeInfo;
+import android.text.format.Formatter;
import android.view.View;
import android.widget.FrameLayout;
@@ -44,11 +46,12 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class PhotosViewHolderControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private Fragment mFragment;
- @Mock private StorageStatsSource mSource;
+ @Mock
+ private StorageStatsSource mSource;
private Context mContext;
private PhotosViewHolderController mController;
@@ -74,7 +77,8 @@
public void storageShouldBeZeroBytesIfQueriedBeforeStorageQueryFinishes() {
mController.setupView(mHolder);
- assertThat(mHolder.mSummary.getText().toString()).isEqualTo("0.00 B");
+ assertThat(mHolder.mSummary.getText().toString()).isEqualTo(
+ Formatter.formatFileSize(mContext, 0));
}
@Test
@@ -85,7 +89,8 @@
mController.queryStats();
mController.setupView(mHolder);
- assertThat(mHolder.mSummary.getText().toString()).isEqualTo("11.00 B");
+ assertThat(mHolder.mSummary.getText().toString()).isEqualTo(
+ Formatter.formatFileSize(mContext, 11));
}
@Test
diff --git a/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityPreferenceControllerTest.java
index 5fc3ebc..39cc9a2 100644
--- a/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityPreferenceControllerTest.java
@@ -45,7 +45,7 @@
import org.robolectric.annotation.Implements;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {BackupSettingsActivityPreferenceControllerTest.ShadowBackupManager.class})
public class BackupSettingsActivityPreferenceControllerTest {
private static final String KEY_BACKUP_SETTINGS = "backup_settings";
diff --git a/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityTest.java b/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityTest.java
index 44c7e10..cf3cb53 100644
--- a/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityTest.java
+++ b/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityTest.java
@@ -58,7 +58,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {BackupSettingsActivityTest.ShadowBackupSettingsHelper.class,
BackupSettingsActivityTest.ShadowUserHandle.class})
public class BackupSettingsActivityTest {
diff --git a/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java b/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java
index 9de0c6a..eb33cd6 100644
--- a/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java
+++ b/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java
@@ -50,7 +50,7 @@
import com.android.settingslib.drawer.SettingsDrawerActivity;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {BackupSettingsHelperTest.ShadowBackupManagerStub.class})
public class BackupSettingsHelperTest {
diff --git a/tests/robotests/src/com/android/settings/backup/BackupSettingsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/backup/BackupSettingsPreferenceControllerTest.java
index 3ad49e7..83d9709 100644
--- a/tests/robotests/src/com/android/settings/backup/BackupSettingsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/backup/BackupSettingsPreferenceControllerTest.java
@@ -41,7 +41,7 @@
import android.support.v7.preference.PreferenceScreen;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {BackupSettingsPreferenceControllerTest.ShadowBackupSettingsHelper.class})
public class BackupSettingsPreferenceControllerTest {
private static final String BACKUP_SETTINGS = "backup_settings";
diff --git a/tests/robotests/src/com/android/settings/bluetooth/AlwaysDiscoverableTest.java b/tests/robotests/src/com/android/settings/bluetooth/AlwaysDiscoverableTest.java
index fd46b4b..3cc90bd 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/AlwaysDiscoverableTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/AlwaysDiscoverableTest.java
@@ -41,7 +41,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AlwaysDiscoverableTest {
@Mock
private LocalBluetoothAdapter mLocalAdapter;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsButtonsControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsButtonsControllerTest.java
index 7b0a3f23..e7ce7e0 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsButtonsControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsButtonsControllerTest.java
@@ -43,7 +43,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = SettingsShadowBluetoothDevice.class)
public class BluetoothDetailsButtonsControllerTest extends BluetoothDetailsControllerTestBase {
private BluetoothDetailsButtonsController mController;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsControllerTestBase.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsControllerTestBase.java
index 33a5ed5..b03ecc1 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsControllerTestBase.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsControllerTestBase.java
@@ -28,14 +28,20 @@
import android.support.v7.preference.PreferenceScreen;
import com.android.settings.R;
+import com.android.settings.TestConfig;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.Before;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothDetailsControllerTestBase {
protected Context mContext;
protected Lifecycle mLifecycle;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java
index 544b590..cd07a90 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java
@@ -53,7 +53,7 @@
import org.robolectric.fakes.RoboMenu;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothDeviceDetailsFragmentTest {
private BluetoothDeviceDetailsFragment mFragment;
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceNamePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceNamePreferenceControllerTest.java
index 2e094e2..93de52d 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceNamePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceNamePreferenceControllerTest.java
@@ -40,7 +40,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothDeviceNamePreferenceControllerTest {
private static final String DEVICE_NAME = "Nightshade";
private static final int ORDER = 1;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java
index bc1151b..3dd97bb 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java
@@ -49,7 +49,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = SettingsShadowResources.class)
public class BluetoothDevicePreferenceTest {
private static final boolean SHOW_DEVICES_WITHOUT_NAMES = true;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceRenamePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceRenamePreferenceControllerTest.java
index cde95cd..186e274 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceRenamePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceRenamePreferenceControllerTest.java
@@ -43,7 +43,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothDeviceRenamePreferenceControllerTest {
private static final String DEVICE_NAME = "Nightshade";
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java
new file mode 100644
index 0000000..525f70e
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2017 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.bluetooth;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
+import android.bluetooth.BluetoothDevice;
+import android.content.Context;
+import android.support.v7.preference.Preference;
+
+import com.android.settings.R;
+import com.android.settings.SettingsActivity;
+import com.android.settings.TestConfig;
+import com.android.settings.connecteddevice.DevicePreferenceCallback;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settingslib.bluetooth.CachedBluetoothDevice;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
+public class BluetoothDeviceUpdaterTest {
+ @Mock
+ private DashboardFragment mDashboardFragment;
+ @Mock
+ private DevicePreferenceCallback mDevicePreferenceCallback;
+ @Mock
+ private CachedBluetoothDevice mCachedBluetoothDevice;
+ @Mock
+ private BluetoothDevice mBluetoothDevice;
+ @Mock
+ private SettingsActivity mSettingsActivity;
+
+ private Context mContext;
+ private BluetoothDeviceUpdater mBluetoothDeviceUpdater;
+ private BluetoothDevicePreference mPreference;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+
+ mContext = RuntimeEnvironment.application;
+ doReturn(mContext).when(mDashboardFragment).getContext();
+ doReturn(mBluetoothDevice).when(mCachedBluetoothDevice).getDevice();
+
+ mPreference = new BluetoothDevicePreference(mContext, mCachedBluetoothDevice, false);
+ mBluetoothDeviceUpdater = new BluetoothDeviceUpdater(mDashboardFragment,
+ mDevicePreferenceCallback, null) {
+ @Override
+ public void update(CachedBluetoothDevice cachedBluetoothDevice) {
+ // do nothing
+ }
+ };
+ mBluetoothDeviceUpdater.setPrefContext(mContext);
+ }
+
+ @Test
+ public void testAddPreference_deviceExist_doNothing() {
+ mBluetoothDeviceUpdater.mPreferenceMap.put(mBluetoothDevice, mPreference);
+
+ mBluetoothDeviceUpdater.addPreference(mCachedBluetoothDevice);
+
+ verify(mDevicePreferenceCallback, never()).onDeviceAdded(any(Preference.class));
+ }
+
+ @Test
+ public void testAddPreference_deviceNotExist_addPreference() {
+ mBluetoothDeviceUpdater.addPreference(mCachedBluetoothDevice);
+
+ verify(mDevicePreferenceCallback).onDeviceAdded(any(Preference.class));
+ assertThat(mBluetoothDeviceUpdater.mPreferenceMap.containsKey(mBluetoothDevice)).isTrue();
+ }
+
+ @Test
+ public void testRemovePreference_deviceExist_removePreference() {
+ mBluetoothDeviceUpdater.mPreferenceMap.put(mBluetoothDevice, mPreference);
+
+ mBluetoothDeviceUpdater.removePreference(mCachedBluetoothDevice);
+
+ verify(mDevicePreferenceCallback).onDeviceRemoved(mPreference);
+ assertThat(mBluetoothDeviceUpdater.mPreferenceMap.containsKey(mBluetoothDevice)).isFalse();
+ }
+
+ @Test
+ public void testRemovePreference_deviceNotExist_doNothing() {
+ mBluetoothDeviceUpdater.removePreference(mCachedBluetoothDevice);
+
+ verify(mDevicePreferenceCallback, never()).onDeviceRemoved(any(Preference.class));
+ }
+
+ @Test
+ public void testDeviceProfilesListener_click_startBluetoothDeviceDetailPage() {
+ doReturn(mSettingsActivity).when(mDashboardFragment).getActivity();
+
+ mBluetoothDeviceUpdater.mDeviceProfilesListener.onGearClick(mPreference);
+
+ verify(mSettingsActivity).startPreferencePanel(eq(mDashboardFragment),
+ eq(BluetoothDeviceDetailsFragment.class.getName()), any(),
+ eq(R.string.device_details_title), eq(null), eq(null), eq(0));
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java
index b973edb..102f0a7 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java
@@ -58,7 +58,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION, shadows = {
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O, shadows = {
SettingsShadowResources.class, SettingsShadowResources.SettingsShadowTheme.class
})
public class BluetoothEnablerTest {
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothFilesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothFilesPreferenceControllerTest.java
index cdaf876..ed63fc4 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothFilesPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothFilesPreferenceControllerTest.java
@@ -35,7 +35,7 @@
import org.robolectric.shadows.ShadowApplication;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothFilesPreferenceControllerTest {
private Context mContext;
private BluetoothFilesPreferenceController mController;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothMasterSwitchPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothMasterSwitchPreferenceControllerTest.java
index c9d5746..534cace 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothMasterSwitchPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothMasterSwitchPreferenceControllerTest.java
@@ -47,7 +47,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothMasterSwitchPreferenceControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDetailTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDetailTest.java
index d1d4935..2b30ae4 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDetailTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDetailTest.java
@@ -52,7 +52,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothPairingDetailTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java
index fba11de..25a24d4 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java
@@ -53,7 +53,7 @@
import org.robolectric.util.FragmentTestUtil;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows=ShadowEventLogWriter.class)
public class BluetoothPairingDialogTest {
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingPreferenceControllerTest.java
index 4459f61..192e447 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingPreferenceControllerTest.java
@@ -49,7 +49,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothPairingPreferenceControllerTest {
private static final int ORDER = 1;
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsSummaryProviderTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsSummaryProviderTest.java
index 0061ee5..e7a66fa 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsSummaryProviderTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsSummaryProviderTest.java
@@ -35,7 +35,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothSettingsSummaryProviderTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsTest.java
index c772560..b177729 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsTest.java
@@ -50,7 +50,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothSettingsTest {
private static final String FOOTAGE_MAC_STRING = "Bluetooth mac: xxxx";
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSummaryUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSummaryUpdaterTest.java
index 0c27412..cb04347 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSummaryUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSummaryUpdaterTest.java
@@ -51,7 +51,7 @@
import java.util.Set;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothSummaryUpdaterTest {
private static final String DEVICE_NAME = "Nightshade";
private static final String DEVICE_KEYBOARD_NAME = "Bluetooth Keyboard";
diff --git a/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java
new file mode 100644
index 0000000..c86664c
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2017 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.bluetooth;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.content.Context;
+
+import com.android.settings.TestConfig;
+import com.android.settings.connecteddevice.DevicePreferenceCallback;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settingslib.bluetooth.CachedBluetoothDevice;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
+public class ConnectedBluetoothDeviceUpdaterTest {
+ @Mock
+ private DashboardFragment mDashboardFragment;
+ @Mock
+ private DevicePreferenceCallback mDevicePreferenceCallback;
+ @Mock
+ private CachedBluetoothDevice mCachedBluetoothDevice;
+ @Mock
+ private BluetoothDevice mBluetoothDevice;
+
+ private Context mContext;
+ private ConnectedBluetoothDeviceUpdater mBluetoothDeviceUpdater;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+
+ mContext = RuntimeEnvironment.application;
+ doReturn(mContext).when(mDashboardFragment).getContext();
+ doReturn(mBluetoothDevice).when(mCachedBluetoothDevice).getDevice();
+
+ mBluetoothDeviceUpdater = spy(new ConnectedBluetoothDeviceUpdater(mDashboardFragment,
+ mDevicePreferenceCallback, null));
+ mBluetoothDeviceUpdater.setPrefContext(mContext);
+ doNothing().when(mBluetoothDeviceUpdater).addPreference(any());
+ doNothing().when(mBluetoothDeviceUpdater).removePreference(any());
+ }
+
+ @Test
+ public void testUpdate_filterMatch_addPreference() {
+ doReturn(BluetoothDevice.BOND_BONDED).when(mBluetoothDevice).getBondState();
+ doReturn(true).when(mBluetoothDevice).isConnected();
+
+ mBluetoothDeviceUpdater.update(mCachedBluetoothDevice);
+
+ verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice);
+ }
+
+ @Test
+ public void testUpdate_filterNotMatch_removePreference() {
+ doReturn(BluetoothDevice.BOND_NONE).when(mBluetoothDevice).getBondState();
+ doReturn(false).when(mBluetoothDevice).isConnected();
+
+ mBluetoothDeviceUpdater.update(mCachedBluetoothDevice);
+
+ verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice);
+ }
+
+ @Test
+ public void testOnConnectionStateChanged_deviceConnected_addPreference() {
+ mBluetoothDeviceUpdater.onConnectionStateChanged(mCachedBluetoothDevice,
+ BluetoothAdapter.STATE_CONNECTED);
+
+ verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice);
+ }
+
+ @Test
+ public void testOnConnectionStateChanged_deviceDisconnected_removePreference() {
+ mBluetoothDeviceUpdater.onConnectionStateChanged(mCachedBluetoothDevice,
+ BluetoothAdapter.STATE_DISCONNECTED);
+
+ verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice);
+ }
+
+}
diff --git a/tests/robotests/src/com/android/settings/bluetooth/DeviceListPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/DeviceListPreferenceFragmentTest.java
index 49efecb..169db24 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/DeviceListPreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/DeviceListPreferenceFragmentTest.java
@@ -49,7 +49,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DeviceListPreferenceFragmentTest {
private static final String FOOTAGE_MAC_STRING = "Bluetooth mac: xxxx";
diff --git a/tests/robotests/src/com/android/settings/bluetooth/DevicePickerFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/DevicePickerFragmentTest.java
index 3294ffd..f9b392e 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/DevicePickerFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/DevicePickerFragmentTest.java
@@ -30,7 +30,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DevicePickerFragmentTest {
@Mock
private LocalBluetoothAdapter mLocalAdapter;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/DeviceProfilesSettingsTest.java b/tests/robotests/src/com/android/settings/bluetooth/DeviceProfilesSettingsTest.java
index a6793bb..56454b8 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/DeviceProfilesSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/DeviceProfilesSettingsTest.java
@@ -56,7 +56,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION, shadows = {
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O, shadows = {
ShadowEventLogWriter.class
})
public class DeviceProfilesSettingsTest {
diff --git a/tests/robotests/src/com/android/settings/bluetooth/ForgetDeviceDialogFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/ForgetDeviceDialogFragmentTest.java
index 9343721..71e9933 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/ForgetDeviceDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/ForgetDeviceDialogFragmentTest.java
@@ -46,7 +46,7 @@
import org.robolectric.shadows.ShadowDialog;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ForgetDeviceDialogFragmentTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java
index a8ef4e6..65fe46c 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java
@@ -50,7 +50,7 @@
import org.robolectric.util.FragmentTestUtil;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class RemoteDeviceNameDialogFragmentTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java b/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java
index e0d4638..43583ed 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java
@@ -41,7 +41,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = SettingsShadowResources.class)
public class UtilsTest {
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment2Test.java
similarity index 97%
rename from tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java
rename to tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment2Test.java
index 4cb853e..4bcb299 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment2Test.java
@@ -50,8 +50,8 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
-public class ConnectedDeviceDashboardFragmentTest {
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
+public class ConnectedDeviceDashboardFragment2Test {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
Context mContext;
@@ -61,7 +61,7 @@
private FakeFeatureFactory mFeatureFactory;
private SmsMirroringFeatureProvider mFeatureProvider;
- private ConnectedDeviceDashboardFragment mFragment;
+ private ConnectedDeviceDashboardFragmentOld mFragment;
private TestSmsMirroringPreferenceController mSmsMirroringPreferenceController;
private static final class TestSmsMirroringPreferenceController
@@ -86,7 +86,7 @@
mFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext);
mFeatureProvider = mFeatureFactory.smsMirroringFeatureProvider;
- mFragment = new ConnectedDeviceDashboardFragment();
+ mFragment = new ConnectedDeviceDashboardFragmentOld();
when(mContext.getPackageManager()).thenReturn(mManager);
mSmsMirroringPreferenceController = new TestSmsMirroringPreferenceController(mContext);
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceGroupControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceGroupControllerTest.java
new file mode 100644
index 0000000..e18115a
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceGroupControllerTest.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2017 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.connecteddevice;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+
+import android.content.Context;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceManager;
+import android.support.v7.preference.PreferenceScreen;
+
+import com.android.settings.TestConfig;
+import com.android.settings.bluetooth.ConnectedBluetoothDeviceUpdater;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
+public class ConnectedDeviceGroupControllerTest {
+ @Mock
+ private DashboardFragment mDashboardFragment;
+ @Mock
+ private ConnectedBluetoothDeviceUpdater mConnectedBluetoothDeviceUpdater;
+ @Mock
+ private PreferenceScreen mPreferenceScreen;
+ @Mock
+ private PreferenceManager mPreferenceManager;
+
+ private PreferenceGroup mPreferenceGroup;
+ private Context mContext;
+ private Preference mPreference;
+ private ConnectedDeviceGroupController mConnectedDeviceGroupController;
+ private Lifecycle mLifecycle;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+
+ mContext = RuntimeEnvironment.application;
+ mPreference = new Preference(mContext);
+ mLifecycle = new Lifecycle(() -> mLifecycle);
+ mPreferenceGroup = spy(new PreferenceScreen(mContext, null));
+ doReturn(mPreferenceManager).when(mPreferenceGroup).getPreferenceManager();
+ doReturn(mContext).when(mDashboardFragment).getContext();
+
+ mConnectedDeviceGroupController = new ConnectedDeviceGroupController(mDashboardFragment,
+ mLifecycle, mConnectedBluetoothDeviceUpdater);
+ mConnectedDeviceGroupController.mPreferenceGroup = mPreferenceGroup;
+ }
+
+ @Test
+ public void testOnDeviceAdded_firstAdd_becomeVisible() {
+ mConnectedDeviceGroupController.onDeviceAdded(mPreference);
+
+ assertThat(mPreferenceGroup.isVisible()).isTrue();
+ }
+
+ @Test
+ public void testOnDeviceRemoved_lastRemove_becomeInvisible() {
+ mPreferenceGroup.addPreference(mPreference);
+
+ mConnectedDeviceGroupController.onDeviceRemoved(mPreference);
+
+ assertThat(mPreferenceGroup.isVisible()).isFalse();
+ }
+
+ @Test
+ public void testOnDeviceRemoved_notLastRemove_stillVisible() {
+ mPreferenceGroup.setVisible(true);
+ mPreferenceGroup.addPreference(mPreference);
+ mPreferenceGroup.addPreference(new Preference(mContext));
+
+ mConnectedDeviceGroupController.onDeviceRemoved(mPreference);
+
+ assertThat(mPreferenceGroup.isVisible()).isTrue();
+ }
+
+ @Test
+ public void testDisplayPreference_becomeInvisible() {
+ doReturn(mPreferenceGroup).when(mPreferenceScreen).findPreference(anyString());
+
+ mConnectedDeviceGroupController.displayPreference(mPreferenceScreen);
+
+ assertThat(mPreferenceGroup.isVisible()).isFalse();
+ }
+
+ @Test
+ public void testLifecycle() {
+ // register the callback in onStart()
+ mLifecycle.handleLifecycleEvent(android.arch.lifecycle.Lifecycle.Event.ON_START);
+ verify(mConnectedBluetoothDeviceUpdater).registerCallback();
+
+ // unregister the callback in onStop()
+ mLifecycle.handleLifecycleEvent(android.arch.lifecycle.Lifecycle.Event.ON_STOP);
+ verify(mConnectedBluetoothDeviceUpdater).unregisterCallback();
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/UsbModePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/UsbModePreferenceControllerTest.java
index 7edde6e..59a5172 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/UsbModePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/UsbModePreferenceControllerTest.java
@@ -26,7 +26,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class UsbModePreferenceControllerTest {
@Mock(answer = RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterTest.java
index 14da5d6..c9469a8 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterTest.java
@@ -68,7 +68,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {
SettingsShadowResources.class,
SettingsShadowResources.SettingsShadowTheme.class,
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardDataTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardDataTest.java
index cc4f741..a3483fb 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardDataTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardDataTest.java
@@ -49,7 +49,7 @@
import java.util.Objects;
@RunWith(RobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DashboardDataTest {
private static final String TEST_SUGGESTION_TITLE = "Use fingerprint";
private static final String TEST_CATEGORY_TILE_TITLE = "Display";
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java
index a977872..559e989 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java
@@ -17,10 +17,13 @@
package com.android.settings.dashboard;
import static com.google.common.truth.Truth.assertThat;
+
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.robolectric.RuntimeEnvironment.application;
@@ -30,7 +33,8 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.content.res.Resources;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
import android.graphics.drawable.Icon;
import android.os.Bundle;
@@ -60,6 +64,7 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.Robolectric;
+import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowActivity;
import org.robolectric.shadows.ShadowApplication;
@@ -69,7 +74,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = ShadowUserManager.class)
public class DashboardFeatureProviderImplTest {
@@ -79,21 +84,28 @@
private UserManager mUserManager;
@Mock
private CategoryManager mCategoryManager;
+ @Mock
+ private PackageManager mPackageManager;
private FakeFeatureFactory mFeatureFactory;
+ private Context mContext;
private DashboardFeatureProviderImpl mImpl;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
+ mContext = spy(RuntimeEnvironment.application);
+ doReturn(mPackageManager).when(mContext).getPackageManager();
+ when(mPackageManager.resolveActivity(any(Intent.class), anyInt())).thenReturn(
+ new ResolveInfo());
FakeFeatureFactory.setupForTest(mActivity);
mFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mActivity);
- mImpl = new DashboardFeatureProviderImpl(mActivity);
+ mImpl = new DashboardFeatureProviderImpl(mContext);
}
@Test
public void shouldHoldAppContext() {
- assertThat(mImpl.mContext).isEqualTo(mActivity.getApplicationContext());
+ assertThat(mImpl.mContext).isEqualTo(mContext.getApplicationContext());
}
@Test
@@ -342,7 +354,7 @@
}
@Test
- public void bindPreference_withIntentActionMetatdata_shouldSetLaunchAction() {
+ public void bindPreference_withIntentActionMetadata_shouldSetLaunchAction() {
Activity activity = Robolectric.buildActivity(Activity.class).get();
final ShadowApplication application = ShadowApplication.getInstance();
final Preference preference = new Preference(application.getApplicationContext());
@@ -437,14 +449,13 @@
}
@Test
- public void testShouldTintIcon_shouldReturnValueFromResource() {
- final Resources res = mActivity.getApplicationContext().getResources();
- when(res.getBoolean(R.bool.config_tintSettingIcon))
- .thenReturn(false);
- assertThat(mImpl.shouldTintIcon()).isFalse();
-
- when(res.getBoolean(R.bool.config_tintSettingIcon))
- .thenReturn(true);
+ public void testShouldTintIcon_enabledInResources_shouldBeTrue() {
assertThat(mImpl.shouldTintIcon()).isTrue();
}
+
+ @Test
+ @Config(qualifiers = "mcc999")
+ public void testShouldTintIcon_disabledInResources_shouldBeFalse() {
+ assertThat(mImpl.shouldTintIcon()).isFalse();
+ }
}
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
index 9ba0807..2ee1837 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
@@ -58,7 +58,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DashboardFragmentTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardItemAnimatorTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardItemAnimatorTest.java
index cda9a22..bb24435 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardItemAnimatorTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardItemAnimatorTest.java
@@ -31,7 +31,7 @@
import static com.google.common.truth.Truth.assertThat;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DashboardItemAnimatorTest {
private DashboardItemAnimator mDashboardItemAnimator;
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardSummaryTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardSummaryTest.java
index f3ed57c..2437565 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardSummaryTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardSummaryTest.java
@@ -47,7 +47,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DashboardSummaryTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardTilePlaceholderPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardTilePlaceholderPreferenceControllerTest.java
index c48f30c..6ea3222 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardTilePlaceholderPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardTilePlaceholderPreferenceControllerTest.java
@@ -37,7 +37,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DashboardTilePlaceholderPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/dashboard/SummaryLoaderTest.java b/tests/robotests/src/com/android/settings/dashboard/SummaryLoaderTest.java
index 44b6139..92ed7b4 100644
--- a/tests/robotests/src/com/android/settings/dashboard/SummaryLoaderTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/SummaryLoaderTest.java
@@ -41,7 +41,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SummaryLoaderTest {
private static final String SUMMARY_1 = "summary1";
diff --git a/tests/robotests/src/com/android/settings/dashboard/SupportItemAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/SupportItemAdapterTest.java
index 3dd5266..52c8fbb 100644
--- a/tests/robotests/src/com/android/settings/dashboard/SupportItemAdapterTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/SupportItemAdapterTest.java
@@ -49,7 +49,7 @@
import static org.robolectric.Shadows.shadowOf;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SupportItemAdapterTest {
private static final String ACCOUNT_TYPE = "com.google";
private final Account USER_1 = new Account("user1", ACCOUNT_TYPE);
diff --git a/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionAdapterTest.java
index d943fe3..03165c6 100644
--- a/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionAdapterTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionAdapterTest.java
@@ -43,7 +43,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ConditionAdapterTest {
@Mock
private Condition mCondition1;
diff --git a/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionTest.java b/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionTest.java
index d077e6f..623f762 100644
--- a/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionTest.java
@@ -41,7 +41,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ConditionTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/dashboard/conditional/DndConditionTest.java b/tests/robotests/src/com/android/settings/dashboard/conditional/DndConditionTest.java
index e46ae9e..aa81a1c 100644
--- a/tests/robotests/src/com/android/settings/dashboard/conditional/DndConditionTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/conditional/DndConditionTest.java
@@ -35,7 +35,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DndConditionTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/EventStoreTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/EventStoreTest.java
index 114ee2b..9598c1e 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/EventStoreTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/EventStoreTest.java
@@ -29,7 +29,7 @@
import org.robolectric.RuntimeEnvironment;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class EventStoreTest {
private EventStore mEventStore;
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java
index 1a170c8..b052527 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java
@@ -62,7 +62,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SuggestionAdapterTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionControllerMixinTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionControllerMixinTest.java
index c48978c..ad97e18 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionControllerMixinTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionControllerMixinTest.java
@@ -43,7 +43,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {
ShadowSuggestionController.class
})
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionDismissControllerTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionDismissControllerTest.java
index 4aced2f..c94f200 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionDismissControllerTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionDismissControllerTest.java
@@ -46,7 +46,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SuggestionDismissControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionFeaturizerTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionFeaturizerTest.java
index 4d6a743..f5e342b 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionFeaturizerTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionFeaturizerTest.java
@@ -32,7 +32,7 @@
import org.robolectric.RuntimeEnvironment;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SuggestionFeaturizerTest {
private EventStore mEventStore;
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionRankerTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionRankerTest.java
index 1f32531..3698e4e 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionRankerTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionRankerTest.java
@@ -41,7 +41,7 @@
import static org.mockito.Mockito.spy;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SuggestionRankerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionStateProviderTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionStateProviderTest.java
index 2122d54..6ddba03 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionStateProviderTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionStateProviderTest.java
@@ -38,7 +38,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SuggestionStateProviderTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/datausage/AppDataUsagePreferenceTest.java b/tests/robotests/src/com/android/settings/datausage/AppDataUsagePreferenceTest.java
index 15ca6e4..4f7e216 100644
--- a/tests/robotests/src/com/android/settings/datausage/AppDataUsagePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/AppDataUsagePreferenceTest.java
@@ -39,7 +39,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = ShadowThreadUtils.class)
public class AppDataUsagePreferenceTest {
diff --git a/tests/robotests/src/com/android/settings/datausage/AppDataUsageTest.java b/tests/robotests/src/com/android/settings/datausage/AppDataUsageTest.java
index 26071ed..75fec68 100644
--- a/tests/robotests/src/com/android/settings/datausage/AppDataUsageTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/AppDataUsageTest.java
@@ -57,7 +57,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = ShadowEntityHeaderController.class)
public class AppDataUsageTest {
diff --git a/tests/robotests/src/com/android/settings/datausage/AppPrefLoaderTest.java b/tests/robotests/src/com/android/settings/datausage/AppPrefLoaderTest.java
index ac28e1d..b6547ab 100644
--- a/tests/robotests/src/com/android/settings/datausage/AppPrefLoaderTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/AppPrefLoaderTest.java
@@ -44,7 +44,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppPrefLoaderTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/datausage/BillingCycleSettingsTest.java b/tests/robotests/src/com/android/settings/datausage/BillingCycleSettingsTest.java
index 8b635d2..d735342 100644
--- a/tests/robotests/src/com/android/settings/datausage/BillingCycleSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/BillingCycleSettingsTest.java
@@ -38,7 +38,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BillingCycleSettingsTest {
private static final int LIMIT_BYTES = 123;
diff --git a/tests/robotests/src/com/android/settings/datausage/DataPlanSummaryPreferenceTest.java b/tests/robotests/src/com/android/settings/datausage/DataPlanSummaryPreferenceTest.java
index 9ddce53..a5dea97 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataPlanSummaryPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataPlanSummaryPreferenceTest.java
@@ -38,7 +38,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {
SettingsShadowResources.class,
SettingsShadowResources.SettingsShadowTheme.class
diff --git a/tests/robotests/src/com/android/settings/datausage/DataPlanUsageSummaryTest.java b/tests/robotests/src/com/android/settings/datausage/DataPlanUsageSummaryTest.java
index 748c317..cf790e9 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataPlanUsageSummaryTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataPlanUsageSummaryTest.java
@@ -45,7 +45,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DataPlanUsageSummaryTest {
@Mock
private ConnectivityManager mManager;
diff --git a/tests/robotests/src/com/android/settings/datausage/DataPlansSyncTimePreferenceTest.java b/tests/robotests/src/com/android/settings/datausage/DataPlansSyncTimePreferenceTest.java
index ba2d5f1..1e2565e 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataPlansSyncTimePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataPlansSyncTimePreferenceTest.java
@@ -35,7 +35,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class DataPlansSyncTimePreferenceTest {
private static final String SYNC_TIME = "Today 12:24pm";
diff --git a/tests/robotests/src/com/android/settings/datausage/DataUsageInfoControllerTest.java b/tests/robotests/src/com/android/settings/datausage/DataUsageInfoControllerTest.java
index e60243b..57041fd 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataUsageInfoControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataUsageInfoControllerTest.java
@@ -13,7 +13,7 @@
import static com.google.common.truth.Truth.assertThat;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DataUsageInfoControllerTest {
private DataUsageInfoController mInfoController;
private DataUsageInfo info;
diff --git a/tests/robotests/src/com/android/settings/datausage/DataUsageListTest.java b/tests/robotests/src/com/android/settings/datausage/DataUsageListTest.java
index 9ab88d3..59c99f4 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataUsageListTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataUsageListTest.java
@@ -36,7 +36,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DataUsageListTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/datausage/DataUsageSummaryTest.java b/tests/robotests/src/com/android/settings/datausage/DataUsageSummaryTest.java
index dc53ca1..179f743 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataUsageSummaryTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataUsageSummaryTest.java
@@ -48,7 +48,7 @@
import java.util.ArrayList;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DataUsageSummaryTest {
@Mock
private ConnectivityManager mManager;
diff --git a/tests/robotests/src/com/android/settings/datausage/DataUsageUtilsTest.java b/tests/robotests/src/com/android/settings/datausage/DataUsageUtilsTest.java
index cdcd3a9..1dacc68 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataUsageUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataUsageUtilsTest.java
@@ -33,7 +33,7 @@
import org.robolectric.shadows.ShadowApplication;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class DataUsageUtilsTest {
@Mock private ConnectivityManager mManager;
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/datausage/ManageDataPlansPreferenceTest.java b/tests/robotests/src/com/android/settings/datausage/ManageDataPlansPreferenceTest.java
index 6eff393..e96b4e8 100644
--- a/tests/robotests/src/com/android/settings/datausage/ManageDataPlansPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/ManageDataPlansPreferenceTest.java
@@ -35,7 +35,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class ManageDataPlansPreferenceTest {
private Preference mPreference;
private PreferenceViewHolder mHolder;
diff --git a/tests/robotests/src/com/android/settings/datausage/UnrestrictedDataAccessTest.java b/tests/robotests/src/com/android/settings/datausage/UnrestrictedDataAccessTest.java
index f20e50c..081337f 100644
--- a/tests/robotests/src/com/android/settings/datausage/UnrestrictedDataAccessTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/UnrestrictedDataAccessTest.java
@@ -40,7 +40,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class UnrestrictedDataAccessTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/datetime/AutoTimeFormatPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/AutoTimeFormatPreferenceControllerTest.java
index 06969bb..f9784ef 100644
--- a/tests/robotests/src/com/android/settings/datetime/AutoTimeFormatPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/AutoTimeFormatPreferenceControllerTest.java
@@ -40,7 +40,7 @@
import org.robolectric.shadows.ShadowApplication;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AutoTimeFormatPreferenceControllerTest {
@Mock(answer = RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/datetime/AutoTimePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/AutoTimePreferenceControllerTest.java
index d28cad1..f4c1596 100644
--- a/tests/robotests/src/com/android/settings/datetime/AutoTimePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/AutoTimePreferenceControllerTest.java
@@ -35,7 +35,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AutoTimePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/datetime/AutoTimeZonePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/AutoTimeZonePreferenceControllerTest.java
index 5cbef72..950fd0d 100644
--- a/tests/robotests/src/com/android/settings/datetime/AutoTimeZonePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/AutoTimeZonePreferenceControllerTest.java
@@ -39,7 +39,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = ShadowConnectivityManager.class)
public class AutoTimeZonePreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/datetime/DatePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/DatePreferenceControllerTest.java
index e6a6dd8..000dd2c 100644
--- a/tests/robotests/src/com/android/settings/datetime/DatePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/DatePreferenceControllerTest.java
@@ -22,6 +22,7 @@
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
+import com.android.settingslib.RestrictedPreference;
import org.junit.Before;
import org.junit.Test;
@@ -36,7 +37,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DatePreferenceControllerTest {
@Mock
@@ -48,14 +49,15 @@
@Mock
private AutoTimePreferenceController mAutoTimePreferenceController;
- private Preference mPreference;
+ private RestrictedPreference mPreference;
private DatePreferenceController mController;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(mContext.getSystemService(Context.ALARM_SERVICE)).thenReturn(mAlarmManager);
- mPreference = new Preference(ShadowApplication.getInstance().getApplicationContext());
+ mPreference = new RestrictedPreference(ShadowApplication.getInstance().
+ getApplicationContext());
mController = new DatePreferenceController(mContext, mHost, mAutoTimePreferenceController);
}
@@ -72,6 +74,9 @@
@Test
public void updateState_autoTimeEnabled_shouldDisablePref() {
+ // Make sure not disabled by admin.
+ mPreference.setDisabledByAdmin(null);
+
when(mAutoTimePreferenceController.isEnabled()).thenReturn(true);
mController.updateState(mPreference);
@@ -80,6 +85,9 @@
@Test
public void updateState_autoTimeDisabled_shouldEnablePref() {
+ // Make sure not disabled by admin.
+ mPreference.setDisabledByAdmin(null);
+
when(mAutoTimePreferenceController.isEnabled()).thenReturn(false);
mController.updateState(mPreference);
diff --git a/tests/robotests/src/com/android/settings/datetime/TimeChangeListenerMixinTest.java b/tests/robotests/src/com/android/settings/datetime/TimeChangeListenerMixinTest.java
index ada59f4..524a88e 100644
--- a/tests/robotests/src/com/android/settings/datetime/TimeChangeListenerMixinTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/TimeChangeListenerMixinTest.java
@@ -39,7 +39,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class TimeChangeListenerMixinTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/datetime/TimeFormatPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/TimeFormatPreferenceControllerTest.java
index cd13513..2e975c3 100644
--- a/tests/robotests/src/com/android/settings/datetime/TimeFormatPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/TimeFormatPreferenceControllerTest.java
@@ -41,7 +41,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class TimeFormatPreferenceControllerTest {
@Mock(answer = RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/datetime/TimePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/TimePreferenceControllerTest.java
index 15877e0..afec523 100644
--- a/tests/robotests/src/com/android/settings/datetime/TimePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/TimePreferenceControllerTest.java
@@ -17,10 +17,11 @@
package com.android.settings.datetime;
import android.content.Context;
-import android.support.v7.preference.Preference;
+import android.os.UserManager;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
+import com.android.settingslib.RestrictedPreference;
import org.junit.Before;
import org.junit.Test;
@@ -31,11 +32,12 @@
import org.robolectric.shadows.ShadowApplication;
import static com.google.common.truth.Truth.assertThat;
+
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class TimePreferenceControllerTest {
@Mock
@@ -46,12 +48,13 @@
private AutoTimePreferenceController mAutoTimePreferenceController;
private TimePreferenceController mController;
- private Preference mPreference;
+ private RestrictedPreference mPreference;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
- mPreference = new Preference(ShadowApplication.getInstance().getApplicationContext());
+ mPreference = new RestrictedPreference(
+ ShadowApplication.getInstance().getApplicationContext());
mController = new TimePreferenceController(mContext, mHost, mAutoTimePreferenceController);
}
@@ -62,6 +65,9 @@
@Test
public void updateState_autoTimeEnabled_shouldDisablePref() {
+ // Make sure not disabled by admin.
+ mPreference.setDisabledByAdmin(null);
+
when(mAutoTimePreferenceController.isEnabled()).thenReturn(true);
mController.updateState(mPreference);
@@ -70,6 +76,9 @@
@Test
public void updateState_autoTimeDisabled_shouldEnablePref() {
+ // Make sure not disabled by admin.
+ mPreference.setDisabledByAdmin(null);
+
when(mAutoTimePreferenceController.isEnabled()).thenReturn(false);
mController.updateState(mPreference);
diff --git a/tests/robotests/src/com/android/settings/datetime/TimeZonePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/TimeZonePreferenceControllerTest.java
index 2f96d65..aa10a70 100644
--- a/tests/robotests/src/com/android/settings/datetime/TimeZonePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/TimeZonePreferenceControllerTest.java
@@ -21,6 +21,7 @@
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
+import com.android.settingslib.RestrictedPreference;
import org.junit.Before;
import org.junit.Test;
@@ -36,20 +37,21 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class TimeZonePreferenceControllerTest {
@Mock
private AutoTimeZonePreferenceController mAutoTimeZonePreferenceController;
+
private Context mContext;
private TimeZonePreferenceController mController;
- private Preference mPreference;
+ private RestrictedPreference mPreference;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = ShadowApplication.getInstance().getApplicationContext();
- mPreference = new Preference(mContext);
+ mPreference = new RestrictedPreference(mContext);
mController = spy(new TimeZonePreferenceController(mContext,
mAutoTimeZonePreferenceController));
}
@@ -61,6 +63,9 @@
@Test
public void updateState_autoTimeZoneEnabled_shouldDisablePref() {
+ // Make sure not disabled by admin.
+ mPreference.setDisabledByAdmin(null);
+
doReturn("test timezone").when(mController).getTimeZoneOffsetAndName();
when(mAutoTimeZonePreferenceController.isEnabled()).thenReturn(true);
mController.updateState(mPreference);
@@ -70,6 +75,9 @@
@Test
public void updateState_autoTimeZoneDisabled_shouldEnablePref() {
+ // Make sure not disabled by admin.
+ mPreference.setDisabledByAdmin(null);
+
doReturn("test timezone").when(mController).getTimeZoneOffsetAndName();
when(mAutoTimeZonePreferenceController.isEnabled()).thenReturn(false);
mController.updateState(mPreference);
diff --git a/tests/robotests/src/com/android/settings/datetime/ZonePickerComparatorTest.java b/tests/robotests/src/com/android/settings/datetime/ZonePickerComparatorTest.java
index 4c1794c..10e5e5c 100644
--- a/tests/robotests/src/com/android/settings/datetime/ZonePickerComparatorTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/ZonePickerComparatorTest.java
@@ -23,7 +23,7 @@
import static com.google.common.truth.Truth.assertThat;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ZonePickerComparatorTest {
// Strings in Chinese are sorted by alphabet order of their Pinyin.
diff --git a/tests/robotests/src/com/android/settings/datetime/ZonePickerTest.java b/tests/robotests/src/com/android/settings/datetime/ZonePickerTest.java
index 92807e9..09ff1cd 100644
--- a/tests/robotests/src/com/android/settings/datetime/ZonePickerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/ZonePickerTest.java
@@ -39,7 +39,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ZonePickerTest {
private Activity mActivity;
diff --git a/tests/robotests/src/com/android/settings/development/BugReportInPowerPreferenceControllerV2Test.java b/tests/robotests/src/com/android/settings/development/BugReportInPowerPreferenceControllerTest.java
similarity index 91%
rename from tests/robotests/src/com/android/settings/development/BugReportInPowerPreferenceControllerV2Test.java
rename to tests/robotests/src/com/android/settings/development/BugReportInPowerPreferenceControllerTest.java
index 6fa1400..82086dd 100644
--- a/tests/robotests/src/com/android/settings/development/BugReportInPowerPreferenceControllerV2Test.java
+++ b/tests/robotests/src/com/android/settings/development/BugReportInPowerPreferenceControllerTest.java
@@ -16,12 +16,11 @@
package com.android.settings.development;
-import static com.android.settings.development
- .BugReportInPowerPreferenceControllerV2.COMPONENT_NAME;
-import static com.android.settings.development
- .BugReportInPowerPreferenceControllerV2.SETTING_VALUE_OFF;
-import static com.android.settings.development
- .BugReportInPowerPreferenceControllerV2.SETTING_VALUE_ON;
+import static com.android.settings.development.BugReportInPowerPreferenceController.COMPONENT_NAME;
+import static com.android.settings.development.BugReportInPowerPreferenceController
+ .SETTING_VALUE_OFF;
+import static com.android.settings.development.BugReportInPowerPreferenceController
+ .SETTING_VALUE_ON;
import static com.google.common.truth.Truth.assertThat;
@@ -53,7 +52,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
-public class BugReportInPowerPreferenceControllerV2Test {
+public class BugReportInPowerPreferenceControllerTest {
@Mock
private PreferenceScreen mScreen;
@@ -67,7 +66,7 @@
private SwitchPreference mPreference;
private ContentResolver mContentResolver;
- private BugReportInPowerPreferenceControllerV2 mController;
+ private BugReportInPowerPreferenceController mController;
@Before
public void setUp() {
@@ -75,7 +74,7 @@
mContentResolver = RuntimeEnvironment.application.getContentResolver();
when(mContext.getContentResolver()).thenReturn(mContentResolver);
when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
- mController = new BugReportInPowerPreferenceControllerV2(mContext);
+ mController = new BugReportInPowerPreferenceController(mContext);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
ReflectionHelpers.setField(mController, "mPackageManager", mPackageManager);
}
diff --git a/tests/robotests/src/com/android/settings/development/BugReportPreferenceControllerV2Test.java b/tests/robotests/src/com/android/settings/development/BugReportPreferenceControllerTest.java
similarity index 91%
rename from tests/robotests/src/com/android/settings/development/BugReportPreferenceControllerV2Test.java
rename to tests/robotests/src/com/android/settings/development/BugReportPreferenceControllerTest.java
index 9b4cde6..908c519 100644
--- a/tests/robotests/src/com/android/settings/development/BugReportPreferenceControllerV2Test.java
+++ b/tests/robotests/src/com/android/settings/development/BugReportPreferenceControllerTest.java
@@ -36,20 +36,20 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
-public class BugReportPreferenceControllerV2Test {
+public class BugReportPreferenceControllerTest {
@Mock
private Context mContext;
@Mock
private UserManager mUserManager;
- private BugReportPreferenceControllerV2 mController;
+ private BugReportPreferenceController mController;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
- mController = new BugReportPreferenceControllerV2(mContext);
+ mController = new BugReportPreferenceController(mContext);
}
@Test
diff --git a/tests/robotests/src/com/android/settings/development/CameraLaserSensorPreferenceControllerV2Test.java b/tests/robotests/src/com/android/settings/development/CameraLaserSensorPreferenceControllerTest.java
similarity index 75%
rename from tests/robotests/src/com/android/settings/development/CameraLaserSensorPreferenceControllerV2Test.java
rename to tests/robotests/src/com/android/settings/development/CameraLaserSensorPreferenceControllerTest.java
index 87967b9..1443d16 100644
--- a/tests/robotests/src/com/android/settings/development/CameraLaserSensorPreferenceControllerV2Test.java
+++ b/tests/robotests/src/com/android/settings/development/CameraLaserSensorPreferenceControllerTest.java
@@ -16,18 +16,16 @@
package com.android.settings.development;
-import static com.android.settings.development.CameraLaserSensorPreferenceControllerV2.ENG_BUILD;
-import static com.android.settings.development
- .CameraLaserSensorPreferenceControllerV2.USERDEBUG_BUILD;
-import static com.android.settings.development.CameraLaserSensorPreferenceControllerV2.USER_BUILD;
+import static com.android.settings.development.CameraLaserSensorPreferenceController.ENG_BUILD;
+import static com.android.settings.development.CameraLaserSensorPreferenceController
+ .USERDEBUG_BUILD;
+import static com.android.settings.development.CameraLaserSensorPreferenceController.USER_BUILD;
import android.content.Context;
-import android.content.res.Resources;
import android.os.SystemProperties;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.R;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
import com.android.settings.testutils.shadow.SettingsShadowSystemProperties;
@@ -36,7 +34,6 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
@@ -50,7 +47,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
shadows = {SettingsShadowSystemProperties.class})
-public class CameraLaserSensorPreferenceControllerV2Test {
+public class CameraLaserSensorPreferenceControllerTest {
@Mock
private PreferenceScreen mScreen;
@@ -59,13 +56,13 @@
private Context mContext;
- private CameraLaserSensorPreferenceControllerV2 mController;
+ private CameraLaserSensorPreferenceController mController;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
- mController = new CameraLaserSensorPreferenceControllerV2(mContext);
+ mController = new CameraLaserSensorPreferenceController(mContext);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
when(mPreference.getKey()).thenReturn(mController.getPreferenceKey());
mController.displayPreference(mScreen);
@@ -85,7 +82,7 @@
@Test
public void isAvailable_withUserdebugBuild_shouldReturnTrue() {
SettingsShadowSystemProperties.set(
- CameraLaserSensorPreferenceControllerV2.BUILD_TYPE, USERDEBUG_BUILD);
+ CameraLaserSensorPreferenceController.BUILD_TYPE, USERDEBUG_BUILD);
assertThat(mController.isAvailable()).isTrue();
}
@@ -93,7 +90,7 @@
@Test
public void isAvailable_withEngBuild_shouldReturnTrue() {
SettingsShadowSystemProperties.set(
- CameraLaserSensorPreferenceControllerV2.BUILD_TYPE, ENG_BUILD);
+ CameraLaserSensorPreferenceController.BUILD_TYPE, ENG_BUILD);
assertThat(mController.isAvailable()).isTrue();
}
@@ -101,7 +98,7 @@
@Test
public void isAvailable_withUserBuild_shouldReturnFalse() {
SettingsShadowSystemProperties.set(
- CameraLaserSensorPreferenceControllerV2.BUILD_TYPE, USER_BUILD);
+ CameraLaserSensorPreferenceController.BUILD_TYPE, USER_BUILD);
assertThat(mController.isAvailable()).isFalse();
}
@@ -109,10 +106,10 @@
@Test
public void updateState_cameraLaserSensorEnabled_shouldCheckedPreference() {
SettingsShadowSystemProperties.set(
- CameraLaserSensorPreferenceControllerV2.PROPERTY_CAMERA_LASER_SENSOR,
- Integer.toString(CameraLaserSensorPreferenceControllerV2.ENABLED));
+ CameraLaserSensorPreferenceController.PROPERTY_CAMERA_LASER_SENSOR,
+ Integer.toString(CameraLaserSensorPreferenceController.ENABLED));
SettingsShadowSystemProperties.set(
- CameraLaserSensorPreferenceControllerV2.BUILD_TYPE, USERDEBUG_BUILD);
+ CameraLaserSensorPreferenceController.BUILD_TYPE, USERDEBUG_BUILD);
mController.updateState(mScreen);
@@ -122,10 +119,10 @@
@Test
public void updateState_cameraLaserSensorEnabled_shouldUncheckedPreference() {
SettingsShadowSystemProperties.set(
- CameraLaserSensorPreferenceControllerV2.PROPERTY_CAMERA_LASER_SENSOR,
- Integer.toString(CameraLaserSensorPreferenceControllerV2.DISABLED));
+ CameraLaserSensorPreferenceController.PROPERTY_CAMERA_LASER_SENSOR,
+ Integer.toString(CameraLaserSensorPreferenceController.DISABLED));
SettingsShadowSystemProperties.set(
- CameraLaserSensorPreferenceControllerV2.BUILD_TYPE, USERDEBUG_BUILD);
+ CameraLaserSensorPreferenceController.BUILD_TYPE, USERDEBUG_BUILD);
mController.updateState(mScreen);
@@ -136,20 +133,20 @@
public void onPreferenceChange_preferenceChecked_shouldEnableCameraLaserSensor() {
mController.onPreferenceChange(mPreference, true);
- assertThat(Integer.toString(CameraLaserSensorPreferenceControllerV2.ENABLED)).isEqualTo(
+ assertThat(Integer.toString(CameraLaserSensorPreferenceController.ENABLED)).isEqualTo(
SystemProperties.get(
- CameraLaserSensorPreferenceControllerV2.PROPERTY_CAMERA_LASER_SENSOR,
- Integer.toString(CameraLaserSensorPreferenceControllerV2.ENABLED)));
+ CameraLaserSensorPreferenceController.PROPERTY_CAMERA_LASER_SENSOR,
+ Integer.toString(CameraLaserSensorPreferenceController.ENABLED)));
}
@Test
public void onPreferenceChange__preferenceUnchecked_shouldDisableCameraLaserSensor() {
mController.onPreferenceChange(mPreference, false);
- assertThat(Integer.toString(CameraLaserSensorPreferenceControllerV2.DISABLED)).isEqualTo(
+ assertThat(Integer.toString(CameraLaserSensorPreferenceController.DISABLED)).isEqualTo(
SystemProperties.get(
- CameraLaserSensorPreferenceControllerV2.PROPERTY_CAMERA_LASER_SENSOR,
- Integer.toString(CameraLaserSensorPreferenceControllerV2.ENABLED)));
+ CameraLaserSensorPreferenceController.PROPERTY_CAMERA_LASER_SENSOR,
+ Integer.toString(CameraLaserSensorPreferenceController.ENABLED)));
}
@Test
@@ -165,9 +162,9 @@
verify(mPreference).setEnabled(false);
verify(mPreference).setChecked(false);
- assertThat(Integer.toString(CameraLaserSensorPreferenceControllerV2.DISABLED)).isEqualTo(
+ assertThat(Integer.toString(CameraLaserSensorPreferenceController.DISABLED)).isEqualTo(
SystemProperties.get(
- CameraLaserSensorPreferenceControllerV2.PROPERTY_CAMERA_LASER_SENSOR,
- Integer.toString(CameraLaserSensorPreferenceControllerV2.ENABLED)));
+ CameraLaserSensorPreferenceController.PROPERTY_CAMERA_LASER_SENSOR,
+ Integer.toString(CameraLaserSensorPreferenceController.ENABLED)));
}
}
diff --git a/tests/robotests/src/com/android/settings/development/ConnectivityMonitorPreferenceControllerV2Test.java b/tests/robotests/src/com/android/settings/development/ConnectivityMonitorPreferenceControllerTest.java
similarity index 66%
rename from tests/robotests/src/com/android/settings/development/ConnectivityMonitorPreferenceControllerV2Test.java
rename to tests/robotests/src/com/android/settings/development/ConnectivityMonitorPreferenceControllerTest.java
index 5b4f594..5e99ec9 100644
--- a/tests/robotests/src/com/android/settings/development/ConnectivityMonitorPreferenceControllerV2Test.java
+++ b/tests/robotests/src/com/android/settings/development/ConnectivityMonitorPreferenceControllerTest.java
@@ -16,9 +16,9 @@
package com.android.settings.development;
-import static com.android.settings.development.ConnectivityMonitorPreferenceControllerV2.ENG_BUILD;
-import static com.android.settings.development
- .ConnectivityMonitorPreferenceControllerV2.USERDEBUG_BUILD;
+import static com.android.settings.development.ConnectivityMonitorPreferenceController.ENG_BUILD;
+import static com.android.settings.development.ConnectivityMonitorPreferenceController
+ .USERDEBUG_BUILD;
import static com.google.common.truth.Truth.assertThat;
@@ -45,7 +45,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION, shadows =
SettingsShadowSystemProperties.class)
-public class ConnectivityMonitorPreferenceControllerV2Test {
+public class ConnectivityMonitorPreferenceControllerTest {
private static final String USER_BUILD = "user";
@@ -55,14 +55,14 @@
private SwitchPreference mPreference;
private Context mContext;
- private ConnectivityMonitorPreferenceControllerV2 mController;
+ private ConnectivityMonitorPreferenceController mController;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
SettingsShadowSystemProperties.clear();
mContext = RuntimeEnvironment.application;
- mController = new ConnectivityMonitorPreferenceControllerV2(mContext);
+ mController = new ConnectivityMonitorPreferenceController(mContext);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
mController.displayPreference(mScreen);
}
@@ -70,7 +70,7 @@
@Test
public void isAvailable_trueShowFlagWithUserdebugBuild_shouldReturnTrue() {
SettingsShadowSystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.BUILD_TYPE, USERDEBUG_BUILD);
+ ConnectivityMonitorPreferenceController.BUILD_TYPE, USERDEBUG_BUILD);
assertThat(mController.isAvailable()).isTrue();
}
@@ -78,7 +78,7 @@
@Test
public void isAvailable_trueShowFlagWithEngBuild_shouldReturnTrue() {
SettingsShadowSystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.BUILD_TYPE, ENG_BUILD);
+ ConnectivityMonitorPreferenceController.BUILD_TYPE, ENG_BUILD);
assertThat(mController.isAvailable()).isTrue();
}
@@ -86,7 +86,7 @@
@Test
public void isAvailable_trueShowFlagWithUserBuild_shouldReturnFalse() {
SettingsShadowSystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.BUILD_TYPE, USER_BUILD);
+ ConnectivityMonitorPreferenceController.BUILD_TYPE, USER_BUILD);
assertThat(mController.isAvailable()).isFalse();
}
@@ -95,7 +95,7 @@
@Config(qualifiers = "mcc999")
public void isAvailable_falseShowFlagWithUserdebugBuild_shouldReturnFalse() {
SettingsShadowSystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.BUILD_TYPE, USERDEBUG_BUILD);
+ ConnectivityMonitorPreferenceController.BUILD_TYPE, USERDEBUG_BUILD);
assertThat(mController.isAvailable()).isFalse();
}
@@ -104,7 +104,7 @@
@Config(qualifiers = "mcc999")
public void isAvailable_falseShowFlagWithEngBuild_shouldReturnFalse() {
SettingsShadowSystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.BUILD_TYPE, ENG_BUILD);
+ ConnectivityMonitorPreferenceController.BUILD_TYPE, ENG_BUILD);
assertThat(mController.isAvailable()).isFalse();
}
@@ -113,7 +113,7 @@
@Config(qualifiers = "mcc999")
public void isAvailable_falseShowFlagWithUserBuild_shouldReturnFalse() {
SettingsShadowSystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.BUILD_TYPE, USER_BUILD);
+ ConnectivityMonitorPreferenceController.BUILD_TYPE, USER_BUILD);
assertThat(mController.isAvailable()).isFalse();
}
@@ -121,10 +121,10 @@
@Test
public void updateState_connectivityMonitorEnabled_shouldCheckedPreference() {
SettingsShadowSystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.PROPERTY_CONNECTIVITY_MONITOR,
- ConnectivityMonitorPreferenceControllerV2.ENABLED_STATUS);
+ ConnectivityMonitorPreferenceController.PROPERTY_CONNECTIVITY_MONITOR,
+ ConnectivityMonitorPreferenceController.ENABLED_STATUS);
SettingsShadowSystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.BUILD_TYPE, USERDEBUG_BUILD);
+ ConnectivityMonitorPreferenceController.BUILD_TYPE, USERDEBUG_BUILD);
mController.updateState(mPreference);
@@ -134,10 +134,10 @@
@Test
public void updateState_connectivityMonitorUserEnabled_shouldCheckedPreference() {
SettingsShadowSystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.PROPERTY_CONNECTIVITY_MONITOR,
- ConnectivityMonitorPreferenceControllerV2.USER_ENABLED_STATUS);
+ ConnectivityMonitorPreferenceController.PROPERTY_CONNECTIVITY_MONITOR,
+ ConnectivityMonitorPreferenceController.USER_ENABLED_STATUS);
SettingsShadowSystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.BUILD_TYPE, USERDEBUG_BUILD);
+ ConnectivityMonitorPreferenceController.BUILD_TYPE, USERDEBUG_BUILD);
mController.updateState(mPreference);
@@ -147,10 +147,10 @@
@Test
public void updateState_connectivityMonitorDisabled_shouldUncheckedPreference() {
SettingsShadowSystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.PROPERTY_CONNECTIVITY_MONITOR,
- ConnectivityMonitorPreferenceControllerV2.DISABLED_STATUS);
+ ConnectivityMonitorPreferenceController.PROPERTY_CONNECTIVITY_MONITOR,
+ ConnectivityMonitorPreferenceController.DISABLED_STATUS);
SettingsShadowSystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.BUILD_TYPE, USERDEBUG_BUILD);
+ ConnectivityMonitorPreferenceController.BUILD_TYPE, USERDEBUG_BUILD);
mController.updateState(mPreference);
@@ -160,10 +160,10 @@
@Test
public void updateState_connectivityMonitorUserDisabled_shouldUncheckedPreference() {
SettingsShadowSystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.PROPERTY_CONNECTIVITY_MONITOR,
- ConnectivityMonitorPreferenceControllerV2.USER_DISABLED_STATUS);
+ ConnectivityMonitorPreferenceController.PROPERTY_CONNECTIVITY_MONITOR,
+ ConnectivityMonitorPreferenceController.USER_DISABLED_STATUS);
SettingsShadowSystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.BUILD_TYPE, USERDEBUG_BUILD);
+ ConnectivityMonitorPreferenceController.BUILD_TYPE, USERDEBUG_BUILD);
mController.updateState(mPreference);
@@ -173,29 +173,29 @@
@Test
public void onPreferenceChange_preferenceChecked_shouldEnableConnectivityMonitor() {
SystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.PROPERTY_CONNECTIVITY_MONITOR,
- ConnectivityMonitorPreferenceControllerV2.USER_ENABLED_STATUS);
+ ConnectivityMonitorPreferenceController.PROPERTY_CONNECTIVITY_MONITOR,
+ ConnectivityMonitorPreferenceController.USER_ENABLED_STATUS);
mController.handlePreferenceTreeClick(mPreference);
- assertThat(ConnectivityMonitorPreferenceControllerV2.USER_ENABLED_STATUS).isEqualTo(
+ assertThat(ConnectivityMonitorPreferenceController.USER_ENABLED_STATUS).isEqualTo(
SystemProperties.get(
- ConnectivityMonitorPreferenceControllerV2.PROPERTY_CONNECTIVITY_MONITOR,
- ConnectivityMonitorPreferenceControllerV2.DISABLED_STATUS));
+ ConnectivityMonitorPreferenceController.PROPERTY_CONNECTIVITY_MONITOR,
+ ConnectivityMonitorPreferenceController.DISABLED_STATUS));
}
@Test
public void onPreferenceChange_preferenceUnchecked_shouldDisableConnectivityMonitor() {
SystemProperties.set(
- ConnectivityMonitorPreferenceControllerV2.PROPERTY_CONNECTIVITY_MONITOR,
- ConnectivityMonitorPreferenceControllerV2.USER_DISABLED_STATUS);
+ ConnectivityMonitorPreferenceController.PROPERTY_CONNECTIVITY_MONITOR,
+ ConnectivityMonitorPreferenceController.USER_DISABLED_STATUS);
mController.handlePreferenceTreeClick(mPreference);
- assertThat(ConnectivityMonitorPreferenceControllerV2.USER_DISABLED_STATUS).isEqualTo(
+ assertThat(ConnectivityMonitorPreferenceController.USER_DISABLED_STATUS).isEqualTo(
SystemProperties.get(
- ConnectivityMonitorPreferenceControllerV2.PROPERTY_CONNECTIVITY_MONITOR,
- ConnectivityMonitorPreferenceControllerV2.DISABLED_STATUS));
+ ConnectivityMonitorPreferenceController.PROPERTY_CONNECTIVITY_MONITOR,
+ ConnectivityMonitorPreferenceController.DISABLED_STATUS));
}
@Test
@@ -210,10 +210,10 @@
mController.onDeveloperOptionsSwitchDisabled();
String mode = SystemProperties.get(
- ConnectivityMonitorPreferenceControllerV2.PROPERTY_CONNECTIVITY_MONITOR,
+ ConnectivityMonitorPreferenceController.PROPERTY_CONNECTIVITY_MONITOR,
null /* default */);
- assertThat(mode).isEqualTo(ConnectivityMonitorPreferenceControllerV2.USER_DISABLED_STATUS);
+ assertThat(mode).isEqualTo(ConnectivityMonitorPreferenceController.USER_DISABLED_STATUS);
verify(mPreference).setEnabled(false);
verify(mPreference).setChecked(false);
}
diff --git a/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java
index 5449353..881ee84 100644
--- a/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java
@@ -223,10 +223,10 @@
@Test
public void onDisableLogPersistDialogConfirmed_shouldCallControllerDialogConfirmed() {
- final LogPersistPreferenceControllerV2 controller = mock(
- LogPersistPreferenceControllerV2.class);
+ final LogPersistPreferenceController controller = mock(
+ LogPersistPreferenceController.class);
doReturn(controller).when(mDashboard).getDevelopmentOptionsController(
- LogPersistPreferenceControllerV2.class);
+ LogPersistPreferenceController.class);
mDashboard.onDisableLogPersistDialogConfirmed();
verify(controller).onDisableLogPersistDialogConfirmed();
@@ -234,10 +234,10 @@
@Test
public void onDisableLogPersistDialogRejected_shouldCallControllerDialogRejected() {
- final LogPersistPreferenceControllerV2 controller = mock(
- LogPersistPreferenceControllerV2.class);
+ final LogPersistPreferenceController controller = mock(
+ LogPersistPreferenceController.class);
doReturn(controller).when(mDashboard).getDevelopmentOptionsController(
- LogPersistPreferenceControllerV2.class);
+ LogPersistPreferenceController.class);
mDashboard.onDisableLogPersistDialogRejected();
verify(controller).onDisableLogPersistDialogRejected();
diff --git a/tests/robotests/src/com/android/settings/development/LogPersistPreferenceControllerV2Test.java b/tests/robotests/src/com/android/settings/development/LogPersistPreferenceControllerTest.java
similarity index 92%
rename from tests/robotests/src/com/android/settings/development/LogPersistPreferenceControllerV2Test.java
rename to tests/robotests/src/com/android/settings/development/LogPersistPreferenceControllerTest.java
index ddc0da5..1dc1255 100644
--- a/tests/robotests/src/com/android/settings/development/LogPersistPreferenceControllerV2Test.java
+++ b/tests/robotests/src/com/android/settings/development/LogPersistPreferenceControllerTest.java
@@ -42,7 +42,7 @@
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
shadows = {SettingsShadowSystemProperties.class})
-public class LogPersistPreferenceControllerV2Test {
+public class LogPersistPreferenceControllerTest {
@Mock
private ListPreference mPreference;
@@ -52,7 +52,7 @@
private DevelopmentSettingsDashboardFragment mFragment;
private Context mContext;
- private LogPersistPreferenceControllerV2 mController;
+ private LogPersistPreferenceController mController;
private Lifecycle mLifecycle;
@Before
@@ -60,7 +60,7 @@
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mLifecycle = new Lifecycle(() -> mLifecycle);
- mController = new LogPersistPreferenceControllerV2(mContext, mFragment, mLifecycle);
+ mController = new LogPersistPreferenceController(mContext, mFragment, mLifecycle);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
SystemProperties.set("ro.debuggable", "1");
mController.displayPreference(mScreen);
diff --git a/tests/robotests/src/com/android/settings/development/LogdSizePreferenceControllerV2Test.java b/tests/robotests/src/com/android/settings/development/LogdSizePreferenceControllerTest.java
similarity index 94%
rename from tests/robotests/src/com/android/settings/development/LogdSizePreferenceControllerV2Test.java
rename to tests/robotests/src/com/android/settings/development/LogdSizePreferenceControllerTest.java
index 71766c3..f7be653 100644
--- a/tests/robotests/src/com/android/settings/development/LogdSizePreferenceControllerV2Test.java
+++ b/tests/robotests/src/com/android/settings/development/LogdSizePreferenceControllerTest.java
@@ -41,7 +41,7 @@
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
shadows = {SettingsShadowSystemProperties.class})
-public class LogdSizePreferenceControllerV2Test {
+public class LogdSizePreferenceControllerTest {
@Mock
private PreferenceScreen mScreen;
@@ -61,7 +61,7 @@
private String[] mListValues;
private String[] mListSummaries;
private Context mContext;
- private LogdSizePreferenceControllerV2 mController;
+ private LogdSizePreferenceController mController;
@Before
public void setup() {
@@ -69,7 +69,7 @@
mContext = RuntimeEnvironment.application;
mListValues = mContext.getResources().getStringArray(R.array.select_logd_size_values);
mListSummaries = mContext.getResources().getStringArray(R.array.select_logd_size_summaries);
- mController = new LogdSizePreferenceControllerV2(mContext);
+ mController = new LogdSizePreferenceController(mContext);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
mController.displayPreference(mScreen);
}
diff --git a/tests/robotests/src/com/android/settings/development/SelectUsbConfigPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/SelectUsbConfigPreferenceControllerTest.java
index ffb5ceb..5a82ca0 100644
--- a/tests/robotests/src/com/android/settings/development/SelectUsbConfigPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/SelectUsbConfigPreferenceControllerTest.java
@@ -20,6 +20,9 @@
import static android.arch.lifecycle.Lifecycle.Event.ON_DESTROY;
import static com.google.common.truth.Truth.assertThat;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString;
@@ -31,6 +34,7 @@
import static org.mockito.Mockito.when;
import android.content.Context;
+import android.content.pm.PackageManager;
import android.hardware.usb.UsbManager;
import android.support.v7.preference.ListPreference;
import android.support.v7.preference.PreferenceScreen;
@@ -46,6 +50,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@@ -62,6 +67,8 @@
private PreferenceScreen mScreen;
@Mock
private UsbManager mUsbManager;
+ @Mock
+ private PackageManager mPackageManager;
private Context mContext;
private Lifecycle mLifecycle;
@@ -86,6 +93,7 @@
mLifecycle = new Lifecycle(() -> mLifecycle);
mContext = spy(RuntimeEnvironment.application);
doReturn(mUsbManager).when(mContext).getSystemService(Context.USB_SERVICE);
+ doReturn(mPackageManager).when(mContext).getPackageManager();
mValues = mContext.getResources().getStringArray(R.array.usb_configuration_values);
mSummaries = mContext.getResources().getStringArray(R.array.usb_configuration_titles);
mController = spy(new SelectUsbConfigPreferenceController(mContext, mLifecycle));
@@ -109,6 +117,30 @@
}
@Test
+ public void onUsbAccessoryAndHostDisabled_shouldNotBeAvailable() {
+ when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_HOST)).thenReturn(false);
+ when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_ACCESSORY)).thenReturn(
+ false);
+ assertFalse(mController.isAvailable());
+ }
+
+ @Test
+ public void onUsbHostEnabled_shouldBeAvailable() {
+ when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_HOST)).thenReturn(true);
+ when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_ACCESSORY)).thenReturn(
+ false);
+ assertTrue(mController.isAvailable());
+ }
+
+ @Test
+ public void onUsbAccessoryEnabled_shouldBeAvailable() {
+ when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_HOST)).thenReturn(false);
+ when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_ACCESSORY)).thenReturn(
+ true);
+ assertTrue(mController.isAvailable());
+ }
+
+ @Test
public void onPreferenceChange_setMtp_shouldEnableMtp() {
when(mUsbManager.isFunctionEnabled(mValues[1])).thenReturn(true);
doNothing().when(mController).setCurrentFunction(anyString(), anyBoolean());
diff --git a/tests/robotests/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerV2Test.java b/tests/robotests/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerTest.java
similarity index 95%
rename from tests/robotests/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerV2Test.java
rename to tests/robotests/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerTest.java
index 9e60295..e396ebe 100644
--- a/tests/robotests/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerV2Test.java
+++ b/tests/robotests/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerTest.java
@@ -52,7 +52,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
-public class VerifyAppsOverUsbPreferenceControllerV2Test {
+public class VerifyAppsOverUsbPreferenceControllerTest {
@Mock
private PackageManagerWrapper mPackageManager;
@@ -62,11 +62,11 @@
private RestrictedSwitchPreference mPreference;
@Mock
- private VerifyAppsOverUsbPreferenceControllerV2.RestrictedLockUtilsDelegate
+ private VerifyAppsOverUsbPreferenceController.RestrictedLockUtilsDelegate
mRestrictedLockUtilsDelegate;
private Context mContext;
- private VerifyAppsOverUsbPreferenceControllerV2 mController;
+ private VerifyAppsOverUsbPreferenceController mController;
/** Convenience class for setting global int settings. */
class GlobalSetter {
@@ -83,7 +83,7 @@
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
when(mScreen.findPreference(anyString())).thenReturn(mPreference);
- mController = new VerifyAppsOverUsbPreferenceControllerV2(mContext);
+ mController = new VerifyAppsOverUsbPreferenceController(mContext);
ReflectionHelpers.setField(
mController, "mRestrictedLockUtils", mRestrictedLockUtilsDelegate);
ReflectionHelpers.setField(mController, "mPackageManager", mPackageManager);
@@ -188,7 +188,7 @@
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
android.provider.Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, -1 /* default */);
- assertThat(mode).isEqualTo(VerifyAppsOverUsbPreferenceControllerV2.SETTING_VALUE_ON);
+ assertThat(mode).isEqualTo(VerifyAppsOverUsbPreferenceController.SETTING_VALUE_ON);
}
@Test
@@ -198,7 +198,7 @@
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
android.provider.Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, -1 /* default */);
- assertThat(mode).isEqualTo(VerifyAppsOverUsbPreferenceControllerV2.SETTING_VALUE_OFF);
+ assertThat(mode).isEqualTo(VerifyAppsOverUsbPreferenceController.SETTING_VALUE_OFF);
}
@Test
diff --git a/tests/robotests/src/com/android/settings/development/WebViewAppPreferenceControllerV2Test.java b/tests/robotests/src/com/android/settings/development/WebViewAppPreferenceControllerTest.java
similarity index 94%
rename from tests/robotests/src/com/android/settings/development/WebViewAppPreferenceControllerV2Test.java
rename to tests/robotests/src/com/android/settings/development/WebViewAppPreferenceControllerTest.java
index 4f9540f..59f6e35 100644
--- a/tests/robotests/src/com/android/settings/development/WebViewAppPreferenceControllerV2Test.java
+++ b/tests/robotests/src/com/android/settings/development/WebViewAppPreferenceControllerTest.java
@@ -43,7 +43,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
-public class WebViewAppPreferenceControllerV2Test {
+public class WebViewAppPreferenceControllerTest {
@Mock
private PreferenceScreen mPreferenceScreen;
@@ -57,13 +57,13 @@
private DefaultAppInfo mAppInfo;
private Context mContext;
- private WebViewAppPreferenceControllerV2 mController;
+ private WebViewAppPreferenceController mController;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
- mController = spy(new WebViewAppPreferenceControllerV2(mContext));
+ mController = spy(new WebViewAppPreferenceController(mContext));
ReflectionHelpers.setField(mController, "mPackageManager", mPackageManager);
ReflectionHelpers.setField(mController, "mWebViewUpdateServiceWrapper",
mWebViewUpdateServiceWrapper);
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowResources.java b/tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowResources.java
index 183f5ad..b0cd484 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowResources.java
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowResources.java
@@ -101,6 +101,13 @@
return directlyOn(realResources, Resources.class).getColorStateList(id, theme);
}
+ /**
+ * Deprecated because SDK 24+ uses
+ * {@link SettingsShadowResourcesImpl#loadDrawable(Resources, TypedValue, int, int, Theme)}
+ *
+ * TODO: Delete when all tests have been migrated to sdk 26
+ */
+ @Deprecated
@Implementation
public Drawable loadDrawable(TypedValue value, int id, Theme theme)
throws NotFoundException {
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowResourcesImpl.java b/tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowResourcesImpl.java
new file mode 100644
index 0000000..42b02f3
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/SettingsShadowResourcesImpl.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2017 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.testutils.shadow;
+
+import android.content.res.Resources;
+import android.content.res.ResourcesImpl;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+import android.util.TypedValue;
+
+import com.android.settings.R;
+
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+import org.robolectric.shadows.ShadowResourcesImpl;
+
+@Implements(
+ value = ResourcesImpl.class,
+ isInAndroidSdk = false,
+ minSdk = 26
+)
+public class SettingsShadowResourcesImpl extends ShadowResourcesImpl {
+
+ @Implementation
+ public Drawable loadDrawable(Resources wrapper, TypedValue value, int id, int density,
+ Resources.Theme theme) {
+ // The drawable item in switchbar_background.xml refers to a very recent color attribute
+ // that Robolectric isn't yet aware of.
+ // TODO: Remove this once Robolectric is updated.
+ if (id == R.drawable.switchbar_background) {
+ return new ColorDrawable();
+ } else if (id == R.drawable.ic_launcher_settings) {
+ // ic_launcher_settings uses adaptive-icon, which is not supported by robolectric,
+ // change it to a normal drawable.
+ id = R.drawable.ic_settings_wireless;
+ } else if (id == R.drawable.app_filter_spinner_background) {
+ id = R.drawable.ic_expand_more_inverse;
+ } else if (id == R.drawable.selectable_card_grey) {
+ id = R.drawable.ic_expand_more_inverse;
+ }
+ return super.loadDrawable(wrapper, value, id, density, theme);
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/webview/WebViewAppPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/webview/WebViewAppPreferenceControllerTest.java
index 08ecc9b..9404e53 100644
--- a/tests/robotests/src/com/android/settings/webview/WebViewAppPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/webview/WebViewAppPreferenceControllerTest.java
@@ -31,7 +31,7 @@
import org.robolectric.annotation.Config;
/**
- * Deprecated in favor of {@link com.android.settings.development.WebViewAppPreferenceControllerV2}
+ * Deprecated in favor of {@link com.android.settings.development.WebViewAppPreferenceController}
*/
@Deprecated
@RunWith(SettingsRobolectricTestRunner.class)
diff --git a/tests/robotests/src/com/android/settings/widget/ActionBarShadowControllerTest.java b/tests/robotests/src/com/android/settings/widget/ActionBarShadowControllerTest.java
index 0f3eb31..f69012e 100644
--- a/tests/robotests/src/com/android/settings/widget/ActionBarShadowControllerTest.java
+++ b/tests/robotests/src/com/android/settings/widget/ActionBarShadowControllerTest.java
@@ -45,7 +45,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ActionBarShadowControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/widget/ActionButtonPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/ActionButtonPreferenceTest.java
index a080bc6..a215967 100644
--- a/tests/robotests/src/com/android/settings/widget/ActionButtonPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/ActionButtonPreferenceTest.java
@@ -40,7 +40,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ActionButtonPreferenceTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/widget/AppPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/AppPreferenceTest.java
index d489094..6481f8a 100644
--- a/tests/robotests/src/com/android/settings/widget/AppPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/AppPreferenceTest.java
@@ -33,7 +33,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppPreferenceTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/widget/AppSwitchPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/AppSwitchPreferenceTest.java
index a7c8d7c..81537a8 100644
--- a/tests/robotests/src/com/android/settings/widget/AppSwitchPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/AppSwitchPreferenceTest.java
@@ -33,7 +33,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppSwitchPreferenceTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/widget/AspectRatioFrameLayoutTest.java b/tests/robotests/src/com/android/settings/widget/AspectRatioFrameLayoutTest.java
index dd6138c..4a19258 100644
--- a/tests/robotests/src/com/android/settings/widget/AspectRatioFrameLayoutTest.java
+++ b/tests/robotests/src/com/android/settings/widget/AspectRatioFrameLayoutTest.java
@@ -32,7 +32,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AspectRatioFrameLayoutTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/widget/DefaultIndicatorSeekBarTest.java b/tests/robotests/src/com/android/settings/widget/DefaultIndicatorSeekBarTest.java
index 7fcf328..47a9aa6 100644
--- a/tests/robotests/src/com/android/settings/widget/DefaultIndicatorSeekBarTest.java
+++ b/tests/robotests/src/com/android/settings/widget/DefaultIndicatorSeekBarTest.java
@@ -29,7 +29,7 @@
import static junit.framework.Assert.assertEquals;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DefaultIndicatorSeekBarTest {
private DefaultIndicatorSeekBar mDefaultIndicatorSeekBar;
diff --git a/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java b/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java
index 9c6ee45..af30e4f 100644
--- a/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java
@@ -58,7 +58,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class EntityHeaderControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/widget/FixedLineSummaryPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/FixedLineSummaryPreferenceTest.java
index 0d9a77b..5022ceb 100644
--- a/tests/robotests/src/com/android/settings/widget/FixedLineSummaryPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/FixedLineSummaryPreferenceTest.java
@@ -38,7 +38,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class FixedLineSummaryPreferenceTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/widget/LoadingViewControllerTest.java b/tests/robotests/src/com/android/settings/widget/LoadingViewControllerTest.java
index 09b52c8..6ab2b17 100644
--- a/tests/robotests/src/com/android/settings/widget/LoadingViewControllerTest.java
+++ b/tests/robotests/src/com/android/settings/widget/LoadingViewControllerTest.java
@@ -37,7 +37,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class LoadingViewControllerTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/widget/MasterSwitchPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/MasterSwitchPreferenceTest.java
index 1c449cc..c80c7b4 100644
--- a/tests/robotests/src/com/android/settings/widget/MasterSwitchPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/MasterSwitchPreferenceTest.java
@@ -40,7 +40,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class MasterSwitchPreferenceTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/widget/PreferenceCategoryControllerTest.java b/tests/robotests/src/com/android/settings/widget/PreferenceCategoryControllerTest.java
index 23aa378..d8661bf 100644
--- a/tests/robotests/src/com/android/settings/widget/PreferenceCategoryControllerTest.java
+++ b/tests/robotests/src/com/android/settings/widget/PreferenceCategoryControllerTest.java
@@ -36,7 +36,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class PreferenceCategoryControllerTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/widget/RadioButtonPickerFragmentTest.java b/tests/robotests/src/com/android/settings/widget/RadioButtonPickerFragmentTest.java
index 8ca68ae..9fc5b2e 100644
--- a/tests/robotests/src/com/android/settings/widget/RadioButtonPickerFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/widget/RadioButtonPickerFragmentTest.java
@@ -45,7 +45,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class RadioButtonPickerFragmentTest {
diff --git a/tests/robotests/src/com/android/settings/widget/RingProgressBarTest.java b/tests/robotests/src/com/android/settings/widget/RingProgressBarTest.java
index a1a2f24..0226c22 100644
--- a/tests/robotests/src/com/android/settings/widget/RingProgressBarTest.java
+++ b/tests/robotests/src/com/android/settings/widget/RingProgressBarTest.java
@@ -31,7 +31,7 @@
import static junit.framework.Assert.assertEquals;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class RingProgressBarTest {
private Context mContext = RuntimeEnvironment.application;
diff --git a/tests/robotests/src/com/android/settings/widget/RtlCompatibleViewPagerTest.java b/tests/robotests/src/com/android/settings/widget/RtlCompatibleViewPagerTest.java
index 78afc43..1072152 100644
--- a/tests/robotests/src/com/android/settings/widget/RtlCompatibleViewPagerTest.java
+++ b/tests/robotests/src/com/android/settings/widget/RtlCompatibleViewPagerTest.java
@@ -36,7 +36,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(
manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {ShadowTextUtils.class}
)
public class RtlCompatibleViewPagerTest {
diff --git a/tests/robotests/src/com/android/settings/widget/ScrollToParentEditTextTest.java b/tests/robotests/src/com/android/settings/widget/ScrollToParentEditTextTest.java
index 5755015..8e91259 100644
--- a/tests/robotests/src/com/android/settings/widget/ScrollToParentEditTextTest.java
+++ b/tests/robotests/src/com/android/settings/widget/ScrollToParentEditTextTest.java
@@ -41,7 +41,7 @@
import org.robolectric.shadows.ShadowView;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ScrollToParentEditTextTest {
private static final int EDIT_TEXT_SIZE = 20;
diff --git a/tests/robotests/src/com/android/settings/widget/SummaryUpdaterTest.java b/tests/robotests/src/com/android/settings/widget/SummaryUpdaterTest.java
index 2f42550..8dbe552 100644
--- a/tests/robotests/src/com/android/settings/widget/SummaryUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/widget/SummaryUpdaterTest.java
@@ -34,7 +34,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SummaryUpdaterTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/widget/ValidatedEditTextPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/ValidatedEditTextPreferenceTest.java
index 59be160..ff2332c 100644
--- a/tests/robotests/src/com/android/settings/widget/ValidatedEditTextPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/ValidatedEditTextPreferenceTest.java
@@ -42,7 +42,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ValidatedEditTextPreferenceTest {
@Mock
diff --git a/tests/unit/src/com/android/settings/core/UserRestrictionTest.java b/tests/unit/src/com/android/settings/core/UserRestrictionTest.java
new file mode 100644
index 0000000..ad00bd7
--- /dev/null
+++ b/tests/unit/src/com/android/settings/core/UserRestrictionTest.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2017 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.core;
+
+import static junit.framework.Assert.fail;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.content.res.XmlResourceParser;
+import android.os.UserManager;
+import android.platform.test.annotations.Presubmit;
+import android.provider.SearchIndexableResource;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.MediumTest;
+import android.support.test.runner.AndroidJUnit4;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.util.Xml;
+
+import com.android.settings.search.DatabaseIndexingUtils;
+import com.android.settings.search.Indexable;
+import com.android.settings.search.SearchIndexableResources;
+
+import com.google.android.collect.Sets;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Set;
+
+@RunWith(AndroidJUnit4.class)
+@MediumTest
+public class UserRestrictionTest {
+
+ private static final String TAG = "UserRestrictionTest";
+
+ private Context mContext;
+
+ private static final Set<String> USER_RESTRICTIONS = Sets.newHashSet(
+ UserManager.DISALLOW_CONFIG_DATE_TIME,
+ UserManager.DISALLOW_CONFIG_CREDENTIALS,
+ UserManager.DISALLOW_NETWORK_RESET,
+ UserManager.DISALLOW_FACTORY_RESET,
+ UserManager.DISALLOW_CONFIG_TETHERING,
+ UserManager.DISALLOW_CONFIG_VPN,
+ UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS
+ );
+
+ @Before
+ public void setUp() {
+ mContext = InstrumentationRegistry.getTargetContext();
+ }
+
+ /**
+ * Verity that userRestriction attributes are entered and parsed successfully.
+ */
+ @Test
+ public void userRestrictionAttributeShouldBeValid()
+ throws IOException, XmlPullParserException, Resources.NotFoundException {
+ for (Class<?> clazz : SearchIndexableResources.providerValues()) {
+ verifyUserRestriction(clazz);
+ }
+ }
+
+ private void verifyUserRestriction(Class<?> clazz)
+ throws IOException, XmlPullParserException, Resources.NotFoundException {
+ if (clazz == null) {
+ return;
+ }
+ final String className = clazz.getName();
+ final Indexable.SearchIndexProvider provider =
+ DatabaseIndexingUtils.getSearchIndexProvider(clazz);
+ final List<SearchIndexableResource> resourcesToIndex =
+ provider.getXmlResourcesToIndex(mContext, true);
+
+ if (resourcesToIndex == null) {
+ Log.d(TAG, className + "is not providing SearchIndexableResource, skipping");
+ return;
+ }
+
+ for (SearchIndexableResource sir : resourcesToIndex) {
+ if (sir.xmlResId <= 0) {
+ Log.d(TAG, className + " doesn't have a valid xml to index.");
+ continue;
+ }
+ final XmlResourceParser parser = mContext.getResources().getXml(sir.xmlResId);
+
+ int type;
+ while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
+ && type != XmlPullParser.START_TAG) {
+ // Parse next until start tag is found
+ }
+ final int outerDepth = parser.getDepth();
+
+ do {
+ if (type != XmlPullParser.START_TAG) {
+ continue;
+ }
+ final String nodeName = parser.getName();
+ if (!nodeName.endsWith("Preference")) {
+ continue;
+ }
+ final AttributeSet attrs = Xml.asAttributeSet(parser);
+ final String userRestriction = getDataUserRestrictions(mContext, attrs);
+ if (userRestriction != null) {
+ if(!isValidRestriction(userRestriction)) {
+ fail("userRestriction in " + className + " not valid.");
+ }
+ }
+ } while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
+ && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth));
+ }
+ }
+
+ boolean isValidRestriction(String userRestriction) {
+ return USER_RESTRICTIONS.contains(userRestriction);
+ }
+
+ private String getDataUserRestrictions(Context context, AttributeSet attrs) {
+ return getData(context, attrs,
+ com.android.settingslib.R.styleable.RestrictedPreference,
+ com.android.settingslib.R.styleable.RestrictedPreference_userRestriction);
+ }
+
+ private String getData(Context context, AttributeSet set, int[] attrs, int resId) {
+ final TypedArray ta = context.obtainStyledAttributes(set, attrs);
+ String data = ta.getString(resId);
+ ta.recycle();
+ return data;
+ }
+}