OpenSeizureDetector / Android_Pebble_SD

The main OpenSeizureDetector Android App, that is published on the Android Play Store.
http://openseizuredetector.org.uk
GNU General Public License v3.0
9 stars 11 forks source link

V4.2.6 - Crash when opening app from notification #176

Closed jones139 closed 1 month ago

jones139 commented 2 months ago

Attempted to open main activity from OSD notification. Crash Report: ***** DEVICE INFO Brand: motorola Device: sabahl Model: moto e13 Manufacturer: motorola Product: sabahl_ge SDK: 33 Release: 13

***** APP INFO Version: 4.2.7 Installed On: 2024-04-12 21:10:48 Updated On: 2024-04-14 19:45:46 Current Date: 2024-04-14 23:47:31

***** ERROR LOG java.lang.IllegalStateException: Fragment FragmentOsdAlg{224bb9f} (693a5a70-cbd8-4ce0-987c-353cd5011c4a) not attached to a context. at androidx.fragment.app.Fragment.requireContext(Fragment.java:972) at androidx.fragment.app.Fragment.getResources(Fragment.java:1036) at androidx.fragment.app.Fragment.getString(Fragment.java:1058) at uk.org.openseizuredetector.FragmentOsdAlg.updateUi(FragmentOsdAlg.java:76) at uk.org.openseizuredetector.FragmentOsdBaseClass$2.run(FragmentOsdBaseClass.java:114) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:8046) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:703) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)

jones139 commented 2 months ago

Background service continued to run, so not too serious.
Probably a race condition - we must not be checking for bind correctly or something like that.

jones139 commented 2 months ago

I haven't seen this again, and no-one else has reported it yet.

jones139 commented 2 months ago

I spoke too soon, another user reported the same crash today from V4.2.7. They confirmed that the main background process continued to run so the system was still working - it was just a front end crash, so not a critical one.

I'll fix this in V4.3, because I can't see what is causing it at the moment!

***** DEVICE INFO Brand: google Device: panther Model: Pixel 7 Manufacturer: Google Product: panther SDK: 34 Release: 14

***** APP INFO Version: 4.2.7 Installed On: 2024-02-03 20:21:26 Updated On: 2024-04-16 22:06:21 Current Date: 2024-05-03 10:40:33

***** ERROR LOG java.lang.IllegalStateException: Fragment FragmentOsdAlg{172f585} (ef092669-d18b-4432-8fd5-52015f6640d9) not attached to a context. at androidx.fragment.app.Fragment.requireContext(Fragment.java:972) at androidx.fragment.app.Fragment.getResources(Fragment.java:1036) at androidx.fragment.app.Fragment.getString(Fragment.java:1058) at uk.org.openseizuredetector.FragmentOsdAlg.updateUi(FragmentOsdAlg.java:76) at uk.org.openseizuredetector.FragmentOsdBaseClass$2.run(FragmentOsdBaseClass.java:114) at android.os.Handler.handleCallback(Handler.java:959) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8501) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)

jones139 commented 1 month ago

A user has reported this occurring twice in a week, which sounds excessive - I'll try and catch the exception to stop it crashing and put a Toast warning on screen instead.

jones139 commented 1 month ago

V4.2.8 includes code to catch exceptions when updating the UI, so should avoid this crash - we might see strange UI hangs instead though because if the context is null, I can't display Toast messages on the screen - they are written to the system log instead - but as it is only the UI it is better to fail like that than crash.

jones139 commented 1 month ago

Should be fixed in V4.2.8, so closing - will re-open if it crops up again.