Merge cherrypicks of [3463668, 3464926, 3464927, 3464663, 3464895, 3464928, 3464896, 3464664, 3464665, 3464666, 3464492, 3464456, 3464929, 3465492, 3465473] into oc-m2-release
Change-Id: I83ac436097727c32f94643f3959694711083b38a
diff --git a/src/com/android/providers/telephony/TelephonyProvider.java b/src/com/android/providers/telephony/TelephonyProvider.java
index 49c3d10..e94493b 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);
}