Watch for creation rather than updating of Tor cookie file
Tor writes to a temporary file and then renames it over the old file, if any, so CLOSE_WRITE never occurs. The old code was working in most cases because it received IGNORED when the old file was unlinked and didn't check the event type.
https://developer.android.com/reference/android/os/FileObserver
http://rswiki.csie.org/lxr/http/source/include/linux/inotify.h#L28
Possible fix for #1293 (closed), but I haven't been able to reproduce the bug.
Edited by akwizgran