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

Android 6 production phone not showing notifications, missing data #8

Closed zagorsky closed 1 year ago

zagorsky commented 7 years ago

The symptoms:

  1. The user reported that survey notifications didn't appear unless they opened the app. The report from researcher Garth Coombs was "They don't get the notifications of new surveys unless they launch Beiwe and log in", although it was probably the act of launching the app that started up the survey notifications again, not the act of logging in.

  2. The user seems to be missing survey answers files. There were 20 or 21 surveys, and the user reported only missing 2. But the user has only 7 survey answers files recorded: 1/26, 1/27, 1/30, 1/31, 2/5, 2/7, 2/14.

  3. The user has very little GPS and WiFi data. Between 1/25 (when the user enrolled) and 2/22 (when Maria downloaded data), there were:

    1. Only 2 GPS files: one on 2/18 with 5 timestamps, accuracies all 20, and one on 2/20, with normal data.

    2. Only 1 WiFi file, from 2/20, which has only two timestamps, although lots of data recorded for each timestamp

    3. Scarce accelerometer data (2-5 files per day) from 1/25 to 2/17, but good accelerometer data (15-17 files per day) from 2/18 to 2/22. This may indicate that on 2/18, the user exempted Beiwe from battery optimization.

Information about the app & user:

The audio file encryption code also crashed a lot

Here's the stack trace we got:

1487046704365
BeiweVersion:10, AndroidVersion:6.0.1, Product:kltetmo, Brand:samsung, HardwareId:qcom, Manufacturer:samsung, Model:SM-G900T, App Variant:clinical variant
Error message: An error occurred while executing doInBackground()
Error type: class java.lang.RuntimeException

Error-fill:
        org.beiwe.app.CrashHandler.writeCrashlog(CrashHandler.java:82)
        org.beiwe.app.CrashHandler.uncaughtException(CrashHandler.java:33)
        java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
        java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)

Actual Error:
        java.lang.StringFactory.newStringFromChars(Native Method)
        java.lang.StringFactory.newStringFromChars(StringFactory.java:218)
        java.lang.StringFactory.newStringFromBytes(StringFactory.java:203)
        java.lang.StringFactory.newStringFromBytes(StringFactory.java:63)
        android.util.Base64.encodeToString(Base64.java:456)
        org.beiwe.app.storage.EncryptionEngine.toBase64String(EncryptionEngine.java:235)
        org.beiwe.app.storage.EncryptionEngine.encryptAES(EncryptionEngine.java:177)
        org.beiwe.app.storage.AudioFileManager.encryptAudioFile(AudioFileManager.java:37)
        org.beiwe.app.survey.AudioRecorderCommon$EncryptAudioFileTask.doInBackground(AudioRecorderCommon.java:123)
        org.beiwe.app.survey.AudioRecorderCommon$EncryptAudioFileTask.doInBackground(AudioRecorderCommon.java:1)
        android.os.AsyncTask$2.call(AsyncTask.java:295)
        java.util.concurrent.FutureTask.run(FutureTask.java:237)
        android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
        java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        java.lang.Thread.run(Thread.java:818)

We got this stack trace at these times (EST):

Only two other phones have seen this crash:

Eli suspects this crash may indicate very heavy memory consumption on the phone.

zagorsky commented 7 years ago

Steps to resolve this

@mariasimoneau, Eli and I haven't been able to connect the stack trace to the other symptoms this phone is experiencing, except to hypothesize that both may be connected to very heavy memory usage on the phone in general. To figure out what's going on with Beiwe on this phone, we'd like more information:

Questions about the data

Could a researcher who's authorized to view the data for this study please answer these questions?

  1. Did the user submit more surveys that we don't have survey_answers files for? Do the survey_timings files show that the user submitted (not just opened or answered, but submitted) more than 7 surveys? When the user submits a survey, the survey_timings file is supposed to record a line that says "User hit submit", along with the timestamp.

  2. How many surveys did the user open, and did they submit all of them? How many times does the app_log have the phrase "opened survey [SURVEY_ID]", and do the timestamps of those instances match the timestamps of "Survey first rendered and displayed to user" in the survey_timings_files, or are they inconsistent?

  3. Did survey notifications appear for more than about 9 surveys? When does the app_log have the phrase "Received Broadcast: Intent { act=[SURVEY_ID]..."? Every time that phrase appears, Beiwe should display the survey notification (unless Beiwe didn't have permission to show notifications). There's also no way for a user to open a survey unless the survey notification appears. And if it receives a broadcast more than once during a period when only one survey was supposed to display, then what probably happened is that the notification displayed multiple times (maybe the app was killed and started again) before the user submitted the survey.

Questions for the user directly

If the user is still enrolled in the study, would it be possible for them to answer:

  1. Can the user check Beiwe's information in the Application Manager (under Settings -> Device -> Applications -> Application manager -> Beiwe, and give us all the information from that screen? If the amount of Storage used is very high, that might indicate that the phone is failing to upload data files.
zagorsky commented 7 years ago

Hi @mariasimoneau, in another thread you posted what I think are two more reports of missing survey notifications on Android 6 phones. One for a user in a study:

We just got another report of a user not getting notifications (Android (version 6.0.1). beiwe version 16-2.1.3). Should I have them try the 2.1.4 version? I asked the collaborator for data you requested before (below) and asked about their wifi connection. They already logged into Beiwe to see if that triggered the survey but it didn't.

And one on a phone that you were testing:

On Tuesday when I saw the missing notifications I couldn't have been sure it wasn't related to the "survey schedules not deleting" issue that I was testing as I was sending surveys every minute and then deleting them. however, i had two test phones side by side and twice one got a survey and the other did not.

I think upgrading from 2.1.3 to 2.1.4 is unlikely to solve anything, because we didn't push any code directly addressing this problem, but if you try it and it definitely makes a difference, I'll be interested! Also let me know if you get more information on either of the cases above.