Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3807493 authored by Pavel Grafov's avatar Pavel Grafov
Browse files

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
parent ec3c5f10
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -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;
            }
            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;
            }
            return admin != null
                    ? admin.mNearbyAppStreamingPolicy
                    : NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY;
        }
        return NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY;
    }
    /**