# Print output for @column tags ?>
public
abstract
class
AbstractInputMethodService
extends Service
implements
KeyEvent.Callback
java.lang.Object | ||||
↳ | android.content.Context | |||
↳ | android.content.ContextWrapper | |||
↳ | android.app.Service | |||
↳ | android.inputmethodservice.AbstractInputMethodService |
Known direct subclasses
|
AbstractInputMethodService provides a abstract base class for input methods.
Normal input method implementations will not derive from this directly,
instead building on top of InputMethodService
or another more
complete base class. Be sure to read InputMethod
for more
information on the basics of writing input methods.
This class combines a Service (representing the input method component to the system with the InputMethod interface that input methods must implement. This base class takes care of reporting your InputMethod from the service when clients bind to it, but provides no standard implementation of the InputMethod interface itself. Derived classes must implement that interface.
After Build.VERSION_CODES.S
, the maximum possible area to show the soft
input may not be the entire screen. For example, some devices may support to show the soft input
on only half of screen.
In that case, moving the soft input from one half screen to another will trigger a
Resources
update to match the new Configuration
and
this AbstractInputMethodService
may also receive a
Service.onConfigurationChanged(android.content.res.Configuration)
callback if there's notable configuration changes
See also:
Nested classes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
class |
AbstractInputMethodService.AbstractInputMethodImpl
Base class for derived classes to implement their |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
class |
AbstractInputMethodService.AbstractInputMethodSessionImpl
Base class for derived classes to implement their |
Inherited constants | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Service
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From class
android.content.Context
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
android.content.ComponentCallbacks2
|
Public constructors | |
---|---|
AbstractInputMethodService()
|
Public methods | |
---|---|
KeyEvent.DispatcherState
|
getKeyDispatcherState()
Return the global |
Object
|
getSystemService(String name)
Return the handle to a system-level service by name. |
final
IBinder
|
onBind(Intent intent)
Return the communication channel to the service. |
abstract
AbstractInputMethodService.AbstractInputMethodImpl
|
onCreateInputMethodInterface()
Called by the framework during initialization, when the InputMethod interface for this service needs to be created. |
abstract
AbstractInputMethodService.AbstractInputMethodSessionImpl
|
onCreateInputMethodSessionInterface()
Called by the framework when a new InputMethodSession interface is needed for a new client of the input method. |
void
|
onDestroy()
Called by the system to notify a Service that it is no longer used and is being removed. If you override this method you must call through to the superclass implementation. |
boolean
|
onGenericMotionEvent(MotionEvent event)
Implement this to handle generic motion events on your input method. |
boolean
|
onTrackballEvent(MotionEvent event)
Implement this to handle trackball events on your input method. |
Protected methods | |
---|---|
void
|
dump(FileDescriptor fd, PrintWriter fout, String[] args)
Implement this to handle |
Inherited methods | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Service
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From class
android.content.ContextWrapper
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From class
android.content.Context
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From class
java.lang.Object
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
android.content.ComponentCallbacks2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
android.view.KeyEvent.Callback
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
android.content.ComponentCallbacks
|
public AbstractInputMethodService ()
public KeyEvent.DispatcherState getKeyDispatcherState ()
Return the global KeyEvent.DispatcherState
for used for processing events from the target application.
Normally you will not need to use this directly, but
just use the standard high-level event callbacks like KeyEvent.Callback.onKeyDown(int, KeyEvent)
.
Returns | |
---|---|
KeyEvent.DispatcherState |
public Object getSystemService (String name)
Return the handle to a system-level service by name. The class of the returned object varies by the requested name. Currently available names are:
WINDOW_SERVICE
("window")
WindowManager
. Must only be obtained
from a visual context such as Activity or a Context created with
createWindowContext(int, android.os.Bundle)
, which are adjusted to the configuration and
visual bounds of an area on screen.
LAYOUT_INFLATER_SERVICE
("layout_inflater")
LayoutInflater
for inflating layout resources
in this context. Must only be obtained from a visual context such as Activity or a Context
created with createWindowContext(int, android.os.Bundle)
, which are adjusted to the
configuration and visual bounds of an area on screen.
ACTIVITY_SERVICE
("activity")
ActivityManager
for interacting with the
global activity state of the system.
WALLPAPER_SERVICE
("wallpaper")
WallpaperService
for accessing wallpapers in this
context. Must only be obtained from a visual context such as Activity or a Context created
with createWindowContext(int, android.os.Bundle)
, which are adjusted to the configuration and
visual bounds of an area on screen.
POWER_SERVICE
("power")
PowerManager
for controlling power
management.
ALARM_SERVICE
("alarm")
AlarmManager
for receiving intents at the
time of your choosing.
NOTIFICATION_SERVICE
("notification")
NotificationManager
for informing the user
of background events.
KEYGUARD_SERVICE
("keyguard")
KeyguardManager
for controlling keyguard.
LOCATION_SERVICE
("location")
LocationManager
for controlling location
(e.g., GPS) updates.
SEARCH_SERVICE
("search")
SearchManager
for handling search.
VIBRATOR_MANAGER_SERVICE
("vibrator_manager")
VibratorManager
for accessing the device vibrators, interacting
with individual ones and playing synchronized effects on multiple vibrators.
VIBRATOR_SERVICE
("vibrator")
Vibrator
for interacting with the vibrator hardware.
CONNECTIVITY_SERVICE
("connectivity")
ConnectivityManager
for
handling management of network connections.
IPSEC_SERVICE
("ipsec")
IpSecManager
for managing IPSec on
sockets and networks.
WIFI_SERVICE
("wifi")
WifiManager
for management of Wi-Fi
connectivity. On releases before NYC, it should only be obtained from an application
context, and not from any other derived context to avoid memory leaks within the calling
process.
WIFI_AWARE_SERVICE
("wifiaware")
WifiAwareManager
for management of
Wi-Fi Aware discovery and connectivity.
WIFI_P2P_SERVICE
("wifip2p")
WifiP2pManager
for management of
Wi-Fi Direct connectivity.
INPUT_METHOD_SERVICE
("input_method")
InputMethodManager
for management of input methods.
UI_MODE_SERVICE
("uimode")
UiModeManager
for controlling UI modes.
DOWNLOAD_SERVICE
("download")
DownloadManager
for requesting HTTP downloads
BATTERY_SERVICE
("batterymanager")
BatteryManager
for managing battery state
JOB_SCHEDULER_SERVICE
("taskmanager")
JobScheduler
for managing scheduled tasks
NETWORK_STATS_SERVICE
("netstats")
NetworkStatsManager
for querying network
usage statistics.
HARDWARE_PROPERTIES_SERVICE
("hardware_properties")
HardwarePropertiesManager
for accessing hardware properties.
DOMAIN_VERIFICATION_SERVICE
("domain_verification")
DomainVerificationManager
for accessing
web domain approval state.
Note: System services obtained via this API may be closely associated with the Context in which they are obtained from. In general, do not share the service objects between various different contexts (Activities, Applications, Services, Providers, etc.)
Note: Instant apps, for which PackageManager#isInstantApp()
returns true,
don't have access to the following system services: DEVICE_POLICY_SERVICE
,
FINGERPRINT_SERVICE
, KEYGUARD_SERVICE
, SHORTCUT_SERVICE
,
USB_SERVICE
, WALLPAPER_SERVICE
, WIFI_P2P_SERVICE
,
WIFI_SERVICE
, WIFI_AWARE_SERVICE
. For these services this method will
return null
. Generally, if you are running as an instant app you should always
check whether the result of this method is null
.
Note: When implementing this method, keep in mind that new services can be added on newer
Android releases, so if you're looking for just the explicit names mentioned above, make sure
to return null
when you don't recognize the name — if you throw a
RuntimeException
exception instead, you're app might break on new Android releases.
Parameters | |
---|---|
name |
String : This value cannot be null .
|
Returns | |
---|---|
Object |
The service or null if the name does not exist. |
public final IBinder onBind (Intent intent)
Return the communication channel to the service. May return null if
clients can not bind to the service. The returned
IBinder
is usually for a complex interface
that has been described using
aidl.
Note that unlike other application components, calls on to the IBinder interface returned here may not happen on the main thread of the process. More information about the main thread can be found in Processes and Threads.
Parameters | |
---|---|
intent |
Intent : The Intent that was used to bind to this service,
as given to Context.bindService . Note that any extras that were included with
the Intent at that point will not be seen here. |
Returns | |
---|---|
IBinder |
Return an IBinder through which clients can call on to the service. |
public abstract AbstractInputMethodService.AbstractInputMethodImpl onCreateInputMethodInterface ()
Called by the framework during initialization, when the InputMethod interface for this service needs to be created.
Returns | |
---|---|
AbstractInputMethodService.AbstractInputMethodImpl |
public abstract AbstractInputMethodService.AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface ()
Called by the framework when a new InputMethodSession interface is needed for a new client of the input method.
Returns | |
---|---|
AbstractInputMethodService.AbstractInputMethodSessionImpl |
public void onDestroy ()
Called by the system to notify a Service that it is no longer used and is being removed. The service should clean up any resources it holds (threads, registered receivers, etc) at this point. Upon return, there will be no more calls in to this Service object and it is effectively dead. Do not call this method directly. If you override this method you must call through to the superclass implementation.
public boolean onGenericMotionEvent (MotionEvent event)
Implement this to handle generic motion events on your input method.
Parameters | |
---|---|
event |
MotionEvent : The motion event being received. |
Returns | |
---|---|
boolean |
True if the event was handled in this function, false otherwise. |
See also:
public boolean onTrackballEvent (MotionEvent event)
Implement this to handle trackball events on your input method.
Parameters | |
---|---|
event |
MotionEvent : The motion event being received. |
Returns | |
---|---|
boolean |
True if the event was handled in this function, false otherwise. |
See also:
protected void dump (FileDescriptor fd, PrintWriter fout, String[] args)
Implement this to handle Binder.dump()
calls on your input method.
Parameters | |
---|---|
fd |
FileDescriptor : The raw file descriptor that the dump is being sent to. |
fout |
PrintWriter : The PrintWriter to which you should dump your state. This will be
closed for you after you return. |
args |
String : additional arguments to the dump request. |
Except as noted, this content is licensed under Apache 2.0. For details and restrictions, see the Content License.
Android 7.0 r1 —