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

Commit 90315835 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hal : properly clear thread instances during vts" into audio-hal.lnx.6.0

parents 0503bbdd a2b4967c
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ struct BatteryListenerImpl : public hardware::health::V2_0::IHealthInfoCallback,
        std::lock_guard<std::mutex> _l(mLock);
        return statusToBool(mStatus);
    }
    void reset();
  private:
    sp<hardware::health::V2_0::IHealth> mHealth;
    status_t init();
@@ -164,15 +165,19 @@ BatteryListenerImpl::BatteryListenerImpl(cb_fn_t cb) :

BatteryListenerImpl::~BatteryListenerImpl()
{
    {
    mThread->join();
}

void BatteryListenerImpl::reset(){
    std::lock_guard<std::mutex> _l(mLock);
        if (mHealth != NULL)
    if (mHealth != nullptr) {
        mHealth->unregisterCallback(this);
        mHealth->unlinkToDeath(this);
    }
    mStatus = BatteryStatus::UNKNOWN;
    mDone = true;
    mThread->join();
    mCond.notify_one();
}

void BatteryListenerImpl::serviceDied(uint64_t cookie __unused,
                                     const wp<hidl::base::V1_0::IBase>& who)
{
@@ -216,6 +221,7 @@ status_t batteryPropertiesListenerInit(BatteryListenerImpl::cb_fn_t cb)

status_t batteryPropertiesListenerDeinit()
{
    batteryListener->reset();
    batteryListener.clear();
    return OK;
}
+1 −0
Original line number Diff line number Diff line
@@ -9472,6 +9472,7 @@ static int adev_close(hw_device_t *device)
    if ((--audio_device_ref_count) == 0) {
         if (audio_extn_spkr_prot_is_enabled())
             audio_extn_spkr_prot_deinit();
        audio_extn_battery_properties_listener_deinit();
        audio_extn_snd_mon_unregister_listener(adev);
        audio_extn_sound_trigger_deinit(adev);
        audio_extn_listen_deinit(adev);