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

Commit 7af6ee7a authored by Eric Laurent's avatar Eric Laurent Committed by Mikhail Naganov
Browse files

libaudiohal: implement supportsBluetoothVariableLatency for HIDL

Implement supportsBluetoothVariableLatency for HIDL by way of
getParameters API.

Bug: 287695426
Test: verify that low latency mode is requested when TalkBack is playing
Change-Id: Ibacbdf6cefbcb96b6ac3cfd82b6d26a0e36c8a08
Merged-In: Ibacbdf6cefbcb96b6ac3cfd82b6d26a0e36c8a08
(cherry picked from commit 321b5c9d)
parent 1e0b2997
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1010,7 +1010,7 @@ status_t DeviceHalAidl::dump(int fd, const Vector<String16>& args) {
    return mModule->dump(fd, Args(args).args(), args.size());
}

int32_t DeviceHalAidl::supportsBluetoothVariableLatency(bool* supports) {
status_t DeviceHalAidl::supportsBluetoothVariableLatency(bool* supports) {
    TIME_CHECK();
    if (!mModule) return NO_INIT;
    if (supports == nullptr) {
+1 −1
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ class DeviceHalAidl : public DeviceHalInterface, public ConversionHelperAidl,

    error::Result<audio_hw_sync_t> getHwAvSync() override;

    int32_t supportsBluetoothVariableLatency(bool* supports __unused) override;
    status_t supportsBluetoothVariableLatency(bool* supports __unused) override;

    status_t getSoundDoseInterface(const std::string& module,
                                   ::ndk::SpAIBinder* soundDoseBinder) override;
+22 −0
Original line number Diff line number Diff line
@@ -684,4 +684,26 @@ status_t DeviceHalHidl::getSoundDoseInterface(const std::string& module,
}
#endif

status_t DeviceHalHidl::supportsBluetoothVariableLatency(bool* supports) {
    if (supports == nullptr) {
        return BAD_VALUE;
    }
    *supports = false;

    String8 reply;
    status_t status = getParameters(
            String8(AUDIO_PARAMETER_BT_VARIABLE_LATENCY_SUPPORTED), &reply);
    if (status != NO_ERROR) {
        return status;
    }
    AudioParameter replyParams(reply);
    String8 trueOrFalse;
    status = replyParams.get(
            String8(AUDIO_PARAMETER_BT_VARIABLE_LATENCY_SUPPORTED), trueOrFalse);
    if (status != NO_ERROR) {
        return status;
    }
    *supports = trueOrFalse == AudioParameter::valueTrue;
    return NO_ERROR;
}
} // namespace android
+1 −4
Original line number Diff line number Diff line
@@ -127,10 +127,7 @@ class DeviceHalHidl : public DeviceHalInterface, public CoreConversionHelperHidl
        return INVALID_OPERATION;
    }

    int32_t supportsBluetoothVariableLatency(bool* supports __unused) override {
        // TODO: Implement the HAL query when moving to AIDL HAL.
        return INVALID_OPERATION;
    }
    status_t supportsBluetoothVariableLatency(bool* supports) override;

    status_t setConnectedState(const struct audio_port_v7 *port, bool connected) override;

+1 −1
Original line number Diff line number Diff line
@@ -142,7 +142,7 @@ class DeviceHalInterface : public virtual RefBase
    virtual int32_t getAAudioMixerBurstCount() = 0;
    virtual int32_t getAAudioHardwareBurstMinUsec() = 0;

    virtual int32_t supportsBluetoothVariableLatency(bool* supports) = 0;
    virtual status_t supportsBluetoothVariableLatency(bool* supports) = 0;

    // Update the connection status of an external device.
    virtual status_t setConnectedState(const struct audio_port_v7* port, bool connected) = 0;