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 14 forks source link

V4.2.3 - Crash when using BangleJS #158

Closed jones139 closed 4 months ago

jones139 commented 6 months ago

User Reported issue: ***** DEVICE INFO Brand: samsung Device: a33x Model: SM-A336B Manufacturer: samsung Product: a33xnseea SDK: 34 Release: 14

***** APP INFO Version: 4.2.3 Installed On: 2024-03-24 21:02:03 Updated On: 2024-03-24 22:34:54 Current Date: 2024-03-24 22:51:34

***** ERROR LOG java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.bluetooth.BluetoothGatt.writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic)' on a null object reference at uk.org.openseizuredetector.SdDataSourceBLE$1.executeWriteCharacteristic(SdDataSourceBLE.java:396) at uk.org.openseizuredetector.SdDataSourceBLE$1.access$1000(SdDataSourceBLE.java:240) at uk.org.openseizuredetector.SdDataSourceBLE$1$3.run(SdDataSourceBLE.java:404) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at android.app.ActivityThread.main(ActivityThread.java:8893) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

I think this is because BangleJS does not have the characteristic to receive the OSD status - but it looks like we are not checking if it exists or not before we try to write to it.

jones139 commented 6 months ago

Commit cff9d4567c should fix this, @lundstrj

lundstrj commented 6 months ago

I was actually fiddling around with a PineTime when this happened. I'll try to build from source tomorrow and see if I can provoke the same error again.

jones139 commented 6 months ago

You will need a recent version of the Pinetime firmware too - have been developing the pinetime firmware and android app in parallel, so if you get the versions out of sync it might break - but it should have failed nicely rather than crash and this fix should sort that.

lundstrj commented 6 months ago

When you say a recent version of the PineTime firmware, do you mean more recent than PineTimeSD 0.6 which seems to be only days old?

I ran OSD 4.2.4 now, connected to Android Studio and I managed to capture some logs. I haven't looked through them, but I figured I should share them anyway.

OSD entered a FAULT state (to me it is unclear why, I was just wearing the PineTime and working as usual, with OSD running)

samsung-SM-A336B-Android-14_2024-03-27_090344.logcat.log

jones139 commented 6 months ago

I'd missed this comment, sorry, @lundstrj! V0.6 is the latest version, but it is functionally the same as V0.5 (the difference is making the display look more like the GarminSD watch display to try to persuade our Benjamin that it is 'his' watch!

lundstrj commented 6 months ago

I get it. We have our fair share of hangups and aversion to change over here too. Every day is like walking a tight rope.

jones139 commented 5 months ago

I think this should be fixed in V4.2.7 which is available as a binary release now and should be on Play store for beta testers tomorrow - you need to use the new BLE2 data source (the original Bluetooth Data Source is still available as a fall back) - I will remove the original Bluetooth Data source from the production release if we are happy with BLE2.