Loading core/java/android/provider/Settings.java +1 −1 Original line number Diff line number Diff line Loading @@ -799,7 +799,7 @@ public final class Settings { if (mCallGetCommand != null) { try { Bundle args = null; if (userHandle != UserHandle.myUserId()) { if (!isSelf) { args = new Bundle(); args.putInt(CALL_METHOD_USER_KEY, userHandle); } Loading core/java/com/android/internal/view/RotationPolicy.java +24 −11 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } /** Loading @@ -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 Loading @@ -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 Loading @@ -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); } /** Loading packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +2 −6 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.systemui.recent.TaskDescription; import com.android.systemui.statusbar.policy.NotificationRowLayout; import com.android.systemui.statusbar.tablet.StatusBarPanel; import android.app.ActivityManager; import android.app.ActivityManagerNative; import android.app.ActivityOptions; import android.app.KeyguardManager; Loading Loading @@ -261,12 +262,7 @@ public abstract class BaseStatusBar extends SystemUI implements )); } // XXX: this is currently broken and will always return 0, but should start working at some point try { mCurrentUserId = ActivityManagerNative.getDefault().getCurrentUser().id; } catch (RemoteException e) { Log.v(TAG, "Couldn't get current user ID; guessing it's 0", e); } mCurrentUserId = ActivityManager.getCurrentUser(); IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_USER_SWITCHED); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +2 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,8 @@ class QuickSettings { bluetoothController.addStateChangedCallback(mModel); batteryController.addStateChangedCallback(mModel); locationController.addStateChangedCallback(mModel); RotationPolicy.registerRotationPolicyListener(mContext, mRotationPolicyListener); RotationPolicy.registerRotationPolicyListener(mContext, mRotationPolicyListener, UserHandle.USER_ALL); } private void queryForUserInformation() { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java +23 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.database.ContentObserver; import android.graphics.drawable.Drawable; import android.hardware.display.WifiDisplayStatus; import android.os.Handler; import android.os.UserHandle; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.text.TextUtils; Loading Loading @@ -94,6 +95,16 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, } }; /** Broadcast receiver to act on user switches to update visuals of per-user state */ private BroadcastReceiver mUserSwitchedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (Intent.ACTION_USER_SWITCHED.equals(intent.getAction())) { onUserSwitched(intent); } } }; /** ContentObserver to determine the next alarm */ private class NextAlarmObserver extends ContentObserver { public NextAlarmObserver(Handler handler) { Loading Loading @@ -203,6 +214,9 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, IntentFilter alarmIntentFilter = new IntentFilter(); alarmIntentFilter.addAction(Intent.ACTION_ALARM_CHANGED); context.registerReceiver(mAlarmIntentReceiver, alarmIntentFilter); IntentFilter userSwitchedFilter = new IntentFilter(Intent.ACTION_USER_SWITCHED); context.registerReceiver(mUserSwitchedReceiver, userSwitchedFilter); } void updateResources() { Loading Loading @@ -609,4 +623,12 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, onBrightnessLevelChanged(); } // User switch: need to update visuals of all tiles known to have per-user state void onUserSwitched(Intent intent) { onRotationLockChanged(); onBrightnessLevelChanged(); onNextAlarmChanged(); onBugreportChanged(); } } Loading
core/java/android/provider/Settings.java +1 −1 Original line number Diff line number Diff line Loading @@ -799,7 +799,7 @@ public final class Settings { if (mCallGetCommand != null) { try { Bundle args = null; if (userHandle != UserHandle.myUserId()) { if (!isSelf) { args = new Bundle(); args.putInt(CALL_METHOD_USER_KEY, userHandle); } Loading
core/java/com/android/internal/view/RotationPolicy.java +24 −11 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } /** Loading @@ -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 Loading @@ -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 Loading @@ -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); } /** Loading
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +2 −6 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.systemui.recent.TaskDescription; import com.android.systemui.statusbar.policy.NotificationRowLayout; import com.android.systemui.statusbar.tablet.StatusBarPanel; import android.app.ActivityManager; import android.app.ActivityManagerNative; import android.app.ActivityOptions; import android.app.KeyguardManager; Loading Loading @@ -261,12 +262,7 @@ public abstract class BaseStatusBar extends SystemUI implements )); } // XXX: this is currently broken and will always return 0, but should start working at some point try { mCurrentUserId = ActivityManagerNative.getDefault().getCurrentUser().id; } catch (RemoteException e) { Log.v(TAG, "Couldn't get current user ID; guessing it's 0", e); } mCurrentUserId = ActivityManager.getCurrentUser(); IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_USER_SWITCHED); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +2 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,8 @@ class QuickSettings { bluetoothController.addStateChangedCallback(mModel); batteryController.addStateChangedCallback(mModel); locationController.addStateChangedCallback(mModel); RotationPolicy.registerRotationPolicyListener(mContext, mRotationPolicyListener); RotationPolicy.registerRotationPolicyListener(mContext, mRotationPolicyListener, UserHandle.USER_ALL); } private void queryForUserInformation() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java +23 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.database.ContentObserver; import android.graphics.drawable.Drawable; import android.hardware.display.WifiDisplayStatus; import android.os.Handler; import android.os.UserHandle; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.text.TextUtils; Loading Loading @@ -94,6 +95,16 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, } }; /** Broadcast receiver to act on user switches to update visuals of per-user state */ private BroadcastReceiver mUserSwitchedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (Intent.ACTION_USER_SWITCHED.equals(intent.getAction())) { onUserSwitched(intent); } } }; /** ContentObserver to determine the next alarm */ private class NextAlarmObserver extends ContentObserver { public NextAlarmObserver(Handler handler) { Loading Loading @@ -203,6 +214,9 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, IntentFilter alarmIntentFilter = new IntentFilter(); alarmIntentFilter.addAction(Intent.ACTION_ALARM_CHANGED); context.registerReceiver(mAlarmIntentReceiver, alarmIntentFilter); IntentFilter userSwitchedFilter = new IntentFilter(Intent.ACTION_USER_SWITCHED); context.registerReceiver(mUserSwitchedReceiver, userSwitchedFilter); } void updateResources() { Loading Loading @@ -609,4 +623,12 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, onBrightnessLevelChanged(); } // User switch: need to update visuals of all tiles known to have per-user state void onUserSwitched(Intent intent) { onRotationLockChanged(); onBrightnessLevelChanged(); onNextAlarmChanged(); onBugreportChanged(); } }