Loading java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +12 −13 Original line number Diff line number Diff line Loading @@ -274,18 +274,25 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions, voiceKeyEnabled, hasShortcutKey); } public int getKeyboardMode() { return mCurrentId != null ? mCurrentId.mMode : KeyboardId.MODE_TEXT; } public boolean isAlphabetMode() { return mState.isAlphabetMode(); final Keyboard keyboard = getLatinKeyboard(); return keyboard != null && keyboard.mId.isAlphabetKeyboard(); } public boolean isInputViewShown() { return mCurrentInputView != null && mCurrentInputView.isShown(); } public boolean isShiftedOrShiftLocked() { final Keyboard keyboard = getLatinKeyboard(); return keyboard != null && keyboard.isShiftedOrShiftLocked(); } public boolean isManualTemporaryUpperCase() { final Keyboard keyboard = getLatinKeyboard(); return keyboard != null && keyboard.isManualTemporaryUpperCase(); } public boolean isKeyboardAvailable() { if (mKeyboardView != null) return mKeyboardView.getKeyboard() != null; Loading @@ -301,14 +308,6 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions, return null; } public boolean isShiftedOrShiftLocked() { return mState.isShiftedOrShiftLocked(); } public boolean isManualTemporaryUpperCase() { return mState.isManualTemporaryUpperCase(); } // Implements {@link KeyboardState.SwitchActions}. @Override public void setShifted(int shiftMode) { Loading java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +27 −41 Original line number Diff line number Diff line Loading @@ -26,11 +26,13 @@ import com.android.inputmethod.keyboard.Keyboard; * Keyboard state machine. * * This class contains all keyboard state transition logic. * * The input events are {@link #onLoadKeyboard(String, boolean)}, {@link #onSaveKeyboardState()}, * {@link #onPressShift(boolean)}, {@link #onReleaseShift(boolean)}, {@link #onPressSymbol()}, * {@link #onReleaseSymbol()}, {@link #onOtherKeyPressed()}, {@link #onCodeInput(int, boolean)}, * {@link #onCancelInput(boolean)}, {@link #onUpdateShiftState(boolean)}, {@link #onToggleShift()}, * {@link #onToggleCapsLock()}, and {@link #onToggleAlphabetAndSymbols()}. * * The actions are {@link SwitchActions}'s methods. */ public class KeyboardState { Loading @@ -39,12 +41,16 @@ public class KeyboardState { public interface SwitchActions { public void setAlphabetKeyboard(); public static final int UNSHIFT = 0; public static final int MANUAL_SHIFT = 1; public static final int AUTOMATIC_SHIFT = 2; public void setShifted(int shiftMode); public void setShiftLocked(boolean shiftLocked); public void setSymbolsKeyboard(); public void setSymbolsShiftedKeyboard(); } Loading Loading @@ -103,8 +109,9 @@ public class KeyboardState { final SavedKeyboardState state = mSavedKeyboardState; state.mIsAlphabetMode = mIsAlphabetMode; if (mIsAlphabetMode) { state.mIsShiftLocked = isShiftLocked(); state.mIsShifted = !state.mIsShiftLocked && isShiftedOrShiftLocked(); state.mIsShiftLocked = mKeyboardShiftState.isShiftLocked(); state.mIsShifted = !state.mIsShiftLocked && mKeyboardShiftState.isShiftedOrShiftLocked(); } else { state.mIsShiftLocked = false; state.mIsShifted = mIsSymbolShifted; Loading Loading @@ -144,34 +151,11 @@ public class KeyboardState { } } public boolean isAlphabetMode() { return mIsAlphabetMode; } // TODO: Remove this method. public boolean isShiftLocked() { return mKeyboardShiftState.isShiftLocked(); } public boolean isShiftLockShifted() { return mKeyboardShiftState.isShiftLockShifted(); } public boolean isShiftedOrShiftLocked() { return mKeyboardShiftState.isShiftedOrShiftLocked(); } public boolean isAutomaticTemporaryUpperCase() { return mKeyboardShiftState.isAutomaticTemporaryUpperCase(); } public boolean isManualTemporaryUpperCase() { return mKeyboardShiftState.isManualTemporaryUpperCase(); } public boolean isManualTemporaryUpperCaseFromAuto() { return mKeyboardShiftState.isManualTemporaryUpperCaseFromAuto(); } private void setShifted(int shiftMode) { if (DEBUG_STATE) { Log.d(TAG, "setShifted: shiftMode=" + shiftModeToString(shiftMode)); Loading @@ -185,7 +169,7 @@ public class KeyboardState { // state when shift key is pressed to go to normal mode. // On the other hand, on distinct multi touch panel device, turning off the shift // locked state with shift key pressing is handled by onReleaseShift(). if (!mHasDistinctMultitouch && !shifted && isShiftLocked()) { if (!mHasDistinctMultitouch && !shifted && mKeyboardShiftState.isShiftLocked()) { mKeyboardShiftState.setShiftLocked(false); } mKeyboardShiftState.setShifted(shifted); Loading Loading @@ -233,7 +217,7 @@ public class KeyboardState { if (DEBUG_STATE) { Log.d(TAG, "setSymbolsKeyboard"); } mPrevMainKeyboardWasShiftLocked = isShiftLocked(); mPrevMainKeyboardWasShiftLocked = mKeyboardShiftState.isShiftLocked(); mSwitchActions.setSymbolsKeyboard(); mIsAlphabetMode = false; mIsSymbolShifted = false; Loading Loading @@ -284,7 +268,7 @@ public class KeyboardState { Log.d(TAG, "onUpdateShiftState: " + this + " autoCaps=" + autoCaps); } if (mIsAlphabetMode) { if (!isShiftLocked() && !mShiftKeyState.isIgnoring()) { if (!mKeyboardShiftState.isShiftLocked() && !mShiftKeyState.isIgnoring()) { if (mShiftKeyState.isReleasing() && autoCaps) { // Only when shift key is releasing, automatic temporary upper case will be set. setShifted(SwitchActions.AUTOMATIC_SHIFT); Loading @@ -305,17 +289,17 @@ public class KeyboardState { Log.d(TAG, "onPressShift: " + this + " sliding=" + withSliding); } if (mIsAlphabetMode) { if (isShiftLocked()) { if (mKeyboardShiftState.isShiftLocked()) { // Shift key is pressed while caps lock state, we will treat this state as shifted // caps lock state and mark as if shift key pressed while normal state. setShifted(SwitchActions.MANUAL_SHIFT); mShiftKeyState.onPress(); } else if (isAutomaticTemporaryUpperCase()) { } else if (mKeyboardShiftState.isAutomaticTemporaryUpperCase()) { // Shift key is pressed while automatic temporary upper case, we have to move to // manual temporary upper case. setShifted(SwitchActions.MANUAL_SHIFT); mShiftKeyState.onPress(); } else if (isShiftedOrShiftLocked()) { } else if (mKeyboardShiftState.isShiftedOrShiftLocked()) { // In manual upper case state, we just record shift key has been pressing while // shifted state. mShiftKeyState.onPressOnShifted(); Loading @@ -337,22 +321,23 @@ public class KeyboardState { Log.d(TAG, "onReleaseShift: " + this + " sliding=" + withSliding); } if (mIsAlphabetMode) { final boolean isShiftLocked = isShiftLocked(); final boolean isShiftLocked = mKeyboardShiftState.isShiftLocked(); if (mShiftKeyState.isMomentary()) { // After chording input while normal state. setShifted(SwitchActions.UNSHIFT); } else if (isShiftLocked && !isShiftLockShifted() && (mShiftKeyState.isPressing() || mShiftKeyState.isPressingOnShifted()) && !withSliding) { } else if (isShiftLocked && !mKeyboardShiftState.isShiftLockShifted() && (mShiftKeyState.isPressing() || mShiftKeyState.isPressingOnShifted()) && !withSliding) { // Shift has been long pressed, ignore this release. } else if (isShiftLocked && !mShiftKeyState.isIgnoring() && !withSliding) { // Shift has been pressed without chording while caps lock state. setShiftLocked(false); } else if (isShiftedOrShiftLocked() && mShiftKeyState.isPressingOnShifted() && !withSliding) { } else if (mKeyboardShiftState.isShiftedOrShiftLocked() && mShiftKeyState.isPressingOnShifted() && !withSliding) { // Shift has been pressed without chording while shifted state. setShifted(SwitchActions.UNSHIFT); } else if (isManualTemporaryUpperCaseFromAuto() && mShiftKeyState.isPressing() && !withSliding) { } else if (mKeyboardShiftState.isManualTemporaryUpperCaseFromAuto() && mShiftKeyState.isPressing() && !withSliding) { // Shift has been pressed without chording while manual temporary upper case // transited from automatic temporary upper case. setShifted(SwitchActions.UNSHIFT); Loading Loading @@ -468,7 +453,7 @@ public class KeyboardState { Log.d(TAG, "onToggleShift: " + this); } if (mIsAlphabetMode) { setShifted(isShiftedOrShiftLocked() setShifted(mKeyboardShiftState.isShiftedOrShiftLocked() ? SwitchActions.UNSHIFT : SwitchActions.MANUAL_SHIFT); } else { toggleShiftInSymbols(); Loading @@ -480,7 +465,7 @@ public class KeyboardState { Log.d(TAG, "onToggleCapsLock: " + this); } if (mIsAlphabetMode) { if (isShiftLocked()) { if (mKeyboardShiftState.isShiftLocked()) { setShiftLocked(false); // Shift key is long pressed while caps lock state, we will toggle back to normal // state. And mark as if shift key is released. Loading @@ -506,6 +491,7 @@ public class KeyboardState { default: return null; } } private static String switchStateToString(int switchState) { switch (switchState) { case SWITCH_STATE_ALPHA: return "ALPHA"; Loading java/src/com/android/inputmethod/latin/LatinIME.java +3 −21 Original line number Diff line number Diff line Loading @@ -78,7 +78,6 @@ import java.util.Locale; public class LatinIME extends InputMethodServiceCompatWrapper implements KeyboardActionListener, SuggestionsView.Listener { private static final String TAG = LatinIME.class.getSimpleName(); private static final boolean PERF_DEBUG = false; private static final boolean TRACE = false; private static boolean DEBUG; Loading Loading @@ -1577,7 +1576,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } switcher.updateShiftState(); if (LatinIME.PERF_DEBUG) measureCps(); TextEntryState.typedCharacter((char) code, mSettingsValues.isWordSeparator(code), x, y); if (null != ic) ic.endBatchEdit(); } Loading Loading @@ -2478,7 +2476,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar final Printer p = new PrintWriterPrinter(fout); p.println("LatinIME state :"); p.println(" Keyboard mode = " + mKeyboardSwitcher.getKeyboardMode()); final Keyboard keyboard = mKeyboardSwitcher.getLatinKeyboard(); final int keyboardMode = keyboard != null ? keyboard.mId.mMode : -1; p.println(" Keyboard mode = " + keyboardMode); p.println(" mComposingStringBuilder=" + mComposingStringBuilder.toString()); p.println(" mIsSuggestionsRequested=" + mIsSettingsSuggestionStripOn); p.println(" mCorrectionMode=" + mCorrectionMode); Loading @@ -2491,22 +2491,4 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar p.println(" mVibrateOn=" + mSettingsValues.mVibrateOn); p.println(" mKeyPreviewPopupOn=" + mSettingsValues.mKeyPreviewPopupOn); } // Characters per second measurement private long mLastCpsTime; private static final int CPS_BUFFER_SIZE = 16; private long[] mCpsIntervals = new long[CPS_BUFFER_SIZE]; private int mCpsIndex; private void measureCps() { long now = System.currentTimeMillis(); if (mLastCpsTime == 0) mLastCpsTime = now - 100; // Initial mCpsIntervals[mCpsIndex] = now - mLastCpsTime; mLastCpsTime = now; mCpsIndex = (mCpsIndex + 1) % CPS_BUFFER_SIZE; long total = 0; for (int i = 0; i < CPS_BUFFER_SIZE; i++) total += mCpsIntervals[i]; System.out.println("CPS = " + ((CPS_BUFFER_SIZE * 1000f) / total)); } } Loading
java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +12 −13 Original line number Diff line number Diff line Loading @@ -274,18 +274,25 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions, voiceKeyEnabled, hasShortcutKey); } public int getKeyboardMode() { return mCurrentId != null ? mCurrentId.mMode : KeyboardId.MODE_TEXT; } public boolean isAlphabetMode() { return mState.isAlphabetMode(); final Keyboard keyboard = getLatinKeyboard(); return keyboard != null && keyboard.mId.isAlphabetKeyboard(); } public boolean isInputViewShown() { return mCurrentInputView != null && mCurrentInputView.isShown(); } public boolean isShiftedOrShiftLocked() { final Keyboard keyboard = getLatinKeyboard(); return keyboard != null && keyboard.isShiftedOrShiftLocked(); } public boolean isManualTemporaryUpperCase() { final Keyboard keyboard = getLatinKeyboard(); return keyboard != null && keyboard.isManualTemporaryUpperCase(); } public boolean isKeyboardAvailable() { if (mKeyboardView != null) return mKeyboardView.getKeyboard() != null; Loading @@ -301,14 +308,6 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions, return null; } public boolean isShiftedOrShiftLocked() { return mState.isShiftedOrShiftLocked(); } public boolean isManualTemporaryUpperCase() { return mState.isManualTemporaryUpperCase(); } // Implements {@link KeyboardState.SwitchActions}. @Override public void setShifted(int shiftMode) { Loading
java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +27 −41 Original line number Diff line number Diff line Loading @@ -26,11 +26,13 @@ import com.android.inputmethod.keyboard.Keyboard; * Keyboard state machine. * * This class contains all keyboard state transition logic. * * The input events are {@link #onLoadKeyboard(String, boolean)}, {@link #onSaveKeyboardState()}, * {@link #onPressShift(boolean)}, {@link #onReleaseShift(boolean)}, {@link #onPressSymbol()}, * {@link #onReleaseSymbol()}, {@link #onOtherKeyPressed()}, {@link #onCodeInput(int, boolean)}, * {@link #onCancelInput(boolean)}, {@link #onUpdateShiftState(boolean)}, {@link #onToggleShift()}, * {@link #onToggleCapsLock()}, and {@link #onToggleAlphabetAndSymbols()}. * * The actions are {@link SwitchActions}'s methods. */ public class KeyboardState { Loading @@ -39,12 +41,16 @@ public class KeyboardState { public interface SwitchActions { public void setAlphabetKeyboard(); public static final int UNSHIFT = 0; public static final int MANUAL_SHIFT = 1; public static final int AUTOMATIC_SHIFT = 2; public void setShifted(int shiftMode); public void setShiftLocked(boolean shiftLocked); public void setSymbolsKeyboard(); public void setSymbolsShiftedKeyboard(); } Loading Loading @@ -103,8 +109,9 @@ public class KeyboardState { final SavedKeyboardState state = mSavedKeyboardState; state.mIsAlphabetMode = mIsAlphabetMode; if (mIsAlphabetMode) { state.mIsShiftLocked = isShiftLocked(); state.mIsShifted = !state.mIsShiftLocked && isShiftedOrShiftLocked(); state.mIsShiftLocked = mKeyboardShiftState.isShiftLocked(); state.mIsShifted = !state.mIsShiftLocked && mKeyboardShiftState.isShiftedOrShiftLocked(); } else { state.mIsShiftLocked = false; state.mIsShifted = mIsSymbolShifted; Loading Loading @@ -144,34 +151,11 @@ public class KeyboardState { } } public boolean isAlphabetMode() { return mIsAlphabetMode; } // TODO: Remove this method. public boolean isShiftLocked() { return mKeyboardShiftState.isShiftLocked(); } public boolean isShiftLockShifted() { return mKeyboardShiftState.isShiftLockShifted(); } public boolean isShiftedOrShiftLocked() { return mKeyboardShiftState.isShiftedOrShiftLocked(); } public boolean isAutomaticTemporaryUpperCase() { return mKeyboardShiftState.isAutomaticTemporaryUpperCase(); } public boolean isManualTemporaryUpperCase() { return mKeyboardShiftState.isManualTemporaryUpperCase(); } public boolean isManualTemporaryUpperCaseFromAuto() { return mKeyboardShiftState.isManualTemporaryUpperCaseFromAuto(); } private void setShifted(int shiftMode) { if (DEBUG_STATE) { Log.d(TAG, "setShifted: shiftMode=" + shiftModeToString(shiftMode)); Loading @@ -185,7 +169,7 @@ public class KeyboardState { // state when shift key is pressed to go to normal mode. // On the other hand, on distinct multi touch panel device, turning off the shift // locked state with shift key pressing is handled by onReleaseShift(). if (!mHasDistinctMultitouch && !shifted && isShiftLocked()) { if (!mHasDistinctMultitouch && !shifted && mKeyboardShiftState.isShiftLocked()) { mKeyboardShiftState.setShiftLocked(false); } mKeyboardShiftState.setShifted(shifted); Loading Loading @@ -233,7 +217,7 @@ public class KeyboardState { if (DEBUG_STATE) { Log.d(TAG, "setSymbolsKeyboard"); } mPrevMainKeyboardWasShiftLocked = isShiftLocked(); mPrevMainKeyboardWasShiftLocked = mKeyboardShiftState.isShiftLocked(); mSwitchActions.setSymbolsKeyboard(); mIsAlphabetMode = false; mIsSymbolShifted = false; Loading Loading @@ -284,7 +268,7 @@ public class KeyboardState { Log.d(TAG, "onUpdateShiftState: " + this + " autoCaps=" + autoCaps); } if (mIsAlphabetMode) { if (!isShiftLocked() && !mShiftKeyState.isIgnoring()) { if (!mKeyboardShiftState.isShiftLocked() && !mShiftKeyState.isIgnoring()) { if (mShiftKeyState.isReleasing() && autoCaps) { // Only when shift key is releasing, automatic temporary upper case will be set. setShifted(SwitchActions.AUTOMATIC_SHIFT); Loading @@ -305,17 +289,17 @@ public class KeyboardState { Log.d(TAG, "onPressShift: " + this + " sliding=" + withSliding); } if (mIsAlphabetMode) { if (isShiftLocked()) { if (mKeyboardShiftState.isShiftLocked()) { // Shift key is pressed while caps lock state, we will treat this state as shifted // caps lock state and mark as if shift key pressed while normal state. setShifted(SwitchActions.MANUAL_SHIFT); mShiftKeyState.onPress(); } else if (isAutomaticTemporaryUpperCase()) { } else if (mKeyboardShiftState.isAutomaticTemporaryUpperCase()) { // Shift key is pressed while automatic temporary upper case, we have to move to // manual temporary upper case. setShifted(SwitchActions.MANUAL_SHIFT); mShiftKeyState.onPress(); } else if (isShiftedOrShiftLocked()) { } else if (mKeyboardShiftState.isShiftedOrShiftLocked()) { // In manual upper case state, we just record shift key has been pressing while // shifted state. mShiftKeyState.onPressOnShifted(); Loading @@ -337,22 +321,23 @@ public class KeyboardState { Log.d(TAG, "onReleaseShift: " + this + " sliding=" + withSliding); } if (mIsAlphabetMode) { final boolean isShiftLocked = isShiftLocked(); final boolean isShiftLocked = mKeyboardShiftState.isShiftLocked(); if (mShiftKeyState.isMomentary()) { // After chording input while normal state. setShifted(SwitchActions.UNSHIFT); } else if (isShiftLocked && !isShiftLockShifted() && (mShiftKeyState.isPressing() || mShiftKeyState.isPressingOnShifted()) && !withSliding) { } else if (isShiftLocked && !mKeyboardShiftState.isShiftLockShifted() && (mShiftKeyState.isPressing() || mShiftKeyState.isPressingOnShifted()) && !withSliding) { // Shift has been long pressed, ignore this release. } else if (isShiftLocked && !mShiftKeyState.isIgnoring() && !withSliding) { // Shift has been pressed without chording while caps lock state. setShiftLocked(false); } else if (isShiftedOrShiftLocked() && mShiftKeyState.isPressingOnShifted() && !withSliding) { } else if (mKeyboardShiftState.isShiftedOrShiftLocked() && mShiftKeyState.isPressingOnShifted() && !withSliding) { // Shift has been pressed without chording while shifted state. setShifted(SwitchActions.UNSHIFT); } else if (isManualTemporaryUpperCaseFromAuto() && mShiftKeyState.isPressing() && !withSliding) { } else if (mKeyboardShiftState.isManualTemporaryUpperCaseFromAuto() && mShiftKeyState.isPressing() && !withSliding) { // Shift has been pressed without chording while manual temporary upper case // transited from automatic temporary upper case. setShifted(SwitchActions.UNSHIFT); Loading Loading @@ -468,7 +453,7 @@ public class KeyboardState { Log.d(TAG, "onToggleShift: " + this); } if (mIsAlphabetMode) { setShifted(isShiftedOrShiftLocked() setShifted(mKeyboardShiftState.isShiftedOrShiftLocked() ? SwitchActions.UNSHIFT : SwitchActions.MANUAL_SHIFT); } else { toggleShiftInSymbols(); Loading @@ -480,7 +465,7 @@ public class KeyboardState { Log.d(TAG, "onToggleCapsLock: " + this); } if (mIsAlphabetMode) { if (isShiftLocked()) { if (mKeyboardShiftState.isShiftLocked()) { setShiftLocked(false); // Shift key is long pressed while caps lock state, we will toggle back to normal // state. And mark as if shift key is released. Loading @@ -506,6 +491,7 @@ public class KeyboardState { default: return null; } } private static String switchStateToString(int switchState) { switch (switchState) { case SWITCH_STATE_ALPHA: return "ALPHA"; Loading
java/src/com/android/inputmethod/latin/LatinIME.java +3 −21 Original line number Diff line number Diff line Loading @@ -78,7 +78,6 @@ import java.util.Locale; public class LatinIME extends InputMethodServiceCompatWrapper implements KeyboardActionListener, SuggestionsView.Listener { private static final String TAG = LatinIME.class.getSimpleName(); private static final boolean PERF_DEBUG = false; private static final boolean TRACE = false; private static boolean DEBUG; Loading Loading @@ -1577,7 +1576,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } switcher.updateShiftState(); if (LatinIME.PERF_DEBUG) measureCps(); TextEntryState.typedCharacter((char) code, mSettingsValues.isWordSeparator(code), x, y); if (null != ic) ic.endBatchEdit(); } Loading Loading @@ -2478,7 +2476,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar final Printer p = new PrintWriterPrinter(fout); p.println("LatinIME state :"); p.println(" Keyboard mode = " + mKeyboardSwitcher.getKeyboardMode()); final Keyboard keyboard = mKeyboardSwitcher.getLatinKeyboard(); final int keyboardMode = keyboard != null ? keyboard.mId.mMode : -1; p.println(" Keyboard mode = " + keyboardMode); p.println(" mComposingStringBuilder=" + mComposingStringBuilder.toString()); p.println(" mIsSuggestionsRequested=" + mIsSettingsSuggestionStripOn); p.println(" mCorrectionMode=" + mCorrectionMode); Loading @@ -2491,22 +2491,4 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar p.println(" mVibrateOn=" + mSettingsValues.mVibrateOn); p.println(" mKeyPreviewPopupOn=" + mSettingsValues.mKeyPreviewPopupOn); } // Characters per second measurement private long mLastCpsTime; private static final int CPS_BUFFER_SIZE = 16; private long[] mCpsIntervals = new long[CPS_BUFFER_SIZE]; private int mCpsIndex; private void measureCps() { long now = System.currentTimeMillis(); if (mLastCpsTime == 0) mLastCpsTime = now - 100; // Initial mCpsIntervals[mCpsIndex] = now - mLastCpsTime; mLastCpsTime = now; mCpsIndex = (mCpsIndex + 1) % CPS_BUFFER_SIZE; long total = 0; for (int i = 0; i < CPS_BUFFER_SIZE; i++) total += mCpsIntervals[i]; System.out.println("CPS = " + ((CPS_BUFFER_SIZE * 1000f) / total)); } }