LG8n: Add shim for proprietary AudioTrack constructor

Change-Id: Icc7a1f9c748578f5b58499e7a76213673c4bcf54
Signed-off-by: bengris32 <bengris32@protonmail.ch>
Signed-off-by: Shirayuki39 <lorddemecrius83@proton.me>
This commit is contained in:
bengris32 2024-07-17 08:27:20 +08:00 committed by Shirayuki39
parent be61e68918
commit 677091e3f0
4 changed files with 66 additions and 0 deletions

View file

@ -196,6 +196,9 @@ PRODUCT_BOOT_JARS += \
mediatek-telephony-base \ mediatek-telephony-base \
mediatek-telephony-common mediatek-telephony-common
PRODUCT_PACKAGES += \
libshim_sink
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/privapp-permissions-com.mediatek.ims.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/permissions/privapp-permissions-com.mediatek.ims.xml $(LOCAL_PATH)/configs/privapp-permissions-com.mediatek.ims.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/permissions/privapp-permissions-com.mediatek.ims.xml

View file

@ -71,6 +71,9 @@ function blob_fixup {
"${PATCHELF}" --replace-needed "libbinder.so" "libbinder-v31.so" "${2}" "${PATCHELF}" --replace-needed "libbinder.so" "libbinder-v31.so" "${2}"
"${PATCHELF}" --replace-needed "libhidlbase.so" "libhidlbase-v31.so" "${2}" "${PATCHELF}" --replace-needed "libhidlbase.so" "libhidlbase-v31.so" "${2}"
;; ;;
lib64/libsink.so)
"${PATCHELF}" --add-needed "libshim_sink.so" "$2"
;;
vendor/bin/hw/android.hardware.gnss-service.mediatek |\ vendor/bin/hw/android.hardware.gnss-service.mediatek |\
vendor/lib64/hw/android.hardware.gnss-impl-mediatek.so) vendor/lib64/hw/android.hardware.gnss-impl-mediatek.so)
"$PATCHELF" --replace-needed "android.hardware.gnss-V1-ndk_platform.so" "android.hardware.gnss-V1-ndk.so" "$2" "$PATCHELF" --replace-needed "android.hardware.gnss-V1-ndk_platform.so" "android.hardware.gnss-V1-ndk.so" "$2"

18
libshims/Android.bp Normal file
View file

@ -0,0 +1,18 @@
//
// Copyright (C) 2023 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
cc_library_shared {
name: "libshim_sink",
srcs: ["libshim_sink.cpp"],
compile_multilib: "64",
shared_libs: [
"libaudioclient",
],
header_libs: [
"libaudioclient_headers",
"libmedia_headers",
],
}

42
libshims/libshim_sink.cpp Normal file
View file

@ -0,0 +1,42 @@
/*
* Copyright (C) 2023 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <media/AudioTrack.h>
using namespace android;
extern "C" {
void _ZN7android10AudioTrackC1E19audio_stream_type_tj14audio_format_t20audio_channel_mask_tm20audio_output_flags_tRKNS_2wpINS0_19IAudioTrackCallbackEEEi15audio_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,
const wp<AudioTrack::IAudioTrackCallback> &callback,
int32_t notificationFrames, audio_session_t sessionId,
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_t20audio_channel_mask_tm20audio_output_flags_tRKNS_2wpINS0_19IAudioTrackCallbackEEEi15audio_session_tNS0_13transfer_typeEPK20audio_offload_info_tRKNS_7content22AttributionSourceStateEPK18audio_attributes_tbfiRKNSt3__112basic_stringIcNSM_11char_traitsIcEENSM_9allocatorIcEEEE(
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,
const wp<AudioTrack::IAudioTrackCallback> &callback,
int32_t notificationFrames, audio_session_t sessionId,
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,
const std::string& /* unknown */) {
_ZN7android10AudioTrackC1E19audio_stream_type_tj14audio_format_t20audio_channel_mask_tm20audio_output_flags_tRKNS_2wpINS0_19IAudioTrackCallbackEEEi15audio_session_tNS0_13transfer_typeEPK20audio_offload_info_tRKNS_7content22AttributionSourceStateEPK18audio_attributes_tbfi(
thisptr, streamType, sampleRate, format, channelMask, frameCount, flags,
callback, notificationFrames, sessionId, transferType, offloadInfo,
attributionSource, pAttributes, doNotReconnect, maxRequiredSpeed,
selectedDeviceId);
}
}