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

Commit 9cb1a5e5 authored by Daulet Zhanguzin's avatar Daulet Zhanguzin
Browse files

Replace com.android.internal.util.Preconditions.checkNotNull with

java.util.Objects.requireNonNull

Bug: 126528330

Test: Treehugger
Change-Id: I9932ddce2a0b4e6fcd1893d38c8a13e85d8226d8
parent 856ce4a1
Loading
Loading
Loading
Loading
+29 −29
Original line number Original line Diff line number Diff line
@@ -2261,8 +2261,8 @@ public class NotificationManagerService extends SystemService {


    private void createNotificationChannelGroup(String pkg, int uid, NotificationChannelGroup group,
    private void createNotificationChannelGroup(String pkg, int uid, NotificationChannelGroup group,
            boolean fromApp, boolean fromListener) {
            boolean fromApp, boolean fromListener) {
        Preconditions.checkNotNull(group);
        Objects.requireNonNull(group);
        Preconditions.checkNotNull(pkg);
        Objects.requireNonNull(pkg);


        final NotificationChannelGroup preUpdate =
        final NotificationChannelGroup preUpdate =
                mPreferencesHelper.getNotificationChannelGroup(group.getId(), pkg, uid);
                mPreferencesHelper.getNotificationChannelGroup(group.getId(), pkg, uid);
@@ -3005,7 +3005,7 @@ public class NotificationManagerService extends SystemService {
            boolean needsPolicyFileChange = false;
            boolean needsPolicyFileChange = false;
            for (int i = 0; i < channelsSize; i++) {
            for (int i = 0; i < channelsSize; i++) {
                final NotificationChannel channel = channels.get(i);
                final NotificationChannel channel = channels.get(i);
                Preconditions.checkNotNull(channel, "channel in list is null");
                Objects.requireNonNull(channel, "channel in list is null");
                needsPolicyFileChange = mPreferencesHelper.createNotificationChannel(pkg, uid,
                needsPolicyFileChange = mPreferencesHelper.createNotificationChannel(pkg, uid,
                        channel, true /* fromTargetApp */,
                        channel, true /* fromTargetApp */,
                        mConditionProviders.isPackageOrComponentAllowed(
                        mConditionProviders.isPackageOrComponentAllowed(
@@ -3126,7 +3126,7 @@ public class NotificationManagerService extends SystemService {
        public void updateNotificationChannelForPackage(String pkg, int uid,
        public void updateNotificationChannelForPackage(String pkg, int uid,
                NotificationChannel channel) {
                NotificationChannel channel) {
            enforceSystemOrSystemUI("Caller not system or systemui");
            enforceSystemOrSystemUI("Caller not system or systemui");
            Preconditions.checkNotNull(channel);
            Objects.requireNonNull(channel);
            updateNotificationChannelInt(pkg, uid, channel, false);
            updateNotificationChannelInt(pkg, uid, channel, false);
        }
        }


@@ -3877,21 +3877,21 @@ public class NotificationManagerService extends SystemService {


        @Override
        @Override
        public AutomaticZenRule getAutomaticZenRule(String id) throws RemoteException {
        public AutomaticZenRule getAutomaticZenRule(String id) throws RemoteException {
            Preconditions.checkNotNull(id, "Id is null");
            Objects.requireNonNull(id, "Id is null");
            enforcePolicyAccess(Binder.getCallingUid(), "getAutomaticZenRule");
            enforcePolicyAccess(Binder.getCallingUid(), "getAutomaticZenRule");
            return mZenModeHelper.getAutomaticZenRule(id);
            return mZenModeHelper.getAutomaticZenRule(id);
        }
        }


        @Override
        @Override
        public String addAutomaticZenRule(AutomaticZenRule automaticZenRule) {
        public String addAutomaticZenRule(AutomaticZenRule automaticZenRule) {
            Preconditions.checkNotNull(automaticZenRule, "automaticZenRule is null");
            Objects.requireNonNull(automaticZenRule, "automaticZenRule is null");
            Preconditions.checkNotNull(automaticZenRule.getName(), "Name is null");
            Objects.requireNonNull(automaticZenRule.getName(), "Name is null");
            if (automaticZenRule.getOwner() == null
            if (automaticZenRule.getOwner() == null
                    && automaticZenRule.getConfigurationActivity() == null) {
                    && automaticZenRule.getConfigurationActivity() == null) {
                throw new NullPointerException(
                throw new NullPointerException(
                        "Rule must have a conditionproviderservice and/or configuration activity");
                        "Rule must have a conditionproviderservice and/or configuration activity");
            }
            }
            Preconditions.checkNotNull(automaticZenRule.getConditionId(), "ConditionId is null");
            Objects.requireNonNull(automaticZenRule.getConditionId(), "ConditionId is null");
            if (automaticZenRule.getZenPolicy() != null
            if (automaticZenRule.getZenPolicy() != null
                    && automaticZenRule.getInterruptionFilter() != INTERRUPTION_FILTER_PRIORITY) {
                    && automaticZenRule.getInterruptionFilter() != INTERRUPTION_FILTER_PRIORITY) {
                throw new IllegalArgumentException("ZenPolicy is only applicable to "
                throw new IllegalArgumentException("ZenPolicy is only applicable to "
@@ -3906,14 +3906,14 @@ public class NotificationManagerService extends SystemService {
        @Override
        @Override
        public boolean updateAutomaticZenRule(String id, AutomaticZenRule automaticZenRule)
        public boolean updateAutomaticZenRule(String id, AutomaticZenRule automaticZenRule)
                throws RemoteException {
                throws RemoteException {
            Preconditions.checkNotNull(automaticZenRule, "automaticZenRule is null");
            Objects.requireNonNull(automaticZenRule, "automaticZenRule is null");
            Preconditions.checkNotNull(automaticZenRule.getName(), "Name is null");
            Objects.requireNonNull(automaticZenRule.getName(), "Name is null");
            if (automaticZenRule.getOwner() == null
            if (automaticZenRule.getOwner() == null
                    && automaticZenRule.getConfigurationActivity() == null) {
                    && automaticZenRule.getConfigurationActivity() == null) {
                throw new NullPointerException(
                throw new NullPointerException(
                        "Rule must have a conditionproviderservice and/or configuration activity");
                        "Rule must have a conditionproviderservice and/or configuration activity");
            }
            }
            Preconditions.checkNotNull(automaticZenRule.getConditionId(), "ConditionId is null");
            Objects.requireNonNull(automaticZenRule.getConditionId(), "ConditionId is null");
            enforcePolicyAccess(Binder.getCallingUid(), "updateAutomaticZenRule");
            enforcePolicyAccess(Binder.getCallingUid(), "updateAutomaticZenRule");


            return mZenModeHelper.updateAutomaticZenRule(id, automaticZenRule,
            return mZenModeHelper.updateAutomaticZenRule(id, automaticZenRule,
@@ -3922,7 +3922,7 @@ public class NotificationManagerService extends SystemService {


        @Override
        @Override
        public boolean removeAutomaticZenRule(String id) throws RemoteException {
        public boolean removeAutomaticZenRule(String id) throws RemoteException {
            Preconditions.checkNotNull(id, "Id is null");
            Objects.requireNonNull(id, "Id is null");
            // Verify that they can modify zen rules.
            // Verify that they can modify zen rules.
            enforcePolicyAccess(Binder.getCallingUid(), "removeAutomaticZenRule");
            enforcePolicyAccess(Binder.getCallingUid(), "removeAutomaticZenRule");


@@ -3931,7 +3931,7 @@ public class NotificationManagerService extends SystemService {


        @Override
        @Override
        public boolean removeAutomaticZenRules(String packageName) throws RemoteException {
        public boolean removeAutomaticZenRules(String packageName) throws RemoteException {
            Preconditions.checkNotNull(packageName, "Package name is null");
            Objects.requireNonNull(packageName, "Package name is null");
            enforceSystemOrSystemUI("removeAutomaticZenRules");
            enforceSystemOrSystemUI("removeAutomaticZenRules");


            return mZenModeHelper.removeAutomaticZenRules(packageName, "removeAutomaticZenRules");
            return mZenModeHelper.removeAutomaticZenRules(packageName, "removeAutomaticZenRules");
@@ -3939,7 +3939,7 @@ public class NotificationManagerService extends SystemService {


        @Override
        @Override
        public int getRuleInstanceCount(ComponentName owner) throws RemoteException {
        public int getRuleInstanceCount(ComponentName owner) throws RemoteException {
            Preconditions.checkNotNull(owner, "Owner is null");
            Objects.requireNonNull(owner, "Owner is null");
            enforceSystemOrSystemUI("getRuleInstanceCount");
            enforceSystemOrSystemUI("getRuleInstanceCount");


            return mZenModeHelper.getCurrentInstanceCount(owner);
            return mZenModeHelper.getCurrentInstanceCount(owner);
@@ -3947,8 +3947,8 @@ public class NotificationManagerService extends SystemService {


        @Override
        @Override
        public void setAutomaticZenRuleState(String id, Condition condition) {
        public void setAutomaticZenRuleState(String id, Condition condition) {
            Preconditions.checkNotNull(id, "id is null");
            Objects.requireNonNull(id, "id is null");
            Preconditions.checkNotNull(condition, "Condition is null");
            Objects.requireNonNull(condition, "Condition is null");


            enforcePolicyAccess(Binder.getCallingUid(), "setAutomaticZenRuleState");
            enforcePolicyAccess(Binder.getCallingUid(), "setAutomaticZenRuleState");


@@ -4292,7 +4292,7 @@ public class NotificationManagerService extends SystemService {


        @Override
        @Override
        public boolean isNotificationListenerAccessGranted(ComponentName listener) {
        public boolean isNotificationListenerAccessGranted(ComponentName listener) {
            Preconditions.checkNotNull(listener);
            Objects.requireNonNull(listener);
            checkCallerIsSystemOrSameApp(listener.getPackageName());
            checkCallerIsSystemOrSameApp(listener.getPackageName());
            return mListeners.isPackageOrComponentAllowed(listener.flattenToString(),
            return mListeners.isPackageOrComponentAllowed(listener.flattenToString(),
                    getCallingUserHandle().getIdentifier());
                    getCallingUserHandle().getIdentifier());
@@ -4301,7 +4301,7 @@ public class NotificationManagerService extends SystemService {
        @Override
        @Override
        public boolean isNotificationListenerAccessGrantedForUser(ComponentName listener,
        public boolean isNotificationListenerAccessGrantedForUser(ComponentName listener,
                int userId) {
                int userId) {
            Preconditions.checkNotNull(listener);
            Objects.requireNonNull(listener);
            checkCallerIsSystem();
            checkCallerIsSystem();
            return mListeners.isPackageOrComponentAllowed(listener.flattenToString(),
            return mListeners.isPackageOrComponentAllowed(listener.flattenToString(),
                    userId);
                    userId);
@@ -4309,7 +4309,7 @@ public class NotificationManagerService extends SystemService {


        @Override
        @Override
        public boolean isNotificationAssistantAccessGranted(ComponentName assistant) {
        public boolean isNotificationAssistantAccessGranted(ComponentName assistant) {
            Preconditions.checkNotNull(assistant);
            Objects.requireNonNull(assistant);
            checkCallerIsSystemOrSameApp(assistant.getPackageName());
            checkCallerIsSystemOrSameApp(assistant.getPackageName());
            return mAssistants.isPackageOrComponentAllowed(assistant.flattenToString(),
            return mAssistants.isPackageOrComponentAllowed(assistant.flattenToString(),
                    getCallingUserHandle().getIdentifier());
                    getCallingUserHandle().getIdentifier());
@@ -4332,7 +4332,7 @@ public class NotificationManagerService extends SystemService {
        @Override
        @Override
        public void setNotificationListenerAccessGrantedForUser(ComponentName listener, int userId,
        public void setNotificationListenerAccessGrantedForUser(ComponentName listener, int userId,
                boolean granted) {
                boolean granted) {
            Preconditions.checkNotNull(listener);
            Objects.requireNonNull(listener);
            checkCallerIsSystemOrShell();
            checkCallerIsSystemOrShell();
            final long identity = Binder.clearCallingIdentity();
            final long identity = Binder.clearCallingIdentity();
            try {
            try {
@@ -4450,7 +4450,7 @@ public class NotificationManagerService extends SystemService {
        public void updateNotificationChannelGroupFromPrivilegedListener(
        public void updateNotificationChannelGroupFromPrivilegedListener(
                INotificationListener token, String pkg, UserHandle user,
                INotificationListener token, String pkg, UserHandle user,
                NotificationChannelGroup group) throws RemoteException {
                NotificationChannelGroup group) throws RemoteException {
            Preconditions.checkNotNull(user);
            Objects.requireNonNull(user);
            verifyPrivilegedListener(token, user, false);
            verifyPrivilegedListener(token, user, false);
            createNotificationChannelGroup(
            createNotificationChannelGroup(
                    pkg, getUidForPackageAndUser(pkg, user), group, false, true);
                    pkg, getUidForPackageAndUser(pkg, user), group, false, true);
@@ -4460,9 +4460,9 @@ public class NotificationManagerService extends SystemService {
        @Override
        @Override
        public void updateNotificationChannelFromPrivilegedListener(INotificationListener token,
        public void updateNotificationChannelFromPrivilegedListener(INotificationListener token,
                String pkg, UserHandle user, NotificationChannel channel) throws RemoteException {
                String pkg, UserHandle user, NotificationChannel channel) throws RemoteException {
            Preconditions.checkNotNull(channel);
            Objects.requireNonNull(channel);
            Preconditions.checkNotNull(pkg);
            Objects.requireNonNull(pkg);
            Preconditions.checkNotNull(user);
            Objects.requireNonNull(user);


            verifyPrivilegedListener(token, user, false);
            verifyPrivilegedListener(token, user, false);
            updateNotificationChannelInt(pkg, getUidForPackageAndUser(pkg, user), channel, true);
            updateNotificationChannelInt(pkg, getUidForPackageAndUser(pkg, user), channel, true);
@@ -4471,8 +4471,8 @@ public class NotificationManagerService extends SystemService {
        @Override
        @Override
        public ParceledListSlice<NotificationChannel> getNotificationChannelsFromPrivilegedListener(
        public ParceledListSlice<NotificationChannel> getNotificationChannelsFromPrivilegedListener(
                INotificationListener token, String pkg, UserHandle user) throws RemoteException {
                INotificationListener token, String pkg, UserHandle user) throws RemoteException {
            Preconditions.checkNotNull(pkg);
            Objects.requireNonNull(pkg);
            Preconditions.checkNotNull(user);
            Objects.requireNonNull(user);
            verifyPrivilegedListener(token, user, true);
            verifyPrivilegedListener(token, user, true);


            return mPreferencesHelper.getNotificationChannels(pkg, getUidForPackageAndUser(pkg, user),
            return mPreferencesHelper.getNotificationChannels(pkg, getUidForPackageAndUser(pkg, user),
@@ -4483,8 +4483,8 @@ public class NotificationManagerService extends SystemService {
        public ParceledListSlice<NotificationChannelGroup>
        public ParceledListSlice<NotificationChannelGroup>
                getNotificationChannelGroupsFromPrivilegedListener(
                getNotificationChannelGroupsFromPrivilegedListener(
                INotificationListener token, String pkg, UserHandle user) throws RemoteException {
                INotificationListener token, String pkg, UserHandle user) throws RemoteException {
            Preconditions.checkNotNull(pkg);
            Objects.requireNonNull(pkg);
            Preconditions.checkNotNull(user);
            Objects.requireNonNull(user);
            verifyPrivilegedListener(token, user, true);
            verifyPrivilegedListener(token, user, true);


            List<NotificationChannelGroup> groups = new ArrayList<>();
            List<NotificationChannelGroup> groups = new ArrayList<>();
@@ -4520,7 +4520,7 @@ public class NotificationManagerService extends SystemService {


        @Override
        @Override
        public boolean isPackagePaused(String pkg) {
        public boolean isPackagePaused(String pkg) {
            Preconditions.checkNotNull(pkg);
            Objects.requireNonNull(pkg);
            checkCallerIsSameApp(pkg);
            checkCallerIsSameApp(pkg);


            return isPackagePausedOrSuspended(pkg, Binder.getCallingUid());
            return isPackagePausedOrSuspended(pkg, Binder.getCallingUid());
+19 −19
Original line number Original line Diff line number Diff line
@@ -621,10 +621,10 @@ public class PreferencesHelper implements RankingConfig {
    @Override
    @Override
    public void createNotificationChannelGroup(String pkg, int uid, NotificationChannelGroup group,
    public void createNotificationChannelGroup(String pkg, int uid, NotificationChannelGroup group,
            boolean fromTargetApp) {
            boolean fromTargetApp) {
        Preconditions.checkNotNull(pkg);
        Objects.requireNonNull(pkg);
        Preconditions.checkNotNull(group);
        Objects.requireNonNull(group);
        Preconditions.checkNotNull(group.getId());
        Objects.requireNonNull(group.getId());
        Preconditions.checkNotNull(!TextUtils.isEmpty(group.getName()));
        Objects.requireNonNull(!TextUtils.isEmpty(group.getName()));
        synchronized (mPackagePreferences) {
        synchronized (mPackagePreferences) {
            PackagePreferences r = getOrCreatePackagePreferencesLocked(pkg, uid);
            PackagePreferences r = getOrCreatePackagePreferencesLocked(pkg, uid);
            if (r == null) {
            if (r == null) {
@@ -658,9 +658,9 @@ public class PreferencesHelper implements RankingConfig {
    @Override
    @Override
    public boolean createNotificationChannel(String pkg, int uid, NotificationChannel channel,
    public boolean createNotificationChannel(String pkg, int uid, NotificationChannel channel,
            boolean fromTargetApp, boolean hasDndAccess) {
            boolean fromTargetApp, boolean hasDndAccess) {
        Preconditions.checkNotNull(pkg);
        Objects.requireNonNull(pkg);
        Preconditions.checkNotNull(channel);
        Objects.requireNonNull(channel);
        Preconditions.checkNotNull(channel.getId());
        Objects.requireNonNull(channel.getId());
        Preconditions.checkArgument(!TextUtils.isEmpty(channel.getName()));
        Preconditions.checkArgument(!TextUtils.isEmpty(channel.getName()));
        boolean needsPolicyFileChange = false;
        boolean needsPolicyFileChange = false;
        synchronized (mPackagePreferences) {
        synchronized (mPackagePreferences) {
@@ -788,8 +788,8 @@ public class PreferencesHelper implements RankingConfig {
    @Override
    @Override
    public void updateNotificationChannel(String pkg, int uid, NotificationChannel updatedChannel,
    public void updateNotificationChannel(String pkg, int uid, NotificationChannel updatedChannel,
            boolean fromUser) {
            boolean fromUser) {
        Preconditions.checkNotNull(updatedChannel);
        Objects.requireNonNull(updatedChannel);
        Preconditions.checkNotNull(updatedChannel.getId());
        Objects.requireNonNull(updatedChannel.getId());
        synchronized (mPackagePreferences) {
        synchronized (mPackagePreferences) {
            PackagePreferences r = getOrCreatePackagePreferencesLocked(pkg, uid);
            PackagePreferences r = getOrCreatePackagePreferencesLocked(pkg, uid);
            if (r == null) {
            if (r == null) {
@@ -850,7 +850,7 @@ public class PreferencesHelper implements RankingConfig {
    @Override
    @Override
    public NotificationChannel getNotificationChannel(String pkg, int uid, String channelId,
    public NotificationChannel getNotificationChannel(String pkg, int uid, String channelId,
            boolean includeDeleted) {
            boolean includeDeleted) {
        Preconditions.checkNotNull(pkg);
        Objects.requireNonNull(pkg);
        synchronized (mPackagePreferences) {
        synchronized (mPackagePreferences) {
            PackagePreferences r = getOrCreatePackagePreferencesLocked(pkg, uid);
            PackagePreferences r = getOrCreatePackagePreferencesLocked(pkg, uid);
            if (r == null) {
            if (r == null) {
@@ -891,8 +891,8 @@ public class PreferencesHelper implements RankingConfig {
    @Override
    @Override
    @VisibleForTesting
    @VisibleForTesting
    public void permanentlyDeleteNotificationChannel(String pkg, int uid, String channelId) {
    public void permanentlyDeleteNotificationChannel(String pkg, int uid, String channelId) {
        Preconditions.checkNotNull(pkg);
        Objects.requireNonNull(pkg);
        Preconditions.checkNotNull(channelId);
        Objects.requireNonNull(channelId);
        synchronized (mPackagePreferences) {
        synchronized (mPackagePreferences) {
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
            if (r == null) {
            if (r == null) {
@@ -904,7 +904,7 @@ public class PreferencesHelper implements RankingConfig {


    @Override
    @Override
    public void permanentlyDeleteNotificationChannels(String pkg, int uid) {
    public void permanentlyDeleteNotificationChannels(String pkg, int uid) {
        Preconditions.checkNotNull(pkg);
        Objects.requireNonNull(pkg);
        synchronized (mPackagePreferences) {
        synchronized (mPackagePreferences) {
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
            if (r == null) {
            if (r == null) {
@@ -993,7 +993,7 @@ public class PreferencesHelper implements RankingConfig {


    public NotificationChannelGroup getNotificationChannelGroupWithChannels(String pkg,
    public NotificationChannelGroup getNotificationChannelGroupWithChannels(String pkg,
            int uid, String groupId, boolean includeDeleted) {
            int uid, String groupId, boolean includeDeleted) {
        Preconditions.checkNotNull(pkg);
        Objects.requireNonNull(pkg);
        synchronized (mPackagePreferences) {
        synchronized (mPackagePreferences) {
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
            if (r == null || groupId == null || !r.groups.containsKey(groupId)) {
            if (r == null || groupId == null || !r.groups.containsKey(groupId)) {
@@ -1016,7 +1016,7 @@ public class PreferencesHelper implements RankingConfig {


    public NotificationChannelGroup getNotificationChannelGroup(String groupId, String pkg,
    public NotificationChannelGroup getNotificationChannelGroup(String groupId, String pkg,
            int uid) {
            int uid) {
        Preconditions.checkNotNull(pkg);
        Objects.requireNonNull(pkg);
        synchronized (mPackagePreferences) {
        synchronized (mPackagePreferences) {
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
            if (r == null) {
            if (r == null) {
@@ -1029,7 +1029,7 @@ public class PreferencesHelper implements RankingConfig {
    @Override
    @Override
    public ParceledListSlice<NotificationChannelGroup> getNotificationChannelGroups(String pkg,
    public ParceledListSlice<NotificationChannelGroup> getNotificationChannelGroups(String pkg,
            int uid, boolean includeDeleted, boolean includeNonGrouped, boolean includeEmpty) {
            int uid, boolean includeDeleted, boolean includeNonGrouped, boolean includeEmpty) {
        Preconditions.checkNotNull(pkg);
        Objects.requireNonNull(pkg);
        Map<String, NotificationChannelGroup> groups = new ArrayMap<>();
        Map<String, NotificationChannelGroup> groups = new ArrayMap<>();
        synchronized (mPackagePreferences) {
        synchronized (mPackagePreferences) {
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
@@ -1111,7 +1111,7 @@ public class PreferencesHelper implements RankingConfig {
    @Override
    @Override
    public ParceledListSlice<NotificationChannel> getNotificationChannels(String pkg, int uid,
    public ParceledListSlice<NotificationChannel> getNotificationChannels(String pkg, int uid,
            boolean includeDeleted) {
            boolean includeDeleted) {
        Preconditions.checkNotNull(pkg);
        Objects.requireNonNull(pkg);
        List<NotificationChannel> channels = new ArrayList<>();
        List<NotificationChannel> channels = new ArrayList<>();
        synchronized (mPackagePreferences) {
        synchronized (mPackagePreferences) {
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
@@ -1168,7 +1168,7 @@ public class PreferencesHelper implements RankingConfig {
    }
    }


    public int getDeletedChannelCount(String pkg, int uid) {
    public int getDeletedChannelCount(String pkg, int uid) {
        Preconditions.checkNotNull(pkg);
        Objects.requireNonNull(pkg);
        int deletedCount = 0;
        int deletedCount = 0;
        synchronized (mPackagePreferences) {
        synchronized (mPackagePreferences) {
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
@@ -1187,7 +1187,7 @@ public class PreferencesHelper implements RankingConfig {
    }
    }


    public int getBlockedChannelCount(String pkg, int uid) {
    public int getBlockedChannelCount(String pkg, int uid) {
        Preconditions.checkNotNull(pkg);
        Objects.requireNonNull(pkg);
        int blockedCount = 0;
        int blockedCount = 0;
        synchronized (mPackagePreferences) {
        synchronized (mPackagePreferences) {
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);