Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 689ff111 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8195043 from b62a3924 to tm-d1-release

Change-Id: I54abc8aa4275a29465a4429c1161743332abf3df
parents afdd6efa b62a3924
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <android/binder_process.h>
#include <binder/ProcessState.h>
#include <cutils/properties.h>
#include <dlfcn.h>
#include <hidl/HidlTransportSupport.h>
#include <hidl/LegacySupport.h>
#include <hwbinder/ProcessState.h>
@@ -46,6 +47,31 @@ static bool registerPassthroughServiceImplementations(Iter first, Iter last) {
    return false;
}

static bool registerExternalServiceImplementation(const std::string& libName,
                                                  const std::string& funcName) {
    constexpr int dlMode = RTLD_LAZY;
    void* handle = nullptr;
    dlerror();  // clear
    auto libPath = libName + ".so";
    handle = dlopen(libPath.c_str(), dlMode);
    if (handle == nullptr) {
        const char* error = dlerror();
        ALOGE("Failed to dlopen %s: %s", libPath.c_str(),
              error != nullptr ? error : "unknown error");
        return false;
    }
    binder_status_t (*factoryFunction)();
    *(void**)(&factoryFunction) = dlsym(handle, funcName.c_str());
    if (!factoryFunction) {
        const char* error = dlerror();
        ALOGE("Factory function %s not found in libName %s: %s", funcName.c_str(), libPath.c_str(),
              error != nullptr ? error : "unknown error");
        dlclose(handle);
        return false;
    }
    return ((*factoryFunction)() == STATUS_OK);
}

int main(int /* argc */, char* /* argv */ []) {
    signal(SIGPIPE, SIG_IGN);

@@ -105,6 +131,13 @@ int main(int /* argc */, char* /* argv */ []) {
            "android.hardware.bluetooth.a2dp@1.0::IBluetoothAudioOffload"
        }
    };

    const std::vector<std::pair<std::string,std::string>> optionalInterfaceSharedLibs = {
        {
            "android.hardware.bluetooth.audio-impl",
            "createIBluetoothAudioProviderFactory",
        },
    };
    // clang-format on

    for (const auto& listIter : mandatoryInterfaces) {
@@ -121,5 +154,15 @@ int main(int /* argc */, char* /* argv */ []) {
                 "Could not register %s", interfaceFamilyName.c_str());
    }

    for (const auto& interfacePair : optionalInterfaceSharedLibs) {
        const std::string& libraryName = interfacePair.first;
        const std::string& interfaceLoaderFuncName = interfacePair.second;
        if (registerExternalServiceImplementation(libraryName, interfaceLoaderFuncName)) {
            ALOGI("%s() from %s success", interfaceLoaderFuncName.c_str(), libraryName.c_str());
        } else {
            ALOGW("%s() from %s failed", interfaceLoaderFuncName.c_str(), libraryName.c_str());
        }
    }

    joinRpcThreadpool();
}
+4 −3
Original line number Diff line number Diff line
@@ -23,10 +23,11 @@ package android.hardware.automotive.vehicle;
@Backing(type="int")
enum CustomInputType {
    /**
     * Ten functions representing the custom input code to be defined and implemented by OEM
     * partners.
     * Ten optional functions to be used in case OEM don't need more than 10 input code values.
     *
     * OEMs need to formally contact Android team if more than 10 functions are required.
     * OEMs are free to use any signed 32 bits number to represent the input code value.
     * The following function keys are only for convenience and any other integer values are
     * also allowed.
     */
    CUSTOM_EVENT_F1 = 1001,
    CUSTOM_EVENT_F2 = 1002,
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ package android.hardware.bluetooth.audio;
@VintfStability
interface IBluetoothAudioProvider {
  void endSession();
  android.hardware.common.fmq.MQDescriptor<byte,android.hardware.common.fmq.SynchronizedReadWrite> startSession(in android.hardware.bluetooth.audio.IBluetoothAudioPort hostIf, in android.hardware.bluetooth.audio.AudioConfiguration audioConfig);
  android.hardware.common.fmq.MQDescriptor<byte,android.hardware.common.fmq.SynchronizedReadWrite> startSession(in android.hardware.bluetooth.audio.IBluetoothAudioPort hostIf, in android.hardware.bluetooth.audio.AudioConfiguration audioConfig, in android.hardware.bluetooth.audio.LatencyMode[] supportedLatencyModes);
  void streamStarted(in android.hardware.bluetooth.audio.BluetoothAudioStatus status);
  void streamSuspended(in android.hardware.bluetooth.audio.BluetoothAudioStatus status);
  void updateAudioConfiguration(in android.hardware.bluetooth.audio.AudioConfiguration audioConfig);
+5 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.hardware.bluetooth.audio;
import android.hardware.bluetooth.audio.AudioConfiguration;
import android.hardware.bluetooth.audio.BluetoothAudioStatus;
import android.hardware.bluetooth.audio.IBluetoothAudioPort;
import android.hardware.bluetooth.audio.LatencyMode;
import android.hardware.common.fmq.MQDescriptor;
import android.hardware.common.fmq.SynchronizedReadWrite;

@@ -50,6 +51,8 @@ interface IBluetoothAudioProvider {
     *    device. The PCM parameters are set if software based encoding,
     *    otherwise the correct codec configuration is used for hardware
     *    encoding.
     * @param supportedLatencyModes latency modes supported by the active
     * remote device
     *
     * @return The fast message queue for audio data from/to this
     *    provider. Audio data will be in PCM format as specified by the
@@ -57,8 +60,8 @@ interface IBluetoothAudioProvider {
     *    from/to hardware or on failure
     */
    MQDescriptor<byte, SynchronizedReadWrite> startSession(
            in IBluetoothAudioPort hostIf, in AudioConfiguration audioConfig);

            in IBluetoothAudioPort hostIf, in AudioConfiguration audioConfig,
            in LatencyMode[] supportedLatencyModes);
    /**
     * Callback for IBluetoothAudioPort.startStream()
     *
+6 −3
Original line number Diff line number Diff line
@@ -38,7 +38,10 @@ bool A2dpOffloadAudioProvider::isValid(const SessionType& session_type) {

ndk::ScopedAStatus A2dpOffloadAudioProvider::startSession(
    const std::shared_ptr<IBluetoothAudioPort>& host_if,
    const AudioConfiguration& audio_config, DataMQDesc* _aidl_return) {
    const AudioConfiguration& audio_config,
    const std::vector<LatencyMode>& latency_modes,
    DataMQDesc* _aidl_return) {
  latency_modes_ = latency_modes;
  if (audio_config.getTag() != AudioConfiguration::a2dpConfig) {
    LOG(WARNING) << __func__ << " - Invalid Audio Configuration="
                 << audio_config.toString();
@@ -52,8 +55,8 @@ ndk::ScopedAStatus A2dpOffloadAudioProvider::startSession(
    *_aidl_return = DataMQDesc();
    return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
  }
  return BluetoothAudioProvider::startSession(host_if, audio_config,
                                              _aidl_return);
  return BluetoothAudioProvider::startSession(
      host_if, audio_config, latency_modes, _aidl_return);
}

ndk::ScopedAStatus A2dpOffloadAudioProvider::onSessionReady(
Loading