summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdnan Begovic <adnan@cyngn.com>2015-05-04 10:36:24 -0700
committerAdnan Begovic <adnan@cyngn.com>2015-05-04 10:42:56 -0700
commitd8f349b5b533a79473851ebd35591f6f4f3f9e3f (patch)
tree2675fd91bffe8fdb7fdd791df5bcc8d2dce11d42
parent553933c7399ef8a06cf9035b1781926bcf566cf5 (diff)
downloadandroid_packages_providers_TelephonyProvider-d8f349b5b533a79473851ebd35591f6f4f3f9e3f.tar.gz
android_packages_providers_TelephonyProvider-d8f349b5b533a79473851ebd35591f6f4f3f9e3f.tar.bz2
android_packages_providers_TelephonyProvider-d8f349b5b533a79473851ebd35591f6f4f3f9e3f.zip
TelephonyProvider: Handle upgrade from 11 -> 12.1.
Change-Id: I0fd2ab10c1ce1ce3db8e12c63b16b35010d0af2d
-rw-r--r--src/com/android/providers/telephony/TelephonyProvider.java42
1 files changed, 32 insertions, 10 deletions
diff --git a/src/com/android/providers/telephony/TelephonyProvider.java b/src/com/android/providers/telephony/TelephonyProvider.java
index bc5baf9..d9a6f1d 100644
--- a/src/com/android/providers/telephony/TelephonyProvider.java
+++ b/src/com/android/providers/telephony/TelephonyProvider.java
@@ -377,16 +377,7 @@ public class TelephonyProvider extends ContentProvider
oldVersion = 9 << 16 | 6;
}
if (oldVersion < (10 << 16 | 6)) {
- db.execSQL("ALTER TABLE " + CARRIERS_TABLE +
- " ADD COLUMN profile_id INTEGER DEFAULT 0;");
- db.execSQL("ALTER TABLE " + CARRIERS_TABLE +
- " ADD COLUMN modem_cognitive BOOLEAN DEFAULT 0;");
- db.execSQL("ALTER TABLE " + CARRIERS_TABLE +
- " ADD COLUMN max_conns INTEGER DEFAULT 0;");
- db.execSQL("ALTER TABLE " + CARRIERS_TABLE +
- " ADD COLUMN wait_time INTEGER DEFAULT 0;");
- db.execSQL("ALTER TABLE " + CARRIERS_TABLE +
- " ADD COLUMN max_conns_time INTEGER DEFAULT 0;");
+ upgradeForProfileIdIfNecessary(db);
oldVersion = 10 << 16 | 6;
}
if (oldVersion < (11 << 16 | 6)) {
@@ -428,6 +419,23 @@ public class TelephonyProvider extends ContentProvider
}
if (oldVersion < (17 << 16 | 6)) {
try {
+ upgradeForProfileIdIfNecessary(db);
+ } catch (SQLiteException e) {
+ if (DBG) {
+ log("onUpgrade " + CARRIERS_TABLE + ": profile_id already present.");
+ }
+ }
+
+ try {
+ db.execSQL("ALTER TABLE " + CARRIERS_TABLE +
+ " ADD COLUMN mtu INTEGER DEFAULT 0;");
+ } catch (SQLiteException e) {
+ if (DBG) {
+ log("onUpgrade " + CARRIERS_TABLE + ": mtu already present.");
+ }
+ }
+
+ try {
// Try to update the siminfo table. It might not be there.
db.execSQL("ALTER TABLE " + SIMINFO_TABLE +
" ADD COLUMN " + SubscriptionManager.CARRIER_NAME + " TEXT DEFAULT '';");
@@ -437,6 +445,7 @@ public class TelephonyProvider extends ContentProvider
" The table will get created in onOpen.");
}
}
+
try {
// read_only was present in CM11, but not in CM12. Add it if it's missing.
db.execSQL("ALTER TABLE " + CARRIERS_TABLE +
@@ -1247,6 +1256,19 @@ public class TelephonyProvider extends ContentProvider
return count;
}
+ private static void upgradeForProfileIdIfNecessary(SQLiteDatabase db) {
+ db.execSQL("ALTER TABLE " + CARRIERS_TABLE +
+ " ADD COLUMN profile_id INTEGER DEFAULT 0;");
+ db.execSQL("ALTER TABLE " + CARRIERS_TABLE +
+ " ADD COLUMN modem_cognitive BOOLEAN DEFAULT 0;");
+ db.execSQL("ALTER TABLE " + CARRIERS_TABLE +
+ " ADD COLUMN max_conns INTEGER DEFAULT 0;");
+ db.execSQL("ALTER TABLE " + CARRIERS_TABLE +
+ " ADD COLUMN wait_time INTEGER DEFAULT 0;");
+ db.execSQL("ALTER TABLE " + CARRIERS_TABLE +
+ " ADD COLUMN max_conns_time INTEGER DEFAULT 0;");
+ }
+
private void checkPermission() {
int status = getContext().checkCallingOrSelfPermission(
"android.permission.WRITE_APN_SETTINGS");