am ae6f6e81: am 625cfe3d: Merge "ResearchLog uploadingService now waits for logging to finish" into jb-mr1-dev
* commit 'ae6f6e8109da26756d8ea10b45b3ad68698b021b': ResearchLog uploadingService now waits for logging to finishmain
commit
58bc18ca75
|
@ -93,7 +93,7 @@ public class ResearchLog {
|
|||
mFile = outputFile;
|
||||
}
|
||||
|
||||
public synchronized void close() {
|
||||
public synchronized void close(final Runnable onClosed) {
|
||||
mExecutor.submit(new Callable<Object>() {
|
||||
@Override
|
||||
public Object call() throws Exception {
|
||||
|
@ -111,6 +111,9 @@ public class ResearchLog {
|
|||
if (mFile.exists()) {
|
||||
mFile.setWritable(false, false);
|
||||
}
|
||||
if (onClosed != null) {
|
||||
onClosed.run();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -376,11 +376,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
|
|||
|
||||
if (mMainLogBuffer != null) {
|
||||
publishLogBuffer(mMainLogBuffer, mMainResearchLog, false /* isIncludingPrivateData */);
|
||||
mMainResearchLog.close();
|
||||
mMainResearchLog.close(null /* callback */);
|
||||
mMainLogBuffer = null;
|
||||
}
|
||||
if (mFeedbackLogBuffer != null) {
|
||||
mFeedbackLog.close();
|
||||
mFeedbackLog.close(null /* callback */);
|
||||
mFeedbackLogBuffer = null;
|
||||
}
|
||||
}
|
||||
|
@ -549,8 +549,12 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
|
|||
false /* isPotentiallyPrivate */);
|
||||
mFeedbackLogBuffer.shiftIn(feedbackLogUnit);
|
||||
publishLogBuffer(mFeedbackLogBuffer, mFeedbackLog, true /* isIncludingPrivateData */);
|
||||
mFeedbackLog.close();
|
||||
mFeedbackLog.close(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
uploadNow();
|
||||
}
|
||||
});
|
||||
mFeedbackLog = new ResearchLog(createLogFile(mFilesDir));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue