OSDN Git Service

Add PrefController in XML support
authorMatthew Fritze <mfritze@google.com>
Mon, 11 Dec 2017 17:57:54 +0000 (09:57 -0800)
committerMatthew Fritze <mfritze@google.com>
Tue, 12 Dec 2017 22:21:12 +0000 (14:21 -0800)
commit7d2b4f5fc7ee7d054af1344c74ec5d439c8c25ce
tree1482078e4eba9bc68e08ef89730eddddc8d81647
parent2f7240ceb5371bc8c9596d261fa32ad6cd14311a
Add PrefController in XML support

Add the ability to define a Preference Controller
in xml using the 'controller' tag.

This is useful for two reasons:
- It allows the controllers to be instantiated via
reflection for Slices and Dashboard fragment
- Removes the requirement that controllers be defined manually
in Fragments

In order to be instantiable, they must have a unified construction
following either:

  ClassName(Context)
  ClassName(Context, String)

Also added a robotest that verifies that all controllers defined
in XML follow the constructor schema, and extend
BasePreferenceController.

Test: robotests
Bug: 67996923
Change-Id: I304b35dc666daebecf0c9e286696f3f2a510704a
13 files changed:
res/values/attrs.xml
res/xml/display_settings.xml
res/xml/system_dashboard_fragment.xml
src/com/android/settings/backup/BackupSettingsActivityPreferenceController.java
src/com/android/settings/deviceinfo/AdditionalSystemUpdatePreferenceController.java
src/com/android/settings/deviceinfo/SystemUpdatePreferenceController.java
src/com/android/settings/gestures/GesturesSettingPreferenceController.java
src/com/android/settings/search/XmlParserUtils.java
src/com/android/settings/system/SystemDashboardFragment.java
tests/robotests/res/xml-mcc999/about_legal.xml
tests/robotests/src/com/android/settings/core/XmlControllerAttributeTest.java [new file with mode: 0644]
tests/robotests/src/com/android/settings/deviceinfo/SystemUpdatePreferenceControllerTest.java
tests/robotests/src/com/android/settings/search/XmlParserUtilTest.java