From 00646d2a8e3e57ec1e62bd786c3eea547471ed58 Mon Sep 17 00:00:00 2001 From: SamarV-121 Date: Tue, 23 Nov 2021 21:30:48 +0530 Subject: [PATCH 1/3] GS290: libshim_vtservice: Update to S [1] https://github.com/LineageOS/android_frameworks_av/commit/bda4575c36ad11b0870ccdb50dcb3a04573d6782#diff-0e7ff81a94e7f5ce90bdb128b6ceea84c201a721055b05afccfa2ec814036907 [2] https://github.com/LineageOS/android_frameworks_av/commit/337611324fb7b22600d588493f938e7df4789e3d#diff-0e7ff81a94e7f5ce90bdb128b6ceea84c201a721055b05afccfa2ec814036907 Change-Id: I09c2dc7294811931c43d3e280c008e0b3588ac76 Signed-off-by: SamarV-121 --- ims/libshim_vtservice.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ims/libshim_vtservice.cpp b/ims/libshim_vtservice.cpp index cdaf667..ad334ba 100644 --- a/ims/libshim_vtservice.cpp +++ b/ims/libshim_vtservice.cpp @@ -3,7 +3,6 @@ using namespace android; extern "C" { -// Old constructor without opPackageName void _ZN7android10AudioTrackC1E19audio_stream_type_tj14audio_format_tjj20audio_output_flags_tPFviPvS4_ES4_i15audio_session_tNS0_13transfer_typeEPK20audio_offload_info_tjiPK18audio_attributes_tbfi( audio_stream_type_t streamType, uint32_t sampleRate, @@ -23,11 +22,10 @@ void _ZN7android10AudioTrackC1E19audio_stream_type_tj14audio_format_tjj20audio_o bool doNotReconnect, float maxRequiredSpeed, audio_port_handle_t selectedDeviceId) { - const std::string& opPackageName = "com.mediatek.ims"; + const AttributionSourceState& attributionSource = AttributionSourceState(); new android::AudioTrack(streamType, sampleRate, format, channelMask, frameCount, flags, cbf, - user, notificationFrames, sessionId, transferType, offloadInfo, uid, - pid, pAttributes, doNotReconnect, maxRequiredSpeed, selectedDeviceId, - opPackageName); + user, notificationFrames, sessionId, transferType, offloadInfo, attributionSource, + pAttributes, doNotReconnect, maxRequiredSpeed, selectedDeviceId); } void _ZN7android11AudioSourceC1E14audio_source_tRKNS_8String16Ejjjjii28audio_microphone_direction_tf() {} -- GitLab From 46d7dae3e19a149f756bf9f35162ae4570d4164c Mon Sep 17 00:00:00 2001 From: Jackeagle Date: Wed, 21 Jun 2023 05:45:20 -0400 Subject: [PATCH 2/3] GS290: libshim_vtservice: Address more missing symbols Change-Id: I58505118c114577174c5a215de8e29b1acc99649 Signed-off-by: Jackeagle --- ims/Android.bp | 7 ++++++- ims/libshim_vtservice.cpp | 13 ++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ims/Android.bp b/ims/Android.bp index 6604ed0..ffd3b72 100644 --- a/ims/Android.bp +++ b/ims/Android.bp @@ -16,7 +16,12 @@ cc_library_shared { name: "libshim_vtservice", srcs: ["libshim_vtservice.cpp"], - shared_libs: ["libaudioclient"], + shared_libs: [ + "libaudioclient", + "libgui", + "libstagefright", + "libutils", + ], header_libs: [ "libaudioclient_headers", "libmedia_headers", diff --git a/ims/libshim_vtservice.cpp b/ims/libshim_vtservice.cpp index ad334ba..cd7c91d 100644 --- a/ims/libshim_vtservice.cpp +++ b/ims/libshim_vtservice.cpp @@ -1,3 +1,4 @@ +#include #include using namespace android; @@ -28,5 +29,15 @@ void _ZN7android10AudioTrackC1E19audio_stream_type_tj14audio_format_tjj20audio_o pAttributes, doNotReconnect, maxRequiredSpeed, selectedDeviceId); } - void _ZN7android11AudioSourceC1E14audio_source_tRKNS_8String16Ejjjjii28audio_microphone_direction_tf() {} +void _ZN7android11AudioSourceC1E14audio_source_tRKNS_8String16Ejjjjii28audio_microphone_direction_tf() {} + +void _ZN7android7SurfaceC1ERKNS_2spINS_22IGraphicBufferProducerEEEbRKNS1_INS_7IBinderEEE( + void* thisptr, const sp& bufferProducer, bool controlledByApp, const sp& surfaceControlHandle); + +void _ZN7android7SurfaceC1ERKNS_2spINS_22IGraphicBufferProducerEEEb( + void* thisptr, const sp &bufferProducer, bool controlledByApp) { + _ZN7android7SurfaceC1ERKNS_2spINS_22IGraphicBufferProducerEEEbRKNS1_INS_7IBinderEEE(thisptr, bufferProducer, controlledByApp, nullptr); +} + +int _ZN7android10MediaMuxerC1EiNS0_12OutputFormatE[6] = { 0, 1, 2, 3, 4, NULL }; } -- GitLab From 96bf53d99a598e14f6cc14a6c08260dcc31a5968 Mon Sep 17 00:00:00 2001 From: bengris32 Date: Mon, 9 May 2022 15:57:21 +0100 Subject: [PATCH 3/3] GS290: libshim_vtservice: Fixup vtservice shim * All non-static class member functions (including constructors/destructors) carry a hidden this pointer. Add it. * AttributionSourceState now holds the pid and uid, create a new AttributionSourceState and set the uid and pid and pass it to new AudioTrack constructor. * _ZN7android10MediaMuxerC1EiNS0_12OutputFormatE is a class constructor, so call the new equivalent. * Only build 32bit library, since vtservice is 32bit on pre A12 IMS stack, and size_t on 32bit is unsigned int, while on 64 bit it is unsigned long, meaning that we can't link the shim against the 32bit and 64bit lib since the symbol changes (well, we could with a compiler macro to use the correct symbol name for the 2 libs, but as stated before, there is no point). Signed-off-by: bengris32 Change-Id: I275fac7ddf63595f482ebef80d2116a322b6db60 --- ims/Android.bp | 1 + ims/libshim_vtservice.cpp | 43 +++++++++++++++++++++++++++++++++------ 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/ims/Android.bp b/ims/Android.bp index ffd3b72..fff2c4d 100644 --- a/ims/Android.bp +++ b/ims/Android.bp @@ -16,6 +16,7 @@ cc_library_shared { name: "libshim_vtservice", srcs: ["libshim_vtservice.cpp"], + compile_multilib: "32", shared_libs: [ "libaudioclient", "libgui", diff --git a/ims/libshim_vtservice.cpp b/ims/libshim_vtservice.cpp index cd7c91d..b99bac5 100644 --- a/ims/libshim_vtservice.cpp +++ b/ims/libshim_vtservice.cpp @@ -1,10 +1,33 @@ #include #include +#include using namespace android; extern "C" { + +void _ZN7android10AudioTrackC1E19audio_stream_type_tj14audio_format_t20audio_channel_mask_tj20audio_output_flags_tPFviPvS5_ES5_i15audio_session_tNS0_13transfer_typeEPK20audio_offload_info_tRKNS_7content22AttributionSourceStateEPK18audio_attributes_tbfi( + void* thisptr, + audio_stream_type_t streamType, + uint32_t sampleRate, + audio_format_t format, + audio_channel_mask_t channelMask, + size_t frameCount, + audio_output_flags_t flags, + android::AudioTrack::callback_t cbf, + void* user, + int32_t notificationFrames, + audio_session_t sessionId, + android::AudioTrack::transfer_type transferType, + const audio_offload_info_t *offloadInfo, + const AttributionSourceState& attributionSource, + const audio_attributes_t* pAttributes, + bool doNotReconnect, + float maxRequiredSpeed, + audio_port_handle_t selectedDeviceId); + void _ZN7android10AudioTrackC1E19audio_stream_type_tj14audio_format_tjj20audio_output_flags_tPFviPvS4_ES4_i15audio_session_tNS0_13transfer_typeEPK20audio_offload_info_tjiPK18audio_attributes_tbfi( + void* thisptr, audio_stream_type_t streamType, uint32_t sampleRate, audio_format_t format, @@ -23,11 +46,15 @@ void _ZN7android10AudioTrackC1E19audio_stream_type_tj14audio_format_tjj20audio_o bool doNotReconnect, float maxRequiredSpeed, audio_port_handle_t selectedDeviceId) { - const AttributionSourceState& attributionSource = AttributionSourceState(); - new android::AudioTrack(streamType, sampleRate, format, channelMask, frameCount, flags, cbf, - user, notificationFrames, sessionId, transferType, offloadInfo, attributionSource, - pAttributes, doNotReconnect, maxRequiredSpeed, selectedDeviceId); - } + AttributionSourceState* attributionSource = new AttributionSourceState(); + attributionSource->uid = uid; + attributionSource->pid = pid; + _ZN7android10AudioTrackC1E19audio_stream_type_tj14audio_format_t20audio_channel_mask_tj20audio_output_flags_tPFviPvS5_ES5_i15audio_session_tNS0_13transfer_typeEPK20audio_offload_info_tRKNS_7content22AttributionSourceStateEPK18audio_attributes_tbfi( + thisptr, streamType, sampleRate, format, channelMask, frameCount, flags, cbf, + user, notificationFrames, sessionId, transferType, offloadInfo, + *attributionSource, pAttributes, + doNotReconnect, maxRequiredSpeed, selectedDeviceId); +} void _ZN7android11AudioSourceC1E14audio_source_tRKNS_8String16Ejjjjii28audio_microphone_direction_tf() {} @@ -39,5 +66,9 @@ void _ZN7android7SurfaceC1ERKNS_2spINS_22IGraphicBufferProducerEEEb( _ZN7android7SurfaceC1ERKNS_2spINS_22IGraphicBufferProducerEEEbRKNS1_INS_7IBinderEEE(thisptr, bufferProducer, controlledByApp, nullptr); } -int _ZN7android10MediaMuxerC1EiNS0_12OutputFormatE[6] = { 0, 1, 2, 3, 4, NULL }; +void _ZN7android10MediaMuxerC1EiNS_14MediaMuxerBase12OutputFormatE(void* thisptr, int fd, android::MediaMuxer::OutputFormat format); + +void _ZN7android10MediaMuxerC1EiNS0_12OutputFormatE(void* thisptr, int fd, android::MediaMuxer::OutputFormat format) { + _ZN7android10MediaMuxerC1EiNS_14MediaMuxerBase12OutputFormatE(thisptr, fd, format); +} } -- GitLab