summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2018-07-12 01:39:06 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-07-12 01:39:06 +0000
commit5fc82e8af082dd8cf44a377498b6060f5cc7a28e (patch)
tree3c0a295b0f47f26f99a974ed48786049961934df
parentb5a3117fe9675d9cedcaf22dff017cd48e659c7d (diff)
parentb89d6fffeb5ab1ab4ae8752b78473e926de64f5b (diff)
Merge "Add stub implementation of HdmiCecLocalDeviceAudioSystem"
-rw-r--r--services/core/java/com/android/server/hdmi/Constants.java2
-rwxr-xr-xservices/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java2
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java58
3 files changed, 62 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/hdmi/Constants.java b/services/core/java/com/android/server/hdmi/Constants.java
index a2a55e532ef4..0eb18a8f8cd5 100644
--- a/services/core/java/com/android/server/hdmi/Constants.java
+++ b/services/core/java/com/android/server/hdmi/Constants.java
@@ -200,6 +200,8 @@ final class Constants {
static final int UNKNOWN_VOLUME = -1;
+ static final String PROPERTY_PREFERRED_ADDRESS_AUDIO_SYSTEM =
+ "persist.sys.hdmi.addr.audiosystem";
static final String PROPERTY_PREFERRED_ADDRESS_PLAYBACK = "persist.sys.hdmi.addr.playback";
static final String PROPERTY_PREFERRED_ADDRESS_TV = "persist.sys.hdmi.addr.tv";
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
index c7cdbefba723..1dd10f550985 100755
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
@@ -169,6 +169,8 @@ abstract class HdmiCecLocalDevice {
return new HdmiCecLocalDeviceTv(service);
case HdmiDeviceInfo.DEVICE_PLAYBACK:
return new HdmiCecLocalDevicePlayback(service);
+ case HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM:
+ return new HdmiCecLocalDeviceAudioSystem(service);
default:
return null;
}
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java
new file mode 100644
index 000000000000..9b545c09448c
--- /dev/null
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2018 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.android.server.hdmi;
+
+
+import android.hardware.hdmi.HdmiDeviceInfo;
+import android.os.SystemProperties;
+
+/**
+ * Represent a logical device of type {@link HdmiDeviceInfo#DEVICE_AUDIO_SYSTEM} residing in
+ * Android system.
+ */
+public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDevice {
+
+ protected HdmiCecLocalDeviceAudioSystem(HdmiControlService service) {
+ super(service, HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM);
+ }
+
+ @Override
+ @HdmiAnnotations.ServiceThreadOnly
+ protected void onAddressAllocated(int logicalAddress, int reason) {
+ assertRunOnServiceThread();
+ mService.sendCecCommand(HdmiCecMessageBuilder.buildReportPhysicalAddressCommand(
+ mAddress, mService.getPhysicalAddress(), mDeviceType));
+ mService.sendCecCommand(HdmiCecMessageBuilder.buildDeviceVendorIdCommand(
+ mAddress, mService.getVendorId()));
+ startQueuedActions();
+ }
+
+ @Override
+ @HdmiAnnotations.ServiceThreadOnly
+ protected int getPreferredAddress() {
+ assertRunOnServiceThread();
+ return SystemProperties.getInt(Constants.PROPERTY_PREFERRED_ADDRESS_AUDIO_SYSTEM,
+ Constants.ADDR_UNREGISTERED);
+ }
+
+ @Override
+ @HdmiAnnotations.ServiceThreadOnly
+ protected void setPreferredAddress(int addr) {
+ assertRunOnServiceThread();
+ SystemProperties.set(Constants.PROPERTY_PREFERRED_ADDRESS_AUDIO_SYSTEM,
+ String.valueOf(addr));
+ }
+}