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

Commit eaa3f2ff authored by Yash Garg's avatar Yash Garg 💬
Browse files

directly use allow functions for dnd and notification listener

parent 96aa521c
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -806,7 +806,7 @@ public class NotificationManagerService extends SystemService {
        if (DBG) Slog.d(TAG, "loadPolicyFile");
        synchronized (mPolicyFile) {
            InputStream infile = null;
            mListeners.loadForceNotificationEnabledServices();
            mListeners.loadForceNotificationEnabledServices(USER_SYSTEM);
            try {
                infile = mPolicyFile.openRead();
                readPolicyXml(infile, false /*forRestore*/, UserHandle.USER_ALL);
@@ -9566,7 +9566,7 @@ public class NotificationManagerService extends SystemService {
        }

        
        protected void loadForceNotificationEnabledServices() {
        protected void loadForceNotificationEnabledServices(int userId) {
            String forceEnabledPackages = mContext.getResources().getString(
                    R.string.config_forceNotificationPermission);

@@ -9574,16 +9574,20 @@ public class NotificationManagerService extends SystemService {
                String[] packages =
                        forceEnabledPackages.split(ManagedServices.ENABLED_SERVICES_SEPARATOR);
                for (int i = 0; i < packages.length; i++) {
                    if (TextUtils.isEmpty(packages[i])) {
                    String pkg = packages[i];

                    if (TextUtils.isEmpty(pkg)) {
                        continue;
                    }

                    allowDndPackage(pkg);

                    ArraySet<ComponentName> approvedListeners =
                            this.queryPackageForServices(packages[i],
                            this.queryPackageForServices(pkg,
                                MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE, USER_SYSTEM);
                    for (int k = 0; k < approvedListeners.size(); k++) {
                        ComponentName cn = approvedListeners.valueAt(k);
                        addDefaultComponentOrPackage(cn.flattenToString());
                        allowNotificationListener(userId, cn);
                    }
                }
            }