- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have OTA working properly on iOS and can't figure out how to get Android to rediscover the bootloader service once it's enabled. Even with the CySmart app my device does not behave properly. I fire the WriteAttrServChanged() and this obviously works since iOS automatically kicks back to the main screen which forces a reconnect and rediscover of services but with Android I never get the kick back and instead the CySmart app times out eventually and usually returns with an error 133 which leads me to assume something flooded out or the connection was interrupted before the service changed value was received by the generic Service Changed 2A05.
I am programmatically changing the bootloader flag in my own app but since the behavior is the same in the Android CySmart app I assume either the Service Changed characteristic is not being listen to or another issue is happening. Any help would be greatly appreciated since this is preventing OTA on Android for my devices since there isn't a dependable way to programmatically rediscover the service.
void WriteAttrServChanged(void)
{
uint32 value;
CYBLE_GATT_HANDLE_VALUE_PAIR_T handleValuePair;
/* Force client to rediscover services in range of bootloader service */
value = ((uint32)(((uint32) cyBle_btss.btServiceHandle) << 16u)) |
((uint32) (cyBle_btss.btServiceInfo[0u].btServiceCharDescriptors[0u]));
handleValuePair.value.val = (uint8 *)&value;
handleValuePair.value.len = sizeof(value);
handleValuePair.attrHandle = cyBle_gatts.serviceChangedHandle;
CyBle_GattsWriteAttributeValue(&handleValuePair, 0u, NULL,CYBLE_GATT_DB_LOCALLY_INITIATED);
}
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you fire the WriteAttrServChanged(), please check the logcat in Android Studio and share the logs here. It will help debug further.
Regards,
Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No problem. Further below is the relevant area as soon as I write to my characteristic which sets a flag to fire the SlaveReset(). With this code, I took any manual disconnects reconnects out and am purely firing the code to activate the bootloader, wait 2 seconds, start the bootloader notification, then begin the bootloader process. The device does reset but I get errors with the device if I attempt to read or notify listen to the bootloader service.
void BootloaderSwitch()
{
if (bootloaderFlag == 1)
{
CyDelay(100);
if (bootloaderFlag == 1)
{
DBG_PRINTF("Bootloader activation flag found \r\n");
DBG_PRINTF("Switching to bootloader application... \r\n");
CyDelay(500);
CyBle_Shutdown(); /* stop all ongoing activities */
CyBle_ProcessEvents(); /* process all pending events */
CyBle_SetState(CYBLE_STATE_STOPPED);
CySysWdtUnlock();
CySysWdtDisable(WDT_COUNTER_MASK);
CyGlobalIntDisable;
Bootloadable_Load();
}
}
}
2019-01-25 08:08:11.341 24760-24760/com.edibu.somethingawesome I/chromium: [INFO:CONSOLE(1832)] "Enabling bootloader via bootloaderActivated characteristic with: 01", source: http://172.31.12.15:8100/main.js (1832)
2019-01-25 08:08:11.347 24760-25005/com.edibu.somethingawesome D/BLEPlugin: action = write
2019-01-25 08:08:11.347 24760-25005/com.edibu.somethingawesome D/Peripheral: Queuing Command com.megster.cordova.ble.central.BLECommand@61c4ca5
2019-01-25 08:08:11.348 24760-25005/com.edibu.somethingawesome D/Peripheral: Processing Commands
2019-01-25 08:08:11.348 24760-25005/com.edibu.somethingawesome D/Peripheral: Write 0000446e-0000-1000-8000-00805f9b34fb
2019-01-25 08:08:11.429 24760-24773/com.edibu.somethingawesome D/Peripheral: onCharacteristicWrite android.bluetooth.BluetoothGattCharacteristic@5fcc82b
2019-01-25 08:08:11.430 24760-24773/com.edibu.somethingawesome D/Peripheral: Processing Complete
2019-01-25 08:08:11.430 24760-24773/com.edibu.somethingawesome D/Peripheral: Processing Commands
2019-01-25 08:08:11.430 24760-24773/com.edibu.somethingawesome D/Peripheral: Command Queue is empty.
2019-01-25 08:08:11.454 24760-24760/com.edibu.somethingawesome D/SystemWebChromeClient: http://172.31.12.15:8100/main.js: Line 1834 : Bootloader activated: OK
2019-01-25 08:08:11.454 24760-24760/com.edibu.somethingawesome I/chromium: [INFO:CONSOLE(1834)] "Bootloader activated: OK", source: http://172.31.12.15:8100/main.js (1834)
2019-01-25 08:08:11.457 24760-24760/com.edibu.somethingawesome D/SystemWebChromeClient: http://172.31.12.15:8100/main.js: Line 1835 : Waiting 2 seconds for device to refresh.
2019-01-25 08:08:11.457 24760-24760/com.edibu.somethingawesome I/chromium: [INFO:CONSOLE(1835)] "Waiting 2 seconds for device to refresh.", source: http://172.31.12.15:8100/main.js (1835)
2019-01-25 08:08:12.508 2846-2846/? D/wpa_supplicant: wlan0: Control interface command 'SIGNAL_POLL'
2019-01-25 08:08:12.844 2874-2874/? I/NetworkController.WifiSignalController: Change in state to: connected=true,enabled=true,level=2,inetCondition=1,iconGroup=IconGroup(Default Wi-Fi Icons),activityIn=false,activityOut=false,rssi=-59,,ssid="Balls2",isGigaWiFi=false,isAttWifiCall=false
2019-01-25 08:08:13.217 371-425/? I/GBMv2: GBM state [10]
2019-01-25 08:08:13.318 371-425/? I/GBMv2: GBM state [0]
2019-01-25 08:08:13.351 341-475/? I/ThermalEngine: Sensor:vs_temp:3100 mC
2019-01-25 08:08:13.370 341-480/? I/ThermalEngine: Mitigation:CPU[0]:1094400 Khz
2019-01-25 08:08:13.375 407-2528/? V/Netd: unexpected event from subsystem power_supply
2019-01-25 08:08:13.405 2874-2874/? D/KeyguardUpdateMonitor: Intent.ACTION_BATTERY_CHANGED status : 2 ,plugged : 2 ,level : 100 ,temperature : 283, temperatureState : 0, EXTRA_CHARGING_CURRENT : 0 / EXTRA_HVDCP_TYPE : false
2019-01-25 08:08:13.408 2874-2874/? I/LGPowerUI: onReceive = android.intent.action.BATTERY_CHANGED
2019-01-25 08:08:13.409 2874-2874/? I/LGPowerUI: level = 100, plugType = 2, plugged = true, charging = true, temperature = 283, chargingCurrent = 0, factoryCableItem = 0, isFastCharging = false, batteryID = 1
2019-01-25 08:08:13.412 2874-3490/? I/AbsQuickSettingsHandlerBase: Got action android.intent.action.BATTERY_CHANGED for BATTERY_SAVER
2019-01-25 08:08:13.413 4197-4355/? W/QCNEJ: |CORE| CNE received unexpected action: android.intent.action.BATTERY_CHANGED
2019-01-25 08:08:13.414 4246-4246/? D/BatteryManager: ***Receiving Battery Change 100.0% ***
2019-01-25 08:08:13.414 407-2528/? V/Netd: unexpected event from subsystem power_supply
2019-01-25 08:08:13.418 3326-3326/? D/TeleService: PhoneGlobalsEx: onReceive: android.intent.action.BATTERY_CHANGED
2019-01-25 08:08:13.422 15105-16512/? D/HeadsetStateMachine: Disconnected process message: 10, size: 0
2019-01-25 08:08:13.424 1947-2767/? D/WifiController: battery changed pluggedType: 2
2019-01-25 08:08:13.445 2874-2874/? D/KeyguardUpdateMonitor: Intent.ACTION_BATTERY_CHANGED status : 2 ,plugged : 2 ,level : 100 ,temperature : 283, temperatureState : 0, EXTRA_CHARGING_CURRENT : 0 / EXTRA_HVDCP_TYPE : false
2019-01-25 08:08:13.447 2874-2874/? I/LGPowerUI: onReceive = android.intent.action.BATTERY_CHANGED
2019-01-25 08:08:13.448 2874-2874/? I/LGPowerUI: level = 100, plugType = 2, plugged = true, charging = true, temperature = 283, chargingCurrent = 0, factoryCableItem = 0, isFastCharging = false, batteryID = 1
2019-01-25 08:08:13.451 3326-3326/? D/TeleService: PhoneGlobalsEx: onReceive: android.intent.action.BATTERY_CHANGED
2019-01-25 08:08:13.452 2874-3490/? I/AbsQuickSettingsHandlerBase: Got action android.intent.action.BATTERY_CHANGED for BATTERY_SAVER
2019-01-25 08:08:13.457 4197-4355/? W/QCNEJ: |CORE| CNE received unexpected action: android.intent.action.BATTERY_CHANGED
2019-01-25 08:08:13.462 24760-24760/com.edibu.somethingawesome D/SystemWebChromeClient: http://172.31.12.15:8100/main.js: Line 1814 : Starting bootloader notification
2019-01-25 08:08:13.462 24760-24760/com.edibu.somethingawesome I/chromium: [INFO:CONSOLE(1814)] "Starting bootloader notification", source: http://172.31.12.15:8100/main.js (1814)
2019-01-25 08:08:13.464 4246-4246/? D/BatteryManager: ***Receiving Battery Change 100.0% ***
2019-01-25 08:08:13.468 15105-16512/? D/HeadsetStateMachine: Disconnected process message: 10, size: 0
2019-01-25 08:08:13.472 1947-2767/? D/WifiController: battery changed pluggedType: 2
2019-01-25 08:08:13.476 24760-25005/com.edibu.somethingawesome D/BLEPlugin: action = startNotification
2019-01-25 08:08:13.477 24760-25005/com.edibu.somethingawesome D/Peripheral: Queuing Command com.megster.cordova.ble.central.BLECommand@de08488
2019-01-25 08:08:13.477 24760-25005/com.edibu.somethingawesome D/Peripheral: Processing Commands
2019-01-25 08:08:13.477 24760-25005/com.edibu.somethingawesome D/Peripheral: Register Notify 00060001-f8ce-11e4-abf4-0002a5d5c51b
2019-01-25 08:08:13.479 24760-25005/com.edibu.somethingawesome E/PluginManager: Uncaught exception from plugin
java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List android.bluetooth.BluetoothGattService.getCharacteristics()' on a null object reference
at com.megster.cordova.ble.central.Peripheral.findNotifyCharacteristic(Peripheral.java:573)
at com.megster.cordova.ble.central.Peripheral.registerNotifyCallback(Peripheral.java:486)
at com.megster.cordova.ble.central.Peripheral.processCommands(Peripheral.java:853)
at com.megster.cordova.ble.central.Peripheral.queueCommand(Peripheral.java:819)
at com.megster.cordova.ble.central.Peripheral.queueRegisterNotifyCallback(Peripheral.java:766)
at com.megster.cordova.ble.central.BLECentralPlugin.registerNotifyCallback(BLECentralPlugin.java:522)
at com.megster.cordova.ble.central.BLECentralPlugin.execute(BLECentralPlugin.java:227)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:117)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:136)
at android.os.HandlerThread.run(HandlerThread.java:61)
2019-01-25 08:08:13.501 1947-2815/? D/WifiWatchdogStateMachine: EVENT_CHECK_IMS_CALL_STATE received
2019-01-25 08:08:13.501 1947-2815/? D/WifiWatchdogStateMachine: OnlineWatchState handleRssiChange() imscallstate : 0
2019-01-25 08:08:13.506 24760-25005/com.edibu.somethingawesome D/BLEPlugin: action = stopNotification
2019-01-25 08:08:13.507 24760-25005/com.edibu.somethingawesome D/Peripheral: Queuing Command com.megster.cordova.ble.central.BLECommand@e7dbc07
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So I went ahead and created a new barebones OTA FixedStack Bootloader / Bootloadable project based on your example projects. I removed the HID components and SW2 requirement, flip the switch via a BLE write and have OTA working perfectly on iOS. When I try it on Android I get the exact same problems as my other projects. It's actually worse on CySmart since the app actually crashes before even allowing me to search for my filename on the firmware update page. Here is the full trace from the time I open the app, find the device, set the characteristic value to enable the Bootloader project, wait 15 seconds then the app either crashes or goes back to the main screen. Select the device again and now the Bootloader is enabled. Navigate to the OTA Bootloader view and the app crashes so I never get to actually test it. I see the app on the App Store hasn't been updated since 2015 so I also tried this with my forked version of this with an updated attribute conversion table I use in house. Same results which leads me to believe either Android is handling the generic service changed request differently or improperly or the psoc device itself has either a timing issue or some other issue causing this.
2019-01-25 22:42:21.544 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:42:21.610 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:42:21.679 9375-9375/? D/BluetoothAdapter: stopLeScan()
2019-01-25 22:42:21.683 9375-9375/? D/BluetoothAdapter: scan not started yet
2019-01-25 22:42:21.688 9375-9375/? E/CySmart Android: BLE DISCONNECTED STATE
2019-01-25 22:42:21.689 9375-9375/? D/BluetoothGatt: connect() - device: 00:A0:50:11:42:4E, auto: false
2019-01-25 22:42:21.689 9375-9375/? D/BluetoothGatt: registerApp()
2019-01-25 22:42:21.689 9375-9375/? D/BluetoothGatt: registerApp() - UUID=6277a0d1-0f6a-4152-a637-1081a4a58efe
2019-01-25 22:42:21.695 9375-9375/? D/BluetoothGatt: refresh() - device: 00:A0:50:11:42:4E
2019-01-25 22:42:22.164 9375-9375/? E/CySmart Android: Scanning onPause
2019-01-25 22:42:22.164 9375-9375/? E/CySmart Android: UN Registering receiver in Profile scannng
2019-01-25 22:42:22.166 9375-9375/? D/BluetoothAdapter: stopLeScan()
2019-01-25 22:42:22.167 9375-9375/? D/BluetoothAdapter: scan not started yet
2019-01-25 22:42:22.203 9375-9375/? E/CySmart Android: Service discovery onResume
2019-01-25 22:42:22.704 9375-9375/? E/CySmart Android: Discover service called
2019-01-25 22:42:22.704 9375-9375/? D/BluetoothGatt: discoverServices() - device: 00:A0:50:11:42:4E
2019-01-25 22:42:23.167 9375-9375/? E/CySmart Android: Service discovered
2019-01-25 22:42:23.209 9375-9375/? D/BluetoothGatt: configureMTU() - device: 00:A0:50:11:42:4E mtu: 512
2019-01-25 22:42:23.235 9375-9375/? E/CySmart Android: Action viewfalse
2019-01-25 22:42:26.077 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:42:26.127 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:42:26.146 9375-9375/? E/CySmart Android: Action viewfalse
2019-01-25 22:42:27.065 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:42:27.128 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:42:27.216 9375-9375/? E/CySmart Android: LIst characteristice sizee>>8
2019-01-25 22:42:27.230 9375-9375/? E/CySmart Android: Action viewfalse
2019-01-25 22:42:28.363 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:42:28.393 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:42:28.544 9375-9375/? E/CySmart Android: Action viewfalse
2019-01-25 22:42:29.661 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:42:29.727 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:42:29.745 9375-9375/? E/CySmart Android: Cleared
2019-01-25 22:42:30.861 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:42:30.947 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:42:30.950 9375-9375/? I/AudioManagerEx: AudioManagerEx created
2019-01-25 22:42:31.345 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:42:31.428 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:42:32.178 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:42:32.245 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:42:53.042 9375-9375/? E/CySmart Android: onReceive--false
2019-01-25 22:42:53.050 9375-9375/? E/CySmart Android: Not in PSF and SCF
2019-01-25 22:42:53.060 9375-9375/? I/Timeline: Timeline: Activity_launch_request id:com.cypress.cysmart time:319917719
2019-01-25 22:42:53.119 9375-9375/? E/CySmart Android: newIntent
2019-01-25 22:42:53.120 9375-9375/? E/CySmart Android: onResume-->activity
2019-01-25 22:42:53.183 9375-9375/? I/Timeline: Timeline: Activity_launch_request id:com.cypress.cysmart time:319917842
2019-01-25 22:42:53.416 9375-9375/? D/CySmart Android: Phone
2019-01-25 22:42:53.508 9375-9375/? D/BluetoothAdapter: startLeScan(): null
2019-01-25 22:42:53.513 9375-9375/? D/BluetoothAdapter: STATE_ON
2019-01-25 22:42:53.555 9375-9375/? E/CySmart Android: onResume-->activity
2019-01-25 22:42:53.559 9375-9375/? E/CySmart Android: Scanning onResume
2019-01-25 22:42:53.590 9375-9375/? E/CySmart Android: Registering receiver in Profile scannng
2019-01-25 22:42:54.388 9375-9375/? I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@db0d3a2 time:319919047
2019-01-25 22:42:54.436 9375-9375/? E/CySmart Android: Enabled characteristic size-->0
2019-01-25 22:42:59.197 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:42:59.314 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:42:59.399 9375-9375/? D/BluetoothAdapter: stopLeScan()
2019-01-25 22:42:59.402 9375-9375/? D/BluetoothAdapter: scan not started yet
2019-01-25 22:42:59.405 9375-9375/? E/CySmart Android: BLE DISCONNECTED STATE
2019-01-25 22:42:59.408 9375-9375/? D/BluetoothGatt: connect() - device: 00:A0:50:11:42:4E, auto: false
2019-01-25 22:42:59.408 9375-9375/? D/BluetoothGatt: registerApp()
2019-01-25 22:42:59.409 9375-9375/? D/BluetoothGatt: registerApp() - UUID=27e91205-9453-4eb4-9cf4-76576bce38da
2019-01-25 22:42:59.418 9375-9375/? D/BluetoothGatt: refresh() - device: 00:A0:50:11:42:4E
2019-01-25 22:42:59.652 9375-9375/? E/CySmart Android: Scanning onPause
2019-01-25 22:42:59.652 9375-9375/? E/CySmart Android: UN Registering receiver in Profile scannng
2019-01-25 22:42:59.657 9375-9375/? D/BluetoothAdapter: stopLeScan()
2019-01-25 22:42:59.659 9375-9375/? D/BluetoothAdapter: scan not started yet
2019-01-25 22:42:59.716 9375-9375/? E/CySmart Android: Service discovery onResume
2019-01-25 22:43:00.216 9375-9375/? E/CySmart Android: Discover service called
2019-01-25 22:43:00.216 9375-9375/? D/BluetoothGatt: discoverServices() - device: 00:A0:50:11:42:4E
2019-01-25 22:43:00.822 9375-9375/? E/CySmart Android: Service discovered
2019-01-25 22:43:00.876 9375-9375/? D/BluetoothGatt: configureMTU() - device: 00:A0:50:11:42:4E mtu: 512
2019-01-25 22:43:00.913 9375-9375/? E/CySmart Android: Action viewfalse
2019-01-25 22:43:02.481 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:43:02.925 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:43:04.630 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:43:04.712 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:43:04.744 9375-9375/? E/CySmart Android: secondFilePath-->
2019-01-25 22:43:04.752 9375-9375/? I/BluetoothDevice: createBond() for device 00:A0:50:11:42:4E called by pid: 9375 tid: 9375
2019-01-25 22:43:04.765 9375-9375/? E/CySmart Android: Action viewfalse
2019-01-25 22:43:04.879 9375-9375/? E/CySmart Android: Started Timer
2019-01-25 22:43:04.881 9375-9375/? I/CySmart Android: Bonding is in process....
2019-01-25 22:43:04.916 9375-9375/? E/CySmart Android: Started Timer
2019-01-25 22:43:05.010 9375-9375/? E/CySmart Android: HomepageActivity--->Not Bonded
2019-01-25 22:43:05.010 9375-9375/? E/CySmart Android: Stopped Timer
2019-01-25 22:43:07.977 9375-9375/? E/CySmart Android: onReceive--false
2019-01-25 22:43:07.997 9375-9375/? E/CySmart Android: Not in PSF and SCF
2019-01-25 22:43:08.002 9375-9375/? I/Timeline: Timeline: Activity_launch_request id:com.cypress.cysmart time:319932661
2019-01-25 22:43:08.043 9375-9375/? E/CySmart Android: newIntent
2019-01-25 22:43:08.043 9375-9375/? E/CySmart Android: onResume-->activity
2019-01-25 22:43:08.069 9375-9375/? I/Timeline: Timeline: Activity_launch_request id:com.cypress.cysmart time:319932728
2019-01-25 22:43:08.128 9375-9375/? I/BluetoothDevice: createBond() for device 00:A0:50:11:42:4E called by pid: 9375 tid: 9375
2019-01-25 22:43:08.322 9375-9375/? I/CySmart Android: Bonding is in process....
2019-01-25 22:43:08.324 9375-9375/? E/CySmart Android: Started Timer
2019-01-25 22:43:08.335 9375-9375/? D/CySmart Android: Phone
2019-01-25 22:43:08.428 9375-9375/? D/BluetoothAdapter: startLeScan(): null
2019-01-25 22:43:08.436 9375-9375/? D/BluetoothAdapter: STATE_ON
2019-01-25 22:43:08.483 9375-9375/? E/CySmart Android: onResume-->activity
2019-01-25 22:43:08.489 9375-9375/? E/CySmart Android: Scanning onResume
2019-01-25 22:43:08.499 9375-9375/? E/CySmart Android: Registering receiver in Profile scannng
2019-01-25 22:43:08.801 9375-9375/? I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@8f6c6d2 time:319933460
2019-01-25 22:43:08.900 9375-9375/? E/WindowManager: android.view.WindowLeaked: Activity com.cypress.cysmart.HomePageActivity has leaked window DecorView@90d8742[Bonding] that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:431)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:331)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:94)
at android.app.Dialog.show(Dialog.java:337)
at com.cypress.cysmart.CommonUtils.Utils.bondingProgressDialog(Utils.java:663)
at com.cypress.cysmart.OTAFirmwareUpdate.OTAFirmwareUpgradeFragment$1.onReceive(OTAFirmwareUpgradeFragment.java:365)
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1196)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6317)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
2019-01-25 22:43:19.483 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:43:19.949 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:43:19.951 9375-9375/? I/TouchFlickNoti: CHANGE DOWN TO UP vectorVelocity:-923
2019-01-25 22:43:20.631 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:43:20.898 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:43:20.900 9375-9375/? I/TouchFlickNoti: CHANGE DOWN TO UP vectorVelocity:-1197
2019-01-25 22:43:21.647 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:43:21.898 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:43:21.899 9375-9375/? I/TouchFlickNoti: CHANGE DOWN TO UP vectorVelocity:-1318
2019-01-25 22:43:22.584 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:43:22.764 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:43:22.766 9375-9375/? I/TouchFlickNoti: CHANGE DOWN TO UP vectorVelocity:-2026
2019-01-25 22:43:23.748 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-25 22:43:23.885 9375-9375/? I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-25 22:43:23.885 9375-9375/? I/TouchFlickNoti: CHANGE DOWN TO UP vectorVelocity:-2792
2019-01-25 22:43:24.896 9375-9375/? D/AndroidRuntime: Shutting down VM
--------- beginning of crash
2019-01-25 22:43:24.898 9375-9375/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.cypress.cysmart, PID: 9375
java.lang.IllegalArgumentException: View=DecorView@90d8742[Bonding] not attached to window manager
at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:473)
at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:382)
at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:126)
at android.app.Dialog.dismissDialog(Dialog.java:404)
at android.app.Dialog.-android_app_Dialog-mthref-0(Dialog.java:141)
at android.app.Dialog$-void__init__android_content_Context_context_int_themeResId_boolean_createContextThemeWrapper_LambdaImpl0.run(Dialog.java)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6317)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This looks like a memory leak which is happening because the AsyncTask might be running in a thread which has references to a dead Activity and its views. In summary, the activity might be finishing even before the AsyncTask is able to dismiss the dialog. You can resolve this by checking if the dialog exists before dismissing it in the AsyncTask.
Please add the following code in the OnPause():
if ((mDialog != null) && mDialog.isShowing())
mDialog.dismiss();
mDialog = null;
And in the AsyncTask, add the following code to the onPostExecute():
if ((mDialog != null) && mDialog.isShowing()) {
mDialog.dismiss();
}
I'm not sure about the object name (hence given the generic mDialog), please make changes accordingly. Let me know how it goes with these changes
Regards,
Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I built my own CySmart and fixed the errors to actually get the device to perform an update eventually. So it looks like the CySmart app and my own app do the same thing when firing the WireServAttrChanged function. Neither seem to be reflected in the logs and both seem to wait about 15 seconds then the blue device itself disconnects. The one main difference is I noticed the CySmart app forces a device refresh cache call to force finding new services which leads me to believe that command does nothing on Android. Is that your experience as well?
2019-01-28 08:19:15.689 31017-31031/com.cypress.cysmart D/CYSMART: , [Controls|Bootloader Activated] Write request status - Success
WRITEATTR FUNCION IS CALLED HERE. The device just sits for 15 seconds then disconnects. If the refresh cache option on disconnect option is enabled, the services are forced to be rediscovered on the next connect after another delay to wait for the cache to clear. This leads to a pretty long delay is actually enabling the new bootloader service. This is happening on Android 5.x and 7.x but I haven't tested on others yet.
2op019-01-28 08:19:36.231 31017-31057/com.cypress.cysmart D/BluetoothGatt: onClientConnectionState() - status=8 clientIf=9 device=00:A0:50:43:05:69
2019-01-28 08:19:36.232 31017-31057/com.cypress.cysmart I/CySmart Android: onConnectionStateChange
2019-01-28 08:19:36.232 31017-31057/com.cypress.cysmart I/CySmart Android: action :com.example.bluetooth.le.ACTION_GATT_DISCONNECTED
2019-01-28 08:19:36.240 31017-31017/com.cypress.cysmart E/CySmart Android: onReceive--false
2019-01-28 08:19:36.255 31017-31017/com.cypress.cysmart E/CySmart Android: Not in PSF and SCF
2019-01-28 08:19:36.271 31017-31017/com.cypress.cysmart I/Timeline: Timeline: Activity_launch_request id:com.cypress.cysmart time:523117194
2019-01-28 08:19:36.315 31017-31017/com.cypress.cysmart E/CySmart Android: newIntent
2019-01-28 08:19:36.315 31017-31017/com.cypress.cysmart E/CySmart Android: onResume-->activity
2019-01-28 08:19:36.347 31017-31017/com.cypress.cysmart I/Timeline: Timeline: Activity_launch_request id:com.cypress.cysmart time:523117270
2019-01-28 08:19:36.537 31017-31017/com.cypress.cysmart D/CySmart Android: Phone
2019-01-28 08:19:36.593 31017-31017/com.cypress.cysmart D/BluetoothAdapter: startLeScan(): null
2019-01-28 08:19:36.596 31017-31017/com.cypress.cysmart D/BluetoothAdapter: STATE_ON
2019-01-28 08:19:36.602 31017-31029/com.cypress.cysmart D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=10 mClientIf=0
2019-01-28 08:19:36.651 31017-31017/com.cypress.cysmart E/CySmart Android: onResume-->activity
2019-01-28 08:19:36.655 31017-31017/com.cypress.cysmart E/CySmart Android: Scanning onResume
2019-01-28 08:19:36.658 31017-31017/com.cypress.cysmart E/CySmart Android: Registering receiver in Profile scannng
2019-01-28 08:19:36.964 31017-31017/com.cypress.cysmart I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@2bc4246 time:523117887
2019-01-28 08:19:37.095 31017-31017/com.cypress.cysmart E/CySmart Android: Enabled characteristic size-->0
2019-01-28 08:19:38.594 31017-32262/com.cypress.cysmart D/BluetoothAdapter: stopLeScan()
2019-01-28 08:19:38.597 31017-32262/com.cypress.cysmart D/BluetoothAdapter: STATE_ON
2019-01-28 08:19:38.600 31017-32262/com.cypress.cysmart D/BluetoothAdapter: stopLeScan()
2019-01-28 08:19:38.603 31017-32262/com.cypress.cysmart D/BluetoothAdapter: scan not started yet
2019-01-28 08:19:43.341 31017-31017/com.cypress.cysmart I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-28 08:19:43.741 31017-31017/com.cypress.cysmart I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-28 08:19:44.443 31017-31017/com.cypress.cysmart I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-28 08:19:44.509 31017-31017/com.cypress.cysmart I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-28 08:19:44.577 31017-31017/com.cypress.cysmart D/BluetoothAdapter: stopLeScan()
2019-01-28 08:19:44.578 31017-31017/com.cypress.cysmart D/BluetoothAdapter: scan not started yet
2019-01-28 08:19:44.582 31017-31017/com.cypress.cysmart E/CySmart Android: BLE DISCONNECTED STATE
2019-01-28 08:19:44.583 31017-31017/com.cypress.cysmart D/BluetoothGatt: connect() - device: 00:A0:50:43:05:69, auto: false
2019-01-28 08:19:44.583 31017-31017/com.cypress.cysmart D/BluetoothGatt: registerApp()
2019-01-28 08:19:44.584 31017-31017/com.cypress.cysmart D/BluetoothGatt: registerApp() - UUID=de5d84ff-822e-4ccb-9074-b26e7c1a754c
2019-01-28 08:19:44.590 31017-31017/com.cypress.cysmart D/BluetoothGatt: refresh() - device: 00:A0:50:43:05:69
2019-01-28 08:19:44.592 31017-31031/com.cypress.cysmart D/BluetoothGatt: onClientRegistered() - status=0 clientIf=10
2019-01-28 08:19:44.892 31017-31031/com.cypress.cysmart D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=10 device=00:A0:50:43:05:69
2019-01-28 08:19:44.892 31017-31031/com.cypress.cysmart I/CySmart Android: onConnectionStateChange
2019-01-28 08:19:44.893 31017-31031/com.cypress.cysmart I/CySmart Android: action :com.example.bluetooth.le.ACTION_GATT_CONNECTED
2019-01-28 08:19:44.992 31017-31017/com.cypress.cysmart E/CySmart Android: Scanning onPause
2019-01-28 08:19:44.992 31017-31017/com.cypress.cysmart E/CySmart Android: UN Registering receiver in Profile scannng
2019-01-28 08:19:44.995 31017-31017/com.cypress.cysmart D/BluetoothAdapter: stopLeScan()
2019-01-28 08:19:44.996 31017-31017/com.cypress.cysmart D/BluetoothAdapter: scan not started yet
2019-01-28 08:19:45.038 31017-31017/com.cypress.cysmart E/CySmart Android: Service discovery onResume
2019-01-28 08:19:45.538 31017-31017/com.cypress.cysmart E/CySmart Android: Discover service called
2019-01-28 08:19:45.538 31017-31017/com.cypress.cysmart D/BluetoothGatt: discoverServices() - device: 00:A0:50:43:05:69
2019-01-28 08:19:46.072 31017-31057/com.cypress.cysmart D/BluetoothGatt: onSearchComplete() = Device=00:A0:50:43:05:69 Status=0
2019-01-28 08:19:46.089 31017-31057/com.cypress.cysmart I/CySmart Android: action :com.example.bluetooth.le.ACTION_GATT_SERVICES_DISCOVERED
2019-01-28 08:19:46.093 31017-31017/com.cypress.cysmart E/CySmart Android: Service discovered
2019-01-28 08:19:46.139 31017-31017/com.cypress.cysmart D/BluetoothGatt: configureMTU() - device: 00:A0:50:43:05:69 mtu: 512
2019-01-28 08:19:46.176 31017-31017/com.cypress.cysmart E/CySmart Android: Action viewfalse
2019-01-28 08:19:46.250 31017-31057/com.cypress.cysmart D/BluetoothGatt: onConfigureMTU() - Device=00:A0:50:43:05:69 mtu=23 status=0
2019-01-28 08:19:47.709 31017-31017/com.cypress.cysmart I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-28 08:19:47.874 31017-31017/com.cypress.cysmart I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-28 08:19:54.626 31017-31017/com.cypress.cysmart I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-28 08:19:54.659 31017-31017/com.cypress.cysmart I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-28 08:19:54.691 31017-31017/com.cypress.cysmart E/CySmart Android: secondFilePath-->Default
2019-01-28 08:19:54.699 31017-31017/com.cypress.cysmart I/BluetoothDevice: createBond() for device 00:A0:50:43:05:69 called by pid: 31017 tid: 31017
2019-01-28 08:19:54.713 31017-31017/com.cypress.cysmart E/CySmart Android: Action viewfalse
2019-01-28 08:19:54.802 31017-31017/com.cypress.cysmart E/CySmart Android: Started Timer
2019-01-28 08:19:54.803 31017-31017/com.cypress.cysmart I/CySmart Android: Bonding is in process....
2019-01-28 08:19:54.837 31017-31017/com.cypress.cysmart E/CySmart Android: Started Timer
2019-01-28 08:19:54.944 31017-31017/com.cypress.cysmart E/CySmart Android: Pair request received
2019-01-28 08:19:54.944 31017-31017/com.cypress.cysmart E/CySmart Android: HomepageActivity--->Pair Request
2019-01-28 08:19:54.944 31017-31017/com.cypress.cysmart E/CySmart Android: Stopped Timer
2019-01-28 08:19:58.942 31017-31017/com.cypress.cysmart E/CySmart Android: onResume-->activity
2019-01-28 08:19:58.987 31017-31017/com.cypress.cysmart I/BluetoothDevice: createBond() for device 00:A0:50:43:05:69 called by pid: 31017 tid: 31017
2019-01-28 08:19:59.088 31017-31017/com.cypress.cysmart E/CySmart Android: HomepageActivity--->Bonded
2019-01-28 08:19:59.088 31017-31017/com.cypress.cysmart E/CySmart Android: Stopped Timer
2019-01-28 08:19:59.128 31017-31017/com.cypress.cysmart I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@2bc4246 time:523140052
2019-01-28 08:20:02.428 31017-31017/com.cypress.cysmart I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-28 08:20:02.475 31017-31017/com.cypress.cysmart I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-28 08:20:02.492 31017-31017/com.cypress.cysmart I/Timeline: Timeline: Activity_launch_request id:com.cypress.cysmart time:523143416
2019-01-28 08:20:02.629 31017-31017/com.cypress.cysmart D/CySmart Android: Phone
2019-01-28 08:20:02.757 31017-31017/com.cypress.cysmart I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@4bc480 time:523143681
2019-01-28 08:20:03.645 31017-31017/com.cypress.cysmart I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-28 08:20:03.710 31017-31017/com.cypress.cysmart I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-28 08:20:05.914 31017-31017/com.cypress.cysmart I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
2019-01-28 08:20:05.991 31017-31017/com.cypress.cysmart I/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
2019-01-28 08:20:06.057 31017-31017/com.cypress.cysmart D/BluetoothGatt: setCharacteristicNotification() - uuid: 00060001-f8ce-11e4-abf4-0002a5d5c51b enable: true
2019-01-28 08:20:06.070 31017-31017/com.cypress.cysmart E/CySmart Android: PATH>>>/storage/emulated/0/CySmart/XT8_H.cyacd
2019-01-28 08:20:06.085 31017-31017/com.cypress.cysmart E/CySmart Android: onResume-->activity
2019-01-28 08:20:06.159 31017-31052/com.cypress.cysmart E/CySmart Android: added notify characteristic
2019-01-28 08:20:06.183 31017-31017/com.cypress.cysmart I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@2bc4246 time:523147106
2019-01-28 08:20:07.209 31017-31017/com.cypress.cysmart E/CySmart Android: OTAEnterBootLoaderCmd
2019-01-28 08:20:07.217 31017-31017/com.cypress.cysmart V/CYSMART: , [Bootloader Service|Bootloader Data Characteristic] Write request sent with value , [ 01 38 00 00 C7 FF 17 ]
2019-01-28 08:20:07.313 31017-31052/com.cypress.cysmart D/CYSMART: , [Bootloader Service|Bootloader Data Characteristic] Write request status - Success
2019-01-28 08:20:07.328 31017-31017/com.cypress.cysmart E/CySmart Android: Response>>>>>010008009E11510E003C0101ABFE17
2019-01-28 08:20:07.328 31017-31017/com.cypress.cysmart I/CySmart Android: CYRET_SUCCESS
2019-01-28 08:20:07.331 31017-31017/com.cypress.cysmart E/CySmart Android: OTAGetFlashSizeCmd
2019-01-28 08:20:07.341 31017-31017/com.cypress.cysmart V/CYSMART: , [Bootloader Service|Bootloader Data Characteristic] Write request sent with value , [ 01 32 01 00 01 CB FF 17 ]
2019-01-28 08:20:07.412 31017-31052/com.cypress.cysmart D/CYSMART: , [Bootloader Service|Bootloader Data Characteristic] Write request status - Success
2019-01-28 08:20:07.424 31017-31017/com.cypress.cysmart E/CySmart Android: Get flash size Response>>>>>01000400FC00FF01FFFD17
2019-01-28 08:20:07.424 31017-31017/com.cypress.cysmart I/CySmart Android: CYRET_SUCCESS
2019-01-28 08:20:07.429 31017-31017/com.cypress.cysmart E/CySmart Android: Row: 0Start Pos: 0mStartRow: 16515072mEndRow: 33488896Row No:16515072
2019-01-28 08:20:07.429 31017-31017/com.cypress.cysmart E/CySmart Android: Array id: 1 Shared Array id: 1
2019-01-28 08:20:07.429 31017-31017/com.cypress.cysmart E/CySmart Android: OTAProgramRowCmd send size--->138
2019-01-28 08:20:07.449 31017-31017/com.cypress.cysmart V/CYSMART: , [Bootloader Service|Bootloader Data Characteristic] Write request sent with value , [ 01 39 83 00 01 FC 00 00 40 00 20 11 7E 01 00 C9 A4 01 00 C9 A4 01 00 10 B5 02 4B 83 F3 08 88 02 F0 78 FB 00 40 00 20 70 B5 12 22 22 4B 1A 60 02 F0 FE FF 21 48 03 F0 5B F9 01 20 03 F0 18 F8 30 20 02 F0 1F FF 1E 4C 80 25 ED 05 25 60 1D 4A 11 68 02 23 0B 43 13 60 1B 4A 1C 4B 1A 60 00 22 1B 4B 1A 60 1B 4A 13 68 08 21 8B 43 13 60 FA 20 C0 00 02 F0 A9 FF 18 48 02 F0 9C FF B8 22 52 01 16 4B 1A 60 16 4B 17 4A 31 D5 17 ]
2019-01-28 08:20:08.438 31017-31031/com.cypress.cysmart D/CYSMART: , [Bootloader Service|Bootloader Data Characteristic] Write request status - Success
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not able to reproduce the error just yet, so I can't tell if I'm seeing the same behaviour. I can help you debug based on your logs. So can you please share the entire log file of the logcat window? You can add it as an attachment.
Regards,
Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you say full logs, are you referring to removing the filter for my app in the log? The previous post was the full log shown in Android Studio from the point of the button press to the error.
In order to prevent the issue I have just left the bootloader service enabled with auth. This eliminates the need to rediscover services, which is the main issue here. Are there any security or other unforseen issues with just leaving the bootloader service enabled with auth for a released product?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No I mean, copy the entire contents of the logcat from the start of App activity till the occurence of crash and paste it into a file. Then attach this file to the post for vieiwing.
Regards,
Dheeraj