Merge "Add DPM API to request location provider enable"
This commit is contained in:
committed by
Android (Google) Code Review
commit
614210991b
@@ -8854,6 +8854,49 @@ public class DevicePolicyManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by device owners to request a location provider to change its allowed state. For a
|
||||
* provider to be enabled requires both that the master location setting is enabled, and that
|
||||
* the provider itself is allowed. Most location providers are always allowed. Some location
|
||||
* providers may have user consents or terms and conditions that must be accepted, or some other
|
||||
* type of blocker before they are allowed however. Every location provider is responsible for
|
||||
* its own allowed state.
|
||||
*
|
||||
* <p>This method requests that a location provider change its allowed state. For providers that
|
||||
* are always allowed and have no state to change, this will have no effect. If the provider
|
||||
* does require some consent, terms and conditions, or other blocking state, using this API
|
||||
* implies that the device owner is agreeing/disagreeing to any consents, terms and conditions,
|
||||
* etc, and the provider should make a best effort to adjust it's allowed state accordingly.
|
||||
*
|
||||
* <p>Location providers are generally only responsible for the current user, and callers must
|
||||
* assume that this method will only affect provider state for the current user. Callers are
|
||||
* responsible for tracking current user changes and re-updating provider state as necessary.
|
||||
*
|
||||
* <p>While providers are expected to make a best effort to honor this request, it is not a
|
||||
* given that all providers will support such a request. If a provider does change its state as
|
||||
* a result of this request, that may happen asynchronously after some delay. Test location
|
||||
* providers set through {@link android.location.LocationManager#addTestProvider} will respond
|
||||
* to this request to aide in testing.
|
||||
*
|
||||
* @param admin Which {@link DeviceAdminReceiver} this request is associated with
|
||||
* @param provider A location provider as listed by
|
||||
* {@link android.location.LocationManager#getAllProviders()}
|
||||
* @param providerAllowed Whether the location provider is being requested to enable or disable
|
||||
* itself
|
||||
* @throws SecurityException if {@code admin} is not a device owner.
|
||||
*/
|
||||
public void requestSetLocationProviderAllowed(@NonNull ComponentName admin,
|
||||
@NonNull String provider, boolean providerAllowed) {
|
||||
throwIfParentInstance("requestSetLocationProviderAllowed");
|
||||
if (mService != null) {
|
||||
try {
|
||||
mService.requestSetLocationProviderAllowed(admin, provider, providerAllowed);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by profile or device owners to update {@link android.provider.Settings.Secure}
|
||||
* settings. Validation that the value of the setting is in the correct form for the setting
|
||||
|
||||
@@ -270,6 +270,7 @@ interface IDevicePolicyManager {
|
||||
boolean isLockdownAdminConfiguredNetworks(in ComponentName who);
|
||||
|
||||
void setLocationEnabled(in ComponentName who, boolean locationEnabled);
|
||||
void requestSetLocationProviderAllowed(in ComponentName who, in String provider, boolean providerAllowed);
|
||||
|
||||
boolean setTime(in ComponentName who, long millis);
|
||||
boolean setTimeZone(in ComponentName who, String timeZone);
|
||||
|
||||
Reference in New Issue
Block a user