Merge "Cleanup."
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 4bee987..75ba24d7 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -171,10 +171,8 @@
 
         public void onCreate() {
             final Resources res = getOwnerInstance().getResources();
-            mDelayUpdateSuggestions =
-                    res.getInteger(R.integer.config_delay_update_suggestions);
-            mDelayUpdateShiftState =
-                    res.getInteger(R.integer.config_delay_update_shift_state);
+            mDelayUpdateSuggestions = res.getInteger(R.integer.config_delay_update_suggestions);
+            mDelayUpdateShiftState = res.getInteger(R.integer.config_delay_update_shift_state);
             mDoubleSpacePeriodTimeout =
                     res.getInteger(R.integer.config_double_space_period_timeout);
         }
@@ -339,12 +337,15 @@
 
         private void executePendingImsCallback(final LatinIME latinIme, final EditorInfo editorInfo,
                 boolean restarting) {
-            if (mHasPendingFinishInputView)
+            if (mHasPendingFinishInputView) {
                 latinIme.onFinishInputViewInternal(mHasPendingFinishInput);
-            if (mHasPendingFinishInput)
+            }
+            if (mHasPendingFinishInput) {
                 latinIme.onFinishInputInternal();
-            if (mHasPendingStartInput)
+            }
+            if (mHasPendingStartInput) {
                 latinIme.onStartInputInternal(editorInfo, restarting);
+            }
             resetPendingImsCallback();
         }
 
@@ -579,9 +580,8 @@
                 (mInputLogic.mSuggest == null) ? null : mInputLogic.mSuggest.mDictionaryFacilitator;
         // Creates new dictionary facilitator for the new locale.
         final DictionaryFacilitatorForSuggest dictionaryFacilitator =
-                new DictionaryFacilitatorForSuggest(this /* context */, locale,
-                        settingsValues, this /* DictionaryInitializationListener */,
-                        oldDictionaryFacilitator);
+                new DictionaryFacilitatorForSuggest(this /* context */, locale, settingsValues,
+                        this /* DictionaryInitializationListener */, oldDictionaryFacilitator);
         final Suggest newSuggest = new Suggest(locale, dictionaryFacilitator);
         if (settingsValues.mCorrectionEnabled) {
             newSuggest.setAutoCorrectionThreshold(settingsValues.mAutoCorrectionThreshold);
@@ -658,7 +658,7 @@
                 .findViewById(android.R.id.extractArea);
         mKeyPreviewBackingView = view.findViewById(R.id.key_preview_backing);
         mSuggestionStripView = (SuggestionStripView)view.findViewById(R.id.suggestion_strip_view);
-        if (mSuggestionStripView != null) {
+        if (hasSuggestionStripView()) {
             mSuggestionStripView.setListener(this, view);
         }
         if (LatinImeLogger.sVISUALDEBUG) {
@@ -738,13 +738,11 @@
             ResearchLogger.latinIME_onStartInputViewInternal(editorInfo, prefs);
         }
         if (InputAttributes.inPrivateImeOptions(null, NO_MICROPHONE_COMPAT, editorInfo)) {
-            Log.w(TAG, "Deprecated private IME option specified: "
-                    + editorInfo.privateImeOptions);
+            Log.w(TAG, "Deprecated private IME option specified: " + editorInfo.privateImeOptions);
             Log.w(TAG, "Use " + getPackageName() + "." + NO_MICROPHONE + " instead");
         }
         if (InputAttributes.inPrivateImeOptions(getPackageName(), FORCE_ASCII, editorInfo)) {
-            Log.w(TAG, "Deprecated private IME option specified: "
-                    + editorInfo.privateImeOptions);
+            Log.w(TAG, "Deprecated private IME option specified: " + editorInfo.privateImeOptions);
             Log.w(TAG, "Use EditorInfo.IME_FLAG_FORCE_ASCII flag instead");
         }
 
@@ -890,12 +888,9 @@
         super.onUpdateSelection(oldSelStart, oldSelEnd, newSelStart, newSelEnd,
                 composingSpanStart, composingSpanEnd);
         if (DEBUG) {
-            Log.i(TAG, "onUpdateSelection: oss=" + oldSelStart
-                    + ", ose=" + oldSelEnd
-                    + ", nss=" + newSelStart
-                    + ", nse=" + newSelEnd
-                    + ", cs=" + composingSpanStart
-                    + ", ce=" + composingSpanEnd);
+            Log.i(TAG, "onUpdateSelection: oss=" + oldSelStart + ", ose=" + oldSelEnd
+                    + ", nss=" + newSelStart + ", nse=" + newSelEnd
+                    + ", cs=" + composingSpanStart + ", ce=" + composingSpanEnd);
         }
         if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
             ResearchLogger.latinIME_onUpdateSelection(oldSelStart, oldSelEnd,
@@ -1009,7 +1004,7 @@
     private void setSuggestionStripShownInternal(final boolean isSuggestionStripVisible,
             final boolean needsInputViewShown) {
         // TODO: Modify this if we support suggestions with hard keyboard
-        if (!onEvaluateInputViewShown() || null == mSuggestionStripView) {
+        if (!onEvaluateInputViewShown() || !hasSuggestionStripView()) {
             return;
         }
         final boolean inputViewShown = mKeyboardSwitcher.isShowingMainKeyboardOrEmojiPalettes();
@@ -1053,7 +1048,7 @@
     public void onComputeInsets(final InputMethodService.Insets outInsets) {
         super.onComputeInsets(outInsets);
         final View visibleKeyboardView = mKeyboardSwitcher.getVisibleKeyboardView();
-        if (visibleKeyboardView == null || mSuggestionStripView == null) {
+        if (visibleKeyboardView == null || !hasSuggestionStripView()) {
             return;
         }
         final int adjustedBackingHeight = getAdjustedBackingViewHeight();
@@ -1192,7 +1187,9 @@
     }
 
     public void displaySettingsDialog() {
-        if (isShowingOptionDialog()) return;
+        if (isShowingOptionDialog()) {
+            return;
+        }
         showSubtypeSelectorAndSettings();
     }
 
@@ -1252,8 +1249,8 @@
             mSubtypeSwitcher.switchToShortcutIME(this);
             // Still call the *#onCodeInput methods for readability.
         }
-        mInputLogic.onCodeInput(codeToSend, keyX, keyY, mSettings.getCurrent(),
-                mHandler, mKeyboardSwitcher);
+        mInputLogic.onCodeInput(codeToSend, keyX, keyY, mSettings.getCurrent(), mHandler,
+                mKeyboardSwitcher);
         mKeyboardSwitcher.onCodeInput(codePoint);
     }
 
@@ -1312,13 +1309,13 @@
 
     // TODO[IL]: Define a clear interface for this
     public boolean isSuggestionStripVisible() {
-        final SettingsValues currentSettings = mSettings.getCurrent();
-        if (mSuggestionStripView == null) {
+        if (!hasSuggestionStripView()) {
             return false;
         }
         if (mSuggestionStripView.isShowingAddToDictionaryHint()) {
             return true;
         }
+        final SettingsValues currentSettings = mSettings.getCurrent();
         if (null == currentSettings) {
             return false;
         }
@@ -1347,16 +1344,17 @@
 
     @Override
     public void dismissAddToDictionaryHint() {
-        if (null != mSuggestionStripView) {
-            mSuggestionStripView.dismissAddToDictionaryHint();
+        if (!hasSuggestionStripView()) {
+            return;
         }
+        mSuggestionStripView.dismissAddToDictionaryHint();
     }
 
     // TODO[IL]: Define a clear interface for this
     public void setSuggestedWords(final SuggestedWords suggestedWords,
             final boolean isSuggestionStripVisible, final boolean needsInputViewShown) {
         mInputLogic.setSuggestedWords(suggestedWords);
-        if (mSuggestionStripView == null) {
+        if (!hasSuggestionStripView()) {
             return;
         }
         final SettingsValues currentSettings = mSettings.getCurrent();
@@ -1413,9 +1411,9 @@
         }
         suggest.getSuggestedWords(mInputLogic.mWordComposer,
                 mInputLogic.mWordComposer.getPreviousWordForSuggestion(),
-                keyboard.getProximityInfo(),
-                currentSettings.mBlockPotentiallyOffensive, currentSettings.mCorrectionEnabled,
-                additionalFeaturesOptions, sessionId, sequenceNumber, callback);
+                keyboard.getProximityInfo(), currentSettings.mBlockPotentiallyOffensive,
+                currentSettings.mCorrectionEnabled, additionalFeaturesOptions, sessionId,
+                sequenceNumber, callback);
     }
 
     // TODO[IL]: Move this to InputLogic
@@ -1429,7 +1427,7 @@
         // the "add to dictionary" hint, we need to revert to suggestions - although it is unclear
         // how we can come here if it's displayed.
         if (suggestedWords.size() > 1 || typedWord.length() <= 1
-                || null == mSuggestionStripView || isShowingAddToDictionaryHint()) {
+                || !hasSuggestionStripView() || isShowingAddToDictionaryHint()) {
             return suggestedWords;
         } else {
             final SuggestedWords punctuationList =
@@ -1439,10 +1437,8 @@
             final ArrayList<SuggestedWords.SuggestedWordInfo> typedWordAndPreviousSuggestions =
                     SuggestedWords.getTypedWordAndPreviousSuggestions(typedWord, oldSuggestedWords);
             return new SuggestedWords(typedWordAndPreviousSuggestions, null /* rawSuggestions */,
-                    false /* typedWordValid */,
-                    false /* hasAutoCorrectionCandidate */,
-                    true /* isObsoleteSuggestions */,
-                    false /* isPrediction */);
+                    false /* typedWordValid */, false /* hasAutoCorrectionCandidate */,
+                    true /* isObsoleteSuggestions */, false /* isPrediction */);
         }
     }
 
@@ -1481,7 +1477,9 @@
 
     @Override
     public void showAddToDictionaryHint(final String word) {
-        if (null == mSuggestionStripView) return;
+        if (!hasSuggestionStripView()) {
+            return;
+        }
         mSuggestionStripView.showAddToDictionaryHint(word);
     }