のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

No editor info for this field. Bug?

Cross Reference: /packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/InputAttributes.java

     57     public InputAttributes(final EditorInfo editorInfo, final boolean isFullscreenMode,
     58             final String packageNameForPrivateImeOptions) {
     59         mEditorInfo = editorInfo;
     60         mPackageNameForPrivateImeOptions = packageNameForPrivateImeOptions;
     61         mTargetApplicationPackageName = null != editorInfo ? editorInfo.packageName : null;
     62         final int inputType = null != editorInfo ? editorInfo.inputType : 0;
     63         final int inputClass = inputType & InputType.TYPE_MASK_CLASS;
     64         mInputType = inputType;
     65         mIsPasswordField = InputTypeUtils.isPasswordInputType(inputType)
     66                 || InputTypeUtils.isVisiblePasswordInputType(inputType);
     67         if (inputClass != InputType.TYPE_CLASS_TEXT) {
     68             // If we are not looking at a TYPE_CLASS_TEXT field, the following strange
     69             // cases may arise, so we do a couple sanity checks for them. If it's a
     70             // TYPE_CLASS_TEXT field, these special cases cannot happen, by construction
     71             // of the flags.
     72             if (null == editorInfo) {
     73                 Log.w(TAG, "No editor info for this field. Bug?"); <=======
     74             } else if (InputType.TYPE_NULL == inputType) {
     75                 // TODO: We should honor TYPE_NULL specification.
     76                 Log.i(TAG, "InputType.TYPE_NULL is specified");
     77             } else if (inputClass == 0) {
     78                 // TODO: is this check still necessary?
     79                 Log.w(TAG, String.format("Unexpected input class: inputType=0x%08x"
     80                         + " imeOptions=0x%08x", inputType, editorInfo.imeOptions));
     81             }
     82             mShouldShowSuggestions = false;
     83             mInputTypeNoAutoCorrect = false;
     84             mApplicationSpecifiedCompletionOn = false;
     85             mShouldInsertSpacesAutomatically = false;
     86             mShouldShowVoiceInputKey = false;
     87             mDisableGestureFloatingPreviewText = false;
     88             mIsGeneralTextInput = false;
     89             return;
     90         }
     91         // inputClass == InputType.TYPE_CLASS_TEXT
     92         final int variation = inputType & InputType.TYPE_MASK_VARIATION;
     93         final boolean flagNoSuggestions =
     94                 0 != (inputType & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
     95         final boolean flagMultiLine =
     96                 0 != (inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE);
     97         final boolean flagAutoCorrect =
     98                 0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
     99         final boolean flagAutoComplete =
    100                 0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
    101 
    102         // TODO: Have a helper method in InputTypeUtils
    103         // Make sure that passwords are not displayed in {@link SuggestionStripView}.
    104         final boolean shouldSuppressSuggestions = mIsPasswordField
    105                 || InputTypeUtils.isEmailVariation(variation)
    106                 || InputType.TYPE_TEXT_VARIATION_URI == variation
    107                 || InputType.TYPE_TEXT_VARIATION_FILTER == variation
    108                 || flagNoSuggestions
    109                 || flagAutoComplete;
    110         mShouldShowSuggestions = !shouldSuppressSuggestions;
    111 
    112         mShouldInsertSpacesAutomatically = InputTypeUtils.isAutoSpaceFriendlyType(inputType);
    113 
    114         final boolean noMicrophone = mIsPasswordField
    115                 || InputTypeUtils.isEmailVariation(variation)
    116                 || InputType.TYPE_TEXT_VARIATION_URI == variation
    117                 || hasNoMicrophoneKeyOption();
    118         mShouldShowVoiceInputKey = !noMicrophone;
    119 
    120         mDisableGestureFloatingPreviewText = InputAttributes.inPrivateImeOptions(
    121                 mPackageNameForPrivateImeOptions, NO_FLOATING_GESTURE_PREVIEW, editorInfo);
    122 
    123         // If it's a browser edit field and auto correct is not ON explicitly, then
    124         // disable auto correction, but keep suggestions on.
    125         // If NO_SUGGESTIONS is set, don't do prediction.
    126         // If it's not multiline and the autoCorrect flag is not set, then don't correct
    127         mInputTypeNoAutoCorrect =
    128                 (variation == InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT && !flagAutoCorrect)
    129                 || flagNoSuggestions
    130                 || (!flagAutoCorrect && !flagMultiLine);
    131 
    132         mApplicationSpecifiedCompletionOn = flagAutoComplete && isFullscreenMode;
    133 
    134         // If we come here, inputClass is always TYPE_CLASS_TEXT
    135         mIsGeneralTextInput = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS != variation
    136                 && InputType.TYPE_TEXT_VARIATION_PASSWORD != variation
    137                 && InputType.TYPE_TEXT_VARIATION_PHONETIC != variation
    138                 && InputType.TYPE_TEXT_VARIATION_URI != variation
    139                 && InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD != variation
    140                 && InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS != variation
    141                 && InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD != variation;
    142     }
    143