Skip to content
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

Fixed memory leaks in form-filling #6275

Merged
merged 2 commits into from
Jul 22, 2024
Merged

Conversation

grzesiek2010
Copy link
Member

@grzesiek2010 grzesiek2010 commented Jul 22, 2024

Closes #5976

Why is this the best possible solution? Were any other approaches considered?

The first problem I was able to reproduce was building SavepointsRepositoryProvider and passing activity as a context. SavepointsRepositoryProvider similar to other database repository providers needs a context but it should be the application one instead.

Another problem was passing data to BackgroundLocationHelper. Here instead of using lambda functions to pass the form controller we should pass formSessionRepository and sessionId to let BackgroundLocationHelper get the form controller when it needs it similar to what other objects constructed in FormEntryViewModelFactory do.

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?

Please make sure the leaks do not occur anymore. Additionally, it would be good to test background audio recordings briefly (just to check if it works with no crashes) as the code related to this functionality has been updated.
There might be other leaks caused by device rotation but I was able to reproduce only the two described above. If there is something more you can still see please let me know.

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

@grzesiek2010 grzesiek2010 requested a review from seadowg July 22, 2024 09:00
@grzesiek2010 grzesiek2010 marked this pull request as ready for review July 22, 2024 09:00
@seadowg seadowg added needs testing high priority Should be looked at before other PRs/issues labels Jul 22, 2024
@seadowg seadowg merged commit 8dcf4f9 into getodk:v2024.2.x Jul 22, 2024
6 checks passed
@WKobus
Copy link

WKobus commented Jul 22, 2024

There is leak in select one and multi questions with minimal appearance when rotating device

  1. Open all question types form
  2. Go to select one minimal question
  3. Tap on select answer
  4. Rotate device few times until leak occurs

@grzesiek2010
Copy link
Member Author

There is leak in select one and multi questions with minimal appearance when rotating device

Please file a separate issue for that if it's a leak caused by a particular question type.

@WKobus
Copy link

WKobus commented Jul 23, 2024

Tested with Success

Verified on device with Android 14

Verified Cases:

@dbemke
Copy link

dbemke commented Jul 23, 2024

Tested with Success

Verified on device with Android 10

seadowg added a commit to seadowg/collect that referenced this pull request Jul 24, 2024
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.

4 participants