Loading core/res/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -1706,6 +1706,10 @@ config_enableFusedLocationOverlay is false. --> <string name="config_fusedLocationProviderPackageName" translatable="false">com.android.location.fused</string> <!-- Default value for the ADAS GNSS Location Enabled setting if this setting has never been set before. --> <bool name="config_defaultAdasGnssLocationEnabled" translatable="false">false</bool> <string-array name="config_locationExtraPackageNames" translatable="false"></string-array> <!-- The package name of the default network recommendation app. Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1918,6 +1918,7 @@ <java-symbol type="bool" name="config_tintNotificationActionButtons" /> <java-symbol type="bool" name="config_dozeAfterScreenOffByDefault" /> <java-symbol type="bool" name="config_enableActivityRecognitionHardwareOverlay" /> <java-symbol type="bool" name="config_defaultAdasGnssLocationEnabled" /> <java-symbol type="bool" name="config_enableFusedLocationOverlay" /> <java-symbol type="bool" name="config_enableGeocoderOverlay" /> <java-symbol type="bool" name="config_enableGeofenceOverlay" /> Loading location/java/android/location/ILocationManager.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,9 @@ interface ILocationManager boolean isLocationEnabledForUser(int userId); void setLocationEnabledForUser(boolean enabled, int userId); boolean isAdasGnssLocationEnabledForUser(int userId); void setAdasGnssLocationEnabledForUser(boolean enabled, int userId); void addTestProvider(String name, in ProviderProperties properties, in List<String> locationTags, String packageName, @nullable String attributionTag); void removeTestProvider(String provider, String packageName, @nullable String attributionTag); Loading location/java/android/location/LastLocationRequest.java +58 −2 Original line number Diff line number Diff line Loading @@ -34,12 +34,15 @@ import java.util.Objects; public final class LastLocationRequest implements Parcelable { private final boolean mHiddenFromAppOps; private final boolean mAdasGnssBypass; private final boolean mLocationSettingsIgnored; private LastLocationRequest( boolean hiddenFromAppOps, boolean adasGnssBypass, boolean locationSettingsIgnored) { mHiddenFromAppOps = hiddenFromAppOps; mAdasGnssBypass = adasGnssBypass; mLocationSettingsIgnored = locationSettingsIgnored; } Loading @@ -55,6 +58,21 @@ public final class LastLocationRequest implements Parcelable { return mHiddenFromAppOps; } /** * Returns true if this request may access GNSS even if location settings would normally deny * this, in order to enable automotive safety features. This field is only respected on * automotive devices, and only if the client is recognized as a legitimate ADAS (Advanced * Driving Assistance Systems) application. * * @return true if all limiting factors will be ignored to satisfy GNSS request * @hide */ // TODO: make this system api public boolean isAdasGnssBypass() { return mAdasGnssBypass; } /** * Returns true if location settings, throttling, background location limits, and any other * possible limiting factors will be ignored in order to satisfy this last location request. Loading @@ -65,12 +83,22 @@ public final class LastLocationRequest implements Parcelable { return mLocationSettingsIgnored; } /** * Returns true if any bypass flag is set on this request. For internal use only. * * @hide */ public boolean isBypass() { return mAdasGnssBypass || mLocationSettingsIgnored; } public static final @NonNull Parcelable.Creator<LastLocationRequest> CREATOR = new Parcelable.Creator<LastLocationRequest>() { @Override public LastLocationRequest createFromParcel(Parcel in) { return new LastLocationRequest( /* hiddenFromAppOps= */ in.readBoolean(), /* adasGnssBypass= */ in.readBoolean(), /* locationSettingsIgnored= */ in.readBoolean()); } @Override Loading @@ -86,6 +114,7 @@ public final class LastLocationRequest implements Parcelable { @Override public void writeToParcel(@NonNull Parcel parcel, int flags) { parcel.writeBoolean(mHiddenFromAppOps); parcel.writeBoolean(mAdasGnssBypass); parcel.writeBoolean(mLocationSettingsIgnored); } Loading @@ -99,12 +128,13 @@ public final class LastLocationRequest implements Parcelable { } LastLocationRequest that = (LastLocationRequest) o; return mHiddenFromAppOps == that.mHiddenFromAppOps && mAdasGnssBypass == that.mAdasGnssBypass && mLocationSettingsIgnored == that.mLocationSettingsIgnored; } @Override public int hashCode() { return Objects.hash(mHiddenFromAppOps, mLocationSettingsIgnored); return Objects.hash(mHiddenFromAppOps, mAdasGnssBypass, mLocationSettingsIgnored); } @NonNull Loading @@ -115,8 +145,11 @@ public final class LastLocationRequest implements Parcelable { if (mHiddenFromAppOps) { s.append("hiddenFromAppOps, "); } if (mAdasGnssBypass) { s.append("adasGnssBypass, "); } if (mLocationSettingsIgnored) { s.append("locationSettingsIgnored, "); s.append("settingsBypass, "); } if (s.length() > "LastLocationRequest[".length()) { s.setLength(s.length() - 2); Loading @@ -131,6 +164,7 @@ public final class LastLocationRequest implements Parcelable { public static final class Builder { private boolean mHiddenFromAppOps; private boolean mAdasGnssBypass; private boolean mLocationSettingsIgnored; /** Loading @@ -138,6 +172,7 @@ public final class LastLocationRequest implements Parcelable { */ public Builder() { mHiddenFromAppOps = false; mAdasGnssBypass = false; mLocationSettingsIgnored = false; } Loading @@ -146,6 +181,7 @@ public final class LastLocationRequest implements Parcelable { */ public Builder(@NonNull LastLocationRequest lastLocationRequest) { mHiddenFromAppOps = lastLocationRequest.mHiddenFromAppOps; mAdasGnssBypass = lastLocationRequest.mAdasGnssBypass; mLocationSettingsIgnored = lastLocationRequest.mLocationSettingsIgnored; } Loading @@ -163,6 +199,25 @@ public final class LastLocationRequest implements Parcelable { return this; } /** * If set to true, indicates that the client is an ADAS (Advanced Driving Assistance * Systems) client, which requires access to GNSS even if location settings would normally * deny this, in order to enable auto safety features. This field is only respected on * automotive devices, and only if the client is recognized as a legitimate ADAS * application. Defaults to false. * * <p>Permissions enforcement occurs when resulting location request is actually used, not * when this method is invoked. * * @hide */ // TODO: make this system api @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS) public @NonNull LastLocationRequest.Builder setAdasGnssBypass(boolean adasGnssBypass) { mAdasGnssBypass = adasGnssBypass; return this; } /** * If set to true, indicates that location settings, throttling, background location limits, * and any other possible limiting factors should be ignored in order to satisfy this Loading @@ -186,6 +241,7 @@ public final class LastLocationRequest implements Parcelable { public @NonNull LastLocationRequest build() { return new LastLocationRequest( mHiddenFromAppOps, mAdasGnssBypass, mLocationSettingsIgnored); } } Loading location/java/android/location/LocationManager.java +63 −0 Original line number Diff line number Diff line Loading @@ -314,6 +314,33 @@ public class LocationManager { */ public static final String EXTRA_LOCATION_ENABLED = "android.location.extra.LOCATION_ENABLED"; /** * Broadcast intent action when the ADAS (Advanced Driving Assistance Systems) GNSS location * enabled state changes. Includes a boolean intent extra, {@link #EXTRA_ADAS_GNSS_ENABLED}, * with the enabled state of ADAS GNSS location. This broadcast only has meaning on automotive * devices. * * @see #EXTRA_ADAS_GNSS_ENABLED * @see #isAdasGnssLocationEnabled() * * @hide */ // TODO: @SystemApi @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_ADAS_GNSS_ENABLED_CHANGED = "android.location.action.ADAS_GNSS_ENABLED_CHANGED"; /** * Intent extra included with {@link #ACTION_ADAS_GNSS_ENABLED_CHANGED} broadcasts, containing * the boolean enabled state of ADAS GNSS location. * * @see #ACTION_ADAS_GNSS_ENABLED_CHANGED * * @hide */ // TODO: @SystemApi public static final String EXTRA_ADAS_GNSS_ENABLED = "android.location.extra.ADAS_GNSS_ENABLED"; /** * Broadcast intent action indicating that a high power location requests * has either started or stopped being active. The current state of Loading Loading @@ -620,6 +647,42 @@ public class LocationManager { } } /** * Returns the current enabled/disabled state of ADAS (Advanced Driving Assistance Systems) * GNSS location access for the given user. This controls safety critical automotive access to * GNSS location. This only has meaning on automotive devices. * * @return true if ADAS location is enabled and false if ADAS location is disabled. * * @hide */ //TODO: @SystemApi public boolean isAdasGnssLocationEnabled() { try { return mService.isAdasGnssLocationEnabledForUser(mContext.getUser().getIdentifier()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Enables or disables ADAS (Advanced Driving Assistance Systems) GNSS location access for the * given user. This only has meaning on automotive devices. * * @param enabled true to enable ADAS location and false to disable ADAS location. * * @hide */ // TODO: @SystemApi @RequiresPermission(WRITE_SECURE_SETTINGS) public void setAdasGnssLocationEnabled(boolean enabled) { try { mService.setAdasGnssLocationEnabledForUser(enabled, mContext.getUser().getIdentifier()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Returns the current enabled/disabled status of the given provider. To listen for changes, see * {@link #PROVIDERS_CHANGED_ACTION}. Loading Loading
core/res/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -1706,6 +1706,10 @@ config_enableFusedLocationOverlay is false. --> <string name="config_fusedLocationProviderPackageName" translatable="false">com.android.location.fused</string> <!-- Default value for the ADAS GNSS Location Enabled setting if this setting has never been set before. --> <bool name="config_defaultAdasGnssLocationEnabled" translatable="false">false</bool> <string-array name="config_locationExtraPackageNames" translatable="false"></string-array> <!-- The package name of the default network recommendation app. Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1918,6 +1918,7 @@ <java-symbol type="bool" name="config_tintNotificationActionButtons" /> <java-symbol type="bool" name="config_dozeAfterScreenOffByDefault" /> <java-symbol type="bool" name="config_enableActivityRecognitionHardwareOverlay" /> <java-symbol type="bool" name="config_defaultAdasGnssLocationEnabled" /> <java-symbol type="bool" name="config_enableFusedLocationOverlay" /> <java-symbol type="bool" name="config_enableGeocoderOverlay" /> <java-symbol type="bool" name="config_enableGeofenceOverlay" /> Loading
location/java/android/location/ILocationManager.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,9 @@ interface ILocationManager boolean isLocationEnabledForUser(int userId); void setLocationEnabledForUser(boolean enabled, int userId); boolean isAdasGnssLocationEnabledForUser(int userId); void setAdasGnssLocationEnabledForUser(boolean enabled, int userId); void addTestProvider(String name, in ProviderProperties properties, in List<String> locationTags, String packageName, @nullable String attributionTag); void removeTestProvider(String provider, String packageName, @nullable String attributionTag); Loading
location/java/android/location/LastLocationRequest.java +58 −2 Original line number Diff line number Diff line Loading @@ -34,12 +34,15 @@ import java.util.Objects; public final class LastLocationRequest implements Parcelable { private final boolean mHiddenFromAppOps; private final boolean mAdasGnssBypass; private final boolean mLocationSettingsIgnored; private LastLocationRequest( boolean hiddenFromAppOps, boolean adasGnssBypass, boolean locationSettingsIgnored) { mHiddenFromAppOps = hiddenFromAppOps; mAdasGnssBypass = adasGnssBypass; mLocationSettingsIgnored = locationSettingsIgnored; } Loading @@ -55,6 +58,21 @@ public final class LastLocationRequest implements Parcelable { return mHiddenFromAppOps; } /** * Returns true if this request may access GNSS even if location settings would normally deny * this, in order to enable automotive safety features. This field is only respected on * automotive devices, and only if the client is recognized as a legitimate ADAS (Advanced * Driving Assistance Systems) application. * * @return true if all limiting factors will be ignored to satisfy GNSS request * @hide */ // TODO: make this system api public boolean isAdasGnssBypass() { return mAdasGnssBypass; } /** * Returns true if location settings, throttling, background location limits, and any other * possible limiting factors will be ignored in order to satisfy this last location request. Loading @@ -65,12 +83,22 @@ public final class LastLocationRequest implements Parcelable { return mLocationSettingsIgnored; } /** * Returns true if any bypass flag is set on this request. For internal use only. * * @hide */ public boolean isBypass() { return mAdasGnssBypass || mLocationSettingsIgnored; } public static final @NonNull Parcelable.Creator<LastLocationRequest> CREATOR = new Parcelable.Creator<LastLocationRequest>() { @Override public LastLocationRequest createFromParcel(Parcel in) { return new LastLocationRequest( /* hiddenFromAppOps= */ in.readBoolean(), /* adasGnssBypass= */ in.readBoolean(), /* locationSettingsIgnored= */ in.readBoolean()); } @Override Loading @@ -86,6 +114,7 @@ public final class LastLocationRequest implements Parcelable { @Override public void writeToParcel(@NonNull Parcel parcel, int flags) { parcel.writeBoolean(mHiddenFromAppOps); parcel.writeBoolean(mAdasGnssBypass); parcel.writeBoolean(mLocationSettingsIgnored); } Loading @@ -99,12 +128,13 @@ public final class LastLocationRequest implements Parcelable { } LastLocationRequest that = (LastLocationRequest) o; return mHiddenFromAppOps == that.mHiddenFromAppOps && mAdasGnssBypass == that.mAdasGnssBypass && mLocationSettingsIgnored == that.mLocationSettingsIgnored; } @Override public int hashCode() { return Objects.hash(mHiddenFromAppOps, mLocationSettingsIgnored); return Objects.hash(mHiddenFromAppOps, mAdasGnssBypass, mLocationSettingsIgnored); } @NonNull Loading @@ -115,8 +145,11 @@ public final class LastLocationRequest implements Parcelable { if (mHiddenFromAppOps) { s.append("hiddenFromAppOps, "); } if (mAdasGnssBypass) { s.append("adasGnssBypass, "); } if (mLocationSettingsIgnored) { s.append("locationSettingsIgnored, "); s.append("settingsBypass, "); } if (s.length() > "LastLocationRequest[".length()) { s.setLength(s.length() - 2); Loading @@ -131,6 +164,7 @@ public final class LastLocationRequest implements Parcelable { public static final class Builder { private boolean mHiddenFromAppOps; private boolean mAdasGnssBypass; private boolean mLocationSettingsIgnored; /** Loading @@ -138,6 +172,7 @@ public final class LastLocationRequest implements Parcelable { */ public Builder() { mHiddenFromAppOps = false; mAdasGnssBypass = false; mLocationSettingsIgnored = false; } Loading @@ -146,6 +181,7 @@ public final class LastLocationRequest implements Parcelable { */ public Builder(@NonNull LastLocationRequest lastLocationRequest) { mHiddenFromAppOps = lastLocationRequest.mHiddenFromAppOps; mAdasGnssBypass = lastLocationRequest.mAdasGnssBypass; mLocationSettingsIgnored = lastLocationRequest.mLocationSettingsIgnored; } Loading @@ -163,6 +199,25 @@ public final class LastLocationRequest implements Parcelable { return this; } /** * If set to true, indicates that the client is an ADAS (Advanced Driving Assistance * Systems) client, which requires access to GNSS even if location settings would normally * deny this, in order to enable auto safety features. This field is only respected on * automotive devices, and only if the client is recognized as a legitimate ADAS * application. Defaults to false. * * <p>Permissions enforcement occurs when resulting location request is actually used, not * when this method is invoked. * * @hide */ // TODO: make this system api @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS) public @NonNull LastLocationRequest.Builder setAdasGnssBypass(boolean adasGnssBypass) { mAdasGnssBypass = adasGnssBypass; return this; } /** * If set to true, indicates that location settings, throttling, background location limits, * and any other possible limiting factors should be ignored in order to satisfy this Loading @@ -186,6 +241,7 @@ public final class LastLocationRequest implements Parcelable { public @NonNull LastLocationRequest build() { return new LastLocationRequest( mHiddenFromAppOps, mAdasGnssBypass, mLocationSettingsIgnored); } } Loading
location/java/android/location/LocationManager.java +63 −0 Original line number Diff line number Diff line Loading @@ -314,6 +314,33 @@ public class LocationManager { */ public static final String EXTRA_LOCATION_ENABLED = "android.location.extra.LOCATION_ENABLED"; /** * Broadcast intent action when the ADAS (Advanced Driving Assistance Systems) GNSS location * enabled state changes. Includes a boolean intent extra, {@link #EXTRA_ADAS_GNSS_ENABLED}, * with the enabled state of ADAS GNSS location. This broadcast only has meaning on automotive * devices. * * @see #EXTRA_ADAS_GNSS_ENABLED * @see #isAdasGnssLocationEnabled() * * @hide */ // TODO: @SystemApi @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_ADAS_GNSS_ENABLED_CHANGED = "android.location.action.ADAS_GNSS_ENABLED_CHANGED"; /** * Intent extra included with {@link #ACTION_ADAS_GNSS_ENABLED_CHANGED} broadcasts, containing * the boolean enabled state of ADAS GNSS location. * * @see #ACTION_ADAS_GNSS_ENABLED_CHANGED * * @hide */ // TODO: @SystemApi public static final String EXTRA_ADAS_GNSS_ENABLED = "android.location.extra.ADAS_GNSS_ENABLED"; /** * Broadcast intent action indicating that a high power location requests * has either started or stopped being active. The current state of Loading Loading @@ -620,6 +647,42 @@ public class LocationManager { } } /** * Returns the current enabled/disabled state of ADAS (Advanced Driving Assistance Systems) * GNSS location access for the given user. This controls safety critical automotive access to * GNSS location. This only has meaning on automotive devices. * * @return true if ADAS location is enabled and false if ADAS location is disabled. * * @hide */ //TODO: @SystemApi public boolean isAdasGnssLocationEnabled() { try { return mService.isAdasGnssLocationEnabledForUser(mContext.getUser().getIdentifier()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Enables or disables ADAS (Advanced Driving Assistance Systems) GNSS location access for the * given user. This only has meaning on automotive devices. * * @param enabled true to enable ADAS location and false to disable ADAS location. * * @hide */ // TODO: @SystemApi @RequiresPermission(WRITE_SECURE_SETTINGS) public void setAdasGnssLocationEnabled(boolean enabled) { try { mService.setAdasGnssLocationEnabledForUser(enabled, mContext.getUser().getIdentifier()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Returns the current enabled/disabled status of the given provider. To listen for changes, see * {@link #PROVIDERS_CHANGED_ACTION}. Loading