Reset rotation-lock-for-accessibility setting on upgrade.
Since it now hides the display setting, force the user to opt-in
again.
Bug: 18104538
Change-Id: I4cac947f7a35ba0f578d059542401dcc5d169307
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index 9bfcadb..ddf24e8 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -71,7 +71,7 @@
// database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
// is properly propagated through your change. Not doing so will result in a loss of user
// settings.
- private static final int DATABASE_VERSION = 117;
+ private static final int DATABASE_VERSION = 118;
private Context mContext;
private int mUserHandle;
@@ -1879,6 +1879,22 @@
upgradeVersion = 117;
}
+ if (upgradeVersion < 118) {
+ // Reset rotation-lock-for-accessibility on upgrade, since it now hides the display
+ // setting.
+ db.beginTransaction();
+ SQLiteStatement stmt = null;
+ try {
+ stmt = db.compileStatement("INSERT OR REPLACE INTO system(name,value)"
+ + " VALUES(?,?);");
+ loadSetting(stmt, Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 0);
+ db.setTransactionSuccessful();
+ } finally {
+ db.endTransaction();
+ if (stmt != null) stmt.close();
+ }
+ upgradeVersion = 118;
+ }
// *** Remember to update DATABASE_VERSION above!
if (upgradeVersion != currentVersion) {