diff options
author | Daniel Sandler <dsandler@google.com> | 2010-08-17 00:41:00 -0400 |
---|---|---|
committer | Daniel Sandler <dsandler@google.com> | 2010-11-04 16:55:29 -0400 |
commit | b73617de462579f7c12c25a4c2747c576f00f6a2 (patch) | |
tree | 1f070d8a32c97062feca491ed9675af8d7c874dc /packages/SettingsProvider | |
parent | 1ab022b8c8b063d95a591bf40109986c5b1bbb11 (diff) | |
download | frameworks_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')
-rw-r--r-- | packages/SettingsProvider/res/values/defaults.xml | 2 | ||||
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index 8de507e..8a6e82d 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -103,4 +103,6 @@ 0x120016=0x03050601:0x03040501:0x03030401:0x03020301:0x03070301:0x03010301:0x03000301; </string> + <!-- Default for Settings.System.USER_ROTATION --> + <integer name="def_user_rotation">0</integer> </resources> 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) { |