## Problem
Android hosts show different timestamps for **Last seen** and **Last
fetched** on the host details page. For Android devices (which don't use
osquery check-in), both values should match because they're updated by
the same MDM sync operation.
Fixesfleetdm/fleet#43195
## Root Cause
`host_seen_times` is the table that powers the `seen_time` (Last seen)
value. For regular hosts, this is updated by osquery check-in. Android
hosts never populated this table, so `seen_time` fell back to
`hosts.created_at`, causing a mismatch with `detail_updated_at` (Last
fetched).
## Changes
- **`NewAndroidHost`** — after inserting the host, also insert into
`host_seen_times` with the same `detail_updated_at` value.
- **`UpdateAndroidHost`** — after updating the host, upsert
`host_seen_times` with the new `detail_updated_at`.
- **New test `AndroidLastSeenMatchesLastFetched`** — verifies
`host_seen_times.seen_time` matches `detail_updated_at` for both
`NewAndroidHost` and `UpdateAndroidHost` paths.
## Testing
- Added `testAndroidLastSeenMatchesLastFetched` covering both paths.
- Existing Android datastore tests should continue to pass.
---
*This PR was created with AI assistance.*
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Host list now shows "Last seen" in a platform-aware way; mobile hosts
display "Last seen: Not supported" instead of unreliable timestamps.
* Hostname entries now include platform info so last-seen display is
accurate across device types.
* Improved consistency in last-seen rendering across the hosts table.
<!-- review_stack_entry_start -->
[](https://app.coderabbit.ai/change-stack/fleetdm/fleet/pull/44628)
<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Wahaj Ahmed <wahajahmed010@gmail.com>