diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 9bfd67783e694..1406a396e96d9 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -7960,13 +7960,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { Preconditions.checkCallAuthorization(hasCrossUsersPermission(caller, userId)); synchronized (getLockObject()) { - if (mOwners.hasProfileOwner(userId) || mOwners.hasDeviceOwner()) { - final ActiveAdmin admin = getDeviceOrProfileOwnerAdminLocked(userId); - return admin.mNearbyNotificationStreamingPolicy; - } + final ActiveAdmin admin = getDeviceOrProfileOwnerAdminLocked(userId); + return admin != null + ? admin.mNearbyNotificationStreamingPolicy + : NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY; } - - return NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY; } @Override @@ -8001,13 +7999,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { Preconditions.checkCallAuthorization(hasCrossUsersPermission(caller, userId)); synchronized (getLockObject()) { - if (mOwners.hasProfileOwner(userId) || mOwners.hasDeviceOwner()) { - final ActiveAdmin admin = getDeviceOrProfileOwnerAdminLocked(userId); - return admin.mNearbyAppStreamingPolicy; - } + final ActiveAdmin admin = getDeviceOrProfileOwnerAdminLocked(userId); + return admin != null + ? admin.mNearbyAppStreamingPolicy + : NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY; } - - return NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY; } /**