diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index 3d4e776a7..86f2abe72 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -403,12 +403,6 @@
-
-
-
-
-
-
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index e1ac387fa..4f038e1a5 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -207,75 +207,6 @@
Phone symbols mode
-
-
-
- Voice input
-
-
- Voice input is not currently supported for your language, but does work in English.
-
-
- Voice input uses Google\'s speech recognition. The Mobile Privacy Policy applies.
-
-
- To turn off voice input, go to input method settings.
-
-
- To use voice input, press the microphone button.
-
-
- Speak now
-
-
- Working
-
-
-
-
-
- Error. Please try again.
-
-
- Couldn\'t connect
-
-
- Error, too much speech.
-
-
- Audio problem
-
-
- Server error
-
-
- No speech heard
-
-
- No matches found
-
-
- Voice search not installed
-
-
- Hint: Swipe across keyboard to speak
-
-
- Hint: Next time, try speaking punctuation like \"period\", \"comma\", or \"question mark\".
-
-
- Cancel
-
-
- OK
-
Voice input key
@@ -294,9 +225,6 @@
Voice input is disabled
-
- Select input method
-
Configure input methods
diff --git a/java/res/xml-ar/keyboard_set.xml b/java/res/xml-ar/keyboard_set.xml
index c37d128d7..88d320144 100644
--- a/java/res/xml-ar/keyboard_set.xml
+++ b/java/res/xml-ar/keyboard_set.xml
@@ -19,8 +19,7 @@
-->
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
getEnabledInputMethodSubtypeList(
InputMethodInfoCompatWrapper imi, boolean allowsImplicitlySelectedSubtypes) {
- if (!SUBTYPE_SUPPORTED) {
- String[] languages = mLanguageSwitcherProxy.getEnabledLanguages(
- allowsImplicitlySelectedSubtypes);
- List subtypeList =
- new ArrayList();
- for (String lang: languages) {
- subtypeList.add(new InputMethodSubtypeCompatWrapper(0, 0, lang, KEYBOARD_MODE, ""));
- }
- return subtypeList;
- }
Object retval = CompatUtils.invoke(mImm, null, METHOD_getEnabledInputMethodSubtypeList,
(imi != null ? imi.getInputMethodInfo() : null), allowsImplicitlySelectedSubtypes);
if (retval == null || !(retval instanceof List>) || ((List>)retval).isEmpty()) {
@@ -228,16 +199,10 @@ public class InputMethodManagerCompatWrapper {
}
public boolean switchToLastInputMethod(IBinder token) {
- if (SubtypeSwitcher.getInstance().isDummyVoiceMode()) {
- return true;
- }
return (Boolean)CompatUtils.invoke(mImm, false, METHOD_switchToLastInputMethod, token);
}
public boolean switchToNextInputMethod(IBinder token, boolean onlyCurrentIme) {
- if (SubtypeSwitcher.getInstance().isDummyVoiceMode()) {
- return true;
- }
return (Boolean)CompatUtils.invoke(mImm, false, METHOD_switchToNextInputMethod, token,
onlyCurrentIme);
}
@@ -253,88 +218,6 @@ public class InputMethodManagerCompatWrapper {
public void showInputMethodPicker() {
if (mImm == null) return;
- if (SUBTYPE_SUPPORTED) {
- mImm.showInputMethodPicker();
- return;
- }
-
- // The code below are based on {@link InputMethodManager#showInputMethodMenuInternal}.
-
- final InputMethodInfoCompatWrapper myImi = SubtypeUtils.getInputMethodInfo(
- mLatinImePackageName);
- final List myImsList = getEnabledInputMethodSubtypeList(
- myImi, true);
- final InputMethodSubtypeCompatWrapper currentIms = getCurrentInputMethodSubtype();
- final List imiList = getEnabledInputMethodList();
- imiList.remove(myImi);
- final PackageManager pm = mPackageManager;
- Collections.sort(imiList, new Comparator() {
- @Override
- public int compare(InputMethodInfoCompatWrapper imi1,
- InputMethodInfoCompatWrapper imi2) {
- final CharSequence imiId1 = imi1.loadLabel(pm) + "/" + imi1.getId();
- final CharSequence imiId2 = imi2.loadLabel(pm) + "/" + imi2.getId();
- return imiId1.toString().compareTo(imiId2.toString());
- }
- });
-
- final int myImsCount = myImsList.size();
- final int imiCount = imiList.size();
- final CharSequence[] items = new CharSequence[myImsCount + imiCount];
-
- int checkedItem = 0;
- int index = 0;
- final CharSequence myImiLabel = myImi.loadLabel(mPackageManager);
- for (int i = 0; i < myImsCount; i++) {
- InputMethodSubtypeCompatWrapper ims = myImsList.get(i);
- if (currentIms.equals(ims))
- checkedItem = index;
- final CharSequence title = TextUtils.concat(
- ims.getDisplayName(mService, mLatinImePackageName, mApplicationInfo),
- " (" + myImiLabel, ")");
- items[index] = title;
- index++;
- }
-
- for (int i = 0; i < imiCount; i++) {
- final InputMethodInfoCompatWrapper imi = imiList.get(i);
- final CharSequence title = imi.loadLabel(mPackageManager);
- items[index] = title;
- index++;
- }
-
- final InputMethodServiceCompatWrapper service = mService;
- final OnClickListener buttonListener = new OnClickListener() {
- @Override
- public void onClick(DialogInterface di, int whichButton) {
- final Intent intent = new Intent("android.settings.INPUT_METHOD_SETTINGS");
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
- | Intent.FLAG_ACTIVITY_CLEAR_TOP);
- service.startActivity(intent);
- }
- };
- final IBinder token = service.getWindow().getWindow().getAttributes().token;
- final OnClickListener selectionListener = new OnClickListener() {
- @Override
- public void onClick(DialogInterface di, int which) {
- di.dismiss();
- if (which < myImsCount) {
- final int imsIndex = which;
- final InputMethodSubtypeCompatWrapper ims = myImsList.get(imsIndex);
- service.notifyOnCurrentInputMethodSubtypeChanged(ims);
- } else {
- final int imiIndex = which - myImsCount;
- final InputMethodInfoCompatWrapper imi = imiList.get(imiIndex);
- setInputMethodAndSubtype(token, imi.getId(), null);
- }
- }
- };
-
- final AlertDialog.Builder builder = new AlertDialog.Builder(mService)
- .setTitle(mService.getString(R.string.selectInputMethod))
- .setNeutralButton(R.string.configure_input_method, buttonListener)
- .setSingleChoiceItems(items, checkedItem, selectionListener);
- mService.showOptionDialogInternal(builder.create());
+ mImm.showInputMethodPicker();
}
}
diff --git a/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java b/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java
index 8e2ee0f7a..7c15be300 100644
--- a/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java
+++ b/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java
@@ -23,7 +23,6 @@ import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodSubtype;
-import com.android.inputmethod.deprecated.LanguageSwitcherProxy;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.latin.SubtypeSwitcher;
@@ -87,9 +86,6 @@ public class InputMethodServiceCompatWrapper extends InputMethodService {
if (subtype != null) {
if (!InputMethodManagerCompatWrapper.FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES
&& !subtype.isDummy()) return;
- if (!InputMethodManagerCompatWrapper.SUBTYPE_SUPPORTED) {
- LanguageSwitcherProxy.getInstance().setLocale(subtype.getLocale());
- }
SubtypeSwitcher.getInstance().updateSubtype(subtype);
}
}
diff --git a/java/src/com/android/inputmethod/deprecated/LanguageSwitcherProxy.java b/java/src/com/android/inputmethod/deprecated/LanguageSwitcherProxy.java
deleted file mode 100644
index 290e6b554..000000000
--- a/java/src/com/android/inputmethod/deprecated/LanguageSwitcherProxy.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.inputmethod.deprecated;
-
-import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
-import com.android.inputmethod.deprecated.languageswitcher.LanguageSwitcher;
-import com.android.inputmethod.latin.LatinIME;
-import com.android.inputmethod.latin.Settings;
-
-import android.content.SharedPreferences;
-import android.content.res.Configuration;
-
-import java.util.Locale;
-
-// This class is used only when the IME doesn't use method.xml for language switching.
-public class LanguageSwitcherProxy implements SharedPreferences.OnSharedPreferenceChangeListener {
- private static final LanguageSwitcherProxy sInstance = new LanguageSwitcherProxy();
- private LatinIME mService;
- private LanguageSwitcher mLanguageSwitcher;
- private SharedPreferences mPrefs;
-
- public static LanguageSwitcherProxy getInstance() {
- if (InputMethodManagerCompatWrapper.SUBTYPE_SUPPORTED) return null;
- return sInstance;
- }
-
- public static void init(LatinIME service, SharedPreferences prefs) {
- if (InputMethodManagerCompatWrapper.SUBTYPE_SUPPORTED) return;
- final Configuration conf = service.getResources().getConfiguration();
- sInstance.mLanguageSwitcher = new LanguageSwitcher(service);
- sInstance.mLanguageSwitcher.loadLocales(prefs, conf.locale);
- sInstance.mPrefs = prefs;
- sInstance.mService = service;
- prefs.registerOnSharedPreferenceChangeListener(sInstance);
- }
-
- public static void onConfigurationChanged(Configuration conf) {
- if (InputMethodManagerCompatWrapper.SUBTYPE_SUPPORTED) return;
- sInstance.mLanguageSwitcher.onConfigurationChanged(conf, sInstance.mPrefs);
- }
-
- public static void loadSettings() {
- if (InputMethodManagerCompatWrapper.SUBTYPE_SUPPORTED) return;
- sInstance.mLanguageSwitcher.loadLocales(sInstance.mPrefs, null);
- }
-
- public int getLocaleCount() {
- return mLanguageSwitcher.getLocaleCount();
- }
-
- public String[] getEnabledLanguages(boolean allowImplicitlySelectedLanguages) {
- return mLanguageSwitcher.getEnabledLanguages(allowImplicitlySelectedLanguages);
- }
-
- public Locale getInputLocale() {
- return mLanguageSwitcher.getInputLocale();
- }
-
- public void setLocale(String localeStr) {
- mLanguageSwitcher.setLocale(localeStr);
- mLanguageSwitcher.persist(mPrefs);
- }
-
- @Override
- public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
- // PREF_SELECTED_LANGUAGES: enabled input subtypes
- // PREF_INPUT_LANGUAGE: current input subtype
- if (key.equals(Settings.PREF_SELECTED_LANGUAGES)
- || key.equals(Settings.PREF_INPUT_LANGUAGE)) {
- mLanguageSwitcher.loadLocales(prefs, null);
- if (mService != null) {
- mService.onRefreshKeyboard();
- }
- }
- }
-}
diff --git a/java/src/com/android/inputmethod/deprecated/VoiceProxy.java b/java/src/com/android/inputmethod/deprecated/VoiceProxy.java
deleted file mode 100644
index 87d1c118b..000000000
--- a/java/src/com/android/inputmethod/deprecated/VoiceProxy.java
+++ /dev/null
@@ -1,854 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.inputmethod.deprecated;
-
-import android.app.AlertDialog;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.res.Configuration;
-import android.net.Uri;
-import android.os.AsyncTask;
-import android.os.IBinder;
-import android.preference.PreferenceManager;
-import android.provider.Browser;
-import android.speech.SpeechRecognizer;
-import android.text.SpannableStringBuilder;
-import android.text.Spanned;
-import android.text.TextUtils;
-import android.text.method.LinkMovementMethod;
-import android.text.style.URLSpan;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewParent;
-import android.view.Window;
-import android.view.WindowManager;
-import android.view.inputmethod.EditorInfo;
-import android.view.inputmethod.ExtractedTextRequest;
-import android.view.inputmethod.InputConnection;
-import android.widget.TextView;
-
-import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
-import com.android.inputmethod.compat.InputMethodServiceCompatWrapper;
-import com.android.inputmethod.compat.SharedPreferencesCompat;
-import com.android.inputmethod.deprecated.voice.FieldContext;
-import com.android.inputmethod.deprecated.voice.Hints;
-import com.android.inputmethod.deprecated.voice.SettingsUtil;
-import com.android.inputmethod.deprecated.voice.VoiceInput;
-import com.android.inputmethod.keyboard.KeyboardSwitcher;
-import com.android.inputmethod.keyboard.LatinKeyboardView;
-import com.android.inputmethod.latin.EditingUtils;
-import com.android.inputmethod.latin.LastComposedWord;
-import com.android.inputmethod.latin.LatinIME;
-import com.android.inputmethod.latin.LatinIME.UIHandler;
-import com.android.inputmethod.latin.LatinImeLogger;
-import com.android.inputmethod.latin.R;
-import com.android.inputmethod.latin.StringUtils;
-import com.android.inputmethod.latin.SubtypeSwitcher;
-import com.android.inputmethod.latin.Utils;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class VoiceProxy implements VoiceInput.UiListener {
- private static final VoiceProxy sInstance = new VoiceProxy();
-
- public static final boolean VOICE_INSTALLED =
- !InputMethodServiceCompatWrapper.CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED;
- private static final boolean ENABLE_VOICE_BUTTON = true;
- private static final String PREF_VOICE_MODE = "voice_mode";
- // Whether or not the user has used voice input before (and thus, whether to show the
- // first-run warning dialog or not).
- private static final String PREF_HAS_USED_VOICE_INPUT = "has_used_voice_input";
- // Whether or not the user has used voice input from an unsupported locale UI before.
- // For example, the user has a Chinese UI but activates voice input.
- private static final String PREF_HAS_USED_VOICE_INPUT_UNSUPPORTED_LOCALE =
- "has_used_voice_input_unsupported_locale";
- private static final int RECOGNITIONVIEW_HEIGHT_THRESHOLD_RATIO = 6;
- // TODO: Adjusted on phones for now
- private static final int RECOGNITIONVIEW_MINIMUM_HEIGHT_DIP = 244;
-
- private static final String TAG = VoiceProxy.class.getSimpleName();
- private static final boolean DEBUG = LatinImeLogger.sDBG;
-
- private boolean mAfterVoiceInput;
- private boolean mConfigurationChanging;
- private boolean mHasUsedVoiceInput;
- private boolean mHasUsedVoiceInputUnsupportedLocale;
- private boolean mImmediatelyAfterVoiceInput;
- private boolean mIsShowingHint;
- private boolean mLocaleSupportedForVoiceInput;
- private boolean mPasswordText;
- private boolean mRecognizing;
- private boolean mShowingVoiceSuggestions;
- private boolean mVoiceButtonEnabled;
- private boolean mVoiceButtonOnPrimary;
- private boolean mVoiceInputHighlighted;
-
- private int mMinimumVoiceRecognitionViewHeightPixel;
- private InputMethodManagerCompatWrapper mImm;
- private LatinIME mService;
- private AlertDialog mVoiceWarningDialog;
- private VoiceInput mVoiceInput;
- private final VoiceResults mVoiceResults = new VoiceResults();
- private Hints mHints;
- private UIHandler mHandler;
- private SubtypeSwitcher mSubtypeSwitcher;
-
- // For each word, a list of potential replacements, usually from voice.
- private final Map> mWordToSuggestions =
- new HashMap>();
-
- public static VoiceProxy init(LatinIME context, SharedPreferences prefs, UIHandler h) {
- sInstance.initInternal(context, prefs, h);
- return sInstance;
- }
-
- public static VoiceProxy getInstance() {
- return sInstance;
- }
-
- private void initInternal(LatinIME service, SharedPreferences prefs, UIHandler h) {
- if (!VOICE_INSTALLED) {
- return;
- }
- mService = service;
- mHandler = h;
- mMinimumVoiceRecognitionViewHeightPixel = Utils.dipToPixel(
- Utils.getDipScale(service), RECOGNITIONVIEW_MINIMUM_HEIGHT_DIP);
- mImm = InputMethodManagerCompatWrapper.getInstance();
- mSubtypeSwitcher = SubtypeSwitcher.getInstance();
- mVoiceInput = new VoiceInput(service, this);
- mHints = new Hints(service, prefs, new Hints.Display() {
- @Override
- public void showHint(int viewResource) {
- View view = LayoutInflater.from(mService).inflate(viewResource, null);
- mIsShowingHint = true;
- }
- });
- }
-
- private VoiceProxy() {
- // Intentional empty constructor for singleton.
- }
-
- public void resetVoiceStates(boolean isPasswordText) {
- mAfterVoiceInput = false;
- mImmediatelyAfterVoiceInput = false;
- mShowingVoiceSuggestions = false;
- mVoiceInputHighlighted = false;
- mPasswordText = isPasswordText;
- }
-
- public void flushVoiceInputLogs() {
- if (!VOICE_INSTALLED) {
- return;
- }
- if (!mConfigurationChanging) {
- if (mAfterVoiceInput) {
- mVoiceInput.flushAllTextModificationCounters();
- mVoiceInput.logInputEnded();
- }
- mVoiceInput.flushLogs();
- mVoiceInput.cancel();
- }
- }
-
- public void flushAndLogAllTextModificationCounters(int index, CharSequence suggestion,
- String wordSeparators) {
- if (!VOICE_INSTALLED) {
- return;
- }
- if (mAfterVoiceInput && mShowingVoiceSuggestions) {
- mVoiceInput.flushAllTextModificationCounters();
- // send this intent AFTER logging any prior aggregated edits.
- mVoiceInput.logTextModifiedByChooseSuggestion(suggestion.toString(), index,
- wordSeparators, mService.getCurrentInputConnection());
- }
- }
-
- private void showVoiceWarningDialog(final boolean swipe, IBinder token) {
- if (mVoiceWarningDialog != null && mVoiceWarningDialog.isShowing()) {
- return;
- }
- AlertDialog.Builder builder = new UrlLinkAlertDialogBuilder(mService);
- builder.setCancelable(true);
- builder.setIcon(R.drawable.ic_mic_dialog);
- builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int whichButton) {
- mVoiceInput.logKeyboardWarningDialogOk();
- reallyStartListening(swipe);
- }
- });
- builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int whichButton) {
- mVoiceInput.logKeyboardWarningDialogCancel();
- switchToLastInputMethod();
- }
- });
- // When the dialog is dismissed by user's cancellation, switch back to the last input method
- builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
- @Override
- public void onCancel(DialogInterface arg0) {
- mVoiceInput.logKeyboardWarningDialogCancel();
- switchToLastInputMethod();
- }
- });
-
- final CharSequence message;
- if (mLocaleSupportedForVoiceInput) {
- message = TextUtils.concat(
- mService.getText(R.string.voice_warning_may_not_understand), "\n\n",
- mService.getText(R.string.voice_warning_how_to_turn_off));
- } else {
- message = TextUtils.concat(
- mService.getText(R.string.voice_warning_locale_not_supported), "\n\n",
- mService.getText(R.string.voice_warning_may_not_understand), "\n\n",
- mService.getText(R.string.voice_warning_how_to_turn_off));
- }
- builder.setMessage(message);
- builder.setTitle(R.string.voice_warning_title);
- mVoiceWarningDialog = builder.create();
- final Window window = mVoiceWarningDialog.getWindow();
- final WindowManager.LayoutParams lp = window.getAttributes();
- lp.token = token;
- lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
- window.setAttributes(lp);
- window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
- mVoiceInput.logKeyboardWarningDialogShown();
- mVoiceWarningDialog.show();
- }
-
- private static class UrlLinkAlertDialogBuilder extends AlertDialog.Builder {
- private AlertDialog mAlertDialog;
-
- public UrlLinkAlertDialogBuilder(Context context) {
- super(context);
- }
-
- @Override
- public AlertDialog.Builder setMessage(CharSequence message) {
- return super.setMessage(replaceURLSpan(message));
- }
-
- private Spanned replaceURLSpan(CharSequence message) {
- // Replace all spans with the custom span
- final SpannableStringBuilder ssb = new SpannableStringBuilder(message);
- for (URLSpan span : ssb.getSpans(0, ssb.length(), URLSpan.class)) {
- int spanStart = ssb.getSpanStart(span);
- int spanEnd = ssb.getSpanEnd(span);
- int spanFlags = ssb.getSpanFlags(span);
- ssb.removeSpan(span);
- ssb.setSpan(new ClickableSpan(span.getURL()), spanStart, spanEnd, spanFlags);
- }
- return ssb;
- }
-
- @Override
- public AlertDialog create() {
- final AlertDialog dialog = super.create();
-
- dialog.setOnShowListener(new DialogInterface.OnShowListener() {
- @Override
- public void onShow(DialogInterface dialogInterface) {
- // Make URL in the dialog message click-able.
- TextView textView = (TextView) mAlertDialog.findViewById(android.R.id.message);
- if (textView != null) {
- textView.setMovementMethod(LinkMovementMethod.getInstance());
- }
- }
- });
- mAlertDialog = dialog;
- return dialog;
- }
-
- class ClickableSpan extends URLSpan {
- public ClickableSpan(String url) {
- super(url);
- }
-
- @Override
- public void onClick(View widget) {
- Uri uri = Uri.parse(getURL());
- Context context = widget.getContext();
- Intent intent = new Intent(Intent.ACTION_VIEW, uri);
- // Add this flag to start an activity from service
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName());
- // Dismiss the warning dialog and go back to the previous IME.
- // TODO: If we can find a way to bring the new activity to front while keeping
- // the warning dialog, we don't need to dismiss it here.
- mAlertDialog.cancel();
- context.startActivity(intent);
- }
- }
- }
-
- public void showPunctuationHintIfNecessary() {
- if (!VOICE_INSTALLED) {
- return;
- }
- InputConnection ic = mService.getCurrentInputConnection();
- if (!mImmediatelyAfterVoiceInput && mAfterVoiceInput && ic != null) {
- if (mHints.showPunctuationHintIfNecessary(ic)) {
- mVoiceInput.logPunctuationHintDisplayed();
- }
- }
- mImmediatelyAfterVoiceInput = false;
- }
-
- public void hideVoiceWindow() {
- if (!VOICE_INSTALLED) {
- return;
- }
- if (!mConfigurationChanging) {
- if (mAfterVoiceInput)
- mVoiceInput.logInputEnded();
- if (mVoiceWarningDialog != null && mVoiceWarningDialog.isShowing()) {
- mVoiceInput.logKeyboardWarningDialogDismissed();
- mVoiceWarningDialog.dismiss();
- mVoiceWarningDialog = null;
- }
- if (VOICE_INSTALLED & mRecognizing) {
- mVoiceInput.cancel();
- }
- }
- mWordToSuggestions.clear();
- }
-
- public void setCursorAndSelection(int newSelEnd, int newSelStart) {
- if (!VOICE_INSTALLED) {
- return;
- }
- if (mAfterVoiceInput) {
- mVoiceInput.setCursorPos(newSelEnd);
- mVoiceInput.setSelectionSpan(newSelEnd - newSelStart);
- }
- }
-
- public void setVoiceInputHighlighted(boolean b) {
- mVoiceInputHighlighted = b;
- }
-
- public void setShowingVoiceSuggestions(boolean b) {
- mShowingVoiceSuggestions = b;
- }
-
- public boolean isVoiceButtonEnabled() {
- return mVoiceButtonEnabled;
- }
-
- public boolean isVoiceButtonOnPrimary() {
- return mVoiceButtonOnPrimary;
- }
-
- public boolean isVoiceInputHighlighted() {
- return mVoiceInputHighlighted;
- }
-
- public boolean isRecognizing() {
- return mRecognizing;
- }
-
- public boolean needsToShowWarningDialog() {
- return !mHasUsedVoiceInput
- || (!mLocaleSupportedForVoiceInput && !mHasUsedVoiceInputUnsupportedLocale);
- }
-
- public boolean getAndResetIsShowingHint() {
- boolean ret = mIsShowingHint;
- mIsShowingHint = false;
- return ret;
- }
-
- private void revertVoiceInput() {
- InputConnection ic = mService.getCurrentInputConnection();
- if (ic != null) ic.commitText("", 1);
- mService.updateSuggestions();
- mVoiceInputHighlighted = false;
- }
-
- public void commitVoiceInput() {
- if (VOICE_INSTALLED && mVoiceInputHighlighted) {
- InputConnection ic = mService.getCurrentInputConnection();
- if (ic != null) ic.finishComposingText();
- mService.updateSuggestions();
- mVoiceInputHighlighted = false;
- }
- }
-
- public boolean logAndRevertVoiceInput() {
- if (!VOICE_INSTALLED) {
- return false;
- }
- if (mVoiceInputHighlighted) {
- mVoiceInput.incrementTextModificationDeleteCount(
- mVoiceResults.candidates.get(0).toString().length());
- revertVoiceInput();
- return true;
- } else {
- return false;
- }
- }
-
- public void rememberReplacedWord(CharSequence suggestion,String wordSeparators) {
- if (!VOICE_INSTALLED) {
- return;
- }
- if (mShowingVoiceSuggestions) {
- // Retain the replaced word in the alternatives array.
- String wordToBeReplaced = EditingUtils.getWordAtCursor(
- mService.getCurrentInputConnection(), wordSeparators);
- if (!mWordToSuggestions.containsKey(wordToBeReplaced)) {
- wordToBeReplaced = wordToBeReplaced.toLowerCase();
- }
- if (mWordToSuggestions.containsKey(wordToBeReplaced)) {
- List suggestions = mWordToSuggestions.get(wordToBeReplaced);
- if (suggestions.contains(suggestion)) {
- suggestions.remove(suggestion);
- }
- suggestions.add(wordToBeReplaced);
- mWordToSuggestions.remove(wordToBeReplaced);
- mWordToSuggestions.put(suggestion.toString(), suggestions);
- }
- }
- }
-
- public void handleBackspace() {
- if (!VOICE_INSTALLED) {
- return;
- }
- if (mAfterVoiceInput) {
- // Don't log delete if the user is pressing delete at
- // the beginning of the text box (hence not deleting anything)
- if (mVoiceInput.getCursorPos() > 0) {
- // If anything was selected before the delete was pressed, increment the
- // delete count by the length of the selection
- int deleteLen = mVoiceInput.getSelectionSpan() > 0 ?
- mVoiceInput.getSelectionSpan() : 1;
- mVoiceInput.incrementTextModificationDeleteCount(deleteLen);
- }
- }
- }
-
- public void handleCharacter() {
- if (!VOICE_INSTALLED) {
- return;
- }
- commitVoiceInput();
- if (mAfterVoiceInput) {
- // Assume input length is 1. This assumption fails for smiley face insertions.
- mVoiceInput.incrementTextModificationInsertCount(1);
- }
- }
-
- public void handleSeparator() {
- if (!VOICE_INSTALLED) {
- return;
- }
- commitVoiceInput();
- if (mAfterVoiceInput){
- // Assume input length is 1. This assumption fails for smiley face insertions.
- mVoiceInput.incrementTextModificationInsertPunctuationCount(1);
- }
- }
-
- public void handleClose() {
- if (!VOICE_INSTALLED) {
- return;
- }
- if (mRecognizing) {
- mVoiceInput.cancel();
- }
- }
-
-
- public void handleVoiceResults(boolean capitalizeFirstWord) {
- if (!VOICE_INSTALLED) {
- return;
- }
- mAfterVoiceInput = true;
- mImmediatelyAfterVoiceInput = true;
-
- InputConnection ic = mService.getCurrentInputConnection();
- if (!mService.isFullscreenMode()) {
- // Start listening for updates to the text from typing, etc.
- if (ic != null) {
- ExtractedTextRequest req = new ExtractedTextRequest();
- ic.getExtractedText(req, InputConnection.GET_EXTRACTED_TEXT_MONITOR);
- }
- }
- mService.vibrate();
-
- final List nBest = new ArrayList();
- for (String c : mVoiceResults.candidates) {
- if (capitalizeFirstWord) {
- c = Character.toUpperCase(c.charAt(0)) + c.substring(1, c.length());
- }
- nBest.add(c);
- }
- if (nBest.size() == 0) {
- return;
- }
- String bestResult = nBest.get(0).toString();
- mVoiceInput.logVoiceInputDelivered(bestResult.length());
- mHints.registerVoiceResult(bestResult);
-
- if (ic != null) ic.beginBatchEdit(); // To avoid extra updates on committing older text
- mService.commitTyped(ic, LastComposedWord.NOT_A_SEPARATOR);
- EditingUtils.appendText(ic, bestResult);
- if (ic != null) ic.endBatchEdit();
-
- mVoiceInputHighlighted = true;
- mWordToSuggestions.putAll(mVoiceResults.alternatives);
- onCancelVoice();
- }
-
- public void switchToRecognitionStatusView(final Configuration configuration) {
- if (!VOICE_INSTALLED) {
- return;
- }
- mHandler.post(new Runnable() {
- @Override
- public void run() {
-// mService.setCandidatesViewShown(false);
- mRecognizing = true;
- mVoiceInput.newView();
- View v = mVoiceInput.getView();
-
- ViewParent p = v.getParent();
- if (p != null && p instanceof ViewGroup) {
- ((ViewGroup) p).removeView(v);
- }
-
- View keyboardView = KeyboardSwitcher.getInstance().getKeyboardView();
-
- // The full height of the keyboard is difficult to calculate
- // as the dimension is expressed in "mm" and not in "pixel"
- // As we add mm, we don't know how the rounding is going to work
- // thus we may end up with few pixels extra (or less).
- if (keyboardView != null) {
- View popupLayout = v.findViewById(R.id.popup_layout);
- final int displayHeight =
- mService.getResources().getDisplayMetrics().heightPixels;
- final int currentHeight = popupLayout.getLayoutParams().height;
- final int keyboardHeight = keyboardView.getHeight();
- if (mMinimumVoiceRecognitionViewHeightPixel > keyboardHeight
- || mMinimumVoiceRecognitionViewHeightPixel > currentHeight) {
- popupLayout.getLayoutParams().height =
- mMinimumVoiceRecognitionViewHeightPixel;
- } else if (keyboardHeight > currentHeight || keyboardHeight
- > (displayHeight / RECOGNITIONVIEW_HEIGHT_THRESHOLD_RATIO)) {
- popupLayout.getLayoutParams().height = keyboardHeight;
- }
- }
- mService.setInputView(v);
- mService.updateInputViewShown();
-
- if (configuration != null) {
- mVoiceInput.onConfigurationChanged(configuration);
- }
- }});
- }
-
- private void switchToLastInputMethod() {
- if (!VOICE_INSTALLED) {
- return;
- }
- final IBinder token = mService.getWindow().getWindow().getAttributes().token;
- new AsyncTask() {
- @Override
- protected Boolean doInBackground(Void... params) {
- return mImm.switchToLastInputMethod(token);
- }
-
- @Override
- protected void onPostExecute(Boolean result) {
- // Calls in this method need to be done in the same thread as the thread which
- // called switchToLastInputMethod()
- if (!result) {
- if (DEBUG) {
- Log.d(TAG, "Couldn't switch back to last IME.");
- }
- // Because the current IME and subtype failed to switch to any other IME and
- // subtype by switchToLastInputMethod, the current IME and subtype should keep
- // being LatinIME and voice subtype in the next time. And for re-showing voice
- // mode, the state of voice input should be reset and the voice view should be
- // hidden.
- mVoiceInput.reset();
- mService.requestHideSelf(0);
- } else {
- // Notify an event that the current subtype was changed. This event will be
- // handled if "onCurrentInputMethodSubtypeChanged" can't be implemented
- // when the API level is 10 or previous.
- mService.notifyOnCurrentInputMethodSubtypeChanged(null);
- }
- }
- }.execute();
- }
-
- private void reallyStartListening(boolean swipe) {
- if (!VOICE_INSTALLED) {
- return;
- }
- if (!mHasUsedVoiceInput) {
- // The user has started a voice input, so remember that in the
- // future (so we don't show the warning dialog after the first run).
- SharedPreferences.Editor editor =
- PreferenceManager.getDefaultSharedPreferences(mService).edit();
- editor.putBoolean(PREF_HAS_USED_VOICE_INPUT, true);
- SharedPreferencesCompat.apply(editor);
- mHasUsedVoiceInput = true;
- }
-
- if (!mLocaleSupportedForVoiceInput && !mHasUsedVoiceInputUnsupportedLocale) {
- // The user has started a voice input from an unsupported locale, so remember that
- // in the future (so we don't show the warning dialog the next time they do this).
- SharedPreferences.Editor editor =
- PreferenceManager.getDefaultSharedPreferences(mService).edit();
- editor.putBoolean(PREF_HAS_USED_VOICE_INPUT_UNSUPPORTED_LOCALE, true);
- SharedPreferencesCompat.apply(editor);
- mHasUsedVoiceInputUnsupportedLocale = true;
- }
-
- // Clear N-best suggestions
- mService.clearSuggestions();
-
- FieldContext context = makeFieldContext();
- mVoiceInput.startListening(context, swipe);
- switchToRecognitionStatusView(null);
- }
-
- public void startListening(final boolean swipe, IBinder token) {
- if (!VOICE_INSTALLED) {
- return;
- }
- // TODO: remove swipe which is no longer used.
- if (needsToShowWarningDialog()) {
- // Calls reallyStartListening if user clicks OK, does nothing if user clicks Cancel.
- showVoiceWarningDialog(swipe, token);
- } else {
- reallyStartListening(swipe);
- }
- }
-
- private boolean fieldCanDoVoice(FieldContext fieldContext) {
- return !mPasswordText
- && mVoiceInput != null
- && !mVoiceInput.isBlacklistedField(fieldContext);
- }
-
- private boolean shouldShowVoiceButton(FieldContext fieldContext, EditorInfo editorInfo) {
- @SuppressWarnings("deprecation")
- final boolean noMic = StringUtils.inPrivateImeOptions(null,
- LatinIME.IME_OPTION_NO_MICROPHONE_COMPAT, editorInfo)
- || StringUtils.inPrivateImeOptions(mService.getPackageName(),
- LatinIME.IME_OPTION_NO_MICROPHONE, editorInfo);
- return ENABLE_VOICE_BUTTON && fieldCanDoVoice(fieldContext) && !noMic
- && SpeechRecognizer.isRecognitionAvailable(mService);
- }
-
- public static boolean isRecognitionAvailable(Context context) {
- return SpeechRecognizer.isRecognitionAvailable(context);
- }
-
- public void loadSettings(EditorInfo editorInfo, SharedPreferences sp) {
- if (!VOICE_INSTALLED) {
- return;
- }
- mHasUsedVoiceInput = sp.getBoolean(PREF_HAS_USED_VOICE_INPUT, false);
- mHasUsedVoiceInputUnsupportedLocale =
- sp.getBoolean(PREF_HAS_USED_VOICE_INPUT_UNSUPPORTED_LOCALE, false);
-
- mLocaleSupportedForVoiceInput = SubtypeSwitcher.isVoiceSupported(
- mService, SubtypeSwitcher.getInstance().getInputLocaleStr());
-
- final String voiceMode = sp.getString(PREF_VOICE_MODE,
- mService.getString(R.string.voice_mode_main));
- mVoiceButtonEnabled = !voiceMode.equals(mService.getString(R.string.voice_mode_off))
- && shouldShowVoiceButton(makeFieldContext(), editorInfo);
- mVoiceButtonOnPrimary = voiceMode.equals(mService.getString(R.string.voice_mode_main));
- }
-
- public void destroy() {
- if (!VOICE_INSTALLED) {
- return;
- }
- if (mVoiceInput != null) {
- mVoiceInput.destroy();
- }
- }
-
- public void onStartInputView(IBinder keyboardViewToken) {
- if (!VOICE_INSTALLED) {
- return;
- }
- // If keyboardViewToken is null, keyboardView is not attached but voiceView is attached.
- IBinder windowToken = keyboardViewToken != null ? keyboardViewToken
- : mVoiceInput.getView().getWindowToken();
- // If IME is in voice mode, but still needs to show the voice warning dialog,
- // keep showing the warning.
- if (mSubtypeSwitcher.isVoiceMode() && windowToken != null) {
- // Close keyboard view if it is been shown.
- final LatinKeyboardView keyboardView = KeyboardSwitcher.getInstance().getKeyboardView();
- if (keyboardView != null && keyboardView.isShown())
- keyboardView.purgeKeyboardAndClosing();
- startListening(false, windowToken);
- }
- // If we have no token, onAttachedToWindow will take care of showing dialog and start
- // listening.
- }
-
- public void onAttachedToWindow() {
- if (!VOICE_INSTALLED) {
- return;
- }
- // After onAttachedToWindow, we can show the voice warning dialog. See startListening()
- // above.
- VoiceInputWrapper.getInstance().setVoiceInput(mVoiceInput, mSubtypeSwitcher);
- }
-
- public void onConfigurationChanged(Configuration configuration) {
- if (!VOICE_INSTALLED) {
- return;
- }
- if (mRecognizing) {
- switchToRecognitionStatusView(configuration);
- }
- }
-
- @Override
- public void onCancelVoice() {
- if (!VOICE_INSTALLED) {
- return;
- }
- if (mRecognizing) {
- if (mSubtypeSwitcher.isVoiceMode()) {
- // If voice mode is being canceled within LatinIME (i.e. time-out or user
- // cancellation etc.), onCancelVoice() will be called first. LatinIME thinks it's
- // still in voice mode. LatinIME needs to call switchToLastInputMethod().
- // Note that onCancelVoice() will be called again from SubtypeSwitcher.
- switchToLastInputMethod();
- } else if (mSubtypeSwitcher.isKeyboardMode()) {
- // If voice mode is being canceled out of LatinIME (i.e. by user's IME switching or
- // as a result of switchToLastInputMethod() etc.),
- // onCurrentInputMethodSubtypeChanged() will be called first. LatinIME will know
- // that it's in keyboard mode and SubtypeSwitcher will call onCancelVoice().
- mRecognizing = false;
- mService.switchToKeyboardView();
- }
- }
- }
-
- @Override
- public void onVoiceResults(List candidates,
- Map> alternatives) {
- if (!VOICE_INSTALLED) {
- return;
- }
- if (!mRecognizing) {
- return;
- }
- mVoiceResults.candidates = candidates;
- mVoiceResults.alternatives = alternatives;
- mHandler.updateVoiceResults();
- }
-
- private FieldContext makeFieldContext() {
- SubtypeSwitcher switcher = SubtypeSwitcher.getInstance();
- return new FieldContext(mService.getCurrentInputConnection(),
- mService.getCurrentInputEditorInfo(), switcher.getInputLocaleStr(),
- switcher.getEnabledLanguages());
- }
-
- // TODO: make this private (proguard issue)
- public static class VoiceResults {
- List candidates;
- Map> alternatives;
- }
-
- public static class VoiceInputWrapper {
- private static final VoiceInputWrapper sInputWrapperInstance = new VoiceInputWrapper();
- private VoiceInput mVoiceInput;
- public static VoiceInputWrapper getInstance() {
- return sInputWrapperInstance;
- }
- private void setVoiceInput(VoiceInput voiceInput, SubtypeSwitcher switcher) {
- if (!VOICE_INSTALLED) {
- return;
- }
- if (mVoiceInput == null && voiceInput != null) {
- mVoiceInput = voiceInput;
- }
- switcher.setVoiceInputWrapper(this);
- }
-
- private VoiceInputWrapper() {
- }
-
- public void cancel() {
- if (!VOICE_INSTALLED) {
- return;
- }
- if (mVoiceInput != null) mVoiceInput.cancel();
- }
-
- public void reset() {
- if (!VOICE_INSTALLED) {
- return;
- }
- if (mVoiceInput != null) mVoiceInput.reset();
- }
- }
-
- // A list of locales which are supported by default for voice input, unless we get a
- // different list from Gservices.
- private static final String DEFAULT_VOICE_INPUT_SUPPORTED_LOCALES =
- "en " +
- "en_US " +
- "en_GB " +
- "en_AU " +
- "en_CA " +
- "en_IE " +
- "en_IN " +
- "en_NZ " +
- "en_SG " +
- "en_ZA ";
-
- public static String getSupportedLocalesString (ContentResolver resolver) {
- return SettingsUtil.getSettingsString(
- resolver,
- SettingsUtil.LATIN_IME_VOICE_INPUT_SUPPORTED_LOCALES,
- DEFAULT_VOICE_INPUT_SUPPORTED_LOCALES);
- }
-
- public void startChangingConfiguration() {
- mConfigurationChanging = true;
- }
-
- public void finishChangingConfiguration() {
- mConfigurationChanging = false;
- }
-}
diff --git a/java/src/com/android/inputmethod/deprecated/compat/VoiceInputLoggerCompatUtils.java b/java/src/com/android/inputmethod/deprecated/compat/VoiceInputLoggerCompatUtils.java
deleted file mode 100644
index 488390fbc..000000000
--- a/java/src/com/android/inputmethod/deprecated/compat/VoiceInputLoggerCompatUtils.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.inputmethod.deprecated.compat;
-
-import com.android.common.userhappiness.UserHappinessSignals;
-import com.android.inputmethod.compat.CompatUtils;
-
-import java.lang.reflect.Method;
-
-public class VoiceInputLoggerCompatUtils {
- public static final String EXTRA_TEXT_REPLACED_LENGTH = "length";
- public static final String EXTRA_BEFORE_N_BEST_CHOOSE = "before";
- public static final String EXTRA_AFTER_N_BEST_CHOOSE = "after";
- private static final Method METHOD_UserHappinessSignals_setHasVoiceLoggingInfo =
- CompatUtils.getMethod(UserHappinessSignals.class, "setHasVoiceLoggingInfo",
- boolean.class);
-
- public static void setHasVoiceLoggingInfoCompat(boolean hasLoggingInfo) {
- CompatUtils.invoke(null, null, METHOD_UserHappinessSignals_setHasVoiceLoggingInfo,
- hasLoggingInfo);
- }
-}
diff --git a/java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java b/java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java
deleted file mode 100644
index 421ee6529..000000000
--- a/java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (C) 2008-2009 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.
- */
-
-package com.android.inputmethod.deprecated.languageswitcher;
-
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
-import android.content.res.Resources;
-import android.os.Bundle;
-import android.preference.CheckBoxPreference;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceManager;
-import android.text.TextUtils;
-import android.util.Pair;
-
-import com.android.inputmethod.compat.SharedPreferencesCompat;
-import com.android.inputmethod.keyboard.KeyboardSet;
-import com.android.inputmethod.latin.DictionaryFactory;
-import com.android.inputmethod.latin.LocaleUtils;
-import com.android.inputmethod.latin.R;
-import com.android.inputmethod.latin.Settings;
-import com.android.inputmethod.latin.StringUtils;
-
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.IOException;
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-
-public class InputLanguageSelection extends PreferenceActivity {
-
- private SharedPreferences mPrefs;
- private String mSelectedLanguages;
- private HashMap mLocaleMap =
- new HashMap();
-
- private static class LocaleEntry implements Comparable