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

Savepoint not created if Collect is closed via going to Latest apps on some devices #6039

Open
dbemke opened this issue Mar 25, 2024 · 3 comments

Comments

@dbemke
Copy link

dbemke commented Mar 25, 2024

ODK Collect version

the store version 2024.1.3, the master version 2a06bf5

Android version

12+

Device used

Pixel 7a

Problem description

On Android 12+ a savepoint isn’t created if Collect is closed via going to "Latest apps” (with navigation using 3 buttons, click the square) and swiping Collect up.

The issue doesn't occur on Android 10 (Redmi 9t), other devices will be described below
Pixel 7a Android 14 example:
https://github.com/getodk/collect/assets/56479916/4fd5f669-2605-464b-a4b9-eed51b4a4c0f

Steps to reproduce the problem

  1. Open a form.
  2. Fill/ Don’t fill something in the first question.
  3. Tap the square navigation button to see the "Latest apps”.
  4. Swipe up so that Collect is closed.
  5. Go back to Collect and open the form again.

A save point will be created if the user switches to another app using "Latest apps" (or hits the home button). This means that in reality, users will usually get save points when switching away from Collect.

Expected behavior

Depending on the version of Collect there should be:

  • 2024.1.3 a form with a savepoint opens in the hierarchy view
  • after the master version (2a06bf5) was merged a recovery dialog should appear

Notes

It looks like Android 12 changes how "Recent apps" interacts with Activity#onSaveInstanceState which we use to trigger a save point. In Android 11 and under, opening recent apps is enough to cause onSaveInstanceState to be called, but in later Android versions the method isn't called until another app is switched to (or the user returns to the Home Screen). We'll need to find another way to trigger a save point so that it works across API versions.

@srujner
Copy link

srujner commented Mar 25, 2024

Something similar is happening on Pixel 3a, Android 12 but only after Fresh Install

Steps to reproduce

  1. Freshly install Collect and open any form
  2. Don’t fill anything in the first question.
  3. Tap the square navigation button to see the "Latest apps”.
  4. Swipe up so that Collect is closed.
  5. Go back to Collect and open the form again.
  6. The Recover dialog will not show

Expected behavior
The Recover dialog should be shown

Other information:
It is happening on Android 12 only after Fresh install and only at the first attempt!
If you'll repeat steps 1-5 then the savepoint will be created and the recovery dialog will appear

@seadowg
Copy link
Member

seadowg commented Mar 25, 2024

I've done some testing and it looks like this is a problem on Android 12+. It seems like it's a change in Android's "Recent Apps" (that I can't find referenced anywhere). I'll update the issue description with my findings.

@seadowg seadowg added this to the v2024.2 milestone Mar 25, 2024
@seadowg
Copy link
Member

seadowg commented Mar 28, 2024

We should discuss if we want to fix this as-is or change the feature so save points are created differently (i.e. on a timer on questions are answered).

@seadowg seadowg modified the milestones: v2024.2, Later Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ready
Development

No branches or pull requests

3 participants