Fix NPE in streamin policy getters.
If there is a DO but it is not on userId, admin was null. With this change DO policies set on other users aren't taken into account, NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY is returned. Fixes: 264761323 Test: atest NearbyNotificationStreamingPolicyTest Test: atest NearbyAppStreamingPolicyTest Change-Id: I4562fb44d663a2d590ab92dd66b881b636838910
This commit is contained in:
@@ -7957,13 +7957,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
|
||||
@@ -7998,13 +7996,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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user