mooshim / Mooshimeter-AndroidApp

50 stars 28 forks source link

Rapid mode switching after closing graph causes hang #45

Closed eldstal closed 7 years ago

eldstal commented 7 years ago

On my Nexus 5 with Android 6.0.1, (At commit 854ba5ff7f1ba7800722c23ac9315d7be0361694) the following steps cause sampling to (visually) stop:

The UI becomes less responsive (Some 1s response time on buttons) and new samples stop coming in on both channels.

Here is an excerpt from the run log at the time of the malfunction:

D/PeripheralWrapper: GATTCB:CCHANGE D/ConfigTree: CH1:VALUE:0.0015884066 D/ConfigTree: CH2:VALUE:2.3814559E-4 D/ConfigTree: REAL_PWR:3.931136E-7 D/ConfigTree: RECV: 220 16 bytes D/PeripheralWrapper: GATTCB:CCHANGE D/ConfigTree: CH1:VALUE:0.0015863872 D/ConfigTree: CH2:VALUE:-2.3814559E-4 D/ConfigTree: REAL_PWR:-3.6322962E-7 D/ConfigTree: RECV: 221 16 bytes D/com.mooshim.mooshimeter.activities.GraphingActivity: onPause D/ConfigTree: CMD: SAMPLING:TRIGGER 0 D/PeripheralWrapper: MAKING PROTECTED CALL D/PeripheralWrapper: WRITE D/PeripheralWrapper: GATTCB:WRITE D/PeripheralWrapper: RELEASED D/PeripheralWrapper: GATTCB:CCHANGE D/ConfigTree: CH1:VALUE:0.0016308142 D/ConfigTree: CH2:VALUE:4.7629117E-4 D/ConfigTree: REAL_PWR:7.565551E-7 D/ConfigTree: RECV: 222 16 bytes D/PeripheralWrapper: GATTCB:CCHANGE D/ConfigTree: SAMPLING:TRIGGER:0 D/ConfigTree: RECV: 223 3 bytes D/com.mooshim.mooshimeter.activities.DeviceActivity: What do I do with this? D/com.mooshim.mooshimeter.activities.DeviceActivity: onStart D/com.mooshim.mooshimeter.activities.DeviceActivity: onResume D/ConfigTree: CMD: SAMPLING:TRIGGER 2 D/PeripheralWrapper: MAKING PROTECTED CALL D/PeripheralWrapper: WRITE D/PeripheralWrapper: GATTCB:WRITE D/PeripheralWrapper: RELEASED D/PeripheralWrapper: GATTCB:CCHANGE D/ConfigTree: SAMPLING:TRIGGER:2 D/ConfigTree: RECV: 224 3 bytes I/DeviceActivity: Stream requested I/DeviceActivity: soundrefresh I/DeviceActivity: zerorefresh I/DeviceActivity: soundrefresh I/DeviceActivity: zerorefresh D/com.mooshim.mooshimeter.activities.GraphingActivity: onStop D/com.mooshim.mooshimeter.activities.GraphingActivity: onDestroy D/PeripheralWrapper: MAKING PROTECTED CALL D/PeripheralWrapper: READRSSI D/BluetoothGatt: readRssi() - device: 68:9E:19:CB:DE:AE D/PeripheralWrapper: GATTCB:RSSI D/PeripheralWrapper: RELEASED I/DeviceActivity: onCh1InputSetClick D/ConfigTree: CMD: PCB_VERSION D/PeripheralWrapper: MAKING PROTECTED CALL D/PeripheralWrapper: WRITE D/PeripheralWrapper: GATTCB:CCHANGE D/ConfigTree: PCB_VERSION:8 D/PeripheralWrapper: GATTCB:WRITE D/PeripheralWrapper: RELEASED D/ConfigTree: RECV: 225 3 bytes D/PeripheralWrapper: MAKING PROTECTED CALL D/PeripheralWrapper: WRITE D/PeripheralWrapper: GATTCB:WRITE D/PeripheralWrapper: GATTCB:CCHANGE D/PeripheralWrapper: RELEASED D/PeripheralWrapper: GATTCB:CCHANGE D/ConfigTree: CH1:ANALYSIS:0 D/ConfigTree: CH1:RANGE_I:0 E/DISPATCH: Exception in callback dispatched from: W/System.err: java.lang.Exception W/System.err: at com.mooshim.mooshimeter.common.Dispatcher.dispatch(Dispatcher.java:47) W/System.err: at com.mooshim.mooshimeter.common.Util.dispatchCb(Util.java:132) W/System.err: at com.mooshim.mooshimeter.devices.PeripheralWrapper$2.onCharacteristicChanged(PeripheralWrapper.java:178) W/System.err: at android.bluetooth.BluetoothGatt$1.onNotify(BluetoothGatt.java:438) W/System.err: at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:399) W/System.err: at android.os.Binder.execTransact(Binder.java:453) E/DISPATCH: Exception details: Only the original thread that created a view hierarchy can touch its views. W/System.err: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. W/System.err: at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6566) W/System.err: at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:911) W/System.err: at android.view.View.requestLayout(View.java:18733) W/System.err: at android.view.View.requestLayout(View.java:18733) W/System.err: at android.view.View.requestLayout(View.java:18733) W/System.err: at android.view.View.requestLayout(View.java:18733) W/System.err: at android.view.View.requestLayout(View.java:18733) W/System.err: at android.view.View.requestLayout(View.java:18733) W/System.err: at android.widget.TextView.setRawTextSize(TextView.java:2915) W/System.err: at android.widget.TextView.setTextSize(TextView.java:2905) W/System.err: at com.mooshim.mooshimeter.activities.DeviceActivity.autoButtonRefresh(DeviceActivity.java:273) W/System.err: at com.mooshim.mooshimeter.activities.DeviceActivity.rangeButtonRefresh(DeviceActivity.java:361) W/System.err: at com.mooshim.mooshimeter.activities.DeviceActivity.onRangeChange(DeviceActivity.java:618) W/System.err: at com.mooshim.mooshimeter.devices.MooshimeterDevice$18.onReceived(MooshimeterDevice.java:491) W/System.err: at com.mooshim.mooshimeter.devices.ConfigTree$ConfigNode.notify(ConfigTree.java:299) W/System.err: at com.mooshim.mooshimeter.devices.ConfigTree.interpretAggregate(ConfigTree.java:352) W/System.err: at com.mooshim.mooshimeter.devices.ConfigTree.access$500(ConfigTree.java:29) W/System.err: at com.mooshim.mooshimeter.devices.ConfigTree$1.serviceBufferList(ConfigTree.java:414) W/System.err: at com.mooshim.mooshimeter.devices.ConfigTree$1.onReceived(ConfigTree.java:444) W/System.err: at com.mooshim.mooshimeter.devices.PeripheralWrapper$2$1.run(PeripheralWrapper.java:181) W/System.err: at com.mooshim.mooshimeter.common.Dispatcher$1.call(Dispatcher.java:53) W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237) W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) W/System.err: at java.lang.Thread.run(Thread.java:818)