API review: rename CarrierIdentification to CarrierId
Bug: 73953797
Test: unit test
Change-Id: I53996836939cae9a697c9a216aba549a0c1b209c
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index e57b3b4..7419bf7 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -106,7 +106,7 @@
android:writePermission="android.permission.MODIFY_PHONE_STATE" />
<provider android:name="CarrierIdProvider"
- android:authorities="carrier_identification"
+ android:authorities="carrier_id"
android:exported="true"
android:singleUser="true"
android:multiprocess="false" />
diff --git a/src/com/android/providers/telephony/CarrierIdProvider.java b/src/com/android/providers/telephony/CarrierIdProvider.java
index cbad428..1c2e5e5 100644
--- a/src/com/android/providers/telephony/CarrierIdProvider.java
+++ b/src/com/android/providers/telephony/CarrierIdProvider.java
@@ -30,7 +30,7 @@
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.os.Environment;
-import android.provider.Telephony.CarrierIdentification;
+import android.provider.Telephony.CarrierId;
import android.telephony.SubscriptionManager;
import android.text.TextUtils;
import android.util.Log;
@@ -88,35 +88,35 @@
private static final int URL_ALL_GET_VERSION = 3;
/**
- * index 0: {@link CarrierIdentification.All#MCCMNC}
+ * index 0: {@link CarrierId.All#MCCMNC}
*/
private static final int MCCMNC_INDEX = 0;
/**
- * index 1: {@link CarrierIdentification.All#IMSI_PREFIX_XPATTERN}
+ * index 1: {@link CarrierId.All#IMSI_PREFIX_XPATTERN}
*/
private static final int IMSI_PREFIX_INDEX = 1;
/**
- * index 2: {@link CarrierIdentification.All#GID1}
+ * index 2: {@link CarrierId.All#GID1}
*/
private static final int GID1_INDEX = 2;
/**
- * index 3: {@link CarrierIdentification.All#GID2}
+ * index 3: {@link CarrierId.All#GID2}
*/
private static final int GID2_INDEX = 3;
/**
- * index 4: {@link CarrierIdentification.All#PLMN}
+ * index 4: {@link CarrierId.All#PLMN}
*/
private static final int PLMN_INDEX = 4;
/**
- * index 5: {@link CarrierIdentification.All#SPN}
+ * index 5: {@link CarrierId.All#SPN}
*/
private static final int SPN_INDEX = 5;
/**
- * index 6: {@link CarrierIdentification.All#APN}
+ * index 6: {@link CarrierId.All#APN}
*/
private static final int APN_INDEX = 6;
/**
- * index 7: {@link CarrierIdentification.All#ICCID_PREFIX}
+ * index 7: {@link CarrierId.All#ICCID_PREFIX}
*/
private static final int ICCID_PREFIX_INDEX = 7;
/**
@@ -127,19 +127,19 @@
* The authority string for the CarrierIdProvider
*/
@VisibleForTesting
- public static final String AUTHORITY = "carrier_identification";
+ public static final String AUTHORITY = "carrier_id";
public static final String CARRIER_ID_TABLE = "carrier_id";
private static final List<String> CARRIERS_ID_UNIQUE_FIELDS = new ArrayList<>(Arrays.asList(
- CarrierIdentification.All.MCCMNC,
- CarrierIdentification.All.GID1,
- CarrierIdentification.All.GID2,
- CarrierIdentification.All.PLMN,
- CarrierIdentification.All.IMSI_PREFIX_XPATTERN,
- CarrierIdentification.All.SPN,
- CarrierIdentification.All.APN,
- CarrierIdentification.All.ICCID_PREFIX));
+ CarrierId.All.MCCMNC,
+ CarrierId.All.GID1,
+ CarrierId.All.GID2,
+ CarrierId.All.PLMN,
+ CarrierId.All.IMSI_PREFIX_XPATTERN,
+ CarrierId.All.SPN,
+ CarrierId.All.APN,
+ CarrierId.All.ICCID_PREFIX));
private CarrierIdDatabaseHelper mDbHelper;
@@ -154,23 +154,23 @@
public static String getStringForCarrierIdTableCreation(String tableName) {
return "CREATE TABLE " + tableName
+ "(_id INTEGER PRIMARY KEY,"
- + CarrierIdentification.All.MCCMNC + " TEXT NOT NULL,"
- + CarrierIdentification.All.GID1 + " TEXT,"
- + CarrierIdentification.All.GID2 + " TEXT,"
- + CarrierIdentification.All.PLMN + " TEXT,"
- + CarrierIdentification.All.IMSI_PREFIX_XPATTERN + " TEXT,"
- + CarrierIdentification.All.SPN + " TEXT,"
- + CarrierIdentification.All.APN + " TEXT,"
- + CarrierIdentification.All.ICCID_PREFIX + " TEXT,"
- + CarrierIdentification.NAME + " TEXT,"
- + CarrierIdentification.CID + " INTEGER DEFAULT -1,"
+ + CarrierId.All.MCCMNC + " TEXT NOT NULL,"
+ + CarrierId.All.GID1 + " TEXT,"
+ + CarrierId.All.GID2 + " TEXT,"
+ + CarrierId.All.PLMN + " TEXT,"
+ + CarrierId.All.IMSI_PREFIX_XPATTERN + " TEXT,"
+ + CarrierId.All.SPN + " TEXT,"
+ + CarrierId.All.APN + " TEXT,"
+ + CarrierId.All.ICCID_PREFIX + " TEXT,"
+ + CarrierId.CARRIER_NAME + " TEXT,"
+ + CarrierId.CARRIER_ID + " INTEGER DEFAULT -1,"
+ "UNIQUE (" + TextUtils.join(", ", CARRIERS_ID_UNIQUE_FIELDS) + "));";
}
@VisibleForTesting
public static String getStringForIndexCreation(String tableName) {
return "CREATE INDEX IF NOT EXISTS mccmncIndex ON " + tableName + " ("
- + CarrierIdentification.All.MCCMNC + ");";
+ + CarrierId.All.MCCMNC + ");";
}
@Override
@@ -231,9 +231,9 @@
values);
if (row > 0) {
final Uri newUri = ContentUris.withAppendedId(
- CarrierIdentification.All.CONTENT_URI, row);
+ CarrierId.All.CONTENT_URI, row);
getContext().getContentResolver().notifyChange(
- CarrierIdentification.All.CONTENT_URI, null);
+ CarrierId.All.CONTENT_URI, null);
return newUri;
}
return null;
@@ -260,7 +260,7 @@
Log.d(TAG, " delete.count=" + count);
if (count > 0) {
getContext().getContentResolver().notifyChange(
- CarrierIdentification.All.CONTENT_URI, null);
+ CarrierId.All.CONTENT_URI, null);
}
return count;
default:
@@ -288,8 +288,7 @@
selectionArgs);
Log.d(TAG, " update.count=" + count);
if (count > 0) {
- getContext().getContentResolver().notifyChange(
- CarrierIdentification.All.CONTENT_URI, null);
+ getContext().getContentResolver().notifyChange(CarrierId.All.CONTENT_URI, null);
}
return count;
default:
@@ -367,8 +366,8 @@
for (CarrierIdProto.CarrierId id : carrierList.carrierId) {
for (CarrierIdProto.CarrierAttribute attr : id.carrierAttribute) {
cv = new ContentValues();
- cv.put(CarrierIdentification.CID, id.canonicalId);
- cv.put(CarrierIdentification.NAME, id.carrierName);
+ cv.put(CarrierId.CARRIER_ID, id.canonicalId);
+ cv.put(CarrierId.CARRIER_NAME, id.carrierName);
cvs = new ArrayList<>();
convertCarrierAttrToContentValues(cv, cvs, attr, 0);
for (ContentValues contentVal : cvs) {
@@ -388,8 +387,7 @@
Log.d(TAG, "update database from pb. inserted rows = " + rows);
if (rows > 0) {
// Notify listener of DB change
- getContext().getContentResolver().notifyChange(
- CarrierIdentification.All.CONTENT_URI, null);
+ getContext().getContentResolver().notifyChange(CarrierId.All.CONTENT_URI, null);
}
setAppliedVersion(carrierList.version);
db.setTransactionSuccessful();
@@ -412,65 +410,65 @@
switch (index) {
case MCCMNC_INDEX:
for (String str : attr.mccmncTuple) {
- cv.put(CarrierIdentification.All.MCCMNC, str);
+ cv.put(CarrierId.All.MCCMNC, str);
convertCarrierAttrToContentValues(cv, cvs, attr, index + 1);
- cv.remove(CarrierIdentification.All.MCCMNC);
+ cv.remove(CarrierId.All.MCCMNC);
found = true;
}
break;
case IMSI_PREFIX_INDEX:
for (String str : attr.imsiPrefixXpattern) {
- cv.put(CarrierIdentification.All.IMSI_PREFIX_XPATTERN, str);
+ cv.put(CarrierId.All.IMSI_PREFIX_XPATTERN, str);
convertCarrierAttrToContentValues(cv, cvs, attr, index + 1);
- cv.remove(CarrierIdentification.All.IMSI_PREFIX_XPATTERN);
+ cv.remove(CarrierId.All.IMSI_PREFIX_XPATTERN);
found = true;
}
break;
case GID1_INDEX:
for (String str : attr.gid1) {
- cv.put(CarrierIdentification.All.GID1, str);
+ cv.put(CarrierId.All.GID1, str);
convertCarrierAttrToContentValues(cv, cvs, attr, index + 1);
- cv.remove(CarrierIdentification.All.GID1);
+ cv.remove(CarrierId.All.GID1);
found = true;
}
break;
case GID2_INDEX:
for (String str : attr.gid2) {
- cv.put(CarrierIdentification.All.GID2, str);
+ cv.put(CarrierId.All.GID2, str);
convertCarrierAttrToContentValues(cv, cvs, attr, index + 1);
- cv.remove(CarrierIdentification.All.GID2);
+ cv.remove(CarrierId.All.GID2);
found = true;
}
break;
case PLMN_INDEX:
for (String str : attr.plmn) {
- cv.put(CarrierIdentification.All.PLMN, str);
+ cv.put(CarrierId.All.PLMN, str);
convertCarrierAttrToContentValues(cv, cvs, attr, index + 1);
- cv.remove(CarrierIdentification.All.PLMN);
+ cv.remove(CarrierId.All.PLMN);
found = true;
}
break;
case SPN_INDEX:
for (String str : attr.spn) {
- cv.put(CarrierIdentification.All.SPN, str);
+ cv.put(CarrierId.All.SPN, str);
convertCarrierAttrToContentValues(cv, cvs, attr, index + 1);
- cv.remove(CarrierIdentification.All.SPN);
+ cv.remove(CarrierId.All.SPN);
found = true;
}
break;
case APN_INDEX:
for (String str : attr.preferredApn) {
- cv.put(CarrierIdentification.All.APN, str);
+ cv.put(CarrierId.All.APN, str);
convertCarrierAttrToContentValues(cv, cvs, attr, index + 1);
- cv.remove(CarrierIdentification.All.APN);
+ cv.remove(CarrierId.All.APN);
found = true;
}
break;
case ICCID_PREFIX_INDEX:
for (String str : attr.iccidPrefix) {
- cv.put(CarrierIdentification.All.ICCID_PREFIX, str);
+ cv.put(CarrierId.All.ICCID_PREFIX, str);
convertCarrierAttrToContentValues(cv, cvs, attr, index + 1);
- cv.remove(CarrierIdentification.All.ICCID_PREFIX);
+ cv.remove(CarrierId.All.ICCID_PREFIX);
found = true;
}
break;
@@ -581,16 +579,15 @@
count++;
Log.d(TAG, "updateCarrierIdForSubId: " + subscription);
mCurrentSubscriptionMap.remove(subscription);
- getContext().getContentResolver().notifyChange(
- CarrierIdentification.CONTENT_URI, null);
+ getContext().getContentResolver().notifyChange(CarrierId.CONTENT_URI, null);
}
}
return count;
} else {
mCurrentSubscriptionMap.put(subId,
- new Pair(cv.getAsInteger(CarrierIdentification.CID),
- cv.getAsString(CarrierIdentification.NAME)));
- getContext().getContentResolver().notifyChange(CarrierIdentification.CONTENT_URI, null);
+ new Pair(cv.getAsInteger(CarrierId.CARRIER_ID),
+ cv.getAsString(CarrierId.CARRIER_NAME)));
+ getContext().getContentResolver().notifyChange(CarrierId.CONTENT_URI, null);
return 1;
}
}
@@ -620,9 +617,9 @@
final MatrixCursor.RowBuilder row = c.newRow();
for (int i = 0; i < c.getColumnCount(); i++) {
final String columnName = c.getColumnName(i);
- if (CarrierIdentification.CID.equals(columnName)) {
+ if (CarrierId.CARRIER_ID.equals(columnName)) {
row.add(mCurrentSubscriptionMap.get(subId).first);
- } else if (CarrierIdentification.NAME.equals(columnName)) {
+ } else if (CarrierId.CARRIER_NAME.equals(columnName)) {
row.add(mCurrentSubscriptionMap.get(subId).second);
} else {
throw new IllegalArgumentException("Invalid column " + projectionIn[i]);
@@ -637,7 +634,7 @@
if (status == PackageManager.PERMISSION_GRANTED) {
return;
}
- throw new SecurityException("No permission to read Carrier Identification provider");
+ throw new SecurityException("No permission to read CarrierId provider");
}
private void checkWritePermission() {
@@ -646,6 +643,6 @@
if (status == PackageManager.PERMISSION_GRANTED) {
return;
}
- throw new SecurityException("No permission to write Carrier Identification provider");
+ throw new SecurityException("No permission to write CarrierId provider");
}
}
diff --git a/tests/src/com/android/providers/telephony/CarrierIdProviderTest.java b/tests/src/com/android/providers/telephony/CarrierIdProviderTest.java
index 8c3cec5..4adcf43 100644
--- a/tests/src/com/android/providers/telephony/CarrierIdProviderTest.java
+++ b/tests/src/com/android/providers/telephony/CarrierIdProviderTest.java
@@ -18,7 +18,6 @@
import android.content.ContentValues;
import android.content.SharedPreferences;
-import android.content.UriMatcher;
import android.content.pm.PackageManager;
import android.content.pm.ProviderInfo;
import android.database.ContentObserver;
@@ -26,8 +25,7 @@
import android.database.SQLException;
import android.net.Uri;
import android.os.Handler;
-import android.provider.Telephony;
-import android.provider.Telephony.CarrierIdentification;
+import android.provider.Telephony.CarrierId;
import android.test.mock.MockContentResolver;
import android.test.mock.MockContext;
import android.util.Log;
@@ -38,7 +36,6 @@
import org.junit.Assert;
import org.junit.Test;
-import org.mockito.Mock;
import java.lang.reflect.Field;
@@ -170,9 +167,8 @@
@Test
public void testInsertCarrierInfo() {
try {
- mContentResolver.insert(CarrierIdentification.All.CONTENT_URI,
- createCarrierInfoInternal());
- Cursor countCursor = mContentResolver.query(CarrierIdentification.All.CONTENT_URI,
+ mContentResolver.insert(CarrierId.All.CONTENT_URI, createCarrierInfoInternal());
+ Cursor countCursor = mContentResolver.query(CarrierId.All.CONTENT_URI,
new String[]{"count(*) AS count"},
null,
null,
@@ -193,8 +189,8 @@
try {
//insert same row twice to break uniqueness constraint
ContentValues contentValues = createCarrierInfoInternal();
- mContentResolver.insert(CarrierIdentification.All.CONTENT_URI, contentValues);
- mContentResolver.insert(CarrierIdentification.All.CONTENT_URI, contentValues);
+ mContentResolver.insert(CarrierId.All.CONTENT_URI, contentValues);
+ mContentResolver.insert(CarrierId.All.CONTENT_URI, contentValues);
Assert.fail("should throw an exception for duplicate carrier info");
} catch (Exception e) {
Log.d(TAG, "Error inserting carrier info:" + e);
@@ -209,8 +205,8 @@
try {
//insert a row with null mnccmnc to break not null constraint
ContentValues contentValues = new ContentValues();
- contentValues.put(CarrierIdentification.All.GID1, dummy_gid1);
- mContentResolver.insert(CarrierIdentification.All.CONTENT_URI, contentValues);
+ contentValues.put(CarrierId.All.GID1, dummy_gid1);
+ mContentResolver.insert(CarrierId.All.CONTENT_URI, contentValues);
Assert.fail("should throw an exception for null mccmnc");
} catch (SQLException e) {
Log.d(TAG, "Error inserting carrier info:" + e);
@@ -224,16 +220,16 @@
@Test
public void testDeleteCarrierInfo() {
try {
- mContentResolver.insert(CarrierIdentification.All.CONTENT_URI,
+ mContentResolver.insert(CarrierId.All.CONTENT_URI,
createCarrierInfoInternal());
} catch (Exception e) {
Log.d(TAG, "Error inserting carrier info:" + e);
}
int numRowsDeleted = -1;
try {
- String whereClause = CarrierIdentification.All.MCCMNC + "=?";
+ String whereClause = CarrierId.All.MCCMNC + "=?";
String[] whereArgs = new String[] { dummy_mccmnc };
- numRowsDeleted = mContentResolver.delete(CarrierIdentification.All.CONTENT_URI,
+ numRowsDeleted = mContentResolver.delete(CarrierId.All.CONTENT_URI,
whereClause, whereArgs);
} catch (Exception e) {
Log.d(TAG, "Error deleting values:" + e);
@@ -251,23 +247,23 @@
ContentValues contentValues = createCarrierInfoInternal();
try {
- mContentResolver.insert(CarrierIdentification.All.CONTENT_URI, contentValues);
+ mContentResolver.insert(CarrierId.All.CONTENT_URI, contentValues);
} catch (Exception e) {
Log.d(TAG, "Error inserting carrierInfo:" + e);
}
try {
- contentValues.put(CarrierIdentification.CID, 1);
- mContentResolver.update(CarrierIdentification.All.CONTENT_URI, contentValues,
- CarrierIdentification.All.MCCMNC + "=?", new String[] { dummy_mccmnc });
+ contentValues.put(CarrierId.CARRIER_ID, 1);
+ mContentResolver.update(CarrierId.All.CONTENT_URI, contentValues,
+ CarrierId.All.MCCMNC + "=?", new String[] { dummy_mccmnc });
} catch (Exception e) {
Log.d(TAG, "Error updating values:" + e);
}
try {
- Cursor findEntry = mContentResolver.query(CarrierIdentification.All.CONTENT_URI,
- new String[] { CarrierIdentification.CID },
- CarrierIdentification.All.MCCMNC + "=?", new String[] { dummy_mccmnc },
+ Cursor findEntry = mContentResolver.query(CarrierId.All.CONTENT_URI,
+ new String[] { CarrierId.CARRIER_ID},
+ CarrierId.All.MCCMNC + "=?", new String[] { dummy_mccmnc },
null);
findEntry.moveToFirst();
cid = findEntry.getInt(0);
@@ -284,21 +280,21 @@
try {
// insert a MVNO
- mContentResolver.insert(CarrierIdentification.All.CONTENT_URI, contentValues);
+ mContentResolver.insert(CarrierId.All.CONTENT_URI, contentValues);
// insert its MNO
contentValues = new ContentValues();
- contentValues.put(CarrierIdentification.All.MCCMNC, dummy_mccmnc);
- contentValues.put(CarrierIdentification.CID, 1);
- mContentResolver.insert(CarrierIdentification.All.CONTENT_URI, contentValues);
+ contentValues.put(CarrierId.All.MCCMNC, dummy_mccmnc);
+ contentValues.put(CarrierId.CARRIER_ID, 1);
+ mContentResolver.insert(CarrierId.All.CONTENT_URI, contentValues);
} catch (Exception e) {
Log.d(TAG, "Error inserting carrierInfo:" + e);
}
Cursor findEntry = null;
- String[] columns = {CarrierIdentification.CID, CarrierIdentification.All.ICCID_PREFIX};
+ String[] columns = {CarrierId.CARRIER_ID, CarrierId.All.ICCID_PREFIX};
try {
- findEntry = mContentResolver.query(CarrierIdentification.All.CONTENT_URI, columns,
- CarrierIdentification.All.MCCMNC + "=?", new String[] { dummy_mccmnc },
+ findEntry = mContentResolver.query(CarrierId.All.CONTENT_URI, columns,
+ CarrierId.All.MCCMNC + "=?", new String[] { dummy_mccmnc },
null);
} catch (Exception e) {
Log.d(TAG, "Query failed:" + e);
@@ -307,10 +303,10 @@
try {
// query based on mccmnc & gid1 & iccid_prefix
- findEntry = mContentResolver.query(CarrierIdentification.All.CONTENT_URI, columns,
- CarrierIdentification.All.MCCMNC + "=? and "
- + CarrierIdentification.All.GID1 + "=? and "
- + CarrierIdentification.All.ICCID_PREFIX + "=?",
+ findEntry = mContentResolver.query(CarrierId.All.CONTENT_URI, columns,
+ CarrierId.All.MCCMNC + "=? and "
+ + CarrierId.All.GID1 + "=? and "
+ + CarrierId.All.ICCID_PREFIX + "=?",
new String[] { dummy_mccmnc, dummy_gid1, dummy_iccid_prefix }, null);
} catch (Exception e) {
Log.d(TAG, "Query failed:" + e);
@@ -327,7 +323,7 @@
int version = 0;
try {
Cursor cursor = mContext.getContentResolver().query(
- Uri.withAppendedPath(Telephony.CarrierIdentification.All.CONTENT_URI,
+ Uri.withAppendedPath(CarrierId.All.CONTENT_URI,
"get_version"), null, null, null);
cursor.moveToFirst();
version = cursor.getInt(0);
@@ -342,12 +338,12 @@
// update carrier id for subId 1
try {
ContentValues cv = new ContentValues();
- cv.put(CarrierIdentification.CID, dummy_cid);
- cv.put(CarrierIdentification.NAME, dummy_name);
+ cv.put(CarrierId.CARRIER_ID, dummy_cid);
+ cv.put(CarrierId.CARRIER_NAME, dummy_name);
doReturn(1).when(mSubController).getDefaultSubId();
doReturn(true).when(mSubController).isActiveSubId(eq(1));
- mContext.getContentResolver().update(Uri.withAppendedPath(
- CarrierIdentification.CONTENT_URI, "1"), cv, null, null);
+ mContext.getContentResolver().update(Uri.withAppendedPath(CarrierId.CONTENT_URI,
+ "1"), cv, null, null);
} catch (Exception e) {
Log.d(TAG, "Error updating current subscription: " + e);
e.printStackTrace();
@@ -358,9 +354,8 @@
// query carrier id for subId 1
try {
final Cursor c = mContext.getContentResolver().query(
- Uri.withAppendedPath(CarrierIdentification.CONTENT_URI, "1"),
- new String[] {CarrierIdentification.CID,
- CarrierIdentification.NAME}, null, null);
+ Uri.withAppendedPath(CarrierId.CONTENT_URI, "1"),
+ new String[] {CarrierId.CARRIER_ID, CarrierId.CARRIER_NAME}, null, null);
c.moveToFirst();
carrierId = c.getInt(0);
carrierName = c.getString(1);
@@ -374,9 +369,8 @@
int count = -1;
try {
final Cursor c = mContext.getContentResolver().query(
- Uri.withAppendedPath(CarrierIdentification.CONTENT_URI, "2"),
- new String[]{CarrierIdentification.CID,
- CarrierIdentification.NAME}, null, null);
+ Uri.withAppendedPath(CarrierId.CONTENT_URI, "2"),
+ new String[]{CarrierId.CARRIER_ID, CarrierId.CARRIER_NAME}, null, null);
count = c.getCount();
} catch (Exception e) {
Log.d(TAG, "Error query current subscription: " + e);
@@ -385,9 +379,8 @@
// query without subId, expect return carrier id of the default subId
try {
- final Cursor c = mContext.getContentResolver().query(CarrierIdentification.CONTENT_URI,
- new String[]{CarrierIdentification.CID,
- CarrierIdentification.NAME}, null, null);
+ final Cursor c = mContext.getContentResolver().query(CarrierId.CONTENT_URI,
+ new String[]{CarrierId.CARRIER_ID, CarrierId.CARRIER_NAME}, null, null);
c.moveToFirst();
carrierId = c.getInt(0);
carrierName = c.getString(1);
@@ -400,9 +393,8 @@
@Test(expected = IllegalArgumentException.class)
public void testQueryCurrrentSubscription_wrongProjection() {
- mContext.getContentResolver().query(CarrierIdentification.CONTENT_URI,
- new String[]{CarrierIdentification.CID,
- CarrierIdentification.NAME, CarrierIdentification.All.MCCMNC},
+ mContext.getContentResolver().query(CarrierId.CONTENT_URI,
+ new String[]{CarrierId.CARRIER_ID, CarrierId.CARRIER_NAME, CarrierId.All.MCCMNC},
null, null);
}
@@ -410,8 +402,8 @@
public void testQueryWithWrongURI() {
try {
mContext.getContentResolver().query(Uri.withAppendedPath(
- CarrierIdentification.CONTENT_URI, "invalid"),
- new String[]{CarrierIdentification.CID, CarrierIdentification.NAME}, null, null);
+ CarrierId.CONTENT_URI, "invalid"),
+ new String[]{CarrierId.CARRIER_ID, CarrierId.CARRIER_NAME}, null, null);
Assert.fail("should throw an exception for wrong uri");
} catch (IllegalArgumentException ex) {
}
@@ -421,12 +413,12 @@
public void testUpdateCurrentSubscription_WrongURI() {
try {
ContentValues cv = new ContentValues();
- cv.put(CarrierIdentification.CID, dummy_cid);
- cv.put(CarrierIdentification.NAME, dummy_name);
+ cv.put(CarrierId.CARRIER_ID, dummy_cid);
+ cv.put(CarrierId.CARRIER_NAME, dummy_name);
doReturn(1).when(mSubController).getDefaultSubId();
doReturn(true).when(mSubController).isActiveSubId(eq(1));
- mContext.getContentResolver().update(CarrierIdentification.CONTENT_URI, cv, null, null);
+ mContext.getContentResolver().update(CarrierId.CONTENT_URI, cv, null, null);
Assert.fail("should throw an exception for wrong uri");
} catch (IllegalArgumentException ex) {
assertFalse(mContentObserver.changed);
@@ -435,16 +427,16 @@
private static ContentValues createCarrierInfoInternal() {
ContentValues contentValues = new ContentValues();
- contentValues.put(CarrierIdentification.All.MCCMNC, dummy_mccmnc);
- contentValues.put(CarrierIdentification.All.GID1, dummy_gid1);
- contentValues.put(CarrierIdentification.All.GID2, dummy_gid2);
- contentValues.put(CarrierIdentification.All.PLMN, dummy_plmn);
- contentValues.put(CarrierIdentification.All.IMSI_PREFIX_XPATTERN, dummy_imsi_prefix);
- contentValues.put(CarrierIdentification.All.SPN, dummy_spn);
- contentValues.put(CarrierIdentification.All.APN, dummy_apn);
- contentValues.put(CarrierIdentification.All.ICCID_PREFIX, dummy_iccid_prefix);
- contentValues.put(CarrierIdentification.NAME, dummy_name);
- contentValues.put(CarrierIdentification.CID, dummy_cid);
+ contentValues.put(CarrierId.All.MCCMNC, dummy_mccmnc);
+ contentValues.put(CarrierId.All.GID1, dummy_gid1);
+ contentValues.put(CarrierId.All.GID2, dummy_gid2);
+ contentValues.put(CarrierId.All.PLMN, dummy_plmn);
+ contentValues.put(CarrierId.All.IMSI_PREFIX_XPATTERN, dummy_imsi_prefix);
+ contentValues.put(CarrierId.All.SPN, dummy_spn);
+ contentValues.put(CarrierId.All.APN, dummy_apn);
+ contentValues.put(CarrierId.All.ICCID_PREFIX, dummy_iccid_prefix);
+ contentValues.put(CarrierId.CARRIER_NAME, dummy_name);
+ contentValues.put(CarrierId.CARRIER_ID, dummy_cid);
return contentValues;
}
}