boswelja/SmartwatchExtensions

Wear OS BootWorker crashing

boswelja opened this issue · 0 comments

Describe the bug
The BootWorker on Wear OS crashes repeatedly. This causes the worker to be rescheduled, possibly hurting watch performance and battery. As the crash is silent, it doesn't appear to affect the user.

To Reproduce
Steps to reproduce the behavior:

  1. Reboot the device
  2. Observe LogCat
    Expected behavior
    BootWorker executes successfully.

Exception

    java.lang.RuntimeException: invalid channel for service notification: Notification(channel=boot_or_update_noti_channel pri=-1 contentView=null vibrate=null sound=null defaults=0x0 flags=0x42 color=0x00000000 vis=PRIVATE)
        at com.android.server.am.ServiceRecord$1.run(ServiceRecord.java:664)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.os.HandlerThread.run(HandlerThread.java:65)
        at com.android.server.ServiceThread.run(ServiceThread.java:44)
2021-06-18 21:35:32.309 732-25828/? E/NotificationService: No Channel found for pkg=com.boswelja.smartwatchextensions.debug, channelId=boot_or_update_noti_channel, id=69102, tag=null, opPkg=com.boswelja.smartwatchextensions.debug, callingUid=10106, userId=0, incomingUserId=0, notificationUid=10106, notification=Notification(channel=boot_or_update_noti_channel pri=-1 contentView=null vibrate=null sound=null defaults=0x0 flags=0x2 color=0x00000000 vis=PRIVATE)
2021-06-18 21:35:32.314 16343-16343/com.boswelja.smartwatchextensions.debug D/AndroidRuntime: Shutting down VM
2021-06-18 21:35:32.342 16343-16343/com.boswelja.smartwatchextensions.debug E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.boswelja.smartwatchextensions.debug, PID: 16343
    android.app.RemoteServiceException: Bad notification for startForeground
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1738)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6680)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Device:

  • Phone: Pixel 3 running Android 12 Beta 2
  • Watch: Fossil Gen 5
  • App Version: 4.2.1 (Debugging)