Move SMS raw db deletion to phone process.
Test: manual
Bug: 127929687
Change-Id: Ie6fac7799846fb0b0d88b914760d159796e21fcc
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 1f01822..bb6c8ff 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -24,6 +24,7 @@
import android.app.AppOpsManager;
import android.app.PendingIntent;
import android.content.ComponentName;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -53,6 +54,7 @@
import android.os.WorkSource;
import android.preference.PreferenceManager;
import android.provider.Settings;
+import android.provider.Telephony;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
@@ -5178,11 +5180,22 @@
setDataRoamingEnabled(subId, getDefaultDataRoamingEnabled(subId));
CarrierInfoManager.deleteAllCarrierKeysForImsiEncryption(mApp);
}
+ // There has been issues when Sms raw table somehow stores orphan
+ // fragments. They lead to garbled message when new fragments come
+ // in and combined with those stale ones. In case this happens again,
+ // user can reset all network settings which will clean up this table.
+ cleanUpSmsRawTable(getDefaultPhone().getContext());
} finally {
Binder.restoreCallingIdentity(identity);
}
}
+ private void cleanUpSmsRawTable(Context context) {
+ ContentResolver resolver = context.getContentResolver();
+ Uri uri = Uri.withAppendedPath(Telephony.Sms.CONTENT_URI, "raw/permanentDelete");
+ resolver.delete(uri, null, null);
+ }
+
@Override
public String getSimLocaleForSubscriber(int subId) {
enforceReadPrivilegedPermission("getSimLocaleForSubscriber, subId: " + subId);