am 6b7100fe: Don\'t execute pending onStartInputView if EditorInfos are equivalent
* commit '6b7100fecaaaf0e8e42c4d2ccebac165e89e79bf': Don't execute pending onStartInputView if EditorInfos are equivalentmain
commit
658a1dffcb
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package com.android.inputmethod.keyboard;
|
package com.android.inputmethod.keyboard;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
|
|
||||||
import com.android.inputmethod.compat.EditorInfoCompatUtils;
|
import com.android.inputmethod.compat.EditorInfoCompatUtils;
|
||||||
|
@ -177,6 +178,14 @@ public class KeyboardId {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean equivalentEditorInfoForKeyboard(EditorInfo a, EditorInfo b) {
|
||||||
|
if (a == null && b == null) return true;
|
||||||
|
if (a == null || b == null) return false;
|
||||||
|
return a.inputType == b.inputType
|
||||||
|
&& a.imeOptions == b.imeOptions
|
||||||
|
&& TextUtils.equals(a.privateImeOptions, b.privateImeOptions);
|
||||||
|
}
|
||||||
|
|
||||||
public static String modeName(int mode) {
|
public static String modeName(int mode) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case MODE_TEXT: return "text";
|
case MODE_TEXT: return "text";
|
||||||
|
|
|
@ -125,23 +125,9 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
mIsValid = true;
|
mIsValid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restore(boolean forceRestore) {
|
public void restore() {
|
||||||
if (!mIsValid) {
|
if (!mIsValid || mIsAlphabetMode) {
|
||||||
if (forceRestore) {
|
|
||||||
setAlphabetKeyboard();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mIsValid = false;
|
|
||||||
|
|
||||||
if (mIsAlphabetMode) {
|
|
||||||
setAlphabetKeyboard();
|
setAlphabetKeyboard();
|
||||||
if (mIsShiftLocked) {
|
|
||||||
setShiftLocked(true);
|
|
||||||
}
|
|
||||||
if (mIsShifted) {
|
|
||||||
setShifted(MANUAL_SHIFT);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (mIsShifted) {
|
if (mIsShifted) {
|
||||||
setSymbolsShiftedKeyboard();
|
setSymbolsShiftedKeyboard();
|
||||||
|
@ -149,6 +135,16 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
setSymbolsKeyboard();
|
setSymbolsKeyboard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!mIsValid) return;
|
||||||
|
mIsValid = false;
|
||||||
|
|
||||||
|
if (mIsAlphabetMode) {
|
||||||
|
setShiftLocked(mIsShiftLocked);
|
||||||
|
if (!mIsShiftLocked) {
|
||||||
|
setShifted(mIsShifted ? MANUAL_SHIFT : UNSHIFT);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +200,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
mSymbolsShiftedKeyboardId = getKeyboardId(editorInfo, true, true, settingsValues);
|
mSymbolsShiftedKeyboardId = getKeyboardId(editorInfo, true, true, settingsValues);
|
||||||
mState.onLoadKeyboard();
|
mState.onLoadKeyboard();
|
||||||
mLayoutSwitchBackSymbols = mResources.getString(R.string.layout_switch_back_symbols);
|
mLayoutSwitchBackSymbols = mResources.getString(R.string.layout_switch_back_symbols);
|
||||||
mSavedKeyboardState.restore(mCurrentId == null);
|
mSavedKeyboardState.restore();
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.w(TAG, "loading keyboard failed: " + mMainKeyboardId, e);
|
Log.w(TAG, "loading keyboard failed: " + mMainKeyboardId, e);
|
||||||
LatinImeLogger.logOnException(mMainKeyboardId.toString(), e);
|
LatinImeLogger.logOnException(mMainKeyboardId.toString(), e);
|
||||||
|
|
|
@ -62,6 +62,7 @@ import com.android.inputmethod.deprecated.VoiceProxy;
|
||||||
import com.android.inputmethod.keyboard.Key;
|
import com.android.inputmethod.keyboard.Key;
|
||||||
import com.android.inputmethod.keyboard.Keyboard;
|
import com.android.inputmethod.keyboard.Keyboard;
|
||||||
import com.android.inputmethod.keyboard.KeyboardActionListener;
|
import com.android.inputmethod.keyboard.KeyboardActionListener;
|
||||||
|
import com.android.inputmethod.keyboard.KeyboardId;
|
||||||
import com.android.inputmethod.keyboard.KeyboardSwitcher;
|
import com.android.inputmethod.keyboard.KeyboardSwitcher;
|
||||||
import com.android.inputmethod.keyboard.KeyboardView;
|
import com.android.inputmethod.keyboard.KeyboardView;
|
||||||
import com.android.inputmethod.keyboard.LatinKeyboard;
|
import com.android.inputmethod.keyboard.LatinKeyboard;
|
||||||
|
@ -442,7 +443,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onStartInputView(EditorInfo editorInfo, boolean restarting) {
|
public void onStartInputView(EditorInfo editorInfo, boolean restarting) {
|
||||||
if (hasMessages(MSG_PENDING_IMS_CALLBACK) && editorInfo == mAppliedEditorInfo) {
|
if (hasMessages(MSG_PENDING_IMS_CALLBACK)
|
||||||
|
&& KeyboardId.equivalentEditorInfoForKeyboard(editorInfo, mAppliedEditorInfo)) {
|
||||||
// Typically this is the second onStartInputView after orientation changed.
|
// Typically this is the second onStartInputView after orientation changed.
|
||||||
resetPendingImsCallback();
|
resetPendingImsCallback();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue