Instantiate pref controllers from xml if it's defined.

- If a <preference> tag also defines a controller, we will try to
  instantiate it before displaying the UI. The same logic is shared by
  BaseSearchIndexProvider so it also drives search suppression.

- If user also defines a list of controllers programatically, the
  programatically created ones takes precedence.

Bug: 73668763
Test: WIP
Change-Id: I7aecec270bcd3af261e012ef1f6995d2a523cfa1
diff --git a/proguard.flags b/proguard.flags
index 091211d..21c5cfd 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -4,6 +4,15 @@
 # Keep all Fragments in this package, which are used by reflection.
 -keep public class com.android.settings.** extends android.app.Fragment
 
+# Keep all preference controllers needed by slice and DashboardFragment.
+-keep class * extends com.android.settings.core.BasePreferenceController {
+    *;
+}
+
+-keep class * extends com.android.settings.core.TogglePreferenceController {
+    *;
+}
+
 # We want to keep methods in Activity that could be used in the XML attribute onClick.
 -keepclassmembers class * extends android.app.Activity {
     public void *(android.view.View);