Merge "[NotificationManagerService]: Fixes the thread-safe issue." am: d530d1bf18 am: f69a73793d am: d0e81464bd

am: c2b7dd0db4

Change-Id: Ia72af5433dae2d200503a91a92c91729eae1eadc
This commit is contained in:
songjinshi
2017-02-14 18:20:15 +00:00
committed by android-build-merger

View File

@@ -2458,12 +2458,14 @@ public class NotificationManagerService extends SystemService {
Slog.w(TAG, "getBackupPayload: cannot backup policy for user " + user);
return null;
}
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
writePolicyXml(baos, true /*forBackup*/);
return baos.toByteArray();
} catch (IOException e) {
Slog.w(TAG, "getBackupPayload: error writing payload for user " + user, e);
synchronized(mPolicyFile) {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
writePolicyXml(baos, true /*forBackup*/);
return baos.toByteArray();
} catch (IOException e) {
Slog.w(TAG, "getBackupPayload: error writing payload for user " + user, e);
}
}
return null;
}
@@ -2481,12 +2483,14 @@ public class NotificationManagerService extends SystemService {
Slog.w(TAG, "applyRestore: cannot restore policy for user " + user);
return;
}
final ByteArrayInputStream bais = new ByteArrayInputStream(payload);
try {
readPolicyXml(bais, true /*forRestore*/);
savePolicyFile();
} catch (NumberFormatException | XmlPullParserException | IOException e) {
Slog.w(TAG, "applyRestore: error reading payload", e);
synchronized(mPolicyFile) {
final ByteArrayInputStream bais = new ByteArrayInputStream(payload);
try {
readPolicyXml(bais, true /*forRestore*/);
savePolicyFile();
} catch (NumberFormatException | XmlPullParserException | IOException e) {
Slog.w(TAG, "applyRestore: error reading payload", e);
}
}
}