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:
@@ -20,7 +20,7 @@ import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class AdbAuthorizationTimeoutPreferenceController extends
|
||||
Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME);
|
||||
// An authTimeout of 0 indicates this preference is enabled and adb authorizations will not
|
||||
// be automatically revoked.
|
||||
((SwitchPreference) mPreference).setChecked(authTimeout == 0);
|
||||
((TwoStatePreference) mPreference).setChecked(authTimeout == 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,7 +64,7 @@ public class AdbAuthorizationTimeoutPreferenceController extends
|
||||
public void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
writeSetting(false);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
private void writeSetting(boolean isEnabled) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -59,7 +59,7 @@ public class AllowAppsOnExternalPreferenceController extends DeveloperOptionsPre
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.FORCE_ALLOW_ON_EXTERNAL, SETTING_VALUE_OFF);
|
||||
|
||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,6 +67,6 @@ public class AllowAppsOnExternalPreferenceController extends DeveloperOptionsPre
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -57,7 +57,7 @@ public class AppsNotRespondingPreferenceController extends DeveloperOptionsPrefe
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.ANR_SHOW_BACKGROUND, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,6 +65,6 @@ public class AppsNotRespondingPreferenceController extends DeveloperOptionsPrefe
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -59,7 +59,7 @@ public class ArtVerifierPreferenceController extends DeveloperOptionsPreferenceC
|
||||
final int verifyDebuggable = Settings.Global.getInt(
|
||||
mContext.getContentResolver(),
|
||||
Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE, SETTING_VALUE_ON);
|
||||
((SwitchPreference) mPreference).setChecked(verifyDebuggable != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(verifyDebuggable != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,6 +67,6 @@ public class ArtVerifierPreferenceController extends DeveloperOptionsPreferenceC
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
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 androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -71,7 +71,7 @@ public class AutomaticSystemServerHeapDumpPreferenceController extends
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
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
|
||||
@@ -79,6 +79,6 @@ public class AutomaticSystemServerHeapDumpPreferenceController extends
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
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 androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
@@ -76,7 +76,7 @@ public class BackAnimationPreferenceController extends DeveloperOptionsPreferenc
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.ENABLE_BACK_ANIMATION, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,6 +84,6 @@ public class BackAnimationPreferenceController extends DeveloperOptionsPreferenc
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -66,10 +66,10 @@ public class BluetoothA2dpHwOffloadPreferenceController extends DeveloperOptions
|
||||
if (offloadSupported) {
|
||||
final boolean offloadDisabled =
|
||||
SystemProperties.getBoolean(A2DP_OFFLOAD_DISABLED_PROPERTY, false);
|
||||
((SwitchPreference) mPreference).setChecked(offloadDisabled);
|
||||
((TwoStatePreference) mPreference).setChecked(offloadDisabled);
|
||||
} else {
|
||||
mPreference.setEnabled(false);
|
||||
((SwitchPreference) mPreference).setChecked(true);
|
||||
((TwoStatePreference) mPreference).setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class BluetoothA2dpHwOffloadPreferenceController extends DeveloperOptions
|
||||
final boolean offloadSupported =
|
||||
SystemProperties.getBoolean(A2DP_OFFLOAD_SUPPORTED_PROPERTY, false);
|
||||
if (offloadSupported) {
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
SystemProperties.set(A2DP_OFFLOAD_DISABLED_PROPERTY, "false");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import android.os.SystemProperties;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -57,13 +57,13 @@ public class BluetoothAbsoluteVolumePreferenceController extends
|
||||
public void updateState(Preference preference) {
|
||||
final boolean isEnabled = SystemProperties.getBoolean(
|
||||
BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_PROPERTY, false /* default */);
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
||||
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -57,13 +57,13 @@ public class BluetoothDeviceNoNamePreferenceController extends
|
||||
public void updateState(Preference preference) {
|
||||
final boolean isEnabled = SystemProperties.getBoolean(
|
||||
BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_PROPERTY, false /* default */);
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
||||
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -90,14 +90,14 @@ public class BluetoothLeAudioAllowListPreferenceController
|
||||
(mBluetoothAdapter.isLeAudioSupported() == BluetoothStatusCodes.FEATURE_SUPPORTED);
|
||||
if (!isLeAudioSupported) {
|
||||
mPreference.setEnabled(false);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
return;
|
||||
}
|
||||
|
||||
mPreference.setEnabled(true);
|
||||
final boolean isLeAudioAllowlistBypassed =
|
||||
SystemProperties.getBoolean(BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY, false);
|
||||
((SwitchPreference) mPreference).setChecked(isLeAudioAllowlistBypassed);
|
||||
((TwoStatePreference) mPreference).setChecked(isLeAudioAllowlistBypassed);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,7 +107,7 @@ public class BluetoothLeAudioAllowListPreferenceController
|
||||
SystemProperties.getBoolean(BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY, false);
|
||||
if (isBypassed) {
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -93,6 +93,6 @@ public class BluetoothLeAudioDeviceDetailsPreferenceController
|
||||
final boolean isLeAudioToggleVisible = SystemProperties.getBoolean(
|
||||
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 android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothManager;
|
||||
import android.bluetooth.BluetoothStatusCodes;
|
||||
@@ -27,7 +26,7 @@ import android.os.SystemProperties;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -87,10 +86,10 @@ public class BluetoothLeAudioHwOffloadPreferenceController
|
||||
if (leAudioEnabled && leAudioOffloadSupported && !a2dpOffloadDisabled) {
|
||||
final boolean offloadDisabled =
|
||||
SystemProperties.getBoolean(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY, true);
|
||||
((SwitchPreference) mPreference).setChecked(offloadDisabled);
|
||||
((TwoStatePreference) mPreference).setChecked(offloadDisabled);
|
||||
} else {
|
||||
mPreference.setEnabled(false);
|
||||
((SwitchPreference) mPreference).setChecked(true);
|
||||
((TwoStatePreference) mPreference).setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +107,7 @@ public class BluetoothLeAudioHwOffloadPreferenceController
|
||||
final boolean a2dpOffloadDisabled =
|
||||
SystemProperties.getBoolean(A2DP_OFFLOAD_DISABLED_PROPERTY, false);
|
||||
if (leAudioEnabled && leAudioOffloadSupported && !a2dpOffloadDisabled) {
|
||||
((SwitchPreference) mPreference).setChecked(true);
|
||||
((TwoStatePreference) mPreference).setChecked(true);
|
||||
SystemProperties.set(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY, "true");
|
||||
} else {
|
||||
mPreference.setEnabled(false);
|
||||
|
||||
@@ -24,7 +24,7 @@ import android.os.SystemProperties;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -84,7 +84,7 @@ public class BluetoothLeAudioPreferenceController
|
||||
final boolean leAudioEnabled =
|
||||
(isLeAudioSupportedStatus == BluetoothStatusCodes.FEATURE_SUPPORTED);
|
||||
|
||||
((SwitchPreference) mPreference).setChecked(!leAudioEnabled);
|
||||
((TwoStatePreference) mPreference).setChecked(!leAudioEnabled);
|
||||
|
||||
// Disable option if Bluetooth is disabled or if switch is not supported
|
||||
if (isLeAudioSupportedStatus == BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED
|
||||
|
||||
@@ -22,7 +22,7 @@ import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -68,7 +68,7 @@ public class BugReportInPowerPreferenceController extends
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.BUGREPORT_IN_POWER_MENU, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,6 +76,6 @@ public class BugReportInPowerPreferenceController extends
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
@@ -72,7 +72,7 @@ public class CameraLaserSensorPreferenceController extends DeveloperOptionsPrefe
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
final boolean enabled = isLaserSensorEnabled();
|
||||
((SwitchPreference) mPreference).setChecked(enabled);
|
||||
((TwoStatePreference) mPreference).setChecked(enabled);
|
||||
}
|
||||
|
||||
// There should be no impact on the current
|
||||
|
||||
@@ -24,14 +24,14 @@ import android.os.Looper;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Display;
|
||||
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settingslib.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ColorModePreference extends SwitchPreference implements DisplayListener {
|
||||
public class ColorModePreference extends TwoStatePreference implements DisplayListener {
|
||||
|
||||
private DisplayManager mDisplayManager;
|
||||
private Display mDisplay;
|
||||
|
||||
@@ -22,7 +22,7 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
@@ -65,14 +65,14 @@ public class CoolColorTemperaturePreferenceController extends DeveloperOptionsPr
|
||||
public void updateState(Preference preference) {
|
||||
final boolean enableColorTemperature = SystemProperties.getBoolean(
|
||||
COLOR_TEMPERATURE_PROPERTY, false /* default */);
|
||||
((SwitchPreference) mPreference).setChecked(enableColorTemperature);
|
||||
((TwoStatePreference) mPreference).setChecked(enableColorTemperature);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
SystemProperties.set(COLOR_TEMPERATURE_PROPERTY, Boolean.toString(false));
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -59,7 +59,7 @@ public class DebugViewAttributesPreferenceController extends
|
||||
public void updateState(Preference preference) {
|
||||
final int debugViewAttrMode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.DEBUG_VIEW_ATTRIBUTES, 0 /* default */);
|
||||
((SwitchPreference) mPreference).setChecked(debugViewAttrMode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(debugViewAttrMode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,6 +67,6 @@ public class DebugViewAttributesPreferenceController extends
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
@@ -71,7 +71,7 @@ public class DesktopModePreferenceController extends DeveloperOptionsPreferenceC
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
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
|
||||
@@ -79,7 +79,7 @@ public class DesktopModePreferenceController extends DeveloperOptionsPreferenceC
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -63,7 +63,7 @@ public class DisableAutomaticUpdatesPreferenceController extends
|
||||
final int updatesEnabled = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.OTA_DISABLE_AUTOMATIC_UPDATE, 0 /* default */);
|
||||
|
||||
((SwitchPreference) mPreference).setChecked(updatesEnabled != DISABLE_UPDATES_SETTING);
|
||||
((TwoStatePreference) mPreference).setChecked(updatesEnabled != DISABLE_UPDATES_SETTING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,6 +71,6 @@ public class DisableAutomaticUpdatesPreferenceController extends
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -69,7 +69,7 @@ public final class EnableBlursPreferenceController extends DeveloperOptionsPrefe
|
||||
public void updateState(Preference preference) {
|
||||
boolean isEnabled = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.DISABLE_WINDOW_BLURS, 0) == 0;
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
||||
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -59,7 +59,8 @@ public class EnableGnssRawMeasFullTrackingPreferenceController extends
|
||||
final int enableGnssRawMeasFullTrackingMode =
|
||||
Settings.Global.getInt(mContext.getContentResolver(),
|
||||
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
|
||||
@@ -67,6 +68,6 @@ public class EnableGnssRawMeasFullTrackingPreferenceController extends
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -58,7 +58,8 @@ public class EnableGpuDebugLayersPreferenceController extends DeveloperOptionsPr
|
||||
public void updateState(Preference preference) {
|
||||
final int enableGpuDebugLayersMode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.ENABLE_GPU_DEBUG_LAYERS, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(enableGpuDebugLayersMode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference)
|
||||
.setChecked(enableGpuDebugLayersMode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,6 +67,6 @@ public class EnableGpuDebugLayersPreferenceController extends DeveloperOptionsPr
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -84,7 +84,7 @@ public class EnableVerboseVendorLoggingPreferenceController
|
||||
ThreadUtils.postOnBackgroundThread(() -> {
|
||||
final boolean enabled = getVerboseLoggingEnabled();
|
||||
ThreadUtils.getUiThreadHandler().post(() ->
|
||||
((SwitchPreference) mPreference).setChecked(enabled));
|
||||
((TwoStatePreference) mPreference).setChecked(enabled));
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class EnableVerboseVendorLoggingPreferenceController
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
ThreadUtils.postOnBackgroundThread(() ->
|
||||
setVerboseLoggingEnabled(false));
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -21,7 +21,7 @@ import android.os.SystemProperties;
|
||||
import android.view.ThreadedRenderer;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -54,13 +54,13 @@ public class ForceDarkPreferenceController extends DeveloperOptionsPreferenceCon
|
||||
public void updateState(Preference preference) {
|
||||
final boolean isEnabled = SystemProperties.getBoolean(
|
||||
ThreadedRenderer.DEBUG_FORCE_DARK, false /* default */);
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
||||
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
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 androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
@@ -81,13 +81,13 @@ public class ForceEnableNotesRolePreferenceController
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled());
|
||||
((TwoStatePreference) mPreference).setChecked(isEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.content.Context;
|
||||
import android.sysprop.DisplayProperties;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -51,13 +51,13 @@ public class ForceMSAAPreferenceController extends DeveloperOptionsPreferenceCon
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
final boolean isEnabled = DisplayProperties.debug_force_msaa().orElse(false);
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
||||
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
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.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
@@ -72,7 +72,7 @@ public class ForcePeakRefreshRatePreferenceController extends DeveloperOptionsPr
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
((SwitchPreference) mPreference).setChecked(isForcePeakRefreshRateEnabled());
|
||||
((TwoStatePreference) mPreference).setChecked(isForcePeakRefreshRateEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,7 +90,7 @@ public class ForcePeakRefreshRatePreferenceController extends DeveloperOptionsPr
|
||||
Settings.System.putFloat(mContext.getContentResolver(),
|
||||
Settings.System.MIN_REFRESH_RATE, NO_CONFIG);
|
||||
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -22,7 +22,7 @@ import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
@@ -69,7 +69,7 @@ public class FreeformWindowsPreferenceController extends DeveloperOptionsPrefere
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
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
|
||||
@@ -77,7 +77,7 @@ public class FreeformWindowsPreferenceController extends DeveloperOptionsPrefere
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -67,13 +67,13 @@ public abstract class GlobalSettingSwitchPreferenceController extends
|
||||
public void updateState(Preference preference) {
|
||||
final int mode =
|
||||
Settings.Global.getInt(mContext.getContentResolver(), mSettingsKey, mDefault);
|
||||
((SwitchPreference) mPreference).setChecked(mode != mOff);
|
||||
((TwoStatePreference) mPreference).setChecked(mode != mOff);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
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 androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -54,13 +54,13 @@ public class GpuViewUpdatesPreferenceController extends DeveloperOptionsPreferen
|
||||
public void updateState(Preference preference) {
|
||||
final boolean isEnabled = SystemProperties.getBoolean(
|
||||
ThreadedRenderer.DEBUG_DIRTY_REGIONS_PROPERTY, false /* default */);
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
||||
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
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 androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -54,13 +54,13 @@ public class HardwareLayersUpdatesPreferenceController extends DeveloperOptionsP
|
||||
public void updateState(Preference preference) {
|
||||
final boolean isEnabled = SystemProperties.getBoolean(
|
||||
ThreadedRenderer.DEBUG_SHOW_LAYERS_UPDATES_PROPERTY, false /* default */);
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
||||
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -71,7 +71,7 @@ public class HardwareOverlaysPreferenceController extends DeveloperOptionsPrefer
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
final SwitchPreference switchPreference = (SwitchPreference) mPreference;
|
||||
final TwoStatePreference switchPreference = (TwoStatePreference) mPreference;
|
||||
if (switchPreference.isChecked()) {
|
||||
// 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
|
||||
@@ -96,7 +96,7 @@ public class HardwareOverlaysPreferenceController extends DeveloperOptionsPrefer
|
||||
@SuppressWarnings("unused") final int showUpdates = reply.readInt();
|
||||
@SuppressWarnings("unused") final int showBackground = reply.readInt();
|
||||
final int disableOverlays = reply.readInt();
|
||||
((SwitchPreference) mPreference).setChecked(disableOverlays != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(disableOverlays != SETTING_VALUE_OFF);
|
||||
reply.recycle();
|
||||
data.recycle();
|
||||
} catch (RemoteException ex) {
|
||||
|
||||
@@ -25,7 +25,7 @@ import android.provider.Settings;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -68,14 +68,14 @@ public class KeepActivitiesPreferenceController extends DeveloperOptionsPreferen
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.ALWAYS_FINISH_ACTIVITIES, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
writeImmediatelyDestroyActivitiesOptions(false);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
private void writeImmediatelyDestroyActivitiesOptions(boolean isEnabled) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import android.os.UserManager;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -63,7 +63,7 @@ public class LocalTerminalPreferenceController extends DeveloperOptionsPreferenc
|
||||
public void updateState(Preference preference) {
|
||||
final boolean isTerminalEnabled = mPackageManager.getApplicationEnabledSetting(
|
||||
TERMINAL_APP_PACKAGE) == PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
|
||||
((SwitchPreference) mPreference).setChecked(isTerminalEnabled);
|
||||
((TwoStatePreference) mPreference).setChecked(isTerminalEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,7 +78,7 @@ public class LocalTerminalPreferenceController extends DeveloperOptionsPreferenc
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
mPackageManager.setApplicationEnabledSetting(TERMINAL_APP_PACKAGE,
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0 /* flags */);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -59,7 +59,7 @@ public class MobileDataAlwaysOnPreferenceController extends
|
||||
final int mobileDataAlwaysOnMode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.MOBILE_DATA_ALWAYS_ON, SETTING_VALUE_ON);
|
||||
|
||||
((SwitchPreference) mPreference).setChecked(mobileDataAlwaysOnMode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(mobileDataAlwaysOnMode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,6 +67,6 @@ public class MobileDataAlwaysOnPreferenceController extends
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.MOBILE_DATA_ALWAYS_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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -67,7 +67,7 @@ public class MockModemPreferenceController extends
|
||||
try {
|
||||
final boolean isEnabled = SystemProperties.getBoolean(
|
||||
ALLOW_MOCK_MODEM_PROPERTY, false /* default */);
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
||||
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "Fail to get radio system property: " + e.getMessage());
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class MockModemPreferenceController extends
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
try {
|
||||
SystemProperties.set(ALLOW_MOCK_MODEM_PROPERTY, "false");
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
} catch (RuntimeException e) {
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class NfcSnoopLogPreferenceController extends
|
||||
public void updateState(Preference preference) {
|
||||
try {
|
||||
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) {
|
||||
Log.e(TAG, "Fail to get nfc system property: " + e.getMessage());
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class NfcSnoopLogPreferenceController extends
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
try {
|
||||
SystemProperties.set(NFC_NFCSNOOP_LOG_MODE_PROPERTY, NFCSNOOP_MODE_FILTERED);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
} catch (RuntimeException e) {
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -63,7 +63,7 @@ public class NfcStackDebugLogPreferenceController extends
|
||||
try {
|
||||
final boolean isEnabled = SystemProperties.getBoolean(
|
||||
NFC_STACK_DEBUGLOG_ENABLED_PROPERTY, false /* default */);
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
||||
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "Fail to get nfc system property: " + e.getMessage());
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class NfcStackDebugLogPreferenceController extends
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
try {
|
||||
SystemProperties.set(NFC_STACK_DEBUGLOG_ENABLED_PROPERTY, "false");
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
} catch (RuntimeException e) {
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class NfcVerboseVendorLogPreferenceController
|
||||
public void updateState(Preference preference) {
|
||||
try {
|
||||
final String currentValue = SystemProperties.get(NFC_VERBOSE_VENDOR_LOG_PROPERTY);
|
||||
((SwitchPreference) mPreference)
|
||||
((TwoStatePreference) mPreference)
|
||||
.setChecked(currentValue.equals(VERBOSE_VENDOR_LOG_ENABLED));
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "Fail to get nfc system property: " + e.getMessage());
|
||||
@@ -81,7 +81,7 @@ public class NfcVerboseVendorLogPreferenceController
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
try {
|
||||
SystemProperties.set(NFC_VERBOSE_VENDOR_LOG_PROPERTY, VERBOSE_VENDOR_LOG_DISABLED);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
} catch (RuntimeException e) {
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -66,7 +66,7 @@ public class NonResizableMultiWindowPreferenceController
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,6 +74,6 @@ public class NonResizableMultiWindowPreferenceController
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -62,7 +62,7 @@ public class NotificationChannelWarningsPreferenceController extends
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, 0);
|
||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,7 +70,7 @@ public class NotificationChannelWarningsPreferenceController extends
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -23,7 +23,7 @@ import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -59,7 +59,7 @@ public class OverlaySettingsPreferenceController extends DeveloperOptionsPrefere
|
||||
|
||||
@Override
|
||||
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 androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -66,7 +66,7 @@ public class PhantomProcessPreferenceController extends
|
||||
try {
|
||||
final boolean isEnabled = !FeatureFlagUtils.isEnabled(mContext,
|
||||
SETTINGS_ENABLE_MONITOR_PHANTOM_PROCS);
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
||||
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "Fail to get feature flag: " + e.getMessage());
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class PhantomProcessPreferenceController extends
|
||||
FeatureFlagUtils.setEnabled(mContext,
|
||||
SETTINGS_ENABLE_MONITOR_PHANTOM_PROCS,
|
||||
true /* Enable the monitoring */);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "Fail to set feature flag: " + e.getMessage());
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -57,7 +57,7 @@ public class PointerLocationPreferenceController extends DeveloperOptionsPrefere
|
||||
public void updateState(Preference preference) {
|
||||
final int pointerLocationMode = Settings.System.getInt(mContext.getContentResolver(),
|
||||
Settings.System.POINTER_LOCATION, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(pointerLocationMode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(pointerLocationMode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,6 +65,6 @@ public class PointerLocationPreferenceController extends DeveloperOptionsPrefere
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.System.putInt(mContext.getContentResolver(), Settings.System.POINTER_LOCATION,
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -58,7 +58,7 @@ public class ResizableActivityPreferenceController extends DeveloperOptionsPrefe
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,6 +66,6 @@ public class ResizableActivityPreferenceController extends DeveloperOptionsPrefe
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.internal.app.LocalePicker;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
@@ -59,7 +59,7 @@ public class RtlLayoutPreferenceController extends DeveloperOptionsPreferenceCon
|
||||
public void updateState(Preference preference) {
|
||||
int rtlLayoutMode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.DEVELOPMENT_FORCE_RTL, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(rtlLayoutMode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(rtlLayoutMode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +67,7 @@ public class RtlLayoutPreferenceController extends DeveloperOptionsPreferenceCon
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
writeToForceRtlLayoutSetting(false);
|
||||
updateLocales();
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -54,13 +54,13 @@ public abstract class SecureSettingSwitchPreferenceController extends
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.Secure.getInt(
|
||||
mContext.getContentResolver(), mSettingsKey, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -66,7 +66,7 @@ public class ShowFirstCrashDialogPreferenceController extends DeveloperOptionsPr
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
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
|
||||
@@ -74,6 +74,6 @@ public class ShowFirstCrashDialogPreferenceController extends DeveloperOptionsPr
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -59,7 +59,7 @@ public class ShowKeyPressesPreferenceController extends
|
||||
public void updateState(Preference preference) {
|
||||
int showKeyPresses = Settings.System.getInt(mContext.getContentResolver(),
|
||||
Settings.System.SHOW_KEY_PRESSES, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(showKeyPresses != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(showKeyPresses != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,6 +67,6 @@ public class ShowKeyPressesPreferenceController extends
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.System.putInt(mContext.getContentResolver(), Settings.System.SHOW_KEY_PRESSES,
|
||||
SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.content.Context;
|
||||
import android.sysprop.DisplayProperties;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -51,13 +51,13 @@ public class ShowLayoutBoundsPreferenceController extends DeveloperOptionsPrefer
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
final boolean isEnabled = DisplayProperties.debug_layout().orElse(false);
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
||||
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -75,7 +75,7 @@ public class ShowRefreshRatePreferenceController extends DeveloperOptionsPrefere
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
final SwitchPreference preference = (SwitchPreference) mPreference;
|
||||
final TwoStatePreference preference = (TwoStatePreference) mPreference;
|
||||
if (preference.isChecked()) {
|
||||
// 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
|
||||
@@ -95,7 +95,7 @@ public class ShowRefreshRatePreferenceController extends DeveloperOptionsPrefere
|
||||
data.writeInt(SETTING_VALUE_QUERY);
|
||||
mSurfaceFlinger.transact(SURFACE_FLINGER_CODE, data, reply, 0 /* flags */);
|
||||
final boolean enabled = reply.readBoolean();
|
||||
((SwitchPreference) mPreference).setChecked(enabled);
|
||||
((TwoStatePreference) mPreference).setChecked(enabled);
|
||||
reply.recycle();
|
||||
data.recycle();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import android.os.ServiceManager;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -72,7 +72,7 @@ public class ShowSurfaceUpdatesPreferenceController extends DeveloperOptionsPref
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
final SwitchPreference preference = (SwitchPreference) mPreference;
|
||||
final TwoStatePreference preference = (TwoStatePreference) mPreference;
|
||||
if (preference.isChecked()) {
|
||||
// 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
|
||||
@@ -93,7 +93,7 @@ public class ShowSurfaceUpdatesPreferenceController extends DeveloperOptionsPref
|
||||
@SuppressWarnings("unused") final int showCpu = reply.readInt();
|
||||
@SuppressWarnings("unused") final int enableGL = reply.readInt();
|
||||
final int showUpdates = reply.readInt();
|
||||
((SwitchPreference) mPreference).setChecked(showUpdates != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(showUpdates != SETTING_VALUE_OFF);
|
||||
reply.recycle();
|
||||
data.recycle();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -57,7 +57,7 @@ public class ShowTapsPreferenceController extends DeveloperOptionsPreferenceCont
|
||||
public void updateState(Preference preference) {
|
||||
int showTapsMode = Settings.System.getInt(mContext.getContentResolver(),
|
||||
Settings.System.SHOW_TOUCHES, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(showTapsMode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(showTapsMode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,6 +65,6 @@ public class ShowTapsPreferenceController extends DeveloperOptionsPreferenceCont
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.System.putInt(mContext.getContentResolver(), Settings.System.SHOW_TOUCHES,
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -64,14 +64,14 @@ public class StrictModePreferenceController extends DeveloperOptionsPreferenceCo
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
((SwitchPreference) mPreference).setChecked(isStrictModeEnabled());
|
||||
((TwoStatePreference) mPreference).setChecked(isStrictModeEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
writeStrictModeVisualOptions(false);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
private boolean isStrictModeEnabled() {
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -57,7 +57,7 @@ class StylusHandwritingPreferenceController extends DeveloperOptionsPreferenceCo
|
||||
final int enable = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_HANDWRITING_ENABLED,
|
||||
Settings.Secure.STYLUS_HANDWRITING_DEFAULT_VALUE);
|
||||
((SwitchPreference) mPreference).setChecked(enable != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(enable != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,6 +66,6 @@ class StylusHandwritingPreferenceController extends DeveloperOptionsPreferenceCo
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_HANDWRITING_ENABLED,
|
||||
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 androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -54,13 +54,13 @@ public abstract class SystemSettingSwitchPreferenceController extends
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.System.getInt(
|
||||
mContext.getContentResolver(), mSettingsKey, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -61,7 +61,7 @@ public class TetheringHardwareAccelPreferenceController extends DeveloperOptions
|
||||
final int tetheringMode = Settings.Global.getInt(
|
||||
mContext.getContentResolver(),
|
||||
Settings.Global.TETHER_OFFLOAD_DISABLED, 0 /* default */);
|
||||
((SwitchPreference) mPreference).setChecked(tetheringMode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(tetheringMode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,6 +69,6 @@ public class TetheringHardwareAccelPreferenceController extends DeveloperOptions
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
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 androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
@@ -62,13 +62,13 @@ public class TransparentNavigationBarPreferenceController
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled());
|
||||
((TwoStatePreference) mPreference).setChecked(isEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
final boolean enabled = isEnabled();
|
||||
if (!enabled) {
|
||||
setEnabled(false);
|
||||
|
||||
@@ -25,7 +25,7 @@ import android.provider.Settings;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.RestrictedSwitchPreference;
|
||||
@@ -81,7 +81,7 @@ public class UsbAudioRoutingPreferenceController extends DeveloperOptionsPrefere
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,7 +29,7 @@ import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -79,7 +79,7 @@ public class WaitForDebuggerPreferenceController extends DeveloperOptionsPrefere
|
||||
}
|
||||
|
||||
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(),
|
||||
Settings.Global.WAIT_FOR_DEBUGGER, SETTING_VALUE_OFF) != SETTING_VALUE_OFF;
|
||||
writeDebuggerAppOptions(debugApp, debuggerEnabled, true /* persistent */);
|
||||
@@ -92,7 +92,7 @@ public class WaitForDebuggerPreferenceController extends DeveloperOptionsPrefere
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
writeDebuggerAppOptions(null /* package name */,
|
||||
false /* waitForDebugger */, false /* persistent */);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -21,7 +21,7 @@ import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -60,7 +60,7 @@ public class WifiDisplayCertificationPreferenceController extends
|
||||
final int wifiDisplayCertificationMode = Settings.Global.getInt(
|
||||
mContext.getContentResolver(), Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON,
|
||||
SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(
|
||||
((TwoStatePreference) mPreference).setChecked(
|
||||
wifiDisplayCertificationMode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@@ -69,6 +69,6 @@ public class WifiDisplayCertificationPreferenceController extends
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
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 androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -60,7 +60,7 @@ public class WifiNonPersistentMacRandomizationPreferenceController
|
||||
NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG, 0) == 1) {
|
||||
enabled = true;
|
||||
}
|
||||
((SwitchPreference) mPreference).setChecked(enabled);
|
||||
((TwoStatePreference) mPreference).setChecked(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,6 +68,6 @@ public class WifiNonPersistentMacRandomizationPreferenceController
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
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 androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -50,13 +50,13 @@ public class WifiScanThrottlingPreferenceController extends DeveloperOptionsPref
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
((SwitchPreference) mPreference).setChecked(mWifiManager.isScanThrottleEnabled());
|
||||
((TwoStatePreference) mPreference).setChecked(mWifiManager.isScanThrottleEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -59,7 +59,7 @@ public class WifiVerboseLoggingPreferenceController extends DeveloperOptionsPref
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
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() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
mWifiManager.setVerboseLoggingEnabled(false);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.development.BluetoothA2dpConfigStore;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
@@ -64,7 +64,7 @@ public class BluetoothHDAudioPreferenceController extends AbstractBluetoothPrefe
|
||||
if (supported) {
|
||||
final boolean isEnabled = bluetoothA2dp.isOptionalCodecsEnabled(activeDevice)
|
||||
== 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.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
@@ -164,16 +164,16 @@ public class GraphicsDriverEnableAngleAsSystemDriverController
|
||||
final String currentGlesDriver =
|
||||
mSystemProperties.get(PROPERTY_PERSISTENT_GRAPHICS_EGL, "");
|
||||
final boolean isAngle = TextUtils.equals(ANGLE_DRIVER_SUFFIX, currentGlesDriver);
|
||||
((SwitchPreference) mPreference).setChecked(isAngle);
|
||||
((TwoStatePreference) mPreference).setChecked(isAngle);
|
||||
} else {
|
||||
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
|
||||
// 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.
|
||||
if (!isAngleDeveloperOptionEnabled() && !((SwitchPreference) mPreference).isChecked()) {
|
||||
if (!isAngleDeveloperOptionEnabled() && !((TwoStatePreference) mPreference).isChecked()) {
|
||||
mPreference.setEnabled(false);
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ public class GraphicsDriverEnableAngleAsSystemDriverController
|
||||
// 2) set the persist.graphics.egl empty string
|
||||
GraphicsEnvironment.getInstance().toggleAngleAsSystemDriver(false);
|
||||
// 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 ""
|
||||
GraphicsEnvironment.getInstance().toggleAngleAsSystemDriver(false);
|
||||
// toggle switch off
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ public class GraphicsDriverEnableAngleAsSystemDriverController
|
||||
// if persist.graphicx.egl = "", set the persist.graphics.egl back to "angle"
|
||||
GraphicsEnvironment.getInstance().toggleAngleAsSystemDriver(true);
|
||||
// toggle switch on
|
||||
((SwitchPreference) mPreference).setChecked(true);
|
||||
((TwoStatePreference) mPreference).setChecked(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user