Merge "ResearchLogging of segments: groups of LogUnits that are sampled together"

main
Kurt Partridge 2012-11-30 09:28:22 -08:00 committed by Android (Google) Code Review
commit 2ae580eaea
1 changed files with 17 additions and 0 deletions

View File

@ -708,12 +708,29 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
} }
} }
private static final String[] EVENTKEYS_LOG_SEGMENT_START = {
"logSegmentStart", "isIncludingPrivateData"
};
private static final String[] EVENTKEYS_LOG_SEGMENT_END = {
"logSegmentEnd"
};
/* package for test */ void publishLogBuffer(final LogBuffer logBuffer, /* package for test */ void publishLogBuffer(final LogBuffer logBuffer,
final ResearchLog researchLog, final boolean isIncludingPrivateData) { final ResearchLog researchLog, final boolean isIncludingPrivateData) {
final LogUnit openingLogUnit = new LogUnit();
final Object[] values = {
isIncludingPrivateData
};
openingLogUnit.addLogStatement(EVENTKEYS_LOG_SEGMENT_START, values,
false /* isPotentiallyPrivate */);
researchLog.publish(openingLogUnit, true /* isIncludingPrivateData */);
LogUnit logUnit; LogUnit logUnit;
while ((logUnit = logBuffer.shiftOut()) != null) { while ((logUnit = logBuffer.shiftOut()) != null) {
researchLog.publish(logUnit, isIncludingPrivateData); researchLog.publish(logUnit, isIncludingPrivateData);
} }
final LogUnit closingLogUnit = new LogUnit();
closingLogUnit.addLogStatement(EVENTKEYS_LOG_SEGMENT_END, EVENTKEYS_NULLVALUES,
false /* isPotentiallyPrivate */);
researchLog.publish(closingLogUnit, true /* isIncludingPrivateData */);
} }
private boolean hasOnlyLetters(final String word) { private boolean hasOnlyLetters(final String word) {