Deleting the Text of Death on Android
To skip ahead to the solution, click here. But be careful: the solution offered here will delete ALL SMS messages on your phone. You might want to read the whole story to make sure you're dealing with the same problem.
The other day, my wife's Android phone became unusable. The following error message would appear in a modal dialog, along with an OK button:
Unfortunately, the process com.android.phone has stopped.
As soon as I would tap the OK button, the same message would appear again. Sometimes, another message would display underneath it:
Power off your device, insert the service provider UICC that came with the device, then power on the device.
The phone is a Samsung J3 Emerge, from Sprint, which my wife bought as a temporary replacement phone when the screen on her Galaxy S5 failed. It's running Android 6.0.1, and will probably never support anything newer. Not a great phone, but it was inexpensive and served well as a backup. Many apps and features of the phone still worked, but having to click OK to dismiss this error message over and over and over made it essentially unusable. And, not surprisingly, the Messages app would crash on startup, which means no text messaging -- one of the primary functions of the phone.
That second error message seemed to suggest a hardware issue. I discovered that a UICC is a type of SIM card. So I tried removing and reinserting the SIM card, but this had no effect.
While I researched the problem further, I contacted Sprint and asked them to switch her over to her other phone. This freed me up to fiddle with the J3 Emerge, to see if I could understand the problem, and maybe even fix it.
My next step was to scan logcat for errors, and I discovered this crash:
FATAL EXCEPTION: CdmaInboundSmsHandler Process: com.android.phone, PID: 16225 java.lang.ArrayIndexOutOfBoundsException: length=2; index=2 at com.android.internal.telephony.InboundSmsHandler.processMessagePart(InboundSmsHandler.java:1192) at com.android.internal.telephony.InboundSmsHandler$DeliveringState.processMessage(InboundSmsHandler.java:593) at com.android.internal.util.StateMachine$SmHandler.processMsg(StateMachine.java:968) at com.android.internal.util.StateMachine$SmHandler.handleMessage(StateMachine.java:791) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.os.HandlerThread.run(HandlerThread.java:61)
It looks to me like Android 6.0.1 has a bug, which can crash com.android.phone when it fails to process certain text messages. Every time the process started, it was attempting to load messages from the SMS database, and would stumble upon a message that would result in an ArrayIndexOutOfBoundsException. The phone had been incapacitated by a Text of Death!
I considered trying to access the SMS database myself, to inspect the contents of the message, but quickly realized I just don't have the time. In place of precision and subtlety, I reached for a hammer. Via adb, I was able to delete the SMS database, along with the other bits stored by the telephony provider. (According to documentation, this includes "SMS and MMS messages, access to the APN list, including the MMSC to use, and the service state.")
You'll Need adb
What is adb, you ask? It's the Android Debug Bridge: a command-line tool that you run on your Windows, Linux, or Mac computer to inspect and control features of your Android phone. It's an essential tool for app developers, but can also be handy for power users -- or, in this case, anyone who has been bitten by this most nasty bug. You'll need a USB cable to connect your computer to your phone, and you'll have to download and install the Android SDK Platform Tools, which include adb.
If you're new to adb, you'll also need to enable USB debugging on your Android device. I imagine this would be very challenging while the dialog box keeps popping up; in my case, USB debugging was already enabled.
- On the device, go to Settings > About
(where device is typically "phone")
- Tap the Build number seven times to make Settings > Developer options available. You'll have to enter
- Then enable the USB Debugging option within Settings -> Developer options
Note: After you have completed this whole process and your phone is back to normal, I recommend you turn off USB debugging. Leaving it on is a security risk.
To delete the SMS database (which includes ALL text messages stored on the device), I used the following adb command:
adb shell pm clear com.android.providers.telephony
I received a terse response from adb: "Success". I then tapped the OK button on that process-has-stopped dialog, and it didn't come back! I opened the Messages app, and it didn't crash!
Problem solved. The content of the Text of Death remains a mystery, but I once again have a usable backup phone. Yay!
If you found this helpful, you'd like to thank me, and you enjoy reading -- or know someone who does -- buy one of my books!