Merge "Add a flag for controlling location indicator settings."

This commit is contained in:
TreeHugger Robot
2021-01-13 16:48:37 +00:00
committed by Android (Google) Code Review
3 changed files with 35 additions and 0 deletions

View File

@@ -147,6 +147,12 @@ public final class Utils extends com.android.settingslib.Utils {
*/
public static final String PROPERTY_LOCATION_INDICATORS_ENABLED = "location_indicators_enabled";
/**
* Whether to show location indicator settings in developer options.
*/
public static final String PROPERTY_LOCATION_INDICATOR_SETTINGS_ENABLED =
"location_indicator_settings_enabled";
/**
* Finds a matching activity for a preference's intent. If a matching
* activity is not found, it will remove the preference.

View File

@@ -45,6 +45,11 @@ public class LocationIndicatorsPreferenceController extends TogglePreferenceCont
@Override
public int getAvailabilityStatus() {
final boolean isEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY,
Utils.PROPERTY_LOCATION_INDICATOR_SETTINGS_ENABLED, false);
if (!isEnabled) {
return UNSUPPORTED_ON_DEVICE;
}
// Location indicators feature is only available on devices that support location.
return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION)
? AVAILABLE : UNSUPPORTED_ON_DEVICE;