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;
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;
}
@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);
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;
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;
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getActivity(), this /* fragment */,
getLifecycle());
}
}
};
- 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));
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /*activity */,
null /* fragment */, null /* lifecycle */);
}
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;
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;
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle());
}
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));
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null);
}
};
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;
}
@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);
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";
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;
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";
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";
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";
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";
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";
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;
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";
*/
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;
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";
}
@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);
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;
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context);
}
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));
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context);
}
};
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;
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
final Activity activity = getActivity();
final Application app;
if (activity != null) {
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));
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(
+ Context context) {
return buildPreferenceControllers(context, null, null /* host */);
}
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";
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;
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;
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;
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";
@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);
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;
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;
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return null;
}
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";
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;
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";
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;
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";
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;
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";
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;
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle());
}
.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));
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(
+ Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
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";
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" ;
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;
}
/**
- * 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;
}
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;
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;
* 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;
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;
}
@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);
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";
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";
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";
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;
}
@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);
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";
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;
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;
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;
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
}
@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,
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;
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;
}
@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);
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;
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;
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return null;
}
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;
}
@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);
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";
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;
*/
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());
+ }
+ }
}
/**
*
* 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;
}
}
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;
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<>();
.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);
}
}
@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;
}
}
}
- 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);
}
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
}
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);
}
}
* 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;
}
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
* 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";
*
* 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 {
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;
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";
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();
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";
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();
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";
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";
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";
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
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
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";
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";
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";
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;
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";
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";
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;
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";
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";
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";
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);
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";
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");
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";
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";
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";
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;
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;
private StorageSummaryDonutPreferenceController mSummaryController;
private StorageItemPreferenceController mPreferenceController;
private PrivateVolumeOptionMenuController mOptionMenuController;
- private List<PreferenceController> mSecondaryUsers;
+ private List<AbstractPreferenceController> mSecondaryUsers;
@Override
public void onCreate(Bundle icicle) {
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);
}
@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);
/**
* 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;
}
@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)));
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;
}
@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));
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";
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";
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;
* 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_";
* @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();
/**
* 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
}
}
- private static class NoSecondaryUserController extends PreferenceController {
+ private static class NoSecondaryUserController extends AbstractPreferenceController implements
+ PreferenceControllerMixin {
public NoSecondaryUserController(Context context) {
super(context);
}
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;
* 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/*";
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;
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;
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();
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";
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();
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;
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));
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle(),
new AmbientDisplayConfiguration(context), mMetricsFeatureProvider);
}
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null,
new AmbientDisplayConfiguration(context), null);
}
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;
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;
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;
* 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";
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;
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";
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";
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";
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";
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";
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";
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";
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";
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";
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;
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";
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";
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";
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";
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";
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;
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";
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context);
}
}
}
- 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));
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context);
}
};
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;
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;
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;
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;
}
@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);
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;
* 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;
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;
}
@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(
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */, false /* async */);
}
};
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;
}
@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());
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;
/**
* 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;
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;
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;
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;
}
@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);
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;
* {@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";
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";
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;
/**
* 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";
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";
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;
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;
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;
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return null;
}
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;
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return null;
}
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;
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;
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;
}
@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);
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;
int getPreferenceResourceId();
/** Returns a list of additional preference controllers */
- List<PreferenceController> getControllers(Context context, Lifecycle lifecycle);
+ List<AbstractPreferenceController> getControllers(Context context, Lifecycle lifecycle);
}
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;
}
@Override
- public List<PreferenceController> getControllers(Context context, Lifecycle lifecycle) {
+ public List<AbstractPreferenceController> getControllers(Context context, Lifecycle lifecycle) {
return new ArrayList<>();
}
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;
}
@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));
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
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;
}
@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;
}
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
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;
}
@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;
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
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;
}
@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));
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
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;
}
@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;
}
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
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;
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;
}
@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;
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
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;
}
@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;
}
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
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";
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;
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;
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";
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;
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;
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;
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
if (mAmbientDisplayConfig == null) {
mAmbientDisplayConfig = new AmbientDisplayConfiguration(context);
}
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));
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null,
new AmbientDisplayConfiguration(context));
}
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";
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";
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";
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;
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;
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;
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;
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";
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;
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();
*/
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;
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 {
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
final AirplaneModePreferenceController airplaneModePreferenceController =
new AirplaneModePreferenceController(context, this /* fragment */);
final MobilePlanPreferenceController mobilePlanPreferenceController =
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));
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;
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";
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";
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;
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";
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;
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()
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;
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;
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";
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;
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";
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";
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";
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;
}
@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 =
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null);
}
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;
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;
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";
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";
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);
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;
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;
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, this, mVolumeCallback, getLifecycle());
}
}
}
- 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));
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* fragment */,
null /* callback */, null /* lifecycle */);
}
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;
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";
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;
// 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 {
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return null;
}
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;
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
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;
/**
* @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;
// 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;
}
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;
/**
* @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);
}
}
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;
}
@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,
}
@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(
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();
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";
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;
}
@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));
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
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;
}
@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));
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context);
}
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";
*/
package com.android.settings.wifi;
-import static android.content.Context.NETWORK_SCORE_SERVICE;
import static android.content.Context.WIFI_SERVICE;
import android.content.Context;
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;
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;
}
@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));
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;
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;
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";
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";
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;
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";
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;
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;
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;
* 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);
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;
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
ConnectivityManager cm = context.getSystemService(ConnectivityManager.class);
mWifiDetailPreferenceController = new WifiDetailPreferenceController(
mAccessPoint,
context.getSystemService(WifiManager.class),
mMetricsFeatureProvider);
- ArrayList<PreferenceController> controllers = new ArrayList(1);
+ ArrayList<AbstractPreferenceController> controllers = new ArrayList(1);
controllers.add(mWifiDetailPreferenceController);
return controllers;
}
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;
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;
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";
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;
}
@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 =
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();
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 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";
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;
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 {
}
@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);
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;
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 {
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
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;
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return null;
}
}
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;
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) {
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;
@Test
public void onAttach_shouldCreatePlaceholderPreferenceController() {
- final PreferenceController controller = mTestFragment.getPreferenceController(
+ final AbstractPreferenceController controller = mTestFragment.getPreferenceController(
DashboardTilePlaceholderPreferenceController.class);
assertThat(controller).isNotNull();
@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);
verify(mockController2).getPreferenceKey();
}
- public static class TestPreferenceController extends PreferenceController {
+ public static class TestPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
public TestPreferenceController(Context context) {
super(context);
private final PreferenceManager mPreferenceManager;
private final Context mContext;
- private final List<PreferenceController> mControllers;
+ private final List<AbstractPreferenceController> mControllers;
public final PreferenceScreen mScreen;
}
@Override
- protected List<PreferenceController> getPreferenceControllers(Context context) {
+ protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return mControllers;
}
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;
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;
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);
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);
when(mUserManager.getPrimaryUser()).thenReturn(mPrimaryUser);
when(mUserManager.getUsers()).thenReturn(userInfos);
- List<PreferenceController> controllers =
+ List<AbstractPreferenceController> controllers =
SecondaryUserController.getSecondaryUserControllers(mContext, mUserManager);
assertThat(controllers).hasSize(2);
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);
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;
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;
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 {
@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;
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;
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}.
*/
@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);
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);
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) {
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;
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 {
@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;
*/
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;
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;
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}.
fragment.getPreferenceScreenResId());
final List<String> preferenceKeys = new ArrayList<>();
- for (PreferenceController controller : fragment.getPreferenceControllers(context)) {
+ for (AbstractPreferenceController controller : fragment.getPreferenceControllers(context)) {
preferenceKeys.add(controller.getPreferenceKey());
}
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;
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 {
@Test
public void testGetPreferenceControllers_shouldAllBeCreated() {
- final List<PreferenceController> controllers =
+ final List<AbstractPreferenceController> controllers =
mSettings.getPreferenceControllers(mContext);
assertThat(controllers.isEmpty()).isFalse();
}
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;
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 {
@Test
public void testGetPreferenceControllers_shouldAllBeCreated() {
- final List<PreferenceController> controllers = mFragment.getPreferenceControllers(mContext);
+ final List<AbstractPreferenceController> controllers =
+ mFragment.getPreferenceControllers(mContext);
assertThat(controllers.isEmpty()).isFalse();
}
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;
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;
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 {
@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++;
}
@Test
public void testGetPreferenceControllers_shouldAllBeCreated() {
- final List<PreferenceController> controllers =
+ final List<AbstractPreferenceController> controllers =
mFragment.getPreferenceControllers(mActivity);
assertThat(controllers.isEmpty()).isFalse();
fragment.getPreferenceScreenResId());
final List<String> preferenceKeys = new ArrayList<>();
- for (PreferenceController controller : fragment.getPreferenceControllers(context)) {
+ for (AbstractPreferenceController controller : fragment.getPreferenceControllers(context)) {
preferenceKeys.add(controller.getPreferenceKey());
}
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;
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 {
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);
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;
@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);
@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);
import android.content.Context;
import android.provider.SearchIndexableResource;
-import com.android.settings.core.PreferenceController;
+import com.android.settingslib.core.AbstractPreferenceController;
import java.util.List;
}
@Override
- public List<PreferenceController> getPreferenceControllers(Context context) {
+ public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return null;
}
};