Make PreferenceController a mixin
Bug: 62912136
Test: Existing tests in BaseSearchIndexProviderTest
Change-Id: Ieda359806c09a019840b2005446c7ec8b61fdb00
diff --git a/src/com/android/settings/DateTimeSettings.java b/src/com/android/settings/DateTimeSettings.java
index 326f200..2afbdb2 100644
--- a/src/com/android/settings/DateTimeSettings.java
+++ b/src/com/android/settings/DateTimeSettings.java
@@ -24,7 +24,6 @@
import android.provider.SearchIndexableResource;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.datetime.AutoTimePreferenceController;
@@ -36,6 +35,7 @@
import com.android.settings.datetime.TimeZonePreferenceController;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.datetime.ZoneGetter;
import java.util.ArrayList;
@@ -72,8 +72,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
final Activity activity = getActivity();
final Intent intent = activity.getIntent();
final boolean isFromSUW = intent.getBooleanExtra(EXTRA_IS_FROM_SUW, false);
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index 0805e4b..7ca52e2 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -23,7 +23,6 @@
import android.provider.SearchIndexableResource;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.deviceinfo.AdditionalSystemUpdatePreferenceController;
@@ -41,6 +40,7 @@
import com.android.settings.deviceinfo.SecurityPatchPreferenceController;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -84,7 +84,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getActivity(), this /* fragment */,
getLifecycle());
}
@@ -114,9 +114,9 @@
}
};
- private static List<PreferenceController> buildPreferenceControllers(Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Activity activity, Fragment fragment, Lifecycle lifecycle) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(
new BuildNumberPreferenceController(context, activity, fragment, lifecycle));
controllers.add(new AdditionalSystemUpdatePreferenceController(context));
@@ -149,7 +149,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /*activity */,
null /* fragment */, null /* lifecycle */);
}
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 9ce4c4a..a7d18df 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -21,7 +21,6 @@
import com.android.internal.hardware.AmbientDisplayConfiguration;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.display.AmbientDisplayPreferenceController;
import com.android.settings.display.AutoBrightnessPreferenceController;
@@ -41,6 +40,7 @@
import com.android.settings.display.WallpaperPreferenceController;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -77,7 +77,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle());
}
@@ -86,9 +86,9 @@
return R.string.help_uri_display;
}
- private static List<PreferenceController> buildPreferenceControllers(
+ private static List<AbstractPreferenceController> buildPreferenceControllers(
Context context, Lifecycle lifecycle) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
final AmbientDisplayConfiguration ambientDisplayConfig = new AmbientDisplayConfiguration(context);
controllers.add(new AutoBrightnessPreferenceController(context, KEY_AUTO_BRIGHTNESS));
controllers.add(new AutoRotatePreferenceController(context, lifecycle));
@@ -131,7 +131,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null);
}
};
diff --git a/src/com/android/settings/accounts/AccountDetailDashboardFragment.java b/src/com/android/settings/accounts/AccountDetailDashboardFragment.java
index a895e40..a74b896 100644
--- a/src/com/android/settings/accounts/AccountDetailDashboardFragment.java
+++ b/src/com/android/settings/accounts/AccountDetailDashboardFragment.java
@@ -27,9 +27,9 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settingslib.accounts.AuthenticatorHelper;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.drawer.Tile;
import java.util.ArrayList;
@@ -108,8 +108,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
mAccountSynController = new AccountSyncPreferenceController(context);
controllers.add(mAccountSynController);
mRemoveAccountController = new RemoveAccountPreferenceController(context, this);
diff --git a/src/com/android/settings/accounts/AccountHeaderPreferenceController.java b/src/com/android/settings/accounts/AccountHeaderPreferenceController.java
index d0ce58d..eda75b2 100644
--- a/src/com/android/settings/accounts/AccountHeaderPreferenceController.java
+++ b/src/com/android/settings/accounts/AccountHeaderPreferenceController.java
@@ -26,15 +26,17 @@
import com.android.settings.R;
import com.android.settings.applications.LayoutPreference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.accounts.AuthenticatorHelper;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import static com.android.settings.accounts.AccountDetailDashboardFragment.KEY_ACCOUNT;
import static com.android.settings.accounts.AccountDetailDashboardFragment.KEY_USER_HANDLE;
-public class AccountHeaderPreferenceController extends PreferenceController {
+public class AccountHeaderPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_ACCOUNT_HEADER = "account_header";
diff --git a/src/com/android/settings/accounts/AccountPreferenceController.java b/src/com/android/settings/accounts/AccountPreferenceController.java
index adb0659..246baff 100644
--- a/src/com/android/settings/accounts/AccountPreferenceController.java
+++ b/src/com/android/settings/accounts/AccountPreferenceController.java
@@ -51,13 +51,14 @@
import com.android.settings.SettingsActivity;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.SearchFeatureProviderImpl;
import com.android.settings.search.SearchIndexableRaw;
import com.android.settingslib.RestrictedPreference;
import com.android.settingslib.accounts.AuthenticatorHelper;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
@@ -67,8 +68,8 @@
import java.util.Comparator;
import java.util.List;
-public class AccountPreferenceController extends PreferenceController
- implements AuthenticatorHelper.OnAccountsUpdateListener,
+public class AccountPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, AuthenticatorHelper.OnAccountsUpdateListener,
OnPreferenceClickListener, LifecycleObserver, OnPause, OnResume {
private static final String TAG = "AccountPrefController";
diff --git a/src/com/android/settings/accounts/AccountSyncPreferenceController.java b/src/com/android/settings/accounts/AccountSyncPreferenceController.java
index 0b095f7..847bb03 100644
--- a/src/com/android/settings/accounts/AccountSyncPreferenceController.java
+++ b/src/com/android/settings/accounts/AccountSyncPreferenceController.java
@@ -27,9 +27,11 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class AccountSyncPreferenceController extends PreferenceController {
+public class AccountSyncPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String TAG = "AccountSyncController";
private static final String KEY_ACCOUNT_SYNC = "account_sync";
diff --git a/src/com/android/settings/accounts/AddUserWhenLockedPreferenceController.java b/src/com/android/settings/accounts/AddUserWhenLockedPreferenceController.java
index a3dd94d..f2f2307 100644
--- a/src/com/android/settings/accounts/AddUserWhenLockedPreferenceController.java
+++ b/src/com/android/settings/accounts/AddUserWhenLockedPreferenceController.java
@@ -19,15 +19,17 @@
import android.provider.Settings.Global;
import android.support.v7.preference.Preference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.users.UserCapabilities;
import com.android.settingslib.RestrictedSwitchPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
-public class AddUserWhenLockedPreferenceController extends PreferenceController
- implements Preference.OnPreferenceChangeListener, LifecycleObserver, OnPause, OnResume {
+public class AddUserWhenLockedPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
+ LifecycleObserver, OnPause, OnResume {
private static final String KEY_ADD_USER_WHEN_LOCKED = "add_users_when_locked";
diff --git a/src/com/android/settings/accounts/AutoSyncDataPreferenceController.java b/src/com/android/settings/accounts/AutoSyncDataPreferenceController.java
index f5d7b64..128e88d 100644
--- a/src/com/android/settings/accounts/AutoSyncDataPreferenceController.java
+++ b/src/com/android/settings/accounts/AutoSyncDataPreferenceController.java
@@ -32,10 +32,12 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class AutoSyncDataPreferenceController extends PreferenceController {
+public class AutoSyncDataPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String TAG = "AutoSyncDataController";
private static final String TAG_CONFIRM_AUTO_SYNC_CHANGE = "confirmAutoSyncChange";
diff --git a/src/com/android/settings/accounts/EmergencyInfoPreferenceController.java b/src/com/android/settings/accounts/EmergencyInfoPreferenceController.java
index 0c53041..e1aeeb2 100644
--- a/src/com/android/settings/accounts/EmergencyInfoPreferenceController.java
+++ b/src/com/android/settings/accounts/EmergencyInfoPreferenceController.java
@@ -23,15 +23,16 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.support.v7.preference.Preference;
-import android.support.v7.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.search.SearchIndexableRaw;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.List;
-public class EmergencyInfoPreferenceController extends PreferenceController {
+public class EmergencyInfoPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_EMERGENCY_INFO = "emergency_info";
private static final String ACTION_EDIT_EMERGENCY_INFO = "android.settings.EDIT_EMERGENCY_INFO";
diff --git a/src/com/android/settings/accounts/RemoveAccountPreferenceController.java b/src/com/android/settings/accounts/RemoveAccountPreferenceController.java
index f331144..dabb4ed 100644
--- a/src/com/android/settings/accounts/RemoveAccountPreferenceController.java
+++ b/src/com/android/settings/accounts/RemoveAccountPreferenceController.java
@@ -29,7 +29,6 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
-import android.os.Process;
import android.os.UserHandle;
import android.support.v7.preference.PreferenceScreen;
import android.view.View;
@@ -39,13 +38,14 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.applications.LayoutPreference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.io.IOException;
-public class RemoveAccountPreferenceController extends PreferenceController
- implements OnClickListener {
+public class RemoveAccountPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, OnClickListener {
private static final String KEY_REMOVE_ACCOUNT = "remove_account";
diff --git a/src/com/android/settings/accounts/UserAndAccountDashboardFragment.java b/src/com/android/settings/accounts/UserAndAccountDashboardFragment.java
index d8b19a1..f375cf8 100644
--- a/src/com/android/settings/accounts/UserAndAccountDashboardFragment.java
+++ b/src/com/android/settings/accounts/UserAndAccountDashboardFragment.java
@@ -15,6 +15,8 @@
*/
package com.android.settings.accounts;
+import static android.provider.Settings.EXTRA_AUTHORITIES;
+
import android.app.Activity;
import android.content.Context;
import android.content.pm.UserInfo;
@@ -25,18 +27,16 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.drawer.Tile;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import static android.provider.Settings.EXTRA_AUTHORITIES;
-
public class UserAndAccountDashboardFragment extends DashboardFragment {
private static final String TAG = "UserAndAccountDashboard";
@@ -63,8 +63,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new EmergencyInfoPreferenceController(context));
AddUserWhenLockedPreferenceController addUserWhenLockedPrefController =
new AddUserWhenLockedPreferenceController(context);
diff --git a/src/com/android/settings/applications/AdvancedAppSettings.java b/src/com/android/settings/applications/AdvancedAppSettings.java
index b623801..a237bb8 100644
--- a/src/com/android/settings/applications/AdvancedAppSettings.java
+++ b/src/com/android/settings/applications/AdvancedAppSettings.java
@@ -29,11 +29,11 @@
import com.android.settings.applications.defaultapps.DefaultSmsPreferenceController;
import com.android.settings.applications.defaultapps.DefaultWorkBrowserPreferenceController;
import com.android.settings.applications.defaultapps.DefaultWorkPhonePreferenceController;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
import java.util.Arrays;
@@ -56,7 +56,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context);
}
@@ -65,8 +65,8 @@
return MetricsEvent.APPLICATIONS_ADVANCED;
}
- private static List<PreferenceController> buildPreferenceControllers(Context context) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new DefaultBrowserPreferenceController(context));
controllers.add(new DefaultWorkBrowserPreferenceController(context));
controllers.add(new DefaultPhonePreferenceController(context));
@@ -100,7 +100,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context);
}
};
diff --git a/src/com/android/settings/applications/AppAndNotificationDashboardFragment.java b/src/com/android/settings/applications/AppAndNotificationDashboardFragment.java
index 910b991..dda55e4 100644
--- a/src/com/android/settings/applications/AppAndNotificationDashboardFragment.java
+++ b/src/com/android/settings/applications/AppAndNotificationDashboardFragment.java
@@ -24,10 +24,10 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.notification.EmergencyBroadcastPreferenceController;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
import java.util.Arrays;
@@ -64,7 +64,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
final Activity activity = getActivity();
final Application app;
if (activity != null) {
@@ -75,9 +75,9 @@
return buildPreferenceControllers(context, app, this);
}
- private static List<PreferenceController> buildPreferenceControllers(Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Application app, Fragment host) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new EmergencyBroadcastPreferenceController(context,
"app_and_notif_cell_broadcast_settings"));
controllers.add(new SpecialAppAccessPreferenceController(context));
@@ -97,7 +97,8 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(
+ Context context) {
return buildPreferenceControllers(context, null, null /* host */);
}
diff --git a/src/com/android/settings/applications/AppPermissionsPreferenceController.java b/src/com/android/settings/applications/AppPermissionsPreferenceController.java
index 57ec6d8..f6a2271 100644
--- a/src/com/android/settings/applications/AppPermissionsPreferenceController.java
+++ b/src/com/android/settings/applications/AppPermissionsPreferenceController.java
@@ -24,11 +24,14 @@
import android.util.ArraySet;
import android.util.Log;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
+
import java.util.List;
import java.util.Set;
-public class AppPermissionsPreferenceController extends PreferenceController {
+public class AppPermissionsPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String TAG = "AppPermissionPrefCtrl";
private static final String KEY_APP_PERMISSION_GROUPS = "manage_perms";
diff --git a/src/com/android/settings/applications/RecentAppsPreferenceController.java b/src/com/android/settings/applications/RecentAppsPreferenceController.java
index dd95605..d0f7584 100644
--- a/src/com/android/settings/applications/RecentAppsPreferenceController.java
+++ b/src/com/android/settings/applications/RecentAppsPreferenceController.java
@@ -16,6 +16,9 @@
package com.android.settings.applications;
+import static com.android.internal.logging.nano.MetricsProto.MetricsEvent
+ .SETTINGS_APP_NOTIF_CATEGORY;
+
import android.app.Application;
import android.app.Fragment;
import android.app.usage.UsageStats;
@@ -29,7 +32,6 @@
import android.support.v7.preference.PreferenceCategory;
import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
-import android.text.format.DateUtils;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.IconDrawableFactory;
@@ -37,8 +39,9 @@
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.applications.ApplicationsState;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
import java.util.Arrays;
@@ -49,15 +52,12 @@
import java.util.Map;
import java.util.Set;
-import static com.android.internal.logging.nano.MetricsProto.MetricsEvent
- .SETTINGS_APP_NOTIF_CATEGORY;
-
/**
* This controller displays a list of recently used apps and a "See all" button. If there is
* no recently used app, "See all" will be displayed as "App info".
*/
-public class RecentAppsPreferenceController extends PreferenceController
- implements Comparator<UsageStats> {
+public class RecentAppsPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Comparator<UsageStats> {
private static final String TAG = "RecentAppsCtrl";
private static final String KEY_PREF_CATEGORY = "recent_apps_category";
@@ -122,7 +122,7 @@
@Override
public void updateNonIndexableKeys(List<String> keys) {
- super.updateNonIndexableKeys(keys);
+ PreferenceControllerMixin.super.updateNonIndexableKeys(keys);
// Don't index category name into search. It's not actionable.
keys.add(KEY_PREF_CATEGORY);
keys.add(KEY_DIVIDER);
diff --git a/src/com/android/settings/applications/ResetAppPrefPreferenceController.java b/src/com/android/settings/applications/ResetAppPrefPreferenceController.java
index 6c99a2e..2766c59 100644
--- a/src/com/android/settings/applications/ResetAppPrefPreferenceController.java
+++ b/src/com/android/settings/applications/ResetAppPrefPreferenceController.java
@@ -21,14 +21,15 @@
import android.support.v7.preference.Preference;
import android.text.TextUtils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnCreate;
import com.android.settingslib.core.lifecycle.events.OnSaveInstanceState;
-public class ResetAppPrefPreferenceController extends PreferenceController
- implements LifecycleObserver, OnCreate, OnSaveInstanceState {
+public class ResetAppPrefPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnCreate, OnSaveInstanceState {
private ResetAppsHelper mResetAppsHelper;
diff --git a/src/com/android/settings/applications/SpecialAccessSettings.java b/src/com/android/settings/applications/SpecialAccessSettings.java
index cbd102e..b71b84d 100644
--- a/src/com/android/settings/applications/SpecialAccessSettings.java
+++ b/src/com/android/settings/applications/SpecialAccessSettings.java
@@ -22,10 +22,10 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
import java.util.List;
@@ -62,7 +62,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return null;
}
diff --git a/src/com/android/settings/applications/SpecialAppAccessPreferenceController.java b/src/com/android/settings/applications/SpecialAppAccessPreferenceController.java
index 3735c01..ae578d0 100644
--- a/src/com/android/settings/applications/SpecialAppAccessPreferenceController.java
+++ b/src/com/android/settings/applications/SpecialAppAccessPreferenceController.java
@@ -16,10 +16,12 @@
import android.content.Context;
import android.support.v7.preference.Preference;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.datausage.DataSaverBackend;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class SpecialAppAccessPreferenceController extends PreferenceController {
+public class SpecialAppAccessPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_SPECIAL_ACCESS = "special_access";
diff --git a/src/com/android/settings/applications/assist/AssistContextPreferenceController.java b/src/com/android/settings/applications/assist/AssistContextPreferenceController.java
index 4a8e9c2..f54d5f4 100644
--- a/src/com/android/settings/applications/assist/AssistContextPreferenceController.java
+++ b/src/com/android/settings/applications/assist/AssistContextPreferenceController.java
@@ -25,7 +25,8 @@
import android.support.v7.preference.TwoStatePreference;
import com.android.internal.app.AssistUtils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
@@ -34,8 +35,9 @@
import java.util.Arrays;
import java.util.List;
-public class AssistContextPreferenceController extends PreferenceController
- implements Preference.OnPreferenceChangeListener, LifecycleObserver, OnResume, OnPause {
+public class AssistContextPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
+ LifecycleObserver, OnResume, OnPause {
private static final String KEY_CONTEXT = "context";
diff --git a/src/com/android/settings/applications/assist/AssistFlashScreenPreferenceController.java b/src/com/android/settings/applications/assist/AssistFlashScreenPreferenceController.java
index faee23d..083ab42 100644
--- a/src/com/android/settings/applications/assist/AssistFlashScreenPreferenceController.java
+++ b/src/com/android/settings/applications/assist/AssistFlashScreenPreferenceController.java
@@ -27,7 +27,8 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.AssistUtils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
@@ -36,8 +37,9 @@
import java.util.Arrays;
import java.util.List;
-public class AssistFlashScreenPreferenceController extends PreferenceController
- implements Preference.OnPreferenceChangeListener, LifecycleObserver, OnResume, OnPause {
+public class AssistFlashScreenPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
+ LifecycleObserver, OnResume, OnPause {
private static final String KEY_FLASH = "flash";
diff --git a/src/com/android/settings/applications/assist/AssistScreenshotPreferenceController.java b/src/com/android/settings/applications/assist/AssistScreenshotPreferenceController.java
index fb7be629b..0e3d621 100644
--- a/src/com/android/settings/applications/assist/AssistScreenshotPreferenceController.java
+++ b/src/com/android/settings/applications/assist/AssistScreenshotPreferenceController.java
@@ -25,7 +25,8 @@
import android.support.v7.preference.TwoStatePreference;
import com.android.internal.app.AssistUtils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
@@ -34,8 +35,9 @@
import java.util.Arrays;
import java.util.List;
-public class AssistScreenshotPreferenceController extends PreferenceController
- implements Preference.OnPreferenceChangeListener, LifecycleObserver, OnResume, OnPause {
+public class AssistScreenshotPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
+ LifecycleObserver, OnResume, OnPause {
private static final String KEY_SCREENSHOT = "screenshot";
diff --git a/src/com/android/settings/applications/assist/ManageAssist.java b/src/com/android/settings/applications/assist/ManageAssist.java
index 3b8edf3..b3622ae 100644
--- a/src/com/android/settings/applications/assist/ManageAssist.java
+++ b/src/com/android/settings/applications/assist/ManageAssist.java
@@ -21,11 +21,11 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.gestures.AssistGesturePreferenceController;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -51,7 +51,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle());
}
@@ -68,9 +68,9 @@
.setTitle(R.string.assist_footer);
}
- private static List<PreferenceController> buildPreferenceControllers(Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Lifecycle lifecycle) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new DefaultAssistPreferenceController(context));
controllers.add(new AssistGesturePreferenceController(context, lifecycle, KEY_ASSIST));
controllers.add(new AssistContextPreferenceController(context, lifecycle));
@@ -92,7 +92,8 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(
+ Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
diff --git a/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceController.java b/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceController.java
index b53a335..6b60abc 100644
--- a/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceController.java
+++ b/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceController.java
@@ -27,10 +27,12 @@
import com.android.settings.R;
import com.android.settings.applications.PackageManagerWrapper;
import com.android.settings.applications.PackageManagerWrapperImpl;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.widget.GearPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
-public abstract class DefaultAppPreferenceController extends PreferenceController {
+public abstract class DefaultAppPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String TAG = "DefaultAppPrefControl";
diff --git a/src/com/android/settings/backup/BackupSettingsActivityPreferenceController.java b/src/com/android/settings/backup/BackupSettingsActivityPreferenceController.java
index 8e0f922..afc13b4 100644
--- a/src/com/android/settings/backup/BackupSettingsActivityPreferenceController.java
+++ b/src/com/android/settings/backup/BackupSettingsActivityPreferenceController.java
@@ -18,19 +18,15 @@
import android.app.backup.BackupManager;
import android.content.Context;
-import android.os.Build;
-import android.os.RemoteException;
-import android.os.ServiceManager;
import android.os.UserManager;
import android.support.v7.preference.Preference;
-import android.support.v7.preference.PreferenceScreen;
-import android.util.Log;
import com.android.settings.R;
-import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class BackupSettingsActivityPreferenceController extends PreferenceController {
+public class BackupSettingsActivityPreferenceController extends
+ AbstractPreferenceController implements PreferenceControllerMixin {
private static final String KEY_BACKUP_SETTINGS = "backup_settings";
private static final String TAG = "BackupSettingActivityPC" ;
diff --git a/src/com/android/settings/backup/BackupSettingsFragment.java b/src/com/android/settings/backup/BackupSettingsFragment.java
index a451272..e6bb12d 100644
--- a/src/com/android/settings/backup/BackupSettingsFragment.java
+++ b/src/com/android/settings/backup/BackupSettingsFragment.java
@@ -21,10 +21,11 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
import java.util.List;
@@ -57,11 +58,11 @@
}
/**
- * Get a list of {@link PreferenceController} for this fragment.
+ * Get a list of {@link AbstractPreferenceController} for this fragment.
*/
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new BackupSettingsPreferenceController(context));
return controllers;
}
diff --git a/src/com/android/settings/backup/BackupSettingsPreferenceController.java b/src/com/android/settings/backup/BackupSettingsPreferenceController.java
index 2c4605a..d25d2f5 100644
--- a/src/com/android/settings/backup/BackupSettingsPreferenceController.java
+++ b/src/com/android/settings/backup/BackupSettingsPreferenceController.java
@@ -22,9 +22,11 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class BackupSettingsPreferenceController extends PreferenceController {
+public class BackupSettingsPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String BACKUP_SETTINGS = "backup_settings";
private static final String MANUFACTURER_SETTINGS = "manufacturer_backup";
private Intent mBackupSettingsIntent;
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsController.java b/src/com/android/settings/bluetooth/BluetoothDetailsController.java
index 73e9f31..265690b 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsController.java
@@ -20,8 +20,9 @@
import android.support.v14.preference.PreferenceFragment;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
@@ -31,8 +32,9 @@
* This class provides common lifecycle and bluetooth device event registration for Bluetooth device
* details controllers.
*/
-public abstract class BluetoothDetailsController extends PreferenceController
- implements CachedBluetoothDevice.Callback, LifecycleObserver, OnPause, OnResume {
+public abstract class BluetoothDetailsController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, CachedBluetoothDevice.Callback, LifecycleObserver,
+ OnPause, OnResume {
protected final Context mContext;
protected final PreferenceFragment mFragment;
diff --git a/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java b/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java
index c81e1ee..d09887c 100644
--- a/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java
+++ b/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java
@@ -23,10 +23,10 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.RestrictedDashboardFragment;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -64,8 +64,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- ArrayList<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ ArrayList<AbstractPreferenceController> controllers = new ArrayList<>();
LocalBluetoothManager manager = Utils.getLocalBtManager(context);
BluetoothDevice remoteDevice = manager.getBluetoothAdapter().getRemoteDevice(
mDeviceAddress);
diff --git a/src/com/android/settings/bluetooth/BluetoothDeviceNamePreferenceController.java b/src/com/android/settings/bluetooth/BluetoothDeviceNamePreferenceController.java
index baab3fc..5c521dd 100644
--- a/src/com/android/settings/bluetooth/BluetoothDeviceNamePreferenceController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDeviceNamePreferenceController.java
@@ -32,20 +32,20 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.events.OnResume;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
/**
* Controller that shows and updates the bluetooth device name
*/
-public class BluetoothDeviceNamePreferenceController extends PreferenceController implements
- LifecycleObserver, OnStart, OnStop {
+public class BluetoothDeviceNamePreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnStart, OnStop {
private static final String TAG = "BluetoothNamePrefCtrl";
public static final String KEY_DEVICE_NAME = "device_name";
diff --git a/src/com/android/settings/bluetooth/BluetoothFilesPreferenceController.java b/src/com/android/settings/bluetooth/BluetoothFilesPreferenceController.java
index c425cdc..450c7b2 100644
--- a/src/com/android/settings/bluetooth/BluetoothFilesPreferenceController.java
+++ b/src/com/android/settings/bluetooth/BluetoothFilesPreferenceController.java
@@ -22,14 +22,16 @@
import android.support.v7.preference.Preference;
import com.android.internal.logging.nano.MetricsProto;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.core.AbstractPreferenceController;
/**
* Controller that shows received files
*/
-public class BluetoothFilesPreferenceController extends PreferenceController {
+public class BluetoothFilesPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String TAG = "BluetoothFilesPrefCtrl";
public static final String KEY_RECEIVED_FILES = "bt_received_files";
diff --git a/src/com/android/settings/bluetooth/BluetoothMasterSwitchPreferenceController.java b/src/com/android/settings/bluetooth/BluetoothMasterSwitchPreferenceController.java
index 6d474ee..4f775e7 100644
--- a/src/com/android/settings/bluetooth/BluetoothMasterSwitchPreferenceController.java
+++ b/src/com/android/settings/bluetooth/BluetoothMasterSwitchPreferenceController.java
@@ -25,21 +25,22 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.widget.MasterSwitchController;
import com.android.settings.widget.MasterSwitchPreference;
import com.android.settings.widget.SummaryUpdater.OnSummaryChangeListener;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
-public class BluetoothMasterSwitchPreferenceController extends PreferenceController
- implements OnSummaryChangeListener,
- LifecycleObserver, OnResume, OnPause, OnStart, OnStop {
+public class BluetoothMasterSwitchPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, OnSummaryChangeListener, LifecycleObserver, OnResume,
+ OnPause, OnStart, OnStop {
public static final String KEY_TOGGLE_BLUETOOTH = "toggle_bluetooth";
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDetail.java b/src/com/android/settings/bluetooth/BluetoothPairingDetail.java
index 6545ed1..8adfeab 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingDetail.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDetail.java
@@ -26,10 +26,10 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.search.Indexable;
import com.android.settingslib.bluetooth.BluetoothDeviceFilter;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.widget.FooterPreference;
import java.util.ArrayList;
@@ -185,8 +185,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- List<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ List<AbstractPreferenceController> controllers = new ArrayList<>();
mDeviceNamePrefController = new BluetoothDeviceNamePreferenceController(context,
this, getLifecycle());
controllers.add(mDeviceNamePrefController);
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingPreferenceController.java b/src/com/android/settings/bluetooth/BluetoothPairingPreferenceController.java
index ab99aad..5141b5c 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingPreferenceController.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingPreferenceController.java
@@ -22,14 +22,16 @@
import android.os.UserHandle;
import com.android.settings.SettingsActivity;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.R;
+import com.android.settingslib.core.AbstractPreferenceController;
/**
* Controller that shows and updates the bluetooth device name
*/
-public class BluetoothPairingPreferenceController extends PreferenceController {
+public class BluetoothPairingPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String TAG = "BluetoothPairingPrefCtrl";
public static final String KEY_PAIRING = "pref_bt_pairing";
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 4703031..ce7c59d 100644
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -16,8 +16,9 @@
package com.android.settings.bluetooth;
+import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
+
import android.app.Activity;
-import android.app.Fragment;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.ContentResolver;
@@ -25,7 +26,6 @@
import android.content.IntentFilter;
import android.content.res.Resources;
import android.os.Bundle;
-import android.os.SystemProperties;
import android.provider.Settings;
import android.support.annotation.VisibleForTesting;
import android.support.v7.preference.Preference;
@@ -40,7 +40,6 @@
import com.android.settings.LinkifyUtils;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.location.ScanningSettings;
import com.android.settings.overlay.FeatureFactory;
@@ -55,13 +54,11 @@
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.widget.FooterPreference;
import java.util.ArrayList;
import java.util.List;
-import java.util.Set;
-
-import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
/**
* BluetoothSettings is the Settings screen for Bluetooth configuration and
@@ -356,8 +353,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- List<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ List<AbstractPreferenceController> controllers = new ArrayList<>();
mDeviceNamePrefController = new BluetoothDeviceNamePreferenceController(context,
this, getLifecycle());
mPairingPrefController = new BluetoothPairingPreferenceController(context, this,
diff --git a/src/com/android/settings/bluetooth/BluetoothSettingsObsolete.java b/src/com/android/settings/bluetooth/BluetoothSettingsObsolete.java
index 207d313..19c1e9c 100644
--- a/src/com/android/settings/bluetooth/BluetoothSettingsObsolete.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettingsObsolete.java
@@ -48,7 +48,6 @@
import com.android.settings.LinkifyUtils;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.location.ScanningSettings;
import com.android.settings.overlay.FeatureFactory;
@@ -63,6 +62,7 @@
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.widget.FooterPreference;
import java.util.ArrayList;
@@ -525,8 +525,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- List<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ List<AbstractPreferenceController> controllers = new ArrayList<>();
mDeviceNamePrefController = new BluetoothDeviceNamePreferenceController(context,
this, getLifecycle());
controllers.add(mDeviceNamePrefController);
diff --git a/src/com/android/settings/bluetooth/DevicePickerFragment.java b/src/com/android/settings/bluetooth/DevicePickerFragment.java
index 60470c5..7898041 100644
--- a/src/com/android/settings/bluetooth/DevicePickerFragment.java
+++ b/src/com/android/settings/bluetooth/DevicePickerFragment.java
@@ -16,6 +16,8 @@
package com.android.settings.bluetooth;
+import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
+
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothDevicePicker;
@@ -28,10 +30,8 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
-
-import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.List;
@@ -157,7 +157,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return null;
}
diff --git a/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
index 52028b3..e73da62 100644
--- a/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
+++ b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
@@ -26,13 +26,13 @@
import com.android.settings.SettingsActivity;
import com.android.settings.bluetooth.BluetoothMasterSwitchPreferenceController;
import com.android.settings.bluetooth.Utils;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.deviceinfo.UsbBackend;
import com.android.settings.nfc.NfcPreferenceController;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -65,8 +65,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
final Lifecycle lifecycle = getLifecycle();
final NfcPreferenceController nfcPreferenceController =
new NfcPreferenceController(context);
diff --git a/src/com/android/settings/connecteddevice/UsbModePreferenceController.java b/src/com/android/settings/connecteddevice/UsbModePreferenceController.java
index 9c9ed12..a6cb9be 100644
--- a/src/com/android/settings/connecteddevice/UsbModePreferenceController.java
+++ b/src/com/android/settings/connecteddevice/UsbModePreferenceController.java
@@ -24,15 +24,16 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.R;
import com.android.settings.deviceinfo.UsbBackend;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
-public class UsbModePreferenceController extends PreferenceController
- implements LifecycleObserver, OnResume, OnPause {
+public class UsbModePreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause {
private static final String KEY_USB_MODE = "usb_mode";
diff --git a/src/com/android/settings/core/DynamicAvailabilityPreferenceController.java b/src/com/android/settings/core/DynamicAvailabilityPreferenceController.java
index df6ccd3..04a561c 100644
--- a/src/com/android/settings/core/DynamicAvailabilityPreferenceController.java
+++ b/src/com/android/settings/core/DynamicAvailabilityPreferenceController.java
@@ -20,12 +20,13 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnResume;
-public abstract class DynamicAvailabilityPreferenceController extends PreferenceController
- implements LifecycleObserver, OnResume {
+public abstract class DynamicAvailabilityPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnResume {
private Preference mPreference;
private PreferenceScreen mScreen;
diff --git a/src/com/android/settings/core/PreferenceController.java b/src/com/android/settings/core/PreferenceControllerMixin.java
similarity index 62%
rename from src/com/android/settings/core/PreferenceController.java
rename to src/com/android/settings/core/PreferenceControllerMixin.java
index 2b3a7ab..0f60210 100644
--- a/src/com/android/settings/core/PreferenceController.java
+++ b/src/com/android/settings/core/PreferenceControllerMixin.java
@@ -15,21 +15,28 @@
*/
package com.android.settings.core;
-import android.content.Context;
-
-import com.android.settings.search.SearchIndexableRaw;
import com.android.settings.search.ResultPayload;
+import com.android.settings.search.SearchIndexableRaw;
import com.android.settingslib.core.AbstractPreferenceController;
import java.util.List;
/**
- * A controller that manages event for preference.
+ * A controller mixin that adds mobile settings specific functionality
*/
-public abstract class PreferenceController extends AbstractPreferenceController {
+public interface PreferenceControllerMixin {
- public PreferenceController(Context context) {
- super(context);
+ /**
+ * Updates non-indexable keys for search provider.
+ *
+ * Called by SearchIndexProvider#getNonIndexableKeys
+ */
+ default void updateNonIndexableKeys(List<String> keys) {
+ if (this instanceof AbstractPreferenceController) {
+ if (!((AbstractPreferenceController) this).isAvailable()) {
+ keys.add(((AbstractPreferenceController) this).getPreferenceKey());
+ }
+ }
}
/**
@@ -37,13 +44,13 @@
*
* Called by SearchIndexProvider#getRawDataToIndex
*/
- public void updateRawDataToIndex(List<SearchIndexableRaw> rawData) {
+ default void updateRawDataToIndex(List<SearchIndexableRaw> rawData) {
}
/**
* @return the {@link ResultPayload} corresponding to the search result type for the preference.
*/
- public ResultPayload getResultPayload() {
+ default ResultPayload getResultPayload() {
return null;
}
}
diff --git a/src/com/android/settings/dashboard/DashboardFragment.java b/src/com/android/settings/dashboard/DashboardFragment.java
index 8deade6..ba42222 100644
--- a/src/com/android/settings/dashboard/DashboardFragment.java
+++ b/src/com/android/settings/dashboard/DashboardFragment.java
@@ -32,9 +32,9 @@
import android.view.ViewGroup;
import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.core.PreferenceController;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.Indexable;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.drawer.DashboardCategory;
import com.android.settingslib.drawer.SettingsDrawerActivity;
import com.android.settingslib.drawer.Tile;
@@ -53,7 +53,7 @@
SummaryLoader.SummaryConsumer {
private static final String TAG = "DashboardFragment";
- private final Map<Class, PreferenceController> mPreferenceControllers =
+ private final Map<Class, AbstractPreferenceController> mPreferenceControllers =
new ArrayMap<>();
private final Set<String> mDashboardTilePrefKeys = new ArraySet<>();
@@ -72,14 +72,14 @@
.getProgressiveDisclosureMixin(context, this, getArguments());
getLifecycle().addObserver(mProgressiveDisclosureMixin);
- List<PreferenceController> controllers = getPreferenceControllers(context);
+ List<AbstractPreferenceController> controllers = getPreferenceControllers(context);
if (controllers == null) {
controllers = new ArrayList<>();
}
mPlaceholderPreferenceController =
new DashboardTilePlaceholderPreferenceController(context);
controllers.add(mPlaceholderPreferenceController);
- for (PreferenceController controller : controllers) {
+ for (AbstractPreferenceController controller : controllers) {
addPreferenceController(controller);
}
}
@@ -159,12 +159,12 @@
@Override
public boolean onPreferenceTreeClick(Preference preference) {
- Collection<PreferenceController> controllers = mPreferenceControllers.values();
+ Collection<AbstractPreferenceController> controllers = mPreferenceControllers.values();
// If preference contains intent, log it before handling.
mMetricsFeatureProvider.logDashboardStartIntent(
getContext(), preference.getIntent(), getMetricsCategory());
// Give all controllers a chance to handle click.
- for (PreferenceController controller : controllers) {
+ for (AbstractPreferenceController controller : controllers) {
if (controller.handlePreferenceTreeClick(preference)) {
return true;
}
@@ -188,12 +188,12 @@
}
}
- protected <T extends PreferenceController> T getPreferenceController(Class<T> clazz) {
- PreferenceController controller = mPreferenceControllers.get(clazz);
+ protected <T extends AbstractPreferenceController> T getPreferenceController(Class<T> clazz) {
+ AbstractPreferenceController controller = mPreferenceControllers.get(clazz);
return (T) controller;
}
- protected void addPreferenceController(PreferenceController controller) {
+ protected void addPreferenceController(AbstractPreferenceController controller) {
mPreferenceControllers.put(controller.getClass(), controller);
}
@@ -216,9 +216,9 @@
protected abstract int getPreferenceScreenResId();
/**
- * Get a list of {@link PreferenceController} for this fragment.
+ * Get a list of {@link AbstractPreferenceController} for this fragment.
*/
- protected abstract List<PreferenceController> getPreferenceControllers(Context context);
+ protected abstract List<AbstractPreferenceController> getPreferenceControllers(Context context);
/**
* Returns true if this tile should be displayed
@@ -237,8 +237,8 @@
}
addPreferencesFromResource(resId);
final PreferenceScreen screen = getPreferenceScreen();
- Collection<PreferenceController> controllers = mPreferenceControllers.values();
- for (PreferenceController controller : controllers) {
+ Collection<AbstractPreferenceController> controllers = mPreferenceControllers.values();
+ for (AbstractPreferenceController controller : controllers) {
controller.displayPreference(screen);
}
}
@@ -247,9 +247,9 @@
* Update state of each preference managed by PreferenceController.
*/
protected void updatePreferenceStates() {
- Collection<PreferenceController> controllers = mPreferenceControllers.values();
+ Collection<AbstractPreferenceController> controllers = mPreferenceControllers.values();
final PreferenceScreen screen = getPreferenceScreen();
- for (PreferenceController controller : controllers) {
+ for (AbstractPreferenceController controller : controllers) {
if (!controller.isAvailable()) {
continue;
}
diff --git a/src/com/android/settings/dashboard/DashboardTilePlaceholderPreferenceController.java b/src/com/android/settings/dashboard/DashboardTilePlaceholderPreferenceController.java
index eb99fb3..97a5c35 100644
--- a/src/com/android/settings/dashboard/DashboardTilePlaceholderPreferenceController.java
+++ b/src/com/android/settings/dashboard/DashboardTilePlaceholderPreferenceController.java
@@ -20,7 +20,8 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
/**
* PreferenceController for a dashboard_tile_placeholder, a special preference marking where
@@ -28,7 +29,8 @@
* preference screen in xml. If not present, all dynamic dashboard tiles will be added to the
* bottom of page.
*/
-class DashboardTilePlaceholderPreferenceController extends PreferenceController {
+class DashboardTilePlaceholderPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_PLACEHOLDER = "dashboard_tile_placeholder";
diff --git a/src/com/android/settings/dashboard/RestrictedDashboardFragment.java b/src/com/android/settings/dashboard/RestrictedDashboardFragment.java
index c2176d7..99aaff4 100644
--- a/src/com/android/settings/dashboard/RestrictedDashboardFragment.java
+++ b/src/com/android/settings/dashboard/RestrictedDashboardFragment.java
@@ -49,7 +49,7 @@
*
* This fragment is a replacement of {@link RestrictedSettingsFragment} but extends
* from {@link DashboardFragment}, so we could also use
- * {@link com.android.settings.core.PreferenceController} in this fragment.
+ * {@link com.android.settingslib.core.AbstractPreferenceController} in this fragment.
*/
public abstract class RestrictedDashboardFragment extends DashboardFragment {
diff --git a/src/com/android/settings/datetime/AutoTimePreferenceController.java b/src/com/android/settings/datetime/AutoTimePreferenceController.java
index fdeef29..0b70f45 100644
--- a/src/com/android/settings/datetime/AutoTimePreferenceController.java
+++ b/src/com/android/settings/datetime/AutoTimePreferenceController.java
@@ -20,12 +20,13 @@
import android.provider.Settings;
import android.support.v7.preference.Preference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedSwitchPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class AutoTimePreferenceController extends PreferenceController
- implements Preference.OnPreferenceChangeListener {
+public class AutoTimePreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
private static final String KEY_AUTO_TIME = "auto_time";
private final UpdateTimeAndDateCallback mCallback;
diff --git a/src/com/android/settings/datetime/AutoTimeZonePreferenceController.java b/src/com/android/settings/datetime/AutoTimeZonePreferenceController.java
index b48e535..8a9568a 100644
--- a/src/com/android/settings/datetime/AutoTimeZonePreferenceController.java
+++ b/src/com/android/settings/datetime/AutoTimeZonePreferenceController.java
@@ -22,10 +22,11 @@
import android.support.v7.preference.Preference;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class AutoTimeZonePreferenceController extends PreferenceController
- implements Preference.OnPreferenceChangeListener {
+public class AutoTimeZonePreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
private static final String KEY_AUTO_TIME_ZONE = "auto_zone";
diff --git a/src/com/android/settings/datetime/DatePreferenceController.java b/src/com/android/settings/datetime/DatePreferenceController.java
index 2a06e5a..9582e9e 100644
--- a/src/com/android/settings/datetime/DatePreferenceController.java
+++ b/src/com/android/settings/datetime/DatePreferenceController.java
@@ -26,12 +26,13 @@
import android.text.format.DateFormat;
import android.widget.DatePicker;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.Calendar;
-public class DatePreferenceController extends PreferenceController implements
- DatePickerDialog.OnDateSetListener {
+public class DatePreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, DatePickerDialog.OnDateSetListener {
public interface DatePreferenceHost extends UpdateTimeAndDateCallback {
void showDatePicker();
diff --git a/src/com/android/settings/datetime/TimeFormatPreferenceController.java b/src/com/android/settings/datetime/TimeFormatPreferenceController.java
index 75fc808..92b3716 100644
--- a/src/com/android/settings/datetime/TimeFormatPreferenceController.java
+++ b/src/com/android/settings/datetime/TimeFormatPreferenceController.java
@@ -25,12 +25,14 @@
import android.text.TextUtils;
import android.text.format.DateFormat;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.Calendar;
import java.util.Date;
-public class TimeFormatPreferenceController extends PreferenceController {
+public class TimeFormatPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
static final String HOURS_12 = "12";
static final String HOURS_24 = "24";
diff --git a/src/com/android/settings/datetime/TimePreferenceController.java b/src/com/android/settings/datetime/TimePreferenceController.java
index 4862588..9bb5689 100644
--- a/src/com/android/settings/datetime/TimePreferenceController.java
+++ b/src/com/android/settings/datetime/TimePreferenceController.java
@@ -25,12 +25,13 @@
import android.text.format.DateFormat;
import android.widget.TimePicker;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.Calendar;
-public class TimePreferenceController extends PreferenceController implements
- TimePickerDialog.OnTimeSetListener {
+public class TimePreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, TimePickerDialog.OnTimeSetListener {
public interface TimePreferenceHost extends UpdateTimeAndDateCallback {
void showTimePicker();
diff --git a/src/com/android/settings/datetime/TimeZonePreferenceController.java b/src/com/android/settings/datetime/TimeZonePreferenceController.java
index f0b604e..987132b 100644
--- a/src/com/android/settings/datetime/TimeZonePreferenceController.java
+++ b/src/com/android/settings/datetime/TimeZonePreferenceController.java
@@ -20,12 +20,14 @@
import android.support.annotation.VisibleForTesting;
import android.support.v7.preference.Preference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.datetime.ZoneGetter;
import java.util.Calendar;
-public class TimeZonePreferenceController extends PreferenceController {
+public class TimeZonePreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_TIMEZONE = "timezone";
diff --git a/src/com/android/settings/development/BugReportInPowerPreferenceController.java b/src/com/android/settings/development/BugReportInPowerPreferenceController.java
index 47b2d0d..4032826 100644
--- a/src/com/android/settings/development/BugReportInPowerPreferenceController.java
+++ b/src/com/android/settings/development/BugReportInPowerPreferenceController.java
@@ -25,9 +25,11 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class BugReportInPowerPreferenceController extends PreferenceController {
+public class BugReportInPowerPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_BUGREPORT_IN_POWER = "bugreport_in_power";
diff --git a/src/com/android/settings/development/BugReportPreferenceController.java b/src/com/android/settings/development/BugReportPreferenceController.java
index 371fb73..015071f 100644
--- a/src/com/android/settings/development/BugReportPreferenceController.java
+++ b/src/com/android/settings/development/BugReportPreferenceController.java
@@ -21,9 +21,11 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class BugReportPreferenceController extends PreferenceController {
+public class BugReportPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_BUGREPORT = "bugreport";
diff --git a/src/com/android/settings/development/CameraHalHdrplusPreferenceController.java b/src/com/android/settings/development/CameraHalHdrplusPreferenceController.java
index d7cd28b..e8e2c2d 100644
--- a/src/com/android/settings/development/CameraHalHdrplusPreferenceController.java
+++ b/src/com/android/settings/development/CameraHalHdrplusPreferenceController.java
@@ -24,10 +24,12 @@
import android.widget.Toast;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.settings.core.PreferenceController;
import com.android.settings.R;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class CameraHalHdrplusPreferenceController extends PreferenceController {
+public class CameraHalHdrplusPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_CAMERA_HAL_HDRPLUS_SWITCH = "camera_hal_hdrplus_switch";
@VisibleForTesting
diff --git a/src/com/android/settings/development/TelephonyMonitorPreferenceController.java b/src/com/android/settings/development/TelephonyMonitorPreferenceController.java
index c21ccda..fd6825e 100644
--- a/src/com/android/settings/development/TelephonyMonitorPreferenceController.java
+++ b/src/com/android/settings/development/TelephonyMonitorPreferenceController.java
@@ -24,10 +24,12 @@
import android.widget.Toast;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.R;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class TelephonyMonitorPreferenceController extends PreferenceController {
+public class TelephonyMonitorPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_TELEPHONY_MONITOR_SWITCH = "telephony_monitor_switch";
@VisibleForTesting
diff --git a/src/com/android/settings/development/VerifyAppsOverUsbPreferenceController.java b/src/com/android/settings/development/VerifyAppsOverUsbPreferenceController.java
index c0bb0c7..d7891c7 100644
--- a/src/com/android/settings/development/VerifyAppsOverUsbPreferenceController.java
+++ b/src/com/android/settings/development/VerifyAppsOverUsbPreferenceController.java
@@ -27,17 +27,19 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import com.android.settingslib.RestrictedSwitchPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.List;
/**
* Controller to manage the state of "Verify apps over USB" toggle.
*/
-public class VerifyAppsOverUsbPreferenceController extends PreferenceController {
+public class VerifyAppsOverUsbPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String VERIFY_APPS_OVER_USB_KEY = "verify_apps_over_usb";
private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive";
diff --git a/src/com/android/settings/deviceinfo/AdditionalSystemUpdatePreferenceController.java b/src/com/android/settings/deviceinfo/AdditionalSystemUpdatePreferenceController.java
index 8d35eca..06bdb3f 100644
--- a/src/com/android/settings/deviceinfo/AdditionalSystemUpdatePreferenceController.java
+++ b/src/com/android/settings/deviceinfo/AdditionalSystemUpdatePreferenceController.java
@@ -16,11 +16,12 @@
package com.android.settings.deviceinfo;
import android.content.Context;
-import android.support.v7.preference.Preference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class AdditionalSystemUpdatePreferenceController extends PreferenceController {
+public class AdditionalSystemUpdatePreferenceController extends
+ AbstractPreferenceController implements PreferenceControllerMixin {
private static final String KEY_UPDATE_SETTING = "additional_system_update_settings";
diff --git a/src/com/android/settings/deviceinfo/BasebandVersionPreferenceController.java b/src/com/android/settings/deviceinfo/BasebandVersionPreferenceController.java
index 1153d12..018a068 100644
--- a/src/com/android/settings/deviceinfo/BasebandVersionPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/BasebandVersionPreferenceController.java
@@ -21,9 +21,11 @@
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class BasebandVersionPreferenceController extends PreferenceController {
+public class BasebandVersionPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String BASEBAND_PROPERTY = "gsm.version.baseband";
private static final String KEY_BASEBAND_VERSION = "baseband_version";
diff --git a/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java b/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java
index 9232838..3c44223 100644
--- a/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java
@@ -32,19 +32,20 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.development.DevelopmentSettings;
import com.android.settings.development.DevelopmentSettingsEnabler;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.password.ChooseLockSettingsHelper;
import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnResume;
-public class BuildNumberPreferenceController extends PreferenceController
- implements LifecycleObserver, OnResume {
+public class BuildNumberPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, LifecycleObserver, OnResume {
static final int TAPS_TO_BE_A_DEVELOPER = 7;
static final int REQUEST_CONFIRM_PASSWORD_FOR_DEV_PREF = 100;
diff --git a/src/com/android/settings/deviceinfo/DeviceModelPreferenceController.java b/src/com/android/settings/deviceinfo/DeviceModelPreferenceController.java
index ac3870a..f1dc415 100644
--- a/src/com/android/settings/deviceinfo/DeviceModelPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/DeviceModelPreferenceController.java
@@ -22,10 +22,12 @@
import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.DeviceInfoUtils;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class DeviceModelPreferenceController extends PreferenceController {
+public class DeviceModelPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_DEVICE_MODEL = "device_model";
diff --git a/src/com/android/settings/deviceinfo/FccEquipmentIdPreferenceController.java b/src/com/android/settings/deviceinfo/FccEquipmentIdPreferenceController.java
index 4f8de71..f3d7380 100644
--- a/src/com/android/settings/deviceinfo/FccEquipmentIdPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/FccEquipmentIdPreferenceController.java
@@ -22,9 +22,11 @@
import android.text.TextUtils;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class FccEquipmentIdPreferenceController extends PreferenceController {
+public class FccEquipmentIdPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String PROPERTY_EQUIPMENT_ID = "ro.ril.fccid";
diff --git a/src/com/android/settings/deviceinfo/FeedbackPreferenceController.java b/src/com/android/settings/deviceinfo/FeedbackPreferenceController.java
index ed61a92..2d8941d 100644
--- a/src/com/android/settings/deviceinfo/FeedbackPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/FeedbackPreferenceController.java
@@ -21,10 +21,12 @@
import android.support.v7.preference.Preference;
import android.text.TextUtils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.DeviceInfoUtils;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class FeedbackPreferenceController extends PreferenceController {
+public class FeedbackPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_DEVICE_FEEDBACK = "device_feedback";
private final Fragment mHost;
diff --git a/src/com/android/settings/deviceinfo/FirmwareVersionPreferenceController.java b/src/com/android/settings/deviceinfo/FirmwareVersionPreferenceController.java
index 1b56301..fd73ed5 100644
--- a/src/com/android/settings/deviceinfo/FirmwareVersionPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/FirmwareVersionPreferenceController.java
@@ -26,15 +26,16 @@
import android.text.TextUtils;
import android.util.Log;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnResume;
-public class FirmwareVersionPreferenceController extends PreferenceController
- implements LifecycleObserver, OnResume {
+public class FirmwareVersionPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, LifecycleObserver, OnResume {
private static final String TAG = "FirmwareVersionPref";
private static final String KEY_FIRMWARE_VERSION = "firmware_version";
diff --git a/src/com/android/settings/deviceinfo/KernelVersionPreferenceController.java b/src/com/android/settings/deviceinfo/KernelVersionPreferenceController.java
index 3a84c1e..5afed9c 100644
--- a/src/com/android/settings/deviceinfo/KernelVersionPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/KernelVersionPreferenceController.java
@@ -18,10 +18,12 @@
import android.content.Context;
import android.support.v7.preference.Preference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.DeviceInfoUtils;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class KernelVersionPreferenceController extends PreferenceController {
+public class KernelVersionPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_KERNEL_VERSION = "kernel_version";
diff --git a/src/com/android/settings/deviceinfo/ManualPreferenceController.java b/src/com/android/settings/deviceinfo/ManualPreferenceController.java
index dbaa00f..20464a5 100644
--- a/src/com/android/settings/deviceinfo/ManualPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/ManualPreferenceController.java
@@ -19,9 +19,11 @@
import android.content.Context;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class ManualPreferenceController extends PreferenceController {
+public class ManualPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_MANUAL = "manual";
diff --git a/src/com/android/settings/deviceinfo/RegulatoryInfoPreferenceController.java b/src/com/android/settings/deviceinfo/RegulatoryInfoPreferenceController.java
index f82fd0b..c925c27 100644
--- a/src/com/android/settings/deviceinfo/RegulatoryInfoPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/RegulatoryInfoPreferenceController.java
@@ -19,9 +19,11 @@
import android.content.Intent;
import android.provider.Settings;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class RegulatoryInfoPreferenceController extends PreferenceController {
+public class RegulatoryInfoPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_REGULATORY_INFO = "regulatory_info";
private static final Intent INTENT_PROBE = new Intent(Settings.ACTION_SHOW_REGULATORY_INFO);
diff --git a/src/com/android/settings/deviceinfo/SELinuxStatusPreferenceController.java b/src/com/android/settings/deviceinfo/SELinuxStatusPreferenceController.java
index b8529d2..058992f 100644
--- a/src/com/android/settings/deviceinfo/SELinuxStatusPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/SELinuxStatusPreferenceController.java
@@ -23,9 +23,11 @@
import android.text.TextUtils;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class SELinuxStatusPreferenceController extends PreferenceController {
+public class SELinuxStatusPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String PROPERTY_SELINUX_STATUS = "ro.build.selinux";
private static final String KEY_SELINUX_STATUS = "selinux_status";
diff --git a/src/com/android/settings/deviceinfo/SafetyInfoPreferenceController.java b/src/com/android/settings/deviceinfo/SafetyInfoPreferenceController.java
index bde4dd0..10dbd19 100644
--- a/src/com/android/settings/deviceinfo/SafetyInfoPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/SafetyInfoPreferenceController.java
@@ -19,9 +19,11 @@
import android.content.Intent;
import android.content.pm.PackageManager;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class SafetyInfoPreferenceController extends PreferenceController {
+public class SafetyInfoPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final Intent INTENT_PROBE =
new Intent("android.settings.SHOW_SAFETY_AND_REGULATORY_INFO");
diff --git a/src/com/android/settings/deviceinfo/SafetyLegalPreferenceController.java b/src/com/android/settings/deviceinfo/SafetyLegalPreferenceController.java
index c158d64..c402046 100644
--- a/src/com/android/settings/deviceinfo/SafetyLegalPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/SafetyLegalPreferenceController.java
@@ -19,9 +19,11 @@
import android.os.SystemProperties;
import android.text.TextUtils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class SafetyLegalPreferenceController extends PreferenceController {
+public class SafetyLegalPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_SAFETY_LEGAL = "safetylegal";
private static final String PROPERTY_URL_SAFETYLEGAL = "ro.url.safetylegal";
diff --git a/src/com/android/settings/deviceinfo/SecurityPatchPreferenceController.java b/src/com/android/settings/deviceinfo/SecurityPatchPreferenceController.java
index 64a1159..f38602a 100644
--- a/src/com/android/settings/deviceinfo/SecurityPatchPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/SecurityPatchPreferenceController.java
@@ -22,10 +22,12 @@
import android.text.TextUtils;
import android.util.Log;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.DeviceInfoUtils;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class SecurityPatchPreferenceController extends PreferenceController {
+public class SecurityPatchPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_SECURITY_PATCH = "security_patch";
private static final String TAG = "SecurityPatchPref";
diff --git a/src/com/android/settings/deviceinfo/SerialNumberPreferenceController.java b/src/com/android/settings/deviceinfo/SerialNumberPreferenceController.java
index 0362bbc..b69844d 100644
--- a/src/com/android/settings/deviceinfo/SerialNumberPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/SerialNumberPreferenceController.java
@@ -23,9 +23,11 @@
import android.text.TextUtils;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class SerialNumberPreferenceController extends PreferenceController {
+public class SerialNumberPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_SERIAL_NUMBER = "serial_number";
diff --git a/src/com/android/settings/deviceinfo/StorageDashboardFragment.java b/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
index b5a7b3b..be72539 100644
--- a/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
+++ b/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
@@ -38,7 +38,6 @@
import com.android.settings.applications.PackageManagerWrapperImpl;
import com.android.settings.applications.UserManagerWrapper;
import com.android.settings.applications.UserManagerWrapperImpl;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.deviceinfo.storage.AutomaticStorageManagementSwitchPreferenceController;
import com.android.settings.deviceinfo.storage.SecondaryUserController;
@@ -50,6 +49,7 @@
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settingslib.applications.StorageStatsSource;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.deviceinfo.PrivateStorageInfo;
import com.android.settingslib.deviceinfo.StorageManagerVolumeProvider;
@@ -72,7 +72,7 @@
private StorageSummaryDonutPreferenceController mSummaryController;
private StorageItemPreferenceController mPreferenceController;
private PrivateVolumeOptionMenuController mOptionMenuController;
- private List<PreferenceController> mSecondaryUsers;
+ private List<AbstractPreferenceController> mSecondaryUsers;
@Override
public void onCreate(Bundle icicle) {
@@ -129,7 +129,7 @@
mPreferenceController.setUsedSize(privateUsedBytes);
mPreferenceController.setTotalSize(mStorageInfo.totalBytes);
for (int i = 0, size = mSecondaryUsers.size(); i < size; i++) {
- PreferenceController controller = mSecondaryUsers.get(i);
+ AbstractPreferenceController controller = mSecondaryUsers.get(i);
if (controller instanceof SecondaryUserController) {
SecondaryUserController userController = (SecondaryUserController) controller;
userController.setTotalSize(mStorageInfo.totalBytes);
@@ -161,8 +161,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
mSummaryController = new StorageSummaryDonutPreferenceController(context);
controllers.add(mSummaryController);
@@ -192,10 +192,10 @@
/**
* Updates the secondary user controller sizes.
*/
- private void updateSecondaryUserControllers(List<PreferenceController> controllers,
+ private void updateSecondaryUserControllers(List<AbstractPreferenceController> controllers,
SparseArray<StorageAsyncLoader.AppsStorageResult> stats) {
for (int i = 0, size = controllers.size(); i < size; i++) {
- PreferenceController controller = controllers.get(i);
+ AbstractPreferenceController controller = controllers.get(i);
if (controller instanceof StorageAsyncLoader.ResultHandler) {
StorageAsyncLoader.ResultHandler userController =
(StorageAsyncLoader.ResultHandler) controller;
@@ -218,11 +218,11 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
final StorageManager sm = context.getSystemService(StorageManager.class);
final UserManagerWrapper userManager =
new UserManagerWrapperImpl(context.getSystemService(UserManager.class));
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new StorageSummaryDonutPreferenceController(context));
controllers.add(new StorageItemPreferenceController(context, null /* host */,
null /* volume */, new StorageManagerVolumeProvider(sm)));
diff --git a/src/com/android/settings/deviceinfo/StorageProfileFragment.java b/src/com/android/settings/deviceinfo/StorageProfileFragment.java
index f5129ed..7a0a59e 100644
--- a/src/com/android/settings/deviceinfo/StorageProfileFragment.java
+++ b/src/com/android/settings/deviceinfo/StorageProfileFragment.java
@@ -32,12 +32,12 @@
import com.android.settings.Utils;
import com.android.settings.applications.PackageManagerWrapperImpl;
import com.android.settings.applications.UserManagerWrapperImpl;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.deviceinfo.storage.StorageAsyncLoader;
import com.android.settings.deviceinfo.storage.StorageAsyncLoader.AppsStorageResult;
import com.android.settings.deviceinfo.storage.StorageItemPreferenceController;
import com.android.settingslib.applications.StorageStatsSource;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.deviceinfo.StorageManagerVolumeProvider;
import java.util.ArrayList;
@@ -98,8 +98,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
final StorageManager sm = context.getSystemService(StorageManager.class);
mPreferenceController = new StorageItemPreferenceController(context, this,
mVolume, new StorageManagerVolumeProvider(sm));
diff --git a/src/com/android/settings/deviceinfo/SystemUpdatePreferenceController.java b/src/com/android/settings/deviceinfo/SystemUpdatePreferenceController.java
index c2e2ad8..d2ad6d8 100644
--- a/src/com/android/settings/deviceinfo/SystemUpdatePreferenceController.java
+++ b/src/com/android/settings/deviceinfo/SystemUpdatePreferenceController.java
@@ -28,11 +28,13 @@
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import static android.content.Context.CARRIER_CONFIG_SERVICE;
-public class SystemUpdatePreferenceController extends PreferenceController {
+public class SystemUpdatePreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String TAG = "SysUpdatePrefContr";
diff --git a/src/com/android/settings/deviceinfo/storage/AutomaticStorageManagementSwitchPreferenceController.java b/src/com/android/settings/deviceinfo/storage/AutomaticStorageManagementSwitchPreferenceController.java
index acd34f0..4635d82 100644
--- a/src/com/android/settings/deviceinfo/storage/AutomaticStorageManagementSwitchPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/storage/AutomaticStorageManagementSwitchPreferenceController.java
@@ -24,17 +24,19 @@
import android.support.v7.preference.PreferenceScreen;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.deletionhelper.ActivationWarningFragment;
import com.android.settings.widget.MasterSwitchController;
import com.android.settings.widget.MasterSwitchPreference;
import com.android.settings.widget.SwitchWidgetController;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnResume;
-public class AutomaticStorageManagementSwitchPreferenceController extends PreferenceController
- implements LifecycleObserver, OnResume, SwitchWidgetController.OnSwitchChangeListener {
+public class AutomaticStorageManagementSwitchPreferenceController extends
+ AbstractPreferenceController implements PreferenceControllerMixin, LifecycleObserver,
+ OnResume, SwitchWidgetController.OnSwitchChangeListener {
private static final String KEY_TOGGLE_ASM = "toggle_asm";
@VisibleForTesting
static final String STORAGE_MANAGER_ENABLED_BY_DEFAULT_PROPERTY = "ro.storage_manager.enabled";
diff --git a/src/com/android/settings/deviceinfo/storage/SecondaryUserController.java b/src/com/android/settings/deviceinfo/storage/SecondaryUserController.java
index dec0964..3c69ab1 100644
--- a/src/com/android/settings/deviceinfo/storage/SecondaryUserController.java
+++ b/src/com/android/settings/deviceinfo/storage/SecondaryUserController.java
@@ -28,8 +28,9 @@
import com.android.settings.Utils;
import com.android.settings.applications.UserManagerWrapper;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.deviceinfo.StorageItemPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
import java.util.List;
@@ -38,8 +39,9 @@
* SecondaryUserController controls the preferences on the Storage screen which had to do with
* secondary users.
*/
-public class SecondaryUserController extends PreferenceController
- implements StorageAsyncLoader.ResultHandler, UserIconLoader.UserIconHandler {
+public class SecondaryUserController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, StorageAsyncLoader.ResultHandler,
+ UserIconLoader.UserIconHandler {
// PreferenceGroupKey to try to add our preference onto.
private static final String TARGET_PREFERENCE_GROUP_KEY = "pref_secondary_users";
private static final String PREFERENCE_KEY_BASE = "pref_user_";
@@ -58,9 +60,9 @@
* @param context Context for initializing the preference controllers.
* @param userManager UserManagerWrapper for figuring out which controllers to add.
*/
- public static List<PreferenceController> getSecondaryUserControllers(
+ public static List<AbstractPreferenceController> getSecondaryUserControllers(
Context context, UserManagerWrapper userManager) {
- List<PreferenceController> controllers = new ArrayList<>();
+ List<AbstractPreferenceController> controllers = new ArrayList<>();
UserInfo primaryUser = userManager.getPrimaryUser();
boolean addedUser = false;
List<UserInfo> infos = userManager.getUsers();
@@ -89,7 +91,7 @@
/**
* Constructor for a given secondary user.
- * @param context Context to initialize the underlying {@link PreferenceController}.
+ * @param context Context to initialize the underlying {@link AbstractPreferenceController}.
* @param info {@link UserInfo} for the secondary user which this controllers covers.
*/
@VisibleForTesting
@@ -175,7 +177,8 @@
}
}
- private static class NoSecondaryUserController extends PreferenceController {
+ private static class NoSecondaryUserController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
public NoSecondaryUserController(Context context) {
super(context);
}
diff --git a/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java b/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
index cebd114..7060779 100644
--- a/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
@@ -38,11 +38,12 @@
import com.android.settings.Settings;
import com.android.settings.Utils;
import com.android.settings.applications.ManageApplications;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.deviceinfo.PrivateVolumeSettings.SystemInfoFragment;
import com.android.settings.deviceinfo.StorageItemPreference;
import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.deviceinfo.StorageMeasurement;
import com.android.settingslib.deviceinfo.StorageVolumeProvider;
@@ -54,7 +55,8 @@
* StorageItemPreferenceController handles the storage line items which summarize the storage
* categorization breakdown.
*/
-public class StorageItemPreferenceController extends PreferenceController {
+public class StorageItemPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String TAG = "StorageItemPreference";
private static final String IMAGE_MIME_TYPE = "image/*";
diff --git a/src/com/android/settings/deviceinfo/storage/StorageSummaryDonutPreferenceController.java b/src/com/android/settings/deviceinfo/storage/StorageSummaryDonutPreferenceController.java
index 91c4a6b..24fd2ee 100644
--- a/src/com/android/settings/deviceinfo/storage/StorageSummaryDonutPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/storage/StorageSummaryDonutPreferenceController.java
@@ -24,14 +24,16 @@
import android.text.format.Formatter;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.deviceinfo.StorageVolumeProvider;
/**
* StorgaeSummaryPreferenceController updates the donut storage summary preference to have the
* correct sizes showing.
*/
-public class StorageSummaryDonutPreferenceController extends PreferenceController {
+public class StorageSummaryDonutPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private long mUsedBytes;
private long mTotalBytes;
private StorageSummaryDonutPreference mSummary;
diff --git a/src/com/android/settings/deviceinfo/storage/UserProfileController.java b/src/com/android/settings/deviceinfo/storage/UserProfileController.java
index fc297ca..684ac52 100644
--- a/src/com/android/settings/deviceinfo/storage/UserProfileController.java
+++ b/src/com/android/settings/deviceinfo/storage/UserProfileController.java
@@ -30,14 +30,17 @@
import com.android.internal.util.Preconditions;
import com.android.settings.Utils;
import com.android.settings.applications.UserManagerWrapper;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.deviceinfo.StorageItemPreference;
import com.android.settings.deviceinfo.StorageProfileFragment;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.drawer.SettingsDrawerActivity;
-/** Defines a {@link PreferenceController} which handles a single profile of the primary user. */
-public class UserProfileController extends PreferenceController
- implements StorageAsyncLoader.ResultHandler, UserIconLoader.UserIconHandler {
+/** Defines a {@link AbstractPreferenceController} which handles a single profile of the primary
+ * user. */
+public class UserProfileController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, StorageAsyncLoader.ResultHandler,
+ UserIconLoader.UserIconHandler {
private static final String PREFERENCE_KEY_BASE = "pref_profile_";
private StorageItemPreference mStoragePreference;
private UserManagerWrapper mUserManager;
diff --git a/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceController.java b/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceController.java
index bed04d3..e9f54fb 100644
--- a/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceController.java
+++ b/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceController.java
@@ -25,10 +25,12 @@
import android.support.v7.preference.Preference;
import com.android.internal.hardware.AmbientDisplayConfiguration;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class AmbientDisplayAlwaysOnPreferenceController extends PreferenceController
- implements Preference.OnPreferenceChangeListener {
+public class AmbientDisplayAlwaysOnPreferenceController extends
+ AbstractPreferenceController implements PreferenceControllerMixin,
+ Preference.OnPreferenceChangeListener {
private static final String KEY_ALWAYS_ON = "ambient_display_always_on";
private static final int MY_USER = UserHandle.myUserId();
diff --git a/src/com/android/settings/display/AmbientDisplayNotificationsPreferenceController.java b/src/com/android/settings/display/AmbientDisplayNotificationsPreferenceController.java
index 9e15afb..eec61ff 100644
--- a/src/com/android/settings/display/AmbientDisplayNotificationsPreferenceController.java
+++ b/src/com/android/settings/display/AmbientDisplayNotificationsPreferenceController.java
@@ -21,14 +21,16 @@
import android.support.v7.preference.Preference;
import com.android.internal.hardware.AmbientDisplayConfiguration;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import static android.provider.Settings.Secure.DOZE_ENABLED;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.ACTION_AMBIENT_DISPLAY;
-public class AmbientDisplayNotificationsPreferenceController extends PreferenceController
- implements Preference.OnPreferenceChangeListener {
+public class AmbientDisplayNotificationsPreferenceController extends
+ AbstractPreferenceController implements PreferenceControllerMixin,
+ Preference.OnPreferenceChangeListener {
@VisibleForTesting
static final String KEY_AMBIENT_DISPLAY_NOTIFICATIONS = "ambient_display_notification";
diff --git a/src/com/android/settings/display/AmbientDisplayPreferenceController.java b/src/com/android/settings/display/AmbientDisplayPreferenceController.java
index f3e3046..62223b0 100644
--- a/src/com/android/settings/display/AmbientDisplayPreferenceController.java
+++ b/src/com/android/settings/display/AmbientDisplayPreferenceController.java
@@ -19,12 +19,13 @@
import android.os.UserHandle;
import android.support.v7.preference.Preference;
-import com.android.internal.app.NightDisplayController;
import com.android.internal.hardware.AmbientDisplayConfiguration;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class AmbientDisplayPreferenceController extends PreferenceController {
+public class AmbientDisplayPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final int MY_USER_ID = UserHandle.myUserId();
diff --git a/src/com/android/settings/display/AmbientDisplaySettings.java b/src/com/android/settings/display/AmbientDisplaySettings.java
index 011cccb..6a01ba2 100644
--- a/src/com/android/settings/display/AmbientDisplaySettings.java
+++ b/src/com/android/settings/display/AmbientDisplaySettings.java
@@ -17,20 +17,19 @@
package com.android.settings.display;
import android.content.Context;
-import android.os.Bundle;
import android.os.UserHandle;
import android.provider.SearchIndexableResource;
import com.android.internal.hardware.AmbientDisplayConfiguration;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.gestures.DoubleTapScreenPreferenceController;
import com.android.settings.gestures.PickupGesturePreferenceController;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -49,10 +48,10 @@
private static final String KEY_AMBIENT_DISPLAY_PICK_UP = "ambient_display_pick_up";
private static final String KEY_AMBIENT_DISPLAY_NOTIFICATION = "ambient_display_notification";
- private static List<PreferenceController> buildPreferenceControllers(Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Lifecycle lifecycle, AmbientDisplayConfiguration config,
MetricsFeatureProvider metricsFeatureProvider) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new AmbientDisplayNotificationsPreferenceController(context, config,
metricsFeatureProvider));
controllers.add(new AmbientDisplayAlwaysOnPreferenceController(context, config));
@@ -75,7 +74,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle(),
new AmbientDisplayConfiguration(context), mMetricsFeatureProvider);
}
@@ -99,7 +98,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null,
new AmbientDisplayConfiguration(context), null);
}
diff --git a/src/com/android/settings/display/AutoBrightnessPreferenceController.java b/src/com/android/settings/display/AutoBrightnessPreferenceController.java
index d4226e2..d1d347c 100644
--- a/src/com/android/settings/display/AutoBrightnessPreferenceController.java
+++ b/src/com/android/settings/display/AutoBrightnessPreferenceController.java
@@ -20,19 +20,20 @@
import android.support.v7.preference.Preference;
import com.android.settings.DisplaySettings;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.search.DatabaseIndexingUtils;
import com.android.settings.search.InlineSwitchPayload;
import com.android.settings.search.ResultPayload;
import com.android.settings.R;
+import com.android.settingslib.core.AbstractPreferenceController;
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE;
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
-public class AutoBrightnessPreferenceController extends PreferenceController implements
- Preference.OnPreferenceChangeListener {
+public class AutoBrightnessPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
private final String mAutoBrightnessKey;
diff --git a/src/com/android/settings/display/AutoRotatePreferenceController.java b/src/com/android/settings/display/AutoRotatePreferenceController.java
index a39cde5..c7f6af1 100644
--- a/src/com/android/settings/display/AutoRotatePreferenceController.java
+++ b/src/com/android/settings/display/AutoRotatePreferenceController.java
@@ -19,16 +19,18 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.internal.view.RotationPolicy;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
-public class AutoRotatePreferenceController extends PreferenceController implements
- Preference.OnPreferenceChangeListener, LifecycleObserver, OnResume, OnPause {
+public class AutoRotatePreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, Preference.OnPreferenceChangeListener, LifecycleObserver,
+ OnResume, OnPause {
private static final String KEY_AUTO_ROTATE = "auto_rotate";
private final MetricsFeatureProvider mMetricsFeatureProvider;
diff --git a/src/com/android/settings/display/BatteryPercentagePreferenceController.java b/src/com/android/settings/display/BatteryPercentagePreferenceController.java
index 4968957..4493158 100644
--- a/src/com/android/settings/display/BatteryPercentagePreferenceController.java
+++ b/src/com/android/settings/display/BatteryPercentagePreferenceController.java
@@ -20,7 +20,8 @@
import android.support.v7.preference.Preference;
import android.support.v14.preference.SwitchPreference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import static android.provider.Settings.System.SHOW_BATTERY_PERCENT;
@@ -28,8 +29,8 @@
* A controller to manage the switch for showing battery percentage in the status bar.
*/
-public class BatteryPercentagePreferenceController extends PreferenceController
- implements Preference.OnPreferenceChangeListener {
+public class BatteryPercentagePreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
private static final String KEY_BATTERY_PERCENTAGE = "battery_percentage";
diff --git a/src/com/android/settings/display/BrightnessLevelPreferenceController.java b/src/com/android/settings/display/BrightnessLevelPreferenceController.java
index 3436d2d..98e1e07 100644
--- a/src/com/android/settings/display/BrightnessLevelPreferenceController.java
+++ b/src/com/android/settings/display/BrightnessLevelPreferenceController.java
@@ -30,7 +30,8 @@
import android.support.v7.preference.PreferenceScreen;
import android.util.Log;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
@@ -38,8 +39,8 @@
import java.text.NumberFormat;
-public class BrightnessLevelPreferenceController extends PreferenceController implements
- LifecycleObserver, OnResume, OnPause {
+public class BrightnessLevelPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause {
private static final String TAG = "BrightnessPrefCtrl";
private static final String KEY_BRIGHTNESS = "brightness";
diff --git a/src/com/android/settings/display/CameraGesturePreferenceController.java b/src/com/android/settings/display/CameraGesturePreferenceController.java
index 1b60721..d991302 100644
--- a/src/com/android/settings/display/CameraGesturePreferenceController.java
+++ b/src/com/android/settings/display/CameraGesturePreferenceController.java
@@ -19,12 +19,13 @@
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import static android.provider.Settings.Secure.CAMERA_GESTURE_DISABLED;
-public class CameraGesturePreferenceController extends PreferenceController implements
- Preference.OnPreferenceChangeListener {
+public class CameraGesturePreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
private static final String KEY_CAMERA_GESTURE = "camera_gesture";
diff --git a/src/com/android/settings/display/ColorModePreferenceController.java b/src/com/android/settings/display/ColorModePreferenceController.java
index 9574016..2d669d0 100644
--- a/src/com/android/settings/display/ColorModePreferenceController.java
+++ b/src/com/android/settings/display/ColorModePreferenceController.java
@@ -23,10 +23,11 @@
import android.support.v7.preference.TwoStatePreference;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class ColorModePreferenceController extends PreferenceController implements
- Preference.OnPreferenceChangeListener {
+public class ColorModePreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
private static final String TAG = "ColorModePreference";
private static final String KEY_COLOR_MODE = "color_mode";
diff --git a/src/com/android/settings/display/FontSizePreferenceController.java b/src/com/android/settings/display/FontSizePreferenceController.java
index 7528f18..a8b4e9f 100644
--- a/src/com/android/settings/display/FontSizePreferenceController.java
+++ b/src/com/android/settings/display/FontSizePreferenceController.java
@@ -20,9 +20,11 @@
import com.android.settings.R;
import com.android.settings.accessibility.ToggleFontSizePreferenceFragment;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class FontSizePreferenceController extends PreferenceController {
+public class FontSizePreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_FONT_SIZE = "font_size";
diff --git a/src/com/android/settings/display/LiftToWakePreferenceController.java b/src/com/android/settings/display/LiftToWakePreferenceController.java
index e8be936..7c2206b 100644
--- a/src/com/android/settings/display/LiftToWakePreferenceController.java
+++ b/src/com/android/settings/display/LiftToWakePreferenceController.java
@@ -20,12 +20,13 @@
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import static android.provider.Settings.Secure.WAKE_GESTURE_ENABLED;
-public class LiftToWakePreferenceController extends PreferenceController implements
- Preference.OnPreferenceChangeListener {
+public class LiftToWakePreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
private static final String KEY_LIFT_TO_WAKE = "lift_to_wake";
diff --git a/src/com/android/settings/display/NightDisplayPreferenceController.java b/src/com/android/settings/display/NightDisplayPreferenceController.java
index 4b18778..f42e324 100644
--- a/src/com/android/settings/display/NightDisplayPreferenceController.java
+++ b/src/com/android/settings/display/NightDisplayPreferenceController.java
@@ -14,12 +14,13 @@
package com.android.settings.display;
import android.content.Context;
-import android.support.v7.preference.Preference;
import com.android.internal.app.NightDisplayController;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class NightDisplayPreferenceController extends PreferenceController {
+public class NightDisplayPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_NIGHT_DISPLAY = "night_display";
diff --git a/src/com/android/settings/display/NightModePreferenceController.java b/src/com/android/settings/display/NightModePreferenceController.java
index 2eb64c0..7e9701b 100644
--- a/src/com/android/settings/display/NightModePreferenceController.java
+++ b/src/com/android/settings/display/NightModePreferenceController.java
@@ -20,12 +20,13 @@
import android.support.v7.preference.PreferenceScreen;
import android.util.Log;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import static android.content.Context.UI_MODE_SERVICE;
-public class NightModePreferenceController extends PreferenceController
- implements Preference.OnPreferenceChangeListener {
+public class NightModePreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
private static final String TAG = "NightModePrefContr";
private static final String KEY_NIGHT_MODE = "night_mode";
diff --git a/src/com/android/settings/display/ScreenSaverPreferenceController.java b/src/com/android/settings/display/ScreenSaverPreferenceController.java
index 7a10802..6866f39 100644
--- a/src/com/android/settings/display/ScreenSaverPreferenceController.java
+++ b/src/com/android/settings/display/ScreenSaverPreferenceController.java
@@ -16,10 +16,12 @@
import android.content.Context;
import android.support.v7.preference.Preference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.dream.DreamSettings;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class ScreenSaverPreferenceController extends PreferenceController {
+public class ScreenSaverPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_SCREEN_SAVER = "screensaver";
diff --git a/src/com/android/settings/display/TapToWakePreferenceController.java b/src/com/android/settings/display/TapToWakePreferenceController.java
index 1f24d74..c5a387d 100644
--- a/src/com/android/settings/display/TapToWakePreferenceController.java
+++ b/src/com/android/settings/display/TapToWakePreferenceController.java
@@ -18,10 +18,11 @@
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class TapToWakePreferenceController extends PreferenceController implements
- Preference.OnPreferenceChangeListener {
+public class TapToWakePreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
private static final String KEY_TAP_TO_WAKE = "tap_to_wake";
diff --git a/src/com/android/settings/display/ThemePreferenceController.java b/src/com/android/settings/display/ThemePreferenceController.java
index c38ed28..3bb58b1 100644
--- a/src/com/android/settings/display/ThemePreferenceController.java
+++ b/src/com/android/settings/display/ThemePreferenceController.java
@@ -28,9 +28,10 @@
import android.text.TextUtils;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.core.AbstractPreferenceController;
import libcore.util.Objects;
@@ -39,8 +40,8 @@
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.ACTION_THEME;
-public class ThemePreferenceController extends PreferenceController implements
- Preference.OnPreferenceChangeListener {
+public class ThemePreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
private static final String KEY_THEME = "theme";
diff --git a/src/com/android/settings/display/TimeoutPreferenceController.java b/src/com/android/settings/display/TimeoutPreferenceController.java
index b2890c2..6b282ef 100644
--- a/src/com/android/settings/display/TimeoutPreferenceController.java
+++ b/src/com/android/settings/display/TimeoutPreferenceController.java
@@ -22,13 +22,14 @@
import com.android.settings.R;
import com.android.settings.TimeoutListPreference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.core.AbstractPreferenceController;
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
-public class TimeoutPreferenceController extends PreferenceController implements
- Preference.OnPreferenceChangeListener {
+public class TimeoutPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
private static final String TAG = "TimeoutPrefContr";
diff --git a/src/com/android/settings/display/VrDisplayPreferenceController.java b/src/com/android/settings/display/VrDisplayPreferenceController.java
index 4fef987..7fdb19f 100644
--- a/src/com/android/settings/display/VrDisplayPreferenceController.java
+++ b/src/com/android/settings/display/VrDisplayPreferenceController.java
@@ -20,9 +20,11 @@
import android.support.v7.preference.Preference;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class VrDisplayPreferenceController extends PreferenceController {
+public class VrDisplayPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_VR_DISPLAY_PREF = "vr_display_pref";
diff --git a/src/com/android/settings/display/WallpaperPreferenceController.java b/src/com/android/settings/display/WallpaperPreferenceController.java
index aa29afc..1c26440 100644
--- a/src/com/android/settings/display/WallpaperPreferenceController.java
+++ b/src/com/android/settings/display/WallpaperPreferenceController.java
@@ -17,13 +17,15 @@
import android.os.UserHandle;
import android.support.v7.preference.Preference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
import static android.os.UserManager.DISALLOW_SET_WALLPAPER;
-public class WallpaperPreferenceController extends PreferenceController {
+public class WallpaperPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_WALLPAPER = "wallpaper";
diff --git a/src/com/android/settings/dream/CurrentDreamPreferenceController.java b/src/com/android/settings/dream/CurrentDreamPreferenceController.java
index 5b448f8..86143dd 100644
--- a/src/com/android/settings/dream/CurrentDreamPreferenceController.java
+++ b/src/com/android/settings/dream/CurrentDreamPreferenceController.java
@@ -18,13 +18,15 @@
import android.content.Context;
import android.support.v7.preference.Preference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.widget.GearPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.dream.DreamBackend;
import com.android.settingslib.dream.DreamBackend.DreamInfo;
import java.util.Optional;
-public class CurrentDreamPreferenceController extends PreferenceController {
+public class CurrentDreamPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private final DreamBackend mBackend;
private final static String TAG = "CurrentDreamPreferenceController";
private final static String CURRENT_SCREENSAVER = "current_screensaver";
diff --git a/src/com/android/settings/dream/DreamSettings.java b/src/com/android/settings/dream/DreamSettings.java
index 8c10d45..94ec149 100644
--- a/src/com/android/settings/dream/DreamSettings.java
+++ b/src/com/android/settings/dream/DreamSettings.java
@@ -16,15 +16,20 @@
package com.android.settings.dream;
+import static com.android.settingslib.dream.DreamBackend.EITHER;
+import static com.android.settingslib.dream.DreamBackend.NEVER;
+import static com.android.settingslib.dream.DreamBackend.WHILE_CHARGING;
+import static com.android.settingslib.dream.DreamBackend.WHILE_DOCKED;
+
import android.content.Context;
import android.provider.SearchIndexableResource;
import android.support.annotation.VisibleForTesting;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.dream.DreamBackend;
import com.android.settingslib.dream.DreamBackend.WhenToDream;
@@ -32,11 +37,6 @@
import java.util.Arrays;
import java.util.List;
-import static com.android.settingslib.dream.DreamBackend.EITHER;
-import static com.android.settingslib.dream.DreamBackend.NEVER;
-import static com.android.settingslib.dream.DreamBackend.WHILE_CHARGING;
-import static com.android.settingslib.dream.DreamBackend.WHILE_DOCKED;
-
public class DreamSettings extends DashboardFragment {
private static final String TAG = "DreamSettings";
@@ -109,7 +109,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context);
}
@@ -127,8 +127,8 @@
}
}
- private static List<PreferenceController> buildPreferenceControllers(Context context) {
- List<PreferenceController> controllers = new ArrayList<>();
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
+ List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new CurrentDreamPreferenceController(context));
controllers.add(new WhenToDreamPreferenceController(context));
controllers.add(new StartNowPreferenceController(context));
@@ -146,7 +146,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context);
}
};
diff --git a/src/com/android/settings/dream/StartNowPreferenceController.java b/src/com/android/settings/dream/StartNowPreferenceController.java
index 994b70b..256961b 100644
--- a/src/com/android/settings/dream/StartNowPreferenceController.java
+++ b/src/com/android/settings/dream/StartNowPreferenceController.java
@@ -22,10 +22,12 @@
import android.widget.Button;
import com.android.settings.R;
import com.android.settings.applications.LayoutPreference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.dream.DreamBackend;
-public class StartNowPreferenceController extends PreferenceController {
+public class StartNowPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String TAG = "StartNowPreferenceController";
private static final String PREF_KEY = "dream_start_now_button_container";
private final DreamBackend mBackend;
diff --git a/src/com/android/settings/dream/WhenToDreamPreferenceController.java b/src/com/android/settings/dream/WhenToDreamPreferenceController.java
index 0d870fd..c4c6ed8 100644
--- a/src/com/android/settings/dream/WhenToDreamPreferenceController.java
+++ b/src/com/android/settings/dream/WhenToDreamPreferenceController.java
@@ -18,10 +18,12 @@
import android.content.Context;
import android.support.v7.preference.Preference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.dream.DreamBackend;
-public class WhenToDreamPreferenceController extends PreferenceController {
+public class WhenToDreamPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String WHEN_TO_START = "when_to_start";
private final DreamBackend mBackend;
diff --git a/src/com/android/settings/enterprise/AdminActionPreferenceControllerBase.java b/src/com/android/settings/enterprise/AdminActionPreferenceControllerBase.java
index f6bd4c1..05e9519 100644
--- a/src/com/android/settings/enterprise/AdminActionPreferenceControllerBase.java
+++ b/src/com/android/settings/enterprise/AdminActionPreferenceControllerBase.java
@@ -19,12 +19,14 @@
import android.text.format.DateUtils;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.Date;
-public abstract class AdminActionPreferenceControllerBase extends PreferenceController {
+public abstract class AdminActionPreferenceControllerBase extends
+ AbstractPreferenceController implements PreferenceControllerMixin {
protected final EnterprisePrivacyFeatureProvider mFeatureProvider;
diff --git a/src/com/android/settings/enterprise/ApplicationListFragment.java b/src/com/android/settings/enterprise/ApplicationListFragment.java
index ff68a8b..7425a30 100644
--- a/src/com/android/settings/enterprise/ApplicationListFragment.java
+++ b/src/com/android/settings/enterprise/ApplicationListFragment.java
@@ -22,9 +22,9 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.applications.ApplicationFeatureProvider;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
import java.util.List;
@@ -49,8 +49,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- final List controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
ApplicationListPreferenceController controller = new ApplicationListPreferenceController(
context, this, context.getPackageManager(), this);
controllers.add(controller);
diff --git a/src/com/android/settings/enterprise/ApplicationListPreferenceController.java b/src/com/android/settings/enterprise/ApplicationListPreferenceController.java
index f9fefa1..eee9b33 100644
--- a/src/com/android/settings/enterprise/ApplicationListPreferenceController.java
+++ b/src/com/android/settings/enterprise/ApplicationListPreferenceController.java
@@ -25,7 +25,8 @@
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.applications.ApplicationFeatureProvider;
import com.android.settings.applications.UserAppInfo;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.List;
@@ -33,8 +34,8 @@
* PreferenceController that builds a dynamic list of applications provided by
* {@link ApplicationListBuilder} instance.
*/
-public class ApplicationListPreferenceController extends PreferenceController
- implements ApplicationFeatureProvider.ListOfAppsCallback {
+public class ApplicationListPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, ApplicationFeatureProvider.ListOfAppsCallback {
private final PackageManager mPm;
private SettingsPreferenceFragment mParent;
diff --git a/src/com/android/settings/enterprise/EnterprisePrivacySettings.java b/src/com/android/settings/enterprise/EnterprisePrivacySettings.java
index 54f0508..faf271e 100644
--- a/src/com/android/settings/enterprise/EnterprisePrivacySettings.java
+++ b/src/com/android/settings/enterprise/EnterprisePrivacySettings.java
@@ -21,10 +21,11 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.DynamicAvailabilityPreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -51,17 +52,18 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle(), true /* async */);
}
- private static List<PreferenceController> buildPreferenceControllers(Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Lifecycle lifecycle, boolean async) {
- final List controllers = new ArrayList<PreferenceController>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new NetworkLogsPreferenceController(context));
controllers.add(new BugReportsPreferenceController(context));
controllers.add(new SecurityLogsPreferenceController(context));
- final List exposureChangesCategoryControllers = new ArrayList<PreferenceController>();
+ final List<DynamicAvailabilityPreferenceController> exposureChangesCategoryControllers =
+ new ArrayList<>();
exposureChangesCategoryControllers.add(new EnterpriseInstalledPackagesPreferenceController(
context, lifecycle, async));
exposureChangesCategoryControllers.add(
@@ -112,7 +114,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */, false /* async */);
}
};
diff --git a/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragment.java b/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragment.java
index 6f173f1..a1c61de 100644
--- a/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragment.java
+++ b/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragment.java
@@ -20,8 +20,8 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
import java.util.List;
@@ -48,8 +48,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- final List controllers = new ArrayList<PreferenceController>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
final EnterpriseSetDefaultAppsListPreferenceController controller =
new EnterpriseSetDefaultAppsListPreferenceController(
context, this, context.getPackageManager());
diff --git a/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListPreferenceController.java b/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListPreferenceController.java
index 51b60b8..03a78ea 100644
--- a/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListPreferenceController.java
+++ b/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListPreferenceController.java
@@ -32,9 +32,10 @@
import com.android.settings.applications.ApplicationFeatureProvider;
import com.android.settings.applications.EnterpriseDefaultApps;
import com.android.settings.applications.UserAppInfo;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.users.UserFeatureProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
import java.util.Collections;
@@ -45,7 +46,8 @@
/**
* PreferenceController that builds a dynamic list of default apps set by device or profile owner.
*/
-public class EnterpriseSetDefaultAppsListPreferenceController extends PreferenceController {
+public class EnterpriseSetDefaultAppsListPreferenceController extends
+ AbstractPreferenceController implements PreferenceControllerMixin {
private final PackageManager mPm;
private final SettingsPreferenceFragment mParent;
private final ApplicationFeatureProvider mApplicationFeatureProvider;
diff --git a/src/com/android/settings/enterprise/ManageDeviceAdminPreferenceController.java b/src/com/android/settings/enterprise/ManageDeviceAdminPreferenceController.java
index 6317afe..6f35641 100644
--- a/src/com/android/settings/enterprise/ManageDeviceAdminPreferenceController.java
+++ b/src/com/android/settings/enterprise/ManageDeviceAdminPreferenceController.java
@@ -14,14 +14,15 @@
package com.android.settings.enterprise;
import android.content.Context;
-import android.content.res.Resources;
import android.support.v7.preference.Preference;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class ManageDeviceAdminPreferenceController extends PreferenceController {
+public class ManageDeviceAdminPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
private static final String KEY_MANAGE_DEVICE_ADMIN = "manage_device_admin";
private final EnterprisePrivacyFeatureProvider mFeatureProvider;
diff --git a/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
index 0b1d4a8..eb5d75f 100644
--- a/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
+++ b/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
@@ -41,7 +41,6 @@
import com.android.settings.SettingsActivity;
import com.android.settings.Utils;
import com.android.settings.applications.LayoutPreference;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.enterprise.DevicePolicyManagerWrapper;
import com.android.settings.enterprise.DevicePolicyManagerWrapperImpl;
@@ -52,6 +51,7 @@
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.applications.AppUtils;
import com.android.settingslib.applications.ApplicationsState;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
import java.util.List;
@@ -288,8 +288,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
final Bundle bundle = getArguments();
final int uid = bundle.getInt(EXTRA_UID, 0);
final String packageName = bundle.getString(EXTRA_PACKAGE_NAME);
diff --git a/src/com/android/settings/fuelgauge/AppButtonsPreferenceController.java b/src/com/android/settings/fuelgauge/AppButtonsPreferenceController.java
index 6b4c8a9..1647aa5 100644
--- a/src/com/android/settings/fuelgauge/AppButtonsPreferenceController.java
+++ b/src/com/android/settings/fuelgauge/AppButtonsPreferenceController.java
@@ -50,13 +50,14 @@
import com.android.settings.SettingsActivity;
import com.android.settings.Utils;
import com.android.settings.applications.LayoutPreference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.enterprise.DevicePolicyManagerWrapper;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.applications.AppUtils;
import com.android.settingslib.applications.ApplicationsState;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnDestroy;
@@ -76,9 +77,9 @@
* {@link #handleActivityResult(int, int, Intent)} in this controller.
*/
//TODO(b/35810915): Make InstalledAppDetails use this controller
-public class AppButtonsPreferenceController extends PreferenceController implements
- LifecycleObserver, OnResume, OnPause, OnDestroy, View.OnClickListener,
- ApplicationsState.Callbacks {
+public class AppButtonsPreferenceController extends AbstractPreferenceController implements
+ PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause, OnDestroy,
+ View.OnClickListener, ApplicationsState.Callbacks {
public static final String APP_CHG = "chg";
private static final String TAG = "AppButtonsPrefCtl";
diff --git a/src/com/android/settings/fuelgauge/BackgroundActivityPreferenceController.java b/src/com/android/settings/fuelgauge/BackgroundActivityPreferenceController.java
index 60a94dd..89089e5 100644
--- a/src/com/android/settings/fuelgauge/BackgroundActivityPreferenceController.java
+++ b/src/com/android/settings/fuelgauge/BackgroundActivityPreferenceController.java
@@ -25,13 +25,14 @@
import android.util.Log;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
/**
* Controller to control whether an app can run in the background
*/
-public class BackgroundActivityPreferenceController extends PreferenceController implements
- Preference.OnPreferenceChangeListener {
+public class BackgroundActivityPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
private static final String TAG = "BgActivityPrefContr";
private static final String KEY_BACKGROUND_ACTIVITY = "background_activity";
diff --git a/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java b/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java
index bdd2413..4a342ab 100644
--- a/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java
+++ b/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceController.java
@@ -28,9 +28,10 @@
import com.android.settings.R;
import com.android.settings.applications.LayoutPreference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.Utils;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
@@ -38,8 +39,8 @@
/**
* Controller that update the battery header view
*/
-public class BatteryHeaderPreferenceController extends PreferenceController
- implements LifecycleObserver, OnStart {
+public class BatteryHeaderPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnStart {
@VisibleForTesting
static final String KEY_BATTERY_HEADER = "battery_header";
diff --git a/src/com/android/settings/fuelgauge/BatteryOptimizationPreferenceController.java b/src/com/android/settings/fuelgauge/BatteryOptimizationPreferenceController.java
index 7c5bda2..53a3770 100644
--- a/src/com/android/settings/fuelgauge/BatteryOptimizationPreferenceController.java
+++ b/src/com/android/settings/fuelgauge/BatteryOptimizationPreferenceController.java
@@ -15,22 +15,22 @@
package com.android.settings.fuelgauge;
import android.app.Fragment;
-import android.content.Context;
import android.os.Bundle;
import android.support.annotation.VisibleForTesting;
import android.support.v7.preference.Preference;
-import android.text.TextUtils;
import com.android.settings.R;
import com.android.settings.Settings;
import com.android.settings.SettingsActivity;
import com.android.settings.applications.ManageApplications;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
/**
* Controller that jumps to high power optimization fragment
*/
-public class BatteryOptimizationPreferenceController extends PreferenceController {
+public class BatteryOptimizationPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_BACKGROUND_ACTIVITY = "battery_optimization";
diff --git a/src/com/android/settings/fuelgauge/BatterySaverController.java b/src/com/android/settings/fuelgauge/BatterySaverController.java
index 5d64f1c..97e95d2 100644
--- a/src/com/android/settings/fuelgauge/BatterySaverController.java
+++ b/src/com/android/settings/fuelgauge/BatterySaverController.java
@@ -30,10 +30,11 @@
import android.util.Log;
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.dashboard.conditional.BatterySaverCondition;
import com.android.settings.dashboard.conditional.ConditionManager;
import com.android.settings.widget.MasterSwitchPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
@@ -41,8 +42,9 @@
import static android.os.PowerManager.ACTION_POWER_SAVE_MODE_CHANGING;
-public class BatterySaverController extends PreferenceController implements
- Preference.OnPreferenceChangeListener, LifecycleObserver, OnStart, OnStop {
+public class BatterySaverController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
+ LifecycleObserver, OnStart, OnStop {
private static final String KEY_BATTERY_SAVER = "battery_saver_summary";
private static final String TAG = "BatterySaverController";
private static final boolean DEBUG = false;
diff --git a/src/com/android/settings/fuelgauge/PowerUsageAdvanced.java b/src/com/android/settings/fuelgauge/PowerUsageAdvanced.java
index fc83bed..fe6e509 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageAdvanced.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageAdvanced.java
@@ -37,10 +37,10 @@
import com.android.internal.os.BatteryStatsHelper;
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
import com.android.settings.fuelgauge.PowerUsageAdvanced.PowerUsageData.UsageType;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -158,7 +158,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return null;
}
diff --git a/src/com/android/settings/fuelgauge/PowerUsageAnomalyDetails.java b/src/com/android/settings/fuelgauge/PowerUsageAnomalyDetails.java
index ef7110e..bf4c2af 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageAnomalyDetails.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageAnomalyDetails.java
@@ -31,11 +31,11 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.fuelgauge.anomaly.Anomaly;
import com.android.settings.fuelgauge.anomaly.AnomalyDialogFragment;
import com.android.settings.fuelgauge.anomaly.AnomalyPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.List;
@@ -119,7 +119,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return null;
}
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index e4ae053..a8b35ee 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -46,6 +46,7 @@
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.widget.TextView;
+
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.os.BatterySipper;
import com.android.internal.os.BatterySipper.DrainType;
@@ -56,7 +57,6 @@
import com.android.settings.Utils;
import com.android.settings.applications.LayoutPreference;
import com.android.settings.applications.ManageApplications;
-import com.android.settings.core.PreferenceController;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.display.AutoBrightnessPreferenceController;
@@ -69,6 +69,8 @@
import com.android.settings.fuelgauge.anomaly.AnomalySummaryPreferenceController;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -304,8 +306,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
mBatteryHeaderPreferenceController = new BatteryHeaderPreferenceController(
context, getActivity(), this /* host */, getLifecycle());
controllers.add(mBatteryHeaderPreferenceController);
diff --git a/src/com/android/settings/gestures/AssistGestureFeatureProvider.java b/src/com/android/settings/gestures/AssistGestureFeatureProvider.java
index 8902393..3016143 100644
--- a/src/com/android/settings/gestures/AssistGestureFeatureProvider.java
+++ b/src/com/android/settings/gestures/AssistGestureFeatureProvider.java
@@ -18,7 +18,7 @@
import android.content.Context;
-import com.android.settings.core.PreferenceController;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.List;
@@ -36,6 +36,6 @@
int getPreferenceResourceId();
/** Returns a list of additional preference controllers */
- List<PreferenceController> getControllers(Context context, Lifecycle lifecycle);
+ List<AbstractPreferenceController> getControllers(Context context, Lifecycle lifecycle);
}
diff --git a/src/com/android/settings/gestures/AssistGestureFeatureProviderImpl.java b/src/com/android/settings/gestures/AssistGestureFeatureProviderImpl.java
index a2579ac..87cba61 100644
--- a/src/com/android/settings/gestures/AssistGestureFeatureProviderImpl.java
+++ b/src/com/android/settings/gestures/AssistGestureFeatureProviderImpl.java
@@ -19,7 +19,7 @@
import android.content.Context;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -43,7 +43,7 @@
}
@Override
- public List<PreferenceController> getControllers(Context context, Lifecycle lifecycle) {
+ public List<AbstractPreferenceController> getControllers(Context context, Lifecycle lifecycle) {
return new ArrayList<>();
}
diff --git a/src/com/android/settings/gestures/AssistGestureSettings.java b/src/com/android/settings/gestures/AssistGestureSettings.java
index 93d3a39..77b4ded 100644
--- a/src/com/android/settings/gestures/AssistGestureSettings.java
+++ b/src/com/android/settings/gestures/AssistGestureSettings.java
@@ -21,10 +21,10 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -54,13 +54,13 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle());
}
- private static List<PreferenceController> buildPreferenceControllers(Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Lifecycle lifecycle) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new AssistGesturePreferenceController(context, lifecycle, KEY_ASSIST));
controllers.addAll(FeatureFactory.getFactory(context).getAssistGestureFeatureProvider()
.getControllers(context, lifecycle));
@@ -79,7 +79,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
diff --git a/src/com/android/settings/gestures/CameraLiftTriggerSettings.java b/src/com/android/settings/gestures/CameraLiftTriggerSettings.java
index a222b0b..d31aee6 100644
--- a/src/com/android/settings/gestures/CameraLiftTriggerSettings.java
+++ b/src/com/android/settings/gestures/CameraLiftTriggerSettings.java
@@ -21,9 +21,9 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -51,13 +51,13 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle());
}
- private static List<PreferenceController> buildPreferenceControllers(Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Lifecycle lifecycle) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new CameraLiftTriggerPreferenceController(context, lifecycle, KEY));
return controllers;
}
@@ -73,7 +73,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
diff --git a/src/com/android/settings/gestures/DoubleTapPowerSettings.java b/src/com/android/settings/gestures/DoubleTapPowerSettings.java
index d38292d..cb90c51 100644
--- a/src/com/android/settings/gestures/DoubleTapPowerSettings.java
+++ b/src/com/android/settings/gestures/DoubleTapPowerSettings.java
@@ -21,9 +21,9 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -51,13 +51,13 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle());
}
- private static List<PreferenceController> buildPreferenceControllers(Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Lifecycle lifecycle) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new DoubleTapPowerPreferenceController(context, lifecycle,
KEY_DOUBLE_TAP_POWER));
return controllers;
@@ -74,7 +74,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
diff --git a/src/com/android/settings/gestures/DoubleTapScreenSettings.java b/src/com/android/settings/gestures/DoubleTapScreenSettings.java
index 4690ead..3acbb3d 100644
--- a/src/com/android/settings/gestures/DoubleTapScreenSettings.java
+++ b/src/com/android/settings/gestures/DoubleTapScreenSettings.java
@@ -23,9 +23,9 @@
import com.android.internal.hardware.AmbientDisplayConfiguration;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -58,13 +58,13 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle());
}
- private static List<PreferenceController> buildPreferenceControllers(Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Lifecycle lifecycle) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new DoubleTapScreenPreferenceController(context, lifecycle,
new AmbientDisplayConfiguration(context), UserHandle.myUserId(),
KEY_DOUBLE_TAP_SCREEN));
@@ -82,7 +82,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
diff --git a/src/com/android/settings/gestures/DoubleTwistGestureSettings.java b/src/com/android/settings/gestures/DoubleTwistGestureSettings.java
index 2b46cce..bfd0310 100644
--- a/src/com/android/settings/gestures/DoubleTwistGestureSettings.java
+++ b/src/com/android/settings/gestures/DoubleTwistGestureSettings.java
@@ -21,9 +21,9 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -51,13 +51,13 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle());
}
- private static List<PreferenceController> buildPreferenceControllers(Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Lifecycle lifecycle) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new DoubleTwistPreferenceController(context, lifecycle, KEY_DOUBLE_TWIST));
return controllers;
}
@@ -73,7 +73,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
diff --git a/src/com/android/settings/gestures/GesturePreferenceController.java b/src/com/android/settings/gestures/GesturePreferenceController.java
index e647bf3..df61234 100644
--- a/src/com/android/settings/gestures/GesturePreferenceController.java
+++ b/src/com/android/settings/gestures/GesturePreferenceController.java
@@ -22,15 +22,17 @@
import android.support.v7.preference.TwoStatePreference;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.widget.VideoPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
-public abstract class GesturePreferenceController extends PreferenceController
- implements Preference.OnPreferenceChangeListener, LifecycleObserver, OnStart, OnStop {
+public abstract class GesturePreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
+ LifecycleObserver, OnStart, OnStop {
private VideoPreference mVideoPreference;
diff --git a/src/com/android/settings/gestures/PickupGestureSettings.java b/src/com/android/settings/gestures/PickupGestureSettings.java
index 17d930f..12ed846 100644
--- a/src/com/android/settings/gestures/PickupGestureSettings.java
+++ b/src/com/android/settings/gestures/PickupGestureSettings.java
@@ -23,9 +23,9 @@
import com.android.internal.hardware.AmbientDisplayConfiguration;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -58,13 +58,13 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle());
}
- private static List<PreferenceController> buildPreferenceControllers(Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Lifecycle lifecycle) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new PickupGesturePreferenceController(context, lifecycle,
new AmbientDisplayConfiguration(context), UserHandle.myUserId(), KEY_PICK_UP));
return controllers;
@@ -81,7 +81,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
diff --git a/src/com/android/settings/gestures/SwipeToNotificationSettings.java b/src/com/android/settings/gestures/SwipeToNotificationSettings.java
index 00d4700..08ed026 100644
--- a/src/com/android/settings/gestures/SwipeToNotificationSettings.java
+++ b/src/com/android/settings/gestures/SwipeToNotificationSettings.java
@@ -21,9 +21,9 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -52,13 +52,13 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle());
}
- private static List<PreferenceController> buildPreferenceControllers(Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Lifecycle lifecycle) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new SwipeToNotificationPreferenceController(context, lifecycle, KEY));
return controllers;
}
@@ -74,7 +74,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
diff --git a/src/com/android/settings/inputmethod/GameControllerPreferenceController.java b/src/com/android/settings/inputmethod/GameControllerPreferenceController.java
index 40efb07..f7bc143 100644
--- a/src/com/android/settings/inputmethod/GameControllerPreferenceController.java
+++ b/src/com/android/settings/inputmethod/GameControllerPreferenceController.java
@@ -25,13 +25,15 @@
import android.text.TextUtils;
import android.view.InputDevice;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
-public class GameControllerPreferenceController extends PreferenceController
- implements InputManager.InputDeviceListener, LifecycleObserver, OnResume, OnPause {
+public class GameControllerPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, InputManager.InputDeviceListener, LifecycleObserver,
+ OnResume, OnPause {
public static final String PREF_KEY = "vibrate_input_devices";
private static final String CATEGORY_KEY = "game_controller_settings_category";
diff --git a/src/com/android/settings/inputmethod/PhysicalKeyboardPreferenceController.java b/src/com/android/settings/inputmethod/PhysicalKeyboardPreferenceController.java
index 03d8221..7b0d1ce 100644
--- a/src/com/android/settings/inputmethod/PhysicalKeyboardPreferenceController.java
+++ b/src/com/android/settings/inputmethod/PhysicalKeyboardPreferenceController.java
@@ -21,8 +21,9 @@
import android.support.v7.preference.Preference;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.inputmethod.PhysicalKeyboardFragment.HardKeyboardDeviceInfo;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
@@ -30,8 +31,9 @@
import java.util.List;
-public class PhysicalKeyboardPreferenceController extends PreferenceController implements
- LifecycleObserver, OnResume, OnPause, InputManager.InputDeviceListener {
+public class PhysicalKeyboardPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause,
+ InputManager.InputDeviceListener {
private final InputManager mIm;
diff --git a/src/com/android/settings/inputmethod/SpellCheckerPreferenceController.java b/src/com/android/settings/inputmethod/SpellCheckerPreferenceController.java
index 5ab2cba..270aaba 100644
--- a/src/com/android/settings/inputmethod/SpellCheckerPreferenceController.java
+++ b/src/com/android/settings/inputmethod/SpellCheckerPreferenceController.java
@@ -23,10 +23,12 @@
import android.view.textservice.TextServicesManager;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.inputmethod.InputMethodAndSubtypeUtil;
-public class SpellCheckerPreferenceController extends PreferenceController {
+public class SpellCheckerPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
public static final String KEY_SPELL_CHECKERS = "spellcheckers_settings";
diff --git a/src/com/android/settings/inputmethod/VirtualKeyboardPreferenceController.java b/src/com/android/settings/inputmethod/VirtualKeyboardPreferenceController.java
index 5436901..c3443d2 100644
--- a/src/com/android/settings/inputmethod/VirtualKeyboardPreferenceController.java
+++ b/src/com/android/settings/inputmethod/VirtualKeyboardPreferenceController.java
@@ -25,12 +25,14 @@
import android.view.inputmethod.InputMethodManager;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
import java.util.List;
-public class VirtualKeyboardPreferenceController extends PreferenceController {
+public class VirtualKeyboardPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private final InputMethodManager mImm;
private final DevicePolicyManager mDpm;
diff --git a/src/com/android/settings/language/LanguageAndInputSettings.java b/src/com/android/settings/language/LanguageAndInputSettings.java
index 8bba103..9db58ed 100644
--- a/src/com/android/settings/language/LanguageAndInputSettings.java
+++ b/src/com/android/settings/language/LanguageAndInputSettings.java
@@ -35,7 +35,6 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.applications.defaultapps.DefaultAutofillPreferenceController;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.gestures.AssistGestureFeatureProvider;
@@ -52,6 +51,7 @@
import com.android.settings.inputmethod.VirtualKeyboardPreferenceController;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -109,7 +109,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
if (mAmbientDisplayConfig == null) {
mAmbientDisplayConfig = new AmbientDisplayConfiguration(context);
}
@@ -117,10 +117,10 @@
return buildPreferenceControllers(context, getLifecycle(), mAmbientDisplayConfig);
}
- private static List<PreferenceController> buildPreferenceControllers(@NonNull Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(@NonNull Context context,
@Nullable Lifecycle lifecycle,
@NonNull AmbientDisplayConfiguration ambientDisplayConfiguration) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
// Language
controllers.add(new PhoneLanguagePreferenceController(context));
controllers.add(new SpellCheckerPreferenceController(context));
@@ -216,7 +216,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null,
new AmbientDisplayConfiguration(context));
}
diff --git a/src/com/android/settings/language/PhoneLanguagePreferenceController.java b/src/com/android/settings/language/PhoneLanguagePreferenceController.java
index cd2f539..11c3e03 100644
--- a/src/com/android/settings/language/PhoneLanguagePreferenceController.java
+++ b/src/com/android/settings/language/PhoneLanguagePreferenceController.java
@@ -19,10 +19,12 @@
import android.content.Context;
import android.support.v7.preference.Preference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class PhoneLanguagePreferenceController extends PreferenceController {
+public class PhoneLanguagePreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_PHONE_LANGUAGE = "phone_language";
diff --git a/src/com/android/settings/language/TtsPreferenceController.java b/src/com/android/settings/language/TtsPreferenceController.java
index a734e4b..ef26d5f 100644
--- a/src/com/android/settings/language/TtsPreferenceController.java
+++ b/src/com/android/settings/language/TtsPreferenceController.java
@@ -19,9 +19,11 @@
import android.content.Context;
import android.speech.tts.TtsEngines;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class TtsPreferenceController extends PreferenceController {
+public class TtsPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_VOICE_CATEGORY = "voice_category";
private static final String KEY_TTS_SETTINGS = "tts_settings_summary";
diff --git a/src/com/android/settings/language/UserDictionaryPreferenceController.java b/src/com/android/settings/language/UserDictionaryPreferenceController.java
index 01ce3aa..7d9a6ef 100644
--- a/src/com/android/settings/language/UserDictionaryPreferenceController.java
+++ b/src/com/android/settings/language/UserDictionaryPreferenceController.java
@@ -22,12 +22,14 @@
import android.support.v7.preference.Preference;
import com.android.settings.UserDictionarySettings;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.inputmethod.UserDictionaryList;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.TreeSet;
-public class UserDictionaryPreferenceController extends PreferenceController {
+public class UserDictionaryPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_USER_DICTIONARY_SETTINGS = "key_user_dictionary_settings";
diff --git a/src/com/android/settings/location/AppLocationPermissionPreferenceController.java b/src/com/android/settings/location/AppLocationPermissionPreferenceController.java
index d91b47b..75c9e2f 100644
--- a/src/com/android/settings/location/AppLocationPermissionPreferenceController.java
+++ b/src/com/android/settings/location/AppLocationPermissionPreferenceController.java
@@ -1,14 +1,15 @@
package com.android.settings.location;
import android.content.Context;
-import android.content.Intent;
import android.provider.Settings;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class AppLocationPermissionPreferenceController extends PreferenceController {
+public class AppLocationPermissionPreferenceController extends
+ AbstractPreferenceController implements PreferenceControllerMixin {
private static final String KEY_APP_LEVEL_PERMISSIONS = "app_level_permissions";
private Preference mPreference;
diff --git a/src/com/android/settings/location/LocationPreferenceController.java b/src/com/android/settings/location/LocationPreferenceController.java
index e4d4ca0..d4d939c 100644
--- a/src/com/android/settings/location/LocationPreferenceController.java
+++ b/src/com/android/settings/location/LocationPreferenceController.java
@@ -25,14 +25,15 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
-public class LocationPreferenceController extends PreferenceController implements
- LifecycleObserver, OnResume, OnPause {
+public class LocationPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause {
private static final String KEY_LOCATION = "location";
private Context mContext;
diff --git a/src/com/android/settings/network/AirplaneModePreferenceController.java b/src/com/android/settings/network/AirplaneModePreferenceController.java
index 8422ab4..16f32eb 100644
--- a/src/com/android/settings/network/AirplaneModePreferenceController.java
+++ b/src/com/android/settings/network/AirplaneModePreferenceController.java
@@ -27,15 +27,16 @@
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.TelephonyProperties;
import com.android.settings.AirplaneModeEnabler;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
-public class AirplaneModePreferenceController extends PreferenceController
- implements LifecycleObserver, OnResume, OnPause {
+public class AirplaneModePreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause {
public static final int REQUEST_CODE_EXIT_ECM = 1;
diff --git a/src/com/android/settings/network/MobileNetworkPreferenceController.java b/src/com/android/settings/network/MobileNetworkPreferenceController.java
index b91552e..d95205f 100644
--- a/src/com/android/settings/network/MobileNetworkPreferenceController.java
+++ b/src/com/android/settings/network/MobileNetworkPreferenceController.java
@@ -25,7 +25,8 @@
import android.telephony.TelephonyManager;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
@@ -34,8 +35,8 @@
import static android.os.UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS;
import static com.android.settingslib.RestrictedLockUtils.hasBaseUserRestriction;
-public class MobileNetworkPreferenceController extends PreferenceController implements
- LifecycleObserver, OnResume, OnPause {
+public class MobileNetworkPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause {
private static final String KEY_MOBILE_NETWORK_SETTINGS = "mobile_network_settings";
diff --git a/src/com/android/settings/network/MobilePlanPreferenceController.java b/src/com/android/settings/network/MobilePlanPreferenceController.java
index da4902d..d5ff924 100644
--- a/src/com/android/settings/network/MobilePlanPreferenceController.java
+++ b/src/com/android/settings/network/MobilePlanPreferenceController.java
@@ -31,7 +31,8 @@
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnCreate;
import com.android.settingslib.core.lifecycle.events.OnSaveInstanceState;
@@ -45,8 +46,8 @@
import static com.android.settingslib.RestrictedLockUtils.hasBaseUserRestriction;
-public class MobilePlanPreferenceController extends PreferenceController implements
- LifecycleObserver, OnCreate, OnSaveInstanceState {
+public class MobilePlanPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnCreate, OnSaveInstanceState {
public interface MobilePlanPreferenceHost {
void showMobilePlanMessageDialog();
diff --git a/src/com/android/settings/network/NetworkDashboardFragment.java b/src/com/android/settings/network/NetworkDashboardFragment.java
index 35de1bb..9d70760 100644
--- a/src/com/android/settings/network/NetworkDashboardFragment.java
+++ b/src/com/android/settings/network/NetworkDashboardFragment.java
@@ -15,6 +15,9 @@
*/
package com.android.settings.network;
+import static com.android.settings.network.MobilePlanPreferenceController
+ .MANAGE_MOBILE_PLAN_DIALOG_ID;
+
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -27,20 +30,17 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.wifi.WifiMasterSwitchPreferenceController;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import static com.android.settings.network.MobilePlanPreferenceController
- .MANAGE_MOBILE_PLAN_DIALOG_ID;
-
public class NetworkDashboardFragment extends DashboardFragment implements
MobilePlanPreferenceController.MobilePlanPreferenceHost {
@@ -81,7 +81,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
final AirplaneModePreferenceController airplaneModePreferenceController =
new AirplaneModePreferenceController(context, this /* fragment */);
final MobilePlanPreferenceController mobilePlanPreferenceController =
@@ -99,7 +99,7 @@
lifecycle.addObserver(mobileNetworkPreferenceController);
lifecycle.addObserver(vpnPreferenceController);
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(airplaneModePreferenceController);
controllers.add(mobileNetworkPreferenceController);
controllers.add(new TetherPreferenceController(context, lifecycle));
diff --git a/src/com/android/settings/network/NetworkResetPreferenceController.java b/src/com/android/settings/network/NetworkResetPreferenceController.java
index d8f3217..58a5383 100644
--- a/src/com/android/settings/network/NetworkResetPreferenceController.java
+++ b/src/com/android/settings/network/NetworkResetPreferenceController.java
@@ -18,9 +18,11 @@
import android.content.Context;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class NetworkResetPreferenceController extends PreferenceController {
+public class NetworkResetPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private final NetworkResetRestrictionChecker mRestrictionChecker;
diff --git a/src/com/android/settings/network/NetworkScorerPickerPreferenceController.java b/src/com/android/settings/network/NetworkScorerPickerPreferenceController.java
index 3e481a8..8d4ea63 100644
--- a/src/com/android/settings/network/NetworkScorerPickerPreferenceController.java
+++ b/src/com/android/settings/network/NetworkScorerPickerPreferenceController.java
@@ -20,15 +20,17 @@
import android.support.v7.preference.Preference;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.List;
/**
- * {@link PreferenceController} that shows the active network scorer and toggles the preference
- * based on whether or not there are valid scorers installed.
+ * {@link AbstractPreferenceController} that shows the active network scorer and toggles the
+ * preference based on whether or not there are valid scorers installed.
*/
-public class NetworkScorerPickerPreferenceController extends PreferenceController {
+public class NetworkScorerPickerPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_NETWORK_SCORER_PICKER = "network_scorer_picker";
diff --git a/src/com/android/settings/network/ProxyPreferenceController.java b/src/com/android/settings/network/ProxyPreferenceController.java
index edec247..0970dd9 100644
--- a/src/com/android/settings/network/ProxyPreferenceController.java
+++ b/src/com/android/settings/network/ProxyPreferenceController.java
@@ -20,9 +20,11 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class ProxyPreferenceController extends PreferenceController {
+public class ProxyPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_PROXY_SETTINGS = "proxy_settings";
diff --git a/src/com/android/settings/network/TetherPreferenceController.java b/src/com/android/settings/network/TetherPreferenceController.java
index 31a8526..0229056 100644
--- a/src/com/android/settings/network/TetherPreferenceController.java
+++ b/src/com/android/settings/network/TetherPreferenceController.java
@@ -34,7 +34,8 @@
import com.android.settings.R;
import com.android.settings.TetherSettings;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnDestroy;
@@ -47,8 +48,8 @@
import static com.android.settingslib.RestrictedLockUtils.checkIfRestrictionEnforced;
import static com.android.settingslib.RestrictedLockUtils.hasBaseUserRestriction;
-public class TetherPreferenceController extends PreferenceController
- implements LifecycleObserver, OnResume, OnPause, OnDestroy {
+public class TetherPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause, OnDestroy {
private static final String KEY_TETHER_SETTINGS = "tether_settings";
diff --git a/src/com/android/settings/network/VpnPreferenceController.java b/src/com/android/settings/network/VpnPreferenceController.java
index a62be76..763fb72 100644
--- a/src/com/android/settings/network/VpnPreferenceController.java
+++ b/src/com/android/settings/network/VpnPreferenceController.java
@@ -39,8 +39,9 @@
import com.android.internal.net.LegacyVpnInfo;
import com.android.internal.net.VpnConfig;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
@@ -48,8 +49,8 @@
import java.util.List;
-public class VpnPreferenceController extends PreferenceController implements LifecycleObserver,
- OnResume, OnPause {
+public class VpnPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause {
private static final String KEY_VPN_SETTINGS = "vpn_settings";
private static final NetworkRequest REQUEST = new NetworkRequest.Builder()
diff --git a/src/com/android/settings/network/WifiCallingPreferenceController.java b/src/com/android/settings/network/WifiCallingPreferenceController.java
index 0e673fa..5d6e5cb 100644
--- a/src/com/android/settings/network/WifiCallingPreferenceController.java
+++ b/src/com/android/settings/network/WifiCallingPreferenceController.java
@@ -21,9 +21,11 @@
import com.android.ims.ImsManager;
import com.android.settings.WifiCallingSettings;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class WifiCallingPreferenceController extends PreferenceController {
+public class WifiCallingPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_WFC_SETTINGS = "wifi_calling_settings";
private TelephonyManager mTm;
diff --git a/src/com/android/settings/nfc/NfcPreferenceController.java b/src/com/android/settings/nfc/NfcPreferenceController.java
index 0743871..b146fe0 100644
--- a/src/com/android/settings/nfc/NfcPreferenceController.java
+++ b/src/com/android/settings/nfc/NfcPreferenceController.java
@@ -23,12 +23,10 @@
import android.os.Handler;
import android.provider.Settings;
import android.support.v14.preference.SwitchPreference;
-import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.core.PreferenceController;
-import com.android.settings.network.AirplaneModePreferenceController;
-import com.android.settings.overlay.FeatureFactory;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.RestrictedPreference;
import com.android.settingslib.core.lifecycle.events.OnPause;
@@ -36,8 +34,8 @@
import java.util.List;
-public class NfcPreferenceController extends PreferenceController
- implements LifecycleObserver, OnResume, OnPause {
+public class NfcPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause {
public static final String KEY_TOGGLE_NFC = "toggle_nfc";
public static final String KEY_ANDROID_BEAM_SETTINGS = "android_beam_settings";
diff --git a/src/com/android/settings/notification/AdjustVolumeRestrictedPreferenceController.java b/src/com/android/settings/notification/AdjustVolumeRestrictedPreferenceController.java
index f513882..bad626a 100644
--- a/src/com/android/settings/notification/AdjustVolumeRestrictedPreferenceController.java
+++ b/src/com/android/settings/notification/AdjustVolumeRestrictedPreferenceController.java
@@ -23,14 +23,16 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.accounts.AccountRestrictionHelper;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.RestrictedPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
/**
* Base class for preference controller that handles preference that enforce adjust volume
* restriction
*/
-public abstract class AdjustVolumeRestrictedPreferenceController extends PreferenceController {
+public abstract class AdjustVolumeRestrictedPreferenceController extends
+ AbstractPreferenceController implements PreferenceControllerMixin {
private AccountRestrictionHelper mHelper;
diff --git a/src/com/android/settings/notification/BadgingNotificationPreferenceController.java b/src/com/android/settings/notification/BadgingNotificationPreferenceController.java
index decbe0b..39522e8 100644
--- a/src/com/android/settings/notification/BadgingNotificationPreferenceController.java
+++ b/src/com/android/settings/notification/BadgingNotificationPreferenceController.java
@@ -25,17 +25,18 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import android.support.v7.preference.TwoStatePreference;
-import android.util.Log;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
import static android.provider.Settings.Secure.NOTIFICATION_BADGING;
-public class BadgingNotificationPreferenceController extends PreferenceController implements
- Preference.OnPreferenceChangeListener, LifecycleObserver, OnResume, OnPause {
+public class BadgingNotificationPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
+ LifecycleObserver, OnResume, OnPause {
private static final String TAG = "BadgeNotifPrefContr";
private static final String KEY_NOTIFICATION_BADGING = "notification_badging";
diff --git a/src/com/android/settings/notification/BootSoundPreferenceController.java b/src/com/android/settings/notification/BootSoundPreferenceController.java
index b644ee9..945f9ae 100644
--- a/src/com/android/settings/notification/BootSoundPreferenceController.java
+++ b/src/com/android/settings/notification/BootSoundPreferenceController.java
@@ -22,9 +22,11 @@
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class BootSoundPreferenceController extends PreferenceController {
+public class BootSoundPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
// Boot Sounds needs to be a system property so it can be accessed during boot.
private static final String KEY_BOOT_SOUNDS = "boot_sounds";
diff --git a/src/com/android/settings/notification/CastPreferenceController.java b/src/com/android/settings/notification/CastPreferenceController.java
index 0156dfd..fcb4535 100644
--- a/src/com/android/settings/notification/CastPreferenceController.java
+++ b/src/com/android/settings/notification/CastPreferenceController.java
@@ -18,9 +18,11 @@
import android.content.Context;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class CastPreferenceController extends PreferenceController {
+public class CastPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_WIFI_DISPLAY = "wifi_display";
diff --git a/src/com/android/settings/notification/ConfigureNotificationSettings.java b/src/com/android/settings/notification/ConfigureNotificationSettings.java
index bfb9de0..2b1ecc4 100644
--- a/src/com/android/settings/notification/ConfigureNotificationSettings.java
+++ b/src/com/android/settings/notification/ConfigureNotificationSettings.java
@@ -29,13 +29,12 @@
import com.android.settings.R;
import com.android.settings.RingtonePreference;
import com.android.settings.applications.NotificationApps;
-import com.android.settings.applications.NotificationApps.SummaryProvider;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.gestures.SwipeToNotificationPreferenceController;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -68,13 +67,13 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle());
}
- private static List<PreferenceController> buildPreferenceControllers(Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Lifecycle lifecycle) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
final BadgingNotificationPreferenceController badgeController =
new BadgingNotificationPreferenceController(context);
final PulseNotificationPreferenceController pulseController =
@@ -157,7 +156,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null);
}
diff --git a/src/com/android/settings/notification/EmergencyBroadcastPreferenceController.java b/src/com/android/settings/notification/EmergencyBroadcastPreferenceController.java
index 39250c6..d6291a8 100644
--- a/src/com/android/settings/notification/EmergencyBroadcastPreferenceController.java
+++ b/src/com/android/settings/notification/EmergencyBroadcastPreferenceController.java
@@ -24,14 +24,16 @@
import android.support.v7.preference.Preference;
import com.android.settings.accounts.AccountRestrictionHelper;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.RestrictedPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
/**
* Base class for preference controller that handles preference that enforce adjust volume
* restriction
*/
-public class EmergencyBroadcastPreferenceController extends PreferenceController {
+public class EmergencyBroadcastPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private final String mPrefKey;
diff --git a/src/com/android/settings/notification/LockScreenNotificationPreferenceController.java b/src/com/android/settings/notification/LockScreenNotificationPreferenceController.java
index 228e185..db46ef1 100644
--- a/src/com/android/settings/notification/LockScreenNotificationPreferenceController.java
+++ b/src/com/android/settings/notification/LockScreenNotificationPreferenceController.java
@@ -32,8 +32,9 @@
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
@@ -43,8 +44,9 @@
import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_SECURE_NOTIFICATIONS;
import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS;
-public class LockScreenNotificationPreferenceController extends PreferenceController implements
- Preference.OnPreferenceChangeListener, LifecycleObserver, OnResume, OnPause {
+public class LockScreenNotificationPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
+ LifecycleObserver, OnResume, OnPause {
private static final String TAG = "LockScreenNotifPref";
diff --git a/src/com/android/settings/notification/PulseNotificationPreferenceController.java b/src/com/android/settings/notification/PulseNotificationPreferenceController.java
index d6db8ac..4a8b820 100644
--- a/src/com/android/settings/notification/PulseNotificationPreferenceController.java
+++ b/src/com/android/settings/notification/PulseNotificationPreferenceController.java
@@ -27,15 +27,17 @@
import android.support.v7.preference.TwoStatePreference;
import android.util.Log;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
import static android.provider.Settings.System.NOTIFICATION_LIGHT_PULSE;
-public class PulseNotificationPreferenceController extends PreferenceController implements
- Preference.OnPreferenceChangeListener, LifecycleObserver, OnResume, OnPause {
+public class PulseNotificationPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
+ LifecycleObserver, OnResume, OnPause {
private static final String TAG = "PulseNotifPrefContr";
private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
diff --git a/src/com/android/settings/notification/RingtonePreferenceControllerBase.java b/src/com/android/settings/notification/RingtonePreferenceControllerBase.java
index 333f08a..09a47b7 100644
--- a/src/com/android/settings/notification/RingtonePreferenceControllerBase.java
+++ b/src/com/android/settings/notification/RingtonePreferenceControllerBase.java
@@ -22,9 +22,11 @@
import android.net.Uri;
import android.support.v7.preference.Preference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public abstract class RingtonePreferenceControllerBase extends PreferenceController {
+public abstract class RingtonePreferenceControllerBase extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
public RingtonePreferenceControllerBase(Context context) {
super(context);
diff --git a/src/com/android/settings/notification/SettingPrefController.java b/src/com/android/settings/notification/SettingPrefController.java
index 413b4a2..2af1bde 100644
--- a/src/com/android/settings/notification/SettingPrefController.java
+++ b/src/com/android/settings/notification/SettingPrefController.java
@@ -27,15 +27,15 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
-import java.util.List;
-public abstract class SettingPrefController extends PreferenceController implements
- LifecycleObserver, OnResume, OnPause {
+public abstract class SettingPrefController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause {
protected static final int DEFAULT_ON = 1;
diff --git a/src/com/android/settings/notification/SoundSettings.java b/src/com/android/settings/notification/SoundSettings.java
index 8bee301..e759c39 100644
--- a/src/com/android/settings/notification/SoundSettings.java
+++ b/src/com/android/settings/notification/SoundSettings.java
@@ -31,9 +31,9 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.RingtonePreference;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -113,7 +113,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, this, mVolumeCallback, getLifecycle());
}
@@ -182,10 +182,10 @@
}
}
- private static List<PreferenceController> buildPreferenceControllers(Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
SoundSettings fragment, VolumeSeekBarPreference.Callback callback,
Lifecycle lifecycle) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new ZenModePreferenceController(context));
controllers.add(new EmergencyBroadcastPreferenceController(
context, KEY_CELL_BROADCAST_SETTINGS));
@@ -233,7 +233,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* fragment */,
null /* callback */, null /* lifecycle */);
}
diff --git a/src/com/android/settings/notification/VibrateWhenRingPreferenceController.java b/src/com/android/settings/notification/VibrateWhenRingPreferenceController.java
index 338b652..d41e16b 100644
--- a/src/com/android/settings/notification/VibrateWhenRingPreferenceController.java
+++ b/src/com/android/settings/notification/VibrateWhenRingPreferenceController.java
@@ -27,15 +27,17 @@
import android.support.v7.preference.TwoStatePreference;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
import static android.provider.Settings.System.VIBRATE_WHEN_RINGING;
-public class VibrateWhenRingPreferenceController extends PreferenceController implements
- Preference.OnPreferenceChangeListener, LifecycleObserver, OnResume, OnPause {
+public class VibrateWhenRingPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
+ LifecycleObserver, OnResume, OnPause {
private static final String KEY_VIBRATE_WHEN_RINGING = "vibrate_when_ringing";
private SettingObserver mSettingObserver;
diff --git a/src/com/android/settings/notification/WorkSoundPreferenceController.java b/src/com/android/settings/notification/WorkSoundPreferenceController.java
index 465a2ec..1497c2c 100644
--- a/src/com/android/settings/notification/WorkSoundPreferenceController.java
+++ b/src/com/android/settings/notification/WorkSoundPreferenceController.java
@@ -43,15 +43,17 @@
import com.android.settings.DefaultRingtonePreference;
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
-public class WorkSoundPreferenceController extends PreferenceController implements
- OnPreferenceChangeListener, LifecycleObserver, OnResume, OnPause {
+public class WorkSoundPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, OnPreferenceChangeListener, LifecycleObserver,
+ OnResume, OnPause {
private static final String TAG = "WorkSoundPrefController";
private static final String KEY_WORK_CATEGORY = "sound_work_settings_section";
diff --git a/src/com/android/settings/search/BaseSearchIndexProvider.java b/src/com/android/settings/search/BaseSearchIndexProvider.java
index 11b4db1..f43de34 100644
--- a/src/com/android/settings/search/BaseSearchIndexProvider.java
+++ b/src/com/android/settings/search/BaseSearchIndexProvider.java
@@ -25,7 +25,8 @@
import android.util.Log;
import android.util.Xml;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -61,11 +62,17 @@
// Entire page should be suppressed, mark all keys from this page as non-indexable.
return getNonIndexableKeysFromXml(context);
}
- final List<PreferenceController> controllers = getPreferenceControllers(context);
+ final List<AbstractPreferenceController> controllers = getPreferenceControllers(context);
if (controllers != null && !controllers.isEmpty()) {
final List<String> nonIndexableKeys = new ArrayList<>();
- for (PreferenceController controller : controllers) {
- controller.updateNonIndexableKeys(nonIndexableKeys);
+ for (AbstractPreferenceController controller : controllers) {
+ if (controller instanceof PreferenceControllerMixin) {
+ ((PreferenceControllerMixin) controller)
+ .updateNonIndexableKeys(nonIndexableKeys);
+ } else {
+ throw new IllegalStateException(controller.getClass().getName()
+ + " must implement " + PreferenceControllerMixin.class.getName());
+ }
}
return nonIndexableKeys;
} else {
@@ -74,7 +81,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return null;
}
diff --git a/src/com/android/settings/search/DatabaseIndexingManager.java b/src/com/android/settings/search/DatabaseIndexingManager.java
index c681912..85ba869 100644
--- a/src/com/android/settings/search/DatabaseIndexingManager.java
+++ b/src/com/android/settings/search/DatabaseIndexingManager.java
@@ -42,7 +42,7 @@
import android.util.Xml;
import com.android.settings.SettingsActivity;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -730,7 +730,7 @@
final String intentTargetPackage = sir.intentTargetPackage;
final String intentTargetClass = sir.intentTargetClass;
- Map<String, PreferenceController> controllerUriMap = null;
+ Map<String, PreferenceControllerMixin> controllerUriMap = null;
if (fragmentName != null) {
controllerUriMap = DatabaseIndexingUtils
diff --git a/src/com/android/settings/search/DatabaseIndexingUtils.java b/src/com/android/settings/search/DatabaseIndexingUtils.java
index a6f3cb1..b74fb53 100644
--- a/src/com/android/settings/search/DatabaseIndexingUtils.java
+++ b/src/com/android/settings/search/DatabaseIndexingUtils.java
@@ -33,7 +33,8 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.SettingsActivity;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.lang.reflect.Field;
import java.text.Normalizer;
@@ -75,12 +76,12 @@
/**
* @param className which wil provide the map between from {@link Uri}s to
- * {@link PreferenceController}
+ * {@link PreferenceControllerMixin}
* @param context
- * @return A map between {@link Uri}s and {@link PreferenceController}s to get the payload
+ * @return A map between {@link Uri}s and {@link PreferenceControllerMixin}s to get the payload
* types for Settings.
*/
- public static Map<String, PreferenceController> getPreferenceControllerUriMap(
+ public static Map<String, PreferenceControllerMixin> getPreferenceControllerUriMap(
String className, Context context) {
if (context == null) {
return null;
@@ -98,36 +99,41 @@
// SEARCH_INDEX_DATA_PROVIDER field
final Indexable.SearchIndexProvider provider = getSearchIndexProvider(clazz);
- List<PreferenceController> controllers =
+ List<AbstractPreferenceController> controllers =
provider.getPreferenceControllers(context);
if (controllers == null ) {
return null;
}
- ArrayMap<String, PreferenceController> map = new ArrayMap<>();
+ ArrayMap<String, PreferenceControllerMixin> map = new ArrayMap<>();
- for (PreferenceController controller : controllers) {
- map.put(controller.getPreferenceKey(), controller);
+ for (AbstractPreferenceController controller : controllers) {
+ if (controller instanceof PreferenceControllerMixin) {
+ map.put(controller.getPreferenceKey(), (PreferenceControllerMixin) controller);
+ } else {
+ throw new IllegalStateException(controller.getClass().getName()
+ + " must implement " + PreferenceControllerMixin.class.getName());
+ }
}
return map;
}
/**
- * @param uriMap Map between the {@link PreferenceController} keys
+ * @param uriMap Map between the {@link PreferenceControllerMixin} keys
* and the controllers themselves.
* @param key The look-up key
- * @return The Payload from the {@link PreferenceController} specified by the key, if it exists.
- * Otherwise null.
+ * @return The Payload from the {@link PreferenceControllerMixin} specified by the key,
+ * if it exists. Otherwise null.
*/
- public static ResultPayload getPayloadFromUriMap(Map<String, PreferenceController> uriMap,
+ public static ResultPayload getPayloadFromUriMap(Map<String, PreferenceControllerMixin> uriMap,
String key) {
if (uriMap == null) {
return null;
}
- PreferenceController controller = uriMap.get(key);
+ PreferenceControllerMixin controller = uriMap.get(key);
if (controller == null) {
return null;
}
diff --git a/src/com/android/settings/search/Indexable.java b/src/com/android/settings/search/Indexable.java
index 2ec4ac0..505f41b 100644
--- a/src/com/android/settings/search/Indexable.java
+++ b/src/com/android/settings/search/Indexable.java
@@ -18,7 +18,8 @@
import android.content.Context;
import android.provider.SearchIndexableResource;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.List;
@@ -69,8 +70,9 @@
/**
* @param context
- * @return a list of {@link PreferenceController} for ResultPayload data during Indexing.
+ * @return a list of {@link AbstractPreferenceController} for ResultPayload data during
+ * Indexing.
*/
- List<PreferenceController> getPreferenceControllers(Context context);
+ List<AbstractPreferenceController> getPreferenceControllers(Context context);
}
}
diff --git a/src/com/android/settings/security/LockscreenDashboardFragment.java b/src/com/android/settings/security/LockscreenDashboardFragment.java
index e239a43..b679b73 100644
--- a/src/com/android/settings/security/LockscreenDashboardFragment.java
+++ b/src/com/android/settings/security/LockscreenDashboardFragment.java
@@ -23,10 +23,10 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.accounts.AddUserWhenLockedPreferenceController;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.notification.LockScreenNotificationPreferenceController;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -73,8 +73,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
final Lifecycle lifecycle = getLifecycle();
final LockScreenNotificationPreferenceController notificationController =
new LockScreenNotificationPreferenceController(context,
@@ -111,8 +111,8 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new LockScreenNotificationPreferenceController(context));
controllers.add(new AddUserWhenLockedPreferenceController(context));
controllers.add(new OwnerInfoPreferenceController(
diff --git a/src/com/android/settings/security/OwnerInfoPreferenceController.java b/src/com/android/settings/security/OwnerInfoPreferenceController.java
index a687cb9..cae4d10 100644
--- a/src/com/android/settings/security/OwnerInfoPreferenceController.java
+++ b/src/com/android/settings/security/OwnerInfoPreferenceController.java
@@ -24,16 +24,17 @@
import android.support.v7.preference.PreferenceScreen;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.OwnerInfoSettings;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import com.android.settingslib.RestrictedPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnResume;
-public class OwnerInfoPreferenceController extends PreferenceController
- implements LifecycleObserver, OnResume {
+public class OwnerInfoPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnResume {
private static final String KEY_OWNER_INFO = "owner_info_settings";
private static final int MY_USER_ID = UserHandle.myUserId();
diff --git a/src/com/android/settings/system/FactoryResetPreferenceController.java b/src/com/android/settings/system/FactoryResetPreferenceController.java
index a3cf10a..69eef2a 100644
--- a/src/com/android/settings/system/FactoryResetPreferenceController.java
+++ b/src/com/android/settings/system/FactoryResetPreferenceController.java
@@ -25,11 +25,13 @@
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.List;
-public class FactoryResetPreferenceController extends PreferenceController {
+public class FactoryResetPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
/** Key of the "Factory reset" preference in {@link R.xml.reset_dashboard_fragment}. */
private static final String KEY_FACTORY_RESET = "factory_reset";
diff --git a/src/com/android/settings/system/ResetDashboardFragment.java b/src/com/android/settings/system/ResetDashboardFragment.java
index c04e374..48295a4 100644
--- a/src/com/android/settings/system/ResetDashboardFragment.java
+++ b/src/com/android/settings/system/ResetDashboardFragment.java
@@ -22,11 +22,11 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.applications.ResetAppPrefPreferenceController;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.network.NetworkResetPreferenceController;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -52,13 +52,13 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle());
}
- private static List<PreferenceController> buildPreferenceControllers(Context context,
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Lifecycle lifecycle) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new NetworkResetPreferenceController(context));
controllers.add(new FactoryResetPreferenceController(context));
controllers.add(new ResetAppPrefPreferenceController(context, lifecycle));
@@ -79,7 +79,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
diff --git a/src/com/android/settings/system/SystemDashboardFragment.java b/src/com/android/settings/system/SystemDashboardFragment.java
index fd164be..5d4e7da 100644
--- a/src/com/android/settings/system/SystemDashboardFragment.java
+++ b/src/com/android/settings/system/SystemDashboardFragment.java
@@ -22,12 +22,12 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.backup.BackupSettingsActivityPreferenceController;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.deviceinfo.AdditionalSystemUpdatePreferenceController;
import com.android.settings.deviceinfo.SystemUpdatePreferenceController;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
import java.util.Arrays;
@@ -60,12 +60,12 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context);
}
- private static List<PreferenceController> buildPreferenceControllers(Context context) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new SystemUpdatePreferenceController(context, UserManager.get(context)));
controllers.add(new AdditionalSystemUpdatePreferenceController(context));
controllers.add(new BackupSettingsActivityPreferenceController(context));
@@ -86,7 +86,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context);
}
diff --git a/src/com/android/settings/wifi/CellularFallbackPreferenceController.java b/src/com/android/settings/wifi/CellularFallbackPreferenceController.java
index 4e9174c..2baf261 100644
--- a/src/com/android/settings/wifi/CellularFallbackPreferenceController.java
+++ b/src/com/android/settings/wifi/CellularFallbackPreferenceController.java
@@ -22,13 +22,15 @@
import android.support.v7.preference.Preference;
import android.text.TextUtils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
/**
- * {@link PreferenceController} that controls whether we should fall back to celluar when wifi is
- * bad.
+ * {@link AbstractPreferenceController} that controls whether we should fall back to celluar when
+ * wifi is bad.
*/
-public class CellularFallbackPreferenceController extends PreferenceController {
+public class CellularFallbackPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private static final String KEY_CELLULAR_FALLBACK = "wifi_cellular_data_fallback";
diff --git a/src/com/android/settings/wifi/ConfigureWifiSettings.java b/src/com/android/settings/wifi/ConfigureWifiSettings.java
index a50a1d9..f00fb73 100644
--- a/src/com/android/settings/wifi/ConfigureWifiSettings.java
+++ b/src/com/android/settings/wifi/ConfigureWifiSettings.java
@@ -15,7 +15,6 @@
*/
package com.android.settings.wifi;
-import static android.content.Context.NETWORK_SCORE_SERVICE;
import static android.content.Context.WIFI_SERVICE;
import android.content.Context;
@@ -27,7 +26,6 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.network.NetworkScoreManagerWrapper;
import com.android.settings.network.NetworkScorerPickerPreferenceController;
@@ -35,6 +33,7 @@
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settings.wifi.p2p.WifiP2pPreferenceController;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
import java.util.Arrays;
@@ -69,13 +68,13 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
final NetworkScoreManagerWrapper networkScoreManagerWrapper =
new NetworkScoreManagerWrapper(context.getSystemService(NetworkScoreManager.class));
mUseOpenWifiPreferenceController = new UseOpenWifiPreferenceController(context, this,
networkScoreManagerWrapper, getLifecycle());
final WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
- final List<PreferenceController> controllers = new ArrayList<>();
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new WifiWakeupPreferenceController(context, getLifecycle()));
controllers.add(new NetworkScorerPickerPreferenceController(context,
networkScoreManagerWrapper));
diff --git a/src/com/android/settings/wifi/NotifyOpenNetworksPreferenceController.java b/src/com/android/settings/wifi/NotifyOpenNetworksPreferenceController.java
index 7cf19f2..79b7653 100644
--- a/src/com/android/settings/wifi/NotifyOpenNetworksPreferenceController.java
+++ b/src/com/android/settings/wifi/NotifyOpenNetworksPreferenceController.java
@@ -27,18 +27,19 @@
import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
/**
- * {@link PreferenceController} that controls whether we should notify user when open network is
- * available.
+ * {@link AbstractPreferenceController} that controls whether we should notify user when open
+ * network is available.
*/
-public class NotifyOpenNetworksPreferenceController extends PreferenceController implements
- LifecycleObserver, OnResume, OnPause {
+public class NotifyOpenNetworksPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause {
private static final String KEY_NOTIFY_OPEN_NETWORKS = "notify_open_networks";
private SettingObserver mSettingObserver;
diff --git a/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java b/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java
index 37cd692..c284679 100644
--- a/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java
+++ b/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java
@@ -21,18 +21,20 @@
import android.text.TextUtils;
import com.android.settings.network.NetworkScoreManagerWrapper;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
/**
- * {@link PreferenceController} that controls whether a user wants to enable the "use open networks
- * automatically" feature provider by the current network recommendation provider.
+ * {@link AbstractPreferenceController} that controls whether a user wants to enable the "use open
+ * networks automatically" feature provider by the current network recommendation provider.
*/
-public class UseOpenWifiPreferenceController extends PreferenceController
- implements Preference.OnPreferenceChangeListener, LifecycleObserver, OnResume, OnPause {
+public class UseOpenWifiPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
+ LifecycleObserver, OnResume, OnPause {
private static final String KEY_USE_OPEN_WIFI_AUTOMATICALLY = "use_open_wifi_automatically";
@VisibleForTesting static final int REQUEST_CODE_OPEN_WIFI_AUTOMATICALLY = 400;
diff --git a/src/com/android/settings/wifi/WifiInfoPreferenceController.java b/src/com/android/settings/wifi/WifiInfoPreferenceController.java
index 238f0e1..97c4fb9 100644
--- a/src/com/android/settings/wifi/WifiInfoPreferenceController.java
+++ b/src/com/android/settings/wifi/WifiInfoPreferenceController.java
@@ -28,17 +28,18 @@
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
/**
- * {@link PreferenceController} that updates MAC/IP address.
+ * {@link PreferenceControllerMixin} that updates MAC/IP address.
*/
-public class WifiInfoPreferenceController extends PreferenceController implements
- LifecycleObserver, OnResume, OnPause {
+public class WifiInfoPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause {
private static final String KEY_CURRENT_IP_ADDRESS = "current_ip_address";
private static final String KEY_MAC_ADDRESS = "mac_address";
diff --git a/src/com/android/settings/wifi/WifiMasterSwitchPreferenceController.java b/src/com/android/settings/wifi/WifiMasterSwitchPreferenceController.java
index bc61cff..2fadede 100644
--- a/src/com/android/settings/wifi/WifiMasterSwitchPreferenceController.java
+++ b/src/com/android/settings/wifi/WifiMasterSwitchPreferenceController.java
@@ -18,19 +18,20 @@
import android.content.Context;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.widget.SummaryUpdater;
import com.android.settings.widget.MasterSwitchPreference;
import com.android.settings.widget.MasterSwitchController;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
-public class WifiMasterSwitchPreferenceController extends PreferenceController
- implements SummaryUpdater.OnSummaryChangeListener,
+public class WifiMasterSwitchPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, SummaryUpdater.OnSummaryChangeListener,
LifecycleObserver, OnResume, OnPause, OnStart, OnStop {
public static final String KEY_TOGGLE_WIFI = "toggle_wifi";
diff --git a/src/com/android/settings/wifi/WifiWakeupPreferenceController.java b/src/com/android/settings/wifi/WifiWakeupPreferenceController.java
index 9ec4c59..3496246 100644
--- a/src/com/android/settings/wifi/WifiWakeupPreferenceController.java
+++ b/src/com/android/settings/wifi/WifiWakeupPreferenceController.java
@@ -28,17 +28,19 @@
import android.text.TextUtils;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
/**
- * {@link PreferenceController} that controls whether the Wi-Fi Wakeup feature should be enabled.
+ * {@link PreferenceControllerMixin} that controls whether the Wi-Fi Wakeup feature should be
+ * enabled.
*/
-public class WifiWakeupPreferenceController extends PreferenceController implements
- LifecycleObserver, OnResume, OnPause {
+public class WifiWakeupPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause {
private static final String KEY_ENABLE_WIFI_WAKEUP = "enable_wifi_wakeup";
private SettingObserver mSettingObserver;
diff --git a/src/com/android/settings/wifi/WpsPreferenceController.java b/src/com/android/settings/wifi/WpsPreferenceController.java
index 7aaa7eb..f636593 100644
--- a/src/com/android/settings/wifi/WpsPreferenceController.java
+++ b/src/com/android/settings/wifi/WpsPreferenceController.java
@@ -29,18 +29,19 @@
import android.support.v7.preference.PreferenceScreen;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
/**
- * {@link PreferenceController} that shows Dialog for WPS progress. Disabled when Wi-Fi is off.
+ * {@link PreferenceControllerMixin} that shows Dialog for WPS progress. Disabled when Wi-Fi is off.
*/
-public class WpsPreferenceController extends PreferenceController implements
- LifecycleObserver, OnPause, OnResume {
+public class WpsPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnPause, OnResume {
private static final String KEY_WPS_PUSH = "wps_push_button";
private static final String KEY_WPS_PIN = "wps_pin_entry";
diff --git a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
index 4ab0805..fe61faf 100644
--- a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
+++ b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
@@ -27,7 +27,6 @@
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.ConnectivityManager.NetworkCallback;
-import android.net.IpPrefix;
import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.Network;
@@ -53,10 +52,11 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.applications.LayoutPreference;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.vpn2.ConnectivityManagerWrapper;
import com.android.settings.wifi.WifiDetailPreference;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
@@ -67,7 +67,6 @@
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.List;
import java.util.StringJoiner;
import java.util.stream.Collectors;
@@ -75,8 +74,8 @@
* Controller for logic pertaining to displaying Wifi information for the
* {@link WifiNetworkDetailsFragment}.
*/
-public class WifiDetailPreferenceController extends PreferenceController implements
- LifecycleObserver, OnPause, OnResume {
+public class WifiDetailPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnPause, OnResume {
private static final String TAG = "WifiDetailsPrefCtrl";
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
diff --git a/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java b/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
index 664ac7f..0016010 100644
--- a/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
+++ b/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
@@ -24,9 +24,9 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.vpn2.ConnectivityManagerWrapperImpl;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.wifi.AccessPoint;
import java.util.ArrayList;
@@ -66,7 +66,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
ConnectivityManager cm = context.getSystemService(ConnectivityManager.class);
mWifiDetailPreferenceController = new WifiDetailPreferenceController(
mAccessPoint,
@@ -78,7 +78,7 @@
context.getSystemService(WifiManager.class),
mMetricsFeatureProvider);
- ArrayList<PreferenceController> controllers = new ArrayList(1);
+ ArrayList<AbstractPreferenceController> controllers = new ArrayList(1);
controllers.add(mWifiDetailPreferenceController);
return controllers;
}
diff --git a/src/com/android/settings/wifi/p2p/P2pCategoryPreferenceController.java b/src/com/android/settings/wifi/p2p/P2pCategoryPreferenceController.java
index 3df1978..e777626 100644
--- a/src/com/android/settings/wifi/p2p/P2pCategoryPreferenceController.java
+++ b/src/com/android/settings/wifi/p2p/P2pCategoryPreferenceController.java
@@ -21,9 +21,11 @@
import android.support.v7.preference.PreferenceGroup;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public abstract class P2pCategoryPreferenceController extends PreferenceController {
+public abstract class P2pCategoryPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
protected PreferenceGroup mCategory;
diff --git a/src/com/android/settings/wifi/p2p/P2pThisDevicePreferenceController.java b/src/com/android/settings/wifi/p2p/P2pThisDevicePreferenceController.java
index ca992a9..9ed3158 100644
--- a/src/com/android/settings/wifi/p2p/P2pThisDevicePreferenceController.java
+++ b/src/com/android/settings/wifi/p2p/P2pThisDevicePreferenceController.java
@@ -22,9 +22,11 @@
import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public class P2pThisDevicePreferenceController extends PreferenceController {
+public class P2pThisDevicePreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
private Preference mPreference;
diff --git a/src/com/android/settings/wifi/p2p/WifiP2pPreferenceController.java b/src/com/android/settings/wifi/p2p/WifiP2pPreferenceController.java
index 3eb2b7b..2d5e25f 100644
--- a/src/com/android/settings/wifi/p2p/WifiP2pPreferenceController.java
+++ b/src/com/android/settings/wifi/p2p/WifiP2pPreferenceController.java
@@ -24,17 +24,18 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
/**
- * {@link PreferenceController} to toggle Wifi Direct preference on Wi-Fi state.
+ * {@link PreferenceControllerMixin} to toggle Wifi Direct preference on Wi-Fi state.
*/
-public class WifiP2pPreferenceController extends PreferenceController implements
- LifecycleObserver, OnPause, OnResume {
+public class WifiP2pPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnPause, OnResume {
private static final String KEY_WIFI_DIRECT = "wifi_direct";
diff --git a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
index cd328d9..109aa91 100644
--- a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
+++ b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
@@ -51,8 +51,8 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.DashboardFragment;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
import java.util.List;
@@ -168,8 +168,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
mPersistentCategoryController =
new P2pPersistentCategoryPreferenceController(context);
mPeerCategoryController =
diff --git a/src/com/android/settings/wifi/tether/WifiTetherBasePreferenceController.java b/src/com/android/settings/wifi/tether/WifiTetherBasePreferenceController.java
index eb21175..b6aba1b 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherBasePreferenceController.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherBasePreferenceController.java
@@ -22,10 +22,11 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
-public abstract class WifiTetherBasePreferenceController extends PreferenceController
- implements Preference.OnPreferenceChangeListener {
+public abstract class WifiTetherBasePreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
public interface OnTetherConfigUpdateListener {
void onTetherConfigUpdated();
diff --git a/src/com/android/settings/wifi/tether/WifiTetherPreferenceController.java b/src/com/android/settings/wifi/tether/WifiTetherPreferenceController.java
index 46fb7a9..4fe01d3 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherPreferenceController.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherPreferenceController.java
@@ -30,7 +30,8 @@
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
@@ -38,8 +39,8 @@
import java.util.List;
-public class WifiTetherPreferenceController extends PreferenceController
- implements LifecycleObserver, OnResume, OnPause {
+public class WifiTetherPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause {
public static final IntentFilter WIFI_TETHER_INTENT_FILTER;
private static final String WIFI_TETHER_SETTINGS = "wifi_tether";
diff --git a/src/com/android/settings/wifi/tether/WifiTetherSettings.java b/src/com/android/settings/wifi/tether/WifiTetherSettings.java
index 2584ed4..73fb309 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherSettings.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherSettings.java
@@ -16,6 +16,9 @@
package com.android.settings.wifi.tether;
+import static android.net.ConnectivityManager.ACTION_TETHER_STATE_CHANGED;
+import static android.net.wifi.WifiManager.WIFI_AP_STATE_CHANGED_ACTION;
+
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -31,16 +34,13 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.RestrictedDashboardFragment;
import com.android.settings.widget.SwitchBar;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
import java.util.List;
-import static android.net.ConnectivityManager.ACTION_TETHER_STATE_CHANGED;
-import static android.net.wifi.WifiManager.WIFI_AP_STATE_CHANGED_ACTION;
-
public class WifiTetherSettings extends RestrictedDashboardFragment
implements WifiTetherBasePreferenceController.OnTetherConfigUpdateListener {
@@ -124,8 +124,8 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
- final List<PreferenceController> controllers = new ArrayList<>();
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+ final List<AbstractPreferenceController> controllers = new ArrayList<>();
mSSIDPreferenceController = new WifiTetherSSIDPreferenceController(context, this);
mPasswordPreferenceController = new WifiTetherPasswordPreferenceController(context, this);
mApBandPreferenceController = new WifiTetherApBandPreferenceController(context, this);
diff --git a/tests/robotests/src/com/android/settings/DisplaySettingsTest.java b/tests/robotests/src/com/android/settings/DisplaySettingsTest.java
index 6b895d7..4b345c0 100644
--- a/tests/robotests/src/com/android/settings/DisplaySettingsTest.java
+++ b/tests/robotests/src/com/android/settings/DisplaySettingsTest.java
@@ -1,11 +1,14 @@
package com.android.settings;
+import static com.google.common.truth.Truth.assertThat;
+
import android.content.Context;
-import com.android.settings.core.PreferenceController;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.XmlTestUtils;
import com.android.settings.testutils.shadow.ShadowPowerManagerWrapper;
+import com.android.settingslib.core.AbstractPreferenceController;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RuntimeEnvironment;
@@ -14,10 +17,6 @@
import java.util.ArrayList;
import java.util.List;
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.mock;
-
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class DisplaySettingsTest {
@@ -33,7 +32,7 @@
fragment.getPreferenceScreenResId());
final List<String> preferenceKeys = new ArrayList<>();
- for (PreferenceController controller : fragment.getPreferenceControllers(context)) {
+ for (AbstractPreferenceController controller : fragment.getPreferenceControllers(context)) {
preferenceKeys.add(controller.getPreferenceKey());
}
// Nightmode is currently hidden
diff --git a/tests/robotests/src/com/android/settings/bluetooth/DeviceListPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/DeviceListPreferenceFragmentTest.java
index c205c50..49efecb 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/DeviceListPreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/DeviceListPreferenceFragmentTest.java
@@ -34,9 +34,9 @@
import com.android.settings.R;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
-import com.android.settings.core.PreferenceController;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
+import com.android.settingslib.core.AbstractPreferenceController;
import org.junit.Before;
import org.junit.Test;
@@ -208,7 +208,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return null;
}
}
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentSearchIndexProviderInspector.java b/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentSearchIndexProviderInspector.java
index d102ab4..3d9783d 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentSearchIndexProviderInspector.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentSearchIndexProviderInspector.java
@@ -19,9 +19,9 @@
import android.app.Fragment;
import android.content.Context;
-import com.android.settings.core.PreferenceController;
-import com.android.settings.search.Indexable;
import com.android.settings.search.DatabaseIndexingUtils;
+import com.android.settings.search.Indexable;
+import com.android.settingslib.core.AbstractPreferenceController;
import org.robolectric.RuntimeEnvironment;
@@ -47,8 +47,8 @@
if (provider == null) {
return true;
}
- final List<PreferenceController> controllersFromSearchIndexProvider;
- final List<PreferenceController> controllersFromFragment;
+ final List<AbstractPreferenceController> controllersFromSearchIndexProvider;
+ final List<AbstractPreferenceController> controllersFromFragment;
try {
controllersFromSearchIndexProvider = provider.getPreferenceControllers(context);
} catch (Throwable e) {
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
index 2d32949..1c57dc3 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
@@ -32,10 +32,11 @@
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.core.instrumentation.VisibilityLoggerMixin;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.testutils.FakeFeatureFactory;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.drawer.DashboardCategory;
import com.android.settingslib.drawer.Tile;
@@ -126,7 +127,7 @@
@Test
public void onAttach_shouldCreatePlaceholderPreferenceController() {
- final PreferenceController controller = mTestFragment.getPreferenceController(
+ final AbstractPreferenceController controller = mTestFragment.getPreferenceController(
DashboardTilePlaceholderPreferenceController.class);
assertThat(controller).isNotNull();
@@ -134,9 +135,11 @@
@Test
public void updateState_skipUnavailablePrefs() {
- final List<PreferenceController> preferenceControllers = mTestFragment.mControllers;
- final PreferenceController mockController1 = mock(PreferenceController.class);
- final PreferenceController mockController2 = mock(PreferenceController.class);
+ final List<AbstractPreferenceController> preferenceControllers = mTestFragment.mControllers;
+ final AbstractPreferenceController mockController1 =
+ mock(AbstractPreferenceController.class);
+ final AbstractPreferenceController mockController2 =
+ mock(AbstractPreferenceController.class);
preferenceControllers.add(mockController1);
preferenceControllers.add(mockController2);
when(mockController1.isAvailable()).thenReturn(false);
@@ -149,7 +152,8 @@
verify(mockController2).getPreferenceKey();
}
- public static class TestPreferenceController extends PreferenceController {
+ public static class TestPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
public TestPreferenceController(Context context) {
super(context);
@@ -180,7 +184,7 @@
private final PreferenceManager mPreferenceManager;
private final Context mContext;
- private final List<PreferenceController> mControllers;
+ private final List<AbstractPreferenceController> mControllers;
public final PreferenceScreen mScreen;
@@ -221,7 +225,7 @@
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return mControllers;
}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/storage/SecondaryUserControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/storage/SecondaryUserControllerTest.java
index 9b4f30e..fcda085 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/storage/SecondaryUserControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/storage/SecondaryUserControllerTest.java
@@ -16,9 +16,10 @@
package com.android.settings.deviceinfo.storage;
-import static com.google.common.truth.Truth.assertThat;
import static com.android.settings.utils.FileSizeFormatter.MEGABYTE_IN_BYTES;
+import static com.google.common.truth.Truth.assertThat;
+
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -36,9 +37,9 @@
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
import com.android.settings.applications.UserManagerWrapper;
-import com.android.settings.core.PreferenceController;
import com.android.settingslib.R;
import com.android.settingslib.applications.StorageStatsSource;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.drawable.UserIconDrawable;
import org.junit.Before;
@@ -112,7 +113,7 @@
userInfos.add(mPrimaryUser);
when(mUserManager.getPrimaryUser()).thenReturn(mPrimaryUser);
when(mUserManager.getUsers()).thenReturn(userInfos);
- List<PreferenceController> controllers =
+ List<AbstractPreferenceController> controllers =
SecondaryUserController.getSecondaryUserControllers(mContext, mUserManager);
assertThat(controllers).hasSize(1);
@@ -130,7 +131,7 @@
userInfos.add(secondaryUser);
when(mUserManager.getPrimaryUser()).thenReturn(mPrimaryUser);
when(mUserManager.getUsers()).thenReturn(userInfos);
- List<PreferenceController> controllers =
+ List<AbstractPreferenceController> controllers =
SecondaryUserController.getSecondaryUserControllers(mContext, mUserManager);
assertThat(controllers).hasSize(1);
@@ -147,7 +148,7 @@
when(mUserManager.getPrimaryUser()).thenReturn(mPrimaryUser);
when(mUserManager.getUsers()).thenReturn(userInfos);
- List<PreferenceController> controllers =
+ List<AbstractPreferenceController> controllers =
SecondaryUserController.getSecondaryUserControllers(mContext, mUserManager);
assertThat(controllers).hasSize(2);
@@ -190,7 +191,7 @@
userInfos.add(primaryUserRenamed);
when(mUserManager.getPrimaryUser()).thenReturn(mPrimaryUser);
when(mUserManager.getUsers()).thenReturn(userInfos);
- List<PreferenceController> controllers =
+ List<AbstractPreferenceController> controllers =
SecondaryUserController.getSecondaryUserControllers(mContext, mUserManager);
assertThat(controllers).hasSize(1);
diff --git a/tests/robotests/src/com/android/settings/enterprise/ApplicationListFragmentTest.java b/tests/robotests/src/com/android/settings/enterprise/ApplicationListFragmentTest.java
index 83ea399..a6f95aa 100644
--- a/tests/robotests/src/com/android/settings/enterprise/ApplicationListFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/ApplicationListFragmentTest.java
@@ -16,6 +16,13 @@
package com.android.settings.enterprise;
+import static com.android.settings.testutils.ApplicationTestUtils.buildInfo;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Answers.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.when;
+
import android.content.Context;
import android.content.pm.UserInfo;
import android.support.v7.preference.PreferenceManager;
@@ -27,7 +34,7 @@
import com.android.settings.TestConfig;
import com.android.settings.applications.ApplicationFeatureProvider;
import com.android.settings.applications.UserAppInfo;
-import com.android.settings.core.PreferenceController;
+import com.android.settingslib.core.AbstractPreferenceController;
import org.junit.Before;
import org.junit.Test;
@@ -40,11 +47,6 @@
import java.util.ArrayList;
import java.util.List;
-import static com.android.settings.testutils.ApplicationTestUtils.buildInfo;
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Answers.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.when;
-
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class ApplicationListFragmentTest {
@@ -84,7 +86,7 @@
@Test
public void getPreferenceControllers() {
- final List<PreferenceController> controllers = mFragment.getPreferenceControllers(mContext);
+ final List<AbstractPreferenceController> controllers = mFragment.getPreferenceControllers(mContext);
assertThat(controllers).isNotNull();
assertThat(controllers.size()).isEqualTo(1);
int position = 0;
diff --git a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java
index 42639d6..b668633 100644
--- a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java
@@ -16,16 +16,20 @@
package com.android.settings.enterprise;
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
import android.content.Context;
import android.content.res.XmlResourceParser;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
import com.android.settings.core.DynamicAvailabilityPreferenceController;
-import com.android.settings.core.PreferenceController;
import com.android.settings.testutils.FakeFeatureFactory;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settingslib.core.AbstractPreferenceController;
import org.junit.Before;
import org.junit.Test;
@@ -42,9 +46,6 @@
import java.util.List;
import java.util.Set;
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.when;
-
/**
* Tests for {@link EnterprisePrivacySettings}.
*/
@@ -111,20 +112,20 @@
@Test
public void getPreferenceControllers() throws Exception {
- final List<PreferenceController> controllers = mSettings.getPreferenceControllers(
+ final List<AbstractPreferenceController> controllers = mSettings.getPreferenceControllers(
ShadowApplication.getInstance().getApplicationContext());
verifyPreferenceControllers(controllers);
}
@Test
public void getSearchIndexProviderPreferenceControllers() throws Exception {
- final List<PreferenceController> controllers
+ final List<AbstractPreferenceController> controllers
= EnterprisePrivacySettings.SEARCH_INDEX_DATA_PROVIDER.getPreferenceControllers(
ShadowApplication.getInstance().getApplicationContext());
verifyPreferenceControllers(controllers);
}
- private void verifyPreferenceControllers(List<PreferenceController> controllers)
+ private void verifyPreferenceControllers(List<AbstractPreferenceController> controllers)
throws Exception {
assertThat(controllers).isNotNull();
assertThat(controllers.size()).isEqualTo(16);
@@ -152,7 +153,8 @@
GlobalHttpProxyPreferenceController.class);
assertThat(controllers.get(position++)).isInstanceOf(
CaCertsPreferenceController.class);
- final PreferenceController exposureChangesCategoryController = controllers.get(position);
+ final AbstractPreferenceController exposureChangesCategoryController =
+ controllers.get(position);
final int exposureChangesCategoryControllerIndex = position;
assertThat(controllers.get(position++)).isInstanceOf(
ExposureChangesCategoryPreferenceController.class);
@@ -200,7 +202,7 @@
final Set<String> actualObserved = new HashSet<>();
int maxObservedIndex = -1;
for (int i = 0; i < controllers.size(); i++) {
- final PreferenceController controller = controllers.get(i);
+ final AbstractPreferenceController controller = controllers.get(i);
if (controller instanceof DynamicAvailabilityPreferenceController &&
((DynamicAvailabilityPreferenceController) controller).getAvailabilityObserver()
== exposureChangesCategoryController) {
diff --git a/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragmentTest.java b/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragmentTest.java
index 54a825e..567c06f 100644
--- a/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragmentTest.java
@@ -16,14 +16,21 @@
package com.android.settings.enterprise;
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Answers.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.when;
+
import android.content.Context;
import android.support.v7.preference.PreferenceManager;
import android.support.v7.preference.PreferenceScreen;
+
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
-import com.android.settings.core.PreferenceController;
+import com.android.settingslib.core.AbstractPreferenceController;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,10 +41,6 @@
import java.util.List;
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Answers.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.when;
-
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class EnterpriseSetDefaultAppsListFragmentTest {
@@ -77,7 +80,7 @@
@Test
public void getPreferenceControllers() {
- final List<PreferenceController> controllers = mFragment.getPreferenceControllers(mContext);
+ final List<AbstractPreferenceController> controllers = mFragment.getPreferenceControllers(mContext);
assertThat(controllers).isNotNull();
assertThat(controllers.size()).isEqualTo(1);
int position = 0;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java
index 5225a74..e6e960b 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java
@@ -15,12 +15,28 @@
*/
package com.android.settings.fuelgauge;
-import java.util.List;
+import static com.android.settings.fuelgauge.PowerUsageSummary.MENU_ADDITIONAL_BATTERY_INFO;
+import static com.android.settings.fuelgauge.PowerUsageSummary.MENU_HIGH_POWER_APPS;
+import static com.android.settings.fuelgauge.PowerUsageSummary.MENU_TOGGLE_APPS;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
import android.app.LoaderManager;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
-import android.content.ContentResolver;
import android.os.PowerManager;
import android.support.v7.preference.PreferenceGroup;
import android.support.v7.preference.PreferenceScreen;
@@ -39,17 +55,17 @@
import com.android.internal.os.BatteryStatsImpl;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
-import com.android.settings.fuelgauge.anomaly.AnomalyDetectionPolicy;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
import com.android.settings.Utils;
import com.android.settings.applications.LayoutPreference;
-import com.android.settings.core.PreferenceController;
import com.android.settings.fuelgauge.anomaly.Anomaly;
+import com.android.settings.fuelgauge.anomaly.AnomalyDetectionPolicy;
import com.android.settings.testutils.FakeFeatureFactory;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.testutils.XmlTestUtils;
import com.android.settings.testutils.shadow.SettingsShadowResources;
import com.android.settings.testutils.shadow.ShadowDynamicIndexableContentMonitor;
-import com.android.settings.testutils.XmlTestUtils;
+import com.android.settingslib.core.AbstractPreferenceController;
import org.junit.Before;
import org.junit.Test;
@@ -57,28 +73,12 @@
import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.robolectric.annotation.Config;
import org.robolectric.Robolectric;
import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
import java.util.ArrayList;
-
-import static com.android.settings.fuelgauge.PowerUsageSummary.MENU_ADDITIONAL_BATTERY_INFO;
-import static com.android.settings.fuelgauge.PowerUsageSummary.MENU_HIGH_POWER_APPS;
-import static com.android.settings.fuelgauge.PowerUsageSummary.MENU_TOGGLE_APPS;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
+import java.util.List;
/**
* Unit tests for {@link PowerUsageSummary}.
@@ -440,7 +440,7 @@
fragment.getPreferenceScreenResId());
final List<String> preferenceKeys = new ArrayList<>();
- for (PreferenceController controller : fragment.getPreferenceControllers(context)) {
+ for (AbstractPreferenceController controller : fragment.getPreferenceControllers(context)) {
preferenceKeys.add(controller.getPreferenceKey());
}
diff --git a/tests/robotests/src/com/android/settings/gestures/AssistGestureSettingsTest.java b/tests/robotests/src/com/android/settings/gestures/AssistGestureSettingsTest.java
index 17fa17b..6ce3a00 100644
--- a/tests/robotests/src/com/android/settings/gestures/AssistGestureSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/AssistGestureSettingsTest.java
@@ -16,14 +16,18 @@
package com.android.settings.gestures;
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
import android.content.Context;
import android.provider.SearchIndexableResource;
import com.android.settings.R;
+import com.android.settings.TestConfig;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settings.TestConfig;
-import com.android.settings.core.PreferenceController;
+import com.android.settingslib.core.AbstractPreferenceController;
import org.junit.Before;
import org.junit.Test;
@@ -35,9 +39,6 @@
import java.util.List;
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.when;
-
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class AssistGestureSettingsTest {
@@ -64,7 +65,7 @@
@Test
public void testGetPreferenceControllers_shouldAllBeCreated() {
- final List<PreferenceController> controllers =
+ final List<AbstractPreferenceController> controllers =
mSettings.getPreferenceControllers(mContext);
assertThat(controllers.isEmpty()).isFalse();
}
diff --git a/tests/robotests/src/com/android/settings/gestures/SwipeToNotificationSettingsTest.java b/tests/robotests/src/com/android/settings/gestures/SwipeToNotificationSettingsTest.java
index e2ed14d..0b329d3 100644
--- a/tests/robotests/src/com/android/settings/gestures/SwipeToNotificationSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/SwipeToNotificationSettingsTest.java
@@ -16,13 +16,15 @@
package com.android.settings.gestures;
+import static com.google.common.truth.Truth.assertThat;
+
import android.content.Context;
import android.provider.SearchIndexableResource;
import com.android.settings.R;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settingslib.core.AbstractPreferenceController;
import org.junit.Before;
import org.junit.Test;
@@ -34,8 +36,6 @@
import java.util.List;
-import static com.google.common.truth.Truth.assertThat;
-
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class SwipeToNotificationSettingsTest {
@@ -58,7 +58,8 @@
@Test
public void testGetPreferenceControllers_shouldAllBeCreated() {
- final List<PreferenceController> controllers = mFragment.getPreferenceControllers(mContext);
+ final List<AbstractPreferenceController> controllers =
+ mFragment.getPreferenceControllers(mContext);
assertThat(controllers.isEmpty()).isFalse();
}
diff --git a/tests/robotests/src/com/android/settings/language/LanguageAndInputSettingsTest.java b/tests/robotests/src/com/android/settings/language/LanguageAndInputSettingsTest.java
index e229653..70cb821 100644
--- a/tests/robotests/src/com/android/settings/language/LanguageAndInputSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/language/LanguageAndInputSettingsTest.java
@@ -16,6 +16,16 @@
package com.android.settings.language;
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
import android.app.Activity;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
@@ -32,13 +42,13 @@
import com.android.internal.hardware.AmbientDisplayConfiguration;
import com.android.settings.R;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
-import com.android.settings.core.PreferenceController;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.testutils.FakeFeatureFactory;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.XmlTestUtils;
import com.android.settings.testutils.shadow.ShadowSecureSettings;
+import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
@@ -54,15 +64,6 @@
import java.util.ArrayList;
import java.util.List;
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class LanguageAndInputSettingsTest {
@@ -107,10 +108,10 @@
@Test
public void testGetPreferenceControllers_shouldRegisterLifecycleObservers() {
- final List<PreferenceController> controllers =
+ final List<AbstractPreferenceController> controllers =
mFragment.getPreferenceControllers(mActivity);
int lifecycleObserverCount = 0;
- for (PreferenceController controller : controllers) {
+ for (AbstractPreferenceController controller : controllers) {
if (controller instanceof LifecycleObserver) {
lifecycleObserverCount++;
}
@@ -121,7 +122,7 @@
@Test
public void testGetPreferenceControllers_shouldAllBeCreated() {
- final List<PreferenceController> controllers =
+ final List<AbstractPreferenceController> controllers =
mFragment.getPreferenceControllers(mActivity);
assertThat(controllers.isEmpty()).isFalse();
@@ -203,7 +204,7 @@
fragment.getPreferenceScreenResId());
final List<String> preferenceKeys = new ArrayList<>();
- for (PreferenceController controller : fragment.getPreferenceControllers(context)) {
+ for (AbstractPreferenceController controller : fragment.getPreferenceControllers(context)) {
preferenceKeys.add(controller.getPreferenceKey());
}
diff --git a/tests/robotests/src/com/android/settings/search/BaseSearchIndexProviderTest.java b/tests/robotests/src/com/android/settings/search/BaseSearchIndexProviderTest.java
index ff39deb..6c6d7ab 100644
--- a/tests/robotests/src/com/android/settings/search/BaseSearchIndexProviderTest.java
+++ b/tests/robotests/src/com/android/settings/search/BaseSearchIndexProviderTest.java
@@ -17,13 +17,19 @@
package com.android.settings.search;
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+
import android.content.Context;
import android.provider.SearchIndexableResource;
import com.android.settings.R;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
import org.junit.Before;
import org.junit.Test;
@@ -38,10 +44,6 @@
import java.util.Collections;
import java.util.List;
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class BaseSearchIndexProviderTest {
@@ -63,39 +65,53 @@
assertThat(mIndexProvider.getNonIndexableKeys(mContext)).isEmpty();
}
+ public static class AvailablePreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
+ public AvailablePreferenceController(Context context) {
+ super(context);
+ }
+
+ @Override
+ public boolean isAvailable() {
+ return true;
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return TEST_PREF_KEY;
+ }
+ }
+
@Test
public void getNonIndexableKeys_preferenceIsAvailable_shouldReturnEmptyList() {
- List<PreferenceController> controllers = new ArrayList<>();
- controllers.add(new PreferenceController(mContext) {
- @Override
- public boolean isAvailable() {
- return true;
- }
-
- @Override
- public String getPreferenceKey() {
- return TEST_PREF_KEY;
- }
- });
+ List<AbstractPreferenceController> controllers = new ArrayList<>();
+ controllers.add(new AvailablePreferenceController(mContext));
doReturn(controllers).when(mIndexProvider).getPreferenceControllers(mContext);
assertThat(mIndexProvider.getNonIndexableKeys(mContext)).isEqualTo(Collections.EMPTY_LIST);
}
+ public static class NotAvailablePreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
+ public NotAvailablePreferenceController(Context context) {
+ super(context);
+ }
+
+ @Override
+ public boolean isAvailable() {
+ return false;
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return TEST_PREF_KEY;
+ }
+ }
+
@Test
public void getNonIndexableKeys_preferenceIsNotAvailable_shouldReturnKey() {
- List<PreferenceController> controllers = new ArrayList<>();
- controllers.add(new PreferenceController(mContext) {
- @Override
- public boolean isAvailable() {
- return false;
- }
-
- @Override
- public String getPreferenceKey() {
- return TEST_PREF_KEY;
- }
- });
+ List<AbstractPreferenceController> controllers = new ArrayList<>();
+ controllers.add(new NotAvailablePreferenceController(mContext));
doReturn(controllers).when(mIndexProvider).getPreferenceControllers(mContext);
assertThat(mIndexProvider.getNonIndexableKeys(mContext)).contains(TEST_PREF_KEY);
diff --git a/tests/robotests/src/com/android/settings/search/DatabaseIndexingUtilsTest.java b/tests/robotests/src/com/android/settings/search/DatabaseIndexingUtilsTest.java
index d44ecff..3bfa936 100644
--- a/tests/robotests/src/com/android/settings/search/DatabaseIndexingUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/search/DatabaseIndexingUtilsTest.java
@@ -25,7 +25,7 @@
import com.android.internal.hardware.AmbientDisplayConfiguration;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
-import com.android.settings.core.PreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.deviceinfo.SystemUpdatePreferenceController;
import org.junit.Before;
@@ -67,7 +67,7 @@
@Test
public void testGetPreferenceControllerUriMap_CompatibleClass_ReturnsValidMap() {
final String className = "com.android.settings.system.SystemDashboardFragment";
- final Map<String, PreferenceController> map =
+ final Map<String, PreferenceControllerMixin> map =
DatabaseIndexingUtils.getPreferenceControllerUriMap(className, mContext);
assertThat(map.get("system_update_settings"))
.isInstanceOf(SystemUpdatePreferenceController.class);
@@ -82,23 +82,13 @@
@Test
public void testGetPayloadFromMap_MatchingKey_ReturnsPayload() {
final String key = "key";
- PreferenceController prefController = new PreferenceController(mContext) {
- @Override
- public boolean isAvailable() {
- return false;
- }
-
- @Override
- public String getPreferenceKey() {
- return key;
- }
-
+ PreferenceControllerMixin prefController = new PreferenceControllerMixin() {
@Override
public ResultPayload getResultPayload() {
return new ResultPayload(null);
}
};
- ArrayMap<String, PreferenceController> map = new ArrayMap<>();
+ ArrayMap<String, PreferenceControllerMixin> map = new ArrayMap<>();
map.put(key, prefController);
ResultPayload payload = DatabaseIndexingUtils.getPayloadFromUriMap(map, key);
diff --git a/tests/robotests/src/com/android/settings/search/FakeIndexProvider.java b/tests/robotests/src/com/android/settings/search/FakeIndexProvider.java
index 69c2589..b2a1553 100644
--- a/tests/robotests/src/com/android/settings/search/FakeIndexProvider.java
+++ b/tests/robotests/src/com/android/settings/search/FakeIndexProvider.java
@@ -20,7 +20,7 @@
import android.content.Context;
import android.provider.SearchIndexableResource;
-import com.android.settings.core.PreferenceController;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.List;
@@ -44,7 +44,7 @@
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return null;
}
};