public abstract class TvRemoteProvider extends Object
main looper thread
of an application.
IMPORTANT: This class is effectively a system API for unbundled emote service, and must remain API stable. See README.txt in the root of this package for more information.
Modifier and Type | Field and Description |
---|---|
static String |
SERVICE_INTERFACE
The
Intent that must be declared as handled by the service. |
Constructor and Description |
---|
TvRemoteProvider(Context context)
Creates a provider for an unbundled emote controller
service allowing it to interface with the tv remote controller
system service.
|
Modifier and Type | Method and Description |
---|---|
void |
clearInputBridge(IBinder token)
clearInputBridge : Clear out any existing key or pointer events in queue for this device by
dropping them on the floor and sending an UP to all keys and pointer
slots.
|
void |
closeInputBridge(IBinder token)
closeInputBridge : Close input bridge for a device
|
IBinder |
getBinder()
Gets the Binder associated with the provider.
|
Context |
getContext()
Gets the context of the remote service provider.
|
void |
onInputBridgeConnected(IBinder token)
Information about the InputBridge connected status.
|
void |
openRemoteInputBridge(IBinder token,
String name,
int width,
int height,
int maxPointers)
openRemoteInputBridge : Open an input bridge for a particular device.
|
void |
sendKeyDown(IBinder token,
int keyCode)
sendKeyDown : Send key down event for a device
|
void |
sendKeyUp(IBinder token,
int keyCode)
sendKeyUp : Send key up event for a device
|
void |
sendPointerDown(IBinder token,
int pointerId,
int x,
int y)
sendPointerDown : Send pointer down event for a device
|
void |
sendPointerSync(IBinder token)
sendPointerSync : Send pointer sync event for a device
|
void |
sendPointerUp(IBinder token,
int pointerId)
sendPointerUp : Send pointer up event for a device
|
void |
sendTimestamp(IBinder token,
long timestamp)
sendTimestamp : Send a timestamp for a set of pointer events
|
public static final String SERVICE_INTERFACE
Intent
that must be declared as handled by the service.
The service must also require the android.Manifest.permission#BIND_TV_REMOTE_SERVICE
permission so that other applications cannot abuse it.public TvRemoteProvider(Context context)
context
- The application context for the remote provider.public final Context getContext()
public IBinder getBinder()
This is intended to be used for the onBind() method of a service that implements a remote provider service.
public void onInputBridgeConnected(IBinder token)
token
- Identifier for the connection. Null, if failed.public void openRemoteInputBridge(IBinder token, String name, int width, int height, int maxPointers) throws RuntimeException
onInputBridgeConnected(IBinder token)
The token should be used for subsequent calls.
name
- Device nametoken
- Identifier for this connectionwidth
- Width of the device's virtual touchpadheight
- Height of the device's virtual touchpadmaxPointers
- Maximum supported pointersRuntimeException
public void closeInputBridge(IBinder token) throws RuntimeException
token
- identifier for this connectionRuntimeException
public void clearInputBridge(IBinder token) throws RuntimeException
token
- identifier for this connectionRuntimeException
public void sendTimestamp(IBinder token, long timestamp) throws RuntimeException
token
- identifier for the devicetimestamp
- Timestamp to be used in
SystemClock.uptimeMillis()
time baseRuntimeException
public void sendKeyUp(IBinder token, int keyCode) throws RuntimeException
token
- identifier for this connectionkeyCode
- Key code to be sentRuntimeException
public void sendKeyDown(IBinder token, int keyCode) throws RuntimeException
token
- identifier for this connectionkeyCode
- Key code to be sentRuntimeException
public void sendPointerUp(IBinder token, int pointerId) throws RuntimeException
token
- identifier for the devicepointerId
- Pointer id to be used. Value may be from 0
to MotionEvent#getPointerCount()
-1RuntimeException
public void sendPointerDown(IBinder token, int pointerId, int x, int y) throws RuntimeException
token
- identifier for the devicepointerId
- Pointer id to be used. Value may be from 0
to MotionEvent#getPointerCount()
-1x
- X co-ordinates in display pixelsy
- Y co-ordinates in display pixelsRuntimeException
public void sendPointerSync(IBinder token) throws RuntimeException
token
- identifier for the deviceRuntimeException