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

Commit 3c45c4c9 authored by Jaewan Kim's avatar Jaewan Kim Committed by Rachad Alao
Browse files

Add multiuser support for enabling notification listener

Bug: 66504373
Bug: 65566927
Test: run CtsMediaHostTestCases
Change-Id: I7f22a3849a0dc298b8a6358327125d966068a09d
parent 7a59a622
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -5816,8 +5816,8 @@ public class NotificationManagerService extends SystemService {

    private class ShellCmd extends ShellCommand {
        public static final String USAGE = "help\n"
                + "allow_listener COMPONENT\n"
                + "disallow_listener COMPONENT\n"
                + "allow_listener COMPONENT [user_id]\n"
                + "disallow_listener COMPONENT [user_id]\n"
                + "set_assistant COMPONENT\n"
                + "remove_assistant COMPONENT\n"
                + "allow_dnd PACKAGE\n"
@@ -5848,7 +5848,13 @@ public class NotificationManagerService extends SystemService {
                            pw.println("Invalid listener - must be a ComponentName");
                            return -1;
                        }
                        String userId = getNextArg();
                        if (userId == null) {
                            getBinderService().setNotificationListenerAccessGranted(cn, true);
                        } else {
                            getBinderService().setNotificationListenerAccessGrantedForUser(
                                    cn, Integer.parseInt(userId), true);
                        }
                    }
                    break;
                    case "disallow_listener": {
@@ -5857,7 +5863,13 @@ public class NotificationManagerService extends SystemService {
                            pw.println("Invalid listener - must be a ComponentName");
                            return -1;
                        }
                        String userId = getNextArg();
                        if (userId == null) {
                            getBinderService().setNotificationListenerAccessGranted(cn, false);
                        } else {
                            getBinderService().setNotificationListenerAccessGrantedForUser(
                                    cn, Integer.parseInt(userId), false);
                        }
                    }
                    break;
                    case "allow_assistant": {