stopSessionActivity function
Decrement the activity refcount. When reaching 0, stop heartbeat and start idle timer.
Implementation
void stopSessionActivity(SessionActivityReason reason) {
if (_activityRefcount > 0) _activityRefcount--;
final n = (_activeReasons[reason] ?? 0) - 1;
if (n > 0) {
_activeReasons[reason] = n;
} else {
_activeReasons.remove(reason);
}
if (_activityRefcount == 0 && _heartbeatTimer != null) {
_heartbeatTimer!.cancel();
_heartbeatTimer = null;
_startIdleTimer();
}
}