From a10ba7bb2c6c8c71bb9db1b8e2c76e3bdaf082c3 Mon Sep 17 00:00:00 2001 From: Eva Chen Date: Thu, 20 Jan 2022 14:39:32 -0800 Subject: Update GNSS S2R APIs based on API Council feedback. Bug: 215304589 Test: atest GtsLocationTestCases:AutomotiveGnssControlsTest Change-Id: Ie1ff0698df9e23fa280fbbf71f1330bdf14f5f2c --- .../java/android/location/ILocationManager.aidl | 4 +-- .../java/android/location/LocationManager.java | 38 ++++++++++------------ 2 files changed, 19 insertions(+), 23 deletions(-) (limited to 'location/java/android') diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl index 8054fd452022..f4e965f422c0 100644 --- a/location/java/android/location/ILocationManager.aidl +++ b/location/java/android/location/ILocationManager.aidl @@ -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 locationTags, String packageName, @nullable String attributionTag); diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java index 9109a18f120e..d275628f6e24 100644 --- a/location/java/android/location/LocationManager.java +++ b/location/java/android/location/LocationManager.java @@ -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(); } -- cgit v1.2.3-59-g8ed1b