public abstract class AbstractAPNSetting { public static final String APN_ID = "apn_id"; public static String APN_TABLE_URI = "content://telephony/carriers"; protected static final Uri APN_URI = Uri.parse(APN_TABLE_URI); protected static final Uri PREFERAPN_URI = Uri.parse("content://telephony/carriers/preferapn"); public static final String PREFERRED_APN_URI = "content://telephony/carriers/preferapn";
public int delAPN(Context paramContext, String paramString) { paramContext.getContentResolver().delete(APN_URI, "_id<>?", new String[] { paramString }); return 1; }
protected ContentValues getApn(Context paramContext, String paramString1, String paramString2, String paramString3) { Cursor localCursor = paramContext.getContentResolver().query(APN_URI, null, "(apn=? or name=?) and mcc=? and mnc=?", new String[] { paramString1, paramString1, paramString2, paramString3 }, null); localCursor.moveToFirst(); String[] arrayOfString = localCursor.getColumnNames(); boolean bool = localCursor.isAfterLast(); ContentValues localContentValues = null; if (!bool) { localContentValues = new ContentValues(); int i = arrayOfString.length; int j = 0; int m; for (int k = 0; j < i; k = m) { String str1 = arrayOfString[j]; m = k + 1; String str2 = localCursor.getString(k); localContentValues.put(str1, str2); Log.i("net_state", str1 + ":" + str2); j++; } localCursor.moveToNext(); } localCursor.close(); return localContentValues; }
protected ContentValues getApn(Context paramContext, String paramString1, String paramString2, String paramString3, String paramString4) { Cursor localCursor = paramContext.getContentResolver().query(APN_URI, null, "apn=? and user=? and mcc=? and mnc=?", new String[] { paramString1, paramString2, paramString3, paramString4 }, null); localCursor.moveToFirst(); ContentValues localContentValues = null; String[] arrayOfString = localCursor.getColumnNames(); while (!localCursor.isAfterLast()) { localContentValues = new ContentValues(); int i = arrayOfString.length; int j = 0; int m; for (int k = 0; j < i; k = m) { String str1 = arrayOfString[j]; m = k + 1; String str2 = localCursor.getString(k); localContentValues.put(str1, str2); Log.i("net_state", str1 + ":" + str2); j++; } localCursor.moveToNext(); } localCursor.close(); return localContentValues; }
public String getCurrentAPN(Context paramContext) { Cursor localCursor = paramContext.getContentResolver().query(PREFERAPN_URI, new String[] { "_id" }, null, null, null); if (localCursor != null) { if (localCursor.moveToFirst()) return localCursor.getString(localCursor.getColumnIndex("_id")); localCursor.close(); } return ""; }
public abstract void insertApn();
public void setSelectedApnKey(Context paramContext, String paramString) { if (getCurrentAPN(paramContext).equals(paramString)) return; ContentResolver localContentResolver = paramContext.getContentResolver(); ContentValues localContentValues = new ContentValues(); localContentValues.put("apn_id", paramString); localContentResolver.update(PREFERAPN_URI, localContentValues, null, null); } }