cmparts: Make CMParts searchable
* Implement a SearchIndexablesProvider to allow the Settings app
to crawl our resources.
* Add all missing metadata where necessary so resources can be
indexed.
Change-Id: Ic8f304a7995b269f476eda6306d11b366621f4b0
diff --git a/res/xml/anonymous_stats.xml b/res/xml/anonymous_stats.xml
index 30a65d5..b29885c 100644
--- a/res/xml/anonymous_stats.xml
+++ b/res/xml/anonymous_stats.xml
@@ -16,6 +16,7 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
+ android:key="cmstats"
android:title="@string/anonymous_statistics_title">
<cyanogenmod.preference.CMSecureSettingSwitchPreference
diff --git a/res/xml/appgroup_list.xml b/res/xml/appgroup_list.xml
index 848ce21..ee497a2 100644
--- a/res/xml/appgroup_list.xml
+++ b/res/xml/appgroup_list.xml
@@ -17,6 +17,6 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:key="profile_appgroups_list"
- xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
+ android:title="@string/profile_appgroups_title">
-</PreferenceScreen>
\ No newline at end of file
+</PreferenceScreen>
diff --git a/res/xml/application_list.xml b/res/xml/application_list.xml
index 43c506f..6df1234 100644
--- a/res/xml/application_list.xml
+++ b/res/xml/application_list.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:key="general_section"
@@ -27,4 +26,4 @@
android:title="@string/profile_applist_title" >
</PreferenceCategory>
-</PreferenceScreen>
\ No newline at end of file
+</PreferenceScreen>
diff --git a/res/xml/battery_light_settings.xml b/res/xml/battery_light_settings.xml
index 34b74d0..454ab1a 100644
--- a/res/xml/battery_light_settings.xml
+++ b/res/xml/battery_light_settings.xml
@@ -15,8 +15,7 @@
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
- android:key="battery_light"
+ android:key="battery_lights"
android:title="@string/battery_light_title">
<PreferenceCategory
diff --git a/res/xml/button_settings.xml b/res/xml/button_settings.xml
index c58650e..de9c062 100644
--- a/res/xml/button_settings.xml
+++ b/res/xml/button_settings.xml
@@ -14,7 +14,9 @@
limitations under the License.
-->
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ android:key="button_settings"
+ android:title="@string/button_pref_title">
<SwitchPreference
android:key="disable_nav_keys"
diff --git a/res/xml/display_rotation.xml b/res/xml/display_rotation.xml
index b36df56..1ce81e8 100644
--- a/res/xml/display_rotation.xml
+++ b/res/xml/display_rotation.xml
@@ -15,6 +15,7 @@
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ android:key="rotation"
android:title="@string/display_rotation_title">
<SwitchPreference
diff --git a/res/xml/livedisplay.xml b/res/xml/livedisplay.xml
index ef1d9bd..443e17a 100644
--- a/res/xml/livedisplay.xml
+++ b/res/xml/livedisplay.xml
@@ -14,7 +14,9 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ android:key="livedisplay"
+ android:title="@*cyanogenmod.platform:string/live_display_title">
<PreferenceCategory
android:key="live_display_options"
diff --git a/res/xml/notification_light_settings.xml b/res/xml/notification_light_settings.xml
index 7035490..b9e0ce1 100644
--- a/res/xml/notification_light_settings.xml
+++ b/res/xml/notification_light_settings.xml
@@ -15,7 +15,7 @@
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- android:key="notification_light"
+ android:key="notification_lights"
android:title="@string/notification_light_title">
<PreferenceCategory
diff --git a/res/xml/parts_catalog.xml b/res/xml/parts_catalog.xml
index 94d6a7a..8fec12f 100644
--- a/res/xml/parts_catalog.xml
+++ b/res/xml/parts_catalog.xml
@@ -15,15 +15,28 @@
limitations under the License.
-->
-<parts-catalog xmlns:android="http://schemas.android.com/apk/res/android">
+<!--
+ The parts catalog is used to locate items (usually a PreferenceScreen) inside
+ of CMParts. This can be used by CMPartsPreference to create a simple, two-line
+ entry point from Settings or another application. All entries should specify
+ a fragment, which is a SettingsPreferenceFragment subclass inside CMParts.
+
+ Metadata for the search index provider should be provided for all parts. This
+ can be supplied an XML resource in the "cm:xmlRes" attribute or by implementing
+ the Searchable interface.
+-->
+<parts-catalog xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:cm="http://schemas.android.com/apk/res/cyanogenmod.platform">
<part android:key="battery_lights"
android:title="@string/battery_light_title"
- android:fragment="org.cyanogenmod.cmparts.notificationlight.BatteryLightSettings" />
+ android:fragment="org.cyanogenmod.cmparts.notificationlight.BatteryLightSettings"
+ cm:xmlRes="@xml/battery_light_settings" />
<part android:key="button_settings"
android:title="@string/button_pref_title"
- android:fragment="org.cyanogenmod.cmparts.input.ButtonSettings" />
+ android:fragment="org.cyanogenmod.cmparts.input.ButtonSettings"
+ cm:xmlRes="@xml/button_settings" />
<part android:key="contributors"
android:title="@string/contributors_cloud_fragment_title"
@@ -32,26 +45,47 @@
<part android:key="livedisplay"
android:title="@*cyanogenmod.platform:string/live_display_title"
android:summary="@string/live_display_summary"
- android:fragment="org.cyanogenmod.cmparts.livedisplay.LiveDisplay" />
+ android:fragment="org.cyanogenmod.cmparts.livedisplay.LiveDisplay"
+ cm:xmlRes="@xml/livedisplay" />
<part android:key="notification_lights"
android:title="@string/notification_light_title"
- android:fragment="org.cyanogenmod.cmparts.notificationlight.NotificationLightSettings" />
+ android:fragment="org.cyanogenmod.cmparts.notificationlight.NotificationLightSettings"
+ cm:xmlRes="@xml/notification_light_settings" />
<part android:key="privacy_settings"
android:title="@string/privacy_settings_title"
- android:fragment="org.cyanogenmod.cmparts.PrivacySettings" />
+ android:fragment="org.cyanogenmod.cmparts.PrivacySettings"
+ cm:xmlRes="@xml/privacy_settings" />
<part android:key="profiles_settings"
android:title="@string/profiles_settings_title"
- android:fragment="org.cyanogenmod.cmparts.profiles.ProfilesSettings" />
+ android:fragment="org.cyanogenmod.cmparts.profiles.ProfilesSettings"
+ cm:xmlRes="@xml/profiles_settings" />
<part android:key="rotation"
android:title="@string/display_rotation_title"
- android:fragment="org.cyanogenmod.cmparts.hardware.DisplayRotation" />
+ android:fragment="org.cyanogenmod.cmparts.hardware.DisplayRotation"
+ cm:xmlRes="@xml/display_rotation" />
<part android:key="status_bar_settings"
android:title="@string/status_bar_title"
- android:fragment="org.cyanogenmod.cmparts.statusbar.StatusBarSettings" />
+ android:fragment="org.cyanogenmod.cmparts.statusbar.StatusBarSettings"
+ cm:xmlRes="@xml/status_bar_settings" />
+
+ <part android:key="cmstats"
+ android:title="@string/anonymous_statistics_title"
+ android:fragment="org.cyanogenmod.cmparts.cmstats.AnonymousStats"
+ cm:xmlRes="@xml/anonymous_stats" />
+
+ <part android:key="power_menu"
+ android:title="@string/power_menu_title"
+ android:fragment="org.cyanogenmod.cmparts.input.PowerMenuActions"
+ cm:xmlRes="@xml/power_menu_settings" />
+
+ <part android:key="privacy_guard_manager"
+ android:title="@*cyanogenmod.platform:string/privacy_guard_manager_title"
+ android:fragment="org.cyanogenmod.cmparts.privacyguard.PrivacyGuardManager"
+ cm:xmlRes="@xml/privacy_guard_prefs" />
</parts-catalog>
diff --git a/res/xml/power_menu_settings.xml b/res/xml/power_menu_settings.xml
index 36e1d65..5843c61 100644
--- a/res/xml/power_menu_settings.xml
+++ b/res/xml/power_menu_settings.xml
@@ -16,6 +16,7 @@
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
+ android:key="power_menu"
android:title="@string/power_menu_title">
<CheckBoxPreference
diff --git a/res/xml/privacy_guard_prefs.xml b/res/xml/privacy_guard_prefs.xml
index f77cdfc..ad91bef 100644
--- a/res/xml/privacy_guard_prefs.xml
+++ b/res/xml/privacy_guard_prefs.xml
@@ -15,7 +15,9 @@
-->
<PreferenceScreen
- xmlns:android="http://schemas.android.com/apk/res/android">
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:key="privacy_guard_manager"
+ android:title="@*cyanogenmod.platform:string/privacy_guard_manager_title">
<SwitchPreference
android:key="privacy_guard_default"
diff --git a/res/xml/profiles_settings.xml b/res/xml/profiles_settings.xml
index d3c477c..94c6deb 100644
--- a/res/xml/profiles_settings.xml
+++ b/res/xml/profiles_settings.xml
@@ -16,5 +16,5 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
- android:key="profiles_list" />
+ android:key="profiles_settings"
+ android:title="@string/profiles_settings_title" />
diff --git a/res/xml/status_bar_settings.xml b/res/xml/status_bar_settings.xml
index 6569250..13f302b 100644
--- a/res/xml/status_bar_settings.xml
+++ b/res/xml/status_bar_settings.xml
@@ -16,6 +16,7 @@
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
+ android:key="status_bar_settings"
android:title="@string/status_bar_title">
<PreferenceScreen