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

Commit 95fcf2ae authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

vc: Improve logging

When vc decides to not update remote devices with volume, lets make it
more clear why instead of writing "group not connected ?"

Bug: 284407124
Test: compile
Tag: #feature
Change-Id: I68e870f3c285e2cd567b4b3b54c5946cb37744cc
parent 6aec0a74
Loading
Loading
Loading
Loading
+47 −10
Original line number Diff line number Diff line
@@ -882,18 +882,36 @@ class VolumeControlImpl : public VolumeControl {
      }

      auto devices = csis_api->GetDeviceList(group_id);
      if (devices.empty()) {
        LOG_ERROR("group id: %d has no devices", group_id);
        return;
      }

      bool muteNotChanged = false;
      bool deviceNotReady = false;

      for (auto it = devices.begin(); it != devices.end();) {
        auto dev = volume_control_devices_.FindByAddress(*it);
        if (!dev || !dev->IsReady() || (dev->mute == mute)) {
        if (!dev) {
          it = devices.erase(it);
        } else {
          it++;
          continue;
        }

        if (!dev->IsReady() || (dev->mute == mute)) {
          it = devices.erase(it);
          muteNotChanged =
              muteNotChanged ? muteNotChanged : (dev->mute == mute);
          deviceNotReady = deviceNotReady ? deviceNotReady : !dev->IsReady();
          continue;
        }
        it++;
      }

      if (devices.empty()) {
        LOG(ERROR) << __func__ << " group id : " << group_id
                   << " is not connected? ";
        LOG_DEBUG(
            "No need to update mute for group id: %d . muteNotChanged: %d, "
            "deviceNotReady: %d",
            group_id, muteNotChanged, deviceNotReady);
        return;
      }

@@ -948,18 +966,37 @@ class VolumeControlImpl : public VolumeControl {
      }

      auto devices = csis_api->GetDeviceList(group_id);
      if (devices.empty()) {
        LOG_ERROR("group id: %d has no devices", group_id);
        return;
      }

      bool volumeNotChanged = false;
      bool deviceNotReady = false;

      for (auto it = devices.begin(); it != devices.end();) {
        auto dev = volume_control_devices_.FindByAddress(*it);
        if (!dev || !dev->IsReady() || (dev->volume == volume)) {
        if (!dev) {
          it = devices.erase(it);
        } else {
          it++;
          continue;
        }

        if (!dev->IsReady() || (dev->volume == volume)) {
          it = devices.erase(it);
          volumeNotChanged =
              volumeNotChanged ? volumeNotChanged : (dev->volume == volume);
          deviceNotReady = deviceNotReady ? deviceNotReady : !dev->IsReady();
          continue;
        }

        it++;
      }

      if (devices.empty()) {
        LOG(ERROR) << __func__ << " group id : " << group_id
                   << " is not connected? ";
        LOG_DEBUG(
            "No need to update volume for group id: %d . volumeNotChanged: %d, "
            "deviceNotReady: %d",
            group_id, volumeNotChanged, deviceNotReady);
        return;
      }