Currently sdk keeps retrying heartbeats in case of StatusRuntimeException or any other failure of heartbeat calls
(see doHeartBeatLocked method in HeartbeatContextImpl)
Feature request is for SDK to keep track of current heartbeat timeout for activity, and stop retrying heartbeats it it thinks the activity has timed out.
In this case also activity code should be able to learn about this either via existing ActivityCompletionException
or maybe add a new exception type to denote this scenario fine too.