diff --git a/res/values/bools.xml b/res/values/bools.xml
index 59367b55bed..c896a45015e 100644
--- a/res/values/bools.xml
+++ b/res/values/bools.xml
@@ -48,4 +48,7 @@
false
+
+
+ true
diff --git a/src/com/android/settings/location/LocationModePreferenceController.java b/src/com/android/settings/location/LocationModePreferenceController.java
index a9ed6ad6190..265a9dfe797 100644
--- a/src/com/android/settings/location/LocationModePreferenceController.java
+++ b/src/com/android/settings/location/LocationModePreferenceController.java
@@ -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);
diff --git a/tests/robotests/res/values-mcc999/config.xml b/tests/robotests/res/values-mcc999/config.xml
index 4113c90a289..e25fa188b23 100644
--- a/tests/robotests/res/values-mcc999/config.xml
+++ b/tests/robotests/res/values-mcc999/config.xml
@@ -20,4 +20,5 @@
false
false
false
+ false
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/location/LocationModePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/location/LocationModePreferenceControllerTest.java
index b870d39c9a4..89547904aa8 100644
--- a/tests/robotests/src/com/android/settings/location/LocationModePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/location/LocationModePreferenceControllerTest.java
@@ -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;
@@ -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);