Share preference controller in AdavancedAppSettings search
Change-Id: I4283f35a91ce10e01fa4c9d1cf626b1d2a30082c
Fix: 62141436
Test: make RunSettingsRoboTests
diff --git a/src/com/android/settings/applications/AdvancedAppSettings.java b/src/com/android/settings/applications/AdvancedAppSettings.java
index cce8b7d..b623801 100644
--- a/src/com/android/settings/applications/AdvancedAppSettings.java
+++ b/src/com/android/settings/applications/AdvancedAppSettings.java
@@ -18,8 +18,8 @@
import android.app.Activity;
import android.content.Context;
import android.provider.SearchIndexableResource;
-
import android.text.TextUtils;
+
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.applications.defaultapps.DefaultBrowserPreferenceController;
@@ -57,6 +57,15 @@
@Override
protected List<PreferenceController> getPreferenceControllers(Context context) {
+ return buildPreferenceControllers(context);
+ }
+
+ @Override
+ public int getMetricsCategory() {
+ return MetricsEvent.APPLICATIONS_ADVANCED;
+ }
+
+ private static List<PreferenceController> buildPreferenceControllers(Context context) {
final List<PreferenceController> controllers = new ArrayList<>();
controllers.add(new DefaultBrowserPreferenceController(context));
controllers.add(new DefaultWorkBrowserPreferenceController(context));
@@ -68,11 +77,6 @@
return controllers;
}
- @Override
- public int getMetricsCategory() {
- return MetricsEvent.APPLICATIONS_ADVANCED;
- }
-
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider() {
@Override
@@ -94,6 +98,11 @@
.getPreferenceKey());
return keys;
}
+
+ @Override
+ public List<PreferenceController> getPreferenceControllers(Context context) {
+ return buildPreferenceControllers(context);
+ }
};
static class SummaryProvider implements SummaryLoader.SummaryProvider {
@@ -118,10 +127,10 @@
return;
}
CharSequence summary = concatSummaryText(
- mDefaultSmsPreferenceController.getDefaultAppLabel(),
- mDefaultBrowserPreferenceController.getDefaultAppLabel());
+ mDefaultSmsPreferenceController.getDefaultAppLabel(),
+ mDefaultBrowserPreferenceController.getDefaultAppLabel());
summary = concatSummaryText(summary,
- mDefaultPhonePreferenceController.getDefaultAppLabel());
+ mDefaultPhonePreferenceController.getDefaultAppLabel());
if (!TextUtils.isEmpty(summary)) {
mSummaryLoader.setSummary(this, summary);
}
@@ -139,11 +148,11 @@
}
public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY =
- new SummaryLoader.SummaryProviderFactory() {
- @Override
- public SummaryLoader.SummaryProvider createSummaryProvider(Activity activity,
- SummaryLoader summaryLoader) {
- return new AdvancedAppSettings.SummaryProvider(activity, summaryLoader);
- }
- };
+ new SummaryLoader.SummaryProviderFactory() {
+ @Override
+ public SummaryLoader.SummaryProvider createSummaryProvider(Activity activity,
+ SummaryLoader summaryLoader) {
+ return new AdvancedAppSettings.SummaryProvider(activity, summaryLoader);
+ }
+ };
}
diff --git a/tests/robotests/assets/grandfather_not_sharing_pref_controllers_with_search_provider b/tests/robotests/assets/grandfather_not_sharing_pref_controllers_with_search_provider
index 1712f19..b329072 100644
--- a/tests/robotests/assets/grandfather_not_sharing_pref_controllers_with_search_provider
+++ b/tests/robotests/assets/grandfather_not_sharing_pref_controllers_with_search_provider
@@ -1,2 +1 @@
-com.android.settings.applications.AdvancedAppSettings
com.android.settings.fuelgauge.PowerUsageSummary