Before, the call to closeAll() in McsService#connect() would trigger a SocketException (Socket closed) in McsOutputStream and/or McsInputStream. This would send a teardown message causing McsService to take the new connection down right away. In unlucky situations, this could cause small connect/teardown loops. This commit hopes to prevent those.
Change-Id: Id347d598e028bdd1ba2622cd6a5c6b07874335d6
Waiting twice the heartbeat interval since the last ACK can make us miss dead connections for more than 10min in which no push messages get received.
This change requires the ACK to come within 90 seconds of sending the heartbeat ping, otherwise the connection is considered dead which will trigger a re-connect.
We use a high timeout of 90 seconds, because in some mobile networks (like in trains) ping times of more than 60 seconds have been observed in practice.
Change-Id: I8e63843400b47e1a6d23faf180f9446bcb5e0cd8
This may cause a connection attempt, but in connect(), we'll notice that it is disabled and won't continue to connect.
Change-Id: Id5f00539a48fad16b5e5f55bd336fb8890aa1acc
Otherwise, this gets called multiple times from different places via MSG_TEARDOWN. This causes the reconnect delay to increase with each call to scheduleReconnect(), increasing the time we stay disconnected.
This commit introduces a boolean flag preventing handleTeardown() to run twice or more until connect() was called again.
Change-Id: I3d7cb08d696be48532a61819fbb279a908919a3d
Instead of directly jumping to the settings screen (which is what the
"Request background location access" amounts to) and leaving the user
there without a clue what to do, we update the label, icon and button
with new text explaining what the user needs to do next.