Loading core/java/android/app/admin/DevicePolicyManager.java +5 −1 Original line number Diff line number Diff line Loading @@ -13896,7 +13896,11 @@ public class DevicePolicyManager { } /** * Returns whether USB data signaling is currently enabled by the admin. Callable by any app. * Returns whether USB data signaling is currently enabled. * * <p> When called by a device owner or profile owner of an organization-owned managed profile, * this API returns whether USB data signaling is currently enabled by that admin. When called * by any other app, returns whether USB data signaling is currently enabled on the device. * * @return {@code true} if USB data signaling is enabled, {@code false} otherwise. */ services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +15 −6 Original line number Diff line number Diff line Loading @@ -17565,10 +17565,15 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { @Override public boolean isUsbDataSignalingEnabled(String packageName) { final CallerIdentity caller = getCallerIdentity(packageName); synchronized (getLockObject()) { final ActiveAdmin admin = getProfileOwnerOrDeviceOwnerLocked( getCallerIdentity(packageName)); return admin.mUsbDataSignalingEnabled; // If the caller is an admin, return the policy set by itself. Otherwise // return the device-wide policy. if (isDeviceOwner(caller) || isProfileOwnerOfOrganizationOwnedDevice(caller)) { return getProfileOwnerOrDeviceOwnerLocked(caller).mUsbDataSignalingEnabled; } else { return isUsbDataSignalingEnabledInternalLocked(); } } } Loading @@ -17578,11 +17583,15 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { Preconditions.checkCallAuthorization(isSystemUid(caller)); synchronized (getLockObject()) { return isUsbDataSignalingEnabledInternalLocked(); } } private boolean isUsbDataSignalingEnabledInternalLocked() { final ActiveAdmin admin = getDeviceOwnerOrProfileOwnerOfOrganizationOwnedDeviceLocked( UserHandle.USER_SYSTEM); return admin == null || admin.mUsbDataSignalingEnabled; } } @Override public boolean canUsbDataSignalingBeDisabled() { Loading
core/java/android/app/admin/DevicePolicyManager.java +5 −1 Original line number Diff line number Diff line Loading @@ -13896,7 +13896,11 @@ public class DevicePolicyManager { } /** * Returns whether USB data signaling is currently enabled by the admin. Callable by any app. * Returns whether USB data signaling is currently enabled. * * <p> When called by a device owner or profile owner of an organization-owned managed profile, * this API returns whether USB data signaling is currently enabled by that admin. When called * by any other app, returns whether USB data signaling is currently enabled on the device. * * @return {@code true} if USB data signaling is enabled, {@code false} otherwise. */
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +15 −6 Original line number Diff line number Diff line Loading @@ -17565,10 +17565,15 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { @Override public boolean isUsbDataSignalingEnabled(String packageName) { final CallerIdentity caller = getCallerIdentity(packageName); synchronized (getLockObject()) { final ActiveAdmin admin = getProfileOwnerOrDeviceOwnerLocked( getCallerIdentity(packageName)); return admin.mUsbDataSignalingEnabled; // If the caller is an admin, return the policy set by itself. Otherwise // return the device-wide policy. if (isDeviceOwner(caller) || isProfileOwnerOfOrganizationOwnedDevice(caller)) { return getProfileOwnerOrDeviceOwnerLocked(caller).mUsbDataSignalingEnabled; } else { return isUsbDataSignalingEnabledInternalLocked(); } } } Loading @@ -17578,11 +17583,15 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { Preconditions.checkCallAuthorization(isSystemUid(caller)); synchronized (getLockObject()) { return isUsbDataSignalingEnabledInternalLocked(); } } private boolean isUsbDataSignalingEnabledInternalLocked() { final ActiveAdmin admin = getDeviceOwnerOrProfileOwnerOfOrganizationOwnedDeviceLocked( UserHandle.USER_SYSTEM); return admin == null || admin.mUsbDataSignalingEnabled; } } @Override public boolean canUsbDataSignalingBeDisabled() {