Merge "Add APIs to set Location History package name."
This commit is contained in:
committed by
Android (Google) Code Review
commit
e48e378bee
@@ -2762,7 +2762,9 @@ package android.location {
|
||||
method public deprecated boolean addGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
|
||||
method public void flushGnssBatch();
|
||||
method public int getGnssBatchSize();
|
||||
method public java.lang.String getLocationControllerExtraPackage();
|
||||
method public java.lang.String getNetworkProviderPackage();
|
||||
method public boolean isLocationControllerExtraPackageEnabled();
|
||||
method public boolean isLocationEnabledForUser(android.os.UserHandle);
|
||||
method public boolean isProviderEnabledForUser(java.lang.String, android.os.UserHandle);
|
||||
method public boolean registerGnssBatchedLocationCallback(long, boolean, android.location.BatchedLocationCallback, android.os.Handler);
|
||||
@@ -2770,6 +2772,8 @@ package android.location {
|
||||
method public deprecated void removeGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
|
||||
method public void requestLocationUpdates(android.location.LocationRequest, android.location.LocationListener, android.os.Looper);
|
||||
method public void requestLocationUpdates(android.location.LocationRequest, android.app.PendingIntent);
|
||||
method public void setLocationControllerExtraPackage(java.lang.String);
|
||||
method public void setLocationControllerExtraPackageEnabled(boolean);
|
||||
method public void setLocationEnabledForUser(boolean, android.os.UserHandle);
|
||||
method public boolean setProviderEnabledForUser(java.lang.String, boolean, android.os.UserHandle);
|
||||
method public boolean unregisterGnssBatchedLocationCallback(android.location.BatchedLocationCallback);
|
||||
@@ -4647,6 +4651,7 @@ package android.provider {
|
||||
|
||||
public final class Settings {
|
||||
field public static final java.lang.String ACTION_ENTERPRISE_PRIVACY_SETTINGS = "android.settings.ENTERPRISE_PRIVACY_SETTINGS";
|
||||
field public static final java.lang.String ACTION_LOCATION_CONTROLLER_EXTRA_PACKAGE_SETTINGS = "android.settings.LOCATION_CONTROLLER_EXTRA_PACKAGE_SETTINGS";
|
||||
field public static final java.lang.String ACTION_SHOW_ADMIN_SUPPORT_DETAILS = "android.settings.SHOW_ADMIN_SUPPORT_DETAILS";
|
||||
}
|
||||
|
||||
|
||||
@@ -149,6 +149,23 @@ public final class Settings {
|
||||
public static final String ACTION_LOCATION_SOURCE_SETTINGS =
|
||||
"android.settings.LOCATION_SOURCE_SETTINGS";
|
||||
|
||||
/**
|
||||
* Activity Action: Show settings to allow configuration of location controller extra package.
|
||||
* <p>
|
||||
* In some cases, a matching Activity may not exist, so ensure you
|
||||
* safeguard against this.
|
||||
* <p>
|
||||
* Input: Nothing.
|
||||
* <p>
|
||||
* Output: Nothing.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
|
||||
public static final String ACTION_LOCATION_CONTROLLER_EXTRA_PACKAGE_SETTINGS =
|
||||
"android.settings.LOCATION_CONTROLLER_EXTRA_PACKAGE_SETTINGS";
|
||||
|
||||
/**
|
||||
* Activity Action: Show scanning settings to allow configuration of Wi-Fi
|
||||
* and Bluetooth scanning settings.
|
||||
|
||||
@@ -88,6 +88,10 @@ interface ILocationManager
|
||||
boolean providerMeetsCriteria(String provider, in Criteria criteria);
|
||||
ProviderProperties getProviderProperties(String provider);
|
||||
String getNetworkProviderPackage();
|
||||
void setLocationControllerExtraPackage(String packageName);
|
||||
String getLocationControllerExtraPackage();
|
||||
void setLocationControllerExtraPackageEnabled(boolean enabled);
|
||||
boolean isLocationControllerExtraPackageEnabled();
|
||||
|
||||
boolean isProviderEnabledForUser(String provider, int userId);
|
||||
boolean setProviderEnabledForUser(String provider, boolean enabled, int userId);
|
||||
|
||||
@@ -2396,4 +2396,65 @@ public class LocationManager {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the extra location controller package for location services on the device.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(Manifest.permission.LOCATION_HARDWARE)
|
||||
public void setLocationControllerExtraPackage(String packageName) {
|
||||
try {
|
||||
mService.setLocationControllerExtraPackage(packageName);
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the extra location controller package on the device.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public @Nullable String getLocationControllerExtraPackage() {
|
||||
try {
|
||||
return mService.getLocationControllerExtraPackage();
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
try {
|
||||
mService.setLocationControllerExtraPackageEnabled(enabled);
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether extra location controller package is currently enabled on the device.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public boolean isLocationControllerExtraPackageEnabled() {
|
||||
try {
|
||||
return mService.isLocationControllerExtraPackageEnabled();
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import static android.provider.Settings.Global.LOCATION_DISABLE_STATUS_CALLBACKS
|
||||
|
||||
import static com.android.internal.util.Preconditions.checkState;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityManager;
|
||||
@@ -189,6 +190,8 @@ public class LocationManagerService extends ILocationManager.Stub {
|
||||
private LocationBlacklist mBlacklist;
|
||||
private GnssMeasurementsProvider mGnssMeasurementsProvider;
|
||||
private GnssNavigationMessageProvider mGnssNavigationMessageProvider;
|
||||
private String mLocationControllerExtraPackage;
|
||||
private boolean mLocationControllerExtraPackageEnabled;
|
||||
private IGpsGeofenceHardware mGpsGeofenceProxy;
|
||||
|
||||
// --- fields below are protected by mLock ---
|
||||
@@ -2717,6 +2720,39 @@ public class LocationManagerService extends ILocationManager.Stub {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocationControllerExtraPackage(String packageName) {
|
||||
mContext.enforceCallingPermission(Manifest.permission.LOCATION_HARDWARE,
|
||||
Manifest.permission.LOCATION_HARDWARE + " permission required");
|
||||
synchronized (mLock) {
|
||||
mLocationControllerExtraPackage = packageName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocationControllerExtraPackage() {
|
||||
synchronized (mLock) {
|
||||
return mLocationControllerExtraPackage;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocationControllerExtraPackageEnabled(boolean enabled) {
|
||||
mContext.enforceCallingPermission(Manifest.permission.LOCATION_HARDWARE,
|
||||
Manifest.permission.LOCATION_HARDWARE + " permission required");
|
||||
synchronized (mLock) {
|
||||
mLocationControllerExtraPackageEnabled = enabled;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocationControllerExtraPackageEnabled() {
|
||||
synchronized (mLock) {
|
||||
return mLocationControllerExtraPackageEnabled
|
||||
&& (mLocationControllerExtraPackage != null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current location enabled/disabled status for a user
|
||||
*
|
||||
@@ -3492,6 +3528,11 @@ public class LocationManagerService extends ILocationManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
if (mLocationControllerExtraPackage != null) {
|
||||
pw.println(" Location controller extra package: " + mLocationControllerExtraPackage
|
||||
+ " enabled: " + mLocationControllerExtraPackageEnabled);
|
||||
}
|
||||
|
||||
if (!mBackgroundThrottlePackageWhitelist.isEmpty()) {
|
||||
pw.println(" Throttling Whitelisted Packages:");
|
||||
for (String packageName : mBackgroundThrottlePackageWhitelist) {
|
||||
|
||||
Reference in New Issue
Block a user