Merge "Changed behavior of DPMS.setLocationEnabled() for automotive." into sc-dev am: cf2f6ff89a am: 7c31aa3826
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14525263 Change-Id: I55f784eb12229f81f67483fbfea50f6ebe9bce0f
This commit is contained in:
@@ -10369,11 +10369,11 @@ public class DevicePolicyManager {
|
|||||||
/**
|
/**
|
||||||
* Called by device owners to set the user's global location setting.
|
* Called by device owners to set the user's global location setting.
|
||||||
*
|
*
|
||||||
* <p><b>Note: </b> this call is ignored on
|
|
||||||
* {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE automotive builds}.
|
|
||||||
*
|
*
|
||||||
* @param admin Which {@link DeviceAdminReceiver} this request is associated with
|
* @param admin Which {@link DeviceAdminReceiver} this request is associated with
|
||||||
* @param locationEnabled whether location should be enabled or disabled
|
* @param locationEnabled whether location should be enabled or disabled. <b>Note: </b> on
|
||||||
|
* {@link android.content.pm.PackageManager#FEATURE_AUTOMOTIVE automotive builds}, calls to
|
||||||
|
* disable will be ignored.
|
||||||
* @throws SecurityException if {@code admin} is not a device owner.
|
* @throws SecurityException if {@code admin} is not a device owner.
|
||||||
*/
|
*/
|
||||||
public void setLocationEnabled(@NonNull ComponentName admin, boolean locationEnabled) {
|
public void setLocationEnabled(@NonNull ComponentName admin, boolean locationEnabled) {
|
||||||
|
|||||||
@@ -11987,8 +11987,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
|||||||
Preconditions.checkCallAuthorization(isDeviceOwner(caller));
|
Preconditions.checkCallAuthorization(isDeviceOwner(caller));
|
||||||
|
|
||||||
UserHandle userHandle = caller.getUserHandle();
|
UserHandle userHandle = caller.getUserHandle();
|
||||||
if (mIsAutomotive) {
|
if (mIsAutomotive && !locationEnabled) {
|
||||||
Slogf.v(LOG_TAG, "setLocationEnabled(%s, %b): ignoring for user %s on automotive build",
|
Slogf.i(LOG_TAG, "setLocationEnabled(%s, %b): ignoring for user %s on automotive build",
|
||||||
who.flattenToShortString(), locationEnabled, userHandle);
|
who.flattenToShortString(), locationEnabled, userHandle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -11996,8 +11996,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
|||||||
mInjector.binderWithCleanCallingIdentity(() -> {
|
mInjector.binderWithCleanCallingIdentity(() -> {
|
||||||
boolean wasLocationEnabled = mInjector.getLocationManager().isLocationEnabledForUser(
|
boolean wasLocationEnabled = mInjector.getLocationManager().isLocationEnabledForUser(
|
||||||
userHandle);
|
userHandle);
|
||||||
Slogf.v(LOG_TAG, "calling locationManager.setLocationEnabledForUser(%b, %s)",
|
Slogf.v(LOG_TAG, "calling locationMgr.setLocationEnabledForUser(%b, %s) when it was %b",
|
||||||
locationEnabled, userHandle);
|
locationEnabled, userHandle, wasLocationEnabled);
|
||||||
mInjector.getLocationManager().setLocationEnabledForUser(locationEnabled, userHandle);
|
mInjector.getLocationManager().setLocationEnabledForUser(locationEnabled, userHandle);
|
||||||
|
|
||||||
// make a best effort to only show the notification if the admin is actually enabling
|
// make a best effort to only show the notification if the admin is actually enabling
|
||||||
|
|||||||
Reference in New Issue
Block a user