ResearchLog uploadingService now waits for logging to finish
Bug: 6188932 Change-Id: I31c0f380b334d9117990f2d92de8d385e4a52c7c
This commit is contained in:
parent
58bb1d7dd1
commit
17114054e9
2 changed files with 12 additions and 5 deletions
|
@ -93,7 +93,7 @@ public class ResearchLog {
|
||||||
mFile = outputFile;
|
mFile = outputFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void close() {
|
public synchronized void close(final Runnable onClosed) {
|
||||||
mExecutor.submit(new Callable<Object>() {
|
mExecutor.submit(new Callable<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public Object call() throws Exception {
|
public Object call() throws Exception {
|
||||||
|
@ -111,6 +111,9 @@ public class ResearchLog {
|
||||||
if (mFile.exists()) {
|
if (mFile.exists()) {
|
||||||
mFile.setWritable(false, false);
|
mFile.setWritable(false, false);
|
||||||
}
|
}
|
||||||
|
if (onClosed != null) {
|
||||||
|
onClosed.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -376,11 +376,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
|
|
||||||
if (mMainLogBuffer != null) {
|
if (mMainLogBuffer != null) {
|
||||||
publishLogBuffer(mMainLogBuffer, mMainResearchLog, false /* isIncludingPrivateData */);
|
publishLogBuffer(mMainLogBuffer, mMainResearchLog, false /* isIncludingPrivateData */);
|
||||||
mMainResearchLog.close();
|
mMainResearchLog.close(null /* callback */);
|
||||||
mMainLogBuffer = null;
|
mMainLogBuffer = null;
|
||||||
}
|
}
|
||||||
if (mFeedbackLogBuffer != null) {
|
if (mFeedbackLogBuffer != null) {
|
||||||
mFeedbackLog.close();
|
mFeedbackLog.close(null /* callback */);
|
||||||
mFeedbackLogBuffer = null;
|
mFeedbackLogBuffer = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -549,8 +549,12 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
false /* isPotentiallyPrivate */);
|
false /* isPotentiallyPrivate */);
|
||||||
mFeedbackLogBuffer.shiftIn(feedbackLogUnit);
|
mFeedbackLogBuffer.shiftIn(feedbackLogUnit);
|
||||||
publishLogBuffer(mFeedbackLogBuffer, mFeedbackLog, true /* isIncludingPrivateData */);
|
publishLogBuffer(mFeedbackLogBuffer, mFeedbackLog, true /* isIncludingPrivateData */);
|
||||||
mFeedbackLog.close();
|
mFeedbackLog.close(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
uploadNow();
|
uploadNow();
|
||||||
|
}
|
||||||
|
});
|
||||||
mFeedbackLog = new ResearchLog(createLogFile(mFilesDir));
|
mFeedbackLog = new ResearchLog(createLogFile(mFilesDir));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue