Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#pubctors) \| [Methods](https://developer.android.com/reference/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#inhmethods)

# AbstractInputMethodService.AbstractInputMethodSessionImpl

*** ** * ** ***


`
public


abstract
class
AbstractInputMethodService.AbstractInputMethodSessionImpl
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/android/view/inputmethod/InputMethodSession


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodSessionImpl |

|---|
| Known direct subclasses [InputMethodService.InputMethodSessionImpl](https://developer.android.com/reference/android/inputmethodservice/InputMethodService.InputMethodSessionImpl) |---|---| | [InputMethodService.InputMethodSessionImpl](https://developer.android.com/reference/android/inputmethodservice/InputMethodService.InputMethodSessionImpl) | Concrete implementation of `https://developer.android.com/reference/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl` that provides all of the standard behavior for an input method session. | |

<br />

*** ** * ** ***

Base class for derived classes to implement their `https://developer.android.com/reference/android/view/inputmethod/InputMethodSession`
interface. This takes care of basic maintenance of the session,
but most behavior must be implemented in a derived class.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#AbstractInputMethodSessionImpl()() ` |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#dispatchGenericMotionEvent(int,%20android.view.MotionEvent,%20android.view.inputmethod.InputMethodSession.EventCallback)(int seq, https://developer.android.com/reference/android/view/MotionEvent event, https://developer.android.com/reference/android/view/inputmethod/InputMethodSession.EventCallback callback) ` Take care of dispatching incoming generic motion events to the appropriate callbacks on the service, and tell the client when this is done. |
| ` void` | ` https://developer.android.com/reference/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#dispatchKeyEvent(int,%20android.view.KeyEvent,%20android.view.inputmethod.InputMethodSession.EventCallback)(int seq, https://developer.android.com/reference/android/view/KeyEvent event, https://developer.android.com/reference/android/view/inputmethod/InputMethodSession.EventCallback callback) ` Take care of dispatching incoming key events to the appropriate callbacks on the service, and tell the client when this is done. |
| ` void` | ` https://developer.android.com/reference/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#dispatchTrackballEvent(int,%20android.view.MotionEvent,%20android.view.inputmethod.InputMethodSession.EventCallback)(int seq, https://developer.android.com/reference/android/view/MotionEvent event, https://developer.android.com/reference/android/view/inputmethod/InputMethodSession.EventCallback callback) ` Take care of dispatching incoming trackball events to the appropriate callbacks on the service, and tell the client when this is done. |
| ` boolean` | ` https://developer.android.com/reference/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#isEnabled()() ` Check whether this session has been enabled by the system. |
| ` boolean` | ` https://developer.android.com/reference/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#isRevoked()() ` Check whether this session has been revoked by the system. |
| ` boolean` | ` https://developer.android.com/reference/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#onShouldVerifyKeyEvent(android.view.KeyEvent)(https://developer.android.com/reference/android/view/KeyEvent event) ` |
| ` void` | ` https://developer.android.com/reference/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#revokeSelf()() ` Revoke the session from the client. |
| ` void` | ` https://developer.android.com/reference/android/inputmethodservice/AbstractInputMethodService.AbstractInputMethodSessionImpl#setEnabled(boolean)(boolean enabled) ` Change the enabled state of the session. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||
| From interface ` https://developer.android.com/reference/android/view/inputmethod/InputMethodSession ` |---|---| | ` abstract void` | ` https://developer.android.com/reference/android/view/inputmethod/InputMethodSession#appPrivateCommand(java.lang.String,%20android.os.Bundle)(https://developer.android.com/reference/java/lang/String action, https://developer.android.com/reference/android/os/Bundle data) ` Process a private command sent from the application to the input method. | | ` abstract void` | ` https://developer.android.com/reference/android/view/inputmethod/InputMethodSession#dispatchGenericMotionEvent(int,%20android.view.MotionEvent,%20android.view.inputmethod.InputMethodSession.EventCallback)(int seq, https://developer.android.com/reference/android/view/MotionEvent event, https://developer.android.com/reference/android/view/inputmethod/InputMethodSession.EventCallback callback) ` This method is called when there is a generic motion event. | | ` abstract void` | ` https://developer.android.com/reference/android/view/inputmethod/InputMethodSession#dispatchKeyEvent(int,%20android.view.KeyEvent,%20android.view.inputmethod.InputMethodSession.EventCallback)(int seq, https://developer.android.com/reference/android/view/KeyEvent event, https://developer.android.com/reference/android/view/inputmethod/InputMethodSession.EventCallback callback) ` This method is called when a key is pressed. | | ` abstract void` | ` https://developer.android.com/reference/android/view/inputmethod/InputMethodSession#dispatchTrackballEvent(int,%20android.view.MotionEvent,%20android.view.inputmethod.InputMethodSession.EventCallback)(int seq, https://developer.android.com/reference/android/view/MotionEvent event, https://developer.android.com/reference/android/view/inputmethod/InputMethodSession.EventCallback callback) ` This method is called when there is a track ball event. | | ` abstract void` | ` https://developer.android.com/reference/android/view/inputmethod/InputMethodSession#displayCompletions(android.view.inputmethod.CompletionInfo[])(https://developer.android.com/reference/android/view/inputmethod/CompletionInfo completions) ` Called by a text editor that performs auto completion, to tell the input method about the completions it has available. | | ` abstract void` | ` https://developer.android.com/reference/android/view/inputmethod/InputMethodSession#finishInput()() ` This method is called when the application would like to stop receiving text input. | | ` abstract void` | ` https://developer.android.com/reference/android/view/inputmethod/InputMethodSession#toggleSoftInput(int,%20int)(int showFlags, int hideFlags) ` *This method was deprecated in API level 31. Starting in `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S` the system no longer invokes this method, instead it explicitly shows or hides the IME. An `InputMethodService` wishing to toggle its own visibility should instead invoke `https://developer.android.com/reference/android/inputmethodservice/InputMethodService#requestShowSelf(int)` or `https://developer.android.com/reference/android/inputmethodservice/InputMethodService#requestHideSelf(int)`* | | ` abstract void` | ` https://developer.android.com/reference/android/view/inputmethod/InputMethodSession#updateCursor(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect newCursor) ` This method is called when cursor location of the target input field has changed within its window. | | ` abstract void` | ` https://developer.android.com/reference/android/view/inputmethod/InputMethodSession#updateCursorAnchorInfo(android.view.inputmethod.CursorAnchorInfo)(https://developer.android.com/reference/android/view/inputmethod/CursorAnchorInfo cursorAnchorInfo) ` This method is called when the cursor and/or the character position relevant to text input is changed on the screen. | | ` abstract void` | ` https://developer.android.com/reference/android/view/inputmethod/InputMethodSession#updateExtractedText(int,%20android.view.inputmethod.ExtractedText)(int token, https://developer.android.com/reference/android/view/inputmethod/ExtractedText text) ` Called by a text editor to report its new extracted text when its contents change. | | ` abstract void` | ` https://developer.android.com/reference/android/view/inputmethod/InputMethodSession#updateSelection(int,%20int,%20int,%20int,%20int,%20int)(int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd) ` This method is called when the selection or cursor in the current target input field has changed. | | ` abstract void` | ` https://developer.android.com/reference/android/view/inputmethod/InputMethodSession#viewClicked(boolean)(boolean focusChanged) ` This method is called when the user tapped a text view. | ||

## Public constructors

### AbstractInputMethodSessionImpl

```
public AbstractInputMethodSessionImpl ()
```

<br />

<br />

## Public methods

### dispatchGenericMotionEvent

Added in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void dispatchGenericMotionEvent (int seq, 
                MotionEvent event, 
                InputMethodSession.EventCallback callback)
```

Take care of dispatching incoming generic motion events to the appropriate
callbacks on the service, and tell the client when this is done.

<br />

| Parameters ||
|---|---|
| `seq` | `int` <br /> |
| `event` | `MotionEvent`: The motion event. <br /> |
| `callback` | `InputMethodSession.EventCallback` <br /> |

| Returns ||
|---|---|
| `void` | Whether the input method wants to handle this event. <br /> |

### dispatchKeyEvent

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void dispatchKeyEvent (int seq, 
                KeyEvent event, 
                InputMethodSession.EventCallback callback)
```

Take care of dispatching incoming key events to the appropriate
callbacks on the service, and tell the client when this is done.

<br />

| Parameters ||
|---|---|
| `seq` | `int` <br /> |
| `event` | `KeyEvent`: The key event. <br /> |
| `callback` | `InputMethodSession.EventCallback` <br /> |

| Returns ||
|---|---|
| `void` | Whether the input method wants to handle this event. <br /> |

### dispatchTrackballEvent

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void dispatchTrackballEvent (int seq, 
                MotionEvent event, 
                InputMethodSession.EventCallback callback)
```

Take care of dispatching incoming trackball events to the appropriate
callbacks on the service, and tell the client when this is done.

<br />

| Parameters ||
|---|---|
| `seq` | `int` <br /> |
| `event` | `MotionEvent`: The motion event. <br /> |
| `callback` | `InputMethodSession.EventCallback` <br /> |

| Returns ||
|---|---|
| `void` | Whether the input method wants to handle this event. <br /> |

### isEnabled

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isEnabled ()
```

Check whether this session has been enabled by the system. If not
enabled, you should not execute any calls on to it.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### isRevoked

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isRevoked ()
```

Check whether this session has been revoked by the system. Revoked
session is also always disabled, so there is generally no need to
explicitly check for this.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### onShouldVerifyKeyEvent

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean onShouldVerifyKeyEvent (KeyEvent event)
```

<br />

<br />

| Parameters ||
|---|---|
| `event` | `KeyEvent`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### revokeSelf

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void revokeSelf ()
```

Revoke the session from the client. This disabled the session, and
prevents it from ever being enabled again.

<br />

### setEnabled

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setEnabled (boolean enabled)
```

Change the enabled state of the session. This only works if the
session has not been revoked.

<br />

| Parameters ||
|---|---|
| `enabled` | `boolean` <br /> |