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

Commit 9bf22715 authored by songjinshi's avatar songjinshi Committed by 金时 宋
Browse files

[NotificationManagerService]: Fixes the thread-safe issue.

Add missed sync for backup realted access.

https://code.google.com/p/android/issues/detail?id=233435



Change-Id: I8499f79f491cec545d348bc9c3204aa79ccb6706
Signed-off-by: default avatarsongjinshi <songjinshi@xiaomi.com>
parent e02e3ea7
Loading
Loading
Loading
Loading
+16 −12
Original line number Diff line number Diff line
@@ -2078,6 +2078,7 @@ public class NotificationManagerService extends SystemService {
                Slog.w(TAG, "getBackupPayload: cannot backup policy for user " + user);
                return null;
            }
            synchronized(mPolicyFile) {
                final ByteArrayOutputStream baos = new ByteArrayOutputStream();
                try {
                    writePolicyXml(baos, true /*forBackup*/);
@@ -2085,6 +2086,7 @@ public class NotificationManagerService extends SystemService {
                } catch (IOException e) {
                    Slog.w(TAG, "getBackupPayload: error writing payload for user " + user, e);
                }
            }
            return null;
        }

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

        @Override
        public boolean isNotificationPolicyAccessGranted(String pkg) {