Add APIs to set Location History package name.

The package name will be used by Permission Controller to properly
handle permissions for location history package.

Bug: 119226131

Test: manually tested on device
Change-Id: I522517272c132a054c44489d16626509cf2b42ee
This commit is contained in:
Wei Wang
2018-12-06 17:53:00 -08:00
parent 98aab55ffe
commit 980b7c20d6
5 changed files with 128 additions and 0 deletions

View File

@@ -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;
}
}
}