getActiveNotifications() throws an NPE on Android 6.0.1 (mostly Motorola ROMs)
Edited by @2-4601:
This issue is about a crash when opening notifications. Most of the affected devices are Motorola's running Android 6.0.1.
E AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
E AndroidRuntime: Process: org.thoughtcrime.securesms, PID: 25021
E AndroidRuntime: java.lang.RuntimeException: An error occurred while executing doInBackground()
E AndroidRuntime: at android.os.AsyncTask$3.done(AsyncTask.java:309)
E AndroidRuntime: at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
E AndroidRuntime: at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
E AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:242)
E AndroidRuntime: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
E AndroidRuntime: at java.lang.Thread.run(Thread.java:818)
E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List android.content.pm.ParceledListSlice.getList()' on a null object reference
E AndroidRuntime: at android.app.NotificationManager.getActiveNotifications(NotificationManager.java:683)
E AndroidRuntime: at org.thoughtcrime.securesms.notifications.MessageNotifier.cancelActiveNotifications(MessageNotifier.java:133)
E AndroidRuntime: at org.thoughtcrime.securesms.notifications.MessageNotifier.updateNotification(MessageNotifier.java:241)
E AndroidRuntime: at org.thoughtcrime.securesms.notifications.MessageNotifier.updateNotification(MessageNotifier.java:172)
E AndroidRuntime: at org.thoughtcrime.securesms.ConversationActivity$25.doInBackground(ConversationActivity.java:1356)
E AndroidRuntime: at org.thoughtcrime.securesms.ConversationActivity$25.doInBackground(ConversationActivity.java:1350)
E AndroidRuntime: at android.os.AsyncTask$2.call(AsyncTask.java:295)
E AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E AndroidRuntime: ... 4 more
Original issue was about something else that was already fixed in the beta release at the time of reporting. The original issue was turned into this issue from the second comment. Original issue below for posterity:
I have:
- [x] searched open and closed issues for duplicates
- [x] read https://github.com/WhisperSystems/Signal-Android/wiki/Submitting-useful-bug-reports
Bug description
App crashes.
Steps to reproduce
Unable to reproduce. This happened twice within a short timespan as I was using the app. Strangely, the action I was performing at the time (1st crash: sending a photo captured within Signal to a group conversation, 2nd crash: responding to a text message to a single contact) was successful both times, even though the app reported that it crashed.
Actual result: App crashes and has to be relaunched. Expected result: App should not crash, messages should be sent.
Device info
Device: Samsung Galaxy S5 Neo Android version: 6.0.1 Signal version: 3.25.4
Link to debug log
1st crash: https://gist.github.com/cec3a81959ce454cce66fab9da1644db 2nd crash: https://gist.github.com/a2cddcbc9aeb725918025e7b14e0e991
PS: I also submitted the Google app crash report thing, not sure if that's useful to the OWS crowd.
I guess, my too frequent crashes today at related. Maybe this log helps. https://gist.github.com/98e469579f6a5b8b347c49d8090dcb04
@i7u both of your bugs are fixed in 3.26.x, it's been out for a few days so consider updating
@merkste your crash is happening in code that's not ours, are you running a weird rom?
@moxie0 w00t! Hadn't been prompted to upgrade yet. Done now. Thank you for all you do. Leaving the issue open for @merkste to respond, otherwise I'm done.
Hi @moxie0, my device runs the standard Moto G3 Rom. It's not even rooted. Can I help with further information or testing?
Looks like an Android bug?, and you're not the first to encounter this: https://github.com/googlesamples/android-ActiveNotifications/issues/1
Not sure what to do about this.
Er, sorry, not sure if this is related, but I just had another crash, this time with Signal v. 3.26.2, when I attempted to "share" a link to Signal.
Let me know if this should go in a separate issue. Here's the debug log right after the crash: https://gist.github.com/52ddc0b2340febedd38ec03f38e3dc50
@i7u new issue please
@moxie0 , looks very similar, indeed. Nevertheless, I encountered the crash only recently, after updating to 3.26.x (or maybe it was 3.25.x, but not an earlier version). This gives rise to the suspicion that a recent change triggers the (Android) bug. Maybe we can come up with a workaround?
The crash just happened again and it appears to me that it is related to opening an existing conversation. All crashes - as far as I remember - occurred right after opening a thread.
@merkste Yeah I only recently started calling that API, but I have to in order to support bundled notifications.
Same here... these occasional crashes seemingly occur when:
- 1.: several messages sent by different contacts were received resulting in a bundled notification (e.g. "2 messages in 2 conversations")
- 2.: opening the conversations view by clicking/tapping the bundled notification
- 3.: selecting one of the affected conversations
Moto G4 Plus Android 6.0.1 official ROM, not rooted Signal 3.27.0 (IIRC, I hadn't had this issue with the latest 3.26.x)
Crash log: https://gist.github.com/86e533515fe1f6154a83d8adde3823f4
Ne log: https://gist.github.com/d04092b800b22416b4716afedb91659f
Happened to me today when I opened Signal first time after night. The situation was pretty much how @PiCob described it. (But I can't reproduce it anymore by creating the same conditions.)
Moto G4 Play, 6.0.1, 3.27.0 https://gist.github.com/anonymous/9416379d2b53dcba2f9a0ea9870710aa
Is it not curious how (edit) 6/7 of these crashes is a Moto device? :smile: (One is Sony) All of them are running 6.0.1.
Could be wrong linking it as this issue (2nd crash as listed inOP), but yet another (Motorola) where the user states "Just now I finished reading one text, went back to the list of texts, and clicked on an unread text and it crashed again. As I was typing that last sentence, the same circumstance happened and it crashed again. These happen to be SMS messages, if that matters. One was a group (MMS) that I clicked on and one was a single person. It crashed both times."
https://gist.github.com/d03e0c167afe2d712607aba1819e3886
@riyapenn yeah same issue =(
hopefully that does the trick, i'm just catching the npe as it comes out of the android code. shouldn't be a huge deal if bundled notifications are mishandled as a result, since they're only really visible on 7.0+ devices. would only possibly effect users who have one of these buggy roms and an android wear device.