if (TextUtils.isEmpty(filePath)) {
throw new IllegalArgumentException("empty file path");
}
/* Do a delayed write to disk on a separate handler thread */
synchronized (this) {
if (++mWriteSequence == 1) {
mDiskWriteHandlerThread = new HandlerThread("DelayedDiskWriteThread");
mDiskWriteHandlerThread.start();
mDiskWriteHandler = new Handler(mDiskWriteHandlerThread.getLooper());
}
}
mDiskWriteHandler.post(new Runnable() {
@Override
public void run() {
doWrite(filePath, w);
}
});