286 {
287 if (inputTarget.type == InputTarget.Type.NO_TARGET) {
288 lastInputConnection = null;
289 return null;
290 }
291
292 if (inputTarget.type == InputTarget.Type.PHYSICAL_DISPLAY_PLATFORM_VIEW) {
293 return null;
294 }
295
296 if (inputTarget.type == InputTarget.Type.VIRTUAL_DISPLAY_PLATFORM_VIEW) {
297 if (isInputConnectionLocked) {
298 return lastInputConnection;
299 }
300 lastInputConnection =
301 platformViewsController
303 .onCreateInputConnection(outAttrs);
304 return lastInputConnection;
305 }
306
307 outAttrs.inputType =
308 inputTypeFromTextInputType(
309 configuration.inputType,
310 configuration.obscureText,
311 configuration.autocorrect,
312 configuration.enableSuggestions,
313 configuration.enableIMEPersonalizedLearning,
314 configuration.textCapitalization);
315 outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN;
316
317 if (
Build.VERSION.SDK_INT >= API_LEVELS.API_26
318 && !configuration.enableIMEPersonalizedLearning) {
319 outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING;
320 }
321
322 int enterAction;
323 if (configuration.inputAction == null) {
324
325
326 enterAction =
327 (InputType.TYPE_TEXT_FLAG_MULTI_LINE & outAttrs.inputType) != 0
328 ? EditorInfo.IME_ACTION_NONE
329 : EditorInfo.IME_ACTION_DONE;
330 } else {
331 enterAction = configuration.inputAction;
332 }
333 if (configuration.actionLabel != null) {
334 outAttrs.actionLabel = configuration.actionLabel;
335 outAttrs.actionId = enterAction;
336 }
337 outAttrs.imeOptions |= enterAction;
338
339 if (configuration.contentCommitMimeTypes != null) {
340 String[] imgTypeString = configuration.contentCommitMimeTypes;
341 EditorInfoCompat.setContentMimeTypes(outAttrs, imgTypeString);
342 }
343
344 InputConnectionAdaptor connection =
345 new InputConnectionAdaptor(
346 view, inputTarget.id, textInputChannel, keyboardManager, mEditable, outAttrs);
349
350 lastInputConnection = connection;
351 return lastInputConnection;
352 }
final int getSelectionStart()
final int getSelectionEnd()