aboutsummaryrefslogtreecommitdiff
path: root/sample/src/com/example/android/sampleproxyservice/FakeHdmiTvInputService.java
diff options
context:
space:
mode:
Diffstat (limited to 'sample/src/com/example/android/sampleproxyservice/FakeHdmiTvInputService.java')
-rw-r--r--sample/src/com/example/android/sampleproxyservice/FakeHdmiTvInputService.java61
1 files changed, 61 insertions, 0 deletions
diff --git a/sample/src/com/example/android/sampleproxyservice/FakeHdmiTvInputService.java b/sample/src/com/example/android/sampleproxyservice/FakeHdmiTvInputService.java
new file mode 100644
index 00000000..04acbea3
--- /dev/null
+++ b/sample/src/com/example/android/sampleproxyservice/FakeHdmiTvInputService.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.sampleproxyservice;
+
+import android.media.tv.TvInputService;
+import android.net.Uri;
+import android.view.Surface;
+
+/**
+ * Represents a simple HDMI input.
+ */
+public class FakeHdmiTvInputService extends TvInputService {
+ private ExternalSettopBox mExternalSettopBox = ExternalSettopBox.getInstance();
+
+ @Override
+ public Session onCreateSession(String inputId) {
+ return new FakeHdmiSession();
+ }
+
+ private class FakeHdmiSession extends Session {
+ @Override
+ public void onRelease() {
+ }
+
+ @Override
+ public void onSetCaptionEnabled(boolean enabled) {
+ // No-op.
+ }
+
+ @Override
+ public void onSetStreamVolume(float volume) {
+ mExternalSettopBox.setVolume(volume);
+ }
+
+ @Override
+ public boolean onSetSurface(Surface surface) {
+ mExternalSettopBox.setSurface(surface);
+ return true;
+ }
+
+ @Override
+ public boolean onTune(Uri channel) {
+ // No-op.
+ return false;
+ }
+ }
+}