diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2021-04-20 20:31:22 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2021-04-21 16:42:11 +0000 |
| commit | e346b8ff533d3556fbf97c9201799366a1b4f0db (patch) | |
| tree | e183049bef34a09dfcb06627620732fc743e0cb5 /android/src/androidTest | |
| parent | 03832400d7b84de43d626727e28f39685d86e36e (diff) | |
| download | mullvadvpn-e346b8ff533d3556fbf97c9201799366a1b4f0db.tar.xz mullvadvpn-e346b8ff533d3556fbf97c9201799366a1b4f0db.zip | |
Ensure `ListenerReady` handler is registered first
Previously there could be a race condition because the
`ServiceConnection` constructor would register itself as an event
listener on the service without registering a handler for the
`ListenerReady` event sent after the registration is complete. The
`MainActivity` would then register the handler, and things would work
because the service would send multiple events before sending the
`ListenerReady`, giving time for the handler to be registered before the
event is received.
This commit changes that in order to avoid the race condition. Now the
`ServiceConnection` constructor must receive a callback as a parameter,
and this callback will be used when registering for the `ListenerReady`
event. This allows the constructor to enforce that the handler for the
event is configured before the request for registration is sent.
Diffstat (limited to 'android/src/androidTest')
0 files changed, 0 insertions, 0 deletions
