Migrate to TwoStatePreference
SwitchPreference and SwitchPreferenceCompat are both TwoStatePreference. Using TwoStatePreference in Java will helps migration in the future. Bug: 306771414 Test: manual - check Settings pages Change-Id: I84e1d7b09451106797c2b23d127855c6976678ca
This commit is contained in:
@@ -53,7 +53,7 @@ import android.widget.TextView;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.network.ProxySubscriptionManager;
|
import com.android.settings.network.ProxySubscriptionManager;
|
||||||
import com.android.settings.network.SubscriptionUtil;
|
import com.android.settings.network.SubscriptionUtil;
|
||||||
@@ -122,7 +122,7 @@ public class IccLockSettings extends SettingsPreferenceFragment
|
|||||||
private ProxySubscriptionManager mProxySubscriptionMgr;
|
private ProxySubscriptionManager mProxySubscriptionMgr;
|
||||||
|
|
||||||
private EditPinPreference mPinDialog;
|
private EditPinPreference mPinDialog;
|
||||||
private SwitchPreference mPinToggle;
|
private TwoStatePreference mPinToggle;
|
||||||
|
|
||||||
private Resources mRes;
|
private Resources mRes;
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ public class IccLockSettings extends SettingsPreferenceFragment
|
|||||||
addPreferencesFromResource(R.xml.sim_lock_settings);
|
addPreferencesFromResource(R.xml.sim_lock_settings);
|
||||||
|
|
||||||
mPinDialog = (EditPinPreference) findPreference(PIN_DIALOG);
|
mPinDialog = (EditPinPreference) findPreference(PIN_DIALOG);
|
||||||
mPinToggle = (SwitchPreference) findPreference(PIN_TOGGLE);
|
mPinToggle = (TwoStatePreference) findPreference(PIN_TOGGLE);
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
if (savedInstanceState.containsKey(DIALOG_STATE)
|
if (savedInstanceState.containsKey(DIALOG_STATE)
|
||||||
&& restoreDialogStates(savedInstanceState)) {
|
&& restoreDialogStates(savedInstanceState)) {
|
||||||
|
@@ -24,7 +24,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceCategory;
|
import androidx.preference.PreferenceCategory;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.dashboard.DashboardFragment;
|
import com.android.settings.dashboard.DashboardFragment;
|
||||||
@@ -49,8 +49,8 @@ public class ColorAndMotionFragment extends DashboardFragment {
|
|||||||
private static final String TOGGLE_LARGE_POINTER_ICON = "toggle_large_pointer_icon";
|
private static final String TOGGLE_LARGE_POINTER_ICON = "toggle_large_pointer_icon";
|
||||||
|
|
||||||
private Preference mDisplayDaltonizerPreferenceScreen;
|
private Preference mDisplayDaltonizerPreferenceScreen;
|
||||||
private SwitchPreference mToggleDisableAnimationsPreference;
|
private TwoStatePreference mToggleDisableAnimationsPreference;
|
||||||
private SwitchPreference mToggleLargePointerIconPreference;
|
private TwoStatePreference mToggleLargePointerIconPreference;
|
||||||
private AccessibilitySettingsContentObserver mSettingsContentObserver;
|
private AccessibilitySettingsContentObserver mSettingsContentObserver;
|
||||||
|
|
||||||
private final List<String> mShortcutFeatureKeys = new ArrayList<>();
|
private final List<String> mShortcutFeatureKeys = new ArrayList<>();
|
||||||
|
@@ -26,7 +26,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.TogglePreferenceController;
|
import com.android.settings.core.TogglePreferenceController;
|
||||||
@@ -62,7 +62,7 @@ public class DisableAnimationsPreferenceController extends TogglePreferenceContr
|
|||||||
};
|
};
|
||||||
|
|
||||||
private final ContentResolver mContentResolver;
|
private final ContentResolver mContentResolver;
|
||||||
private SwitchPreference mPreference;
|
private TwoStatePreference mPreference;
|
||||||
|
|
||||||
public DisableAnimationsPreferenceController(Context context, String preferenceKey) {
|
public DisableAnimationsPreferenceController(Context context, String preferenceKey) {
|
||||||
super(context, preferenceKey);
|
super(context, preferenceKey);
|
||||||
|
@@ -26,7 +26,7 @@ import android.provider.Settings;
|
|||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.BasePreferenceController;
|
import com.android.settings.core.BasePreferenceController;
|
||||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||||
@@ -45,7 +45,7 @@ public class FloatingMenuFadePreferenceController extends BasePreferenceControll
|
|||||||
final ContentObserver mContentObserver;
|
final ContentObserver mContentObserver;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
SwitchPreference mPreference;
|
TwoStatePreference mPreference;
|
||||||
|
|
||||||
public FloatingMenuFadePreferenceController(Context context, String preferenceKey) {
|
public FloatingMenuFadePreferenceController(Context context, String preferenceKey) {
|
||||||
super(context, preferenceKey);
|
super(context, preferenceKey);
|
||||||
@@ -81,7 +81,7 @@ public class FloatingMenuFadePreferenceController extends BasePreferenceControll
|
|||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
super.updateState(preference);
|
super.updateState(preference);
|
||||||
final SwitchPreference switchPreference = (SwitchPreference) preference;
|
final TwoStatePreference switchPreference = (TwoStatePreference) preference;
|
||||||
|
|
||||||
switchPreference.setChecked(getFloatingMenuFadeValue() == ON);
|
switchPreference.setChecked(getFloatingMenuFadeValue() == ON);
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ import android.content.Context;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.accessibility.TextReadingPreferenceFragment.EntryPoint;
|
import com.android.settings.accessibility.TextReadingPreferenceFragment.EntryPoint;
|
||||||
@@ -32,7 +32,7 @@ import com.android.settings.core.instrumentation.SettingsStatsLog;
|
|||||||
*/
|
*/
|
||||||
public class HighTextContrastPreferenceController extends TogglePreferenceController implements
|
public class HighTextContrastPreferenceController extends TogglePreferenceController implements
|
||||||
TextReadingResetController.ResetStateListener {
|
TextReadingResetController.ResetStateListener {
|
||||||
private SwitchPreference mSwitchPreference;
|
private TwoStatePreference mSwitchPreference;
|
||||||
|
|
||||||
@EntryPoint
|
@EntryPoint
|
||||||
private int mEntryPoint;
|
private int mEntryPoint;
|
||||||
|
@@ -37,7 +37,7 @@ import androidx.lifecycle.DefaultLifecycleObserver;
|
|||||||
import androidx.lifecycle.LifecycleOwner;
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.TogglePreferenceController;
|
import com.android.settings.core.TogglePreferenceController;
|
||||||
@@ -59,7 +59,7 @@ public class KeyboardVibrationTogglePreferenceController extends TogglePreferenc
|
|||||||
private final Vibrator mVibrator;
|
private final Vibrator mVibrator;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private SwitchPreference mPreference;
|
private TwoStatePreference mPreference;
|
||||||
|
|
||||||
public KeyboardVibrationTogglePreferenceController(Context context, String preferenceKey) {
|
public KeyboardVibrationTogglePreferenceController(Context context, String preferenceKey) {
|
||||||
super(context, preferenceKey);
|
super(context, preferenceKey);
|
||||||
|
@@ -26,7 +26,7 @@ import androidx.lifecycle.Lifecycle;
|
|||||||
import androidx.lifecycle.LifecycleObserver;
|
import androidx.lifecycle.LifecycleObserver;
|
||||||
import androidx.lifecycle.OnLifecycleEvent;
|
import androidx.lifecycle.OnLifecycleEvent;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.TogglePreferenceController;
|
import com.android.settings.core.TogglePreferenceController;
|
||||||
@@ -43,7 +43,7 @@ public class MagnificationAlwaysOnPreferenceController extends TogglePreferenceC
|
|||||||
MagnificationAlwaysOnPreferenceController.class.getSimpleName();
|
MagnificationAlwaysOnPreferenceController.class.getSimpleName();
|
||||||
static final String PREF_KEY = Settings.Secure.ACCESSIBILITY_MAGNIFICATION_ALWAYS_ON_ENABLED;
|
static final String PREF_KEY = Settings.Secure.ACCESSIBILITY_MAGNIFICATION_ALWAYS_ON_ENABLED;
|
||||||
|
|
||||||
private SwitchPreference mSwitchPreference;
|
private TwoStatePreference mSwitchPreference;
|
||||||
|
|
||||||
public MagnificationAlwaysOnPreferenceController(Context context, String preferenceKey) {
|
public MagnificationAlwaysOnPreferenceController(Context context, String preferenceKey) {
|
||||||
super(context, preferenceKey);
|
super(context, preferenceKey);
|
||||||
|
@@ -26,7 +26,7 @@ import androidx.lifecycle.Lifecycle;
|
|||||||
import androidx.lifecycle.LifecycleObserver;
|
import androidx.lifecycle.LifecycleObserver;
|
||||||
import androidx.lifecycle.OnLifecycleEvent;
|
import androidx.lifecycle.OnLifecycleEvent;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.TogglePreferenceController;
|
import com.android.settings.core.TogglePreferenceController;
|
||||||
@@ -39,7 +39,7 @@ public class MagnificationFollowTypingPreferenceController extends TogglePrefere
|
|||||||
MagnificationFollowTypingPreferenceController.class.getSimpleName();
|
MagnificationFollowTypingPreferenceController.class.getSimpleName();
|
||||||
static final String PREF_KEY = "magnification_follow_typing";
|
static final String PREF_KEY = "magnification_follow_typing";
|
||||||
|
|
||||||
private SwitchPreference mFollowTypingPreference;
|
private TwoStatePreference mFollowTypingPreference;
|
||||||
|
|
||||||
public MagnificationFollowTypingPreferenceController(Context context, String preferenceKey) {
|
public MagnificationFollowTypingPreferenceController(Context context, String preferenceKey) {
|
||||||
super(context, preferenceKey);
|
super(context, preferenceKey);
|
||||||
|
@@ -26,7 +26,7 @@ import androidx.lifecycle.Lifecycle;
|
|||||||
import androidx.lifecycle.LifecycleObserver;
|
import androidx.lifecycle.LifecycleObserver;
|
||||||
import androidx.lifecycle.OnLifecycleEvent;
|
import androidx.lifecycle.OnLifecycleEvent;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.TogglePreferenceController;
|
import com.android.settings.core.TogglePreferenceController;
|
||||||
@@ -41,7 +41,7 @@ public class MagnificationJoystickPreferenceController extends TogglePreferenceC
|
|||||||
MagnificationJoystickPreferenceController.class.getSimpleName();
|
MagnificationJoystickPreferenceController.class.getSimpleName();
|
||||||
static final String PREF_KEY = Settings.Secure.ACCESSIBILITY_MAGNIFICATION_JOYSTICK_ENABLED;
|
static final String PREF_KEY = Settings.Secure.ACCESSIBILITY_MAGNIFICATION_JOYSTICK_ENABLED;
|
||||||
|
|
||||||
private SwitchPreference mSwitchPreference;
|
private TwoStatePreference mSwitchPreference;
|
||||||
|
|
||||||
public MagnificationJoystickPreferenceController(Context context, String preferenceKey) {
|
public MagnificationJoystickPreferenceController(Context context, String preferenceKey) {
|
||||||
super(context, preferenceKey);
|
super(context, preferenceKey);
|
||||||
|
@@ -33,7 +33,7 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.preference.PreferenceCategory;
|
import androidx.preference.PreferenceCategory;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
|
import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
|
||||||
@@ -102,7 +102,7 @@ public class ToggleReduceBrightColorsPreferenceFragment extends ToggleFeaturePre
|
|||||||
getPreferenceScreen().removePreference(intensity);
|
getPreferenceScreen().removePreference(intensity);
|
||||||
intensity.setOrder(mShortcutPreference.getOrder() - 2);
|
intensity.setOrder(mShortcutPreference.getOrder() - 2);
|
||||||
generalCategory.addPreference(intensity);
|
generalCategory.addPreference(intensity);
|
||||||
final SwitchPreference persist = findPreference(KEY_PERSIST);
|
final TwoStatePreference persist = findPreference(KEY_PERSIST);
|
||||||
getPreferenceScreen().removePreference(persist);
|
getPreferenceScreen().removePreference(persist);
|
||||||
persist.setOrder(mShortcutPreference.getOrder() - 1);
|
persist.setOrder(mShortcutPreference.getOrder() - 1);
|
||||||
generalCategory.addPreference(persist);
|
generalCategory.addPreference(persist);
|
||||||
|
@@ -38,7 +38,7 @@ import androidx.appcompat.app.AlertDialog;
|
|||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||||
import androidx.preference.Preference.OnPreferenceClickListener;
|
import androidx.preference.Preference.OnPreferenceClickListener;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.applications.AppStateUsageBridge.UsageState;
|
import com.android.settings.applications.AppStateUsageBridge.UsageState;
|
||||||
@@ -57,7 +57,7 @@ public class UsageAccessDetails extends AppInfoWithHeader implements OnPreferenc
|
|||||||
// TODO: Break out this functionality into its own class.
|
// TODO: Break out this functionality into its own class.
|
||||||
private AppStateUsageBridge mUsageBridge;
|
private AppStateUsageBridge mUsageBridge;
|
||||||
private AppOpsManager mAppOpsManager;
|
private AppOpsManager mAppOpsManager;
|
||||||
private SwitchPreference mSwitchPref;
|
private TwoStatePreference mSwitchPref;
|
||||||
private Preference mUsageDesc;
|
private Preference mUsageDesc;
|
||||||
private Intent mSettingsIntent;
|
private Intent mSettingsIntent;
|
||||||
private UsageState mUsageState;
|
private UsageState mUsageState;
|
||||||
@@ -78,7 +78,7 @@ public class UsageAccessDetails extends AppInfoWithHeader implements OnPreferenc
|
|||||||
mDpm = context.getSystemService(DevicePolicyManager.class);
|
mDpm = context.getSystemService(DevicePolicyManager.class);
|
||||||
|
|
||||||
addPreferencesFromResource(R.xml.app_ops_permissions_details);
|
addPreferencesFromResource(R.xml.app_ops_permissions_details);
|
||||||
mSwitchPref = (SwitchPreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
|
mSwitchPref = (TwoStatePreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
|
||||||
mUsageDesc = findPreference(KEY_APP_OPS_SETTINGS_DESC);
|
mUsageDesc = findPreference(KEY_APP_OPS_SETTINGS_DESC);
|
||||||
|
|
||||||
getPreferenceScreen().setTitle(R.string.usage_access);
|
getPreferenceScreen().setTitle(R.string.usage_access);
|
||||||
|
@@ -23,12 +23,13 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||||
import androidx.preference.Preference.OnPreferenceClickListener;
|
import androidx.preference.Preference.OnPreferenceClickListener;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
@@ -50,7 +51,8 @@ public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenc
|
|||||||
// TODO: Break out this functionality into its own class.
|
// TODO: Break out this functionality into its own class.
|
||||||
private AppStateOverlayBridge mOverlayBridge;
|
private AppStateOverlayBridge mOverlayBridge;
|
||||||
private AppOpsManager mAppOpsManager;
|
private AppOpsManager mAppOpsManager;
|
||||||
private SwitchPreference mSwitchPref;
|
@Nullable
|
||||||
|
private TwoStatePreference mSwitchPref = null;
|
||||||
private OverlayState mOverlayState;
|
private OverlayState mOverlayState;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -37,7 +37,7 @@ import android.util.Slog;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ public final class HibernationSwitchPreferenceController extends AppInfoPreferen
|
|||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
super.updateState(preference);
|
super.updateState(preference);
|
||||||
((SwitchPreference) preference).setChecked(isAppEligibleForHibernation()
|
((TwoStatePreference) preference).setChecked(isAppEligibleForHibernation()
|
||||||
&& !isPackageHibernationExemptByUser());
|
&& !isPackageHibernationExemptByUser());
|
||||||
preference.setEnabled(isAppEligibleForHibernation());
|
preference.setEnabled(isAppEligibleForHibernation());
|
||||||
if (!mHibernationEligibilityLoaded) {
|
if (!mHibernationEligibilityLoaded) {
|
||||||
|
@@ -27,7 +27,7 @@ import androidx.appcompat.app.AlertDialog;
|
|||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||||
import androidx.preference.Preference.OnPreferenceClickListener;
|
import androidx.preference.Preference.OnPreferenceClickListener;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.applications.AppInfoWithHeader;
|
import com.android.settings.applications.AppInfoWithHeader;
|
||||||
@@ -47,7 +47,7 @@ public class ManageExternalStorageDetails extends AppInfoWithHeader implements
|
|||||||
|
|
||||||
private AppStateManageExternalStorageBridge mBridge;
|
private AppStateManageExternalStorageBridge mBridge;
|
||||||
private AppOpsManager mAppOpsManager;
|
private AppOpsManager mAppOpsManager;
|
||||||
private SwitchPreference mSwitchPref;
|
private TwoStatePreference mSwitchPref;
|
||||||
private PermissionState mPermissionState;
|
private PermissionState mPermissionState;
|
||||||
private MetricsFeatureProvider mMetricsFeatureProvider;
|
private MetricsFeatureProvider mMetricsFeatureProvider;
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@ import android.os.Bundle;
|
|||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.applications.AppInfoWithHeader;
|
import com.android.settings.applications.AppInfoWithHeader;
|
||||||
@@ -41,7 +41,7 @@ public class MediaManagementAppsDetails extends AppInfoWithHeader implements
|
|||||||
|
|
||||||
private AppStateMediaManagementAppsBridge mAppBridge;
|
private AppStateMediaManagementAppsBridge mAppBridge;
|
||||||
private AppOpsManager mAppOpsManager;
|
private AppOpsManager mAppOpsManager;
|
||||||
private SwitchPreference mSwitchPref;
|
private TwoStatePreference mSwitchPref;
|
||||||
private PermissionState mPermissionState;
|
private PermissionState mPermissionState;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -28,7 +28,7 @@ import android.os.Bundle;
|
|||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.Settings;
|
import com.android.settings.Settings;
|
||||||
@@ -46,7 +46,7 @@ public class TurnScreenOnDetails extends AppInfoWithHeader implements OnPreferen
|
|||||||
|
|
||||||
private AppStateTurnScreenOnBridge mAppBridge;
|
private AppStateTurnScreenOnBridge mAppBridge;
|
||||||
private AppOpsManager mAppOpsManager;
|
private AppOpsManager mAppOpsManager;
|
||||||
private SwitchPreference mSwitchPref;
|
private TwoStatePreference mSwitchPref;
|
||||||
private AppStateAppOpsBridge.PermissionState mPermissionState;
|
private AppStateAppOpsBridge.PermissionState mPermissionState;
|
||||||
|
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ public class TurnScreenOnDetails extends AppInfoWithHeader implements OnPreferen
|
|||||||
|
|
||||||
// find preferences
|
// find preferences
|
||||||
addPreferencesFromResource(R.xml.turn_screen_on_permissions_details);
|
addPreferencesFromResource(R.xml.turn_screen_on_permissions_details);
|
||||||
mSwitchPref = (SwitchPreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
|
mSwitchPref = (TwoStatePreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
|
||||||
mSwitchPref.setOnPreferenceChangeListener(this);
|
mSwitchPref.setOnPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,7 +24,7 @@ import androidx.appcompat.app.AlertDialog;
|
|||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||||
import androidx.preference.Preference.OnPreferenceClickListener;
|
import androidx.preference.Preference.OnPreferenceClickListener;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.applications.AppInfoWithHeader;
|
import com.android.settings.applications.AppInfoWithHeader;
|
||||||
@@ -43,7 +43,7 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
|
|||||||
// TODO: Break out this functionality into its own class.
|
// TODO: Break out this functionality into its own class.
|
||||||
private AppStateWriteSettingsBridge mAppBridge;
|
private AppStateWriteSettingsBridge mAppBridge;
|
||||||
private AppOpsManager mAppOpsManager;
|
private AppOpsManager mAppOpsManager;
|
||||||
private SwitchPreference mSwitchPref;
|
private TwoStatePreference mSwitchPref;
|
||||||
private WriteSettingsState mWriteSettingsState;
|
private WriteSettingsState mWriteSettingsState;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -28,7 +28,7 @@ import androidx.annotation.VisibleForTesting;
|
|||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.applications.AppInfoWithHeader;
|
import com.android.settings.applications.AppInfoWithHeader;
|
||||||
@@ -41,7 +41,7 @@ public class PictureInPictureDetails extends AppInfoWithHeader
|
|||||||
private static final String KEY_APP_OPS_SETTINGS_SWITCH = "app_ops_settings_switch";
|
private static final String KEY_APP_OPS_SETTINGS_SWITCH = "app_ops_settings_switch";
|
||||||
private static final String LOG_TAG = "PictureInPictureDetails";
|
private static final String LOG_TAG = "PictureInPictureDetails";
|
||||||
|
|
||||||
private SwitchPreference mSwitchPref;
|
private TwoStatePreference mSwitchPref;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -49,7 +49,7 @@ public class PictureInPictureDetails extends AppInfoWithHeader
|
|||||||
|
|
||||||
// find preferences
|
// find preferences
|
||||||
addPreferencesFromResource(R.xml.picture_in_picture_permissions_details);
|
addPreferencesFromResource(R.xml.picture_in_picture_permissions_details);
|
||||||
mSwitchPref = (SwitchPreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
|
mSwitchPref = (TwoStatePreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
|
||||||
|
|
||||||
// set title/summary for all of them
|
// set title/summary for all of them
|
||||||
mSwitchPref.setTitle(R.string.picture_in_picture_app_detail_switch);
|
mSwitchPref.setTitle(R.string.picture_in_picture_app_detail_switch);
|
||||||
|
@@ -16,13 +16,12 @@
|
|||||||
|
|
||||||
package com.android.settings.applications.specialaccess.zenaccess;
|
package com.android.settings.applications.specialaccess.zenaccess;
|
||||||
|
|
||||||
import android.app.ActivityManager;
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.applications.AppInfoWithHeader;
|
import com.android.settings.applications.AppInfoWithHeader;
|
||||||
@@ -66,7 +65,7 @@ public class ZenAccessDetails extends AppInfoWithHeader implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePreference(Context context, SwitchPreference preference) {
|
private void updatePreference(Context context, TwoStatePreference preference) {
|
||||||
final CharSequence label = mPackageInfo.applicationInfo.loadLabel(mPm);
|
final CharSequence label = mPackageInfo.applicationInfo.loadLabel(mPm);
|
||||||
final Set<String> autoApproved = ZenAccessController.getAutoApprovedPackages(context);
|
final Set<String> autoApproved = ZenAccessController.getAutoApprovedPackages(context);
|
||||||
if (autoApproved.contains(mPackageName)) {
|
if (autoApproved.contains(mPackageName)) {
|
||||||
|
@@ -23,7 +23,7 @@ import android.hardware.face.FaceManager.SetFeatureCallback;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ public class FaceSettingsAttentionPreferenceController extends FaceSettingsPrefe
|
|||||||
|
|
||||||
private byte[] mToken;
|
private byte[] mToken;
|
||||||
private FaceManager mFaceManager;
|
private FaceManager mFaceManager;
|
||||||
private SwitchPreference mPreference;
|
private TwoStatePreference mPreference;
|
||||||
|
|
||||||
private final SetFeatureCallback mSetFeatureCallback = new SetFeatureCallback() {
|
private final SetFeatureCallback mSetFeatureCallback = new SetFeatureCallback() {
|
||||||
@Override
|
@Override
|
||||||
|
@@ -60,7 +60,7 @@ import androidx.preference.PreferenceCategory;
|
|||||||
import androidx.preference.PreferenceGroup;
|
import androidx.preference.PreferenceGroup;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.PreferenceViewHolder;
|
import androidx.preference.PreferenceViewHolder;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -615,7 +615,7 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
mRequireScreenOnToAuthPreferenceController.isChecked());
|
mRequireScreenOnToAuthPreferenceController.isChecked());
|
||||||
mRequireScreenOnToAuthPreference.setOnPreferenceChangeListener(
|
mRequireScreenOnToAuthPreference.setOnPreferenceChangeListener(
|
||||||
(preference, newValue) -> {
|
(preference, newValue) -> {
|
||||||
final boolean isChecked = ((SwitchPreference) preference).isChecked();
|
final boolean isChecked = ((TwoStatePreference) preference).isChecked();
|
||||||
mRequireScreenOnToAuthPreferenceController.setChecked(!isChecked);
|
mRequireScreenOnToAuthPreferenceController.setChecked(!isChecked);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@@ -55,7 +55,7 @@ import android.widget.Toast;
|
|||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsActivity;
|
import com.android.settings.SettingsActivity;
|
||||||
@@ -376,16 +376,16 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setSwitchChecked(Preference pref, boolean checked) {
|
private void setSwitchChecked(Preference pref, boolean checked) {
|
||||||
if (pref instanceof PrimarySwitchPreference) {
|
if (pref instanceof PrimarySwitchPreference primarySwitchPreference) {
|
||||||
((PrimarySwitchPreference) pref).setChecked(checked);
|
primarySwitchPreference.setChecked(checked);
|
||||||
} else if (pref instanceof SwitchPreference) {
|
} else if (pref instanceof TwoStatePreference twoStatePreference) {
|
||||||
((SwitchPreference) pref).setChecked(checked);
|
twoStatePreference.setChecked(checked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSwitchEnabled(Preference pref, boolean enabled) {
|
private void setSwitchEnabled(Preference pref, boolean enabled) {
|
||||||
if (pref instanceof PrimarySwitchPreference) {
|
if (pref instanceof PrimarySwitchPreference primarySwitchPreference) {
|
||||||
((PrimarySwitchPreference) pref).setSwitchEnabled(enabled);
|
primarySwitchPreference.setSwitchEnabled(enabled);
|
||||||
} else {
|
} else {
|
||||||
pref.setEnabled(enabled);
|
pref.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
@@ -40,7 +40,7 @@ import androidx.annotation.VisibleForTesting;
|
|||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||||
@@ -83,8 +83,8 @@ public class BillingCycleSettings extends DataUsageBaseFragment implements
|
|||||||
NetworkTemplate mNetworkTemplate;
|
NetworkTemplate mNetworkTemplate;
|
||||||
private Preference mBillingCycle;
|
private Preference mBillingCycle;
|
||||||
private Preference mDataWarning;
|
private Preference mDataWarning;
|
||||||
private SwitchPreference mEnableDataWarning;
|
private TwoStatePreference mEnableDataWarning;
|
||||||
private SwitchPreference mEnableDataLimit;
|
private TwoStatePreference mEnableDataLimit;
|
||||||
private Preference mDataLimit;
|
private Preference mDataLimit;
|
||||||
private DataUsageController mDataUsageController;
|
private DataUsageController mDataUsageController;
|
||||||
|
|
||||||
@@ -93,8 +93,8 @@ public class BillingCycleSettings extends DataUsageBaseFragment implements
|
|||||||
Preference billingCycle,
|
Preference billingCycle,
|
||||||
Preference dataLimit,
|
Preference dataLimit,
|
||||||
Preference dataWarning,
|
Preference dataWarning,
|
||||||
SwitchPreference enableLimit,
|
TwoStatePreference enableLimit,
|
||||||
SwitchPreference enableWarning) {
|
TwoStatePreference enableWarning) {
|
||||||
services.mPolicyEditor = policyEditor;
|
services.mPolicyEditor = policyEditor;
|
||||||
mBillingCycle = billingCycle;
|
mBillingCycle = billingCycle;
|
||||||
mDataLimit = dataLimit;
|
mDataLimit = dataLimit;
|
||||||
@@ -133,10 +133,10 @@ public class BillingCycleSettings extends DataUsageBaseFragment implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
mBillingCycle = findPreference(KEY_BILLING_CYCLE);
|
mBillingCycle = findPreference(KEY_BILLING_CYCLE);
|
||||||
mEnableDataWarning = (SwitchPreference) findPreference(KEY_SET_DATA_WARNING);
|
mEnableDataWarning = (TwoStatePreference) findPreference(KEY_SET_DATA_WARNING);
|
||||||
mEnableDataWarning.setOnPreferenceChangeListener(this);
|
mEnableDataWarning.setOnPreferenceChangeListener(this);
|
||||||
mDataWarning = findPreference(KEY_DATA_WARNING);
|
mDataWarning = findPreference(KEY_DATA_WARNING);
|
||||||
mEnableDataLimit = (SwitchPreference) findPreference(KEY_SET_DATA_LIMIT);
|
mEnableDataLimit = (TwoStatePreference) findPreference(KEY_SET_DATA_LIMIT);
|
||||||
mEnableDataLimit.setOnPreferenceChangeListener(this);
|
mEnableDataLimit.setOnPreferenceChangeListener(this);
|
||||||
mDataLimit = findPreference(KEY_DATA_LIMIT);
|
mDataLimit = findPreference(KEY_DATA_LIMIT);
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,6 @@ import android.text.TextUtils;
|
|||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
|
||||||
import androidx.preference.TwoStatePreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
@@ -52,10 +51,10 @@ public class AutoTimeFormatPreferenceController extends AbstractPreferenceContro
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
if (!(preference instanceof SwitchPreference)) {
|
if (!(preference instanceof TwoStatePreference)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
((SwitchPreference) preference).setChecked(isAutoTimeFormatSelection(mContext));
|
((TwoStatePreference) preference).setChecked(isAutoTimeFormatSelection(mContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -64,7 +63,7 @@ public class AutoTimeFormatPreferenceController extends AbstractPreferenceContro
|
|||||||
|| !TextUtils.equals(KEY_AUTO_24_HOUR, preference.getKey())) {
|
|| !TextUtils.equals(KEY_AUTO_24_HOUR, preference.getKey())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean auto24HourEnabled = ((SwitchPreference) preference).isChecked();
|
boolean auto24HourEnabled = ((TwoStatePreference) preference).isChecked();
|
||||||
Boolean is24Hour;
|
Boolean is24Hour;
|
||||||
if (auto24HourEnabled) {
|
if (auto24HourEnabled) {
|
||||||
is24Hour = null;
|
is24Hour = null;
|
||||||
|
@@ -28,7 +28,7 @@ import android.app.time.TimeManager;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
@@ -77,11 +77,11 @@ public class AutoTimePreferenceController extends AbstractPreferenceController
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
if (!(preference instanceof SwitchPreference)) {
|
if (!(preference instanceof TwoStatePreference)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
((SwitchPreference) preference).setChecked(isEnabled());
|
((TwoStatePreference) preference).setChecked(isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -29,7 +29,7 @@ import android.content.Context;
|
|||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -92,11 +92,11 @@ public class AutoTimeZonePreferenceController extends AbstractPreferenceControll
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
if (!(preference instanceof SwitchPreference)) {
|
if (!(preference instanceof TwoStatePreference)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
((SwitchPreference) preference).setChecked(isEnabled());
|
((TwoStatePreference) preference).setChecked(isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -23,7 +23,6 @@ import android.text.TextUtils;
|
|||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
|
||||||
import androidx.preference.TwoStatePreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
@@ -82,7 +81,7 @@ public class TimeFormatPreferenceController extends AbstractPreferenceController
|
|||||||
|| !TextUtils.equals(KEY_TIME_FORMAT, preference.getKey())) {
|
|| !TextUtils.equals(KEY_TIME_FORMAT, preference.getKey())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final boolean is24Hour = ((SwitchPreference) preference).isChecked();
|
final boolean is24Hour = ((TwoStatePreference) preference).isChecked();
|
||||||
update24HourFormat(mContext, is24Hour);
|
update24HourFormat(mContext, is24Hour);
|
||||||
mUpdateTimeAndDateCallback.updateTimeAndDateDisplay(mContext);
|
mUpdateTimeAndDateCallback.updateTimeAndDateDisplay(mContext);
|
||||||
return true;
|
return true;
|
||||||
|
@@ -20,7 +20,7 @@ import android.content.Context;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ public class AdbAuthorizationTimeoutPreferenceController extends
|
|||||||
Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME);
|
Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME);
|
||||||
// An authTimeout of 0 indicates this preference is enabled and adb authorizations will not
|
// An authTimeout of 0 indicates this preference is enabled and adb authorizations will not
|
||||||
// be automatically revoked.
|
// be automatically revoked.
|
||||||
((SwitchPreference) mPreference).setChecked(authTimeout == 0);
|
((TwoStatePreference) mPreference).setChecked(authTimeout == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -64,7 +64,7 @@ public class AdbAuthorizationTimeoutPreferenceController extends
|
|||||||
public void onDeveloperOptionsSwitchDisabled() {
|
public void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
writeSetting(false);
|
writeSetting(false);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeSetting(boolean isEnabled) {
|
private void writeSetting(boolean isEnabled) {
|
||||||
|
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -59,7 +59,7 @@ public class AllowAppsOnExternalPreferenceController extends DeveloperOptionsPre
|
|||||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.FORCE_ALLOW_ON_EXTERNAL, SETTING_VALUE_OFF);
|
Settings.Global.FORCE_ALLOW_ON_EXTERNAL, SETTING_VALUE_OFF);
|
||||||
|
|
||||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -67,6 +67,6 @@ public class AllowAppsOnExternalPreferenceController extends DeveloperOptionsPre
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
Settings.Global.FORCE_ALLOW_ON_EXTERNAL, SETTING_VALUE_OFF);
|
Settings.Global.FORCE_ALLOW_ON_EXTERNAL, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -57,7 +57,7 @@ public class AppsNotRespondingPreferenceController extends DeveloperOptionsPrefe
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
|
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
Settings.Secure.ANR_SHOW_BACKGROUND, SETTING_VALUE_OFF);
|
Settings.Secure.ANR_SHOW_BACKGROUND, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -65,6 +65,6 @@ public class AppsNotRespondingPreferenceController extends DeveloperOptionsPrefe
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
Settings.Secure.ANR_SHOW_BACKGROUND, SETTING_VALUE_OFF);
|
Settings.Secure.ANR_SHOW_BACKGROUND, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -59,7 +59,7 @@ public class ArtVerifierPreferenceController extends DeveloperOptionsPreferenceC
|
|||||||
final int verifyDebuggable = Settings.Global.getInt(
|
final int verifyDebuggable = Settings.Global.getInt(
|
||||||
mContext.getContentResolver(),
|
mContext.getContentResolver(),
|
||||||
Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE, SETTING_VALUE_ON);
|
Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE, SETTING_VALUE_ON);
|
||||||
((SwitchPreference) mPreference).setChecked(verifyDebuggable != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(verifyDebuggable != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -67,6 +67,6 @@ public class ArtVerifierPreferenceController extends DeveloperOptionsPreferenceC
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE, SETTING_VALUE_ON);
|
Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE, SETTING_VALUE_ON);
|
||||||
((SwitchPreference) mPreference).setChecked(true);
|
((TwoStatePreference) mPreference).setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ import android.os.UserManager;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -71,7 +71,7 @@ public class AutomaticSystemServerHeapDumpPreferenceController extends
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
|
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS, SETTING_VALUE_ON);
|
Settings.Global.ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS, SETTING_VALUE_ON);
|
||||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -79,6 +79,6 @@ public class AutomaticSystemServerHeapDumpPreferenceController extends
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
Settings.Global.ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS, SETTING_VALUE_OFF);
|
Settings.Global.ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ import android.content.Context;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
@@ -76,7 +76,7 @@ public class BackAnimationPreferenceController extends DeveloperOptionsPreferenc
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.ENABLE_BACK_ANIMATION, SETTING_VALUE_OFF);
|
Settings.Global.ENABLE_BACK_ANIMATION, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -84,6 +84,6 @@ public class BackAnimationPreferenceController extends DeveloperOptionsPreferenc
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
Settings.Global.ENABLE_BACK_ANIMATION, SETTING_VALUE_OFF);
|
Settings.Global.ENABLE_BACK_ANIMATION, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,7 @@ import android.os.SystemProperties;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -66,10 +66,10 @@ public class BluetoothA2dpHwOffloadPreferenceController extends DeveloperOptions
|
|||||||
if (offloadSupported) {
|
if (offloadSupported) {
|
||||||
final boolean offloadDisabled =
|
final boolean offloadDisabled =
|
||||||
SystemProperties.getBoolean(A2DP_OFFLOAD_DISABLED_PROPERTY, false);
|
SystemProperties.getBoolean(A2DP_OFFLOAD_DISABLED_PROPERTY, false);
|
||||||
((SwitchPreference) mPreference).setChecked(offloadDisabled);
|
((TwoStatePreference) mPreference).setChecked(offloadDisabled);
|
||||||
} else {
|
} else {
|
||||||
mPreference.setEnabled(false);
|
mPreference.setEnabled(false);
|
||||||
((SwitchPreference) mPreference).setChecked(true);
|
((TwoStatePreference) mPreference).setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ public class BluetoothA2dpHwOffloadPreferenceController extends DeveloperOptions
|
|||||||
final boolean offloadSupported =
|
final boolean offloadSupported =
|
||||||
SystemProperties.getBoolean(A2DP_OFFLOAD_SUPPORTED_PROPERTY, false);
|
SystemProperties.getBoolean(A2DP_OFFLOAD_SUPPORTED_PROPERTY, false);
|
||||||
if (offloadSupported) {
|
if (offloadSupported) {
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
SystemProperties.set(A2DP_OFFLOAD_DISABLED_PROPERTY, "false");
|
SystemProperties.set(A2DP_OFFLOAD_DISABLED_PROPERTY, "false");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ import android.os.SystemProperties;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -57,13 +57,13 @@ public class BluetoothAbsoluteVolumePreferenceController extends
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final boolean isEnabled = SystemProperties.getBoolean(
|
final boolean isEnabled = SystemProperties.getBoolean(
|
||||||
BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_PROPERTY, false /* default */);
|
BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_PROPERTY, false /* default */);
|
||||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
SystemProperties.set(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_PROPERTY, "false");
|
SystemProperties.set(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_PROPERTY, "false");
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ import android.os.SystemProperties;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -57,13 +57,13 @@ public class BluetoothDeviceNoNamePreferenceController extends
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final boolean isEnabled = SystemProperties.getBoolean(
|
final boolean isEnabled = SystemProperties.getBoolean(
|
||||||
BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_PROPERTY, false /* default */);
|
BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_PROPERTY, false /* default */);
|
||||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
SystemProperties.set(BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_PROPERTY, "false");
|
SystemProperties.set(BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_PROPERTY, "false");
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,7 @@ import android.sysprop.BluetoothProperties;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -90,14 +90,14 @@ public class BluetoothLeAudioAllowListPreferenceController
|
|||||||
(mBluetoothAdapter.isLeAudioSupported() == BluetoothStatusCodes.FEATURE_SUPPORTED);
|
(mBluetoothAdapter.isLeAudioSupported() == BluetoothStatusCodes.FEATURE_SUPPORTED);
|
||||||
if (!isLeAudioSupported) {
|
if (!isLeAudioSupported) {
|
||||||
mPreference.setEnabled(false);
|
mPreference.setEnabled(false);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mPreference.setEnabled(true);
|
mPreference.setEnabled(true);
|
||||||
final boolean isLeAudioAllowlistBypassed =
|
final boolean isLeAudioAllowlistBypassed =
|
||||||
SystemProperties.getBoolean(BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY, false);
|
SystemProperties.getBoolean(BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY, false);
|
||||||
((SwitchPreference) mPreference).setChecked(isLeAudioAllowlistBypassed);
|
((TwoStatePreference) mPreference).setChecked(isLeAudioAllowlistBypassed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -107,7 +107,7 @@ public class BluetoothLeAudioAllowListPreferenceController
|
|||||||
SystemProperties.getBoolean(BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY, false);
|
SystemProperties.getBoolean(BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY, false);
|
||||||
if (isBypassed) {
|
if (isBypassed) {
|
||||||
SystemProperties.set(BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY, Boolean.toString(false));
|
SystemProperties.set(BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY, Boolean.toString(false));
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@ import android.os.SystemProperties;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -93,6 +93,6 @@ public class BluetoothLeAudioDeviceDetailsPreferenceController
|
|||||||
final boolean isLeAudioToggleVisible = SystemProperties.getBoolean(
|
final boolean isLeAudioToggleVisible = SystemProperties.getBoolean(
|
||||||
LE_AUDIO_TOGGLE_VISIBLE_PROPERTY, LE_AUDIO_TOGGLE_VISIBLE_DEFAULT_VALUE);
|
LE_AUDIO_TOGGLE_VISIBLE_PROPERTY, LE_AUDIO_TOGGLE_VISIBLE_DEFAULT_VALUE);
|
||||||
|
|
||||||
((SwitchPreference) mPreference).setChecked(isLeAudioToggleVisible);
|
((TwoStatePreference) mPreference).setChecked(isLeAudioToggleVisible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package com.android.settings.development;
|
|||||||
|
|
||||||
import static com.android.settings.development.BluetoothA2dpHwOffloadPreferenceController.A2DP_OFFLOAD_DISABLED_PROPERTY;
|
import static com.android.settings.development.BluetoothA2dpHwOffloadPreferenceController.A2DP_OFFLOAD_DISABLED_PROPERTY;
|
||||||
|
|
||||||
|
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.bluetooth.BluetoothManager;
|
import android.bluetooth.BluetoothManager;
|
||||||
import android.bluetooth.BluetoothStatusCodes;
|
import android.bluetooth.BluetoothStatusCodes;
|
||||||
@@ -27,7 +26,7 @@ import android.os.SystemProperties;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -87,10 +86,10 @@ public class BluetoothLeAudioHwOffloadPreferenceController
|
|||||||
if (leAudioEnabled && leAudioOffloadSupported && !a2dpOffloadDisabled) {
|
if (leAudioEnabled && leAudioOffloadSupported && !a2dpOffloadDisabled) {
|
||||||
final boolean offloadDisabled =
|
final boolean offloadDisabled =
|
||||||
SystemProperties.getBoolean(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY, true);
|
SystemProperties.getBoolean(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY, true);
|
||||||
((SwitchPreference) mPreference).setChecked(offloadDisabled);
|
((TwoStatePreference) mPreference).setChecked(offloadDisabled);
|
||||||
} else {
|
} else {
|
||||||
mPreference.setEnabled(false);
|
mPreference.setEnabled(false);
|
||||||
((SwitchPreference) mPreference).setChecked(true);
|
((TwoStatePreference) mPreference).setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +107,7 @@ public class BluetoothLeAudioHwOffloadPreferenceController
|
|||||||
final boolean a2dpOffloadDisabled =
|
final boolean a2dpOffloadDisabled =
|
||||||
SystemProperties.getBoolean(A2DP_OFFLOAD_DISABLED_PROPERTY, false);
|
SystemProperties.getBoolean(A2DP_OFFLOAD_DISABLED_PROPERTY, false);
|
||||||
if (leAudioEnabled && leAudioOffloadSupported && !a2dpOffloadDisabled) {
|
if (leAudioEnabled && leAudioOffloadSupported && !a2dpOffloadDisabled) {
|
||||||
((SwitchPreference) mPreference).setChecked(true);
|
((TwoStatePreference) mPreference).setChecked(true);
|
||||||
SystemProperties.set(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY, "true");
|
SystemProperties.set(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY, "true");
|
||||||
} else {
|
} else {
|
||||||
mPreference.setEnabled(false);
|
mPreference.setEnabled(false);
|
||||||
|
@@ -24,7 +24,7 @@ import android.os.SystemProperties;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -84,7 +84,7 @@ public class BluetoothLeAudioPreferenceController
|
|||||||
final boolean leAudioEnabled =
|
final boolean leAudioEnabled =
|
||||||
(isLeAudioSupportedStatus == BluetoothStatusCodes.FEATURE_SUPPORTED);
|
(isLeAudioSupportedStatus == BluetoothStatusCodes.FEATURE_SUPPORTED);
|
||||||
|
|
||||||
((SwitchPreference) mPreference).setChecked(!leAudioEnabled);
|
((TwoStatePreference) mPreference).setChecked(!leAudioEnabled);
|
||||||
|
|
||||||
// Disable option if Bluetooth is disabled or if switch is not supported
|
// Disable option if Bluetooth is disabled or if switch is not supported
|
||||||
if (isLeAudioSupportedStatus == BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED
|
if (isLeAudioSupportedStatus == BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED
|
||||||
|
@@ -22,7 +22,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -68,7 +68,7 @@ public class BugReportInPowerPreferenceController extends
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
|
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
Settings.Secure.BUGREPORT_IN_POWER_MENU, SETTING_VALUE_OFF);
|
Settings.Secure.BUGREPORT_IN_POWER_MENU, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -76,6 +76,6 @@ public class BugReportInPowerPreferenceController extends
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
Settings.Secure.BUGREPORT_IN_POWER_MENU, SETTING_VALUE_OFF);
|
Settings.Secure.BUGREPORT_IN_POWER_MENU, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ import android.text.TextUtils;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
@@ -72,7 +72,7 @@ public class CameraLaserSensorPreferenceController extends DeveloperOptionsPrefe
|
|||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final boolean enabled = isLaserSensorEnabled();
|
final boolean enabled = isLaserSensorEnabled();
|
||||||
((SwitchPreference) mPreference).setChecked(enabled);
|
((TwoStatePreference) mPreference).setChecked(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// There should be no impact on the current
|
// There should be no impact on the current
|
||||||
|
@@ -24,14 +24,14 @@ import android.os.Looper;
|
|||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
|
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settingslib.R;
|
import com.android.settingslib.R;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ColorModePreference extends SwitchPreference implements DisplayListener {
|
public class ColorModePreference extends TwoStatePreference implements DisplayListener {
|
||||||
|
|
||||||
private DisplayManager mDisplayManager;
|
private DisplayManager mDisplayManager;
|
||||||
private Display mDisplay;
|
private Display mDisplay;
|
||||||
|
@@ -22,7 +22,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
@@ -65,14 +65,14 @@ public class CoolColorTemperaturePreferenceController extends DeveloperOptionsPr
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final boolean enableColorTemperature = SystemProperties.getBoolean(
|
final boolean enableColorTemperature = SystemProperties.getBoolean(
|
||||||
COLOR_TEMPERATURE_PROPERTY, false /* default */);
|
COLOR_TEMPERATURE_PROPERTY, false /* default */);
|
||||||
((SwitchPreference) mPreference).setChecked(enableColorTemperature);
|
((TwoStatePreference) mPreference).setChecked(enableColorTemperature);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
SystemProperties.set(COLOR_TEMPERATURE_PROPERTY, Boolean.toString(false));
|
SystemProperties.set(COLOR_TEMPERATURE_PROPERTY, Boolean.toString(false));
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -59,7 +59,7 @@ public class DebugViewAttributesPreferenceController extends
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int debugViewAttrMode = Settings.Global.getInt(mContext.getContentResolver(),
|
final int debugViewAttrMode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.DEBUG_VIEW_ATTRIBUTES, 0 /* default */);
|
Settings.Global.DEBUG_VIEW_ATTRIBUTES, 0 /* default */);
|
||||||
((SwitchPreference) mPreference).setChecked(debugViewAttrMode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(debugViewAttrMode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -67,6 +67,6 @@ public class DebugViewAttributesPreferenceController extends
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
Settings.Global.DEBUG_VIEW_ATTRIBUTES, SETTING_VALUE_OFF);
|
Settings.Global.DEBUG_VIEW_ATTRIBUTES, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
@@ -71,7 +71,7 @@ public class DesktopModePreferenceController extends DeveloperOptionsPreferenceC
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS, SETTING_VALUE_OFF);
|
DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -79,7 +79,7 @@ public class DesktopModePreferenceController extends DeveloperOptionsPreferenceC
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS, SETTING_VALUE_OFF);
|
DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -63,7 +63,7 @@ public class DisableAutomaticUpdatesPreferenceController extends
|
|||||||
final int updatesEnabled = Settings.Global.getInt(mContext.getContentResolver(),
|
final int updatesEnabled = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.OTA_DISABLE_AUTOMATIC_UPDATE, 0 /* default */);
|
Settings.Global.OTA_DISABLE_AUTOMATIC_UPDATE, 0 /* default */);
|
||||||
|
|
||||||
((SwitchPreference) mPreference).setChecked(updatesEnabled != DISABLE_UPDATES_SETTING);
|
((TwoStatePreference) mPreference).setChecked(updatesEnabled != DISABLE_UPDATES_SETTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -71,6 +71,6 @@ public class DisableAutomaticUpdatesPreferenceController extends
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
Settings.Global.OTA_DISABLE_AUTOMATIC_UPDATE, DISABLE_UPDATES_SETTING);
|
Settings.Global.OTA_DISABLE_AUTOMATIC_UPDATE, DISABLE_UPDATES_SETTING);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -69,7 +69,7 @@ public final class EnableBlursPreferenceController extends DeveloperOptionsPrefe
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
boolean isEnabled = Settings.Global.getInt(mContext.getContentResolver(),
|
boolean isEnabled = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.DISABLE_WINDOW_BLURS, 0) == 0;
|
Settings.Global.DISABLE_WINDOW_BLURS, 0) == 0;
|
||||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -20,7 +20,7 @@ import android.content.Context;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -59,7 +59,8 @@ public class EnableGnssRawMeasFullTrackingPreferenceController extends
|
|||||||
final int enableGnssRawMeasFullTrackingMode =
|
final int enableGnssRawMeasFullTrackingMode =
|
||||||
Settings.Global.getInt(mContext.getContentResolver(),
|
Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING, SETTING_VALUE_OFF);
|
Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(enableGnssRawMeasFullTrackingMode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference)
|
||||||
|
.setChecked(enableGnssRawMeasFullTrackingMode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -67,6 +68,6 @@ public class EnableGnssRawMeasFullTrackingPreferenceController extends
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING, SETTING_VALUE_OFF);
|
Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -58,7 +58,8 @@ public class EnableGpuDebugLayersPreferenceController extends DeveloperOptionsPr
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int enableGpuDebugLayersMode = Settings.Global.getInt(mContext.getContentResolver(),
|
final int enableGpuDebugLayersMode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.ENABLE_GPU_DEBUG_LAYERS, SETTING_VALUE_OFF);
|
Settings.Global.ENABLE_GPU_DEBUG_LAYERS, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(enableGpuDebugLayersMode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference)
|
||||||
|
.setChecked(enableGpuDebugLayersMode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -66,6 +67,6 @@ public class EnableGpuDebugLayersPreferenceController extends DeveloperOptionsPr
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
Settings.Global.ENABLE_GPU_DEBUG_LAYERS, SETTING_VALUE_OFF);
|
Settings.Global.ENABLE_GPU_DEBUG_LAYERS, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -84,7 +84,7 @@ public class EnableVerboseVendorLoggingPreferenceController
|
|||||||
ThreadUtils.postOnBackgroundThread(() -> {
|
ThreadUtils.postOnBackgroundThread(() -> {
|
||||||
final boolean enabled = getVerboseLoggingEnabled();
|
final boolean enabled = getVerboseLoggingEnabled();
|
||||||
ThreadUtils.getUiThreadHandler().post(() ->
|
ThreadUtils.getUiThreadHandler().post(() ->
|
||||||
((SwitchPreference) mPreference).setChecked(enabled));
|
((TwoStatePreference) mPreference).setChecked(enabled));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ public class EnableVerboseVendorLoggingPreferenceController
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
ThreadUtils.postOnBackgroundThread(() ->
|
ThreadUtils.postOnBackgroundThread(() ->
|
||||||
setVerboseLoggingEnabled(false));
|
setVerboseLoggingEnabled(false));
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@@ -21,7 +21,7 @@ import android.os.SystemProperties;
|
|||||||
import android.view.ThreadedRenderer;
|
import android.view.ThreadedRenderer;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -54,13 +54,13 @@ public class ForceDarkPreferenceController extends DeveloperOptionsPreferenceCon
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final boolean isEnabled = SystemProperties.getBoolean(
|
final boolean isEnabled = SystemProperties.getBoolean(
|
||||||
ThreadedRenderer.DEBUG_FORCE_DARK, false /* default */);
|
ThreadedRenderer.DEBUG_FORCE_DARK, false /* default */);
|
||||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
SystemProperties.set(ThreadedRenderer.DEBUG_FORCE_DARK, null);
|
SystemProperties.set(ThreadedRenderer.DEBUG_FORCE_DARK, null);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -39,7 +39,7 @@ import android.os.ServiceManager;
|
|||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.internal.R;
|
import com.android.internal.R;
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
@@ -81,13 +81,13 @@ public class ForceEnableNotesRolePreferenceController
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
((SwitchPreference) mPreference).setChecked(isEnabled());
|
((TwoStatePreference) mPreference).setChecked(isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ import android.content.Context;
|
|||||||
import android.sysprop.DisplayProperties;
|
import android.sysprop.DisplayProperties;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -51,13 +51,13 @@ public class ForceMSAAPreferenceController extends DeveloperOptionsPreferenceCon
|
|||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final boolean isEnabled = DisplayProperties.debug_force_msaa().orElse(false);
|
final boolean isEnabled = DisplayProperties.debug_force_msaa().orElse(false);
|
||||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
DisplayProperties.debug_force_msaa(false);
|
DisplayProperties.debug_force_msaa(false);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,7 @@ import android.util.Log;
|
|||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
@@ -72,7 +72,7 @@ public class ForcePeakRefreshRatePreferenceController extends DeveloperOptionsPr
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
((SwitchPreference) mPreference).setChecked(isForcePeakRefreshRateEnabled());
|
((TwoStatePreference) mPreference).setChecked(isForcePeakRefreshRateEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -90,7 +90,7 @@ public class ForcePeakRefreshRatePreferenceController extends DeveloperOptionsPr
|
|||||||
Settings.System.putFloat(mContext.getContentResolver(),
|
Settings.System.putFloat(mContext.getContentResolver(),
|
||||||
Settings.System.MIN_REFRESH_RATE, NO_CONFIG);
|
Settings.System.MIN_REFRESH_RATE, NO_CONFIG);
|
||||||
|
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@@ -22,7 +22,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
@@ -69,7 +69,7 @@ public class FreeformWindowsPreferenceController extends DeveloperOptionsPrefere
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, SETTING_VALUE_OFF);
|
Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -77,7 +77,7 @@ public class FreeformWindowsPreferenceController extends DeveloperOptionsPrefere
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, SETTING_VALUE_OFF);
|
Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@@ -20,7 +20,7 @@ import android.content.Context;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -67,13 +67,13 @@ public abstract class GlobalSettingSwitchPreferenceController extends
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int mode =
|
final int mode =
|
||||||
Settings.Global.getInt(mContext.getContentResolver(), mSettingsKey, mDefault);
|
Settings.Global.getInt(mContext.getContentResolver(), mSettingsKey, mDefault);
|
||||||
((SwitchPreference) mPreference).setChecked(mode != mOff);
|
((TwoStatePreference) mPreference).setChecked(mode != mOff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(), mSettingsKey, mOff);
|
Settings.Global.putInt(mContext.getContentResolver(), mSettingsKey, mOff);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ import android.os.SystemProperties;
|
|||||||
import android.view.ThreadedRenderer;
|
import android.view.ThreadedRenderer;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -54,13 +54,13 @@ public class GpuViewUpdatesPreferenceController extends DeveloperOptionsPreferen
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final boolean isEnabled = SystemProperties.getBoolean(
|
final boolean isEnabled = SystemProperties.getBoolean(
|
||||||
ThreadedRenderer.DEBUG_DIRTY_REGIONS_PROPERTY, false /* default */);
|
ThreadedRenderer.DEBUG_DIRTY_REGIONS_PROPERTY, false /* default */);
|
||||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
SystemProperties.set(ThreadedRenderer.DEBUG_DIRTY_REGIONS_PROPERTY, null);
|
SystemProperties.set(ThreadedRenderer.DEBUG_DIRTY_REGIONS_PROPERTY, null);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ import android.os.SystemProperties;
|
|||||||
import android.view.ThreadedRenderer;
|
import android.view.ThreadedRenderer;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -54,13 +54,13 @@ public class HardwareLayersUpdatesPreferenceController extends DeveloperOptionsP
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final boolean isEnabled = SystemProperties.getBoolean(
|
final boolean isEnabled = SystemProperties.getBoolean(
|
||||||
ThreadedRenderer.DEBUG_SHOW_LAYERS_UPDATES_PROPERTY, false /* default */);
|
ThreadedRenderer.DEBUG_SHOW_LAYERS_UPDATES_PROPERTY, false /* default */);
|
||||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
SystemProperties.set(ThreadedRenderer.DEBUG_SHOW_LAYERS_UPDATES_PROPERTY, null);
|
SystemProperties.set(ThreadedRenderer.DEBUG_SHOW_LAYERS_UPDATES_PROPERTY, null);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@ import android.os.ServiceManager;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -71,7 +71,7 @@ public class HardwareOverlaysPreferenceController extends DeveloperOptionsPrefer
|
|||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
final SwitchPreference switchPreference = (SwitchPreference) mPreference;
|
final TwoStatePreference switchPreference = (TwoStatePreference) mPreference;
|
||||||
if (switchPreference.isChecked()) {
|
if (switchPreference.isChecked()) {
|
||||||
// Writing false to the preference when the setting is already off will have a
|
// Writing false to the preference when the setting is already off will have a
|
||||||
// side effect of turning on the preference that we wish to avoid
|
// side effect of turning on the preference that we wish to avoid
|
||||||
@@ -96,7 +96,7 @@ public class HardwareOverlaysPreferenceController extends DeveloperOptionsPrefer
|
|||||||
@SuppressWarnings("unused") final int showUpdates = reply.readInt();
|
@SuppressWarnings("unused") final int showUpdates = reply.readInt();
|
||||||
@SuppressWarnings("unused") final int showBackground = reply.readInt();
|
@SuppressWarnings("unused") final int showBackground = reply.readInt();
|
||||||
final int disableOverlays = reply.readInt();
|
final int disableOverlays = reply.readInt();
|
||||||
((SwitchPreference) mPreference).setChecked(disableOverlays != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(disableOverlays != SETTING_VALUE_OFF);
|
||||||
reply.recycle();
|
reply.recycle();
|
||||||
data.recycle();
|
data.recycle();
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
|
@@ -25,7 +25,7 @@ import android.provider.Settings;
|
|||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -68,14 +68,14 @@ public class KeepActivitiesPreferenceController extends DeveloperOptionsPreferen
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.ALWAYS_FINISH_ACTIVITIES, SETTING_VALUE_OFF);
|
Settings.Global.ALWAYS_FINISH_ACTIVITIES, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
writeImmediatelyDestroyActivitiesOptions(false);
|
writeImmediatelyDestroyActivitiesOptions(false);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeImmediatelyDestroyActivitiesOptions(boolean isEnabled) {
|
private void writeImmediatelyDestroyActivitiesOptions(boolean isEnabled) {
|
||||||
|
@@ -7,7 +7,7 @@ import android.os.UserManager;
|
|||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -63,7 +63,7 @@ public class LocalTerminalPreferenceController extends DeveloperOptionsPreferenc
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final boolean isTerminalEnabled = mPackageManager.getApplicationEnabledSetting(
|
final boolean isTerminalEnabled = mPackageManager.getApplicationEnabledSetting(
|
||||||
TERMINAL_APP_PACKAGE) == PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
|
TERMINAL_APP_PACKAGE) == PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
|
||||||
((SwitchPreference) mPreference).setChecked(isTerminalEnabled);
|
((TwoStatePreference) mPreference).setChecked(isTerminalEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -78,7 +78,7 @@ public class LocalTerminalPreferenceController extends DeveloperOptionsPreferenc
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
mPackageManager.setApplicationEnabledSetting(TERMINAL_APP_PACKAGE,
|
mPackageManager.setApplicationEnabledSetting(TERMINAL_APP_PACKAGE,
|
||||||
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0 /* flags */);
|
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0 /* flags */);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -59,7 +59,7 @@ public class MobileDataAlwaysOnPreferenceController extends
|
|||||||
final int mobileDataAlwaysOnMode = Settings.Global.getInt(mContext.getContentResolver(),
|
final int mobileDataAlwaysOnMode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.MOBILE_DATA_ALWAYS_ON, SETTING_VALUE_ON);
|
Settings.Global.MOBILE_DATA_ALWAYS_ON, SETTING_VALUE_ON);
|
||||||
|
|
||||||
((SwitchPreference) mPreference).setChecked(mobileDataAlwaysOnMode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(mobileDataAlwaysOnMode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -67,6 +67,6 @@ public class MobileDataAlwaysOnPreferenceController extends
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.MOBILE_DATA_ALWAYS_ON,
|
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.MOBILE_DATA_ALWAYS_ON,
|
||||||
SETTING_VALUE_ON);
|
SETTING_VALUE_ON);
|
||||||
((SwitchPreference) mPreference).setChecked(true);
|
((TwoStatePreference) mPreference).setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -67,7 +67,7 @@ public class MockModemPreferenceController extends
|
|||||||
try {
|
try {
|
||||||
final boolean isEnabled = SystemProperties.getBoolean(
|
final boolean isEnabled = SystemProperties.getBoolean(
|
||||||
ALLOW_MOCK_MODEM_PROPERTY, false /* default */);
|
ALLOW_MOCK_MODEM_PROPERTY, false /* default */);
|
||||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e(TAG, "Fail to get radio system property: " + e.getMessage());
|
Log.e(TAG, "Fail to get radio system property: " + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ public class MockModemPreferenceController extends
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
try {
|
try {
|
||||||
SystemProperties.set(ALLOW_MOCK_MODEM_PROPERTY, "false");
|
SystemProperties.set(ALLOW_MOCK_MODEM_PROPERTY, "false");
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e(TAG, "Fail to set radio system property: " + e.getMessage());
|
Log.e(TAG, "Fail to set radio system property: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ public class NfcSnoopLogPreferenceController extends
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
try {
|
try {
|
||||||
final String currentValue = SystemProperties.get(NFC_NFCSNOOP_LOG_MODE_PROPERTY);
|
final String currentValue = SystemProperties.get(NFC_NFCSNOOP_LOG_MODE_PROPERTY);
|
||||||
((SwitchPreference) mPreference).setChecked(currentValue.equals(NFCSNOOP_MODE_FULL));
|
((TwoStatePreference) mPreference).setChecked(currentValue.equals(NFCSNOOP_MODE_FULL));
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e(TAG, "Fail to get nfc system property: " + e.getMessage());
|
Log.e(TAG, "Fail to get nfc system property: " + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ public class NfcSnoopLogPreferenceController extends
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
try {
|
try {
|
||||||
SystemProperties.set(NFC_NFCSNOOP_LOG_MODE_PROPERTY, NFCSNOOP_MODE_FILTERED);
|
SystemProperties.set(NFC_NFCSNOOP_LOG_MODE_PROPERTY, NFCSNOOP_MODE_FILTERED);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e(TAG, "Fail to set nfc system property: " + e.getMessage());
|
Log.e(TAG, "Fail to set nfc system property: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -63,7 +63,7 @@ public class NfcStackDebugLogPreferenceController extends
|
|||||||
try {
|
try {
|
||||||
final boolean isEnabled = SystemProperties.getBoolean(
|
final boolean isEnabled = SystemProperties.getBoolean(
|
||||||
NFC_STACK_DEBUGLOG_ENABLED_PROPERTY, false /* default */);
|
NFC_STACK_DEBUGLOG_ENABLED_PROPERTY, false /* default */);
|
||||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e(TAG, "Fail to get nfc system property: " + e.getMessage());
|
Log.e(TAG, "Fail to get nfc system property: " + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ public class NfcStackDebugLogPreferenceController extends
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
try {
|
try {
|
||||||
SystemProperties.set(NFC_STACK_DEBUGLOG_ENABLED_PROPERTY, "false");
|
SystemProperties.set(NFC_STACK_DEBUGLOG_ENABLED_PROPERTY, "false");
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e(TAG, "Fail to set nfc system property: " + e.getMessage());
|
Log.e(TAG, "Fail to set nfc system property: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ public class NfcVerboseVendorLogPreferenceController
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
try {
|
try {
|
||||||
final String currentValue = SystemProperties.get(NFC_VERBOSE_VENDOR_LOG_PROPERTY);
|
final String currentValue = SystemProperties.get(NFC_VERBOSE_VENDOR_LOG_PROPERTY);
|
||||||
((SwitchPreference) mPreference)
|
((TwoStatePreference) mPreference)
|
||||||
.setChecked(currentValue.equals(VERBOSE_VENDOR_LOG_ENABLED));
|
.setChecked(currentValue.equals(VERBOSE_VENDOR_LOG_ENABLED));
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e(TAG, "Fail to get nfc system property: " + e.getMessage());
|
Log.e(TAG, "Fail to get nfc system property: " + e.getMessage());
|
||||||
@@ -81,7 +81,7 @@ public class NfcVerboseVendorLogPreferenceController
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
try {
|
try {
|
||||||
SystemProperties.set(NFC_VERBOSE_VENDOR_LOG_PROPERTY, VERBOSE_VENDOR_LOG_DISABLED);
|
SystemProperties.set(NFC_VERBOSE_VENDOR_LOG_PROPERTY, VERBOSE_VENDOR_LOG_DISABLED);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e(TAG, "Fail to set nfc system property: " + e.getMessage());
|
Log.e(TAG, "Fail to set nfc system property: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -66,7 +66,7 @@ public class NonResizableMultiWindowPreferenceController
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, SETTING_VALUE_OFF);
|
DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -74,6 +74,6 @@ public class NonResizableMultiWindowPreferenceController
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, SETTING_VALUE_OFF);
|
DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -62,7 +62,7 @@ public class NotificationChannelWarningsPreferenceController extends
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, 0);
|
Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, 0);
|
||||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -70,7 +70,7 @@ public class NotificationChannelWarningsPreferenceController extends
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, SETTING_VALUE_OFF);
|
Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@@ -23,7 +23,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -59,7 +59,7 @@ public class OverlaySettingsPreferenceController extends DeveloperOptionsPrefere
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
((SwitchPreference) preference).setChecked(isOverlaySettingsEnabled(mContext));
|
((TwoStatePreference) preference).setChecked(isOverlaySettingsEnabled(mContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -23,7 +23,7 @@ import android.util.FeatureFlagUtils;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -66,7 +66,7 @@ public class PhantomProcessPreferenceController extends
|
|||||||
try {
|
try {
|
||||||
final boolean isEnabled = !FeatureFlagUtils.isEnabled(mContext,
|
final boolean isEnabled = !FeatureFlagUtils.isEnabled(mContext,
|
||||||
SETTINGS_ENABLE_MONITOR_PHANTOM_PROCS);
|
SETTINGS_ENABLE_MONITOR_PHANTOM_PROCS);
|
||||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e(TAG, "Fail to get feature flag: " + e.getMessage());
|
Log.e(TAG, "Fail to get feature flag: " + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ public class PhantomProcessPreferenceController extends
|
|||||||
FeatureFlagUtils.setEnabled(mContext,
|
FeatureFlagUtils.setEnabled(mContext,
|
||||||
SETTINGS_ENABLE_MONITOR_PHANTOM_PROCS,
|
SETTINGS_ENABLE_MONITOR_PHANTOM_PROCS,
|
||||||
true /* Enable the monitoring */);
|
true /* Enable the monitoring */);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e(TAG, "Fail to set feature flag: " + e.getMessage());
|
Log.e(TAG, "Fail to set feature flag: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -57,7 +57,7 @@ public class PointerLocationPreferenceController extends DeveloperOptionsPrefere
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int pointerLocationMode = Settings.System.getInt(mContext.getContentResolver(),
|
final int pointerLocationMode = Settings.System.getInt(mContext.getContentResolver(),
|
||||||
Settings.System.POINTER_LOCATION, SETTING_VALUE_OFF);
|
Settings.System.POINTER_LOCATION, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(pointerLocationMode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(pointerLocationMode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -65,6 +65,6 @@ public class PointerLocationPreferenceController extends DeveloperOptionsPrefere
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.System.putInt(mContext.getContentResolver(), Settings.System.POINTER_LOCATION,
|
Settings.System.putInt(mContext.getContentResolver(), Settings.System.POINTER_LOCATION,
|
||||||
SETTING_VALUE_OFF);
|
SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -58,7 +58,7 @@ public class ResizableActivityPreferenceController extends DeveloperOptionsPrefe
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES, SETTING_VALUE_OFF);
|
Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -66,6 +66,6 @@ public class ResizableActivityPreferenceController extends DeveloperOptionsPrefe
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES, SETTING_VALUE_OFF);
|
Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ import android.sysprop.DisplayProperties;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.internal.app.LocalePicker;
|
import com.android.internal.app.LocalePicker;
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
@@ -59,7 +59,7 @@ public class RtlLayoutPreferenceController extends DeveloperOptionsPreferenceCon
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
int rtlLayoutMode = Settings.Global.getInt(mContext.getContentResolver(),
|
int rtlLayoutMode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.DEVELOPMENT_FORCE_RTL, SETTING_VALUE_OFF);
|
Settings.Global.DEVELOPMENT_FORCE_RTL, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(rtlLayoutMode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(rtlLayoutMode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -67,7 +67,7 @@ public class RtlLayoutPreferenceController extends DeveloperOptionsPreferenceCon
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
writeToForceRtlLayoutSetting(false);
|
writeToForceRtlLayoutSetting(false);
|
||||||
updateLocales();
|
updateLocales();
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@@ -20,7 +20,7 @@ import android.content.Context;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -54,13 +54,13 @@ public abstract class SecureSettingSwitchPreferenceController extends
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int mode = Settings.Secure.getInt(
|
final int mode = Settings.Secure.getInt(
|
||||||
mContext.getContentResolver(), mSettingsKey, SETTING_VALUE_OFF);
|
mContext.getContentResolver(), mSettingsKey, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), mSettingsKey, SETTING_VALUE_OFF);
|
Settings.Secure.putInt(mContext.getContentResolver(), mSettingsKey, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -66,7 +66,7 @@ public class ShowFirstCrashDialogPreferenceController extends DeveloperOptionsPr
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
|
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
Settings.Secure.SHOW_FIRST_CRASH_DIALOG_DEV_OPTION, SETTING_VALUE_OFF);
|
Settings.Secure.SHOW_FIRST_CRASH_DIALOG_DEV_OPTION, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -74,6 +74,6 @@ public class ShowFirstCrashDialogPreferenceController extends DeveloperOptionsPr
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
Settings.Secure.SHOW_FIRST_CRASH_DIALOG_DEV_OPTION, SETTING_VALUE_OFF);
|
Settings.Secure.SHOW_FIRST_CRASH_DIALOG_DEV_OPTION, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -59,7 +59,7 @@ public class ShowKeyPressesPreferenceController extends
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
int showKeyPresses = Settings.System.getInt(mContext.getContentResolver(),
|
int showKeyPresses = Settings.System.getInt(mContext.getContentResolver(),
|
||||||
Settings.System.SHOW_KEY_PRESSES, SETTING_VALUE_OFF);
|
Settings.System.SHOW_KEY_PRESSES, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(showKeyPresses != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(showKeyPresses != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -67,6 +67,6 @@ public class ShowKeyPressesPreferenceController extends
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.System.putInt(mContext.getContentResolver(), Settings.System.SHOW_KEY_PRESSES,
|
Settings.System.putInt(mContext.getContentResolver(), Settings.System.SHOW_KEY_PRESSES,
|
||||||
SETTING_VALUE_OFF);
|
SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ import android.content.Context;
|
|||||||
import android.sysprop.DisplayProperties;
|
import android.sysprop.DisplayProperties;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -51,13 +51,13 @@ public class ShowLayoutBoundsPreferenceController extends DeveloperOptionsPrefer
|
|||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final boolean isEnabled = DisplayProperties.debug_layout().orElse(false);
|
final boolean isEnabled = DisplayProperties.debug_layout().orElse(false);
|
||||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
DisplayProperties.debug_layout(false);
|
DisplayProperties.debug_layout(false);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@ import android.os.ServiceManager;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -75,7 +75,7 @@ public class ShowRefreshRatePreferenceController extends DeveloperOptionsPrefere
|
|||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
final SwitchPreference preference = (SwitchPreference) mPreference;
|
final TwoStatePreference preference = (TwoStatePreference) mPreference;
|
||||||
if (preference.isChecked()) {
|
if (preference.isChecked()) {
|
||||||
// Writing false to the preference when the setting is already off will have a
|
// Writing false to the preference when the setting is already off will have a
|
||||||
// side effect of turning on the preference that we wish to avoid
|
// side effect of turning on the preference that we wish to avoid
|
||||||
@@ -95,7 +95,7 @@ public class ShowRefreshRatePreferenceController extends DeveloperOptionsPrefere
|
|||||||
data.writeInt(SETTING_VALUE_QUERY);
|
data.writeInt(SETTING_VALUE_QUERY);
|
||||||
mSurfaceFlinger.transact(SURFACE_FLINGER_CODE, data, reply, 0 /* flags */);
|
mSurfaceFlinger.transact(SURFACE_FLINGER_CODE, data, reply, 0 /* flags */);
|
||||||
final boolean enabled = reply.readBoolean();
|
final boolean enabled = reply.readBoolean();
|
||||||
((SwitchPreference) mPreference).setChecked(enabled);
|
((TwoStatePreference) mPreference).setChecked(enabled);
|
||||||
reply.recycle();
|
reply.recycle();
|
||||||
data.recycle();
|
data.recycle();
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@ import android.os.ServiceManager;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -72,7 +72,7 @@ public class ShowSurfaceUpdatesPreferenceController extends DeveloperOptionsPref
|
|||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
final SwitchPreference preference = (SwitchPreference) mPreference;
|
final TwoStatePreference preference = (TwoStatePreference) mPreference;
|
||||||
if (preference.isChecked()) {
|
if (preference.isChecked()) {
|
||||||
// Writing false to the preference when the setting is already off will have a
|
// Writing false to the preference when the setting is already off will have a
|
||||||
// side effect of turning on the preference that we wish to avoid
|
// side effect of turning on the preference that we wish to avoid
|
||||||
@@ -93,7 +93,7 @@ public class ShowSurfaceUpdatesPreferenceController extends DeveloperOptionsPref
|
|||||||
@SuppressWarnings("unused") final int showCpu = reply.readInt();
|
@SuppressWarnings("unused") final int showCpu = reply.readInt();
|
||||||
@SuppressWarnings("unused") final int enableGL = reply.readInt();
|
@SuppressWarnings("unused") final int enableGL = reply.readInt();
|
||||||
final int showUpdates = reply.readInt();
|
final int showUpdates = reply.readInt();
|
||||||
((SwitchPreference) mPreference).setChecked(showUpdates != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(showUpdates != SETTING_VALUE_OFF);
|
||||||
reply.recycle();
|
reply.recycle();
|
||||||
data.recycle();
|
data.recycle();
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -57,7 +57,7 @@ public class ShowTapsPreferenceController extends DeveloperOptionsPreferenceCont
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
int showTapsMode = Settings.System.getInt(mContext.getContentResolver(),
|
int showTapsMode = Settings.System.getInt(mContext.getContentResolver(),
|
||||||
Settings.System.SHOW_TOUCHES, SETTING_VALUE_OFF);
|
Settings.System.SHOW_TOUCHES, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(showTapsMode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(showTapsMode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -65,6 +65,6 @@ public class ShowTapsPreferenceController extends DeveloperOptionsPreferenceCont
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.System.putInt(mContext.getContentResolver(), Settings.System.SHOW_TOUCHES,
|
Settings.System.putInt(mContext.getContentResolver(), Settings.System.SHOW_TOUCHES,
|
||||||
SETTING_VALUE_OFF);
|
SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,7 @@ import android.view.IWindowManager;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -64,14 +64,14 @@ public class StrictModePreferenceController extends DeveloperOptionsPreferenceCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
((SwitchPreference) mPreference).setChecked(isStrictModeEnabled());
|
((TwoStatePreference) mPreference).setChecked(isStrictModeEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
writeStrictModeVisualOptions(false);
|
writeStrictModeVisualOptions(false);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isStrictModeEnabled() {
|
private boolean isStrictModeEnabled() {
|
||||||
|
@@ -20,7 +20,7 @@ import android.content.Context;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -57,7 +57,7 @@ class StylusHandwritingPreferenceController extends DeveloperOptionsPreferenceCo
|
|||||||
final int enable = Settings.Secure.getInt(mContext.getContentResolver(),
|
final int enable = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
Settings.Secure.STYLUS_HANDWRITING_ENABLED,
|
Settings.Secure.STYLUS_HANDWRITING_ENABLED,
|
||||||
Settings.Secure.STYLUS_HANDWRITING_DEFAULT_VALUE);
|
Settings.Secure.STYLUS_HANDWRITING_DEFAULT_VALUE);
|
||||||
((SwitchPreference) mPreference).setChecked(enable != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(enable != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -66,6 +66,6 @@ class StylusHandwritingPreferenceController extends DeveloperOptionsPreferenceCo
|
|||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
Settings.Secure.STYLUS_HANDWRITING_ENABLED,
|
Settings.Secure.STYLUS_HANDWRITING_ENABLED,
|
||||||
Settings.Secure.STYLUS_HANDWRITING_DEFAULT_VALUE);
|
Settings.Secure.STYLUS_HANDWRITING_DEFAULT_VALUE);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ import android.content.Context;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -54,13 +54,13 @@ public abstract class SystemSettingSwitchPreferenceController extends
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final int mode = Settings.System.getInt(
|
final int mode = Settings.System.getInt(
|
||||||
mContext.getContentResolver(), mSettingsKey, SETTING_VALUE_OFF);
|
mContext.getContentResolver(), mSettingsKey, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.System.putInt(mContext.getContentResolver(), mSettingsKey, SETTING_VALUE_OFF);
|
Settings.System.putInt(mContext.getContentResolver(), mSettingsKey, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -61,7 +61,7 @@ public class TetheringHardwareAccelPreferenceController extends DeveloperOptions
|
|||||||
final int tetheringMode = Settings.Global.getInt(
|
final int tetheringMode = Settings.Global.getInt(
|
||||||
mContext.getContentResolver(),
|
mContext.getContentResolver(),
|
||||||
Settings.Global.TETHER_OFFLOAD_DISABLED, 0 /* default */);
|
Settings.Global.TETHER_OFFLOAD_DISABLED, 0 /* default */);
|
||||||
((SwitchPreference) mPreference).setChecked(tetheringMode != SETTING_VALUE_OFF);
|
((TwoStatePreference) mPreference).setChecked(tetheringMode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -69,6 +69,6 @@ public class TetheringHardwareAccelPreferenceController extends DeveloperOptions
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
Settings.Global.TETHER_OFFLOAD_DISABLED, SETTING_VALUE_OFF);
|
Settings.Global.TETHER_OFFLOAD_DISABLED, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@ import android.os.RemoteException;
|
|||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.internal.R;
|
import com.android.internal.R;
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
@@ -62,13 +62,13 @@ public class TransparentNavigationBarPreferenceController
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
((SwitchPreference) mPreference).setChecked(isEnabled());
|
((TwoStatePreference) mPreference).setChecked(isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
final boolean enabled = isEnabled();
|
final boolean enabled = isEnabled();
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
|
@@ -25,7 +25,7 @@ import android.provider.Settings;
|
|||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.RestrictedSwitchPreference;
|
import com.android.settingslib.RestrictedSwitchPreference;
|
||||||
@@ -81,7 +81,7 @@ public class UsbAudioRoutingPreferenceController extends DeveloperOptionsPrefere
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED, SETTING_VALUE_OFF);
|
Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -29,7 +29,7 @@ import android.text.TextUtils;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -79,7 +79,7 @@ public class WaitForDebuggerPreferenceController extends DeveloperOptionsPrefere
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateState(Preference preference, String debugApp) {
|
private void updateState(Preference preference, String debugApp) {
|
||||||
final SwitchPreference switchPreference = (SwitchPreference) preference;
|
final TwoStatePreference switchPreference = (TwoStatePreference) preference;
|
||||||
final boolean debuggerEnabled = Settings.Global.getInt(mContext.getContentResolver(),
|
final boolean debuggerEnabled = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.WAIT_FOR_DEBUGGER, SETTING_VALUE_OFF) != SETTING_VALUE_OFF;
|
Settings.Global.WAIT_FOR_DEBUGGER, SETTING_VALUE_OFF) != SETTING_VALUE_OFF;
|
||||||
writeDebuggerAppOptions(debugApp, debuggerEnabled, true /* persistent */);
|
writeDebuggerAppOptions(debugApp, debuggerEnabled, true /* persistent */);
|
||||||
@@ -92,7 +92,7 @@ public class WaitForDebuggerPreferenceController extends DeveloperOptionsPrefere
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
writeDebuggerAppOptions(null /* package name */,
|
writeDebuggerAppOptions(null /* package name */,
|
||||||
false /* waitForDebugger */, false /* persistent */);
|
false /* waitForDebugger */, false /* persistent */);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -60,7 +60,7 @@ public class WifiDisplayCertificationPreferenceController extends
|
|||||||
final int wifiDisplayCertificationMode = Settings.Global.getInt(
|
final int wifiDisplayCertificationMode = Settings.Global.getInt(
|
||||||
mContext.getContentResolver(), Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON,
|
mContext.getContentResolver(), Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON,
|
||||||
SETTING_VALUE_OFF);
|
SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(
|
((TwoStatePreference) mPreference).setChecked(
|
||||||
wifiDisplayCertificationMode != SETTING_VALUE_OFF);
|
wifiDisplayCertificationMode != SETTING_VALUE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,6 +69,6 @@ public class WifiDisplayCertificationPreferenceController extends
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON, SETTING_VALUE_OFF);
|
Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON, SETTING_VALUE_OFF);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ import android.content.Context;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -60,7 +60,7 @@ public class WifiNonPersistentMacRandomizationPreferenceController
|
|||||||
NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG, 0) == 1) {
|
NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG, 0) == 1) {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
((SwitchPreference) mPreference).setChecked(enabled);
|
((TwoStatePreference) mPreference).setChecked(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -68,6 +68,6 @@ public class WifiNonPersistentMacRandomizationPreferenceController
|
|||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
Settings.Global.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG, 0);
|
NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG, 0);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ import android.content.Context;
|
|||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -50,13 +50,13 @@ public class WifiScanThrottlingPreferenceController extends DeveloperOptionsPref
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
((SwitchPreference) mPreference).setChecked(mWifiManager.isScanThrottleEnabled());
|
((TwoStatePreference) mPreference).setChecked(mWifiManager.isScanThrottleEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
mWifiManager.setScanThrottleEnabled(true);
|
mWifiManager.setScanThrottleEnabled(true);
|
||||||
((SwitchPreference) mPreference).setChecked(true);
|
((TwoStatePreference) mPreference).setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ import android.net.wifi.WifiManager;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
@@ -59,7 +59,7 @@ public class WifiVerboseLoggingPreferenceController extends DeveloperOptionsPref
|
|||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
final boolean enabled = mWifiManager.isVerboseLoggingEnabled();
|
final boolean enabled = mWifiManager.isVerboseLoggingEnabled();
|
||||||
((SwitchPreference) mPreference).setChecked(enabled);
|
((TwoStatePreference) mPreference).setChecked(enabled);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +67,6 @@ public class WifiVerboseLoggingPreferenceController extends DeveloperOptionsPref
|
|||||||
protected void onDeveloperOptionsSwitchDisabled() {
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
super.onDeveloperOptionsSwitchDisabled();
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
mWifiManager.setVerboseLoggingEnabled(false);
|
mWifiManager.setVerboseLoggingEnabled(false);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ import android.content.Context;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.development.BluetoothA2dpConfigStore;
|
import com.android.settings.development.BluetoothA2dpConfigStore;
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||||
@@ -64,7 +64,7 @@ public class BluetoothHDAudioPreferenceController extends AbstractBluetoothPrefe
|
|||||||
if (supported) {
|
if (supported) {
|
||||||
final boolean isEnabled = bluetoothA2dp.isOptionalCodecsEnabled(activeDevice)
|
final boolean isEnabled = bluetoothA2dp.isOptionalCodecsEnabled(activeDevice)
|
||||||
== BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED;
|
== BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED;
|
||||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
@@ -164,16 +164,16 @@ public class GraphicsDriverEnableAngleAsSystemDriverController
|
|||||||
final String currentGlesDriver =
|
final String currentGlesDriver =
|
||||||
mSystemProperties.get(PROPERTY_PERSISTENT_GRAPHICS_EGL, "");
|
mSystemProperties.get(PROPERTY_PERSISTENT_GRAPHICS_EGL, "");
|
||||||
final boolean isAngle = TextUtils.equals(ANGLE_DRIVER_SUFFIX, currentGlesDriver);
|
final boolean isAngle = TextUtils.equals(ANGLE_DRIVER_SUFFIX, currentGlesDriver);
|
||||||
((SwitchPreference) mPreference).setChecked(isAngle);
|
((TwoStatePreference) mPreference).setChecked(isAngle);
|
||||||
} else {
|
} else {
|
||||||
mPreference.setEnabled(false);
|
mPreference.setEnabled(false);
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable the developer option toggle UI if ANGLE is disabled, this means next time the
|
// Disable the developer option toggle UI if ANGLE is disabled, this means next time the
|
||||||
// debug property needs to be set to true again to enable ANGLE. If ANGLE is enabled, don't
|
// debug property needs to be set to true again to enable ANGLE. If ANGLE is enabled, don't
|
||||||
// disable the developer option toggle UI so that it can be turned off easily.
|
// disable the developer option toggle UI so that it can be turned off easily.
|
||||||
if (!isAngleDeveloperOptionEnabled() && !((SwitchPreference) mPreference).isChecked()) {
|
if (!isAngleDeveloperOptionEnabled() && !((TwoStatePreference) mPreference).isChecked()) {
|
||||||
mPreference.setEnabled(false);
|
mPreference.setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ public class GraphicsDriverEnableAngleAsSystemDriverController
|
|||||||
// 2) set the persist.graphics.egl empty string
|
// 2) set the persist.graphics.egl empty string
|
||||||
GraphicsEnvironment.getInstance().toggleAngleAsSystemDriver(false);
|
GraphicsEnvironment.getInstance().toggleAngleAsSystemDriver(false);
|
||||||
// 3) reset the switch
|
// 3) reset the switch
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ public class GraphicsDriverEnableAngleAsSystemDriverController
|
|||||||
// if persist.graphics.egl = "angle", set the property value back to ""
|
// if persist.graphics.egl = "angle", set the property value back to ""
|
||||||
GraphicsEnvironment.getInstance().toggleAngleAsSystemDriver(false);
|
GraphicsEnvironment.getInstance().toggleAngleAsSystemDriver(false);
|
||||||
// toggle switch off
|
// toggle switch off
|
||||||
((SwitchPreference) mPreference).setChecked(false);
|
((TwoStatePreference) mPreference).setChecked(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ public class GraphicsDriverEnableAngleAsSystemDriverController
|
|||||||
// if persist.graphicx.egl = "", set the persist.graphics.egl back to "angle"
|
// if persist.graphicx.egl = "", set the persist.graphics.egl back to "angle"
|
||||||
GraphicsEnvironment.getInstance().toggleAngleAsSystemDriver(true);
|
GraphicsEnvironment.getInstance().toggleAngleAsSystemDriver(true);
|
||||||
// toggle switch on
|
// toggle switch on
|
||||||
((SwitchPreference) mPreference).setChecked(true);
|
((TwoStatePreference) mPreference).setChecked(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.internal.R;
|
import com.android.internal.R;
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
@@ -71,7 +71,7 @@ public class BatteryPercentagePreferenceController extends BasePreferenceControl
|
|||||||
mContext.getResources().getBoolean(
|
mContext.getResources().getBoolean(
|
||||||
R.bool.config_defaultBatteryPercentageSetting) ? 1 : 0);
|
R.bool.config_defaultBatteryPercentageSetting) ? 1 : 0);
|
||||||
|
|
||||||
((SwitchPreference) preference).setChecked(setting == 1);
|
((TwoStatePreference) preference).setChecked(setting == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -20,7 +20,7 @@ import android.os.SystemProperties;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
@@ -43,7 +43,7 @@ public class CameraGesturePreferenceController extends AbstractPreferenceControl
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
int value = Settings.Secure.getInt(mContext.getContentResolver(),
|
int value = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
CAMERA_GESTURE_DISABLED, 0);
|
CAMERA_GESTURE_DISABLED, 0);
|
||||||
((SwitchPreference) preference).setChecked(value == 0);
|
((TwoStatePreference) preference).setChecked(value == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -21,7 +21,7 @@ import android.hardware.SensorManager;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
@@ -56,6 +56,6 @@ public class LiftToWakePreferenceController extends AbstractPreferenceController
|
|||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
int value = Settings.Secure.getInt(mContext.getContentResolver(), WAKE_GESTURE_ENABLED, 0);
|
int value = Settings.Secure.getInt(mContext.getContentResolver(), WAKE_GESTURE_ENABLED, 0);
|
||||||
((SwitchPreference) preference).setChecked(value != 0);
|
((TwoStatePreference) preference).setChecked(value != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ import android.telephony.CarrierConfigManager;
|
|||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
@@ -64,6 +64,6 @@ public class ShowOperatorNamePreferenceController extends AbstractPreferenceCont
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
int value = Settings.Secure.getInt(mContext.getContentResolver(),
|
int value = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
KEY_SHOW_OPERATOR_NAME, 1);
|
KEY_SHOW_OPERATOR_NAME, 1);
|
||||||
((SwitchPreference) preference).setChecked(value != 0);
|
((TwoStatePreference) preference).setChecked(value != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,7 @@ import android.content.Context;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
@@ -46,7 +46,7 @@ public class TapToWakePreferenceController extends AbstractPreferenceController
|
|||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
int value = Settings.Secure.getInt(
|
int value = Settings.Secure.getInt(
|
||||||
mContext.getContentResolver(), Settings.Secure.DOUBLE_TAP_TO_WAKE, 0);
|
mContext.getContentResolver(), Settings.Secure.DOUBLE_TAP_TO_WAKE, 0);
|
||||||
((SwitchPreference) preference).setChecked(value != 0);
|
((TwoStatePreference) preference).setChecked(value != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -19,7 +19,7 @@ import android.content.Context;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.core.BasePreferenceController;
|
import com.android.settings.core.BasePreferenceController;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
@@ -52,7 +52,7 @@ public class AutoRestrictionPreferenceController extends BasePreferenceControlle
|
|||||||
super.updateState(preference);
|
super.updateState(preference);
|
||||||
final boolean smartBatteryOn = Settings.Global.getInt(mContext.getContentResolver(),
|
final boolean smartBatteryOn = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
Settings.Global.APP_AUTO_RESTRICTION_ENABLED, ON) == ON;
|
Settings.Global.APP_AUTO_RESTRICTION_ENABLED, ON) == ON;
|
||||||
((SwitchPreference) preference).setChecked(smartBatteryOn);
|
((TwoStatePreference) preference).setChecked(smartBatteryOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user