summaryrefslogtreecommitdiff
path: root/location/java
diff options
context:
space:
mode:
Diffstat (limited to 'location/java')
-rw-r--r--location/java/android/location/ILocationManager.aidl3
-rw-r--r--location/java/android/location/LocationManager.java45
2 files changed, 48 insertions, 0 deletions
diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl
index 5d5c0fc6265d..8054fd452022 100644
--- a/location/java/android/location/ILocationManager.aidl
+++ b/location/java/android/location/ILocationManager.aidl
@@ -125,6 +125,9 @@ interface ILocationManager
boolean isAdasGnssLocationEnabledForUser(int userId);
void setAdasGnssLocationEnabledForUser(boolean enabled, int userId);
+ boolean isAutoGnssSuspended();
+ void setAutoGnssSuspended(boolean suspended);
+
void addTestProvider(String name, in ProviderProperties properties,
in List<String> locationTags, String packageName, @nullable String attributionTag);
void removeTestProvider(String provider, String packageName, @nullable String attributionTag);
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 0681b8da43fd..2ff969316355 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -758,6 +758,51 @@ public class LocationManager {
}
/**
+ * Set whether GNSS requests are suspended on the 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.
+ *
+ * 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.
+ *
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.AUTOMOTIVE_GNSS_CONTROLS)
+ public void setAutoGnssSuspended(boolean suspended) {
+ try {
+ mService.setAutoGnssSuspended(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 true if GNSS requests are suspended and false if they aren't.
+ *
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.AUTOMOTIVE_GNSS_CONTROLS)
+ public boolean isAutoGnssSuspended() {
+ try {
+ return mService.isAutoGnssSuspended();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Gets the last known location from the fused provider, or null if there is no last known
* location. The returned location may be quite old in some circumstances, so the age of the
* location should always be checked.