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

Commit c87b6039 authored by Jeremy Wu's avatar Jeremy Wu
Browse files

Floss: force update |ConnectionHandler::feature_map_|

Absolute volume support relies on the result of |SdpLookup|, and is
stored in |ConnectionHandler::feature_map_|.

However, it is possible that the result is stored as "unsupported" in a
bad connection that doesn't get cleaned up properly (e.g., due to
missing "Connection Closed Event"), in which case the next connection
will inherit that result even when its |SdpLookup| finds
"supported", due to the use of |std::map::emplace|.

In this CL, we force the updates so the states sync better, assuming
there is no good reason to do such permissive update.

Bug: 254313937
Test: Deploy and verify absolute volume is correctly propagated after a
bad connection-disconnection
Tag: #floss

Change-Id: Ia634df6cd36dc17e0486391ff462d37bfc61ada6
parent bfd5658d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ bool ConnectionHandler::ConnectDevice(const RawAddress& bdaddr) {
      instance_->connection_cb_.Run(std::shared_ptr<Device>());
    }

    instance_->feature_map_.emplace(bdaddr, features);
    instance_->feature_map_[bdaddr] = features;
    instance_->AvrcpConnect(true, bdaddr);
    return;
  };
@@ -347,7 +347,7 @@ void ConnectionHandler::AcceptorControlCb(uint8_t handle, uint8_t event,
        }

        auto device = instance_->device_map_[handle];
        instance_->feature_map_.emplace(device->GetAddress(), features);
        instance_->feature_map_[device->GetAddress()] = features;

        // TODO (apanicke): Report to the VolumeInterface that a new Device is
        // connected that doesn't support absolute volume.