Loading res/values/bools.xml +3 −0 Original line number Diff line number Diff line Loading @@ -48,4 +48,7 @@ <!--Whether help links are defined. --> <bool name="config_has_help">false</bool> <!-- Whether location mode is available or not. --> <bool name="config_location_mode_available">true</bool> </resources> src/com/android/settings/location/LocationModePreferenceController.java +5 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,11 @@ public class LocationModePreferenceController extends LocationBasePreferenceCont return KEY_LOCATION_MODE; } @Override public boolean isAvailable() { return mContext.getResources().getBoolean(R.bool.config_location_mode_available); } @Override public void displayPreference(PreferenceScreen screen) { super.displayPreference(screen); Loading tests/robotests/res/values-mcc999/config.xml +1 −0 Original line number Diff line number Diff line Loading @@ -20,4 +20,5 @@ <bool name="config_show_camera_laser_sensor">false</bool> <bool name="config_show_connectivity_monitor">false</bool> <bool name="config_display_recent_apps">false</bool> <bool name="config_location_mode_available">false</bool> </resources> No newline at end of file tests/robotests/src/com/android/settings/location/LocationModePreferenceControllerTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ */ package com.android.settings.location; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; Loading Loading @@ -72,6 +74,17 @@ public class LocationModePreferenceControllerTest { when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference); } @Test @Config(qualifiers = "mcc999") public void locationModePreference_ifXmlSetToFalse_shouldNotBeAvailable() { assertFalse(mController.isAvailable()); } @Test public void locationModePreference_ifXmlSetToTrue_shouldBeAvailable() { assertTrue(mController.isAvailable()); } @Test public void onLocationModeChanged_locationOff_shouldDisablePreference() { when(mUserManager.hasUserRestriction(any())).thenReturn(false); Loading Loading
res/values/bools.xml +3 −0 Original line number Diff line number Diff line Loading @@ -48,4 +48,7 @@ <!--Whether help links are defined. --> <bool name="config_has_help">false</bool> <!-- Whether location mode is available or not. --> <bool name="config_location_mode_available">true</bool> </resources>
src/com/android/settings/location/LocationModePreferenceController.java +5 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,11 @@ public class LocationModePreferenceController extends LocationBasePreferenceCont return KEY_LOCATION_MODE; } @Override public boolean isAvailable() { return mContext.getResources().getBoolean(R.bool.config_location_mode_available); } @Override public void displayPreference(PreferenceScreen screen) { super.displayPreference(screen); Loading
tests/robotests/res/values-mcc999/config.xml +1 −0 Original line number Diff line number Diff line Loading @@ -20,4 +20,5 @@ <bool name="config_show_camera_laser_sensor">false</bool> <bool name="config_show_connectivity_monitor">false</bool> <bool name="config_display_recent_apps">false</bool> <bool name="config_location_mode_available">false</bool> </resources> No newline at end of file
tests/robotests/src/com/android/settings/location/LocationModePreferenceControllerTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ */ package com.android.settings.location; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; Loading Loading @@ -72,6 +74,17 @@ public class LocationModePreferenceControllerTest { when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference); } @Test @Config(qualifiers = "mcc999") public void locationModePreference_ifXmlSetToFalse_shouldNotBeAvailable() { assertFalse(mController.isAvailable()); } @Test public void locationModePreference_ifXmlSetToTrue_shouldBeAvailable() { assertTrue(mController.isAvailable()); } @Test public void onLocationModeChanged_locationOff_shouldDisablePreference() { when(mUserManager.hasUserRestriction(any())).thenReturn(false); Loading