diff options
Diffstat (limited to 'java/src')
4 files changed, 50 insertions, 30 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java index e08536b43..203036998 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java @@ -1086,6 +1086,9 @@ public final class KeyboardTextsSet { /* 101 */ null, // U+00BF: "¿" INVERTED QUESTION MARK /* 102 */ "?,\u00BF", + /* 103 */ "\"", + /* 104 */ "\'", + /* 105 */ "\'", }; /* Language et: Estonian */ diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java index bed31a7d1..5eab292fc 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java @@ -160,6 +160,9 @@ public final class BinaryDictionaryFileDumper { for (int mode = MODE_MIN; mode <= MODE_MAX; ++mode) { InputStream originalSourceStream = null; InputStream inputStream = null; + InputStream uncompressedStream = null; + InputStream decryptedStream = null; + BufferedInputStream bufferedStream = null; File outputFile = null; FileOutputStream outputStream = null; AssetFileDescriptor afd = null; @@ -179,18 +182,19 @@ public final class BinaryDictionaryFileDumper { // Get the appropriate decryption method for this try switch (mode) { case COMPRESSED_CRYPTED_COMPRESSED: - inputStream = FileTransforms.getUncompressedStream( - FileTransforms.getDecryptedStream( - FileTransforms.getUncompressedStream( - originalSourceStream))); + uncompressedStream = + FileTransforms.getUncompressedStream(originalSourceStream); + decryptedStream = FileTransforms.getDecryptedStream(uncompressedStream); + inputStream = FileTransforms.getUncompressedStream(decryptedStream); break; case CRYPTED_COMPRESSED: - inputStream = FileTransforms.getUncompressedStream( - FileTransforms.getDecryptedStream(originalSourceStream)); + decryptedStream = FileTransforms.getDecryptedStream(originalSourceStream); + inputStream = FileTransforms.getUncompressedStream(decryptedStream); break; case COMPRESSED_CRYPTED: - inputStream = FileTransforms.getDecryptedStream( - FileTransforms.getUncompressedStream(originalSourceStream)); + uncompressedStream = + FileTransforms.getUncompressedStream(originalSourceStream); + inputStream = FileTransforms.getDecryptedStream(uncompressedStream); break; case COMPRESSED_ONLY: inputStream = FileTransforms.getUncompressedStream(originalSourceStream); @@ -201,8 +205,9 @@ public final class BinaryDictionaryFileDumper { case NONE: inputStream = originalSourceStream; break; - } - checkMagicAndCopyFileTo(new BufferedInputStream(inputStream), outputStream); + } + bufferedStream = new BufferedInputStream(inputStream); + checkMagicAndCopyFileTo(bufferedStream, outputStream); outputStream.flush(); outputStream.close(); final File finalFile = new File(finalFileName); @@ -234,8 +239,11 @@ public final class BinaryDictionaryFileDumper { try { // inputStream.close() will close afd, we should not call afd.close(). if (null != inputStream) inputStream.close(); + if (null != uncompressedStream) uncompressedStream.close(); + if (null != decryptedStream) decryptedStream.close(); + if (null != bufferedStream) bufferedStream.close(); } catch (Exception e) { - Log.e(TAG, "Exception while closing a cross-process file descriptor : " + e); + Log.e(TAG, "Exception while closing a file descriptor : " + e); } try { if (null != outputStream) outputStream.close(); diff --git a/java/src/com/android/inputmethod/latin/DebugSettings.java b/java/src/com/android/inputmethod/latin/DebugSettings.java index 3af3cab2c..731b9baf5 100644 --- a/java/src/com/android/inputmethod/latin/DebugSettings.java +++ b/java/src/com/android/inputmethod/latin/DebugSettings.java @@ -37,6 +37,8 @@ public final class DebugSettings extends PreferenceFragment private static final String DEBUG_MODE_KEY = "debug_mode"; public static final String FORCE_NON_DISTINCT_MULTITOUCH_KEY = "force_non_distinct_multitouch"; public static final String PREF_USABILITY_STUDY_MODE = "usability_study_mode"; + private static final String PREF_STATISTICS_LOGGING_KEY = "enable_logging"; + private static final boolean SHOW_STATISTICS_LOGGING = false; private boolean mServiceNeedsRestart = false; private CheckBoxPreference mDebugMode; @@ -55,6 +57,12 @@ public final class DebugSettings extends PreferenceFragment ResearchLogger.DEFAULT_USABILITY_STUDY_MODE)); checkbox.setSummary(R.string.settings_warning_researcher_mode); } + final Preference statisticsLoggingPref = findPreference(PREF_STATISTICS_LOGGING_KEY); + if (statisticsLoggingPref instanceof CheckBoxPreference) { + if (!SHOW_STATISTICS_LOGGING) { + getPreferenceScreen().removePreference(statisticsLoggingPref); + } + } mServiceNeedsRestart = false; mDebugMode = (CheckBoxPreference) findPreference(DEBUG_MODE_KEY); diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 0711a2386..5f7907326 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -736,21 +736,17 @@ public final class LatinIME extends InputMethodService implements KeyboardAction updateFullscreenMode(); mApplicationSpecifiedCompletions = null; - if (isDifferentTextField || selectionChanged) { - // If the selection changed, we reset the input state. Essentially, we come here with - // restarting == true when the app called setText() or similar. We should reset the - // state if the app set the text to something else, but keep it if it set a suggestion - // or something. - mEnteredText = null; - resetComposingState(true /* alsoResetLastComposedWord */); - mDeleteCount = 0; - mSpaceState = SPACE_STATE_NONE; + // The app calling setText() has the effect of clearing the composing + // span, so we should reset our state unconditionally, even if restarting is true. + mEnteredText = null; + resetComposingState(true /* alsoResetLastComposedWord */); + mDeleteCount = 0; + mSpaceState = SPACE_STATE_NONE; - if (mSuggestionStripView != null) { - // This will set the punctuation suggestions if next word suggestion is off; - // otherwise it will clear the suggestion strip. - setPunctuationSuggestions(); - } + if (mSuggestionStripView != null) { + // This will set the punctuation suggestions if next word suggestion is off; + // otherwise it will clear the suggestion strip. + setPunctuationSuggestions(); } mConnection.resetCachesUponCursorMove(editorInfo.initialSelStart); @@ -1423,7 +1419,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mHandler.postUpdateSuggestionStrip(); final String text = specificTldProcessingOnTextInput(rawText); if (SPACE_STATE_PHANTOM == mSpaceState) { - sendKeyCodePoint(Constants.CODE_SPACE); + promotePhantomSpace(); } mConnection.commitText(text, 1); mConnection.endBatchEdit(); @@ -1586,7 +1582,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mWordComposer.setBatchInputWord(batchInputText); mConnection.beginBatchEdit(); if (SPACE_STATE_PHANTOM == mSpaceState) { - sendKeyCodePoint(Constants.CODE_SPACE); + promotePhantomSpace(); } mConnection.setComposingText(batchInputText, 1); mExpectingUpdateSelection = true; @@ -1741,7 +1737,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // Sanity check throw new RuntimeException("Should not be composing here"); } - sendKeyCodePoint(Constants.CODE_SPACE); + promotePhantomSpace(); } // NOTE: isCursorTouchingWord() is a blocking IPC call, so it often takes several @@ -1818,7 +1814,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction if (SPACE_STATE_PHANTOM == spaceState && mCurrentSettings.isPhantomSpacePromotingSymbol(primaryCode)) { - sendKeyCodePoint(Constants.CODE_SPACE); + promotePhantomSpace(); } sendKeyCodePoint(primaryCode); @@ -2082,7 +2078,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction int firstChar = Character.codePointAt(suggestion, 0); if ((!mCurrentSettings.isWeakSpaceStripper(firstChar)) && (!mCurrentSettings.isWeakSpaceSwapper(firstChar))) { - sendKeyCodePoint(Constants.CODE_SPACE); + promotePhantomSpace(); } } @@ -2259,6 +2255,11 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mHandler.postUpdateSuggestionStrip(); } + // This essentially inserts a space, and that's it. + public void promotePhantomSpace() { + sendKeyCodePoint(Constants.CODE_SPACE); + } + // Used by the RingCharBuffer public boolean isWordSeparator(final int code) { return mCurrentSettings.isWordSeparator(code); |