-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Notify the user when match exactly stops running because of Doze #6874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
collect_app/src/main/java/org/odk/collect/android/backgroundwork/SyncFormsTaskSpec.kt
Outdated
Show resolved
Hide resolved
...n/java/org/odk/collect/android/notifications/builders/FormsSyncStoppedNotificationBuilder.kt
Show resolved
Hide resolved
9cf7909 to
c7e3726
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a585240 to
e814d91
Compare
e814d91 to
255601a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e47b665 to
14400dd
Compare
14400dd to
8042bbd
Compare
391587e to
13368a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works! I was able to test with Doze mode and the flow is really nice. I've left a couple of comments about some tweaks that would be good to make.
Also, I don't think there's any test coverage that we actually pass isStopped down into FormsDataService#matchFormsWithServer. We could actually write a UI test for this as we can give ourselves fake the onStopped call in TestScheduler (and simulate the network cutting off in StubOpenRosaServer).
collect_app/src/main/java/org/odk/collect/android/backgroundwork/SyncFormsTaskSpec.kt
Outdated
Show resolved
Hide resolved
8f18a11 to
5c93720
Compare
| } | ||
|
|
||
| @Test | ||
| fun whenMatchExactlyStopped_showNotification_andOpenFormListOnClick() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! This is really clean. It makes me realize that we'd also want a test for the case where the job is stopped but completes successfully (we shouldn't see a notification in that scenario).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@grzesiek2010 I can follow up with this test
|
We tried to get notification by using steps from issue #6825, but we can't get it, we used phones with Android 10,11 and 16 |
And downloading the form doesn't finish? |
|
yea, form download fails |
|
Just to make sure we're on the same page. I see the new notification doing this:
After about 5 mins I get the new notification. If I force Doze mode using Are you waiting a full 30 mins then checking the phone? I'm wondering if something could be clearing the notification. |
|
Tested with success Verified on device with Android 10, 11, 16 |
Work towards #6835
Why is this the best possible solution? Were any other approaches considered?
We didn’t have any UI indication when form syncing failed because it was stopped by the system (e.g., due to Doze). Now we catch that case and display a notification. This is the result of our earlier discussion. As for the implementation, there’s nothing important to discuss.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
This introduces a new notification when form syncing is stopped by the system, so it shouldn’t affect other parts of the app. If you were able to reproduce that case (and I believe you were: [issue comment]), you can test it that way. You can also use ADB to simulate it: [Doze & App Standby].
Do we need any specific form for testing your changes? If so, please attach one.
No.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
No.
Before submitting this PR, please make sure you have:
./gradlew connectedAndroidTest(or./gradlew testLab) and confirmed all checks still passDateFormatsTest