summaryrefslogtreecommitdiff
path: root/location/java/android
diff options
context:
space:
mode:
author Eva Chen <evaschen@google.com> 2022-01-20 14:39:32 -0800
committer Eva Chen <evaschen@google.com> 2022-01-25 12:58:55 -0800
commita10ba7bb2c6c8c71bb9db1b8e2c76e3bdaf082c3 (patch)
tree7a15de07d6d3bd805f48bfa54f5c0b16683bee18 /location/java/android
parent9653938ca6107f9de18e247255b446552bbd7de5 (diff)
Update GNSS S2R APIs based on API Council feedback.
Bug: 215304589 Test: atest GtsLocationTestCases:AutomotiveGnssControlsTest Change-Id: Ie1ff0698df9e23fa280fbbf71f1330bdf14f5f2c
Diffstat (limited to 'location/java/android')
-rw-r--r--location/java/android/location/ILocationManager.aidl4
-rw-r--r--location/java/android/location/LocationManager.java38
2 files changed, 19 insertions, 23 deletions
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<String> 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();
}