Loading core/java/com/android/server/SystemConfig.java +38 −2 Original line number Original line Diff line number Diff line Loading @@ -89,7 +89,7 @@ public class SystemConfig { private static final int ALLOW_ASSOCIATIONS = 0x080; private static final int ALLOW_ASSOCIATIONS = 0x080; // ALLOW_OVERRIDE_APP_RESTRICTIONS allows to use "allow-in-power-save-except-idle", // ALLOW_OVERRIDE_APP_RESTRICTIONS allows to use "allow-in-power-save-except-idle", // "allow-in-power-save", "allow-in-data-usage-save","allow-unthrottled-location", // "allow-in-power-save", "allow-in-data-usage-save","allow-unthrottled-location", // and "allow-ignore-location-settings". // "allow-ignore-location-settings" and "allow-adas-location-settings". private static final int ALLOW_OVERRIDE_APP_RESTRICTIONS = 0x100; private static final int ALLOW_OVERRIDE_APP_RESTRICTIONS = 0x100; private static final int ALLOW_IMPLICIT_BROADCASTS = 0x200; private static final int ALLOW_IMPLICIT_BROADCASTS = 0x200; private static final int ALLOW_VENDOR_APEX = 0x400; private static final int ALLOW_VENDOR_APEX = 0x400; Loading Loading @@ -234,6 +234,10 @@ public class SystemConfig { // without throttling, as read from the configuration files. // without throttling, as read from the configuration files. final ArraySet<String> mAllowUnthrottledLocation = new ArraySet<>(); final ArraySet<String> mAllowUnthrottledLocation = new ArraySet<>(); // These are the packages that are allow-listed to be able to retrieve location when // the location state is driver assistance only. final ArrayMap<String, ArraySet<String>> mAllowAdasSettings = new ArrayMap<>(); // These are the packages that are white-listed to be able to retrieve location even when user // These are the packages that are white-listed to be able to retrieve location even when user // location settings are off, for emergency purposes, as read from the configuration files. // location settings are off, for emergency purposes, as read from the configuration files. final ArrayMap<String, ArraySet<String>> mAllowIgnoreLocationSettings = new ArrayMap<>(); final ArrayMap<String, ArraySet<String>> mAllowIgnoreLocationSettings = new ArrayMap<>(); Loading Loading @@ -394,6 +398,10 @@ public class SystemConfig { return mAllowUnthrottledLocation; return mAllowUnthrottledLocation; } } public ArrayMap<String, ArraySet<String>> getAllowAdasLocationSettings() { return mAllowAdasSettings; } public ArrayMap<String, ArraySet<String>> getAllowIgnoreLocationSettings() { public ArrayMap<String, ArraySet<String>> getAllowIgnoreLocationSettings() { return mAllowIgnoreLocationSettings; return mAllowIgnoreLocationSettings; } } Loading Loading @@ -1007,6 +1015,34 @@ public class SystemConfig { } } XmlUtils.skipCurrentTag(parser); XmlUtils.skipCurrentTag(parser); } break; } break; case "allow-adas-location-settings" : { if (allowOverrideAppRestrictions) { String pkgname = parser.getAttributeValue(null, "package"); String attributionTag = parser.getAttributeValue(null, "attributionTag"); if (pkgname == null) { Slog.w(TAG, "<" + name + "> without package in " + permFile + " at " + parser.getPositionDescription()); } else { ArraySet<String> tags = mAllowAdasSettings.get(pkgname); if (tags == null || !tags.isEmpty()) { if (tags == null) { tags = new ArraySet<>(1); mAllowAdasSettings.put(pkgname, tags); } if (!"*".equals(attributionTag)) { if ("null".equals(attributionTag)) { attributionTag = null; } tags.add(attributionTag); } } } } else { logNotAllowedInPartition(name, permFile, parser); } XmlUtils.skipCurrentTag(parser); } break; case "allow-ignore-location-settings": { case "allow-ignore-location-settings": { if (allowOverrideAppRestrictions) { if (allowOverrideAppRestrictions) { String pkgname = parser.getAttributeValue(null, "package"); String pkgname = parser.getAttributeValue(null, "package"); Loading location/java/android/location/LocationDeviceConfig.java +28 −4 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,30 @@ package android.location; */ */ public final class LocationDeviceConfig { public final class LocationDeviceConfig { /** * Package/tag combinations that are allowlisted for ignoring location settings (may retrieve * location even when user location settings are off), for advanced driver-assistance systems * only. * * <p>Package/tag combinations are separated by commas (","), and with in each combination is a * package name followed by 0 or more attribution tags, separated by semicolons (";"). If a * package is followed by 0 attribution tags, this is interpreted the same as the wildcard * value. There are two special interpreted values for attribution tags, the wildcard value * ("*") which represents all attribution tags, and the null value ("null"), which is converted * to the null string (since attribution tags may be null). This format implies that attribution * tags which should be on this list may not contain semicolons. * * <p>Examples of valid entries: * * <ul> * <li>android * <li>android;* * <li>android;*,com.example.app;null;my_attr * <li>android;*,com.example.app;null;my_attr,com.example.otherapp;my_attr * </ul> */ public static final String ADAS_SETTINGS_ALLOWLIST = "adas_settings_allowlist"; /** /** * Package/tag combinations that are allowedlisted for ignoring location settings (may retrieve * Package/tag combinations that are allowedlisted for ignoring location settings (may retrieve * location even when user location settings are off, and may ignore throttling, etc), for * location even when user location settings are off, and may ignore throttling, etc), for Loading @@ -39,10 +63,10 @@ public final class LocationDeviceConfig { * <p>Examples of valid entries: * <p>Examples of valid entries: * * * <ul> * <ul> * <li>android</li> * <li>android * <li>android;*</li> * <li>android;* * <li>android;*,com.example.app;null;my_attr</li> * <li>android;*,com.example.app;null;my_attr * <li>android;*,com.example.app;null;my_attr,com.example.otherapp;my_attr</li> * <li>android;*,com.example.app;null;my_attr,com.example.otherapp;my_attr * </ul> * </ul> */ */ public static final String IGNORE_SETTINGS_ALLOWLIST = "ignore_settings_allowlist"; public static final String IGNORE_SETTINGS_ALLOWLIST = "ignore_settings_allowlist"; Loading services/core/java/com/android/server/location/LocationManagerService.java +4 −13 Original line number Original line Diff line number Diff line Loading @@ -94,7 +94,6 @@ import android.util.IndentingPrintWriter; import android.util.Log; import android.util.Log; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.GuardedBy; import com.android.internal.util.ArrayUtils; import com.android.internal.util.DumpUtils; import com.android.internal.util.DumpUtils; import com.android.internal.util.Preconditions; import com.android.internal.util.Preconditions; import com.android.server.FgThread; import com.android.server.FgThread; Loading Loading @@ -279,6 +278,9 @@ public class LocationManagerService extends ILocationManager.Stub implements this::onLocationUserSettingsChanged); this::onLocationUserSettingsChanged); mInjector.getSettingsHelper().addOnLocationEnabledChangedListener( mInjector.getSettingsHelper().addOnLocationEnabledChangedListener( this::onLocationModeChanged); this::onLocationModeChanged); mInjector.getSettingsHelper().addAdasAllowlistChangedListener( () -> refreshAppOpsRestrictions(UserHandle.USER_ALL) ); mInjector.getSettingsHelper().addIgnoreSettingsAllowlistChangedListener( mInjector.getSettingsHelper().addIgnoreSettingsAllowlistChangedListener( () -> refreshAppOpsRestrictions(UserHandle.USER_ALL)); () -> refreshAppOpsRestrictions(UserHandle.USER_ALL)); mInjector.getUserInfoHelper().addListener((userId, change) -> { mInjector.getUserInfoHelper().addListener((userId, change) -> { Loading Loading @@ -823,12 +825,6 @@ public class LocationManagerService extends ILocationManager.Stub implements throw new IllegalArgumentException( throw new IllegalArgumentException( "adas gnss bypass requests are only allowed on the \"gps\" provider"); "adas gnss bypass requests are only allowed on the \"gps\" provider"); } } if (!ArrayUtils.contains(mContext.getResources().getStringArray( com.android.internal.R.array.config_locationDriverAssistancePackageNames), identity.getPackageName())) { throw new SecurityException( "only verified adas packages may use adas gnss bypass requests"); } if (!isLocationProvider) { if (!isLocationProvider) { LocationPermissions.enforceCallingOrSelfBypassPermission(mContext); LocationPermissions.enforceCallingOrSelfBypassPermission(mContext); } } Loading Loading @@ -923,12 +919,6 @@ public class LocationManagerService extends ILocationManager.Stub implements throw new IllegalArgumentException( throw new IllegalArgumentException( "adas gnss bypass requests are only allowed on the \"gps\" provider"); "adas gnss bypass requests are only allowed on the \"gps\" provider"); } } if (!ArrayUtils.contains(mContext.getResources().getStringArray( com.android.internal.R.array.config_locationDriverAssistancePackageNames), identity.getPackageName())) { throw new SecurityException( "only verified adas packages may use adas gnss bypass requests"); } if (!isLocationProvider) { if (!isLocationProvider) { LocationPermissions.enforceCallingOrSelfBypassPermission(mContext); LocationPermissions.enforceCallingOrSelfBypassPermission(mContext); } } Loading Loading @@ -1542,6 +1532,7 @@ public class LocationManagerService extends ILocationManager.Stub implements } } } } builder.add(mInjector.getSettingsHelper().getIgnoreSettingsAllowlist()); builder.add(mInjector.getSettingsHelper().getIgnoreSettingsAllowlist()); builder.add(mInjector.getSettingsHelper().getAdasAllowlist()); allowedPackages = builder.build(); allowedPackages = builder.build(); } } Loading services/core/java/com/android/server/location/injector/SettingsHelper.java +14 −0 Original line number Original line Diff line number Diff line Loading @@ -146,6 +146,20 @@ public abstract class SettingsHelper { public abstract void removeOnGnssMeasurementsFullTrackingEnabledChangedListener( public abstract void removeOnGnssMeasurementsFullTrackingEnabledChangedListener( GlobalSettingChangedListener listener); GlobalSettingChangedListener listener); /** Retrieve adas allowlist. */ public abstract PackageTagsList getAdasAllowlist(); /** * Add a listener for changes to the ADAS settings package allowlist. Callbacks occur on an * unspecified thread. */ public abstract void addAdasAllowlistChangedListener(GlobalSettingChangedListener listener); /** * Remove a listener for changes to the ADAS package allowlist. */ public abstract void removeAdasAllowlistChangedListener(GlobalSettingChangedListener listener); /** /** * Retrieve the ignore location settings package+tags allowlist setting. * Retrieve the ignore location settings package+tags allowlist setting. */ */ Loading services/core/java/com/android/server/location/injector/SystemSettingsHelper.java +29 −1 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.location.injector; package com.android.server.location.injector; import static android.location.LocationDeviceConfig.ADAS_SETTINGS_ALLOWLIST; import static android.location.LocationDeviceConfig.IGNORE_SETTINGS_ALLOWLIST; import static android.location.LocationDeviceConfig.IGNORE_SETTINGS_ALLOWLIST; import static android.provider.Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING; import static android.provider.Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING; import static android.provider.Settings.Global.LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS; import static android.provider.Settings.Global.LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS; Loading Loading @@ -80,6 +81,7 @@ public class SystemSettingsHelper extends SettingsHelper { private final StringListCachedSecureSetting mLocationPackageBlacklist; private final StringListCachedSecureSetting mLocationPackageBlacklist; private final StringListCachedSecureSetting mLocationPackageWhitelist; private final StringListCachedSecureSetting mLocationPackageWhitelist; private final StringSetCachedGlobalSetting mBackgroundThrottlePackageWhitelist; private final StringSetCachedGlobalSetting mBackgroundThrottlePackageWhitelist; private final PackageTagsListSetting mAdasPackageAllowlist; private final PackageTagsListSetting mIgnoreSettingsPackageAllowlist; private final PackageTagsListSetting mIgnoreSettingsPackageAllowlist; public SystemSettingsHelper(Context context) { public SystemSettingsHelper(Context context) { Loading @@ -98,6 +100,9 @@ public class SystemSettingsHelper extends SettingsHelper { LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST, LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST, () -> SystemConfig.getInstance().getAllowUnthrottledLocation(), () -> SystemConfig.getInstance().getAllowUnthrottledLocation(), FgThread.getHandler()); FgThread.getHandler()); mAdasPackageAllowlist = new PackageTagsListSetting( ADAS_SETTINGS_ALLOWLIST, () -> SystemConfig.getInstance().getAllowAdasLocationSettings()); mIgnoreSettingsPackageAllowlist = new PackageTagsListSetting( mIgnoreSettingsPackageAllowlist = new PackageTagsListSetting( IGNORE_SETTINGS_ALLOWLIST, IGNORE_SETTINGS_ALLOWLIST, () -> SystemConfig.getInstance().getAllowIgnoreLocationSettings()); () -> SystemConfig.getInstance().getAllowIgnoreLocationSettings()); Loading Loading @@ -232,6 +237,21 @@ public class SystemSettingsHelper extends SettingsHelper { mGnssMeasurementFullTracking.removeListener(listener); mGnssMeasurementFullTracking.removeListener(listener); } } @Override public PackageTagsList getAdasAllowlist() { return mAdasPackageAllowlist.getValue(); } @Override public void addAdasAllowlistChangedListener(GlobalSettingChangedListener listener) { mAdasPackageAllowlist.addListener(listener); } @Override public void removeAdasAllowlistChangedListener(GlobalSettingChangedListener listener) { mAdasPackageAllowlist.removeListener(listener); } @Override @Override public PackageTagsList getIgnoreSettingsAllowlist() { public PackageTagsList getIgnoreSettingsAllowlist() { return mIgnoreSettingsPackageAllowlist.getValue(); return mIgnoreSettingsPackageAllowlist.getValue(); Loading Loading @@ -359,11 +379,19 @@ public class SystemSettingsHelper extends SettingsHelper { PackageTagsList ignoreSettingsAllowlist = mIgnoreSettingsPackageAllowlist.getValue(); PackageTagsList ignoreSettingsAllowlist = mIgnoreSettingsPackageAllowlist.getValue(); if (!ignoreSettingsAllowlist.isEmpty()) { if (!ignoreSettingsAllowlist.isEmpty()) { ipw.println("Bypass Allow Packages:"); ipw.println("Emergency Bypass Allow Packages:"); ipw.increaseIndent(); ipw.increaseIndent(); ignoreSettingsAllowlist.dump(ipw); ignoreSettingsAllowlist.dump(ipw); ipw.decreaseIndent(); ipw.decreaseIndent(); } } PackageTagsList adasPackageAllowlist = mAdasPackageAllowlist.getValue(); if (!adasPackageAllowlist.isEmpty()) { ipw.println("ADAS Bypass Allow Packages:"); ipw.increaseIndent(); adasPackageAllowlist.dump(ipw); ipw.decreaseIndent(); } } } private abstract static class ObservingSetting extends ContentObserver { private abstract static class ObservingSetting extends ContentObserver { Loading Loading
core/java/com/android/server/SystemConfig.java +38 −2 Original line number Original line Diff line number Diff line Loading @@ -89,7 +89,7 @@ public class SystemConfig { private static final int ALLOW_ASSOCIATIONS = 0x080; private static final int ALLOW_ASSOCIATIONS = 0x080; // ALLOW_OVERRIDE_APP_RESTRICTIONS allows to use "allow-in-power-save-except-idle", // ALLOW_OVERRIDE_APP_RESTRICTIONS allows to use "allow-in-power-save-except-idle", // "allow-in-power-save", "allow-in-data-usage-save","allow-unthrottled-location", // "allow-in-power-save", "allow-in-data-usage-save","allow-unthrottled-location", // and "allow-ignore-location-settings". // "allow-ignore-location-settings" and "allow-adas-location-settings". private static final int ALLOW_OVERRIDE_APP_RESTRICTIONS = 0x100; private static final int ALLOW_OVERRIDE_APP_RESTRICTIONS = 0x100; private static final int ALLOW_IMPLICIT_BROADCASTS = 0x200; private static final int ALLOW_IMPLICIT_BROADCASTS = 0x200; private static final int ALLOW_VENDOR_APEX = 0x400; private static final int ALLOW_VENDOR_APEX = 0x400; Loading Loading @@ -234,6 +234,10 @@ public class SystemConfig { // without throttling, as read from the configuration files. // without throttling, as read from the configuration files. final ArraySet<String> mAllowUnthrottledLocation = new ArraySet<>(); final ArraySet<String> mAllowUnthrottledLocation = new ArraySet<>(); // These are the packages that are allow-listed to be able to retrieve location when // the location state is driver assistance only. final ArrayMap<String, ArraySet<String>> mAllowAdasSettings = new ArrayMap<>(); // These are the packages that are white-listed to be able to retrieve location even when user // These are the packages that are white-listed to be able to retrieve location even when user // location settings are off, for emergency purposes, as read from the configuration files. // location settings are off, for emergency purposes, as read from the configuration files. final ArrayMap<String, ArraySet<String>> mAllowIgnoreLocationSettings = new ArrayMap<>(); final ArrayMap<String, ArraySet<String>> mAllowIgnoreLocationSettings = new ArrayMap<>(); Loading Loading @@ -394,6 +398,10 @@ public class SystemConfig { return mAllowUnthrottledLocation; return mAllowUnthrottledLocation; } } public ArrayMap<String, ArraySet<String>> getAllowAdasLocationSettings() { return mAllowAdasSettings; } public ArrayMap<String, ArraySet<String>> getAllowIgnoreLocationSettings() { public ArrayMap<String, ArraySet<String>> getAllowIgnoreLocationSettings() { return mAllowIgnoreLocationSettings; return mAllowIgnoreLocationSettings; } } Loading Loading @@ -1007,6 +1015,34 @@ public class SystemConfig { } } XmlUtils.skipCurrentTag(parser); XmlUtils.skipCurrentTag(parser); } break; } break; case "allow-adas-location-settings" : { if (allowOverrideAppRestrictions) { String pkgname = parser.getAttributeValue(null, "package"); String attributionTag = parser.getAttributeValue(null, "attributionTag"); if (pkgname == null) { Slog.w(TAG, "<" + name + "> without package in " + permFile + " at " + parser.getPositionDescription()); } else { ArraySet<String> tags = mAllowAdasSettings.get(pkgname); if (tags == null || !tags.isEmpty()) { if (tags == null) { tags = new ArraySet<>(1); mAllowAdasSettings.put(pkgname, tags); } if (!"*".equals(attributionTag)) { if ("null".equals(attributionTag)) { attributionTag = null; } tags.add(attributionTag); } } } } else { logNotAllowedInPartition(name, permFile, parser); } XmlUtils.skipCurrentTag(parser); } break; case "allow-ignore-location-settings": { case "allow-ignore-location-settings": { if (allowOverrideAppRestrictions) { if (allowOverrideAppRestrictions) { String pkgname = parser.getAttributeValue(null, "package"); String pkgname = parser.getAttributeValue(null, "package"); Loading
location/java/android/location/LocationDeviceConfig.java +28 −4 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,30 @@ package android.location; */ */ public final class LocationDeviceConfig { public final class LocationDeviceConfig { /** * Package/tag combinations that are allowlisted for ignoring location settings (may retrieve * location even when user location settings are off), for advanced driver-assistance systems * only. * * <p>Package/tag combinations are separated by commas (","), and with in each combination is a * package name followed by 0 or more attribution tags, separated by semicolons (";"). If a * package is followed by 0 attribution tags, this is interpreted the same as the wildcard * value. There are two special interpreted values for attribution tags, the wildcard value * ("*") which represents all attribution tags, and the null value ("null"), which is converted * to the null string (since attribution tags may be null). This format implies that attribution * tags which should be on this list may not contain semicolons. * * <p>Examples of valid entries: * * <ul> * <li>android * <li>android;* * <li>android;*,com.example.app;null;my_attr * <li>android;*,com.example.app;null;my_attr,com.example.otherapp;my_attr * </ul> */ public static final String ADAS_SETTINGS_ALLOWLIST = "adas_settings_allowlist"; /** /** * Package/tag combinations that are allowedlisted for ignoring location settings (may retrieve * Package/tag combinations that are allowedlisted for ignoring location settings (may retrieve * location even when user location settings are off, and may ignore throttling, etc), for * location even when user location settings are off, and may ignore throttling, etc), for Loading @@ -39,10 +63,10 @@ public final class LocationDeviceConfig { * <p>Examples of valid entries: * <p>Examples of valid entries: * * * <ul> * <ul> * <li>android</li> * <li>android * <li>android;*</li> * <li>android;* * <li>android;*,com.example.app;null;my_attr</li> * <li>android;*,com.example.app;null;my_attr * <li>android;*,com.example.app;null;my_attr,com.example.otherapp;my_attr</li> * <li>android;*,com.example.app;null;my_attr,com.example.otherapp;my_attr * </ul> * </ul> */ */ public static final String IGNORE_SETTINGS_ALLOWLIST = "ignore_settings_allowlist"; public static final String IGNORE_SETTINGS_ALLOWLIST = "ignore_settings_allowlist"; Loading
services/core/java/com/android/server/location/LocationManagerService.java +4 −13 Original line number Original line Diff line number Diff line Loading @@ -94,7 +94,6 @@ import android.util.IndentingPrintWriter; import android.util.Log; import android.util.Log; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.GuardedBy; import com.android.internal.util.ArrayUtils; import com.android.internal.util.DumpUtils; import com.android.internal.util.DumpUtils; import com.android.internal.util.Preconditions; import com.android.internal.util.Preconditions; import com.android.server.FgThread; import com.android.server.FgThread; Loading Loading @@ -279,6 +278,9 @@ public class LocationManagerService extends ILocationManager.Stub implements this::onLocationUserSettingsChanged); this::onLocationUserSettingsChanged); mInjector.getSettingsHelper().addOnLocationEnabledChangedListener( mInjector.getSettingsHelper().addOnLocationEnabledChangedListener( this::onLocationModeChanged); this::onLocationModeChanged); mInjector.getSettingsHelper().addAdasAllowlistChangedListener( () -> refreshAppOpsRestrictions(UserHandle.USER_ALL) ); mInjector.getSettingsHelper().addIgnoreSettingsAllowlistChangedListener( mInjector.getSettingsHelper().addIgnoreSettingsAllowlistChangedListener( () -> refreshAppOpsRestrictions(UserHandle.USER_ALL)); () -> refreshAppOpsRestrictions(UserHandle.USER_ALL)); mInjector.getUserInfoHelper().addListener((userId, change) -> { mInjector.getUserInfoHelper().addListener((userId, change) -> { Loading Loading @@ -823,12 +825,6 @@ public class LocationManagerService extends ILocationManager.Stub implements throw new IllegalArgumentException( throw new IllegalArgumentException( "adas gnss bypass requests are only allowed on the \"gps\" provider"); "adas gnss bypass requests are only allowed on the \"gps\" provider"); } } if (!ArrayUtils.contains(mContext.getResources().getStringArray( com.android.internal.R.array.config_locationDriverAssistancePackageNames), identity.getPackageName())) { throw new SecurityException( "only verified adas packages may use adas gnss bypass requests"); } if (!isLocationProvider) { if (!isLocationProvider) { LocationPermissions.enforceCallingOrSelfBypassPermission(mContext); LocationPermissions.enforceCallingOrSelfBypassPermission(mContext); } } Loading Loading @@ -923,12 +919,6 @@ public class LocationManagerService extends ILocationManager.Stub implements throw new IllegalArgumentException( throw new IllegalArgumentException( "adas gnss bypass requests are only allowed on the \"gps\" provider"); "adas gnss bypass requests are only allowed on the \"gps\" provider"); } } if (!ArrayUtils.contains(mContext.getResources().getStringArray( com.android.internal.R.array.config_locationDriverAssistancePackageNames), identity.getPackageName())) { throw new SecurityException( "only verified adas packages may use adas gnss bypass requests"); } if (!isLocationProvider) { if (!isLocationProvider) { LocationPermissions.enforceCallingOrSelfBypassPermission(mContext); LocationPermissions.enforceCallingOrSelfBypassPermission(mContext); } } Loading Loading @@ -1542,6 +1532,7 @@ public class LocationManagerService extends ILocationManager.Stub implements } } } } builder.add(mInjector.getSettingsHelper().getIgnoreSettingsAllowlist()); builder.add(mInjector.getSettingsHelper().getIgnoreSettingsAllowlist()); builder.add(mInjector.getSettingsHelper().getAdasAllowlist()); allowedPackages = builder.build(); allowedPackages = builder.build(); } } Loading
services/core/java/com/android/server/location/injector/SettingsHelper.java +14 −0 Original line number Original line Diff line number Diff line Loading @@ -146,6 +146,20 @@ public abstract class SettingsHelper { public abstract void removeOnGnssMeasurementsFullTrackingEnabledChangedListener( public abstract void removeOnGnssMeasurementsFullTrackingEnabledChangedListener( GlobalSettingChangedListener listener); GlobalSettingChangedListener listener); /** Retrieve adas allowlist. */ public abstract PackageTagsList getAdasAllowlist(); /** * Add a listener for changes to the ADAS settings package allowlist. Callbacks occur on an * unspecified thread. */ public abstract void addAdasAllowlistChangedListener(GlobalSettingChangedListener listener); /** * Remove a listener for changes to the ADAS package allowlist. */ public abstract void removeAdasAllowlistChangedListener(GlobalSettingChangedListener listener); /** /** * Retrieve the ignore location settings package+tags allowlist setting. * Retrieve the ignore location settings package+tags allowlist setting. */ */ Loading
services/core/java/com/android/server/location/injector/SystemSettingsHelper.java +29 −1 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.location.injector; package com.android.server.location.injector; import static android.location.LocationDeviceConfig.ADAS_SETTINGS_ALLOWLIST; import static android.location.LocationDeviceConfig.IGNORE_SETTINGS_ALLOWLIST; import static android.location.LocationDeviceConfig.IGNORE_SETTINGS_ALLOWLIST; import static android.provider.Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING; import static android.provider.Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING; import static android.provider.Settings.Global.LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS; import static android.provider.Settings.Global.LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS; Loading Loading @@ -80,6 +81,7 @@ public class SystemSettingsHelper extends SettingsHelper { private final StringListCachedSecureSetting mLocationPackageBlacklist; private final StringListCachedSecureSetting mLocationPackageBlacklist; private final StringListCachedSecureSetting mLocationPackageWhitelist; private final StringListCachedSecureSetting mLocationPackageWhitelist; private final StringSetCachedGlobalSetting mBackgroundThrottlePackageWhitelist; private final StringSetCachedGlobalSetting mBackgroundThrottlePackageWhitelist; private final PackageTagsListSetting mAdasPackageAllowlist; private final PackageTagsListSetting mIgnoreSettingsPackageAllowlist; private final PackageTagsListSetting mIgnoreSettingsPackageAllowlist; public SystemSettingsHelper(Context context) { public SystemSettingsHelper(Context context) { Loading @@ -98,6 +100,9 @@ public class SystemSettingsHelper extends SettingsHelper { LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST, LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST, () -> SystemConfig.getInstance().getAllowUnthrottledLocation(), () -> SystemConfig.getInstance().getAllowUnthrottledLocation(), FgThread.getHandler()); FgThread.getHandler()); mAdasPackageAllowlist = new PackageTagsListSetting( ADAS_SETTINGS_ALLOWLIST, () -> SystemConfig.getInstance().getAllowAdasLocationSettings()); mIgnoreSettingsPackageAllowlist = new PackageTagsListSetting( mIgnoreSettingsPackageAllowlist = new PackageTagsListSetting( IGNORE_SETTINGS_ALLOWLIST, IGNORE_SETTINGS_ALLOWLIST, () -> SystemConfig.getInstance().getAllowIgnoreLocationSettings()); () -> SystemConfig.getInstance().getAllowIgnoreLocationSettings()); Loading Loading @@ -232,6 +237,21 @@ public class SystemSettingsHelper extends SettingsHelper { mGnssMeasurementFullTracking.removeListener(listener); mGnssMeasurementFullTracking.removeListener(listener); } } @Override public PackageTagsList getAdasAllowlist() { return mAdasPackageAllowlist.getValue(); } @Override public void addAdasAllowlistChangedListener(GlobalSettingChangedListener listener) { mAdasPackageAllowlist.addListener(listener); } @Override public void removeAdasAllowlistChangedListener(GlobalSettingChangedListener listener) { mAdasPackageAllowlist.removeListener(listener); } @Override @Override public PackageTagsList getIgnoreSettingsAllowlist() { public PackageTagsList getIgnoreSettingsAllowlist() { return mIgnoreSettingsPackageAllowlist.getValue(); return mIgnoreSettingsPackageAllowlist.getValue(); Loading Loading @@ -359,11 +379,19 @@ public class SystemSettingsHelper extends SettingsHelper { PackageTagsList ignoreSettingsAllowlist = mIgnoreSettingsPackageAllowlist.getValue(); PackageTagsList ignoreSettingsAllowlist = mIgnoreSettingsPackageAllowlist.getValue(); if (!ignoreSettingsAllowlist.isEmpty()) { if (!ignoreSettingsAllowlist.isEmpty()) { ipw.println("Bypass Allow Packages:"); ipw.println("Emergency Bypass Allow Packages:"); ipw.increaseIndent(); ipw.increaseIndent(); ignoreSettingsAllowlist.dump(ipw); ignoreSettingsAllowlist.dump(ipw); ipw.decreaseIndent(); ipw.decreaseIndent(); } } PackageTagsList adasPackageAllowlist = mAdasPackageAllowlist.getValue(); if (!adasPackageAllowlist.isEmpty()) { ipw.println("ADAS Bypass Allow Packages:"); ipw.increaseIndent(); adasPackageAllowlist.dump(ipw); ipw.decreaseIndent(); } } } private abstract static class ObservingSetting extends ContentObserver { private abstract static class ObservingSetting extends ContentObserver { Loading