Set EDITED column to USER_EDITED when editing APN

TelephonyProvider switched from defaulting EDITED to USER_EDITED and now
defaults to CARRIER_EDITED in https://android-review.googlesource.com/c/platform/packages/providers/TelephonyProvider/+/570244.
Therefore, when the user edits the APN, we can no longer rely on the
default implementation

Bug: 67750905
Test: None
Change-Id: I4996b24da94f7c1883c3c802b8edd5e23db580b2
This commit is contained in:
goneil
2017-12-11 16:25:16 -08:00
committed by Gil O'Neil
parent d46153c3d3
commit a05db0fac9

View File

@@ -249,7 +249,9 @@ public class ApnEditor extends SettingsPreferenceFragment
finish(); finish();
return; return;
} }
mUri = getContentResolver().insert(uri, new ContentValues()); ContentValues contentValues = new ContentValues();
contentValues.put(Telephony.Carriers.EDITED, Telephony.Carriers.USER_EDITED);
mUri = getContentResolver().insert(uri, contentValues);
} else { } else {
mUri = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, mUri = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI,
icicle.getInt(SAVED_POS)); icicle.getInt(SAVED_POS));
@@ -464,7 +466,9 @@ public class ApnEditor extends SettingsPreferenceFragment
if (mUri == null && mNewApn) { if (mUri == null && mNewApn) {
// The URI could have been deleted when activity is paused, // The URI could have been deleted when activity is paused,
// therefore, it needs to be restored. // therefore, it needs to be restored.
mUri = getContentResolver().insert(getIntent().getData(), new ContentValues()); ContentValues contentValues = new ContentValues();
contentValues.put(Telephony.Carriers.EDITED, Telephony.Carriers.USER_EDITED);
mUri = getContentResolver().insert(getIntent().getData(), contentValues);
if (mUri == null) { if (mUri == null) {
Log.w(TAG, "Failed to insert new telephony provider into " Log.w(TAG, "Failed to insert new telephony provider into "
+ getIntent().getData()); + getIntent().getData());
@@ -1044,6 +1048,8 @@ public class ApnEditor extends SettingsPreferenceFragment
callUpdate, callUpdate,
CARRIER_ENABLED_INDEX); CARRIER_ENABLED_INDEX);
values.put(Telephony.Carriers.EDITED, Telephony.Carriers.USER_EDITED);
if (callUpdate) { if (callUpdate) {
getContentResolver().update(mUri, values, null, null); getContentResolver().update(mUri, values, null, null);
} else { } else {