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

Commit d08b5b7d authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes from topic "bluetoothmodule" into main am: 169be347 am: d5054454 am: 178734d7

parents 0d3cbd41 178734d7
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -82,19 +82,18 @@ ndk::ScopedAStatus Bluetooth::setHfpConfig(const HfpConfig& in_config, HfpConfig

ndk::ScopedAStatus BluetoothA2dp::isEnabled(bool* _aidl_return) {
    *_aidl_return = mEnabled;
    LOG(DEBUG) << __func__ << ": returning " << *_aidl_return;
    return ndk::ScopedAStatus::ok();
}

ndk::ScopedAStatus BluetoothA2dp::setEnabled(bool in_enabled) {
    mEnabled = in_enabled;
    LOG(DEBUG) << __func__ << ": " << mEnabled;
    if (mHandler) return mHandler();
    return ndk::ScopedAStatus::ok();
}

ndk::ScopedAStatus BluetoothA2dp::supportsOffloadReconfiguration(bool* _aidl_return) {
    *_aidl_return = true;
    LOG(DEBUG) << __func__ << ": returning " << *_aidl_return;
    *_aidl_return = false;
    return ndk::ScopedAStatus::ok();
}

@@ -102,24 +101,22 @@ ndk::ScopedAStatus BluetoothA2dp::reconfigureOffload(
        const std::vector<::aidl::android::hardware::audio::core::VendorParameter>& in_parameters
                __unused) {
    LOG(DEBUG) << __func__ << ": " << ::android::internal::ToString(in_parameters);
    return ndk::ScopedAStatus::ok();
    return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}

ndk::ScopedAStatus BluetoothLe::isEnabled(bool* _aidl_return) {
    *_aidl_return = mEnabled;
    LOG(DEBUG) << __func__ << ": returning " << *_aidl_return;
    return ndk::ScopedAStatus::ok();
}

ndk::ScopedAStatus BluetoothLe::setEnabled(bool in_enabled) {
    mEnabled = in_enabled;
    LOG(DEBUG) << __func__ << ": " << mEnabled;
    if (mHandler) return mHandler();
    return ndk::ScopedAStatus::ok();
}

ndk::ScopedAStatus BluetoothLe::supportsOffloadReconfiguration(bool* _aidl_return) {
    *_aidl_return = true;
    LOG(DEBUG) << __func__ << ": returning " << *_aidl_return;
    *_aidl_return = false;
    return ndk::ScopedAStatus::ok();
}

@@ -127,7 +124,7 @@ ndk::ScopedAStatus BluetoothLe::reconfigureOffload(
        const std::vector<::aidl::android::hardware::audio::core::VendorParameter>& in_parameters
                __unused) {
    LOG(DEBUG) << __func__ << ": " << ::android::internal::ToString(in_parameters);
    return ndk::ScopedAStatus::ok();
    return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}

}  // namespace aidl::android::hardware::audio::core
+9 −0
Original line number Diff line number Diff line
@@ -1371,4 +1371,13 @@ ndk::ScopedAStatus Module::onMasterVolumeChanged(float volume __unused) {
    return ndk::ScopedAStatus::ok();
}

Module::BtProfileHandles Module::getBtProfileManagerHandles() {
    return std::make_tuple(std::weak_ptr<IBluetooth>(), std::weak_ptr<IBluetoothA2dp>(),
                           std::weak_ptr<IBluetoothLe>());
}

ndk::ScopedAStatus Module::bluetoothParametersUpdated() {
    return mStreams.bluetoothParametersUpdated();
}

}  // namespace aidl::android::hardware::audio::core
+5 −0
Original line number Diff line number Diff line
@@ -723,6 +723,11 @@ ndk::ScopedAStatus StreamCommonImpl::setConnectedDevices(
    return ndk::ScopedAStatus::ok();
}

ndk::ScopedAStatus StreamCommonImpl::bluetoothParametersUpdated() {
    LOG(DEBUG) << __func__;
    return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}

namespace {
static std::map<AudioDevice, std::string> transformMicrophones(
        const std::vector<MicrophoneInfo>& microphones) {
+20 −0
Original line number Diff line number Diff line
@@ -233,8 +233,28 @@ ndk::ScopedAStatus StreamSwitcher::setConnectedDevices(const std::vector<AudioDe
                             << status.getDescription();
            }
        }
        if (mBluetoothParametersUpdated) {
            if (auto status = mStream->bluetoothParametersUpdated(); !status.isOk()) {
                LOG(WARNING) << __func__
                             << ": error while updating BT parameters for a new stream: "
                             << status.getDescription();
            }
        }
        mBluetoothParametersUpdated = false;
    }
    return ndk::ScopedAStatus::ok();
}

ndk::ScopedAStatus StreamSwitcher::bluetoothParametersUpdated() {
    if (mStream == nullptr) {
        LOG(ERROR) << __func__ << ": stream was closed";
        return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
    }
    if (mIsStubStream) {
        mBluetoothParametersUpdated = true;
        return ndk::ScopedAStatus::ok();
    }
    return mStream->bluetoothParametersUpdated();
}

}  // namespace aidl::android::hardware::audio::core
+15 −0
Original line number Diff line number Diff line
@@ -302,6 +302,21 @@ bool BluetoothAudioPortAidl::loadAudioConfig(PcmConfiguration* audio_cfg) const
    return true;
}

bool BluetoothAudioPortAidl::standby() {
    if (!inUse()) {
        LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
        return false;
    }
    std::lock_guard guard(mCvMutex);
    LOG(VERBOSE) << __func__ << debugMessage() << ", state=" << getState() << " request";
    if (mState == BluetoothStreamState::DISABLED) {
        mState = BluetoothStreamState::STANDBY;
        LOG(VERBOSE) << __func__ << debugMessage() << ", state=" << getState() << " done";
        return true;
    }
    return false;
}

bool BluetoothAudioPortAidl::condWaitState(BluetoothStreamState state) {
    const auto waitTime = std::chrono::milliseconds(kMaxWaitingTimeMs);
    std::unique_lock lock(mCvMutex);
Loading