OSDN Git Service

Fix settings db update sequence
authorChristopher Tate <ctate@google.com>
Wed, 22 Oct 2014 17:36:42 +0000 (10:36 -0700)
committerChristopher Tate <ctate@google.com>
Wed, 22 Oct 2014 17:36:42 +0000 (10:36 -0700)
The 'global' table only exists in the owner-user db instance; make
sure to apply global-setting update steps only when bringing up that
instance.

Bug 18069830

Change-Id: I843eabe710d9487de94690921d61adb181b45ed2

packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java

index 8c51caf..f88ea8b 100644 (file)
@@ -1829,16 +1829,18 @@ public class DatabaseHelper extends SQLiteOpenHelper {
         }
 
         if (upgradeVersion < 114) {
-            db.beginTransaction();
-            SQLiteStatement stmt = null;
-            try {
-                stmt = db.compileStatement("INSERT OR IGNORE INTO global(name,value)"
-                        + " VALUES(?,?);");
-                loadSetting(stmt, Settings.Global.VOLTE_VT_ENABLED, ImsConfig.FeatureValueConstants.ON);
-                db.setTransactionSuccessful();
-            } finally {
-                db.endTransaction();
-                if (stmt != null) stmt.close();
+            if (mUserHandle == UserHandle.USER_OWNER) {
+                db.beginTransaction();
+                SQLiteStatement stmt = null;
+                try {
+                    stmt = db.compileStatement("INSERT OR IGNORE INTO global(name,value)"
+                            + " VALUES(?,?);");
+                    loadSetting(stmt, Settings.Global.VOLTE_VT_ENABLED, ImsConfig.FeatureValueConstants.ON);
+                    db.setTransactionSuccessful();
+                } finally {
+                    db.endTransaction();
+                    if (stmt != null) stmt.close();
+                }
             }
             upgradeVersion = 114;
         }