clariusdev / mobileapi

Android API Allowing IPC with the Clarius App
https://www.clarius.com
BSD 3-Clause "New" or "Revised" License
12 stars 4 forks source link

MSG_FREEZE_CHANGED does not set arg1 #16

Closed mischkew closed 2 years ago

mischkew commented 2 years ago

Mobile API Version: v8.0.1 Mobile App Version: v8.6.0 Phone: Samsung Galaxy S8, Samsung Galaxy S10 Probe: L7HD

Observed Behaviour

When toggling the freeze state via USER_FN_TOGGLE_FREEZE the probe changes the freeze status accordingly. This can be seen in the Clarius app and the probe flashes lights blue/ green. When the freeze status has been toggled, a MSG_FREEZE_CHANGED is received. arg1 is always 0, regardless of the actual freeze status of the app.

This does not happen in v8.0.1 and v8.5.1 of the Mobile App and scanner software.

This is reproducible with both, hardware scanners and virtual scanners.

Expected Behaviour

arg1 represents the actual freeze status, i.e. is 1 when the probe is frozen and 0 when the probe is imaging.

Steps to Reproduce

julien-l commented 2 years ago

Hi thanks for reporting. Does it also happen when toggling freezing directly in the app, as opposed to via the Mobile API with the USER_FN_TOGGLE_FREEZE function?

mischkew commented 2 years ago

Hey @julien-l,

I had to remove the 8.6 build and try out the earlier build on my phone to document this issue. Now it takes a while for me to be enrolled back into the beta tester program. My other phone only received 8.5, probably because the beta is not a 100% roll-out.

Could you upload the beta apks/ bunldes as part of the releases here on GitHub as well? Then my turnaround for testing and giving you guys feedback is quicker.

julien-l commented 2 years ago

I was able to replicate the issue and confirm it was introduced in version 8.6.0, I will investigate.

mischkew commented 2 years ago

Great! Thanks for looking into it.

julien-l commented 2 years ago

The reason is the payload format for MSG_FREEZE_CHANGED has changed in 8.6, the freeze state is sent in the bundle data rather that arg1. In file MobileApiHelper.java, change line:

mObserver.onFrozen(1 == msg.arg1);

To:

mObserver.onFrozen(msg.getData().getBoolean("freeze"));

This will be documented in the next Mobile API release.

mischkew commented 2 years ago

Will that then be a v9 release of the API? I would consider such a change a breaking API change.

Is there a chance to keep the same behavior and only add the parcel function?

That way the API stays backwards compatible.

julien-l commented 2 years ago

Hi sorry for the late reply. I confirm that his change is part of the 8.6 Clarius App.

Also note that the API versioning follows the Clarius application's versioning, which is based on marketing considerations (e.g. new features) and not follow the usual API versioning rules like semver. In other words, it is not impossible we introduce breaking changes between minor versions. That being said, we generally try to keep the API backward-compatible.