summaryrefslogtreecommitdiffstats
path: root/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@google.com>2010-08-17 00:41:00 -0400
committerDaniel Sandler <dsandler@google.com>2010-11-04 16:55:29 -0400
commitb73617de462579f7c12c25a4c2747c576f00f6a2 (patch)
tree1f070d8a32c97062feca491ed9675af8d7c874dc /packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
parent1ab022b8c8b063d95a591bf40109986c5b1bbb11 (diff)
downloadframeworks_base-b73617de462579f7c12c25a4c2747c576f00f6a2.zip
frameworks_base-b73617de462579f7c12c25a4c2747c576f00f6a2.tar.gz
frameworks_base-b73617de462579f7c12c25a4c2747c576f00f6a2.tar.bz2
Rotation lock.
IWindowManager now supports two new methods, freezeRotation() and thawRotation(), that allow a caller to temporarily stash the device's current rotation as the default rotation (when no other constraints are present). The system bar uses this to implement a user-accessible rotation lock by calling freezeRotation() and then turning off accelerometer-based display rotation; unless overridden by an app, the display will continue to appear in the frozen rotation until the rotation is unlocked by the user (either via the rotation lock icon in the system bar or by checking "rotate screen automatically" in Settings). Bug: 2949639 Change-Id: Icd21c169d1053719590e72401f229424b254622f
Diffstat (limited to 'packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java')
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index 9ac832b..593edc8 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -61,7 +61,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
// 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 = 59;
+ private static final int DATABASE_VERSION = 60;
private Context mContext;
@@ -775,6 +775,23 @@ public class DatabaseHelper extends SQLiteOpenHelper {
upgradeVersion = 59;
}
+ if (upgradeVersion == 59) {
+ // Persistence for the rotation lock feature.
+ db.beginTransaction();
+ SQLiteStatement stmt = null;
+ try {
+ stmt = db.compileStatement("INSERT INTO system(name,value)"
+ + " VALUES(?,?);");
+ loadBooleanSetting(stmt, Settings.System.USER_ROTATION,
+ R.integer.def_user_rotation); // should be zero degrees
+ db.setTransactionSuccessful();
+ } finally {
+ db.endTransaction();
+ if (stmt != null) stmt.close();
+ }
+ upgradeVersion = 60;
+ }
+
// *** Remember to update DATABASE_VERSION above!
if (upgradeVersion != currentVersion) {