summaryrefslogtreecommitdiffstats
path: root/core/java/com
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2012-09-21 17:17:22 -0700
committerChristopher Tate <ctate@google.com>2012-09-27 18:56:23 -0700
commit5e08af03a3dffff8b8fc098790e5133589601d8f (patch)
tree97246bb48548eb2e2cfe997685333a6d0899ab87 /core/java/com
parenta852ff3a4b637e8101c2f54e110467586fe604cf (diff)
downloadframeworks_base-5e08af03a3dffff8b8fc098790e5133589601d8f.zip
frameworks_base-5e08af03a3dffff8b8fc098790e5133589601d8f.tar.gz
frameworks_base-5e08af03a3dffff8b8fc098790e5133589601d8f.tar.bz2
Respect per-user rotation lock et alia
Various per-user settings such as rotation lock are relevant to the singleton PhoneWindowManager object. We now listen for user-switch broadcasts and reconfigure the active state based on the newly- active user's settings. The RotationPolicy toolset has also been updated to do the right thing, as has the Quick Settings UI. Bug 7213638 Change-Id: Iee2109e48df550b4c979d3f9c91b5d2b71a6a08e
Diffstat (limited to 'core/java/com')
-rw-r--r--core/java/com/android/internal/view/RotationPolicy.java35
1 files changed, 24 insertions, 11 deletions
diff --git a/core/java/com/android/internal/view/RotationPolicy.java b/core/java/com/android/internal/view/RotationPolicy.java
index 98beadb..95130c8 100644
--- a/core/java/com/android/internal/view/RotationPolicy.java
+++ b/core/java/com/android/internal/view/RotationPolicy.java
@@ -23,6 +23,7 @@ import android.os.AsyncTask;
import android.os.Handler;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.UserHandle;
import android.provider.Settings;
import android.util.Log;
import android.view.IWindowManager;
@@ -55,16 +56,17 @@ public final class RotationPolicy {
*/
public static boolean isRotationLockToggleVisible(Context context) {
return isRotationLockToggleSupported(context) &&
- Settings.System.getInt(context.getContentResolver(),
- Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 0) == 0;
+ Settings.System.getIntForUser(context.getContentResolver(),
+ Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 0,
+ UserHandle.USER_CURRENT) == 0;
}
/**
* Returns true if rotation lock is enabled.
*/
public static boolean isRotationLocked(Context context) {
- return Settings.System.getInt(context.getContentResolver(),
- Settings.System.ACCELEROMETER_ROTATION, 0) == 0;
+ return Settings.System.getIntForUser(context.getContentResolver(),
+ Settings.System.ACCELEROMETER_ROTATION, 0, UserHandle.USER_CURRENT) == 0;
}
/**
@@ -73,8 +75,9 @@ public final class RotationPolicy {
* Should be used by the rotation lock toggle.
*/
public static void setRotationLock(Context context, final boolean enabled) {
- Settings.System.putInt(context.getContentResolver(),
- Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 0);
+ Settings.System.putIntForUser(context.getContentResolver(),
+ Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 0,
+ UserHandle.USER_CURRENT);
AsyncTask.execute(new Runnable() {
@Override
@@ -100,8 +103,9 @@ public final class RotationPolicy {
* Should be used by Display settings and Accessibility settings.
*/
public static void setRotationLockForAccessibility(Context context, final boolean enabled) {
- Settings.System.putInt(context.getContentResolver(),
- Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, enabled ? 1 : 0);
+ Settings.System.putIntForUser(context.getContentResolver(),
+ Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, enabled ? 1 : 0,
+ UserHandle.USER_CURRENT);
AsyncTask.execute(new Runnable() {
@Override
@@ -121,16 +125,25 @@ public final class RotationPolicy {
}
/**
- * Registers a listener for rotation policy changes.
+ * Registers a listener for rotation policy changes affecting the caller's user
*/
public static void registerRotationPolicyListener(Context context,
RotationPolicyListener listener) {
+ registerRotationPolicyListener(context, listener, UserHandle.getCallingUserId());
+ }
+
+ /**
+ * Registers a listener for rotation policy changes affecting a specific user,
+ * or USER_ALL for all users.
+ */
+ public static void registerRotationPolicyListener(Context context,
+ RotationPolicyListener listener, int userHandle) {
context.getContentResolver().registerContentObserver(Settings.System.getUriFor(
Settings.System.ACCELEROMETER_ROTATION),
- false, listener.mObserver);
+ false, listener.mObserver, userHandle);
context.getContentResolver().registerContentObserver(Settings.System.getUriFor(
Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY),
- false, listener.mObserver);
+ false, listener.mObserver, userHandle);
}
/**