diff --git a/res/values/config.xml b/res/values/config.xml
index 00e5c99fde6..0b4851563f2 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -787,4 +787,7 @@
true
+
+
+ false
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 257d9522796..88bd4d730bc 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -663,6 +663,8 @@
Learn more about Location settings
+
+ To change location access, go to Settings > Security and Privacy > Privacy controls
Accounts
diff --git a/src/com/android/settings/location/LocationSettings.java b/src/com/android/settings/location/LocationSettings.java
index ff8b4be390e..7bb02285676 100644
--- a/src/com/android/settings/location/LocationSettings.java
+++ b/src/com/android/settings/location/LocationSettings.java
@@ -25,7 +25,9 @@ import android.location.SettingInjectorService;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
+import android.os.SystemProperties;
import android.provider.Settings;
+import android.util.Log;
import androidx.preference.Preference;
import androidx.preference.PreferenceGroup;
@@ -72,6 +74,13 @@ public class LocationSettings extends DashboardFragment implements
private RecentLocationAccessPreferenceController mController;
private ContentObserver mContentObserver;
+ /**
+ * Read-only boot property used to enable/disable geolocation toggle as part of privacy hub
+ * feature for chrome.
+ */
+ private static final String RO_BOOT_ENABLE_PRIVACY_HUB_FOR_CHROME =
+ "ro.boot.enable_privacy_hub_for_chrome";
+
@Override
public int getMetricsCategory() {
return SettingsEnums.LOCATION;
@@ -83,6 +92,7 @@ public class LocationSettings extends DashboardFragment implements
final SettingsActivity activity = (SettingsActivity) getActivity();
final SettingsMainSwitchBar switchBar = activity.getSwitchBar();
switchBar.setTitle(getContext().getString(R.string.location_settings_primary_switch_title));
+ updateChromeSwitchBarPreference(switchBar);
switchBar.show();
mSwitchBarController = new LocationSwitchBarController(activity, switchBar,
getSettingsLifecycle());
@@ -161,4 +171,17 @@ public class LocationSettings extends DashboardFragment implements
*/
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.location_settings);
+
+ /**
+ * Update switchbar config in case of Chrome devices and location is managed by chrome.
+ */
+ private void updateChromeSwitchBarPreference(final SettingsMainSwitchBar switchBar) {
+ if (getContext().getResources().getBoolean(R.bool.config_disable_location_toggle_for_chrome)
+ && SystemProperties.getBoolean(RO_BOOT_ENABLE_PRIVACY_HUB_FOR_CHROME, false)) {
+ Log.i(TAG, "Disabling location toggle for chrome devices");
+ switchBar.setClickable(false);
+ switchBar.setTooltipText(getResources().getString(
+ R.string.location_settings_tooltip_text_for_chrome));
+ }
+ }
}