BIDMCDigitalPsychiatry / LAMP-platform

The LAMP Platform (issues and documentation).
https://docs.lamp.digital/
Other
12 stars 10 forks source link

BroadcastReceiver Issues in LAMP-kotlin #816

Open MattMatt27 opened 1 month ago

MattMatt27 commented 1 month ago

Describe the bug LAMP_kotlin.sensor_core.Screen.onStartCommand is failing with the following Java security exception on Android 14 devices.

Caused by java.lang.SecurityException
digital.lamp.mindlamp: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts

The issue appears to be new security requirements for the registerReceiver command explained here: https://developer.android.com/about/versions/14/behavior-changes-14#runtime-receivers-exported

The following line is the one that is currently failing: https://github.com/BIDMCDigitalPsychiatry/LAMP-kotlin/blob/6c0d9692a47ef7a639f231d4d60de6dd7e9ec688/lamp_kotlin/src/main/java/digital/lamp/lamp_kotlin/sensor_core/Screen.kt#L86

To Reproduce Steps to reproduce the behavior:

Expected behavior The error should clear and screen state data collection should resume for Android 14 users

Smartphone (please complete the following information):

Additional context There may be other registerReceiver commands in LAMP-kotlin that require updates. A quick search turned up a half dozen instances of the command without the new flag, but I am unsure if all of them actually need the update because supposedly system broadcasts do not require it. Also if we have any receivers defined in AndroidManifest.xml those will likely need updates as well. That said, for now the Screen script seems to be the only one that is failing.

sijitg commented 1 month ago

We are checking it. We shall update ASP

sijitg commented 1 month ago

We will update LAMP-kotlin and app staging release pointing to new library version today. Thanks MattMatt27 for the debug info.

sijitg commented 1 month ago

We merged the fix. LAMP_kotlin library version 2024.07.12 is released. mindLamp app version 2024.07.12 Open testing (staging) build is submitted for Google review.

sijitg commented 1 month ago

Both staging (open testing) and Production version for this issue fix is live in play store (Version 2024.07.12)