From 00c2fedc5accf6b255f7cb3f066288ea10e50787 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 26 Jan 2024 13:09:33 -0800 Subject: [PATCH] audio: Provide a default implementation of IHalAdapterVendorExtension This service is used by the audio server for translating between legacy string KV pairs and AIDL vendor parameters. It resides on the system_ext partition. Since it has to be implemented by every SoC vendor, provide an example implementation. This example service is added to CF and GSI system_ext. Vendors can use their own names and policy labels, the only thing that the audio server depends on is the AIDL interface. There is no fuzzer for this service because the example implementation only contains trivial code (interface methods are stubbed out). Bug: 321651892 Test: atest audiorouting_tests Change-Id: I8ab922660a30ffd44772987204ac4a28c1007c66 --- build/soong/service_fuzzer_bindings.go | 1 + contexts/plat_file_contexts_test | 3 ++- private/audio_vendor_parameter_parser_service.te | 13 +++++++++++++ private/file_contexts | 1 + private/service.te | 1 + private/service_contexts | 1 + 6 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 private/audio_vendor_parameter_parser_service.te diff --git a/build/soong/service_fuzzer_bindings.go b/build/soong/service_fuzzer_bindings.go index a7d65cd6e..49d364eda 100644 --- a/build/soong/service_fuzzer_bindings.go +++ b/build/soong/service_fuzzer_bindings.go @@ -150,6 +150,7 @@ var ( "android.frameworks.sensorservice.ISensorManager/default": []string{"libsensorserviceaidl_fuzzer"}, "android.frameworks.stats.IStats/default": EXCEPTION_NO_FUZZER, "android.frameworks.vibrator.IVibratorControlService/default": EXCEPTION_NO_FUZZER, + "android.media.audio.IHalAdapterVendorExtension/default": EXCEPTION_NO_FUZZER, "android.se.omapi.ISecureElementService/default": EXCEPTION_NO_FUZZER, "android.system.keystore2.IKeystoreService/default": EXCEPTION_NO_FUZZER, "android.system.net.netd.INetd/default": []string{"netd_hw_service_fuzzer"}, diff --git a/contexts/plat_file_contexts_test b/contexts/plat_file_contexts_test index 64b2f2da9..a2665b6a6 100644 --- a/contexts/plat_file_contexts_test +++ b/contexts/plat_file_contexts_test @@ -752,7 +752,8 @@ /system/system_ext/bin/hwservicemanager hwservicemanager_exec /system_ext/bin/hw/android.hidl.allocator@1.0-service hal_allocator_default_exec /system/system_ext/bin/hw/android.hidl.allocator@1.0-service hal_allocator_default_exec - +/system_ext/bin/hw/android.hardware.audio.parameter_parser.example_service audio_vendor_parameter_parser_exec +/system/system_ext/bin/hw/android.hardware.audio.parameter_parser.example_service audio_vendor_parameter_parser_exec /system_ext/bin/canhalconfigurator canhalconfigurator_exec /system_ext/bin/canhalconfigurator-aidl canhalconfigurator_exec diff --git a/private/audio_vendor_parameter_parser_service.te b/private/audio_vendor_parameter_parser_service.te new file mode 100644 index 000000000..155c8404a --- /dev/null +++ b/private/audio_vendor_parameter_parser_service.te @@ -0,0 +1,13 @@ +# Define a vendor parameter parser service which is used by the audio server +type audio_vendor_parameter_parser, coredomain, domain; +type audio_vendor_parameter_parser_exec, system_file_type, file_type, exec_type; +init_daemon_domain(audio_vendor_parameter_parser) + +binder_service(audio_vendor_parameter_parser) + +add_service(audio_vendor_parameter_parser, audio_vendor_parameter_parser_service); + +binder_call(audioserver, audio_vendor_parameter_parser) +binder_call(audio_vendor_parameter_parser, servicemanager) + +allow audioserver audio_vendor_parameter_parser_service:service_manager find; diff --git a/private/file_contexts b/private/file_contexts index 7fbc580ab..502e845bb 100644 --- a/private/file_contexts +++ b/private/file_contexts @@ -518,6 +518,7 @@ /(system_ext|system/system_ext)/bin/hidl_lazy_cb_test_server u:object_r:hidl_lazy_test_server_exec:s0 /(system_ext|system/system_ext)/bin/hwservicemanager u:object_r:hwservicemanager_exec:s0 /(system_ext|system/system_ext)/bin/hw/android\.hidl\.allocator@1\.0-service u:object_r:hal_allocator_default_exec:s0 +/(system_ext|system/system_ext)/bin/hw/android\.hardware\.audio\.parameter_parser\.example_service u:object_r:audio_vendor_parameter_parser_exec:s0 /(system_ext|system/system_ext)/bin/canhalconfigurator(-aidl)? u:object_r:canhalconfigurator_exec:s0 diff --git a/private/service.te b/private/service.te index e97eb8c92..200e96874 100644 --- a/private/service.te +++ b/private/service.te @@ -1,5 +1,6 @@ type ambient_context_service, app_api_service, system_server_service, service_manager_type; type attention_service, system_server_service, service_manager_type; +type audio_vendor_parameter_parser_service, service_manager_type; type bg_install_control_service, system_api_service, system_server_service, service_manager_type; type compos_service, service_manager_type; type communal_service, app_api_service, system_server_service, service_manager_type; diff --git a/private/service_contexts b/private/service_contexts index 5d3aaa72f..931767edb 100644 --- a/private/service_contexts +++ b/private/service_contexts @@ -147,6 +147,7 @@ aidl_lazy_test_quit u:object_r:aidl_lazy_test_service:s0 aidl_lazy_cb_test u:object_r:aidl_lazy_test_service:s0 alarm u:object_r:alarm_service:s0 android.hardware.automotive.evs.IEvsEnumerator/default u:object_r:evsmanagerd_service:s0 +android.media.audio.IHalAdapterVendorExtension/default u:object_r:audio_vendor_parameter_parser_service:s0 android.os.UpdateEngineService u:object_r:update_engine_service:s0 android.os.UpdateEngineStableService u:object_r:update_engine_stable_service:s0 android.frameworks.automotive.display.ICarDisplayProxy/default u:object_r:fwk_automotive_display_service:s0