Loading res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -787,4 +787,7 @@ <!-- Whether location services setting is available or not. --> <bool name="config_show_location_services">true</bool> <!-- Whether to disable location toggle for ChromeOS devices--> <bool name="config_disable_location_toggle_for_chrome">false</bool> </resources> res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -663,6 +663,8 @@ <string name="location_settings_footer_learn_more_content_description"> Learn more about Location settings </string> <!-- Tooltip for switchbar on Chrome devices. [CHAR LIMIT=90]--> <string name="location_settings_tooltip_text_for_chrome">To change location access, go to Settings > Security and Privacy > Privacy controls</string> <!-- Main Settings screen setting option title for the item to take you to the accounts screen [CHAR LIMIT=22] --> <string name="account_settings_title">Accounts</string> Loading src/com/android/settings/location/LocationSettings.java +23 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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()); Loading Loading @@ -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)); } } } Loading
res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -787,4 +787,7 @@ <!-- Whether location services setting is available or not. --> <bool name="config_show_location_services">true</bool> <!-- Whether to disable location toggle for ChromeOS devices--> <bool name="config_disable_location_toggle_for_chrome">false</bool> </resources>
res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -663,6 +663,8 @@ <string name="location_settings_footer_learn_more_content_description"> Learn more about Location settings </string> <!-- Tooltip for switchbar on Chrome devices. [CHAR LIMIT=90]--> <string name="location_settings_tooltip_text_for_chrome">To change location access, go to Settings > Security and Privacy > Privacy controls</string> <!-- Main Settings screen setting option title for the item to take you to the accounts screen [CHAR LIMIT=22] --> <string name="account_settings_title">Accounts</string> Loading
src/com/android/settings/location/LocationSettings.java +23 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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()); Loading Loading @@ -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)); } } }