Merge "Create settings page for choosing default Network Scorer."
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 5ef5caf..b000c14 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -179,7 +179,7 @@
<activity android:name=".Settings$NetworkDashboardActivity"
android:taskAffinity="com.android.settings"
android:label="@string/network_dashboard_title"
- android:icon="@drawable/ic_dashboard_network"
+ android:icon="@drawable/ic_settings_wireless"
android:parentActivityName="Settings">
<intent-filter android:priority="1">
<action android:name="android.settings.WIRELESS_SETTINGS" />
@@ -916,7 +916,7 @@
<activity android:name="Settings$DisplaySettingsActivity"
android:label="@string/display_settings"
- android:icon="@drawable/ic_dashboard_display"
+ android:icon="@drawable/ic_settings_display"
android:taskAffinity="">
<intent-filter android:priority="1">
<action android:name="com.android.settings.DISPLAY_SETTINGS" />
@@ -1298,7 +1298,7 @@
<activity android:name="Settings$SecuritySettingsActivity"
android:label="@string/security_settings_title"
- android:icon="@drawable/ic_dashboard_security"
+ android:icon="@drawable/ic_settings_security"
android:configChanges="orientation|keyboardHidden|screenSize"
android:taskAffinity=""
android:parentActivityName="Settings">
@@ -2989,7 +2989,7 @@
<!-- Alias for battery settings in new IA. Remove and merge metadata into TargetActivity -->
<activity android:name=".Settings$AppAndNotificationDashboardActivity"
android:label="@string/app_and_notification_dashboard_title"
- android:icon="@drawable/ic_dashboard_apps">
+ android:icon="@drawable/ic_apps">
<intent-filter android:priority="9">
<action android:name="com.android.settings.action.SETTINGS"/>
</intent-filter>
@@ -3003,7 +3003,7 @@
<activity android:name=".Settings$StorageDashboardActivity"
android:label="@string/storage_settings"
- android:icon="@drawable/ic_dashboard_storage">
+ android:icon="@drawable/ic_settings_storage">
<intent-filter android:priority="5">
<action android:name="com.android.settings.action.SETTINGS" />
</intent-filter>
@@ -3017,7 +3017,7 @@
<activity android:name=".Settings$UserAndAccountDashboardActivity"
android:label="@string/account_dashboard_title"
- android:icon="@drawable/ic_dashboard_user">
+ android:icon="@drawable/ic_settings_accounts">
<intent-filter android:priority="3">
<action android:name="com.android.settings.action.SETTINGS"/>
</intent-filter>
@@ -3035,7 +3035,7 @@
<activity android:name=".Settings$SystemDashboardActivity"
android:label="@string/header_category_system"
- android:icon="@drawable/ic_dashboard_system">
+ android:icon="@drawable/ic_settings_about">
<intent-filter android:priority="1">
<action android:name="com.android.settings.action.SETTINGS"/>
</intent-filter>
diff --git a/res/drawable/ic_dashboard_apps.xml b/res/drawable/ic_dashboard_apps.xml
deleted file mode 100644
index c0083a6..0000000
--- a/res/drawable/ic_dashboard_apps.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:pathData="M4,8h4L8,4L4,4v4zM10,20h4v-4h-4v4zM4,20h4v-4L4,16v4zM4,14h4v-4L4,10v4zM10,14h4v-4h-4v4zM16,4v4h4L20,4h-4zM10,8h4L14,4h-4v4zM16,14h4v-4h-4v4zM16,20h4v-4h-4v4z"
- android:fillColor="#ec8122"/>
-</vector>
diff --git a/res/drawable/ic_dashboard_display.xml b/res/drawable/ic_dashboard_display.xml
deleted file mode 100644
index ae367cf..0000000
--- a/res/drawable/ic_dashboard_display.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
- -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24.0dp"
- android:height="24.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#4184f3"
- android:pathData="M20.0,15.31L23.31,12.0 20.0,8.69L20.0,4.0l-4.69,0.0L12.0,0.69 8.69,4.0L4.0,4.0l0.0,4.69L0.69,12.0 4.0,15.31L4.0,20.0l4.69,0.0L12.0,23.31 15.31,20.0L20.0,20.0l0.0,-4.69zM12.0,18.0L12.0,6.0c3.31,0.0 6.0,2.69 6.0,6.0s-2.69,6.0 -6.0,6.0z"/>
-</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_dashboard_network.xml b/res/drawable/ic_dashboard_network.xml
deleted file mode 100644
index 6c7ee2e..0000000
--- a/res/drawable/ic_dashboard_network.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
- -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24.0dp"
- android:height="24.0dp"
- android:viewportWidth="18.0"
- android:viewportHeight="18.0">
- <path
- android:fillColor="#0b9c57"
- android:pathData="M9.01,15.99l8.8,-10.96C17.47,4.77 14.08,2.0 9.0,2.0S0.53,4.7 0.19,5.03l8.8,10.96l0.02,0.0z"/>
-</vector>
diff --git a/res/drawable/ic_dashboard_security.xml b/res/drawable/ic_dashboard_security.xml
deleted file mode 100644
index 1e6a1e8..0000000
--- a/res/drawable/ic_dashboard_security.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
- -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24.0dp"
- android:height="24.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#7a1ea1"
- android:pathData="M18.0,8.0l-1.0,0.0L17.0,6.0c0.0,-2.76 -2.24,-5.0 -5.0,-5.0S7.0,3.24 7.0,6.0l0.0,2.0L6.0,8.0c-1.1,0.0 -2.0,0.9 -2.0,2.0l0.0,10.0c0.0,1.0 0.9,2.0 2.0,2.0l12.0,0.0c1.1,0.0 2.0,-0.9 2.0,-2.0L20.0,10.0c0.0,-1.1 -0.9,-2.0 -2.0,-2.0zm-6.0,9.0c-1.1,0.0 -2.0,-0.9 -2.0,-2.0s0.9,-2.0 2.0,-2.0 2.0,0.9 2.0,2.0 -0.9,2.0 -2.0,2.0zm3.1,-9.0L8.9,8.0L8.9,6.0c0.0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0.0 3.1,1.39 3.1,3.1l0.0,2.0z"/>
-</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_dashboard_sound.xml b/res/drawable/ic_dashboard_sound.xml
deleted file mode 100644
index 0cd3b04..0000000
--- a/res/drawable/ic_dashboard_sound.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
- -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24.0dp"
- android:height="24.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#4184f3"
- android:pathData="M3.0,9.0l0.0,6.0l4.0,0.0l5.0,5.0L12.0,4.0L7.0,9.0L3.0,9.0zm13.5,3.0c0.0,-1.77 -1.02,-3.29 -2.5,-4.03l0.0,8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM14.0,3.23l0.0,2.06c2.8,0.86 5.0,3.54 5.0,6.71s-2.11,5.85 -5.0,6.71l0.0,2.06c4.01,-0.91 7.0,-4.49 7.0,-8.77s-2.99,-7.86 -7.0,-8.77z"/>
-</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_dashboard_storage.xml b/res/drawable/ic_dashboard_storage.xml
deleted file mode 100644
index 2b6160e..0000000
--- a/res/drawable/ic_dashboard_storage.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
- -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24.0dp"
- android:height="24.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#4184f3"
- android:pathData="M2.0,20.0l20.0,0.0l0.0,-4.0L2.0,16.0l0.0,4.0zm2.0,-3.0l2.0,0.0l0.0,2.0L4.0,19.0l0.0,-2.0zM2.0,4.0l0.0,4.0l20.0,0.0L22.0,4.0L2.0,4.0zm4.0,3.0L4.0,7.0L4.0,5.0l2.0,0.0l0.0,2.0zm-4.0,7.0l20.0,0.0l0.0,-4.0L2.0,10.0l0.0,4.0zm2.0,-3.0l2.0,0.0l0.0,2.0L4.0,13.0l0.0,-2.0z"/>
-</vector>
diff --git a/res/drawable/ic_dashboard_system.xml b/res/drawable/ic_dashboard_system.xml
deleted file mode 100644
index fdd9214..0000000
--- a/res/drawable/ic_dashboard_system.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
- -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24.0dp"
- android:height="24.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#606060"
- android:pathData="M11.0,17.0l2.0,0.0l0.0,-6.0l-2.0,0.0l0.0,6.0zm1.0,-15.0C6.48,2.0 2.0,6.48 2.0,12.0s4.48,10.0 10.0,10.0 10.0,-4.48 10.0,-10.0S17.52,2.0 12.0,2.0zm0.0,18.0c-4.41,0.0 -8.0,-3.59 -8.0,-8.0s3.59,-8.0 8.0,-8.0 8.0,3.59 8.0,8.0 -3.59,8.0 -8.0,8.0zM11.0,9.0l2.0,0.0L13.0,7.0l-2.0,0.0l0.0,2.0z"/>
-</vector>
diff --git a/res/drawable/ic_dashboard_user.xml b/res/drawable/ic_dashboard_user.xml
deleted file mode 100644
index 302d33e..0000000
--- a/res/drawable/ic_dashboard_user.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
- -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24.0dp"
- android:height="24.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#aeb32a"
- android:pathData="M3.0,5.0
- l0.0,14.0c0.0,1.0 0.89,2.0 2.0,2.0l14.0,0.0c1.1,0.0 2.0,-0.9 2.0,-2.0
- L21.0,5.0c0.0,-1.1 -0.9,-2.0 -2.0,-2.0
- L5.0,3.0c-1.11,0.0 -2.0,0.9 -2.0,2.0zm12.0,4.0c0.0,1.66 -1.34,3.0 -3.0,3.0s-3.0,-1.34 -3.0,-3.0 1.34,-3.0 3.0,-3.0 3.0,1.34 3.0,3.0zm-9.0,8.0c0.0,-2.0 4.0,-3.1 6.0,-3.1s6.0,1.1 6.0,3.1l0.0,1.0
- l-12.0,0l0.0,-1.0z"/>
-</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_devices_other.xml b/res/drawable/ic_devices_other.xml
index 73407a3..20639a3 100644
--- a/res/drawable/ic_devices_other.xml
+++ b/res/drawable/ic_devices_other.xml
@@ -17,8 +17,9 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
- android:viewportHeight="24.0">
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
<path
android:pathData="M3,6h18L21,4L3,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h4v-2L3,18L3,6zM13,12L9,12v1.78c-0.61,0.55 -1,1.33 -1,2.22s0.39,1.67 1,2.22L9,20h4v-1.78c0.61,-0.55 1,-1.34 1,-2.22s-0.39,-1.67 -1,-2.22L13,12zM11,17.5c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5zM22,8h-6c-0.5,0 -1,0.5 -1,1v10c0,0.5 0.5,1 1,1h6c0.5,0 1,-0.5 1,-1L23,9c0,-0.5 -0.5,-1 -1,-1zM21,18h-4v-8h4v8z"
- android:fillColor="#0b9c57"/>
+ android:fillColor="#FFFFFFFF"/>
</vector>
diff --git a/res/drawable/ic_help.xml b/res/drawable/ic_help.xml
index 5b056e7..7a225e5 100644
--- a/res/drawable/ic_help.xml
+++ b/res/drawable/ic_help.xml
@@ -17,8 +17,9 @@
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
- android:viewportHeight="24.0">
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
<path
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,19h-2v-2h2v2zM15.07,11.25l-0.9,0.92C13.45,12.9 13,13.5 13,15h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2L8,9c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88 -0.36,1.68 -0.93,2.25z"
- android:fillColor="#f3501d"/>
+ android:fillColor="#FFFFFFFF"/>
</vector>
diff --git a/res/drawable/ic_settings_accessibility.xml b/res/drawable/ic_settings_accessibility.xml
index a689c4a..34c0bdd 100644
--- a/res/drawable/ic_settings_accessibility.xml
+++ b/res/drawable/ic_settings_accessibility.xml
@@ -17,8 +17,9 @@
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="24.0"
- android:viewportHeight="24.0">
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
<path
- android:fillColor="#3e50b4"
+ android:fillColor="#FFFFFFFF"
android:pathData="M12.0,2.0c1.1,0.0 2.0,0.9 2.0,2.0s-0.9,2.0 -2.0,2.0 -2.0,-0.9 -2.0,-2.0 0.9,-2.0 2.0,-2.0zm9.0,7.0l-6.0,0.0l0.0,13.0l-2.0,0.0l0.0,-6.0l-2.0,0.0l0.0,6.0L9.0,22.0L9.0,9.0L3.0,9.0L3.0,7.0l18.0,0.0l0.0,2.0z"/>
</vector>
diff --git a/res/drawable/ic_settings_battery.xml b/res/drawable/ic_settings_battery.xml
index f1e56d8..c8e053d 100644
--- a/res/drawable/ic_settings_battery.xml
+++ b/res/drawable/ic_settings_battery.xml
@@ -17,9 +17,10 @@
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="24.0"
- android:viewportHeight="24.0">
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
<path
- android:fillColor="#4184f3"
+ android:fillColor="#FFFFFFFF"
android:pathData="M15.67,4.0L14.0,4.0L14.0,2.0l-4.0,0.0l0.0,2.0L8.33,4.0C7.6,4.0 7.0,4.6 7.0,5.33l0.0,15.33C7.0,21.4 7.6,22.0 8.33,22.0l7.33,0.0c0.74,0.0 1.34,-0.6 1.34,-1.33L17.0,5.33C17.0,4.6 16.4,4.0 15.67,4.0z
M16,5l0,5.5l-8,0l0,-5.5l3,0l0,-2l2,0l0,2l3,0z"/>
</vector>
diff --git a/res/values/config.xml b/res/values/config.xml
index 0fa2b71..f81bf9b 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -67,4 +67,36 @@
<!-- If the support features are enabled. -->
<bool name="config_support_enabled">false</bool>
+ <!-- List containing the component names of pre-installed screen reader services. -->
+ <string-array name="config_preinstalled_screen_reader_services" translatable="false">
+ <!--
+ <item>com.example.package.first/com.example.class.FirstService</item>
+ <item>com.example.package.second/com.example.class.SecondService</item>
+ -->
+ </string-array>
+
+ <!-- List containing the component names of pre-installed audio and captioning services. -->
+ <string-array name="config_preinstalled_audio_and_caption_services" translatable="false">
+ <!--
+ <item>com.example.package.first/com.example.class.FirstService</item>
+ <item>com.example.package.second/com.example.class.SecondService</item>
+ -->
+ </string-array>
+
+ <!-- List containing the component names of pre-installed display services. -->
+ <string-array name="config_preinstalled_display_services" translatable="false">
+ <!--
+ <item>com.example.package.first/com.example.class.FirstService</item>
+ <item>com.example.package.second/com.example.class.SecondService</item>
+ -->
+ </string-array>
+
+ <!-- List containing the component names of pre-installed interaction control services. -->
+ <string-array name="config_preinstalled_interaction_control_services" translatable="false">
+ <!--
+ <item>com.example.package.first/com.example.class.FirstService</item>
+ <item>com.example.package.second/com.example.class.SecondService</item>
+ -->
+ </string-array>
+
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 10bd724..8673359 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3978,18 +3978,22 @@
<string name="vision_settings_title">Vision Settings</string>
<!-- Settings description for a brief version of Vision-Related Accessibility Settings. Tells the user that they can adjust these settings now to help them through the remainder of the Setup Wizard and that they can later be changed in Settings. Displayed in Setup Wizard only. [CHAR LIMIT=none] -->
<string name="vision_settings_description">You can customize this device to fit your needs. These accessibility features can be changed later in Settings.</string>
- <!-- Title for the accessibility preference category of accessibility services. [CHAR LIMIT=25] -->
- <string name="accessibility_services_title">Services</string>
+ <!-- Title for the accessibility preference category of screen reader services and settings. [CHAR LIMIT=50] -->
+ <string name="screen_reader_category_title">Screen readers</string>
+ <!-- Title for the accessibility preference category of audio services and settings. [CHAR LIMIT=50] -->
+ <string name="audio_and_captions_category_title">Audio & on-screen text</string>
+ <!-- Title for the accessibility preference category of display services and settings. [CHAR LIMIT=50] -->
+ <string name="display_category_title">Display</string>
+ <!-- Title for the accessibility preference category of interaction control services and settings. [CHAR LIMIT=50] -->
+ <string name="interaction_control_category_title">Interaction controls</string>
+ <!-- Title for the accessibility preference category of services downloaded by the user. [CHAR LIMIT=50] -->
+ <string name="user_installed_services_category_title">Downloaded services</string>
<!-- Title for the Talkback Accessibility Service. Displayed on the Accessibility Settings screen in Setup Wizard. [CHAR_LIMIT=25] -->
<string name="talkback_title">Talkback</string>
<!-- Summary for the Talkback Accessibility Service. Lets the user know that Talkback is a screenreader and that it is usually most helpful to blind and low vision users and whether the service is on. [CHAR_LIMIT=none] -->
<string name="talkback_summary">Screen reader primarily for people with blindness and low vision</string>
<!-- Summary for the Select to Speak Accessibility Service. [CHAR_LIMIT=none] -->
<string name="select_to_speak_summary">Tap items on your screen to hear them read aloud</string>
- <!-- Title for the accessibility preference category of system related preferences. [CHAR LIMIT=25] -->
- <string name="accessibility_system_title">System</string>
- <!-- Title for the accessibility preference category of display related preferences. [CHAR LIMIT=25] -->
- <string name="accessibility_display_title">Display</string>
<!-- Title for the accessibility preference screen to enable video captioning. [CHAR LIMIT=35] -->
<string name="accessibility_captioning_title">Captions</string>
<!-- Title for the accessibility preference screen to enable screen magnification. [CHAR LIMIT=35] -->
@@ -4180,10 +4184,10 @@
<string name="disable_service_message">Tapping OK will
stop <xliff:g id="service" example="TalkBack">%1$s</xliff:g>.</string>
- <!-- Title for the prompt shown as a placeholder if no accessibility serivices are installed. [CHAR LIMIT=50] -->
+ <!-- Title for the prompt shown as a placeholder if no accessibility services are installed. [CHAR LIMIT=50] -->
<string name="accessibility_no_services_installed">No services installed</string>
- <!-- Default description for an accessibility serivice if the latter doesn't provide one. [CHAR LIMIT=NONE] -->
+ <!-- Default description for an accessibility service if the latter doesn't provide one. [CHAR LIMIT=NONE] -->
<string name="accessibility_service_default_description">No description provided.</string>
<!-- Accessibility settings: button for lauching settings for an accessibility service -->
@@ -4204,7 +4208,7 @@
<!-- Title for print service settings screen [CHAR LIMIT=25] -->
<string name="print_settings_title">Print services</string>
- <!-- Title for the prompt shown as a placeholder if no print serivices are installed. [CHAR LIMIT=50] -->
+ <!-- Title for the prompt shown as a placeholder if no print services are installed. [CHAR LIMIT=50] -->
<string name="print_no_services_installed">No services installed</string>
<!-- Title for the prompt shown as a placeholder if no printers are found while searching. [CHAR LIMIT=50] -->
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index ee21017..478dfe5 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -18,38 +18,42 @@
android:title="@string/accessibility_settings"
android:persistent="true">
+ <ListPreference
+ android:key="accessibility_shortcut_preference"
+ android:title="@string/accessibility_global_gesture_preference_title"/>
+
<PreferenceCategory
- android:key="services_category"
- android:title="@string/accessibility_services_title">
+ android:key="user_installed_services_category"
+ android:title="@string/user_installed_services_category_title">
</PreferenceCategory>
<PreferenceCategory
- android:key="system_category"
- android:title="@string/accessibility_system_title">
+ android:key="screen_reader_category"
+ android:title="@string/screen_reader_category_title">
<Preference
- android:fragment="com.android.settings.accessibility.CaptionPropertiesFragment"
- android:key="captioning_preference_screen"
- android:title="@string/accessibility_captioning_title" />
+ android:key="tts_settings_preference"
+ android:fragment="com.android.settings.tts.TextToSpeechSettings"
+ android:title="@string/tts_settings_title"/>
+ </PreferenceCategory>
+
+ <PreferenceCategory
+ android:key="display_category"
+ android:title="@string/display_category_title">
<Preference
- android:fragment="com.android.settings.accessibility.ToggleScreenMagnificationPreferenceFragment"
- android:key="screen_magnification_preference_screen"
- android:title="@string/accessibility_screen_magnification_title"/>
-
- <Preference
- android:fragment="com.android.settings.accessibility.ToggleFontSizePreferenceFragment"
- android:key="font_size_preference_screen"
- android:title="@string/title_font_size"/>
+ android:fragment="com.android.settings.accessibility.ToggleFontSizePreferenceFragment"
+ android:key="font_size_preference_screen"
+ android:title="@string/title_font_size"/>
<com.android.settings.display.ScreenZoomPreference
- android:key="screen_zoom"
- android:title="@string/screen_zoom_title"/>
+ android:key="screen_zoom"
+ android:title="@string/screen_zoom_title"/>
<Preference
- android:fragment="com.android.settings.accessibility.ToggleAutoclickPreferenceFragment"
- android:key="autoclick_preference_screen"
- android:title="@string/accessibility_autoclick_preference_title"/>
+ android:fragment="com.android.settings.accessibility.ToggleScreenMagnificationPreferenceFragment"
+ android:key="screen_magnification_preference_screen"
+ android:title="@string/accessibility_screen_magnification_title"/>
<SwitchPreference
android:key="toggle_high_text_contrast_preference"
@@ -57,6 +61,31 @@
android:summary="@string/experimental_preference"/>
<SwitchPreference
+ android:key="toggle_inversion_preference"
+ android:title="@string/accessibility_display_inversion_preference_title"
+ android:summary="@string/accessibility_display_inversion_preference_subtitle"
+ android:persistent="false" />
+
+ <Preference
+ android:fragment="com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment"
+ android:key="daltonizer_preference_screen"
+ android:title="@string/accessibility_display_daltonizer_preference_title" />
+
+ <SwitchPreference
+ android:key="toggle_large_pointer_icon"
+ android:title="@string/accessibility_toggle_large_pointer_icon_title" />
+ </PreferenceCategory>
+
+ <PreferenceCategory
+ android:key="interaction_control_category"
+ android:title="@string/interaction_control_category_title">
+
+ <Preference
+ android:fragment="com.android.settings.accessibility.ToggleAutoclickPreferenceFragment"
+ android:key="autoclick_preference_screen"
+ android:title="@string/accessibility_autoclick_preference_title"/>
+
+ <SwitchPreference
android:key="toggle_power_button_ends_call_preference"
android:title="@string/accessibility_power_button_ends_call_prerefence_title"
android:persistent="false"/>
@@ -66,9 +95,17 @@
android:title="@string/accelerometer_title"
android:persistent="false"/>
- <SwitchPreference
- android:key="toggle_large_pointer_icon"
- android:title="@string/accessibility_toggle_large_pointer_icon_title" />
+ <ListPreference
+ android:key="select_long_press_timeout_preference"
+ android:title="@string/accessibility_long_press_timeout_preference_title"
+ android:entries="@array/long_press_timeout_selector_titles"
+ android:entryValues="@array/long_press_timeout_selector_values"
+ android:persistent="false"/>
+ </PreferenceCategory>
+
+ <PreferenceCategory
+ android:key="audio_and_captions_category"
+ android:title="@string/audio_and_captions_category_title">
<SwitchPreference
android:key="toggle_master_mono"
@@ -76,35 +113,9 @@
android:summary="@string/accessibility_toggle_master_mono_summary"
android:persistent="false"/>
- <ListPreference
- android:key="accessibility_shortcut_preference"
- android:title="@string/accessibility_global_gesture_preference_title"/>
-
<Preference
- android:key="tts_settings_preference"
- android:fragment="com.android.settings.tts.TextToSpeechSettings"
- android:title="@string/tts_settings_title"/>
-
- <ListPreference android:key="select_long_press_timeout_preference"
- android:title="@string/accessibility_long_press_timeout_preference_title"
- android:entries="@array/long_press_timeout_selector_titles"
- android:entryValues="@array/long_press_timeout_selector_values"
- android:persistent="false"/>
-
+ android:fragment="com.android.settings.accessibility.CaptionPropertiesFragment"
+ android:key="captioning_preference_screen"
+ android:title="@string/accessibility_captioning_title" />
</PreferenceCategory>
-
- <PreferenceCategory
- android:key="display_category"
- android:title="@string/accessibility_display_title" >
- <SwitchPreference
- android:key="toggle_inversion_preference"
- android:title="@string/accessibility_display_inversion_preference_title"
- android:summary="@string/accessibility_display_inversion_preference_subtitle"
- android:persistent="false" />
- <Preference
- android:fragment="com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment"
- android:key="daltonizer_preference_screen"
- android:title="@string/accessibility_display_daltonizer_preference_title" />
- </PreferenceCategory>
-
</PreferenceScreen>
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 807371e..672f4ed 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -25,6 +25,7 @@
import android.content.pm.PackageManager;
import android.content.pm.ServiceInfo;
import android.content.res.Resources;
+import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@@ -35,7 +36,9 @@
import android.support.v7.preference.ListPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceCategory;
+import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
+import android.util.ArrayMap;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.accessibility.AccessibilityManager;
@@ -46,18 +49,17 @@
import com.android.internal.view.RotationPolicy.RotationPolicyListener;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.SingleLineSummaryPreference;
import com.android.settings.Utils;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settings.search.SearchIndexableRaw;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
-import com.android.settingslib.RestrictedPreference;
import com.android.settingslib.accessibility.AccessibilityUtils;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -68,9 +70,20 @@
public class AccessibilitySettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener, Indexable {
+ // Index of the first preference in a preference category.
+ private static final int FIRST_PREFERENCE_IN_CATEGORY_INDEX = 0;
+
// Preference categories
- private static final String SERVICES_CATEGORY = "services_category";
- private static final String SYSTEM_CATEGORY = "system_category";
+ private static final String CATEGORY_SCREEN_READER = "screen_reader_category";
+ private static final String CATEGORY_AUDIO_AND_CAPTIONS = "audio_and_captions_category";
+ private static final String CATEGORY_DISPLAY = "display_category";
+ private static final String CATEGORY_INTERACTION_CONTROL = "interaction_control_category";
+ private static final String CATEGORY_DOWNLOADED_SERVICES = "user_installed_services_category";
+
+ private static final String[] CATEGORIES = new String[] {
+ CATEGORY_SCREEN_READER, CATEGORY_AUDIO_AND_CAPTIONS, CATEGORY_DISPLAY,
+ CATEGORY_INTERACTION_CONTROL, CATEGORY_DOWNLOADED_SERVICES
+ };
// Preferences
private static final String TOGGLE_HIGH_TEXT_CONTRAST_PREFERENCE =
@@ -118,10 +131,7 @@
// ID for dialog that confirms shortcut capabilities
private static final int DIALOG_ID_ADD_SHORTCUT_WARNING = 1;
- // Auxiliary members.
- static final Set<ComponentName> sInstalledServices = new HashSet<>();
-
- private final Map<String, String> mLongPressTimeoutValuetoTitleMap = new HashMap<>();
+ private final Map<String, String> mLongPressTimeoutValueToTitleMap = new HashMap<>();
private final Handler mHandler = new Handler();
@@ -129,7 +139,7 @@
@Override
public void run() {
if (getActivity() != null) {
- updateServicesPreferences();
+ updateServicePreferences();
}
}
};
@@ -164,7 +174,7 @@
new SettingsContentObserver(mHandler) {
@Override
public void onChange(boolean selfChange, Uri uri) {
- updateServicesPreferences();
+ updateServicePreferences();
}
};
@@ -175,9 +185,12 @@
}
};
- // Preference controls.
- private PreferenceCategory mServicesCategory;
- private PreferenceCategory mSystemsCategory;
+ private final Map<String, PreferenceCategory> mCategoryToPrefCategoryMap =
+ new ArrayMap<>();
+ private final Map<Preference, PreferenceCategory> mServicePreferenceToPreferenceCategoryMap =
+ new ArrayMap<>();
+ private final Map<ComponentName, PreferenceCategory> mPreBundledServiceComponentToCategoryMap =
+ new ArrayMap<>();
private SwitchPreference mToggleHighTextContrastPreference;
private SwitchPreference mTogglePowerButtonEndsCallPreference;
@@ -260,7 +273,7 @@
Settings.Secure.putInt(getContentResolver(),
Settings.Secure.LONG_PRESS_TIMEOUT, Integer.parseInt(stringValue));
mSelectLongPressTimeoutPreference.setSummary(
- mLongPressTimeoutValuetoTitleMap.get(stringValue));
+ mLongPressTimeoutValueToTitleMap.get(stringValue));
}
private void handleToggleInversionPreferenceChange(boolean checked) {
@@ -386,8 +399,10 @@
}
private void initializeAllPreferences() {
- mServicesCategory = (PreferenceCategory) findPreference(SERVICES_CATEGORY);
- mSystemsCategory = (PreferenceCategory) findPreference(SYSTEM_CATEGORY);
+ for (int i = 0; i < CATEGORIES.length; i++) {
+ PreferenceCategory prefCategory = (PreferenceCategory) findPreference(CATEGORIES[i]);
+ mCategoryToPrefCategoryMap.put(CATEGORIES[i], prefCategory);
+ }
// Text contrast.
mToggleHighTextContrastPreference =
@@ -402,14 +417,16 @@
(SwitchPreference) findPreference(TOGGLE_POWER_BUTTON_ENDS_CALL_PREFERENCE);
if (!KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_POWER)
|| !Utils.isVoiceCapable(getActivity())) {
- mSystemsCategory.removePreference(mTogglePowerButtonEndsCallPreference);
+ mCategoryToPrefCategoryMap.get(CATEGORY_INTERACTION_CONTROL)
+ .removePreference(mTogglePowerButtonEndsCallPreference);
}
// Lock screen rotation.
mToggleLockScreenRotationPreference =
(SwitchPreference) findPreference(TOGGLE_LOCK_SCREEN_ROTATION_PREFERENCE);
if (!RotationPolicy.isRotationSupported(getActivity())) {
- mSystemsCategory.removePreference(mToggleLockScreenRotationPreference);
+ mCategoryToPrefCategoryMap.get(CATEGORY_INTERACTION_CONTROL)
+ .removePreference(mToggleLockScreenRotationPreference);
}
// Large pointer icon.
@@ -424,7 +441,7 @@
mSelectLongPressTimeoutPreference =
(ListPreference) findPreference(SELECT_LONG_PRESS_TIMEOUT_PREFERENCE);
mSelectLongPressTimeoutPreference.setOnPreferenceChangeListener(this);
- if (mLongPressTimeoutValuetoTitleMap.size() == 0) {
+ if (mLongPressTimeoutValueToTitleMap.size() == 0) {
String[] timeoutValues = getResources().getStringArray(
R.array.long_press_timeout_selector_values);
mLongPressTimeoutDefault = Integer.parseInt(timeoutValues[0]);
@@ -432,7 +449,7 @@
R.array.long_press_timeout_selector_titles);
final int timeoutValueCount = timeoutValues.length;
for (int i = 0; i < timeoutValueCount; i++) {
- mLongPressTimeoutValuetoTitleMap.put(timeoutValues[i], timeoutTitles[i]);
+ mLongPressTimeoutValueToTitleMap.put(timeoutValues[i], timeoutTitles[i]);
}
}
@@ -459,17 +476,32 @@
}
private void updateAllPreferences() {
- updateServicesPreferences();
updateSystemPreferences();
+ updateServicePreferences();
}
- private void updateServicesPreferences() {
+ private void updateServicePreferences() {
// Since services category is auto generated we have to do a pass
// to generate it since services can come and go and then based on
// the global accessibility state to decided whether it is enabled.
// Generate.
- mServicesCategory.removeAll();
+ ArrayList<Preference> servicePreferences =
+ new ArrayList<>(mServicePreferenceToPreferenceCategoryMap.keySet());
+ for (int i = 0; i < servicePreferences.size(); i++) {
+ Preference service = servicePreferences.get(i);
+ PreferenceCategory category = mServicePreferenceToPreferenceCategoryMap.get(service);
+ category.removePreference(service);
+ }
+
+ initializePreBundledServicesMapFromArray(CATEGORY_SCREEN_READER,
+ R.array.config_preinstalled_screen_reader_services);
+ initializePreBundledServicesMapFromArray(CATEGORY_AUDIO_AND_CAPTIONS,
+ R.array.config_preinstalled_audio_and_caption_services);
+ initializePreBundledServicesMapFromArray(CATEGORY_DISPLAY,
+ R.array.config_preinstalled_display_services);
+ initializePreBundledServicesMapFromArray(CATEGORY_INTERACTION_CONTROL,
+ R.array.config_preinstalled_interaction_control_services);
AccessibilityManager accessibilityManager = AccessibilityManager.getInstance(getActivity());
@@ -482,36 +514,49 @@
final boolean accessibilityEnabled = Settings.Secure.getInt(getContentResolver(),
Settings.Secure.ACCESSIBILITY_ENABLED, 0) == 1;
+ PreferenceCategory downloadedServicesCategory =
+ mCategoryToPrefCategoryMap.get(CATEGORY_DOWNLOADED_SERVICES);
+ // Temporarily add the downloaded services category back if it was previously removed.
+ if (findPreference(CATEGORY_DOWNLOADED_SERVICES) == null) {
+ getPreferenceScreen().addPreference(downloadedServicesCategory);
+ }
+
for (int i = 0, count = installedServices.size(); i < count; ++i) {
AccessibilityServiceInfo info = installedServices.get(i);
- RestrictedPreference preference =
- new RestrictedPreference(mServicesCategory.getContext());
+ SingleLineSummaryPreference preference =
+ new SingleLineSummaryPreference(downloadedServicesCategory.getContext(), null);
String title = info.getResolveInfo().loadLabel(getPackageManager()).toString();
+ Drawable icon = info.getResolveInfo().loadIcon(getPackageManager());
+ if (icon == null) {
+ // todo (saigem): add a default
+ }
+
ServiceInfo serviceInfo = info.getResolveInfo().serviceInfo;
- ComponentName componentName = new ComponentName(serviceInfo.packageName,
- serviceInfo.name);
+ String packageName = serviceInfo.packageName;
+ ComponentName componentName = new ComponentName(packageName, serviceInfo.name);
+ String componentNameKey = componentName.flattenToString();
preference.setKey(componentName.flattenToString());
preference.setTitle(title);
+ preference.setIcon(icon);
final boolean serviceEnabled = accessibilityEnabled
&& enabledServices.contains(componentName);
- String serviceEnabledString;
- if (serviceEnabled) {
- serviceEnabledString = getString(R.string.accessibility_feature_state_on);
- } else {
- serviceEnabledString = getString(R.string.accessibility_feature_state_off);
- }
+ String serviceState = serviceEnabled ?
+ getString(R.string.accessibility_feature_state_on) :
+ getString(R.string.accessibility_feature_state_off);
+ String serviceSummary = info.loadSummary(getPackageManager());
+ serviceSummary = (TextUtils.isEmpty(serviceSummary)) ? serviceState.toUpperCase() :
+ serviceState.toUpperCase() + " / " + serviceSummary;
// Disable all accessibility services that are not permitted.
- String packageName = serviceInfo.packageName;
boolean serviceAllowed =
permittedServices == null || permittedServices.contains(packageName);
if (!serviceAllowed && !serviceEnabled) {
EnforcedAdmin admin = RestrictedLockUtils.checkIfAccessibilityServiceDisallowed(
- getActivity(), serviceInfo.packageName, UserHandle.myUserId());
+ getActivity(), packageName, UserHandle.myUserId());
if (admin != null) {
preference.setDisabledByAdmin(admin);
} else {
@@ -521,9 +566,7 @@
preference.setEnabled(true);
}
- preference.setSummary(serviceEnabledString);
-
- preference.setOrder(i);
+ preference.setSummary(serviceSummary);
preference.setFragment(ToggleAccessibilityServicePreferenceFragment.class.getName());
preference.setPersistent(true);
@@ -543,26 +586,33 @@
extras.putString(EXTRA_SETTINGS_TITLE,
getString(R.string.accessibility_menu_item_settings));
extras.putString(EXTRA_SETTINGS_COMPONENT_NAME,
- new ComponentName(info.getResolveInfo().serviceInfo.packageName,
- settingsClassName).flattenToString());
+ new ComponentName(packageName, settingsClassName).flattenToString());
}
-
extras.putParcelable(EXTRA_COMPONENT_NAME, componentName);
- mServicesCategory.addPreference(preference);
+ PreferenceCategory prefCategory = downloadedServicesCategory;
+ // Set the appropriate category if the service comes pre-installed.
+ if (mPreBundledServiceComponentToCategoryMap.containsKey(componentName)) {
+ prefCategory = mPreBundledServiceComponentToCategoryMap.get(componentName);
+ }
+ preference.setOrder(FIRST_PREFERENCE_IN_CATEGORY_INDEX);
+ prefCategory.addPreference(preference);
+ mServicePreferenceToPreferenceCategoryMap.put(preference, prefCategory);
}
- if (mServicesCategory.getPreferenceCount() == 0) {
- if (mNoServicesMessagePreference == null) {
- mNoServicesMessagePreference = new Preference(getPrefContext());
- mNoServicesMessagePreference.setPersistent(false);
- mNoServicesMessagePreference.setLayoutResource(
- R.layout.text_description_preference);
- mNoServicesMessagePreference.setSelectable(false);
- mNoServicesMessagePreference.setSummary(
- getString(R.string.accessibility_no_services_installed));
- }
- mServicesCategory.addPreference(mNoServicesMessagePreference);
+ // If the user has not installed any additional services, hide the category.
+ if (downloadedServicesCategory.getPreferenceCount() == 0) {
+ PreferenceScreen screen = getPreferenceScreen();
+ screen.removePreference(downloadedServicesCategory);
+ }
+ }
+
+ private void initializePreBundledServicesMapFromArray(String categoryKey, int key) {
+ String[] services = getResources().getStringArray(key);
+ PreferenceCategory category = mCategoryToPrefCategoryMap.get(categoryKey);
+ for (int i = 0; i < services.length; i++) {
+ ComponentName component = ComponentName.unflattenFromString(services[i]);
+ mPreBundledServiceComponentToCategoryMap.put(component, category);
}
}
@@ -602,7 +652,7 @@
Settings.Secure.LONG_PRESS_TIMEOUT, mLongPressTimeoutDefault);
String value = String.valueOf(longPressTimeout);
mSelectLongPressTimeoutPreference.setValue(value);
- mSelectLongPressTimeoutPreference.setSummary(mLongPressTimeoutValuetoTitleMap.get(value));
+ mSelectLongPressTimeoutPreference.setSummary(mLongPressTimeoutValueToTitleMap.get(value));
updateFeatureSummary(Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED,
mCaptioningPreferenceScreen);
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 99c46bf..acb99a6 100644
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -99,6 +99,8 @@
private final IntentFilter mIntentFilter;
+ // For Search
+ private static final String DATA_KEY_REFERENCE = "main_toggle_bluetooth";
// accessed from inner class (not private to avoid thunks)
FooterPreference mMyDevicePreference;
@@ -567,6 +569,7 @@
SearchIndexableRaw data = new SearchIndexableRaw(context);
data.title = res.getString(R.string.bluetooth_settings);
data.screenTitle = res.getString(R.string.bluetooth_settings);
+ data.key = DATA_KEY_REFERENCE;
result.add(data);
// Add cached paired BT devices
diff --git a/src/com/android/settings/core/instrumentation/SharedPreferencesLogger.java b/src/com/android/settings/core/instrumentation/SharedPreferencesLogger.java
index a5efcc1..6c23b39 100644
--- a/src/com/android/settings/core/instrumentation/SharedPreferencesLogger.java
+++ b/src/com/android/settings/core/instrumentation/SharedPreferencesLogger.java
@@ -21,6 +21,7 @@
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.text.TextUtils;
+import android.util.Pair;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.overlay.FeatureFactory;
@@ -111,13 +112,17 @@
return;
}
// Pref key exists in set, log it's change in metrics.
- mMetricsFeature.count(mContext, prefKey + "|" + value, 1);
+ mMetricsFeature.action(mContext, MetricsEvent.ACTION_SETTINGS_PREFERENCE_CHANGE,
+ Pair.create(MetricsEvent.FIELD_SETTINGS_PREFERENCE_CHANGE_NAME, prefKey),
+ Pair.create(MetricsEvent.FIELD_SETTINGS_PREFERENCE_CHANGE_VALUE, value));
}
private void logPackageName(String key, String value) {
- mMetricsFeature.count(mContext, mTag + "/" + key, 1);
+ final String prefKey = mTag + "/" + key;
+ mMetricsFeature.action(mContext, MetricsEvent.ACTION_SETTINGS_PREFERENCE_CHANGE,
+ Pair.create(MetricsEvent.FIELD_SETTINGS_PREFERENCE_CHANGE_NAME, prefKey));
mMetricsFeature.action(mContext, MetricsEvent.ACTION_GENERIC_PACKAGE,
- mTag + "/" + key + "|" + value);
+ prefKey + "|" + value);
}
private void safeLogValue(String key, String value) {
diff --git a/src/com/android/settings/fuelgauge/PowerUsageAdvanced.java b/src/com/android/settings/fuelgauge/PowerUsageAdvanced.java
index fc96340..f18ae65 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageAdvanced.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageAdvanced.java
@@ -59,7 +59,8 @@
UsageType.BLUETOOTH,
UsageType.USER,
UsageType.IDLE,
- UsageType.APP};
+ UsageType.APP,
+ UsageType.UNACCOUNTED};
private BatteryHistoryPreference mHistPref;
private PreferenceGroup mUsageListGroup;
private PowerUsageFeatureProvider mPowerUsageFeatureProvider;
@@ -114,7 +115,7 @@
mUsageListGroup.removeAll();
for (int i = 0, size = dataList.size(); i < size; i++) {
final PowerUsageData batteryData = dataList.get(i);
- final PowerGaugePreference pref = new PowerGaugePreference(getContext());
+ final PowerGaugePreference pref = new PowerGaugePreference(getPrefContext());
pref.setTitle(batteryData.titleResId);
pref.setSummary(batteryData.summary);
@@ -139,6 +140,8 @@
return UsageType.USER;
} else if (drainType == DrainType.CELL) {
return UsageType.CELL;
+ } else if (drainType == DrainType.UNACCOUNTED) {
+ return UsageType.UNACCOUNTED;
} else if (mPowerUsageFeatureProvider.isTypeSystem(sipper)) {
return UsageType.SYSTEM;
} else if (mPowerUsageFeatureProvider.isTypeService(sipper)) {
@@ -200,7 +203,8 @@
UsageType.SYSTEM,
UsageType.BLUETOOTH,
UsageType.USER,
- UsageType.IDLE})
+ UsageType.IDLE,
+ UsageType.UNACCOUNTED})
public @interface UsageType {
int APP = 0;
int WIFI = 1;
@@ -210,6 +214,7 @@
int BLUETOOTH = 5;
int USER = 6;
int IDLE = 7;
+ int UNACCOUNTED = 8;
}
@StringRes
@@ -249,6 +254,8 @@
return R.string.power_user;
case UsageType.IDLE:
return R.string.power_idle;
+ case UsageType.UNACCOUNTED:
+ return R.string.power_unaccounted;
case UsageType.APP:
default:
return R.string.power_apps;
diff --git a/src/com/android/settings/search2/CursorToSearchResultConverter.java b/src/com/android/settings/search2/CursorToSearchResultConverter.java
index 880a65b..71d999e 100644
--- a/src/com/android/settings/search2/CursorToSearchResultConverter.java
+++ b/src/com/android/settings/search2/CursorToSearchResultConverter.java
@@ -35,6 +35,7 @@
import com.android.settings.dashboard.SiteMapManager;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -77,6 +78,22 @@
private final Set<String> mKeys;
+ private final int LONG_TITLE_LENGTH = 20;
+
+ private static final String[] whiteList = {
+ "main_toggle_wifi",
+ "main_toggle_bluetooth",
+ "toggle_airplane",
+ "tether_settings",
+ "battery_saver",
+ "toggle_nfc",
+ "restrict_background",
+ "data_usage_enable",
+ "button_roaming_key",
+ };
+ private static final Set<String> prioritySettings = new HashSet(Arrays.asList(whiteList));
+
+
public CursorToSearchResultConverter(Context context, String queryText) {
mContext = context;
mKeys = new HashSet<>();
@@ -135,7 +152,7 @@
}
final List<String> breadcrumbs = getBreadcrumbs(sitemapManager, cursor);
- final int rank = getRank(breadcrumbs, baseRank);
+ final int rank = getRank(title, breadcrumbs, baseRank, key);
final SearchResult.Builder builder = new SearchResult.Builder();
builder.addTitle(title)
@@ -225,18 +242,32 @@
}
/** Uses the breadcrumbs to determine the offset to the base rank.
- * There are two checks
- * A) If the query matches the highest level menu title
- * B) If the query matches a subsequent menu title
+ * There are three checks
+ * A) If the result is prioritized and the highest base level
+ * B) If the query matches the highest level menu title
+ * C) If the query matches a subsequent menu title
+ * D) Is the title longer than 20
*
- * If the query matches A and B, the offset is 0.
- * If the query matches A only, the offset is 1.
- * If the query matches neither A nor B, the offset is 2.
+ * If the query matches A, set it to TOP_RANK
+ * If the query matches B and C, the offset is 0.
+ * If the query matches C only, the offset is 1.
+ * If the query matches neither B nor C, the offset is 2.
+ * If the query matches D, the offset is 2
+
+ * @param title of the result.
* @param crumbs from the Information Architecture
* @param baseRank of the result. Lower if it's a better result.
* @return
*/
- private int getRank(List<String> crumbs, int baseRank) {
+ private int getRank(String title, List<String> crumbs, int baseRank, String key) {
+ // The result can only be prioritized if it is a top ranked result.
+ if (prioritySettings.contains(key) && baseRank < DatabaseResultLoader.BASE_RANKS[1]) {
+ return SearchResult.TOP_RANK;
+ }
+ if (title.length() > LONG_TITLE_LENGTH) {
+ return baseRank + 2;
+ }
return baseRank;
}
+
}
diff --git a/src/com/android/settings/search2/DatabaseResultLoader.java b/src/com/android/settings/search2/DatabaseResultLoader.java
index ad1e6a9..5892ebc 100644
--- a/src/com/android/settings/search2/DatabaseResultLoader.java
+++ b/src/com/android/settings/search2/DatabaseResultLoader.java
@@ -97,7 +97,7 @@
* If the query only matches keywords or entries, the best rank it can be is 9
*
*/
- private static final int[] BASE_RANKS = {1, 3, 7, 9};
+ public static final int[] BASE_RANKS = {1, 3, 7, 9};
private final String mQueryText;
private final Context mContext;
diff --git a/src/com/android/settings/search2/SearchResult.java b/src/com/android/settings/search2/SearchResult.java
index a82c47f..6b27d89 100644
--- a/src/com/android/settings/search2/SearchResult.java
+++ b/src/com/android/settings/search2/SearchResult.java
@@ -27,10 +27,15 @@
public class SearchResult implements Comparable<SearchResult> {
/**
- * Defines the max rank for a search result to be considered as ranked. Results with ranks
+ * Defines the lowest rank for a search result to be considered as ranked. Results with ranks
* higher than this have no guarantee for sorting order.
*/
- public static final int MAX_RANK = 10;
+ public static final int BOTTOM_RANK = 10;
+
+ /**
+ * Defines the highest rank for a search result. Used for special search results only.
+ */
+ public static final int TOP_RANK = 0;
/**
* The title of the result and main text displayed.
diff --git a/src/com/android/settings/search2/SearchResultsAdapter.java b/src/com/android/settings/search2/SearchResultsAdapter.java
index afe432a..5151b64 100644
--- a/src/com/android/settings/search2/SearchResultsAdapter.java
+++ b/src/com/android/settings/search2/SearchResultsAdapter.java
@@ -32,7 +32,8 @@
import java.util.List;
import java.util.Map;
-import static com.android.settings.search2.SearchResult.MAX_RANK;
+import static com.android.settings.search2.SearchResult.TOP_RANK;
+import static com.android.settings.search2.SearchResult.BOTTOM_RANK;
public class SearchResultsAdapter extends Adapter<SearchViewHolder> {
@@ -117,9 +118,9 @@
int dbIndex = 0;
int appIndex = 0;
- int rank = 1;
+ int rank = TOP_RANK;
- while (rank <= MAX_RANK) {
+ while (rank <= BOTTOM_RANK) {
while ((dbIndex < dbSize) && (databaseResults.get(dbIndex).rank == rank)) {
results.add(databaseResults.get(dbIndex++));
}
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index d652efa..9405e8c 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -168,6 +168,9 @@
private MenuItem mScanMenuItem;
+ // For Search
+ private static final String DATA_KEY_REFERENCE = "main_toggle_wifi";
+
/* End of "used in Wifi Setup context" */
public WifiSettings() {
@@ -1028,6 +1031,7 @@
data.title = res.getString(R.string.wifi_settings);
data.screenTitle = res.getString(R.string.wifi_settings);
data.keywords = res.getString(R.string.keywords_wifi);
+ data.key = DATA_KEY_REFERENCE;
result.add(data);
// Add saved Wi-Fi access points
diff --git a/tests/robotests/Android.mk b/tests/robotests/Android.mk
index 3fc034d..b448433 100644
--- a/tests/robotests/Android.mk
+++ b/tests/robotests/Android.mk
@@ -38,4 +38,6 @@
LOCAL_TEST_PACKAGE := Settings
+LOCAL_INSTRUMENT_SOURCE_DIRS := $(dir $(LOCAL_PATH))../src
+
include prebuilts/misc/common/robolectric/run_robotests.mk
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/core/instrumentation/SharedPreferenceLoggerTest.java b/tests/robotests/src/com/android/settings/core/instrumentation/SharedPreferenceLoggerTest.java
index eeaa175..763d6e3 100644
--- a/tests/robotests/src/com/android/settings/core/instrumentation/SharedPreferenceLoggerTest.java
+++ b/tests/robotests/src/com/android/settings/core/instrumentation/SharedPreferenceLoggerTest.java
@@ -17,6 +17,7 @@
import android.content.Context;
import android.content.SharedPreferences;
+import android.util.Pair;
import com.android.settings.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
@@ -32,7 +33,6 @@
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -71,7 +71,8 @@
editor.putInt(TEST_KEY, 2);
editor.putInt(TEST_KEY, 2);
- verify(mMetricsFeature, times(6)).count(any(Context.class), anyString(), anyInt());
+ verify(mMetricsFeature, times(6)).action(any(Context.class), anyInt(),
+ any(Pair.class), any(Pair.class));
}
@Test
@@ -83,7 +84,8 @@
editor.putBoolean(TEST_KEY, false);
editor.putBoolean(TEST_KEY, false);
- verify(mMetricsFeature, times(4)).count(any(Context.class), anyString(), anyInt());
+ verify(mMetricsFeature, times(4)).action(any(Context.class), anyInt(),
+ any(Pair.class), any(Pair.class));
}
@Test
@@ -95,7 +97,8 @@
editor.putLong(TEST_KEY, 1);
editor.putLong(TEST_KEY, 2);
- verify(mMetricsFeature, times(4)).count(any(Context.class), anyString(), anyInt());
+ verify(mMetricsFeature, times(4)).action(any(Context.class), anyInt(),
+ any(Pair.class), any(Pair.class));
}
@Test
@@ -107,7 +110,8 @@
editor.putFloat(TEST_KEY, 1);
editor.putFloat(TEST_KEY, 2);
- verify(mMetricsFeature, times(4)).count(any(Context.class), anyString(), anyInt());
+ verify(mMetricsFeature, times(4)).action(any(Context.class), anyInt(),
+ any(Pair.class), any(Pair.class));
}
}
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageAdvancedTest.java b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageAdvancedTest.java
index ed7e48b..494ac67 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageAdvancedTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageAdvancedTest.java
@@ -94,9 +94,9 @@
@Test
public void testExtractUsageType_TypeEqualsToDrainType_ReturnRelevantType() {
final DrainType drainTypes[] = {DrainType.WIFI, DrainType.BLUETOOTH, DrainType.IDLE,
- DrainType.USER, DrainType.CELL};
+ DrainType.USER, DrainType.CELL, DrainType.UNACCOUNTED};
final int usageTypes[] = {UsageType.WIFI, UsageType.BLUETOOTH, UsageType.IDLE,
- UsageType.USER, UsageType.CELL};
+ UsageType.USER, UsageType.CELL, UsageType.UNACCOUNTED};
assertThat(drainTypes.length).isEqualTo(usageTypes.length);
for (int i = 0, size = drainTypes.length; i < size; i++) {
@@ -147,7 +147,7 @@
assertThat(usageTypeSet).asList().containsExactly(UsageType.APP, UsageType.WIFI,
UsageType.CELL, UsageType.BLUETOOTH, UsageType.IDLE, UsageType.SERVICE,
- UsageType.USER, UsageType.SYSTEM);
+ UsageType.USER, UsageType.SYSTEM, UsageType.UNACCOUNTED);
}
@Test
diff --git a/tests/robotests/src/com/android/settings/nfc/PaymentSettingsTest.java b/tests/robotests/src/com/android/settings/nfc/PaymentSettingsTest.java
new file mode 100644
index 0000000..7e898fb
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/nfc/PaymentSettingsTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.nfc;
+
+import android.content.Context;
+
+import android.content.pm.PackageManager;
+import android.content.pm.PackageParser;
+import com.android.settings.SettingsRobolectricTestRunner;
+import com.android.settings.TestConfig;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.annotation.Config;
+
+import java.util.List;
+
+import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+public class PaymentSettingsTest {
+ @Mock
+ Context mContext;
+
+ @Mock
+ private PackageManager mManager;
+
+ private PaymentSettings mFragment;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ mFragment = new PaymentSettings();
+ when(mContext.getPackageManager()).thenReturn(mManager);
+ }
+
+ @Test
+ public void testNonIndexableKey_NoNFC_KeyAdded() {
+ when(mManager.hasSystemFeature(PackageManager.FEATURE_NFC)).thenReturn(false);
+
+ List<String> niks = mFragment.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
+ assertThat(niks).contains(mFragment.PAYMENT_KEY);
+ }
+
+ @Test
+ public void testNonIndexableKey_NFC_NoKeyAdded() {
+ when(mManager.hasSystemFeature(PackageManager.FEATURE_NFC)).thenReturn(true);
+
+ List<String> niks = mFragment.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
+ assertThat(niks).isNull();
+ }
+}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/search2/CursorToSearchResultConverterTest.java b/tests/robotests/src/com/android/settings/search2/CursorToSearchResultConverterTest.java
index 6f326ab..ab55605 100644
--- a/tests/robotests/src/com/android/settings/search2/CursorToSearchResultConverterTest.java
+++ b/tests/robotests/src/com/android/settings/search2/CursorToSearchResultConverterTest.java
@@ -24,6 +24,7 @@
import android.graphics.drawable.Drawable;
import android.util.ArrayMap;
+import com.android.settings.DisplaySettings;
import com.android.settings.R;
import com.android.settings.SettingsRobolectricTestRunner;
import com.android.settings.SubSettings;
@@ -32,6 +33,7 @@
import com.android.settings.gestures.SwipeToNotificationSettings;
import com.android.settings.search2.ResultPayload.PayloadType;
+import com.android.settings.wifi.WifiSettings;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -147,6 +149,29 @@
}
@Test
+ public void testLongTitle_PenalizedInRank() {
+ MatrixCursor cursor = new MatrixCursor(DatabaseResultLoader.SELECT_COLUMNS);
+ final String BLANK = "";
+ cursor.addRow(new Object[]{
+ ID, // Doc ID
+ "Longer than 20 characters", // Title
+ SUMMARY, // Summary on
+ SUMMARY, // summary off
+ DisplaySettings.class.getName(),
+ BLANK, // screen title
+ null, // icon
+ BLANK, // action
+ null, // target package
+ BLANK, // target class
+ BLANK, // Key
+ 0, // Payload Type
+ null // Payload
+ });
+ List<SearchResult> results = mConverter.convertCursor(mSiteMapManager, cursor, BASE_RANK);
+ assertThat(results.get(0).rank).isEqualTo(BASE_RANK + 2);
+ }
+
+ @Test
public void testParseCursor_MatchesIntentForSubSettings() {
MatrixCursor cursor = new MatrixCursor(DatabaseResultLoader.SELECT_COLUMNS);
final String BLANK = "";
@@ -246,6 +271,245 @@
assertThat(newPayload.valueMap.get(0)).isFalse();
}
+ // The following tests are temporary, and should be removed when we replace the Search
+ // White-list solution for elevating ranking.
+
+ @Test
+ public void testWifiKey_PrioritizedResult() {
+ MatrixCursor cursor = new MatrixCursor(DatabaseResultLoader.SELECT_COLUMNS);
+ final String BLANK = "";
+ final String key = "main_toggle_wifi";
+
+ cursor.addRow(new Object[]{
+ ID, // Doc ID
+ TITLES[0], // Title
+ SUMMARY, // Summary on
+ SUMMARY, // summary off
+ WifiSettings.class.getName(), // ClassName
+ BLANK, // screen title
+ null, // icon
+ BLANK, // action
+ null, // target package
+ BLANK, // target class
+ key, // Key
+ 0, // Payload Type
+ null // Payload
+ });
+ List<SearchResult> results = mConverter.convertCursor(mSiteMapManager, cursor, BASE_RANK);
+
+ assertThat(results.get(0).rank).isEqualTo(SearchResult.TOP_RANK);
+ }
+
+ @Test
+ public void testBluetoothKey_PrioritizedResult() {
+ MatrixCursor cursor = new MatrixCursor(DatabaseResultLoader.SELECT_COLUMNS);
+ final String BLANK = "";
+ final String key = "main_toggle_bluetooth";
+
+ cursor.addRow(new Object[]{
+ ID, // Doc ID
+ TITLES[0], // Title
+ SUMMARY, // Summary on
+ SUMMARY, // summary off
+ WifiSettings.class.getName(), // ClassName
+ BLANK, // screen title
+ null, // icon
+ BLANK, // action
+ null, // target package
+ BLANK, // target class
+ key, // Key
+ 0, // Payload Type
+ null // Payload
+ });
+ List<SearchResult> results = mConverter.convertCursor(mSiteMapManager, cursor, BASE_RANK);
+
+ assertThat(results.get(0).rank).isEqualTo(SearchResult.TOP_RANK);
+ }
+
+ @Test
+ public void testAirplaneKey_PrioritizedResult() {
+ MatrixCursor cursor = new MatrixCursor(DatabaseResultLoader.SELECT_COLUMNS);
+ final String BLANK = "";
+ final String key = "toggle_airplane";
+
+ cursor.addRow(new Object[]{
+ ID, // Doc ID
+ TITLES[0], // Title
+ SUMMARY, // Summary on
+ SUMMARY, // summary off
+ WifiSettings.class.getName(), // ClassName
+ BLANK, // screen title
+ null, // icon
+ BLANK, // action
+ null, // target package
+ BLANK, // target class
+ key, // Key
+ 0, // Payload Type
+ null // Payload
+ });
+ List<SearchResult> results = mConverter.convertCursor(mSiteMapManager, cursor, BASE_RANK);
+
+ assertThat(results.get(0).rank).isEqualTo(SearchResult.TOP_RANK);
+ }
+
+ @Test
+ public void testHotspotKey_PrioritizedResult() {
+ MatrixCursor cursor = new MatrixCursor(DatabaseResultLoader.SELECT_COLUMNS);
+ final String BLANK = "";
+ final String key = "tether_settings";
+
+ cursor.addRow(new Object[]{
+ ID, // Doc ID
+ TITLES[0], // Title
+ SUMMARY, // Summary on
+ SUMMARY, // summary off
+ WifiSettings.class.getName(), // ClassName
+ BLANK, // screen title
+ null, // icon
+ BLANK, // action
+ null, // target package
+ BLANK, // target class
+ key, // Key
+ 0, // Payload Type
+ null // Payload
+ });
+ List<SearchResult> results = mConverter.convertCursor(mSiteMapManager, cursor, BASE_RANK);
+
+ assertThat(results.get(0).rank).isEqualTo(SearchResult.TOP_RANK);
+ }
+
+ @Test
+ public void testBatterySaverKey_PrioritizedResult() {
+ MatrixCursor cursor = new MatrixCursor(DatabaseResultLoader.SELECT_COLUMNS);
+ final String BLANK = "";
+ final String key = "battery_saver";
+
+ cursor.addRow(new Object[]{
+ ID, // Doc ID
+ TITLES[0], // Title
+ SUMMARY, // Summary on
+ SUMMARY, // summary off
+ WifiSettings.class.getName(), // ClassName
+ BLANK, // screen title
+ null, // icon
+ BLANK, // action
+ null, // target package
+ BLANK, // target class
+ key, // Key
+ 0, // Payload Type
+ null // Payload
+ });
+ List<SearchResult> results = mConverter.convertCursor(mSiteMapManager, cursor, BASE_RANK);
+
+ assertThat(results.get(0).rank).isEqualTo(SearchResult.TOP_RANK);
+ }
+
+ @Test
+ public void testNFCKey_PrioritizedResult() {
+ MatrixCursor cursor = new MatrixCursor(DatabaseResultLoader.SELECT_COLUMNS);
+ final String BLANK = "";
+ final String key = "toggle_nfc";
+
+ cursor.addRow(new Object[]{
+ ID, // Doc ID
+ TITLES[0], // Title
+ SUMMARY, // Summary on
+ SUMMARY, // summary off
+ WifiSettings.class.getName(), // ClassName
+ BLANK, // screen title
+ null, // icon
+ BLANK, // action
+ null, // target package
+ BLANK, // target class
+ key, // Key
+ 0, // Payload Type
+ null // Payload
+ });
+ List<SearchResult> results = mConverter.convertCursor(mSiteMapManager, cursor, BASE_RANK);
+
+ assertThat(results.get(0).rank).isEqualTo(SearchResult.TOP_RANK);
+ }
+
+ @Test
+ public void testDataSaverKey_PrioritizedResult() {
+ MatrixCursor cursor = new MatrixCursor(DatabaseResultLoader.SELECT_COLUMNS);
+ final String BLANK = "";
+ final String key = "restrict_background";
+
+ cursor.addRow(new Object[]{
+ ID, // Doc ID
+ TITLES[0], // Title
+ SUMMARY, // Summary on
+ SUMMARY, // summary off
+ WifiSettings.class.getName(), // ClassName
+ BLANK, // screen title
+ null, // icon
+ BLANK, // action
+ null, // target package
+ BLANK, // target class
+ key, // Key
+ 0, // Payload Type
+ null // Payload
+ });
+ List<SearchResult> results = mConverter.convertCursor(mSiteMapManager, cursor, BASE_RANK);
+
+ assertThat(results.get(0).rank).isEqualTo(SearchResult.TOP_RANK);
+ }
+
+ @Test
+ public void testDataUsageKey_PrioritizedResult() {
+ MatrixCursor cursor = new MatrixCursor(DatabaseResultLoader.SELECT_COLUMNS);
+ final String BLANK = "";
+ final String key = "data_usage_enable";
+
+ cursor.addRow(new Object[]{
+ ID, // Doc ID
+ TITLES[0], // Title
+ SUMMARY, // Summary on
+ SUMMARY, // summary off
+ WifiSettings.class.getName(), // ClassName
+ BLANK, // screen title
+ null, // icon
+ BLANK, // action
+ null, // target package
+ BLANK, // target class
+ key, // Key
+ 0, // Payload Type
+ null // Payload
+ });
+ List<SearchResult> results = mConverter.convertCursor(mSiteMapManager, cursor, BASE_RANK);
+
+ assertThat(results.get(0).rank).isEqualTo(SearchResult.TOP_RANK);
+ }
+
+ @Test
+ public void testRoamingKey_PrioritizedResult() {
+ MatrixCursor cursor = new MatrixCursor(DatabaseResultLoader.SELECT_COLUMNS);
+ final String BLANK = "";
+ final String key = "button_roaming_key";
+
+ cursor.addRow(new Object[]{
+ ID, // Doc ID
+ TITLES[0], // Title
+ SUMMARY, // Summary on
+ SUMMARY, // summary off
+ WifiSettings.class.getName(), // ClassName
+ BLANK, // screen title
+ null, // icon
+ BLANK, // action
+ null, // target package
+ BLANK, // target class
+ key, // Key
+ 0, // Payload Type
+ null // Payload
+ });
+ List<SearchResult> results = mConverter.convertCursor(mSiteMapManager, cursor, BASE_RANK);
+
+ assertThat(results.get(0).rank).isEqualTo(SearchResult.TOP_RANK);
+ }
+
+ // End of temporary tests
+
private MatrixCursor getDummyCursor() {
return getDummyCursor(true /* hasIcon */);
}