Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@grzesiek2010
Copy link
Member

@grzesiek2010 grzesiek2010 commented Sep 5, 2025

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:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • added any new strings with date formatting to DateFormatsTest
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@seadowg seadowg added the high priority Should be looked at before other PRs/issues label Sep 5, 2025
@grzesiek2010 grzesiek2010 marked this pull request as ready for review September 5, 2025 08:57
@grzesiek2010 grzesiek2010 requested a review from seadowg September 5, 2025 08:57
@grzesiek2010 grzesiek2010 requested a review from seadowg September 5, 2025 11:52
Copy link
Member

@seadowg seadowg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grzesiek2010 grzesiek2010 requested a review from seadowg September 5, 2025 14:00
Copy link
Member

@seadowg seadowg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grzesiek2010 grzesiek2010 force-pushed the COLLECT-6835_part1 branch 4 times, most recently from a585240 to e814d91 Compare September 5, 2025 15:38
@grzesiek2010 grzesiek2010 requested a review from seadowg September 5, 2025 15:40
Copy link
Member

@seadowg seadowg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grzesiek2010 grzesiek2010 requested a review from seadowg September 5, 2025 16:15
Copy link
Member

@seadowg seadowg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@seadowg seadowg left a 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).

}

@Test
fun whenMatchExactlyStopped_showNotification_andOpenFormListOnClick() {
Copy link
Member

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).

Copy link
Member

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

@seadowg seadowg merged commit 7859301 into getodk:master Sep 8, 2025
6 checks passed
@WKobus
Copy link

WKobus commented Sep 8, 2025

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

@seadowg
Copy link
Member

seadowg commented Sep 8, 2025

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?

@WKobus
Copy link

WKobus commented Sep 8, 2025

yea, form download fails

@seadowg
Copy link
Member

seadowg commented Sep 8, 2025

Just to make sure we're on the same page. I see the new notification doing this:

  1. Scan user "1000 media" https://test.getodk.cloud/projects/629/app-users
  2. Lock the phone

After about 5 mins I get the new notification. If I force Doze mode using adb, I get it much faster.

Are you waiting a full 30 mins then checking the phone? I'm wondering if something could be clearing the notification.

@WKobus
Copy link

WKobus commented Sep 8, 2025

Tested with success

Verified on device with Android 10, 11, 16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

behavior verified high priority Should be looked at before other PRs/issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants