Loading src/com/android/settings/development/EnhancedConnectivityPreferenceController.java +4 −4 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ public class EnhancedConnectivityPreferenceController extends @VisibleForTesting static final int ENHANCED_CONNECTIVITY_ON = 1; // default is enhanced connectivity disabled. // default is enhanced connectivity enabled. @VisibleForTesting static final int ENHANCED_CONNECTIVITY_OFF = 0; Loading Loading @@ -65,7 +65,7 @@ public class EnhancedConnectivityPreferenceController extends public void updateState(Preference preference) { final int enhancedConnectivityEnabled = Settings.Global.getInt( mContext.getContentResolver(), Settings.Global.ENHANCED_CONNECTIVITY_ENABLED, ENHANCED_CONNECTIVITY_OFF); ENHANCED_CONNECTIVITY_ON); ((SwitchPreference) mPreference).setChecked( enhancedConnectivityEnabled == ENHANCED_CONNECTIVITY_ON); } Loading @@ -75,7 +75,7 @@ public class EnhancedConnectivityPreferenceController extends super.onDeveloperOptionsSwitchDisabled(); Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.ENHANCED_CONNECTIVITY_ENABLED, ENHANCED_CONNECTIVITY_OFF); ((SwitchPreference) mPreference).setChecked(false); ENHANCED_CONNECTIVITY_ON); ((SwitchPreference) mPreference).setChecked(true); } } tests/robotests/src/com/android/settings/development/EnhancedConnectivityPreferenceControllerTest.java +6 −6 Original line number Diff line number Diff line Loading @@ -88,20 +88,20 @@ public class EnhancedConnectivityPreferenceControllerTest { } @Test public void onDeveloperOptionsDisabled_shouldDisablePreference() { mController.onDeveloperOptionsDisabled(); public void onDeveloperOptionsDisabled_shouldEnablePreference() { mController.onDeveloperOptionsSwitchDisabled(); verify(mPreference).setEnabled(false); verify(mPreference).setChecked(false); verify(mPreference).setChecked(true); assertThat(isSettingEnabled()).isFalse(); assertThat(isSettingEnabled()).isTrue(); } private boolean isSettingEnabled() { return Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.ENHANCED_CONNECTIVITY_ENABLED, EnhancedConnectivityPreferenceController.ENHANCED_CONNECTIVITY_OFF /* default off */) EnhancedConnectivityPreferenceController.ENHANCED_CONNECTIVITY_ON /* default on */) == EnhancedConnectivityPreferenceController.ENHANCED_CONNECTIVITY_ON; } } Loading
src/com/android/settings/development/EnhancedConnectivityPreferenceController.java +4 −4 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ public class EnhancedConnectivityPreferenceController extends @VisibleForTesting static final int ENHANCED_CONNECTIVITY_ON = 1; // default is enhanced connectivity disabled. // default is enhanced connectivity enabled. @VisibleForTesting static final int ENHANCED_CONNECTIVITY_OFF = 0; Loading Loading @@ -65,7 +65,7 @@ public class EnhancedConnectivityPreferenceController extends public void updateState(Preference preference) { final int enhancedConnectivityEnabled = Settings.Global.getInt( mContext.getContentResolver(), Settings.Global.ENHANCED_CONNECTIVITY_ENABLED, ENHANCED_CONNECTIVITY_OFF); ENHANCED_CONNECTIVITY_ON); ((SwitchPreference) mPreference).setChecked( enhancedConnectivityEnabled == ENHANCED_CONNECTIVITY_ON); } Loading @@ -75,7 +75,7 @@ public class EnhancedConnectivityPreferenceController extends super.onDeveloperOptionsSwitchDisabled(); Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.ENHANCED_CONNECTIVITY_ENABLED, ENHANCED_CONNECTIVITY_OFF); ((SwitchPreference) mPreference).setChecked(false); ENHANCED_CONNECTIVITY_ON); ((SwitchPreference) mPreference).setChecked(true); } }
tests/robotests/src/com/android/settings/development/EnhancedConnectivityPreferenceControllerTest.java +6 −6 Original line number Diff line number Diff line Loading @@ -88,20 +88,20 @@ public class EnhancedConnectivityPreferenceControllerTest { } @Test public void onDeveloperOptionsDisabled_shouldDisablePreference() { mController.onDeveloperOptionsDisabled(); public void onDeveloperOptionsDisabled_shouldEnablePreference() { mController.onDeveloperOptionsSwitchDisabled(); verify(mPreference).setEnabled(false); verify(mPreference).setChecked(false); verify(mPreference).setChecked(true); assertThat(isSettingEnabled()).isFalse(); assertThat(isSettingEnabled()).isTrue(); } private boolean isSettingEnabled() { return Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.ENHANCED_CONNECTIVITY_ENABLED, EnhancedConnectivityPreferenceController.ENHANCED_CONNECTIVITY_OFF /* default off */) EnhancedConnectivityPreferenceController.ENHANCED_CONNECTIVITY_ON /* default on */) == EnhancedConnectivityPreferenceController.ENHANCED_CONNECTIVITY_ON; } }