diff options
-rw-r--r-- | java/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | java/res/drawable/btn_center.xml | 5 | ||||
-rw-r--r-- | java/res/values/strings.xml | 2 | ||||
-rw-r--r-- | java/res/xml/method.xml | 187 | ||||
-rw-r--r-- | java/res/xml/prefs.xml | 7 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/compat/InputMethodSubtype.java | 157 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/KeyboardId.java | 2 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/BinaryDictionary.java | 4 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 28 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/Settings.java | 4 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/SubtypeSwitcher.java | 34 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/Utils.java | 5 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/voice/VoiceIMEConnector.java | 24 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/voice/VoiceInputLogger.java | 8 | ||||
-rw-r--r-- | native/Android.mk | 8 | ||||
-rw-r--r-- | tests/Android.mk | 4 |
16 files changed, 224 insertions, 257 deletions
diff --git a/java/AndroidManifest.xml b/java/AndroidManifest.xml index e0eecfc7d..cc4c74441 100644 --- a/java/AndroidManifest.xml +++ b/java/AndroidManifest.xml @@ -1,6 +1,8 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.inputmethod.latin"> + <original-package android:name="com.android.inputmethod.latin" /> + <uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.READ_USER_DICTIONARY" /> diff --git a/java/res/drawable/btn_center.xml b/java/res/drawable/btn_center.xml index 9998b56e2..19b298f75 100644 --- a/java/res/drawable/btn_center.xml +++ b/java/res/drawable/btn_center.xml @@ -19,8 +19,7 @@ --> <selector - xmlns:android="http://schemas.android.com/apk/res/android" - android:exitFadeDuration="@android:integer/config_mediumAnimTime"> + xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_window_focused="false" android:state_enabled="true" @@ -37,4 +36,4 @@ android:drawable="@drawable/btn_center_default" /> <item android:drawable="@drawable/btn_center_default" /> -</selector>
\ No newline at end of file +</selector> diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index f63d6816c..72601c37f 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -31,7 +31,7 @@ <!-- Option to play back sound on keypress in soft keyboard --> <string name="sound_on_keypress">Sound on keypress</string> - <!-- Option to control whether or not to show a popup with a larger font on each key press. --> + <!-- Option to pop up the character with a larger font above soft keyboard --> <string name="popup_on_keypress">Popup on keypress</string> <!-- Category title for general settings for Android keyboard --> diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index b1f737903..3167ae8a8 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -20,190 +20,7 @@ <!-- The attributes in this XML file provide configuration information --> <!-- for the Input Method Manager. --> -<!-- Keyboard: en_US, en_GB, cs, da, de, es, es_US, fr, fr_CA, fr_CH, it, nb, nl, sr, sv --> -<!-- Voice: af, cs, da, de, en, es, fr, it, ja, ko, nl, pl, pt, ru, tr, yue, zh, zu --> -<!-- TODO: use <lang>_keyboard icon instead of a common keyboard icon. --> -<!-- TODO: use <lang>_mic icon instead of a common mic icon. --> -<!-- If IME doesn't have an applicable subtype, the first subtype will be used as a default - subtype.--> <input-method xmlns:android="http://schemas.android.com/apk/res/android" android:settingsActivity="com.android.inputmethod.latin.Settings" - android:isDefault="@bool/im_is_default"> - <subtype android:icon="@drawable/ic_subtype_keyboard" - android:label="@string/subtype_mode_en_US_keyboard" - android:imeSubtypeLocale="en_US" - android:imeSubtypeMode="keyboard" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_en_voice" - android:imeSubtypeLocale="en" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_keyboard" - android:label="@string/subtype_mode_en_GB_keyboard" - android:imeSubtypeLocale="en_GB" - android:imeSubtypeMode="keyboard" - /> - <subtype android:icon="@drawable/ic_subtype_keyboard" - android:label="@string/subtype_mode_cs_keyboard" - android:imeSubtypeLocale="cs" - android:imeSubtypeMode="keyboard" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_cs_voice" - android:imeSubtypeLocale="cs" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_keyboard" - android:label="@string/subtype_mode_da_keyboard" - android:imeSubtypeLocale="da" - android:imeSubtypeMode="keyboard" - /> - <subtype android:icon="@drawable/ic_subtype_keyboard" - android:label="@string/subtype_mode_de_keyboard" - android:imeSubtypeLocale="de" - android:imeSubtypeMode="keyboard" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_de_voice" - android:imeSubtypeLocale="de" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_keyboard" - android:label="@string/subtype_mode_es_keyboard" - android:imeSubtypeLocale="es" - android:imeSubtypeMode="keyboard" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_es_voice" - android:imeSubtypeLocale="es" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_keyboard" - android:label="@string/subtype_mode_fr_keyboard" - android:imeSubtypeLocale="fr" - android:imeSubtypeMode="keyboard" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_fr_voice" - android:imeSubtypeLocale="fr" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_keyboard" - android:label="@string/subtype_mode_fr_CA_keyboard" - android:imeSubtypeLocale="fr_CA" - android:imeSubtypeMode="keyboard" - /> - <subtype android:icon="@drawable/ic_subtype_keyboard" - android:label="@string/subtype_mode_fr_CH_keyboard" - android:imeSubtypeLocale="fr_CH" - android:imeSubtypeMode="keyboard" - /> - <subtype android:icon="@drawable/ic_subtype_keyboard" - android:label="@string/subtype_mode_it_keyboard" - android:imeSubtypeLocale="it" - android:imeSubtypeMode="keyboard" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_it_voice" - android:imeSubtypeLocale="it" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_keyboard" - android:label="@string/subtype_mode_nb_keyboard" - android:imeSubtypeLocale="nb" - android:imeSubtypeMode="keyboard" - /> - <subtype android:icon="@drawable/ic_subtype_keyboard" - android:label="@string/subtype_mode_nl_keyboard" - android:imeSubtypeLocale="nl" - android:imeSubtypeMode="keyboard" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_nl_voice" - android:imeSubtypeLocale="nl" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_keyboard" - android:label="@string/subtype_mode_ru_keyboard" - android:imeSubtypeLocale="ru" - android:imeSubtypeMode="keyboard" - /> - <subtype android:icon="@drawable/ic_subtype_keyboard" - android:label="@string/subtype_mode_sr_keyboard" - android:imeSubtypeLocale="sr" - android:imeSubtypeMode="keyboard" - /> - <subtype android:icon="@drawable/ic_subtype_keyboard" - android:label="@string/subtype_mode_sv_keyboard" - android:imeSubtypeLocale="sv" - android:imeSubtypeMode="keyboard" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_af_voice" - android:imeSubtypeLocale="af" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_ja_voice" - android:imeSubtypeLocale="ja" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_ko_voice" - android:imeSubtypeLocale="ko" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_pl_voice" - android:imeSubtypeLocale="pl" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_pt_voice" - android:imeSubtypeLocale="pt" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_ru_voice" - android:imeSubtypeLocale="ru" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_tr_voice" - android:imeSubtypeLocale="tr" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_yue_voice" - android:imeSubtypeLocale="yue" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_zh_voice" - android:imeSubtypeLocale="zh" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> - <subtype android:icon="@drawable/ic_subtype_mic" - android:label="@string/subtype_mode_zu_voice" - android:imeSubtypeLocale="zu" - android:imeSubtypeMode="voice" - android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" - /> -</input-method> + android:isDefault="@bool/im_is_default" +/> diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index d031415d7..06fa02303 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -130,4 +130,11 @@ android:defaultValue="false" /> + <CheckBoxPreference + android:key="debug_mode" + android:title="Debug Mode" + android:persistent="true" + android:defaultValue="false" + /> + </PreferenceScreen> diff --git a/java/src/com/android/inputmethod/compat/InputMethodSubtype.java b/java/src/com/android/inputmethod/compat/InputMethodSubtype.java new file mode 100644 index 000000000..6630dbe75 --- /dev/null +++ b/java/src/com/android/inputmethod/compat/InputMethodSubtype.java @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Note: This class has been copied from Honeycomb framework. +// Original class in Honeycomb framework is {@link android.view.inputmethod.InputMethodSubtype}. + +package com.android.inputmethod.compat; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.util.Arrays; + +/** + * Information given to an {@link InputMethod} about a client connecting + * to it. + */ +/** + * InputMethodSubtype is a subtype contained in the input method. Subtype can describe + * locales (e.g. en_US, fr_FR...) and modes (e.g. voice, keyboard...), and is used for + * IME switch. The subtype allows the system to call the specified subtype of IME directly. + */ +public final class InputMethodSubtype implements Parcelable { + private final int mSubtypeNameResId; + private final int mSubtypeIconResId; + private final String mSubtypeLocale; + private final String mSubtypeMode; + private final String mSubtypeExtraValue; + private final int mSubtypeHashCode; + + /** + * Constructor + * @param nameId The name of the subtype + * @param iconId The icon of the subtype + * @param locale The locale supported by the subtype + * @param modeId The mode supported by the subtype + * @param extraValue The extra value of the subtype + */ + InputMethodSubtype(int nameId, int iconId, String locale, String mode, String extraValue) { + mSubtypeNameResId = nameId; + mSubtypeIconResId = iconId; + mSubtypeLocale = locale != null ? locale : ""; + mSubtypeMode = mode != null ? mode : ""; + mSubtypeExtraValue = extraValue != null ? extraValue : ""; + mSubtypeHashCode = hashCodeInternal(mSubtypeNameResId, mSubtypeIconResId, mSubtypeLocale, + mSubtypeMode, mSubtypeExtraValue); + } + + InputMethodSubtype(Parcel source) { + String s; + mSubtypeNameResId = source.readInt(); + mSubtypeIconResId = source.readInt(); + s = source.readString(); + mSubtypeLocale = s != null ? s : ""; + s = source.readString(); + mSubtypeMode = s != null ? s : ""; + s = source.readString(); + mSubtypeExtraValue = s != null ? s : ""; + mSubtypeHashCode = hashCodeInternal(mSubtypeNameResId, mSubtypeIconResId, mSubtypeLocale, + mSubtypeMode, mSubtypeExtraValue); + } + + /** + * @return the name of the subtype + */ + public int getNameResId() { + return mSubtypeNameResId; + } + + /** + * @return the icon of the subtype + */ + public int getIconResId() { + return mSubtypeIconResId; + } + + /** + * @return the locale of the subtype + */ + public String getLocale() { + return mSubtypeLocale; + } + + /** + * @return the mode of the subtype + */ + public String getMode() { + return mSubtypeMode; + } + + /** + * @return the extra value of the subtype + */ + public String getExtraValue() { + return mSubtypeExtraValue; + } + + @Override + public int hashCode() { + return mSubtypeHashCode; + } + + @Override + public boolean equals(Object o) { + if (o instanceof InputMethodSubtype) { + InputMethodSubtype subtype = (InputMethodSubtype) o; + return (subtype.hashCode() == hashCode()) + && (subtype.getNameResId() == getNameResId()) + && (subtype.getMode().equals(getMode())) + && (subtype.getIconResId() == getIconResId()) + && (subtype.getLocale().equals(getLocale())) + && (subtype.getExtraValue().equals(getExtraValue())); + } + return false; + } + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel dest, int parcelableFlags) { + dest.writeInt(mSubtypeNameResId); + dest.writeInt(mSubtypeIconResId); + dest.writeString(mSubtypeLocale); + dest.writeString(mSubtypeMode); + dest.writeString(mSubtypeExtraValue); + } + + public static final Parcelable.Creator<InputMethodSubtype> CREATOR + = new Parcelable.Creator<InputMethodSubtype>() { + public InputMethodSubtype createFromParcel(Parcel source) { + return new InputMethodSubtype(source); + } + + public InputMethodSubtype[] newArray(int size) { + return new InputMethodSubtype[size]; + } + }; + + private static int hashCodeInternal(int nameResId, int iconResId, String locale, + String mode, String extraValue) { + return Arrays.hashCode(new Object[] {nameResId, iconResId, locale, mode, extraValue}); + } +} diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java index db86740c3..8c70d8ffe 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java @@ -171,7 +171,7 @@ public class KeyboardId { case EditorInfo.IME_ACTION_SEARCH: action = "actionSearch"; break; case EditorInfo.IME_ACTION_SEND: action = "actionSend"; break; case EditorInfo.IME_ACTION_DONE: action = "actionDone"; break; - case EditorInfo.IME_ACTION_PREVIOUS: action = "actionPrevious"; break; + // @@@ case EditorInfo.IME_ACTION_PREVIOUS: action = "actionPrevious"; break; default: action = "actionUnknown(" + actionNo + ")"; break; } if ((imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) { diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java index a7e95a080..d87672c0e 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java @@ -55,9 +55,9 @@ public class BinaryDictionary extends Dictionary { static { try { - System.loadLibrary("jni_latinime"); + System.loadLibrary("jni_latinime2"); } catch (UnsatisfiedLinkError ule) { - Log.e(TAG, "Could not load native library jni_latinime"); + Log.e(TAG, "Could not load native library jni_latinime"); } } diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 67a9f3203..a55ee5246 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -16,6 +16,7 @@ package com.android.inputmethod.latin; +import com.android.inputmethod.compat.InputMethodSubtype; import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.KeyboardActionListener; import com.android.inputmethod.keyboard.KeyboardId; @@ -61,13 +62,13 @@ import android.view.ViewParent; import android.view.Window; import android.view.WindowManager; import android.view.inputmethod.CompletionInfo; -import android.view.inputmethod.CorrectionInfo; +// @@@ import android.view.inputmethod.CorrectionInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.ExtractedText; import android.view.inputmethod.ExtractedTextRequest; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; -import android.view.inputmethod.InputMethodSubtype; +// @@@ import android.view.inputmethod.InputMethodSubtype; import android.widget.FrameLayout; import android.widget.HorizontalScrollView; import android.widget.LinearLayout; @@ -488,7 +489,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (container.getPaddingRight() != 0) { HorizontalScrollView scrollView = (HorizontalScrollView) container.findViewById(R.id.candidates_scroll_view); - scrollView.setOverScrollMode(View.OVER_SCROLL_NEVER); + // @@@ scrollView.setOverScrollMode(View.OVER_SCROLL_NEVER); container.setGravity(Gravity.CENTER_HORIZONTAL); } mCandidateView = (CandidateView) container.findViewById(R.id.candidates); @@ -499,13 +500,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen private static boolean isPasswordVariation(int variation) { return variation == InputType.TYPE_TEXT_VARIATION_PASSWORD - || variation == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD - || variation == InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD; + || variation == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; + // @@@ || variation == InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD; } private static boolean isEmailVariation(int variation) { - return variation == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS - || variation == InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS; + return variation == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; + // @@@ || variation == InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS; } @Override @@ -1251,8 +1252,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen private void handleTab() { final int imeOptions = getCurrentInputEditorInfo().imeOptions; - final int navigationFlags = - EditorInfo.IME_FLAG_NAVIGATE_NEXT | EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS; + final int navigationFlags = 0; + // @@@ final int navigationFlags = + // @@@ EditorInfo.IME_FLAG_NAVIGATE_NEXT | EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS; if ((imeOptions & navigationFlags) == 0) { sendDownUpKeyEvents(KeyEvent.KEYCODE_TAB); return; @@ -1262,6 +1264,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (ic == null) return; + /* @@@ // True if keyboard is in either chording shift or manual temporary upper case mode. final boolean isManualTemporaryUpperCase = mKeyboardSwitcher.isManualTemporaryUpperCase(); if ((imeOptions & EditorInfo.IME_FLAG_NAVIGATE_NEXT) != 0 @@ -1271,6 +1274,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen && isManualTemporaryUpperCase) { ic.performEditorAction(EditorInfo.IME_ACTION_PREVIOUS); } + */ } private void abortCorrection(boolean force) { @@ -1397,9 +1401,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen TextEntryState.backToAcceptedDefault(typedWord); if (!TextUtils.isEmpty(typedWord) && !typedWord.equals(mBestWord)) { if (ic != null) { + /* @@@ CorrectionInfo correctionInfo = new CorrectionInfo( mLastSelectionEnd - typedWord.length(), typedWord, mBestWord); ic.commitCorrection(correctionInfo); + */ } if (mCandidateView != null) mCandidateView.onAutoCorrectionInverted(mBestWord); @@ -2119,7 +2125,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // Get the settings preferences final SharedPreferences prefs = mPrefs; Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); - mVibrateOn = vibrator != null && vibrator.hasVibrator() + // @@@ mVibrateOn = vibrator != null && vibrator.hasVibrator() + mVibrateOn = vibrator != null && prefs.getBoolean(Settings.PREF_VIBRATE_ON, false); mSoundOn = prefs.getBoolean(Settings.PREF_SOUND_ON, mResources.getBoolean(R.bool.config_default_sound_enabled)); @@ -2341,7 +2348,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen System.out.println("CPS = " + ((CPS_BUFFER_SIZE * 1000f) / total)); } - @Override public void onCurrentInputMethodSubtypeChanged(InputMethodSubtype subtype) { SubtypeSwitcher.getInstance().updateSubtype(subtype); } diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java index 341d5add0..59c68f208 100644 --- a/java/src/com/android/inputmethod/latin/Settings.java +++ b/java/src/com/android/inputmethod/latin/Settings.java @@ -135,7 +135,9 @@ public class Settings extends PreferenceActivity } Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); - if (vibrator == null || !vibrator.hasVibrator()) { + if (vibrator == null + // @@@ || !vibrator.hasVibrator() + ) { generalSettings.removePreference(findPreference(PREF_VIBRATE_ON)); } diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java index d8c89a0d4..f45c2b7f8 100644 --- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java +++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java @@ -16,6 +16,7 @@ package com.android.inputmethod.latin; +import com.android.inputmethod.compat.InputMethodSubtype; import com.android.inputmethod.keyboard.KeyboardSwitcher; import com.android.inputmethod.keyboard.LatinKeyboard; import com.android.inputmethod.keyboard.LatinKeyboardView; @@ -37,7 +38,6 @@ import android.text.TextUtils; import android.util.Log; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodManager; -import android.view.inputmethod.InputMethodSubtype; import java.util.ArrayList; import java.util.Arrays; @@ -129,7 +129,7 @@ public class SubtypeSwitcher { // Only configuration changed event is allowed to call this because this is heavy. private void updateAllParameters() { mSystemLocale = mResources.getConfiguration().locale; - updateSubtype(mImm.getCurrentInputMethodSubtype()); + // @@@ updateSubtype(mImm.getCurrentInputMethodSubtype()); updateParametersOnStartInputView(); } @@ -147,8 +147,8 @@ public class SubtypeSwitcher { // Reload enabledSubtypes from the framework. private void updateEnabledSubtypes() { boolean foundCurrentSubtypeBecameDisabled = true; - mAllEnabledSubtypesOfCurrentInputMethod = mImm.getEnabledInputMethodSubtypeList( - null, true); + // @@@ mAllEnabledSubtypesOfCurrentInputMethod = mImm.getEnabledInputMethodSubtypeList( + // null, true); mEnabledLanguagesOfCurrentInputMethod.clear(); mEnabledKeyboardSubtypesOfCurrentInputMethod.clear(); for (InputMethodSubtype ims: mAllEnabledSubtypesOfCurrentInputMethod) { @@ -172,7 +172,7 @@ public class SubtypeSwitcher { Log.w(TAG, "Current subtype: " + mInputLocaleStr + ", " + mMode); Log.w(TAG, "Last subtype was disabled. Update to the current one."); } - updateSubtype(mImm.getCurrentInputMethodSubtype()); + // @@@ updateSubtype(mImm.getCurrentInputMethodSubtype()); } } @@ -185,6 +185,7 @@ public class SubtypeSwitcher { + ", " + mShortcutSubtype.getMode()))); } // TODO: Update an icon for shortcut IME + /* Map<InputMethodInfo, List<InputMethodSubtype>> shortcuts = mImm.getShortcutInputMethodsAndSubtypes(); for (InputMethodInfo imi: shortcuts.keySet()) { @@ -196,14 +197,8 @@ public class SubtypeSwitcher { // as appropriate. mShortcutSubtype = subtypes.size() > 0 ? subtypes.get(0) : null; break; - } - if (DBG) { - Log.d(TAG, "Update shortcut IME to : " - + (mShortcutInputMethodInfo == null - ? "<null>" : mShortcutInputMethodInfo.getId()) + ", " - + (mShortcutSubtype == null ? "<null>" : (mShortcutSubtype.getLocale() - + ", " + mShortcutSubtype.getMode()))); - } + } + */ } // Update the current subtype. LatinIME.onCurrentInputMethodSubtypeChanged calls this function. @@ -308,14 +303,7 @@ public class SubtypeSwitcher { if (token == null || mShortcutInputMethodInfo == null) { return; } - final String imiId = mShortcutInputMethodInfo.getId(); - final InputMethodSubtype subtype = mShortcutSubtype; - new Thread("SwitchToShortcutIME") { - @Override - public void run() { - mImm.setInputMethodAndSubtype(token, imiId, subtype); - } - }.start(); + // @@@ mImm.setInputMethodAndSubtype(token, mShortcutInfo.getId(), mShortcutSubtype); } public Drawable getShortcutIcon() { @@ -323,6 +311,7 @@ public class SubtypeSwitcher { } private Drawable getSubtypeIcon(InputMethodInfo imi, InputMethodSubtype subtype) { + /* final PackageManager pm = mService.getPackageManager(); if (imi != null) { final String imiPackageName = imi.getPackageName(); @@ -344,7 +333,8 @@ public class SubtypeSwitcher { Log.w(TAG, "IME can't be found: " + imiPackageName); } } - } + } + */ return null; } diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java index e980d3a30..d33d962c0 100644 --- a/java/src/com/android/inputmethod/latin/Utils.java +++ b/java/src/com/android/inputmethod/latin/Utils.java @@ -93,10 +93,11 @@ public class Utils { } public static boolean hasMultipleEnabledIMEsOrSubtypes(InputMethodManager imm) { - return imm.getEnabledInputMethodList().size() > 1 + return imm.getEnabledInputMethodList().size() > 1; + // @@@ return imm.getEnabledInputMethodList().size() > 1 // imm.getEnabledInputMethodSubtypeList(null, false) will return the current IME's enabled // input method subtype (The current IME should be LatinIME.) - || imm.getEnabledInputMethodSubtypeList(null, false).size() > 1; + // || imm.getEnabledInputMethodSubtypeList(null, false).size() > 1; } public static String getInputMethodId(InputMethodManager imm, String packageName) { diff --git a/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java b/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java index 277ef7e65..267bef21d 100644 --- a/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java +++ b/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java @@ -554,26 +554,10 @@ public class VoiceIMEConnector implements VoiceInput.UiListener { } private void switchToLastInputMethod() { - final IBinder token = mService.getWindow().getWindow().getAttributes().token; - new AsyncTask<Void, Void, Boolean>() { - @Override - protected Boolean doInBackground(Void... params) { - return mImm.switchToLastInputMethod(token); - } - - @Override - protected void onPostExecute(Boolean result) { - if (!result) { - if (DEBUG) { - Log.d(TAG, "Couldn't switch back to last IME."); - } - // Needs to reset here because LatinIME failed to back to any IME and - // the same voice subtype will be triggered in the next time. - mVoiceInput.reset(); - mService.requestHideSelf(0); - } - } - }.execute(); + /* @@@ + IBinder token = mContext.getWindow().getWindow().getAttributes().token; + mImm.switchToLastInputMethod(token); + */ } private void reallyStartListening(boolean swipe) { diff --git a/java/src/com/android/inputmethod/voice/VoiceInputLogger.java b/java/src/com/android/inputmethod/voice/VoiceInputLogger.java index 3e65434a2..1cea681f8 100644 --- a/java/src/com/android/inputmethod/voice/VoiceInputLogger.java +++ b/java/src/com/android/inputmethod/voice/VoiceInputLogger.java @@ -212,13 +212,13 @@ public class VoiceInputLogger { setHasLoggingInfo(true); Intent i = newLoggingBroadcast(LoggingEvents.VoiceIme.TEXT_MODIFIED); i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_LENGTH, suggestionLength); - i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_REPLACED_LENGTH, replacedPhraseLength); + i.putExtra("rlength", replacedPhraseLength); i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_TYPE, LoggingEvents.VoiceIme.TEXT_MODIFIED_TYPE_CHOOSE_SUGGESTION); i.putExtra(LoggingEvents.VoiceIme.EXTRA_N_BEST_CHOOSE_INDEX, index); - i.putExtra(LoggingEvents.VoiceIme.EXTRA_BEFORE_N_BEST_CHOOSE, before); - i.putExtra(LoggingEvents.VoiceIme.EXTRA_AFTER_N_BEST_CHOOSE, after); + i.putExtra("before", before); + i.putExtra("after", after); mContext.sendBroadcast(i); } @@ -257,7 +257,7 @@ public class VoiceInputLogger { // 2. type subject in subject field // 3. speak message in message field // 4. press send - UserHappinessSignals.setHasVoiceLoggingInfo(hasLoggingInfo); + // @@@ UserHappinessSignals.setHasVoiceLoggingInfo(hasLoggingInfo); } private boolean hasLoggingInfo(){ diff --git a/native/Android.mk b/native/Android.mk index a8fe06d50..2a570356f 100644 --- a/native/Android.mk +++ b/native/Android.mk @@ -1,7 +1,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_C_INCLUDES += $(LOCAL_PATH)/src +LOCAL_C_INCLUDES += $(LOCAL_PATH)/src $(JNI_H_INCLUDE) LOCAL_SRC_FILES := \ jni/com_android_inputmethod_latin_BinaryDictionary.cpp \ @@ -27,9 +27,11 @@ ifeq ($(TARGETING_UNBUNDLED_FROYO), true) LOCAL_SDK_VERSION := 8 endif -LOCAL_MODULE := libjni_latinime +LOCAL_PRELINK_MODULE := false -LOCAL_MODULE_TAGS := user +LOCAL_MODULE := libjni_latinime2 + +LOCAL_MODULE_TAGS := optional ifeq ($(FLAG_DBG), true) $(warning Making debug version of native library) diff --git a/tests/Android.mk b/tests/Android.mk index fba7a8d74..60e82d5c2 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -10,8 +10,8 @@ LOCAL_JAVA_LIBRARIES := android.test.runner # Include all test java files. LOCAL_SRC_FILES := $(call all-java-files-under, src) -LOCAL_PACKAGE_NAME := LatinIMETests +LOCAL_PACKAGE_NAME := LatinIME2Tests -LOCAL_INSTRUMENTATION_FOR := LatinIME +LOCAL_INSTRUMENTATION_FOR := LatinIme2Google include $(BUILD_PACKAGE) |