summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorWonsik Kim <wonsik@google.com>2014-09-01 11:52:28 +0900
committerWonsik Kim <wonsik@google.com>2014-09-02 11:45:35 +0900
commitd71c691bc56ef4c5c3cf6b4cabcc450d6b1820c0 (patch)
tree77d0665949e4c60a1fb5317d8dd9687d824cd2a5 /media
parentec1bfea28e8cca5fe01493283fc1433198ce36bb (diff)
downloadframeworks_base-d71c691bc56ef4c5c3cf6b4cabcc450d6b1820c0.zip
frameworks_base-d71c691bc56ef4c5c3cf6b4cabcc450d6b1820c0.tar.gz
frameworks_base-d71c691bc56ef4c5c3cf6b4cabcc450d6b1820c0.tar.bz2
TIF: add SystemApi's for ITvInputHardware related methods
Bug: 17322530 Change-Id: I813d865bc9a77d1d381e52188afac5c5c75a2968
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/tv/TvInputManager.java125
1 files changed, 125 insertions, 0 deletions
diff --git a/media/java/android/media/tv/TvInputManager.java b/media/java/android/media/tv/TvInputManager.java
index 6d1f0e4..ddc383a 100644
--- a/media/java/android/media/tv/TvInputManager.java
+++ b/media/java/android/media/tv/TvInputManager.java
@@ -33,6 +33,7 @@ import android.util.SparseArray;
import android.view.InputChannel;
import android.view.InputEvent;
import android.view.InputEventSender;
+import android.view.KeyEvent;
import android.view.Surface;
import android.view.View;
@@ -520,6 +521,16 @@ public final class TvInputManager {
}
/**
+ * Interface used to receive events from Hardware objects.
+ * @hide
+ */
+ @SystemApi
+ public abstract static class HardwareCallback {
+ public abstract void onReleased();
+ public abstract void onStreamConfigChanged(TvStreamConfig[] configs);
+ }
+
+ /**
* @hide
*/
public TvInputManager(ITvInputManager service, int userId) {
@@ -1006,6 +1017,64 @@ public final class TvInputManager {
}
/**
+ * Returns a list of TvInputHardwareInfo objects representing available hardware.
+ *
+ * @hide
+ */
+ @SystemApi
+ public List<TvInputHardwareInfo> getHardwareList() {
+ try {
+ return mService.getHardwareList();
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Returns acquired TvInputManager.Hardware object for given deviceId.
+ *
+ * If there are other Hardware object acquired for the same deviceId, calling this method will
+ * preempt the previously acquired object and report {@link HardwareCallback#onReleased} to the
+ * old object.
+ *
+ * @hide
+ */
+ @SystemApi
+ public Hardware acquireTvInputHardware(int deviceId, final HardwareCallback callback,
+ TvInputInfo info) {
+ try {
+ return new Hardware(
+ mService.acquireTvInputHardware(deviceId, new ITvInputHardwareCallback.Stub() {
+ @Override
+ public void onReleased() {
+ callback.onReleased();
+ }
+
+ @Override
+ public void onStreamConfigChanged(TvStreamConfig[] configs) {
+ callback.onStreamConfigChanged(configs);
+ }
+ }, info, mUserId));
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Releases previously acquired hardware object.
+ *
+ * @hide
+ */
+ @SystemApi
+ public void releaseTvInputHardware(int deviceId, Hardware hardware) {
+ try {
+ mService.releaseTvInputHardware(deviceId, hardware.getInterface(), mUserId);
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
* The Session provides the per-session functionality of TV inputs.
* @hide
*/
@@ -1652,4 +1721,60 @@ public final class TvInputManager {
}
}
}
+
+ /**
+ * The Hardware provides the per-hardware functionality of TV hardware.
+ *
+ * TV hardware is physical hardware attached to the Android device; for example, HDMI ports,
+ * Component/Composite ports, etc. Specifically, logical devices such as HDMI CEC logical
+ * devices don't fall into this category.
+ *
+ * @hide
+ */
+ @SystemApi
+ public final static class Hardware {
+ private final ITvInputHardware mInterface;
+
+ private Hardware(ITvInputHardware hardwareInterface) {
+ mInterface = hardwareInterface;
+ }
+
+ private ITvInputHardware getInterface() {
+ return mInterface;
+ }
+
+ public boolean setSurface(Surface surface, TvStreamConfig config) {
+ try {
+ return mInterface.setSurface(surface, config);
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void setStreamVolume(float volume) {
+ try {
+ mInterface.setStreamVolume(volume);
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public boolean dispatchKeyEventToHdmi(KeyEvent event) {
+ try {
+ return mInterface.dispatchKeyEventToHdmi(event);
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void overrideAudioSink(int audioType, String audioAddress, int samplingRate,
+ int channelMask, int format) {
+ try {
+ mInterface.overrideAudioSink(audioType, audioAddress, samplingRate, channelMask,
+ format);
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
}