Fields Summary |
---|
private static final boolean | DEBUG |
private static final String | TAG |
public static final String | SERVICE_INTERFACEThis is the interface name that a service implementing a TV input should say that it support
-- that is, this is the action it uses for its intent filter. To be supported, the service
must also require the {@link android.Manifest.permission#BIND_TV_INPUT} permission so that
other applications cannot abuse it. |
public static final String | SERVICE_META_DATAName under which a TvInputService component publishes information about itself.
This meta-data must reference an XML resource containing an
<{@link android.R.styleable#TvInputService tv-input}>
tag. |
private final android.os.Handler | mServiceHandlerHandler instance to handle request from TV Input Manager Service. Should be run in the main
looper to be synchronously run with {@code Session.mHandler}. |
private final android.os.RemoteCallbackList | mCallbacks |
private TvInputManager | mTvInputManager |
Methods Summary |
---|
public static boolean | isNavigationKey(int keyCode)
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_LEFT:
case KeyEvent.KEYCODE_DPAD_RIGHT:
case KeyEvent.KEYCODE_DPAD_UP:
case KeyEvent.KEYCODE_DPAD_DOWN:
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_PAGE_UP:
case KeyEvent.KEYCODE_PAGE_DOWN:
case KeyEvent.KEYCODE_MOVE_HOME:
case KeyEvent.KEYCODE_MOVE_END:
case KeyEvent.KEYCODE_TAB:
case KeyEvent.KEYCODE_SPACE:
case KeyEvent.KEYCODE_ENTER:
return true;
}
return false;
|
private boolean | isPassthroughInput(java.lang.String inputId)
if (mTvInputManager == null) {
mTvInputManager = (TvInputManager) getSystemService(Context.TV_INPUT_SERVICE);
}
TvInputInfo info = mTvInputManager.getTvInputInfo(inputId);
if (info != null && info.isPassthroughInput()) {
return true;
}
return false;
|
public final android.os.IBinder | onBind(android.content.Intent intent)
return new ITvInputService.Stub() {
@Override
public void registerCallback(ITvInputServiceCallback cb) {
if (cb != null) {
mCallbacks.register(cb);
}
}
@Override
public void unregisterCallback(ITvInputServiceCallback cb) {
if (cb != null) {
mCallbacks.unregister(cb);
}
}
@Override
public void createSession(InputChannel channel, ITvInputSessionCallback cb,
String inputId) {
if (channel == null) {
Log.w(TAG, "Creating session without input channel");
}
if (cb == null) {
return;
}
SomeArgs args = SomeArgs.obtain();
args.arg1 = channel;
args.arg2 = cb;
args.arg3 = inputId;
mServiceHandler.obtainMessage(ServiceHandler.DO_CREATE_SESSION, args).sendToTarget();
}
@Override
public void notifyHardwareAdded(TvInputHardwareInfo hardwareInfo) {
mServiceHandler.obtainMessage(ServiceHandler.DO_ADD_HARDWARE_TV_INPUT,
hardwareInfo).sendToTarget();
}
@Override
public void notifyHardwareRemoved(TvInputHardwareInfo hardwareInfo) {
mServiceHandler.obtainMessage(ServiceHandler.DO_REMOVE_HARDWARE_TV_INPUT,
hardwareInfo).sendToTarget();
}
@Override
public void notifyHdmiDeviceAdded(HdmiDeviceInfo deviceInfo) {
mServiceHandler.obtainMessage(ServiceHandler.DO_ADD_HDMI_TV_INPUT,
deviceInfo).sendToTarget();
}
@Override
public void notifyHdmiDeviceRemoved(HdmiDeviceInfo deviceInfo) {
mServiceHandler.obtainMessage(ServiceHandler.DO_REMOVE_HDMI_TV_INPUT,
deviceInfo).sendToTarget();
}
};
|
public abstract android.media.tv.TvInputService$Session | onCreateSession(java.lang.String inputId)Returns a concrete implementation of {@link Session}.
May return {@code null} if this TV input service fails to create a session for some reason.
If TV input represents an external device connected to a hardware TV input,
{@link HardwareSession} should be returned.
|
public TvInputInfo | onHardwareAdded(TvInputHardwareInfo hardwareInfo)Returns a new {@link TvInputInfo} object if this service is responsible for
{@code hardwareInfo}; otherwise, return {@code null}. Override to modify default behavior of
ignoring all hardware input.
return null;
|
public java.lang.String | onHardwareRemoved(TvInputHardwareInfo hardwareInfo)Returns the input ID for {@code deviceId} if it is handled by this service;
otherwise, return {@code null}. Override to modify default behavior of ignoring all hardware
input.
return null;
|
public TvInputInfo | onHdmiDeviceAdded(android.hardware.hdmi.HdmiDeviceInfo deviceInfo)Returns a new {@link TvInputInfo} object if this service is responsible for
{@code deviceInfo}; otherwise, return {@code null}. Override to modify default behavior of
ignoring all HDMI logical input device.
return null;
|
public java.lang.String | onHdmiDeviceRemoved(android.hardware.hdmi.HdmiDeviceInfo deviceInfo)Returns the input ID for {@code deviceInfo} if it is handled by this service; otherwise,
return {@code null}. Override to modify default behavior of ignoring all HDMI logical input
device.
return null;
|