Update GNSS S2R APIs based on API Council feedback.
Bug: 215304589 Test: atest GtsLocationTestCases:AutomotiveGnssControlsTest Change-Id: Ie1ff0698df9e23fa280fbbf71f1330bdf14f5f2c
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
package android {
|
||||
|
||||
public static final class Manifest.permission {
|
||||
field public static final String CONTROL_AUTOMOTIVE_GNSS = "android.permission.CONTROL_AUTOMOTIVE_GNSS";
|
||||
field public static final String GET_INTENT_SENDER_INTENT = "android.permission.GET_INTENT_SENDER_INTENT";
|
||||
}
|
||||
|
||||
@@ -146,6 +147,8 @@ package android.location {
|
||||
|
||||
public class LocationManager {
|
||||
method @RequiresPermission(allOf={android.Manifest.permission.LOCATION_HARDWARE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public boolean injectLocation(@NonNull android.location.Location);
|
||||
method @RequiresPermission(android.Manifest.permission.CONTROL_AUTOMOTIVE_GNSS) public boolean isAutomotiveGnssSuspended();
|
||||
method @RequiresPermission(android.Manifest.permission.CONTROL_AUTOMOTIVE_GNSS) public void setAutomotiveGnssSuspended(boolean);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ package android {
|
||||
field public static final String AMBIENT_WALLPAPER = "android.permission.AMBIENT_WALLPAPER";
|
||||
field public static final String APPROVE_INCIDENT_REPORTS = "android.permission.APPROVE_INCIDENT_REPORTS";
|
||||
field public static final String ASSOCIATE_COMPANION_DEVICES = "android.permission.ASSOCIATE_COMPANION_DEVICES";
|
||||
field public static final String AUTOMOTIVE_GNSS_CONTROLS = "android.permission.AUTOMOTIVE_GNSS_CONTROLS";
|
||||
field public static final String BACKGROUND_CAMERA = "android.permission.BACKGROUND_CAMERA";
|
||||
field public static final String BACKUP = "android.permission.BACKUP";
|
||||
field public static final String BATTERY_PREDICTION = "android.permission.BATTERY_PREDICTION";
|
||||
@@ -5485,7 +5484,6 @@ package android.location {
|
||||
method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public android.location.Location getLastKnownLocation(@NonNull String, @NonNull android.location.LastLocationRequest);
|
||||
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void injectGnssMeasurementCorrections(@NonNull android.location.GnssMeasurementCorrections);
|
||||
method public boolean isAdasGnssLocationEnabled();
|
||||
method @RequiresPermission(android.Manifest.permission.AUTOMOTIVE_GNSS_CONTROLS) public boolean isAutoGnssSuspended();
|
||||
method public boolean isExtraLocationControllerPackageEnabled();
|
||||
method public boolean isLocationEnabledForUser(@NonNull android.os.UserHandle);
|
||||
method public boolean isProviderEnabledForUser(@NonNull String, @NonNull android.os.UserHandle);
|
||||
@@ -5498,7 +5496,6 @@ package android.location {
|
||||
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@Nullable android.location.LocationRequest, @NonNull java.util.concurrent.Executor, @NonNull android.location.LocationListener);
|
||||
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@Nullable android.location.LocationRequest, @NonNull android.app.PendingIntent);
|
||||
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setAdasGnssLocationEnabled(boolean);
|
||||
method @RequiresPermission(android.Manifest.permission.AUTOMOTIVE_GNSS_CONTROLS) public void setAutoGnssSuspended(boolean);
|
||||
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void setExtraLocationControllerPackage(@Nullable String);
|
||||
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void setExtraLocationControllerPackageEnabled(boolean);
|
||||
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setLocationEnabledForUser(boolean, @NonNull android.os.UserHandle);
|
||||
|
||||
@@ -1782,11 +1782,12 @@
|
||||
<permission android:name="android.permission.ACCESS_MOCK_LOCATION"
|
||||
android:protectionLevel="signature" />
|
||||
|
||||
<!-- @SystemApi @hide Allows automotive applications to control location
|
||||
<!-- @hide @SystemApi(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES)
|
||||
Allows automotive applications to control location
|
||||
suspend state for power management use cases.
|
||||
<p>Not for use by third-party applications.
|
||||
-->
|
||||
<permission android:name="android.permission.AUTOMOTIVE_GNSS_CONTROLS"
|
||||
<permission android:name="android.permission.CONTROL_AUTOMOTIVE_GNSS"
|
||||
android:protectionLevel="signature|privileged" />
|
||||
|
||||
<!-- ======================================= -->
|
||||
|
||||
@@ -125,8 +125,8 @@ interface ILocationManager
|
||||
boolean isAdasGnssLocationEnabledForUser(int userId);
|
||||
void setAdasGnssLocationEnabledForUser(boolean enabled, int userId);
|
||||
|
||||
boolean isAutoGnssSuspended();
|
||||
void setAutoGnssSuspended(boolean suspended);
|
||||
boolean isAutomotiveGnssSuspended();
|
||||
void setAutomotiveGnssSuspended(boolean suspended);
|
||||
|
||||
void addTestProvider(String name, in ProviderProperties properties,
|
||||
in List<String> locationTags, String packageName, @nullable String attributionTag);
|
||||
|
||||
@@ -758,45 +758,41 @@ public class LocationManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether GNSS requests are suspended on the device.
|
||||
* Set whether GNSS requests are suspended on the automotive device.
|
||||
*
|
||||
* This method was added to help support power management use cases on automotive devices. More
|
||||
* specifically, it is being added to fix a suspend to RAM issue where the SoC can't go into
|
||||
* a lower power state when applications are actively requesting GNSS updates.
|
||||
* For devices where GNSS prevents the system from going into a low power state, GNSS should
|
||||
* be suspended right before going into the lower power state and resumed right after the device
|
||||
* wakes up.
|
||||
*
|
||||
* Ideally, the issue should be fixed at a lower layer in the stack, but this API introduces a
|
||||
* workaround in the platform layer. This API allows car specific services to halt GNSS requests
|
||||
* based on changes to the car power policy, which will in turn enable the device to go into
|
||||
* suspend.
|
||||
* This method disables GNSS and should only be used for power management use cases such as
|
||||
* suspend-to-RAM or suspend-to-disk.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.AUTOMOTIVE_GNSS_CONTROLS)
|
||||
public void setAutoGnssSuspended(boolean suspended) {
|
||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||
@RequiresFeature(PackageManager.FEATURE_AUTOMOTIVE)
|
||||
@RequiresPermission(android.Manifest.permission.CONTROL_AUTOMOTIVE_GNSS)
|
||||
public void setAutomotiveGnssSuspended(boolean suspended) {
|
||||
try {
|
||||
mService.setAutoGnssSuspended(suspended);
|
||||
mService.setAutomotiveGnssSuspended(suspended);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether GNSS requests are suspended or not.
|
||||
*
|
||||
* This method was added to help support power management use cases on automotive devices. More
|
||||
* specifically, it is being added as part of the fix for a suspend to RAM issue where the SoC
|
||||
* can't go into a lower power state when applications are actively requesting GNSS updates.
|
||||
* Return whether GNSS requests are suspended on the automotive device.
|
||||
*
|
||||
* @return true if GNSS requests are suspended and false if they aren't.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.AUTOMOTIVE_GNSS_CONTROLS)
|
||||
public boolean isAutoGnssSuspended() {
|
||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||
@RequiresFeature(PackageManager.FEATURE_AUTOMOTIVE)
|
||||
@RequiresPermission(android.Manifest.permission.CONTROL_AUTOMOTIVE_GNSS)
|
||||
public boolean isAutomotiveGnssSuspended() {
|
||||
try {
|
||||
return mService.isAutoGnssSuspended();
|
||||
return mService.isAutomotiveGnssSuspended();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
@@ -1239,29 +1239,29 @@ public class LocationManagerService extends ILocationManager.Stub implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequiresPermission(android.Manifest.permission.AUTOMOTIVE_GNSS_CONTROLS)
|
||||
public void setAutoGnssSuspended(boolean suspended) {
|
||||
mContext.enforceCallingPermission(permission.AUTOMOTIVE_GNSS_CONTROLS, null);
|
||||
@RequiresPermission(android.Manifest.permission.CONTROL_AUTOMOTIVE_GNSS)
|
||||
public void setAutomotiveGnssSuspended(boolean suspended) {
|
||||
mContext.enforceCallingPermission(permission.CONTROL_AUTOMOTIVE_GNSS, null);
|
||||
|
||||
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
|
||||
throw new IllegalStateException(
|
||||
"setAutoGnssSuspended only allowed on automotive devices");
|
||||
"setAutomotiveGnssSuspended only allowed on automotive devices");
|
||||
}
|
||||
|
||||
mGnssManagerService.setAutoGnssSuspended(suspended);
|
||||
mGnssManagerService.setAutomotiveGnssSuspended(suspended);
|
||||
}
|
||||
|
||||
@Override
|
||||
@RequiresPermission(android.Manifest.permission.AUTOMOTIVE_GNSS_CONTROLS)
|
||||
public boolean isAutoGnssSuspended() {
|
||||
mContext.enforceCallingPermission(permission.AUTOMOTIVE_GNSS_CONTROLS, null);
|
||||
@RequiresPermission(android.Manifest.permission.CONTROL_AUTOMOTIVE_GNSS)
|
||||
public boolean isAutomotiveGnssSuspended() {
|
||||
mContext.enforceCallingPermission(permission.CONTROL_AUTOMOTIVE_GNSS, null);
|
||||
|
||||
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
|
||||
throw new IllegalStateException(
|
||||
"isAutoGnssSuspended only allowed on automotive devices");
|
||||
"isAutomotiveGnssSuspended only allowed on automotive devices");
|
||||
}
|
||||
|
||||
return mGnssManagerService.isAutoGnssSuspended();
|
||||
return mGnssManagerService.isAutomotiveGnssSuspended();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -753,7 +753,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
||||
* Set whether the GnssLocationProvider is suspended. This method was added to help support
|
||||
* power management use cases on automotive devices.
|
||||
*/
|
||||
public void setAutoGnssSuspended(boolean suspended) {
|
||||
public void setAutomotiveGnssSuspended(boolean suspended) {
|
||||
synchronized (mLock) {
|
||||
mAutomotiveSuspend = suspended;
|
||||
}
|
||||
@@ -764,7 +764,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
||||
* Return whether the GnssLocationProvider is suspended or not. This method was added to help
|
||||
* support power management use cases on automotive devices.
|
||||
*/
|
||||
public boolean isAutoGnssSuspended() {
|
||||
public boolean isAutomotiveGnssSuspended() {
|
||||
synchronized (mLock) {
|
||||
return mAutomotiveSuspend && !mGpsEnabled;
|
||||
}
|
||||
|
||||
@@ -113,16 +113,16 @@ public class GnssManagerService {
|
||||
* Set whether the GnssLocationProvider is suspended on the device. This method was added to
|
||||
* help support power management use cases on automotive devices.
|
||||
*/
|
||||
public void setAutoGnssSuspended(boolean suspended) {
|
||||
mGnssLocationProvider.setAutoGnssSuspended(suspended);
|
||||
public void setAutomotiveGnssSuspended(boolean suspended) {
|
||||
mGnssLocationProvider.setAutomotiveGnssSuspended(suspended);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether the GnssLocationProvider is suspended or not. This method was added to
|
||||
* help support power management use cases on automotive devices.
|
||||
*/
|
||||
public boolean isAutoGnssSuspended() {
|
||||
return mGnssLocationProvider.isAutoGnssSuspended();
|
||||
public boolean isAutomotiveGnssSuspended() {
|
||||
return mGnssLocationProvider.isAutomotiveGnssSuspended();
|
||||
}
|
||||
|
||||
/** Retrieve the IGpsGeofenceHardware. */
|
||||
|
||||
Reference in New Issue
Block a user