onnela-lab / beiwe-android

Beiwe is a smartphone-based digital phenotyping research platform. This is the Beiwe Android app code. The Beiwe2 app is also available on the Google Play store to use with open source builds of the Beiwe backend.
https://www.beiwe.org/
BSD 3-Clause "New" or "Revised" License
27 stars 16 forks source link

reports of duplicated audio recordings from audio surveys. #91

Closed biblicabeebli closed 3 months ago

biblicabeebli commented 5 months ago

We have some code that recovers potentially-lost recordings, maybe something changed in the shared code when we added ambient audio.

TODO:

biblicabeebli commented 4 months ago

This bug may be fixed is 3.6.0, we are still testing this, due to the source report of this bug coming from a live study we were tracking this internally - but this is only about a day of (anything-to-report) debugging behind.

I ended up writing some code that let me go day-by-day through the survey push notifications a participant would experience.

I think I got the bug, it is dumb. It's some interaction with the ~back button~ back stack. (Standard developer caveat: there is A bug that does something like what is reported here, I think it is the reported bug, it could potentially be a different bug. I will refer to this bug as "my bug".) Update: grr-arg - I cannot tell if the bug I found is the bug you are demonstrating, I can only get it to happen with a single survey visible.

TLDR we have a bug somewhere where you can get multiple instances of the main menu "activity" (app screens are called activities in android land). If you have ever done the Android back button/action (it used to be a button, now it's a swipe gesture) inside the app while on the main menu and it "moves you backward" to... the main menu again instead of bumping you to the app's screen. <~ That's the bug I am talking about. (These activities are stored like a stack of paper, the topmost activity is visible and the back button removes the topmost activity.)

Directions to reproduce my bug - works every time:

biblicabeebli commented 4 months ago

RC2 extends the fix to audio surveys (oversite on my part), and changes some functionality that Probably won't have an effect.

biblicabeebli commented 3 months ago

I believe I tracked down the issue, here is my developer note in the changelog. Will post an RC3 later today.

Fixes a bug where a survey notification would be instantly reinstantiated after the survey
was completed if the survey had no weekly scheduled times and was triggered via the internal
app timers. This could occur on relative and absolute schedule surveys because when the
"buffer" of "this week's surveys" encounters an absolute or relative scheduled survey with
nothing in the next week... it sends an appropriately empty schedule listing for that survey.
In this situation the app does not update the tracked "trigger alarm time" timestamp when a
survey is completed, so a survey trigger "in the past" was always found when the app checked.
biblicabeebli commented 3 months ago

Confirmed that that was the bug. 3.6.0 is pushed.