aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/research/ResearchLogger.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/research/ResearchLogger.java')
-rw-r--r--java/src/com/android/inputmethod/research/ResearchLogger.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java
index 364ab2da2..45212913e 100644
--- a/java/src/com/android/inputmethod/research/ResearchLogger.java
+++ b/java/src/com/android/inputmethod/research/ResearchLogger.java
@@ -763,18 +763,26 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
if (isIncludingRecording) {
// Try to read recording from recently written json file
if (mUserRecordingFile != null) {
+ FileChannel channel = null;
try {
- final FileChannel channel =
- new FileInputStream(mUserRecordingFile).getChannel();
+ channel = new FileInputStream(mUserRecordingFile).getChannel();
final MappedByteBuffer buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0,
channel.size());
// Android's openFileOutput() creates the file, so we use Android's default
// Charset (UTF-8) here to read it.
recording = Charset.defaultCharset().decode(buffer).toString();
} catch (FileNotFoundException e) {
- e.printStackTrace();
+ Log.e(TAG, "Could not find recording file", e);
} catch (IOException e) {
- e.printStackTrace();
+ Log.e(TAG, "Error reading recording file", e);
+ } finally {
+ if (channel != null) {
+ try {
+ channel.close();
+ } catch (IOException e) {
+ Log.e(TAG, "Error closing recording file", e);
+ }
+ }
}
}
}
@@ -1395,7 +1403,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
*/
private static final LogStatement LOGSTATEMENT_LATINIME_PICKSUGGESTIONMANUALLY =
new LogStatement("LatinIMEPickSuggestionManually", true, false, "replacedWord", "index",
- "suggestion", "x", "y");
+ "suggestion", "x", "y", "isBatchMode");
public static void latinIME_pickSuggestionManually(final String replacedWord,
final int index, final String suggestion, final boolean isBatchMode) {
final ResearchLogger researchLogger = getInstance();
@@ -1408,7 +1416,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_PICKSUGGESTIONMANUALLY,
scrubDigitsFromString(replacedWord), index,
suggestion == null ? null : scrubbedWord, Constants.SUGGESTION_STRIP_COORDINATE,
- Constants.SUGGESTION_STRIP_COORDINATE);
+ Constants.SUGGESTION_STRIP_COORDINATE, isBatchMode);
researchLogger.commitCurrentLogUnitAsWord(scrubbedWord, Long.MAX_VALUE, isBatchMode);
researchLogger.mStatistics.recordManualSuggestion(SystemClock.uptimeMillis());
}