fleet icon indicating copy to clipboard operation
fleet copied to clipboard

Android BYOD: show "Unenroll pending" label on Host details while Unenroll is pending

Open terry-kwok-code opened this issue 1 month ago • 1 comments

Goal

User story
As an IT admin,
I want to see an "Unenroll pending" label on a personally-owned (BYOD) Android host after I unenroll it while it's offline
so that I can tell the work-profile removal is queued and don't send it again.

Context

Follow-up to #53471 (Allow WIPE for all Android hosts) and the companion bug (BYOD: "Unenroll" still shown in Actions while pending) — link: TODO.

On BYOD Android, both Unenroll and Wipe send the same AMAPI work-profile WIPE. If the device is offline, the command stays Pending until it reconnects (verified: held ~2.5 days, executed on reconnect). Today Host details shows no pending state during that time:

  • GET /api/v1/fleet/hosts/{id} returns "pending_action": "" and "device_status": "unlocked" while the WIPE is Pending, because suppressAndroidBYODWipeStatus (server/service/hosts.go) hides it for BYOD Android. (The wipe endpoint's own response does say "pending_action": "wipe".)
  • Company-owned Android hosts are not suppressed: GET /hosts/{id} returns "pending_action": "wipe", and other platforms show a pending label for Lock/Wipe.

Design (per LeAnn): when Unenroll or Wipe is pending on an offline BYOD Android host, show an "Unenroll pending" label next to the device name on Host details.

Change

  • [ ] Backend: expose the pending work-profile wipe for BYOD Android so the UI can tell it's pending (e.g. stop suppressing it, or add a BYOD-specific pending value). Today the frontend has nothing to key off.
  • [ ] Frontend: show "Unenroll pending" next to the device name on Host details for BYOD Android while that state is set; clear it when the device acks (host goes MDM Off).
  • [ ] Applies whether the admin clicked Unenroll or Wipe (same command on BYOD).
  • [ ] TODO

terry-kwok-code avatar Oct 19 '26 18:10 terry-kwok-code

QA on main (local dev server, build d036cc8e3d), Pixel 8a enrolled as BYOD (work profile).

# Case Result
1 BYOD host with nothing pending: no tag next to the host name Pass
2 Device offline, Actions > Unenroll: yellow Unenroll pending tag next to the host name Pass
3 Tooltip: "Host will unenroll when it comes online. If the host is online, it will unenroll the next time it checks in to Fleet." Pass
4 While pending, Actions shows only Transfer and Delete Pass
5 Device back online: work profile removed, tag gone, MDM status Off Pass
6 Device offline, wipe sent through the API (POST /hosts/:id/wipe): tag says Unenroll pending, not "Wipe pending" Pass
7 Device back online after the API wipe: tag gone, MDM status Off Pass

Note: the UI doesn't offer Wipe for BYOD Android (only Unenroll), so case 6 was run through the API.

terry-kwok-code avatar Nov 17 '26 18:11 terry-kwok-code