summaryrefslogtreecommitdiff
path: root/location/java/android
diff options
context:
space:
mode:
author Eva Chen <evaschen@google.com> 2022-01-27 23:05:30 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-01-27 23:05:30 +0000
commitb9314e1681da4db86c8dfa72570066defa14cd8f (patch)
tree289ffa2b3c482a550d8f6f0ebeab4a4a4bd671f7 /location/java/android
parent9c6a92819b23a641dd609310019205fa641f058c (diff)
parenta10ba7bb2c6c8c71bb9db1b8e2c76e3bdaf082c3 (diff)
Merge "Update GNSS S2R APIs based on API Council feedback."
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();
}