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

Commit f69a7379 authored by songjinshi's avatar songjinshi Committed by android-build-merger
Browse files

Merge "[NotificationManagerService]: Fixes the thread-safe issue."

am: d530d1bf

Change-Id: I661207bb52d84b1928d7ff3ad262cfe89e71e60b
parents 02e71f62 d530d1bf
Loading
Loading
Loading
Loading
+16 −12
Original line number Original line Diff line number Diff line
@@ -2078,6 +2078,7 @@ public class NotificationManagerService extends SystemService {
                Slog.w(TAG, "getBackupPayload: cannot backup policy for user " + user);
                Slog.w(TAG, "getBackupPayload: cannot backup policy for user " + user);
                return null;
                return null;
            }
            }
            synchronized(mPolicyFile) {
                final ByteArrayOutputStream baos = new ByteArrayOutputStream();
                final ByteArrayOutputStream baos = new ByteArrayOutputStream();
                try {
                try {
                    writePolicyXml(baos, true /*forBackup*/);
                    writePolicyXml(baos, true /*forBackup*/);
@@ -2085,6 +2086,7 @@ public class NotificationManagerService extends SystemService {
                } catch (IOException e) {
                } catch (IOException e) {
                    Slog.w(TAG, "getBackupPayload: error writing payload for user " + user, e);
                    Slog.w(TAG, "getBackupPayload: error writing payload for user " + user, e);
                }
                }
            }
            return null;
            return null;
        }
        }


@@ -2101,6 +2103,7 @@ public class NotificationManagerService extends SystemService {
                Slog.w(TAG, "applyRestore: cannot restore policy for user " + user);
                Slog.w(TAG, "applyRestore: cannot restore policy for user " + user);
                return;
                return;
            }
            }
            synchronized(mPolicyFile) {
                final ByteArrayInputStream bais = new ByteArrayInputStream(payload);
                final ByteArrayInputStream bais = new ByteArrayInputStream(payload);
                try {
                try {
                    readPolicyXml(bais, true /*forRestore*/);
                    readPolicyXml(bais, true /*forRestore*/);
@@ -2109,6 +2112,7 @@ public class NotificationManagerService extends SystemService {
                    Slog.w(TAG, "applyRestore: error reading payload", e);
                    Slog.w(TAG, "applyRestore: error reading payload", e);
                }
                }
            }
            }
        }


        @Override
        @Override
        public boolean isNotificationPolicyAccessGranted(String pkg) {
        public boolean isNotificationPolicyAccessGranted(String pkg) {