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

Commit 9c292e33 authored by Julia Reynolds's avatar Julia Reynolds Committed by android-build-merger
Browse files

Merge "Clear calling identity" into oc-mr1-dev

am: bc0c5882

Change-Id: I7c2099ce909f1bdfc0a862c4d25257e0f51a0025
parents 379961a3 bc0c5882
Loading
Loading
Loading
Loading
+49 −33
Original line number Diff line number Diff line
@@ -2749,6 +2749,8 @@ public class NotificationManagerService extends SystemService {
        public void setNotificationPolicyAccessGranted(String pkg, boolean granted)
                throws RemoteException {
            checkCallerIsSystemOrShell();
            final long identity = Binder.clearCallingIdentity();
            try {
                if (!mActivityManager.isLowRamDevice()) {
                    mConditionProviders.setPackageOrComponentEnabled(
                            pkg, getCallingUserHandle().getIdentifier(), true, granted);
@@ -2761,6 +2763,9 @@ public class NotificationManagerService extends SystemService {

                    savePolicyFile();
                }
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
        }

        @Override
@@ -2841,6 +2846,8 @@ public class NotificationManagerService extends SystemService {
                boolean granted) throws RemoteException {
            Preconditions.checkNotNull(listener);
            checkCallerIsSystemOrShell();
            final long identity = Binder.clearCallingIdentity();
            try {
                if (!mActivityManager.isLowRamDevice()) {
                    mConditionProviders.setPackageOrComponentEnabled(listener.flattenToString(),
                            userId, false, granted);
@@ -2849,12 +2856,16 @@ public class NotificationManagerService extends SystemService {

                    getContext().sendBroadcastAsUser(new Intent(
                                    NotificationManager.ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED)

                                    .setPackage(listener.getPackageName())
                                    .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY),
                            getCallingUserHandle(), null);

                    savePolicyFile();
                }
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
        }

        @Override
@@ -2862,6 +2873,8 @@ public class NotificationManagerService extends SystemService {
                int userId, boolean granted) throws RemoteException {
            Preconditions.checkNotNull(assistant);
            checkCallerIsSystemOrShell();
            final long identity = Binder.clearCallingIdentity();
            try {
                if (!mActivityManager.isLowRamDevice()) {
                    mConditionProviders.setPackageOrComponentEnabled(assistant.flattenToString(),
                            userId, false, granted);
@@ -2876,6 +2889,9 @@ public class NotificationManagerService extends SystemService {

                    savePolicyFile();
                }
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
        }

        @Override