Merge "Move the call to flush() to avoid a race condition"

This commit is contained in:
Piotr Wilczyński
2022-05-31 17:13:08 +00:00
committed by Android (Google) Code Review

View File

@@ -463,6 +463,7 @@ final class PersistentDataStore {
TypedXmlSerializer serializer = Xml.resolveSerializer(os);
saveToXml(serializer);
serializer.flush();
mHandler.removeCallbacksAndMessages(/* token */ null);
mHandler.post(() -> {
@@ -481,8 +482,6 @@ final class PersistentDataStore {
}
}
});
serializer.flush();
} catch (IOException ex) {
Slog.w(TAG, "Failed to process the XML serializer.", ex);
}