Uncommit separator LogUnits

Now that separators have their own LogUnits, they must be uncommitted
from the LogBuffer when backspacing over them.

Bug: 9088919

Change-Id: Ib36cc94939b93abe18850a06bced17caf8aaa5b9
main
Kurt Partridge 2013-05-31 22:03:04 -07:00
parent a0c3e02d71
commit bdff287a0d
2 changed files with 19 additions and 8 deletions

View File

@ -1797,8 +1797,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
final String word = mWordComposer.getTypedWord(); final String word = mWordComposer.getTypedWord();
ResearchLogger.latinIME_handleBackspace_batch(word, 1); ResearchLogger.latinIME_handleBackspace_batch(word, 1);
ResearchLogger.getInstance().uncommitCurrentLogUnit(
word, false /* dumpCurrentLogUnit */);
} }
final String rejectedSuggestion = mWordComposer.getTypedWord(); final String rejectedSuggestion = mWordComposer.getTypedWord();
mWordComposer.reset(); mWordComposer.reset();
@ -1858,7 +1856,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mLastSelectionEnd = mLastSelectionStart; mLastSelectionEnd = mLastSelectionStart;
mConnection.deleteSurroundingText(numCharsDeleted, 0); mConnection.deleteSurroundingText(numCharsDeleted, 0);
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_handleBackspace(numCharsDeleted); ResearchLogger.latinIME_handleBackspace(numCharsDeleted,
false /* shouldUncommitLogUnit */);
} }
} else { } else {
// There is no selection, just delete one character. // There is no selection, just delete one character.
@ -1876,12 +1875,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mConnection.deleteSurroundingText(1, 0); mConnection.deleteSurroundingText(1, 0);
} }
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_handleBackspace(1); ResearchLogger.latinIME_handleBackspace(1, true /* shouldUncommitLogUnit */);
} }
if (mDeleteCount > DELETE_ACCELERATE_AT) { if (mDeleteCount > DELETE_ACCELERATE_AT) {
mConnection.deleteSurroundingText(1, 0); mConnection.deleteSurroundingText(1, 0);
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_handleBackspace(1); ResearchLogger.latinIME_handleBackspace(1,
true /* shouldUncommitLogUnit */);
} }
} }
} }

View File

@ -1806,17 +1806,26 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
SystemClock.uptimeMillis()); SystemClock.uptimeMillis());
} }
private static final LogStatement LOGSTATEMENT_LATINIME_HANDLEBACKSPACE =
new LogStatement("LatinIMEHandleBackspace", true, false, "numCharacters");
/** /**
* Log a call to LatinIME.handleBackspace() that is not a batch delete. * Log a call to LatinIME.handleBackspace() that is not a batch delete.
* *
* UserInput: The user is deleting one or more characters by hitting the backspace key once. * UserInput: The user is deleting one or more characters by hitting the backspace key once.
* The covers single character deletes as well as deleting selections. * The covers single character deletes as well as deleting selections.
*
* @param numCharacters how many characters the backspace operation deleted
* @param shouldUncommitLogUnit whether to uncommit the last {@code LogUnit} in the
* {@code LogBuffer}
*/ */
private static final LogStatement LOGSTATEMENT_LATINIME_HANDLEBACKSPACE = public static void latinIME_handleBackspace(final int numCharacters,
new LogStatement("LatinIMEHandleBackspace", true, false, "numCharacters"); final boolean shouldUncommitLogUnit) {
public static void latinIME_handleBackspace(final int numCharacters) {
final ResearchLogger researchLogger = getInstance(); final ResearchLogger researchLogger = getInstance();
researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_HANDLEBACKSPACE, numCharacters); researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_HANDLEBACKSPACE, numCharacters);
if (shouldUncommitLogUnit) {
ResearchLogger.getInstance().uncommitCurrentLogUnit(
null, true /* dumpCurrentLogUnit */);
}
} }
/** /**
@ -1834,6 +1843,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
numCharacters); numCharacters);
researchLogger.mStatistics.recordGestureDelete(deletedText.length(), researchLogger.mStatistics.recordGestureDelete(deletedText.length(),
SystemClock.uptimeMillis()); SystemClock.uptimeMillis());
researchLogger.uncommitCurrentLogUnit(deletedText.toString(),
false /* dumpCurrentLogUnit */);
} }
/** /**