Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Android] Reorder file closing sequence
There is a race condition in test `testNormalPrintingFlow`, which will cause failures in `FileInputStream`. Generally, when `FileInputStream` created, the same file descriptor used previously will be reused, but in the instrumentation thread, after `onWriteFinished`, it is trying to close the same file descriptor, so sometimes it will cause crashes. This CL: 1) Removes unnecessary fileDescriptor.close() in the override `onWriteFinished`. 2) Place `closeFileDescriptor(mFileDescriptor)` before calls `onWrite*` callbacks to make the testing code wait the whole procedure finished, this removes the race condition. Bug: 732698 Change-Id: Ifdc1fa9f00cb77f64f46f6d09df5890b1bb12061 Reviewed-on: https://chromium-review.googlesource.com/549227 Reviewed-by: Selim Gurun <sgurun@chromium.org> Reviewed-by: Ted Choc <tedchoc@chromium.org> Reviewed-by: Nicolas Dossou-Gbété <dgn@chromium.org> Commit-Queue: Shimi Zhang <ctzsm@chromium.org> Cr-Commit-Position: refs/heads/master@{#483023}
- Loading branch information