Address API council review comments.
Rename the setters and getter for location package extra. The getter is
not used by prebuilt apps, so they are renamed directly. The setter is
used by GmsCore, so mark as @removed for now.
Bug: 123587501
Test: Manual
Change-Id: Ia5167d20aff92242036e3642a176fe2ab03d8a52
diff --git a/api/system-current.txt b/api/system-current.txt
index b47f573..8ebed80 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -3376,19 +3376,19 @@
public class LocationManager {
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void flushGnssBatch();
+ method @Nullable public String getExtraLocationControllerPackage();
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public int getGnssBatchSize();
method @Nullable public android.location.GnssCapabilities getGnssCapabilities();
- method @Nullable public String getLocationControllerExtraPackage();
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void injectGnssMeasurementCorrections(@NonNull android.location.GnssMeasurementCorrections);
- method public boolean isLocationControllerExtraPackageEnabled();
+ method public boolean isExtraLocationControllerPackageEnabled();
method public boolean isLocationEnabledForUser(@NonNull android.os.UserHandle);
method public boolean isProviderEnabledForUser(@NonNull String, @NonNull android.os.UserHandle);
method public boolean isProviderPackage(@NonNull String);
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public boolean registerGnssBatchedLocationCallback(long, boolean, @NonNull android.location.BatchedLocationCallback, @Nullable android.os.Handler);
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull android.location.LocationRequest, @NonNull android.location.LocationListener, @Nullable android.os.Looper);
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull android.location.LocationRequest, @NonNull android.app.PendingIntent);
- method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void setLocationControllerExtraPackage(@NonNull String);
- method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void setLocationControllerExtraPackageEnabled(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);
method @Deprecated @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean setProviderEnabledForUser(@NonNull String, boolean, @NonNull android.os.UserHandle);
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public boolean unregisterGnssBatchedLocationCallback(@NonNull android.location.BatchedLocationCallback);
diff --git a/api/system-removed.txt b/api/system-removed.txt
index 9780d43..162f212 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -67,6 +67,8 @@
method @Deprecated public boolean addGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
method @Deprecated public void removeGpsMeasurementListener(android.location.GpsMeasurementsEvent.Listener);
method @Deprecated public void removeGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
+ method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void setLocationControllerExtraPackage(String);
+ method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void setLocationControllerExtraPackageEnabled(boolean);
}
}
diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl
index 93dc6fa..97bc404 100644
--- a/location/java/android/location/ILocationManager.aidl
+++ b/location/java/android/location/ILocationManager.aidl
@@ -93,10 +93,10 @@
ProviderProperties getProviderProperties(String provider);
boolean isProviderPackage(String packageName);
- void setLocationControllerExtraPackage(String packageName);
- String getLocationControllerExtraPackage();
- void setLocationControllerExtraPackageEnabled(boolean enabled);
- boolean isLocationControllerExtraPackageEnabled();
+ void setExtraLocationControllerPackage(String packageName);
+ String getExtraLocationControllerPackage();
+ void setExtraLocationControllerPackageEnabled(boolean enabled);
+ boolean isExtraLocationControllerPackageEnabled();
boolean isProviderEnabledForUser(String provider, int userId);
boolean isLocationEnabledForUser(int userId);
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index edf304c..af60e3c 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -2328,9 +2328,27 @@
*/
@SystemApi
@RequiresPermission(Manifest.permission.LOCATION_HARDWARE)
- public void setLocationControllerExtraPackage(@NonNull String packageName) {
+ public void setExtraLocationControllerPackage(@Nullable String packageName) {
try {
- mService.setLocationControllerExtraPackage(packageName);
+ mService.setExtraLocationControllerPackage(packageName);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Set the extra location controller package for location services on the device.
+ *
+ * @removed
+ * @deprecated Use {@link #setExtraLocationControllerPackage} instead.
+ * @hide
+ */
+ @Deprecated
+ @SystemApi
+ @RequiresPermission(Manifest.permission.LOCATION_HARDWARE)
+ public void setLocationControllerExtraPackage(String packageName) {
+ try {
+ mService.setExtraLocationControllerPackage(packageName);
} catch (RemoteException e) {
e.rethrowFromSystemServer();
}
@@ -2342,9 +2360,9 @@
* @hide
*/
@SystemApi
- public @Nullable String getLocationControllerExtraPackage() {
+ public @Nullable String getExtraLocationControllerPackage() {
try {
- return mService.getLocationControllerExtraPackage();
+ return mService.getExtraLocationControllerPackage();
} catch (RemoteException e) {
e.rethrowFromSystemServer();
return null;
@@ -2354,13 +2372,31 @@
/**
* Set whether the extra location controller package is currently enabled on the device.
*
+ * @removed
+ * @deprecated Use {@link #setExtraLocationControllerPackageEnabled} instead.
+ * @hide
+ */
+ @SystemApi
+ @Deprecated
+ @RequiresPermission(Manifest.permission.LOCATION_HARDWARE)
+ public void setLocationControllerExtraPackageEnabled(boolean enabled) {
+ try {
+ mService.setExtraLocationControllerPackageEnabled(enabled);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Set whether the extra location controller package is currently enabled on the device.
+ *
* @hide
*/
@SystemApi
@RequiresPermission(Manifest.permission.LOCATION_HARDWARE)
- public void setLocationControllerExtraPackageEnabled(boolean enabled) {
+ public void setExtraLocationControllerPackageEnabled(boolean enabled) {
try {
- mService.setLocationControllerExtraPackageEnabled(enabled);
+ mService.setExtraLocationControllerPackageEnabled(enabled);
} catch (RemoteException e) {
e.rethrowFromSystemServer();
}
@@ -2372,9 +2408,9 @@
* @hide
*/
@SystemApi
- public boolean isLocationControllerExtraPackageEnabled() {
+ public boolean isExtraLocationControllerPackageEnabled() {
try {
- return mService.isLocationControllerExtraPackageEnabled();
+ return mService.isExtraLocationControllerPackageEnabled();
} catch (RemoteException e) {
e.rethrowFromSystemServer();
return false;
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java
index f0244c3..2ded1e5 100644
--- a/services/core/java/com/android/server/LocationManagerService.java
+++ b/services/core/java/com/android/server/LocationManagerService.java
@@ -200,8 +200,8 @@
private GnssMeasurementCorrectionsProvider mGnssMeasurementCorrectionsProvider;
private GnssNavigationMessageProvider mGnssNavigationMessageProvider;
@GuardedBy("mLock")
- private String mLocationControllerExtraPackage;
- private boolean mLocationControllerExtraPackageEnabled;
+ private String mExtraLocationControllerPackage;
+ private boolean mExtraLocationControllerPackageEnabled;
private IGpsGeofenceHardware mGpsGeofenceProxy;
// list of currently active providers
@@ -3045,35 +3045,35 @@
}
@Override
- public void setLocationControllerExtraPackage(String packageName) {
+ public void setExtraLocationControllerPackage(String packageName) {
mContext.enforceCallingPermission(Manifest.permission.LOCATION_HARDWARE,
Manifest.permission.LOCATION_HARDWARE + " permission required");
synchronized (mLock) {
- mLocationControllerExtraPackage = packageName;
+ mExtraLocationControllerPackage = packageName;
}
}
@Override
- public String getLocationControllerExtraPackage() {
+ public String getExtraLocationControllerPackage() {
synchronized (mLock) {
- return mLocationControllerExtraPackage;
+ return mExtraLocationControllerPackage;
}
}
@Override
- public void setLocationControllerExtraPackageEnabled(boolean enabled) {
+ public void setExtraLocationControllerPackageEnabled(boolean enabled) {
mContext.enforceCallingPermission(Manifest.permission.LOCATION_HARDWARE,
Manifest.permission.LOCATION_HARDWARE + " permission required");
synchronized (mLock) {
- mLocationControllerExtraPackageEnabled = enabled;
+ mExtraLocationControllerPackageEnabled = enabled;
}
}
@Override
- public boolean isLocationControllerExtraPackageEnabled() {
+ public boolean isExtraLocationControllerPackageEnabled() {
synchronized (mLock) {
- return mLocationControllerExtraPackageEnabled
- && (mLocationControllerExtraPackage != null);
+ return mExtraLocationControllerPackageEnabled
+ && (mExtraLocationControllerPackage != null);
}
}
@@ -3610,9 +3610,9 @@
pw.println(" mBlacklist=null");
}
- if (mLocationControllerExtraPackage != null) {
- pw.println(" Location controller extra package: " + mLocationControllerExtraPackage
- + " enabled: " + mLocationControllerExtraPackageEnabled);
+ if (mExtraLocationControllerPackage != null) {
+ pw.println(" Location controller extra package: " + mExtraLocationControllerPackage
+ + " enabled: " + mExtraLocationControllerPackageEnabled);
}
if (!mBackgroundThrottlePackageWhitelist.isEmpty()) {