[IL134] Add an alternative path to getCurrentAutoCapsState
Bug: 8636060 Change-Id: I959e13d34910adad028ed6174f92029ff690eeebmain
parent
30d5ed67d6
commit
ddc163988a
|
@ -230,8 +230,9 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
mState.onPressKey(code, isSinglePointer, currentAutoCapsState);
|
mState.onPressKey(code, isSinglePointer, currentAutoCapsState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onReleaseKey(final int code, final boolean withSliding) {
|
public void onReleaseKey(final int code, final boolean withSliding,
|
||||||
mState.onReleaseKey(code, withSliding);
|
final int currentAutoCapsState, final int currentRecapitalizeState) {
|
||||||
|
mState.onReleaseKey(code, withSliding, currentAutoCapsState, currentRecapitalizeState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onFinishSlidingInput() {
|
public void onFinishSlidingInput() {
|
||||||
|
|
|
@ -28,7 +28,7 @@ import com.android.inputmethod.latin.utils.RecapitalizeStatus;
|
||||||
* This class contains all keyboard state transition logic.
|
* This class contains all keyboard state transition logic.
|
||||||
*
|
*
|
||||||
* The input events are {@link #onLoadKeyboard()}, {@link #onSaveKeyboardState()},
|
* The input events are {@link #onLoadKeyboard()}, {@link #onSaveKeyboardState()},
|
||||||
* {@link #onPressKey(int,boolean,int)}, {@link #onReleaseKey(int,boolean)},
|
* {@link #onPressKey(int,boolean,int)}, {@link #onReleaseKey(int,boolean,int,int)},
|
||||||
* {@link #onCodeInput(int,int)}, {@link #onFinishSlidingInput()},
|
* {@link #onCodeInput(int,int)}, {@link #onFinishSlidingInput()},
|
||||||
* {@link #onUpdateShiftState(int,int)}, {@link #onResetKeyboardStateToAlphabet()}.
|
* {@link #onUpdateShiftState(int,int)}, {@link #onResetKeyboardStateToAlphabet()}.
|
||||||
*
|
*
|
||||||
|
@ -49,10 +49,13 @@ public final class KeyboardState {
|
||||||
public void setSymbolsKeyboard();
|
public void setSymbolsKeyboard();
|
||||||
public void setSymbolsShiftedKeyboard();
|
public void setSymbolsShiftedKeyboard();
|
||||||
|
|
||||||
|
// Legacy method. TODO: remove the following method.
|
||||||
|
public void requestUpdatingShiftState();
|
||||||
/**
|
/**
|
||||||
* Request to call back {@link KeyboardState#onUpdateShiftState(int, int)}.
|
* Request to call back {@link KeyboardState#onUpdateShiftState(int, int)}.
|
||||||
*/
|
*/
|
||||||
public void requestUpdatingShiftState();
|
public void requestUpdatingShiftState(final int currentAutoCapsState,
|
||||||
|
final int currentRecapitalizeState);
|
||||||
|
|
||||||
public void startDoubleTapShiftKeyTimer();
|
public void startDoubleTapShiftKeyTimer();
|
||||||
public boolean isInDoubleTapShiftKeyTimeout();
|
public boolean isInDoubleTapShiftKeyTimeout();
|
||||||
|
@ -373,13 +376,14 @@ public final class KeyboardState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onReleaseKey(final int code, final boolean withSliding) {
|
public void onReleaseKey(final int code, final boolean withSliding,
|
||||||
|
final int currentAutoCapsState, final int currentRecapitalizeState) {
|
||||||
if (DEBUG_EVENT) {
|
if (DEBUG_EVENT) {
|
||||||
Log.d(TAG, "onReleaseKey: code=" + Constants.printableCode(code)
|
Log.d(TAG, "onReleaseKey: code=" + Constants.printableCode(code)
|
||||||
+ " sliding=" + withSliding + " " + this);
|
+ " sliding=" + withSliding + " " + this);
|
||||||
}
|
}
|
||||||
if (code == Constants.CODE_SHIFT) {
|
if (code == Constants.CODE_SHIFT) {
|
||||||
onReleaseShift(withSliding);
|
onReleaseShift(withSliding, currentAutoCapsState, currentRecapitalizeState);
|
||||||
} else if (code == Constants.CODE_CAPSLOCK) {
|
} else if (code == Constants.CODE_CAPSLOCK) {
|
||||||
setShiftLocked(!mAlphabetShiftState.isShiftLocked());
|
setShiftLocked(!mAlphabetShiftState.isShiftLocked());
|
||||||
} else if (code == Constants.CODE_SWITCH_ALPHA_SYMBOL) {
|
} else if (code == Constants.CODE_SWITCH_ALPHA_SYMBOL) {
|
||||||
|
@ -513,7 +517,8 @@ public final class KeyboardState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onReleaseShift(final boolean withSliding) {
|
private void onReleaseShift(final boolean withSliding, final int currentAutoCapsState,
|
||||||
|
final int currentRecapitalizeState) {
|
||||||
if (RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE != mRecapitalizeMode) {
|
if (RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE != mRecapitalizeMode) {
|
||||||
// We are recapitalizing. We should match the keyboard state to the recapitalize
|
// We are recapitalizing. We should match the keyboard state to the recapitalize
|
||||||
// state in priority.
|
// state in priority.
|
||||||
|
@ -536,7 +541,8 @@ public final class KeyboardState {
|
||||||
// After chording input, automatic shift state may have been changed depending on
|
// After chording input, automatic shift state may have been changed depending on
|
||||||
// what characters were input.
|
// what characters were input.
|
||||||
mShiftKeyState.onRelease();
|
mShiftKeyState.onRelease();
|
||||||
mSwitchActions.requestUpdatingShiftState();
|
mSwitchActions.requestUpdatingShiftState(currentAutoCapsState,
|
||||||
|
currentRecapitalizeState);
|
||||||
return;
|
return;
|
||||||
} else if (mAlphabetShiftState.isShiftLockShifted() && withSliding) {
|
} else if (mAlphabetShiftState.isShiftLockShifted() && withSliding) {
|
||||||
// In shift locked state, shift has been pressed and slid out to other key.
|
// In shift locked state, shift has been pressed and slid out to other key.
|
||||||
|
|
|
@ -1574,7 +1574,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
// press matching call is {@link #onPressKey(int,int,boolean)} above.
|
// press matching call is {@link #onPressKey(int,int,boolean)} above.
|
||||||
@Override
|
@Override
|
||||||
public void onReleaseKey(final int primaryCode, final boolean withSliding) {
|
public void onReleaseKey(final int primaryCode, final boolean withSliding) {
|
||||||
mKeyboardSwitcher.onReleaseKey(primaryCode, withSliding);
|
mKeyboardSwitcher.onReleaseKey(primaryCode, withSliding, getCurrentAutoCapsState(),
|
||||||
|
getCurrentRecapitalizeState());
|
||||||
|
|
||||||
// If accessibility is on, ensure the user receives keyboard state updates.
|
// If accessibility is on, ensure the user receives keyboard state updates.
|
||||||
if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
|
if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
|
||||||
|
|
|
@ -129,6 +129,12 @@ public class MockKeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
mState.onUpdateShiftState(mAutoCapsState, RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE);
|
mState.onUpdateShiftState(mAutoCapsState, RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void requestUpdatingShiftState(final int currentAutoCapsState,
|
||||||
|
final int currentRecapitalizeState) {
|
||||||
|
mState.onUpdateShiftState(currentAutoCapsState, currentRecapitalizeState);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startDoubleTapShiftKeyTimer() {
|
public void startDoubleTapShiftKeyTimer() {
|
||||||
mIsInDoubleTapShiftKeyTimeout = true;
|
mIsInDoubleTapShiftKeyTimeout = true;
|
||||||
|
@ -161,7 +167,12 @@ public class MockKeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onReleaseKey(final int code, final boolean withSliding) {
|
public void onReleaseKey(final int code, final boolean withSliding) {
|
||||||
mState.onReleaseKey(code, withSliding);
|
onReleaseKey(code, withSliding, mAutoCapsState, RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onReleaseKey(final int code, final boolean withSliding,
|
||||||
|
final int currentAutoCapsState, final int currentRecapitalizeState) {
|
||||||
|
mState.onReleaseKey(code, withSliding, currentAutoCapsState, currentRecapitalizeState);
|
||||||
if (mLongPressTimeoutCode == code) {
|
if (mLongPressTimeoutCode == code) {
|
||||||
mLongPressTimeoutCode = 0;
|
mLongPressTimeoutCode = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue