android.device
Class KeyMapManager

java.lang.Object
  extended by android.device.KeyMapManager

public class KeyMapManager
extends java.lang.Object

Object used to remap key and button events. Note: this class only working on Android 5.1 and Android 4.3 (FW version 20160929 and Higher).


Nested Class Summary
 class KeyMapManager.KeyEntry
          Describes the keys provided by button event and their associated labels.
 
Field Summary
static int KEY_TYPE_KEYCODE
          This mask is used to remap new keycode FUNCTION.
static int KEY_TYPE_STARTAC
          This mask is used to remap special actions to start APPS FUNCTION.
 
Constructor Summary
KeyMapManager(Context context)
           
 
Method Summary
 void delKeyEntry(int scancode)
          Delete the Button key remap.
 void disableInterception(boolean interception)
          disable or enable system remap Button key event.
 java.lang.String getKeyAction(int scancode)
          Returns special actions if this scan code is a KeyEvent keycode.
 int getKeyCode(int scancode)
          Returns new keycode if this scan code is a KeyEvent keycode.
 java.util.List<KeyMapManager.KeyEntry> getKeyList()
          Returns all remap keys describes.
 int getKeyMeta(int scancode)
           
 int getKeytype(int scancode)
          Returns ramap type if this scan code is a KeyEvent keycode.
 boolean hasKeyEntry(int scancode)
          Returns the Button key remap state.
 boolean isInterception()
          Returns true if enable system remap Button key event.
 void mapKeyEntry(KeyEvent event, int keytype, java.lang.String meta)
          Create a new key event remap that is the same as the given one, but whose keycode is replaced with the given value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_TYPE_KEYCODE

public static final int KEY_TYPE_KEYCODE

This mask is used to remap new keycode FUNCTION.

See Also:
Constant Field Values

KEY_TYPE_STARTAC

public static final int KEY_TYPE_STARTAC

This mask is used to remap special actions to start APPS FUNCTION.

See Also:
Constant Field Values
Constructor Detail

KeyMapManager

public KeyMapManager(Context context)
Method Detail

hasKeyEntry

public boolean hasKeyEntry(int scancode)

Returns the Button key remap state.

Parameters:
scancode - android.view.KeyEvent#getScanCode()
Returns:
true if the Button key is remap, false otherwise

delKeyEntry

public void delKeyEntry(int scancode)

Delete the Button key remap.

Parameters:
scancode - android.view.KeyEvent#getScanCode()

mapKeyEntry

public void mapKeyEntry(KeyEvent event,
                        int keytype,
                        java.lang.String meta)
Create a new key event remap that is the same as the given one, but whose keycode is replaced with the given value.

Parameters:
event - the button key event android.view.KeyEvent
keytype - such as KEY_TYPE_KEYCODE or KEY_TYPE_STARTAC.
meta - new keycode or special actions to start APPSandroid.content.Intent

isInterception

public boolean isInterception()
Returns true if enable system remap Button key event.

Returns:
true if the remap FUNCTION is enable, false otherwise

disableInterception

public void disableInterception(boolean interception)
disable or enable system remap Button key event.

Parameters:
interception - true disable remap KeyEvent, false otherwise.

getKeyCode

public int getKeyCode(int scancode)
Returns new keycode if this scan code is a KeyEvent keycode.

Parameters:
scancode - android.view.KeyEvent#getScanCode()
Returns:
The keycode or -1 if not found.

getKeyMeta

public int getKeyMeta(int scancode)

getKeyAction

public java.lang.String getKeyAction(int scancode)
Returns special actions if this scan code is a KeyEvent keycode.

Parameters:
scancode - android.view.KeyEvent#getScanCode()
Returns:
special actions to start APPSandroid.content.Intent, null otherwise

getKeytype

public int getKeytype(int scancode)
Returns ramap type if this scan code is a KeyEvent keycode.

Parameters:
scancode - android.view.KeyEvent#getScanCode()
Returns:
keytype such as KEY_TYPE_KEYCODE or KEY_TYPE_STARTAC, -1 otherwise

getKeyList

public java.util.List<KeyMapManager.KeyEntry> getKeyList()
Returns all remap keys describes.

Returns:
describes list KeyMapManager.KeyEntry, null otherwise