am bd51aaf9: Merge "Warn deprecated privateImeOptions, "nm" and "forceAscii""

* commit 'bd51aaf98f39a2de01143109714a69dc9c1a7b66':
  Warn deprecated privateImeOptions, "nm" and "forceAscii"
main
Tadashi G. Takaoka 2012-01-25 22:22:18 -08:00 committed by Android Git Automerger
commit c400482d17
2 changed files with 17 additions and 5 deletions

View File

@ -244,9 +244,10 @@ public class KeyboardSet {
// TODO: Use InputMethodSubtype object as argument. // TODO: Use InputMethodSubtype object as argument.
public Builder setSubtype(Locale inputLocale, boolean asciiCapable, public Builder setSubtype(Locale inputLocale, boolean asciiCapable,
boolean touchPositionCorrectionEnabled) { boolean touchPositionCorrectionEnabled) {
final boolean deprecatedForceAscii = Utils.inPrivateImeOptions(
mPackageName, LatinIME.IME_OPTION_FORCE_ASCII, mEditorInfo);
final boolean forceAscii = EditorInfoCompatUtils.hasFlagForceAscii(mParams.mImeOptions) final boolean forceAscii = EditorInfoCompatUtils.hasFlagForceAscii(mParams.mImeOptions)
|| Utils.inPrivateImeOptions( || deprecatedForceAscii;
mPackageName, LatinIME.IME_OPTION_FORCE_ASCII, mEditorInfo);
mParams.mLocale = (forceAscii && !asciiCapable) ? Locale.US : inputLocale; mParams.mLocale = (forceAscii && !asciiCapable) ? Locale.US : inputLocale;
mParams.mTouchPositionCorrectionEnabled = touchPositionCorrectionEnabled; mParams.mTouchPositionCorrectionEnabled = touchPositionCorrectionEnabled;
return this; return this;
@ -256,10 +257,11 @@ public class KeyboardSet {
boolean voiceKeyOnMain) { boolean voiceKeyOnMain) {
mParams.mSettingsKeyEnabled = settingsKeyEnabled; mParams.mSettingsKeyEnabled = settingsKeyEnabled;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
final boolean deprecatedNoMicrophone = Utils.inPrivateImeOptions(
null, LatinIME.IME_OPTION_NO_MICROPHONE_COMPAT, mEditorInfo);
final boolean noMicrophone = Utils.inPrivateImeOptions( final boolean noMicrophone = Utils.inPrivateImeOptions(
mPackageName, LatinIME.IME_OPTION_NO_MICROPHONE, mEditorInfo) mPackageName, LatinIME.IME_OPTION_NO_MICROPHONE, mEditorInfo)
|| Utils.inPrivateImeOptions( || deprecatedNoMicrophone;
null, LatinIME.IME_OPTION_NO_MICROPHONE_COMPAT, mEditorInfo);
mParams.mVoiceKeyEnabled = voiceKeyEnabled && !noMicrophone; mParams.mVoiceKeyEnabled = voiceKeyEnabled && !noMicrophone;
mParams.mVoiceKeyOnMain = voiceKeyOnMain; mParams.mVoiceKeyOnMain = voiceKeyOnMain;
return this; return this;

View File

@ -104,7 +104,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
*/ */
public static final String IME_OPTION_NO_SETTINGS_KEY = "noSettingsKey"; public static final String IME_OPTION_NO_SETTINGS_KEY = "noSettingsKey";
// TODO: Remove this private option.
/** /**
* The private IME option used to indicate that the given text field needs * The private IME option used to indicate that the given text field needs
* ASCII code points input. * ASCII code points input.
@ -729,6 +728,17 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
: String.format("inputType=0x%08x imeOptions=0x%08x", : String.format("inputType=0x%08x imeOptions=0x%08x",
editorInfo.inputType, editorInfo.imeOptions))); editorInfo.inputType, editorInfo.imeOptions)));
} }
if (Utils.inPrivateImeOptions(null, IME_OPTION_NO_MICROPHONE_COMPAT, editorInfo)) {
Log.w(TAG, "Deprecated private IME option specified: "
+ editorInfo.privateImeOptions);
Log.w(TAG, "Use " + getPackageName() + "." + IME_OPTION_NO_MICROPHONE + " instead");
}
if (Utils.inPrivateImeOptions(getPackageName(), IME_OPTION_FORCE_ASCII, editorInfo)) {
Log.w(TAG, "Deprecated private IME option specified: "
+ editorInfo.privateImeOptions);
Log.w(TAG, "Use EditorInfo.IME_FLAG_FORCE_ASCII flag instead");
}
LatinImeLogger.onStartInputView(editorInfo); LatinImeLogger.onStartInputView(editorInfo);
// In landscape mode, this method gets called without the input view being created. // In landscape mode, this method gets called without the input view being created.
if (inputView == null) { if (inputView == null) {