The title is the question. I'm using libaums to transfer files both ways using BufferedInput/OutputStream, calling close() at the end. And then I'm closing UsbMassStorageDevice and exiting the app.
However, in Settings->Storage I see that USB OTG storage stays mounted. And it can be unmounted only there, in Settings, in a popup. There doesn't seem to be a legal Android API to unmount USB drive from code.
Since I'm building a minimal UI/minimal interaction app, this is a major hassle. However, I've unplugged the stick many times without explicitly unmounting and the copied files were always valid (used diff to check).
So - does copying a file and calling close with libaums guarantee complete transfer of the file? Or is there some underlying OS memory buffer which can't be forced to flush, so unplugging the drive without unmounting can result in corrupt files?