diff options
author | Jim Miller <jaggies@google.com> | 2010-02-12 14:56:49 -0800 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2010-02-12 14:56:49 -0800 |
commit | 6176677e01964cb5751ff217c091571ce6a8b5fb (patch) | |
tree | 4b7336ce8dd28b36516e42196509723a41c164ea /packages | |
parent | ba7ec917ea91364598de1ba7a29910cec08fd5de (diff) | |
download | frameworks_base-6176677e01964cb5751ff217c091571ce6a8b5fb.zip frameworks_base-6176677e01964cb5751ff217c091571ce6a8b5fb.tar.gz frameworks_base-6176677e01964cb5751ff217c091571ce6a8b5fb.tar.bz2 |
Watch 2274882: Add a field to the db when we wipe due to an error in the upgrader.
This should give us the ability to diagnose and fix db upgrade errors as reported by partners and end users.
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index b26607f..57503f7 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -600,7 +600,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { upgradeVersion = 47; } - + if (upgradeVersion == 47) { /* * The password mode constants have changed again; reset back to no @@ -615,7 +615,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { } upgradeVersion = 48; } - + if (upgradeVersion == 48) { /* * Adding a new setting for which voice recognition service to use. @@ -648,6 +648,11 @@ public class DatabaseHelper extends SQLiteOpenHelper { db.execSQL("DROP INDEX IF EXISTS bookmarksIndex2"); db.execSQL("DROP TABLE IF EXISTS favorites"); onCreate(db); + + // Added for diagnosing settings.db wipes after the fact + String wipeReason = oldVersion + "/" + upgradeVersion + "/" + currentVersion; + db.execSQL("INSERT INTO secure(name,value) values('" + + "wiped_db_reason" + "','" + wipeReason + "');"); } } @@ -976,7 +981,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { loadBooleanSetting(stmt, Settings.Secure.MOUNT_UMS_NOTIFY_ENABLED, R.bool.def_mount_ums_notify_enabled); - + loadVoiceRecognitionServiceSetting(stmt); stmt.close(); @@ -989,7 +994,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { loadStringSetting(stmt, Settings.Secure.BACKUP_TRANSPORT, R.string.def_backup_transport); } - + /** * Introduced in database version 49. */ @@ -999,19 +1004,19 @@ public class DatabaseHelper extends SQLiteOpenHelper { mContext.getPackageManager().queryIntentServices( new Intent(RecognitionService.SERVICE_INTERFACE), 0); int numAvailable = availableRecognitionServices.size(); - + if (numAvailable == 0) { Log.w(TAG, "no available voice recognition services found"); } else { if (numAvailable > 1) { Log.w(TAG, "more than one voice recognition service found, picking first"); } - + ServiceInfo serviceInfo = availableRecognitionServices.get(0).serviceInfo; selectedService = new ComponentName(serviceInfo.packageName, serviceInfo.name).flattenToString(); } - + loadSetting(stmt, Settings.Secure.VOICE_RECOGNITION_SERVICE, selectedService == null ? "" : selectedService); } |