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

Using the new `MSG_SET_SETTINGS_INFO` crashes Clarius app #18

Closed nnaskov closed 2 years ago

nnaskov commented 2 years ago

Hi, I am facing the following issue and it seems the issue is with the Clarius app itself.

Mobile API version: 9.0.0 Installed Clarius App: 9.1.0-287+372b0f17e0

Issue When sending the new MSG_SET_SETTINGS_INFO with an argument, bundle of me.clarius.mobileapi.SettingsInfo(), the Clarius app crashes.

Here's my code:

   val defaultSettings = me.clarius.mobileapi.SettingsInfo()
            defaultSettings.autoConnect = true
            defaultSettings.autoScan = true
            defaultSettings.autoFreeze = DEFAULT_AUTO_FREEZE
            defaultSettings.keepAwake = DEFAULT_KEEP_AWAKE

            defaultSettings.buttonUp = SettingsInfo.BUTTON_USER
            defaultSettings.buttonDown = SettingsInfo.BUTTON_USER

            sendMessage(
                MobileApi.MSG_SET_SETTINGS_INFO,
                bundleOf(
                    MobileApi.KEY_SETTINGS_INFO to defaultSettings,
                )
            )

Here's the crash in the Logcat:

2022-03-29 11:57:10.706 E: Class not found when unmarshalling: me.clarius.mobileapi.SettingsInfo
    java.lang.ClassNotFoundException: me.clarius.mobileapi.SettingsInfo
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:454)
        at android.os.Parcel.readParcelableCreator(Parcel.java:3402)
        at android.os.Parcel.readParcelable(Parcel.java:3336)
        at android.os.Parcel.readValue(Parcel.java:3238)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:3635)
        at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:292)
        at android.os.BaseBundle.unparcel(BaseBundle.java:236)
        at android.os.Bundle.getParcelable(Bundle.java:1002)
        at me.clarius.mobileapi.MobileApiService$IncomingHandler.handleMessage(MobileApiService.java:303)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at android.app.ActivityThread.main(ActivityThread.java:8633)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1133)
... 
julien-l commented 2 years ago

Thanks for reporting, I was able to reproduce and this will be fixed in the next version (9.2.0) scheduled to enter testing in a few days. Thanks!

clariusk commented 2 years ago

please see the latest app pilot with latest code here to get fix for reported issue

julien-l commented 2 years ago

This was fixed in version 9.3.0, thanks again for reporting.