Repository navigation
Wear: recover lost sessions and unstick tiles after a reconnect/re-pair - #9
Merged
Merged
Conversation
Three related watch-sync failures after a disconnect or re-pair: Session recovery. When a working companion session is lost while the app is open (a refresh that failed offline, a revoked session, or a stale cached credential applied on launch then rejected), the watch stranded on the signed-out screen with no way back. MainActivity now watches the auth flow and, on a signed-in to signed-out transition, asks the phone to re-mint and push fresh credentials; 'Retry Sync' calls the same path instead of re-applying the stale cached DataItem. Tile refresh on credential arrival. WearDataLayerService.handleCredentials saved the pushed credentials but never refreshed tiles/complications, so they stayed on 'Open Sheaf on phone' until their next scheduled update. It now requests tile + complication updates after saving. Tile avatars stuck/invisible. The tile resources version only rotated on fronter-set / tile-config changes, never when avatar PNGs were re-rendered, so refreshed avatars (and the colour-initials fallback for pfp-less members) stayed invisible until the tile was deleted and recreated. The version now folds in a signature of the cached avatar set. Also, a transient avatar download failure no longer overwrites a good cached avatar with initials.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a cluster of watch-sync failures that show up after the watch disconnects, loses its session, or gets re-paired. All reported from real use.
1. The watch couldn't recover a lost session without re-pairing
If the watch's companion session went away while the app was open (a token refresh that failed while disconnected, a revoked session, or a stale cached credential applied on launch and then rejected by the server), the watch stranded on the signed-out screen even though the phone could mint a fresh session on demand.
MainActivitynow watches the auth flow and, on a signed-in to signed-out transition, asks the phone to re-mint and push fresh credentials (the phone already handles/sheaf/credentials/requestby force-minting). Tracked against the previous value so a normal startup doesn't trigger a redundant re-mint.2. Tiles/complications stayed on "Open Sheaf on phone" after creds arrived
WearDataLayerService.handleCredentialssaved the pushed credentials but never refreshed tiles/complications, so they stayed on the signed-out message until their next scheduled update. It now requests tile + complication updates right after saving (matching what the front-change nudge path already does).3. Tile avatars stuck missing / pfp-less members invisible
Root cause: the tile resources version (
currentResourcesVersion, shared by all five avatar tiles) only rotated when the fronter set or tile config changed, never when the avatar PNGs were re-rendered. So after a re-pair repopulated the avatar cache, Wear kept serving the stale resource bundle (built while avatars were missing) until the tile was deleted and recreated. That's the "recreate the tile and it's fine" behaviour, and it's also why a member with no avatar rendered as an invisible gap rather than their coloured initials (the fallback PNG existed on disk but the old bundle didn't map it).With these in, the existing Settings to "Refresh" chip (
store.loadAll()) actually re-fetches avatars onto the tiles, so there's a working manual escape hatch too.Verification
:wear:testPlayReleaseUnitTestpass;:wear:assemblePlayReleasegreen through R8.