ANR in com.android.launcher after tapping back

前端 未结 1 534
长情又很酷
长情又很酷 2021-01-03 04:02

When I install my app on certain devices (seems to be 4.4.4 and later) I sometimes see the following ANR in com.android.launcher after the following steps:

  1. Fro
相关标签:
1条回答
  • 2021-01-03 04:56

    This is probably a bug in the Android Framework. I tested on about 12 devices today and noticed that this bug occurs reliably on Nexus-type devices running these versions of Android:

    • 4.4.4
    • 5.0.1
    • 5.0.2

    Interestingly, Samsung devices running the same versions of Android do not exhibit the problem. Android 5.1 and later seems to be better in that I see no more ANRs in com.android.launcher; however I am now seeing ANRs in com.google.android.googlequicksearchbox.

    I worked around this problem after noticing that my Activity was overriding onBackPressed() without invoking super.onBackPressed(). After I added super.onBackPressed(), the ANRs went away. But this is not a full workaround because calling super.onBackPressed() finished my Activity, which I do not want.

    I hope this helps someone.

    See: Using FLAG_ACTIVITY_REORDER_TO_FRONT to switch among persistently running UI activities leads to "no window focus" error

    See: Android-L issue: onBackpressed when using FLAG_ACTIVITY_REORDER_TO_FRONT to launch previous activity & freezes app for sometime

    Also, I found a bug entry on Google's site that seems related: https://code.google.com/p/android/issues/detail?id=91534

    0 讨论(0)
提交回复
热议问题