summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-04-30 01:03:50 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-04-30 01:03:50 +0000
commita57d727e82af55c0a069209c67d407ee0974a62e (patch)
treee562139b0883eda14db62a718228f59c7a06dd22
parentea12e1d45effed076fe2d56a7d6576353fca149b (diff)
parentaca91822cd459211493ad0d378171d7d69cbeaeb (diff)
downloadatv-a57d727e82af55c0a069209c67d407ee0974a62e.tar.gz
Snap for 6445537 from aca91822cd459211493ad0d378171d7d69cbeaeb to rvc-release
Change-Id: Ib78e282ae19038bc254e3627994815d2c1e71e7f
-rw-r--r--audio_proxy/interfaces/5.0/Android.bp19
-rw-r--r--audio_proxy/interfaces/5.0/IAudioProxyDevicesManager.hal28
-rw-r--r--audio_proxy/interfaces/5.0/IBusDevice.hal27
-rw-r--r--audio_proxy/interfaces/Android.bp4
-rwxr-xr-xaudio_proxy/interfaces/update-makefiles.sh10
-rw-r--r--audio_proxy/service/Android.bp38
-rw-r--r--audio_proxy/service/AudioProxyDevicesManagerImpl.cpp17
-rw-r--r--audio_proxy/service/AudioProxyDevicesManagerImpl.h29
-rw-r--r--audio_proxy/service/device.google.atv.audio_proxy@5.0-service.rc4
-rw-r--r--audio_proxy/service/main.cpp29
-rw-r--r--audio_proxy/service/manifest_audio_proxy.xml7
11 files changed, 212 insertions, 0 deletions
diff --git a/audio_proxy/interfaces/5.0/Android.bp b/audio_proxy/interfaces/5.0/Android.bp
new file mode 100644
index 0000000..85ca5a3
--- /dev/null
+++ b/audio_proxy/interfaces/5.0/Android.bp
@@ -0,0 +1,19 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "device.google.atv.audio_proxy@5.0",
+ root: "device.google.atv.audio_proxy",
+ product_specific: true,
+ srcs: [
+ "IAudioProxyDevicesManager.hal",
+ "IBusDevice.hal",
+ ],
+ interfaces: [
+ "android.hardware.audio.common@5.0",
+ "android.hardware.audio@5.0",
+ "android.hidl.base@1.0",
+ "android.hidl.safe_union@1.0",
+ ],
+ gen_java: false,
+}
+
diff --git a/audio_proxy/interfaces/5.0/IAudioProxyDevicesManager.hal b/audio_proxy/interfaces/5.0/IAudioProxyDevicesManager.hal
new file mode 100644
index 0000000..b2a6771
--- /dev/null
+++ b/audio_proxy/interfaces/5.0/IAudioProxyDevicesManager.hal
@@ -0,0 +1,28 @@
+/* Copyright 2020 Google Inc. All Rights Reserved. */
+
+package device.google.atv.audio_proxy@5.0;
+
+import IBusDevice;
+
+/**
+ * Main entrance for audio proxy service. Client should use this interface to
+ * register IBusDevice. Service also implements audio HAL IDevicesFactory. When
+ * needed, service will use registered IBusDevice to open output stream. This
+ * allows the client to behave like an audio HAL and read audio from audio
+ * server, if permitted.
+ *
+ * Note, the implementation only supports one version of audio HAL. To avoid
+ * confusion, this interface shares the same version as the supported audio HAL
+ * version.
+ */
+interface IAudioProxyDevicesManager {
+ /**
+ * Registers IBusDevice at `address`. IBusService impl should live as long
+ * as its process, after registered.
+ *
+ * @param address The address associated with the device.
+ * @param device The audio bus device.
+ * @return success True if the device is registered successfully.
+ */
+ registerDevice(string address, IBusDevice device) generates (bool success);
+};
diff --git a/audio_proxy/interfaces/5.0/IBusDevice.hal b/audio_proxy/interfaces/5.0/IBusDevice.hal
new file mode 100644
index 0000000..0044a48
--- /dev/null
+++ b/audio_proxy/interfaces/5.0/IBusDevice.hal
@@ -0,0 +1,27 @@
+/* Copyright 2020 Google Inc. All Rights Reserved. */
+
+package device.google.atv.audio_proxy@5.0;
+
+import android.hardware.audio.common@5.0;
+import android.hardware.audio@5.0::IStreamOut;
+import android.hardware.audio@5.0::Result;
+
+/**
+ * Represents a bus device in audio HAL. Check Java AudioDeviceInfo.TYPE_BUS for
+ * more details.
+ */
+interface IBusDevice {
+ /**
+ * Opens an audio stream for output. This function has the same requirement
+ * as audio HAL IDevice.openOutputStream.
+ */
+ openOutputStream(
+ AudioIoHandle ioHandle,
+ DeviceAddress device,
+ AudioConfig config,
+ bitfield<AudioOutputFlag> flags,
+ SourceMetadata sourceMetadata) generates (
+ Result retval,
+ IStreamOut outStream,
+ AudioConfig suggestedConfig);
+};
diff --git a/audio_proxy/interfaces/Android.bp b/audio_proxy/interfaces/Android.bp
new file mode 100644
index 0000000..89d436a
--- /dev/null
+++ b/audio_proxy/interfaces/Android.bp
@@ -0,0 +1,4 @@
+hidl_package_root {
+ name: "device.google.atv.audio_proxy",
+ path: "device/google/atv/audio_proxy/interfaces",
+}
diff --git a/audio_proxy/interfaces/update-makefiles.sh b/audio_proxy/interfaces/update-makefiles.sh
new file mode 100755
index 0000000..d3f832e
--- /dev/null
+++ b/audio_proxy/interfaces/update-makefiles.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# Run from Android root, e.g.:
+#
+# device/google/atv/audio_proxy/interfaces/update-makefiles.sh
+
+source $ANDROID_BUILD_TOP/system/tools/hidl/update-makefiles-helper.sh
+
+do_makefiles_update \
+ "device.google.atv.audio_proxy:device/google/atv/audio_proxy/interfaces"
diff --git a/audio_proxy/service/Android.bp b/audio_proxy/service/Android.bp
new file mode 100644
index 0000000..8697f8a
--- /dev/null
+++ b/audio_proxy/service/Android.bp
@@ -0,0 +1,38 @@
+// Copyright 2020 Google Inc. All Rights Reserved.
+
+cc_binary {
+ name: "device.google.atv.audio_proxy@5.0-service",
+ vendor: true,
+ relative_install_path: "hw",
+
+ srcs: [
+ "AudioProxyDevicesManagerImpl.cpp",
+ "main.cpp",
+ ],
+
+ init_rc: [
+ "device.google.atv.audio_proxy@5.0-service.rc",
+ ],
+
+ vintf_fragments: [ "manifest_audio_proxy.xml" ],
+
+ shared_libs: [
+ "android.hardware.audio@5.0",
+ "android.hardware.audio.common@5.0",
+ "android.hardware.audio.common@5.0-util",
+ "libhidlbase",
+ "liblog",
+ "libutils",
+ "device.google.atv.audio_proxy@5.0",
+ ],
+
+ header_libs: [
+ "android.hardware.audio.common.util@all-versions",
+ ],
+
+ cflags: [
+ "-DMAJOR_VERSION=5",
+ "-DMINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ],
+}
diff --git a/audio_proxy/service/AudioProxyDevicesManagerImpl.cpp b/audio_proxy/service/AudioProxyDevicesManagerImpl.cpp
new file mode 100644
index 0000000..df64ab3
--- /dev/null
+++ b/audio_proxy/service/AudioProxyDevicesManagerImpl.cpp
@@ -0,0 +1,17 @@
+// Copyright 2020 Google Inc. All Rights Reserved.
+
+#include "AudioProxyDevicesManagerImpl.h"
+
+namespace audio_proxy {
+namespace service {
+
+AudioProxyDevicesManagerImpl::AudioProxyDevicesManagerImpl() = default;
+AudioProxyDevicesManagerImpl::~AudioProxyDevicesManagerImpl() = default;
+
+Return<bool> AudioProxyDevicesManagerImpl::registerDevice(
+ const hidl_string& address, const sp<IBusDevice>& device) {
+ return false;
+}
+
+} // namespace service
+} // namespace audio_proxy
diff --git a/audio_proxy/service/AudioProxyDevicesManagerImpl.h b/audio_proxy/service/AudioProxyDevicesManagerImpl.h
new file mode 100644
index 0000000..6fcbfab
--- /dev/null
+++ b/audio_proxy/service/AudioProxyDevicesManagerImpl.h
@@ -0,0 +1,29 @@
+// Copyright 2020 Google Inc. All Rights Reserved.
+
+#ifndef DEVICE_GOOGLE_ATV_AUDIO_PROXY_SERVICE_AUDIO_PROXY_DEVICES_MANAGER_H_
+#define DEVICE_GOOGLE_ATV_AUDIO_PROXY_SERVICE_AUDIO_PROXY_DEVICES_MANAGER_H_
+
+#include PATH(device/google/atv/audio_proxy/FILE_VERSION/IAudioProxyDevicesManager.h)
+
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::Return;
+using ::device::google::atv::audio_proxy::CPP_VERSION::IAudioProxyDevicesManager;
+using ::device::google::atv::audio_proxy::CPP_VERSION::IBusDevice;
+
+namespace audio_proxy {
+namespace service {
+
+class AudioProxyDevicesManagerImpl : public IAudioProxyDevicesManager {
+ public:
+ AudioProxyDevicesManagerImpl();
+ ~AudioProxyDevicesManagerImpl() override;
+
+ Return<bool> registerDevice(const hidl_string& address,
+ const sp<IBusDevice>& device) override;
+};
+
+} // namespace service
+} // namespace audio_proxy
+
+#endif // DEVICE_GOOGLE_ATV_AUDIO_PROXY_SERVICE_AUDIO_PROXY_DEVICES_MANAGER_H_
diff --git a/audio_proxy/service/device.google.atv.audio_proxy@5.0-service.rc b/audio_proxy/service/device.google.atv.audio_proxy@5.0-service.rc
new file mode 100644
index 0000000..0847c7c
--- /dev/null
+++ b/audio_proxy/service/device.google.atv.audio_proxy@5.0-service.rc
@@ -0,0 +1,4 @@
+service audio_proxy_service /vendor/bin/hw/device.google.atv.audio_proxy@5.0-service
+ class hal
+ user system
+ group system
diff --git a/audio_proxy/service/main.cpp b/audio_proxy/service/main.cpp
new file mode 100644
index 0000000..95fe4eb
--- /dev/null
+++ b/audio_proxy/service/main.cpp
@@ -0,0 +1,29 @@
+// Copyright 2020 Google Inc. All Rights Reserved.
+
+#define LOG_TAG "audio_proxy_service"
+
+#include <hidl/HidlTransportSupport.h>
+#include <utils/Log.h>
+
+#include "AudioProxyDevicesManagerImpl.h"
+
+using ::android::sp;
+using ::android::status_t;
+
+int main(int argc, char** argv) {
+ android::hardware::configureRpcThreadpool(1, true /* callerWillJoin */);
+
+ sp<audio_proxy::service::AudioProxyDevicesManagerImpl> manager =
+ new audio_proxy::service::AudioProxyDevicesManagerImpl();
+ status_t status = manager->registerAsService();
+ if (status != android::OK) {
+ ALOGE("fail to register devices factory manager: %x", status);
+ return -1;
+ }
+
+ ::android::hardware::joinRpcThreadpool();
+
+ // `joinRpcThreadpool` should never return. Return -2 here for unexpected
+ // process exit.
+ return -2;
+}
diff --git a/audio_proxy/service/manifest_audio_proxy.xml b/audio_proxy/service/manifest_audio_proxy.xml
new file mode 100644
index 0000000..a5ea878
--- /dev/null
+++ b/audio_proxy/service/manifest_audio_proxy.xml
@@ -0,0 +1,7 @@
+<manifest version="1.0" type="device">
+ <hal format="hidl">
+ <name>device.google.atv.audio_proxy</name>
+ <transport>hwbinder</transport>
+ <fqname>@5.0::IAudioProxyDevicesManager/default</fqname>
+ </hal>
+</manifest>