Android-components: Renewing push registration should trigger the `onSubscriptionChanged` handler

Created on 28 May 2020  路  11Comments  路  Source: mozilla-mobile/android-components

I'm spinning this off from a discussion in an application-services issue here.

I have an install of Firefox Beta that is not correctly recovering from an expired push subscription with the FxA server.

There's some logic in the FxaPushSupportFeature that detects when the device's push subscription has been marked as expired by the FxA server (here), and logcat tells me that my Fenix is correctly triggering this code. However, the updated subscription is not being communicated back to the FxA server.

IIUC, the uploading of new subscription details is supposed to be handled by this onSubscriptionChanged hander in FxaPushSupportFeature, but my logcat output doesn't show any evidence of this being triggered.

Am I right to expect that onSubscriptionChanged should be triggered here? Or, is there another mechanism by which the new subscription details should be communicated back to the FxA server?

/cc @jonalmeida

<push> blocked 馃悶 bug

All 11 comments

(In terms of user impact, this means that send-tab is in a degraded state for this device - I'm able to send tabs to it from my other devices, but it won't receive the tabs until I do an explicit "sync now").

After doing some investigation today I've confirmed that we are requesting a subscription verification check when the app opens but we are not getting any new subscription changes back; JR is looking into this in https://github.com/mozilla-services/autopush/issues/1397.

I did file two other issues as a result of this investigation:

  1. We fail to verify subscriptions on the first launch of the app: https://github.com/mozilla-mobile/android-components/issues/7236
  2. We can do a verification check immediately after receiving the push token instead of waiting for the next initialization: https://github.com/mozilla-mobile/android-components/issues/7237

After doing some investigation today I've confirmed that we are requesting a subscription verification check when the app opens

Thanks for much for digging into this @jonalmeida. One thing that's not quite clear to me - after renewing the push registration, do we wait until the next app restart in order to verify the subscription list with autopush, or will we do it in the background while the user is still using the app?

@rfk We wait until the next app restart in order to verify the subscription list. To be clear, we attempt to check on every app cold start, so that's where this check happens. Point 2, in my comment above is to change this. Although, I'd like to fix this bug first before we change the behaviour.

For clarity on the ticket, we're blocking this from closing on investigation from mozilla-services/autopush#1397 which may require changes in app-services and/or android-components.

hey, @jonalmeida ^ just caught wind of this. We'll get https://github.com/mozilla-services/autopush/issues/1397 into the queue next week (team meeting Monday) and should be able to update you with an ETA shortly after that.

We've ignored this issue for far too long and it's begun to bite us now: mozilla-mobile/fenix#15899

Yes.

For the ticket, we're discussing this more in the above linked ticket.

Using the latest version of Firebase Crashlytics is also blocked on upgrading FCM (which is blocked on this issue).

To unblock ourselves, we can come up with a patch that specifically fixes the WebPush subscription for Send Tab when FxA has an invalid subscription and force-resubscribe immediately by passing the observer for onSubscriptionChanged.

This is good for FxA/Send Tab but leaves web content without a fix, so we _still_ need to fix this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

csadilek picture csadilek  路  3Comments

Callek picture Callek  路  4Comments

jonalmeida picture jonalmeida  路  4Comments

mitchhentges picture mitchhentges  路  5Comments

codrut-topliceanu picture codrut-topliceanu  路  3Comments