Clear calling entity before deleting SMS from raw table.
Deletion needs permissions of the phone process.

BUG: 18672706
Change-Id: If70b69745f5b09c644720ba019b409a82efb8033
diff --git a/src/java/com/android/internal/telephony/InboundSmsHandler.java b/src/java/com/android/internal/telephony/InboundSmsHandler.java
index 670ee86..d5b1e5a 100644
--- a/src/java/com/android/internal/telephony/InboundSmsHandler.java
+++ b/src/java/com/android/internal/telephony/InboundSmsHandler.java
@@ -1119,9 +1119,14 @@
                         mSmsFilter.mDestPort, mSmsFilter.mSmsBroadcastReceiver);
             } else {
                 // Drop this SMS.
-                log("SMS filtered");
-                deleteFromRawTable(mSmsFilter.mSmsBroadcastReceiver.mDeleteWhere,
-                        mSmsFilter.mSmsBroadcastReceiver.mDeleteWhereArgs);
+                final long token = Binder.clearCallingIdentity();
+                try {
+                    // Needs phone package permissions.
+                    deleteFromRawTable(mSmsFilter.mSmsBroadcastReceiver.mDeleteWhere,
+                            mSmsFilter.mSmsBroadcastReceiver.mDeleteWhereArgs);
+                } finally {
+                    Binder.restoreCallingIdentity(token);
+                }
                 sendMessage(EVENT_BROADCAST_COMPLETE);
             }
         }