Bug? NB6 crashes Sony Xperia M5 hard, forcing phone reboot

Discussion in 'Bugs & wishlist' started by Sandman, Aug 8, 2018.

Tags:
  1. Sandman

    Sandman Active Member Licensed User

    For some reason NB6 crashes Sony Xperia M5 (and perhaps more phones) when using NB6.

    To reproduce:
    - Download the official NB6 (including the updated NB6.bas) and install
    - Try the first notification
    - Message on screen: "Unfortunately, System UI has stopped"

    Result in pic below. After pressing OK, screen starts blinking and phone is completely unresponsive. Only way to fix this is to force a reboot.

    upload_2018-8-8_15-36-22.png

    It's very difficult to test, especially because the device needs to be rebooted all the time. But as far as I can tell it's the actual .Notify(id) that's causing the problem. Stuff up to that seems to work fine.

    The phone is fully updated, which means it's running Android 6.0.

    (I found this as I published an update for my app, now with NB6. Users are going ballistic. Needless to say, this is very stressful for me.)
     
    Last edited: Aug 8, 2018
  2. Erel

    Erel Administrator Staff Member Licensed User

    The example project creates all kinds of notifications. Create a new project with a simple notification and try it. You can check the unfiltered logs with USB debug mode to see the error message.
     
  3. Sandman

    Sandman Active Member Licensed User

    If I create a super simple notification like this, it works fine:

    Code:
    Dim n As Notification
    n.Initialize
    n.Icon = 
    "icon"
    n.Sound = 
    False
    n.SetInfo(
    "Some title""Some text""")
    n.Notify(
    1)
    However, if I run the "Simple notification" from NB6 and use USB debugging, these are the logs I get:

    Code:
    --------- beginning of crash
    FATAL 
    EXCEPTION: main
    Process: com.android.systemui, PID: 
    1465
    java.lang.IllegalStateException: called getResPackage() on Icon(typ=
    BITMAP size=72x72)
        at android.graphics.drawable.Icon.getResPackage(Icon.java:
    182)
        at com.android.systemui.statusbar.StatusBarIconView.equals(StatusBarIconView.java:
    305)
        at java.util.ArrayList.contains(ArrayList.java:
    339)
        at com.android.systemui.statusbar.phone.StatusBarIconController.updateNotificationIcons(StatusBarIconController.java:
    238)
        at com.android.systemui.statusbar.phone.PhoneStatusBar.updateNotifications(PhoneStatusBar.java:
    1760)
        at com.android.systemui.statusbar.BaseStatusBar.addNotificationViews(BaseStatusBar.java:
    1839)
        at com.android.systemui.statusbar.phone.PhoneStatusBar.addNotification(PhoneStatusBar.java:
    1487)
        at com.android.systemui.statusbar.BaseStatusBar$
    6$2.run(BaseStatusBar.java:524)
        at android.os.Handler.handleCallback(Handler.java:
    815)
        at android.os.Handler.dispatchMessage(Handler.java:
    104)
        at android.os.Looper.loop(Looper.java:
    207)
        at android.app.ActivityThread.main(ActivityThread.java:
    5763)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
    789)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
    679)
    getAPEInfo 
    not ape 5003
    unknown object: 5367674f-
    200-0-000000000000422a, 0 bytes
    error parsing header: -
    6
    readlink(
    '/proc/self/fd/266') failed: Permission denied [fd=266]
    warning: unable to get realpath for the library "libpvrANDROID_WSEGL.so". Will use given name.
    readlink(
    '/proc/self/fd/266') failed: Permission denied [fd=266]
    warning: unable to get realpath for the library "libged.so". Will use given name.
    failed 
    to read 27 bytes at offset 0x0000000000c95e, got 0 bytes
    Failed 
    to get GED Log Buf, err(0)
    onScanSources
    setConfig(
    46:google.vorbis.decoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)
    getParameter(
    46:google.vorbis.decoder, ??(0x7f200406)) ERROR: UnsupportedIndex(0x8000101a)
    openPcmDriver(), pcm_start(
    0xeb214000) fail due to cannot start channel: Broken pipe
    -getHardwareBufferInfo pcm_get_htimestamp fail, ret = -
    1, pcm_get_error = cannot start channel: Broken pipe
    b4a.example3
    b4a.example3
    failed 
    to read 27 bytes at offset 0x0000000000c95e, got 0 bytes
    readPage returned -
    1011
    TRAFFIC_STATS_POLL 
    true Token 11 num clients 11
     packet count Tx=
    10717 Rx=15800
    notifying of data 
    activity 2
    They go on for very long, I hope I copied a reasonable amount.

    Looking at the error message I get the distinct feeling that this is caused by a too large icon. (I've seen other threads in the forum where that seems to have been the problem.) However, the Smiley is 160x160 pixels, and it's resized in NB6 like this:

    Code:
    smiley = LoadBitmapResize(File.DirAssets, "smiley.png"24dip24dipFalse)
    And the comment for SmallIcon is as below, so that seems to be correct? Or?
    Code:
    'Sets the status bar icon. The icon size should be 24 x 24.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Looks like a bug in your device OS. Starting from Android 6 the notification icon can be created with a Bitmap instead of a resource. Looks like it causes your device to crash.

    Which version of Android is it running?
     
  5. Sandman

    Sandman Active Member Licensed User

    6.0

    Anything else to try? I'm quite desperate.
     
  6. Sandman

    Sandman Active Member Licensed User

    Can NB6 work with a resource instead of a bitmap?
     
  7. JohnnyHamburg

    JohnnyHamburg Member Licensed User

    I use NB6 also since some days for an app that is on market. And I got told of some crashes in developer console only concerning Android 6. Didn't know yet why they crash.

    My code for notification is:

    Code:
    Sub Process_Globals
        
        
    Public startzeit As Long
        
    Public WDnotifi As Bitmap
        
    Public n As NB6
    End Sub

    Sub Service_Create
    WDnotifi = LoadBitmapResize(
    File.DirAssets, "WDnotifi.png"24dip24dipFalse)

    Simple_Notification
    End Sub

    Sub Simple_Notification
        
        n.Initialize(
    "default"Application.LabelName, "DEFAULT").AutoCancel(True).SmallIcon(WDnotifi)
        
    End Sub
     
  8. Sandman

    Sandman Active Member Licensed User

    Please, can you upload WDnotifi.png here, I want to test a theory...
     
  9. JohnnyHamburg

    JohnnyHamburg Member Licensed User

    Ok, what theory?
     

    Attached Files:

  10. Sandman

    Sandman Active Member Licensed User

    I'm making progress. Will report back in the thread as soon as I have something. Thanks for pic. Sorry for short text, fighting clock
     
  11. Sandman

    Sandman Active Member Licensed User

    Thanks to expert advice from @JordiCP, this is mostly solved. He took the thought of making NB6 work with a resource rather than a file and made it into reality - and as it turned out, that got rid of the crashes.

    It seems that some versions of Android crashes in a really awful way when one tries to use a bitmap as icon. This means that this is the sub from NB6 that causes the problem:

    Code:
    Public Sub SmallIcon (Icon As BitmapAs NB6
        
    If IsBuilder Then
            NotificationBuilder.RunMethod(
    "setSmallIcon"Array(CreateIconFromBitmap(Icon)))
        
    End If
        
    Return Me
    End Sub
    This is what @JordiCP came up with instead. First of all, make sure that the icon is 72x72 and in gray-scale with transparency. This is important, otherwise the icon will just be a filled box. Place the file in Objects\Res\Drawable (read-only)

    Then use this code instead of SmallIcon above.

    Code:
    Public Sub SmallIcon (Icon as BitmapAs NB6
        
    If IsBuilder Then
            
    Dim jo2 As JavaObject
            jo2=Me
            
    Dim id As Int = jo2.RunMethod("retrieveResourceId",Null)
            NotificationBuilder.RunMethod(
    "setSmallIcon"Array(id))       
        
    End If
        
    Return Me
    End Sub

    #if JAVA
    public int retrieveResourceIdStatus() {
        return R.drawable.the_icon_file;
    }
    #End If
    This is not at all as polished as it should be. For instance, the Icon as Bitmap part is not used as the icon is referenced in the Java code. But it was enough to stop the crashes and display the correct icon.

    Some quick notes:
    - 72x72 seems to be fine regardless of display scale
    - Some devices (Jordi can comment on this) failed to get the correct icon and instead showed the app icon - but at least neither the app nor the phone did crash

    Again, let me point out that this is not at all as polished as it should be, there's room for improvements.

    (I'm hoping that Erel might be able to comment and adjust it to make it rock solid. :) )
     
    JordiCP and JohnnyHamburg like this.
  12. Sandman

    Sandman Active Member Licensed User

    Jordi and I tested a theory that NB6 would work out of the box on the Xperia if the icon was grayscale with transparency (as opposed to your current icon, which was in color). Sorry to say, that wasn't the solution, and instead we had to go for the solution I just posted in #11.

    Do you know what devices that have reported the problem? It sure would be great if you could try this solution and see if they start working.
     
  13. JohnnyHamburg

    JohnnyHamburg Member Licensed User

    I don`t want the users of my app to get serious crashes, so I went back to the simple notification yesterday. Hoping this was the problem. Maybe I try NB6 another time again.

    The crashes appeared on Samsung S5 and Note4 devices but only those using Android 6.0.

    But thank you anyway for finding out this problem and a solution. I will test in future.
     
    Sandman likes this.
  14. Erel

    Erel Administrator Staff Member Licensed User

    I will see what can be done...
     
    Sandman likes this.
  15. Erel

    Erel Administrator Staff Member Licensed User

    What is the output of this code on the failed devices:
    Code:
    Dim jo As JavaObject
    jo.InitializeStatic(
    "android.os.Build$VERSION")
    Log(jo.GetField("RELEASE"))
    Log(jo.GetField("INCREMENTAL"))
    ?
     
  16. woniol

    woniol Active Member Licensed User

  17. Erel

    Erel Administrator Staff Member Licensed User

    @woniol please post the output of the code I posted. We might be able to find the exact version where it fails. The source of this issue is a bug in the OS.
     
  18. woniol

    woniol Active Member Licensed User

    I'll post it in 4 hours, I don't have access to this phone right now.
     
    Erel likes this.
  19. Sandman

    Sandman Active Member Licensed User

    Sony Xperia M5 (the device having crashes):
    Code:
    6.0
    1376301686
    I also have two other 6.0 devices so for completeness I ran it there too.

    Alcatel Pixi 4 (no NB6 crashes):
    Code:
    6.0
    v3DL5-
    0
    Motorola Moto X (no NB6 crashes):
    Code:
    6.0
    7
     
  20. woniol

    woniol Active Member Licensed User

    Galaxy S5
    Code:
    6.0.1
    G900FXXS1CQD1
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice