Implement work-profile infra in BasePreferenceController

- Add settings:forWork in xml
- Set mIsForWork based on xml attribute
- Delete WorkProfilePreferenceController and move its function to
BasePreferenceController

Fixes: 123376083
Test: Add work profile, go to Settings->System->Language&input,
UI should show work profile related items
Change-Id: Id2dcbb0e158c117cdfd363466a275f4e133c345e
This commit is contained in:
Raff Tsai
2019-12-02 10:55:29 +08:00
parent 9700435b4d
commit f71db73025
13 changed files with 132 additions and 149 deletions

View File

@@ -65,6 +65,7 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
implements SettingsBaseActivity.CategoryListener, Indexable,
PreferenceGroup.OnExpandButtonClickListener,
BasePreferenceController.UiBlockListener {
public static final String CATEGORY = "category";
private static final String TAG = "DashboardFragment";
@VisibleForTesting
@@ -206,6 +207,7 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
mMetricsFeatureProvider.logDashboardStartIntent(
getContext(), preference.getIntent(), getMetricsCategory());
// Give all controllers a chance to handle click.
preference.getExtras().putInt(CATEGORY, getMetricsCategory());
for (List<AbstractPreferenceController> controllerList : controllers) {
for (AbstractPreferenceController controller : controllerList) {
if (controller.handlePreferenceTreeClick(preference)) {