am dd5e16cc: am c72280d2: am 49e29575: am 21cf95e7: Don\'t allow clients to update or insert _data column data
* commit 'dd5e16ccb3a6226ac4b6b34d98d97683bb543314':
Don't allow clients to update or insert _data column data
diff --git a/src/com/android/providers/telephony/TelephonyProvider.java b/src/com/android/providers/telephony/TelephonyProvider.java
old mode 100755
new mode 100644
index 7ec2aed..f9b1e58
--- a/src/com/android/providers/telephony/TelephonyProvider.java
+++ b/src/com/android/providers/telephony/TelephonyProvider.java
@@ -26,6 +26,7 @@
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.database.Cursor;
+import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
@@ -167,7 +168,7 @@
parser.close();
}
- // Read external APNS data (partner-provided)
+ // Read external APNS data (partner-provided)
XmlPullParser confparser = null;
// Environment.getRootDirectory() is a fancy way of saying ANDROID_ROOT or "/system".
File confFile = new File(Environment.getRootDirectory(), PARTNER_APNS_PATH);
@@ -225,7 +226,7 @@
oldVersion = 6 << 16 | 6;
}
if (oldVersion < (7 << 16 | 6)) {
- // Add protcol fields to the APN. The XML file does not change.
+ // Add carrier_enabled, bearer fields to the APN. The XML file does not change.
db.execSQL("ALTER TABLE " + CARRIERS_TABLE +
" ADD COLUMN carrier_enabled BOOLEAN DEFAULT 1;");
db.execSQL("ALTER TABLE " + CARRIERS_TABLE +
@@ -320,6 +321,7 @@
private void loadApns(SQLiteDatabase db, XmlPullParser parser) {
if (parser != null) {
try {
+ db.beginTransaction();
while (true) {
XmlUtils.nextElement(parser);
ContentValues row = getRow(parser);
@@ -329,10 +331,15 @@
break; // do we really want to skip the rest of the file?
}
}
+ db.setTransactionSuccessful();
} catch (XmlPullParserException e) {
- Log.e(TAG, "Got execption while getting perferred time zone.", e);
+ Log.e(TAG, "Got execption while loading apns.", e);
} catch (IOException e) {
- Log.e(TAG, "Got execption while getting perferred time zone.", e);
+ Log.e(TAG, "Got IOExecption while loading apns.", e);
+ } catch (SQLException e){
+ Log.e(TAG, "Got SQLException while loading apns.", e);
+ } finally {
+ db.endTransaction();
}
}
}
@@ -463,8 +470,14 @@
}
SQLiteDatabase db = mOpenHelper.getReadableDatabase();
- Cursor ret = qb.query(db, projectionIn, selection, selectionArgs, null, null, sort);
- ret.setNotificationUri(getContext().getContentResolver(), url);
+ Cursor ret = null;
+ try {
+ ret = qb.query(db, projectionIn, selection, selectionArgs, null, null, sort);
+ } catch (SQLException e) {
+ Log.e(TAG, "got exception when querying: " + e);
+ }
+ if (ret != null)
+ ret.setNotificationUri(getContext().getContentResolver(), url);
return ret;
}
@@ -729,7 +742,11 @@
private void restoreDefaultAPN() {
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
- db.delete(CARRIERS_TABLE, null, null);
+ try {
+ db.delete(CARRIERS_TABLE, null, null);
+ } catch (SQLException e) {
+ Log.e(TAG, "got exception when deleting to restore: " + e);
+ }
setPreferredApnId((long)-1);
mOpenHelper.initDatabase(db);
}