Merge tag 'android-8.1.0_r20' of https://android.googlesource.com/platform//packages/providers/TelephonyProvider into HEAD

Android 8.1.0 release 20
diff --git a/src/com/android/providers/telephony/TelephonyProvider.java b/src/com/android/providers/telephony/TelephonyProvider.java
index daa8c84..b785f1f 100644
--- a/src/com/android/providers/telephony/TelephonyProvider.java
+++ b/src/com/android/providers/telephony/TelephonyProvider.java
@@ -1504,6 +1504,19 @@
             }
 
             if (!onUpgrade) {
+                // Do not overwrite a carrier or user edit with EDITED=UNEDITED
+                if (newRow.containsKey(EDITED)) {
+                    int oldEdited = oldRow.getInt(oldRow.getColumnIndex(EDITED));
+                    int newEdited = newRow.getAsInteger(EDITED);
+                    if (newEdited == UNEDITED && (oldEdited == CARRIER_EDITED
+                                || oldEdited == CARRIER_DELETED
+                                || oldEdited == CARRIER_DELETED_BUT_PRESENT_IN_XML
+                                || oldEdited == USER_EDITED
+                                || oldEdited == USER_DELETED
+                                || oldEdited == USER_DELETED_BUT_PRESENT_IN_XML)) {
+                        newRow.remove(EDITED);
+                    }
+                }
                 mergedValues.putAll(newRow);
             }