Adds RequiresFeature annotation to ADAS APIs
Bug: 215299508
Test: presubmit
Change-Id: Iaa29a383613b48ef7baa7fd8cd73b8fbf797d6bb
diff --git a/location/java/android/location/LastLocationRequest.java b/location/java/android/location/LastLocationRequest.java
index ec03a33..d90c2e6 100644
--- a/location/java/android/location/LastLocationRequest.java
+++ b/location/java/android/location/LastLocationRequest.java
@@ -20,8 +20,10 @@
import android.Manifest;
import android.annotation.NonNull;
+import android.annotation.RequiresFeature;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
+import android.content.pm.PackageManager;
import android.os.Parcel;
import android.os.Parcelable;
@@ -224,6 +226,7 @@
*/
@SystemApi
@RequiresPermission(LOCATION_BYPASS)
+ @RequiresFeature(PackageManager.FEATURE_AUTOMOTIVE)
public @NonNull LastLocationRequest.Builder setAdasGnssBypass(boolean adasGnssBypass) {
mAdasGnssBypass = adasGnssBypass;
return this;
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index a504cfe..371f5ed 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -681,6 +681,7 @@
*/
@SystemApi
@RequiresPermission(LOCATION_BYPASS)
+ @RequiresFeature(PackageManager.FEATURE_AUTOMOTIVE)
public void setAdasGnssLocationEnabled(boolean enabled) {
try {
mService.setAdasGnssLocationEnabledForUser(enabled, mContext.getUser().getIdentifier());
diff --git a/location/java/android/location/LocationRequest.java b/location/java/android/location/LocationRequest.java
index 09474b5..80b55e2 100644
--- a/location/java/android/location/LocationRequest.java
+++ b/location/java/android/location/LocationRequest.java
@@ -27,10 +27,12 @@
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.RequiresFeature;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledAfter;
+import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
@@ -1136,6 +1138,7 @@
*/
@SystemApi
@RequiresPermission(LOCATION_BYPASS)
+ @RequiresFeature(PackageManager.FEATURE_AUTOMOTIVE)
public @NonNull Builder setAdasGnssBypass(boolean adasGnssBypass) {
mAdasGnssBypass = adasGnssBypass;
return this;