summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-06-20 17:13:16 +0200
committerDanny Baumann <dannybaumann@web.de>2013-06-24 12:54:07 +0200
commita012186757fb6fe7695e0c21b79fa20cad57b2d2 (patch)
treeff0f6c33b5828fb220a1fdfd5e78cda3fb1b3673 /packages
parentb429a08331e8ebea15113fe287f4e5c9478d7001 (diff)
downloadframeworks_base-a012186757fb6fe7695e0c21b79fa20cad57b2d2.zip
frameworks_base-a012186757fb6fe7695e0c21b79fa20cad57b2d2.tar.gz
frameworks_base-a012186757fb6fe7695e0c21b79fa20cad57b2d2.tar.bz2
Fix multi-user behaviour for system UI settings (1/2)
Change-Id: I0e434b989c16f5871ce56c7e3041ff3c7a436c73
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/quicksettings/AlarmTile.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/quicksettings/ExpandedDesktopTile.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/quicksettings/MobileNetworkTypeTile.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/quicksettings/QuickSettingsTile.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/quicksettings/RingerModeTile.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/quicksettings/ScreenTimeoutTile.java14
-rw-r--r--packages/SystemUI/src/com/android/systemui/quicksettings/TorchTile.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java14
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NavigationButtons.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterTextView.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java114
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsController.java22
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/CircleBattery.java21
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java28
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/BrightnessButton.java33
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/FlashlightButton.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/NetworkModeButton.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerWidget.java20
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/ScreenTimeoutButton.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/SoundButton.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java42
25 files changed, 260 insertions, 182 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/quicksettings/AlarmTile.java b/packages/SystemUI/src/com/android/systemui/quicksettings/AlarmTile.java
index 98556b3..176013c 100644
--- a/packages/SystemUI/src/com/android/systemui/quicksettings/AlarmTile.java
+++ b/packages/SystemUI/src/com/android/systemui/quicksettings/AlarmTile.java
@@ -6,6 +6,7 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Handler;
+import android.os.UserHandle;
import android.provider.Settings;
import android.text.TextUtils;
import android.view.LayoutInflater;
@@ -50,8 +51,8 @@ public class AlarmTile extends QuickSettingsTile {
private synchronized void updateTile() {
mDrawable = R.drawable.ic_qs_alarm_on;
- mLabel = Settings.System.getString(mContext.getContentResolver(),
- Settings.System.NEXT_ALARM_FORMATTED);
+ mLabel = Settings.System.getStringForUser(mContext.getContentResolver(),
+ Settings.System.NEXT_ALARM_FORMATTED, UserHandle.USER_CURRENT);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/quicksettings/ExpandedDesktopTile.java b/packages/SystemUI/src/com/android/systemui/quicksettings/ExpandedDesktopTile.java
index d76ef1b..4344d22 100644
--- a/packages/SystemUI/src/com/android/systemui/quicksettings/ExpandedDesktopTile.java
+++ b/packages/SystemUI/src/com/android/systemui/quicksettings/ExpandedDesktopTile.java
@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Handler;
+import android.os.UserHandle;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
@@ -24,8 +25,9 @@ public class ExpandedDesktopTile extends QuickSettingsTile {
@Override
public void onClick(View v) {
// Change the system setting
- Settings.System.putInt(mContext.getContentResolver(),
- Settings.System.EXPANDED_DESKTOP_STATE, mEnabled ? 0 : 1);
+ Settings.System.putIntForUser(mContext.getContentResolver(),
+ Settings.System.EXPANDED_DESKTOP_STATE, mEnabled ? 0 : 1,
+ UserHandle.USER_CURRENT);
}
};
@@ -56,8 +58,8 @@ public class ExpandedDesktopTile extends QuickSettingsTile {
}
private synchronized void updateTile() {
- mEnabled = Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.EXPANDED_DESKTOP_STATE, 0) == 1;
+ mEnabled = Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.EXPANDED_DESKTOP_STATE, 0, UserHandle.USER_CURRENT) == 1;
if (mEnabled) {
mDrawable = R.drawable.ic_qs_expanded_desktop_on;
mLabel = mContext.getString(R.string.quick_settings_expanded_desktop);
diff --git a/packages/SystemUI/src/com/android/systemui/quicksettings/MobileNetworkTypeTile.java b/packages/SystemUI/src/com/android/systemui/quicksettings/MobileNetworkTypeTile.java
index bcb15aa..a56f6e5 100644
--- a/packages/SystemUI/src/com/android/systemui/quicksettings/MobileNetworkTypeTile.java
+++ b/packages/SystemUI/src/com/android/systemui/quicksettings/MobileNetworkTypeTile.java
@@ -2,6 +2,7 @@ package com.android.systemui.quicksettings;
import android.content.Context;
import android.content.Intent;
+import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.util.Log;
@@ -206,9 +207,9 @@ public class MobileNetworkTypeTile extends QuickSettingsTile implements NetworkS
}
private int getCurrentCMMode() {
- return Settings.System.getInt(mContext.getContentResolver(),
+ return Settings.System.getIntForUser(mContext.getContentResolver(),
Settings.System.EXPANDED_NETWORK_MODE,
- CM_MODE_3G2G);
+ CM_MODE_3G2G, UserHandle.USER_CURRENT);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/quicksettings/QuickSettingsTile.java b/packages/SystemUI/src/com/android/systemui/quicksettings/QuickSettingsTile.java
index fbba6d0..08bf642 100644
--- a/packages/SystemUI/src/com/android/systemui/quicksettings/QuickSettingsTile.java
+++ b/packages/SystemUI/src/com/android/systemui/quicksettings/QuickSettingsTile.java
@@ -102,7 +102,8 @@ public class QuickSettingsTile implements OnClickListener {
public final void onClick(View v) {
mOnClick.onClick(v);
ContentResolver resolver = mContext.getContentResolver();
- boolean shouldCollapse = Settings.System.getInt(resolver, Settings.System.QS_COLLAPSE_PANEL, 0) == 1;
+ boolean shouldCollapse = Settings.System.getIntForUser(resolver,
+ Settings.System.QS_COLLAPSE_PANEL, 0, UserHandle.USER_CURRENT) == 1;
if (shouldCollapse) {
mQsc.mBar.collapseAllPanels(true);
}
diff --git a/packages/SystemUI/src/com/android/systemui/quicksettings/RingerModeTile.java b/packages/SystemUI/src/com/android/systemui/quicksettings/RingerModeTile.java
index a9fb920..d3d2b5e 100644
--- a/packages/SystemUI/src/com/android/systemui/quicksettings/RingerModeTile.java
+++ b/packages/SystemUI/src/com/android/systemui/quicksettings/RingerModeTile.java
@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.net.Uri;
+import android.os.UserHandle;
import android.os.Vibrator;
import android.provider.Settings;
import android.text.TextUtils;
@@ -146,8 +147,8 @@ public class RingerModeTile extends QuickSettingsTile {
}
private void updateSettings(ContentResolver resolver) {
- String[] modes = parseStoredValue(Settings.System.getString(
- resolver, Settings.System.EXPANDED_RING_MODE));
+ String[] modes = parseStoredValue(Settings.System.getStringForUser(
+ resolver, Settings.System.EXPANDED_RING_MODE, UserHandle.USER_CURRENT));
if (modes == null || modes.length == 0) {
mRingerValues = new int[] {
0, 1, 2, 3
@@ -162,8 +163,8 @@ public class RingerModeTile extends QuickSettingsTile {
private void findCurrentState() {
ContentResolver resolver = mContext.getContentResolver();
- boolean vibrateWhenRinging = Settings.System.getInt(resolver,
- Settings.System.VIBRATE_WHEN_RINGING, 0) == 1;
+ boolean vibrateWhenRinging = Settings.System.getIntForUser(resolver,
+ Settings.System.VIBRATE_WHEN_RINGING, 0, UserHandle.USER_CURRENT) == 1;
int ringerMode = mAudioManager.getRingerMode();
Ringer ringer = new Ringer(ringerMode, vibrateWhenRinging);
@@ -193,8 +194,8 @@ public class RingerModeTile extends QuickSettingsTile {
// Set the desired state
ContentResolver resolver = context.getContentResolver();
- Settings.System.putInt(resolver, Settings.System.VIBRATE_WHEN_RINGING,
- (mVibrateWhenRinging ? 1 : 0));
+ Settings.System.putIntForUser(resolver, Settings.System.VIBRATE_WHEN_RINGING,
+ mVibrateWhenRinging ? 1 : 0, UserHandle.USER_CURRENT);
mAudioManager.setRingerMode(mRingerMode);
}
diff --git a/packages/SystemUI/src/com/android/systemui/quicksettings/ScreenTimeoutTile.java b/packages/SystemUI/src/com/android/systemui/quicksettings/ScreenTimeoutTile.java
index ba69bb3..24265bb 100644
--- a/packages/SystemUI/src/com/android/systemui/quicksettings/ScreenTimeoutTile.java
+++ b/packages/SystemUI/src/com/android/systemui/quicksettings/ScreenTimeoutTile.java
@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
+import android.os.UserHandle;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
@@ -121,9 +122,9 @@ public class ScreenTimeoutTile extends QuickSettingsTile {
screenTimeout = SCREEN_TIMEOUT_MIN;
}
- Settings.System.putInt(
+ Settings.System.putIntForUser(
mContext.getContentResolver(),
- Settings.System.SCREEN_OFF_TIMEOUT, screenTimeout);
+ Settings.System.SCREEN_OFF_TIMEOUT, screenTimeout, UserHandle.USER_CURRENT);
}
private String makeTimeoutSummaryString(Context context, int timeout) {
@@ -158,12 +159,13 @@ public class ScreenTimeoutTile extends QuickSettingsTile {
}
private int getScreenTimeout() {
- return Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.SCREEN_OFF_TIMEOUT, 0);
+ return Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.SCREEN_OFF_TIMEOUT, 0, UserHandle.USER_CURRENT);
}
private int getCurrentCMMode() {
- return Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.EXPANDED_SCREENTIMEOUT_MODE, CM_MODE_15_60_300);
+ return Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.EXPANDED_SCREENTIMEOUT_MODE, CM_MODE_15_60_300,
+ UserHandle.USER_CURRENT);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/quicksettings/TorchTile.java b/packages/SystemUI/src/com/android/systemui/quicksettings/TorchTile.java
index 413f86a..aeb590d 100644
--- a/packages/SystemUI/src/com/android/systemui/quicksettings/TorchTile.java
+++ b/packages/SystemUI/src/com/android/systemui/quicksettings/TorchTile.java
@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Handler;
+import android.os.UserHandle;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
@@ -53,10 +54,10 @@ public class TorchTile extends QuickSettingsTile {
}
private synchronized void updateTile() {
- boolean enabled = Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.TORCH_STATE, 0) == 1;
+ boolean enabled = Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.TORCH_STATE, 0, UserHandle.USER_CURRENT) == 1;
- if(enabled) {
+ if (enabled) {
mDrawable = R.drawable.ic_qs_torch_on;
mLabel = mContext.getString(R.string.quick_settings_torch);
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 46cbf29..2320ed4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -173,8 +173,6 @@ public abstract class BaseStatusBar extends SystemUI implements
private boolean mDeviceProvisioned = false;
- private boolean mShowNotificationCounts;
-
public IStatusBarService getStatusBarService() {
return mBarService;
}
@@ -240,9 +238,6 @@ public abstract class BaseStatusBar extends SystemUI implements
mBarService = IStatusBarService.Stub.asInterface(
ServiceManager.getService(Context.STATUS_BAR_SERVICE));
- mShowNotificationCounts = Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.STATUS_BAR_NOTIF_COUNT, 0) == 1;
-
mStatusBarContainer = new FrameLayout(mContext);
// Connect in to the status bar manager service
@@ -326,7 +321,7 @@ public abstract class BaseStatusBar extends SystemUI implements
}
public void userSwitched(int newUserId) {
- // should be overridden
+ StatusBarIconView.GlobalSettingsObserver.getInstance(mContext).onChange(true);
}
public boolean notificationIsForCurrentUser(StatusBarNotification n) {
@@ -1205,10 +1200,11 @@ public abstract class BaseStatusBar extends SystemUI implements
public int getExpandedDesktopMode() {
ContentResolver resolver = mContext.getContentResolver();
- boolean expanded = Settings.System.getInt(resolver,
- Settings.System.EXPANDED_DESKTOP_STATE, 0) == 1;
+ boolean expanded = Settings.System.getIntForUser(resolver,
+ Settings.System.EXPANDED_DESKTOP_STATE, 0, UserHandle.USER_CURRENT) == 1;
if (expanded) {
- return Settings.System.getInt(resolver, Settings.System.EXPANDED_DESKTOP_STYLE, 0);
+ return Settings.System.getIntForUser(resolver,
+ Settings.System.EXPANDED_DESKTOP_STYLE, 0, UserHandle.USER_CURRENT);
}
return 0;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NavigationButtons.java b/packages/SystemUI/src/com/android/systemui/statusbar/NavigationButtons.java
index 58c8181..c8b1252 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NavigationButtons.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NavigationButtons.java
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar;
import android.content.Context;
+import android.os.UserHandle;
import android.provider.Settings;
import android.view.KeyEvent;
@@ -168,8 +169,8 @@ public class NavigationButtons {
* @return the current button map, or the default button map.
*/
public static ButtonInfo[] loadButtonMap(Context context) {
- String saved = Settings.System.getString(context.getContentResolver(),
- Settings.System.NAV_BUTTONS);
+ String saved = Settings.System.getStringForUser(context.getContentResolver(),
+ Settings.System.NAV_BUTTONS, UserHandle.USER_CURRENT);
if (saved == null) {
saved = NavigationButtons.DEFAULT_SETTING_STRING;
}
@@ -198,7 +199,7 @@ public class NavigationButtons {
if (i != 0) sb.append("|");
sb.append(map[i].key);
}
- Settings.System.putString(context.getContentResolver(),
- Settings.System.NAV_BUTTONS, sb.toString());
+ Settings.System.putStringForUser(context.getContentResolver(),
+ Settings.System.NAV_BUTTONS, sb.toString(), UserHandle.USER_CURRENT);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterTextView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterTextView.java
index b4e3572..a02b4fd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterTextView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterTextView.java
@@ -22,6 +22,7 @@ import android.content.Context;
import android.content.Intent;
import android.database.ContentObserver;
import android.os.Handler;
+import android.os.UserHandle;
import android.provider.Settings;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
@@ -73,7 +74,8 @@ public class SignalClusterTextView
void observe() {
ContentResolver resolver = mContext.getContentResolver();
resolver.registerContentObserver(Settings.System.getUriFor(
- Settings.System.STATUS_BAR_SIGNAL_TEXT), false, this);
+ Settings.System.STATUS_BAR_SIGNAL_TEXT), false, this,
+ UserHandle.USER_ALL);
}
void unobserve() {
@@ -171,10 +173,10 @@ public class SignalClusterTextView
}
};
- private void updateSettings() {
+ public void updateSettings() {
ContentResolver resolver = mContext.getContentResolver();
- mSignalClusterStyle = (Settings.System.getInt(resolver,
- Settings.System.STATUS_BAR_SIGNAL_TEXT, SIGNAL_CLUSTER_STYLE_NORMAL));
+ mSignalClusterStyle = (Settings.System.getIntForUser(resolver,
+ Settings.System.STATUS_BAR_SIGNAL_TEXT, SIGNAL_CLUSTER_STYLE_NORMAL, UserHandle.USER_CURRENT));
updateSignalText();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
index f59f2ce..8558762 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
@@ -20,6 +20,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
import android.os.Handler;
+import android.os.UserHandle;
import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Slog;
@@ -241,10 +242,11 @@ public class SignalClusterView
}
}
- private void updateSettings() {
+ public void updateSettings() {
ContentResolver resolver = mContext.getContentResolver();
- mSignalClusterStyle = (Settings.System.getInt(resolver,
- Settings.System.STATUS_BAR_SIGNAL_TEXT, SIGNAL_CLUSTER_STYLE_NORMAL));
+ mSignalClusterStyle = Settings.System.getIntForUser(resolver,
+ Settings.System.STATUS_BAR_SIGNAL_TEXT, SIGNAL_CLUSTER_STYLE_NORMAL,
+ UserHandle.USER_CURRENT);
updateSignalClusterStyle();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
index f79a52f..4a614b0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
@@ -71,8 +71,8 @@ public class StatusBarIconView extends AnimatedImageView {
mNumberPain.setTypeface(Typeface.DEFAULT_BOLD);
mNumberPain.setTextSize(scaledPx);
mNotification = notification;
- mShowNotificationCount = Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.STATUS_BAR_NOTIF_COUNT, 0) == 1;
+ mShowNotificationCount = Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.STATUS_BAR_NOTIF_COUNT, 0, UserHandle.USER_CURRENT) == 1;
setContentDescription(notification);
mObserver = GlobalSettingsObserver.getInstance(context);
@@ -362,8 +362,8 @@ public class StatusBarIconView extends AnimatedImageView {
@Override
public void onChange(boolean selfChange) {
- boolean showIconCount = Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.STATUS_BAR_NOTIF_COUNT, 0) == 1;
+ boolean showIconCount = Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.STATUS_BAR_NOTIF_COUNT, 0, UserHandle.USER_CURRENT) == 1;
for (StatusBarIconView sbiv : mIconViews) {
sbiv.mShowNotificationCount = showIconCount;
sbiv.set(sbiv.mIcon, true);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 626dbf9..aba85de 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -20,6 +20,7 @@ import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
+import android.os.UserHandle;
import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Slog;
@@ -119,12 +120,12 @@ public class NotificationPanelView extends PanelView {
mGestureStartY > getHeight() - mHandleBarHeight - getPaddingBottom();
mOkToFlip = getExpandedHeight() == 0;
if (event.getX(0) > getWidth() * (1.0f - STATUS_BAR_SETTINGS_RIGHT_PERCENTAGE) &&
- Settings.System.getInt(getContext().getContentResolver(),
- Settings.System.QS_QUICK_PULLDOWN, 0) == 1) {
+ Settings.System.getIntForUser(getContext().getContentResolver(),
+ Settings.System.QS_QUICK_PULLDOWN, 0, UserHandle.USER_CURRENT) == 1) {
flip = true;
} else if (event.getX(0) < getWidth() * (1.0f - STATUS_BAR_SETTINGS_LEFT_PERCENTAGE) &&
- Settings.System.getInt(getContext().getContentResolver(),
- Settings.System.QS_QUICK_PULLDOWN, 0) == 2) {
+ Settings.System.getIntForUser(getContext().getContentResolver(),
+ Settings.System.QS_QUICK_PULLDOWN, 0, UserHandle.USER_CURRENT) == 2) {
flip = true;
}
break;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 1c21f22..02b98f4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -95,11 +95,13 @@ import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.GestureRecorder;
import com.android.systemui.statusbar.NotificationData;
import com.android.systemui.statusbar.NotificationData.Entry;
+import com.android.systemui.statusbar.SignalClusterTextView;
import com.android.systemui.statusbar.SignalClusterView;
import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.CircleBattery;
import com.android.systemui.statusbar.policy.CircleDockBattery;
+import com.android.systemui.statusbar.policy.Clock;
import com.android.systemui.statusbar.policy.DockBatteryController;
import com.android.systemui.statusbar.policy.BluetoothController;
import com.android.systemui.statusbar.policy.DateView;
@@ -218,6 +220,7 @@ public class PhoneStatusBar extends BaseStatusBar {
QuickSettingsContainerView mSettingsContainer;
int mSettingsPanelGravity;
private TilesChangedObserver mTilesChangedObserver;
+ private SettingsObserver mSettingsObserver;
// top bar
View mNotificationPanelHeader;
@@ -232,10 +235,13 @@ public class PhoneStatusBar extends BaseStatusBar {
private TextView mEmergencyCallLabel;
private int mNotificationHeaderHeight;
- private boolean mShowCarrierInPanel = false;
+ private SignalClusterView mSignalView;
+ private SignalClusterTextView mSignalTextView;
+ private CircleBattery mCircleBattery;
+ private CircleDockBattery mCircleDockBattery;
+ private Clock mClock;
- // clock
- private boolean mShowClock;
+ private boolean mShowCarrierInPanel = false;
// drag bar
CloseDragHandle mCloseView;
@@ -290,7 +296,6 @@ public class PhoneStatusBar extends BaseStatusBar {
private Animator mLightsOutAnimation;
private Animator mLightsOnAnimation;
-
// last theme that was applied in order to detect theme change (as opposed
// to some other configuration change).
CustomTheme mCurrentTheme;
@@ -358,11 +363,11 @@ public class PhoneStatusBar extends BaseStatusBar {
public void update() {
ContentResolver resolver = mContext.getContentResolver();
- boolean autoBrightness = Settings.System.getInt(
- resolver, Settings.System.SCREEN_BRIGHTNESS_MODE, 0) ==
- Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
- mBrightnessControl = !autoBrightness && Settings.System.getInt(
- resolver, Settings.System.STATUS_BAR_BRIGHTNESS_CONTROL, 0) == 1;
+ int brightnessValue = Settings.System.getIntForUser(resolver,
+ Settings.System.SCREEN_BRIGHTNESS_MODE, 0, UserHandle.USER_CURRENT);
+ mBrightnessControl = brightnessValue != Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC
+ && Settings.System.getIntForUser(resolver, Settings.System.STATUS_BAR_BRIGHTNESS_CONTROL,
+ 0, UserHandle.USER_CURRENT) == 1;
}
}
@@ -413,8 +418,8 @@ public class PhoneStatusBar extends BaseStatusBar {
if (ENABLE_INTRUDERS) addIntruderView();
- SettingsObserver observer = new SettingsObserver(mHandler);
- observer.observe();
+ mSettingsObserver = new SettingsObserver(mHandler);
+ mSettingsObserver.observe();
// Lastly, call to the icon policy to install/update all the icons.
mIconPolicy = new PhoneStatusBarPolicy(mContext);
@@ -578,14 +583,14 @@ public class PhoneStatusBar extends BaseStatusBar {
// Load the Power widget views and set the listeners
mPowerWidget = (PowerWidget)mStatusBarWindow.findViewById(R.id.exp_power_stat);
mPowerWidget.setGlobalButtonOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if(Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.EXPANDED_HIDE_ONCHANGE, 0) == 1) {
- animateCollapsePanels();
- }
- }
- });
+ @Override
+ public void onClick(View v) {
+ if (Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.EXPANDED_HIDE_ONCHANGE, 0, UserHandle.USER_CURRENT) == 1) {
+ animateCollapsePanels();
+ }
+ }
+ });
mPowerWidget.setGlobalButtonOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
@@ -609,9 +614,8 @@ public class PhoneStatusBar extends BaseStatusBar {
mBatteryController.addIconView((ImageView)mStatusBarView.findViewById(R.id.battery));
mBatteryController.addLabelView((TextView)mStatusBarView.findViewById(R.id.battery_text));
- final CircleBattery circleBattery =
- (CircleBattery) mStatusBarView.findViewById(R.id.circle_battery);
- mBatteryController.addStateChangedCallback(circleBattery);
+ mCircleBattery = (CircleBattery) mStatusBarView.findViewById(R.id.circle_battery);
+ mBatteryController.addStateChangedCallback(mCircleBattery);
// Dock Battery support
mHasDockBattery = mContext.getResources().getBoolean(
@@ -624,10 +628,10 @@ public class PhoneStatusBar extends BaseStatusBar {
mDockBatteryController.addLabelView(
(TextView)mStatusBarView.findViewById(R.id.dock_battery_text));
- final CircleDockBattery dockCircleBattery =
+ mCircleDockBattery =
(CircleDockBattery) mStatusBarView.findViewById(R.id.circle_dock_battery);
final DockBatteryController.DockBatteryStateChangeCallback callback =
- (DockBatteryController.DockBatteryStateChangeCallback) dockCircleBattery;
+ (DockBatteryController.DockBatteryStateChangeCallback) mCircleDockBattery;
mDockBatteryController.addStateChangedCallback(callback);
} else {
// Remove dock battery icons if device doesn't hava dock battery support
@@ -637,16 +641,18 @@ public class PhoneStatusBar extends BaseStatusBar {
if (v != null) mStatusBarView.removeView(v);
v = mStatusBarView.findViewById(R.id.circle_dock_battery);
if (v != null) mStatusBarView.removeView(v);
+ mCircleDockBattery = null;
}
mNetworkController = new NetworkController(mContext);
mBluetoothController = new BluetoothController(mContext);
- final SignalClusterView signalCluster =
- (SignalClusterView)mStatusBarView.findViewById(R.id.signal_cluster);
+ mSignalView = (SignalClusterView) mStatusBarView.findViewById(R.id.signal_cluster);
+ mSignalTextView = (SignalClusterTextView) mStatusBarView.findViewById(R.id.signal_cluster_text);
+ mClock = (Clock) mStatusBarView.findViewById(R.id.clock);
- mNetworkController.addSignalCluster(signalCluster);
- signalCluster.setNetworkController(mNetworkController);
+ mNetworkController.addSignalCluster(mSignalView);
+ mSignalView.setNetworkController(mNetworkController);
mEmergencyCallLabel = (TextView)mStatusBarWindow.findViewById(R.id.emergency_calls_only);
if (mEmergencyCallLabel != null) {
@@ -1321,13 +1327,8 @@ public class PhoneStatusBar extends BaseStatusBar {
}
public void showClock(boolean show) {
- if (mStatusBarView == null) return;
- ContentResolver resolver = mContext.getContentResolver();
- View clock = mStatusBarView.findViewById(R.id.clock);
- mShowClock = (Settings.System.getInt(resolver,
- Settings.System.STATUS_BAR_CLOCK, 1) == 1);
- if (clock != null) {
- clock.setVisibility(show ? (mShowClock ? View.VISIBLE : View.GONE) : View.GONE);
+ if (mClock != null) {
+ mClock.setHidden(!show);
}
}
@@ -2014,8 +2015,8 @@ public class PhoneStatusBar extends BaseStatusBar {
ServiceManager.getService("power"));
if (power != null) {
power.setTemporaryScreenBrightnessSettingOverride(newBrightness);
- Settings.System.putInt(mContext.getContentResolver(),
- Settings.System.SCREEN_BRIGHTNESS, newBrightness);
+ Settings.System.putIntForUser(mContext.getContentResolver(),
+ Settings.System.SCREEN_BRIGHTNESS, newBrightness, UserHandle.USER_CURRENT);
}
} catch (RemoteException e) {
Slog.w(TAG, "Setting Brightness failed: " + e);
@@ -2682,6 +2683,31 @@ public class PhoneStatusBar extends BaseStatusBar {
animateCollapsePanels();
updateNotificationIcons();
resetUserSetupObserver();
+ mSettingsObserver.onChange(true);
+ mPowerWidget.setupWidget();
+ mPowerWidget.updateVisibility();
+ if (mTilesChangedObserver != null) {
+ mTilesChangedObserver.onChange(true);
+ }
+ if (mSignalView != null) {
+ mSignalView.updateSettings();
+ }
+ if (mSignalTextView != null) {
+ mSignalTextView.updateSettings();
+ }
+ if (mBatteryController != null) {
+ mBatteryController.updateSettings();
+ }
+ if (mCircleBattery != null) {
+ mCircleBattery.updateSettings();
+ }
+ if (mCircleDockBattery != null) {
+ mCircleDockBattery.updateSettings();
+ }
+ if (mClock != null) {
+ mClock.updateSettings();
+ }
+ super.userSwitched(newUserId);
}
private void resetUserSetupObserver() {
@@ -2965,31 +2991,31 @@ public class PhoneStatusBar extends BaseStatusBar {
final ContentResolver cr = mContext.getContentResolver();
cr.registerContentObserver(
Settings.System.getUriFor(Settings.System.QUICK_SETTINGS_TILES),
- false, this);
+ false, this, UserHandle.USER_ALL);
cr.registerContentObserver(
Settings.System.getUriFor(Settings.System.QS_DYNAMIC_ALARM),
- false, this);
+ false, this, UserHandle.USER_ALL);
cr.registerContentObserver(
Settings.System.getUriFor(Settings.System.QS_DYNAMIC_BUGREPORT),
- false, this);
+ false, this, UserHandle.USER_ALL);
cr.registerContentObserver(
Settings.System.getUriFor(Settings.System.QS_DYNAMIC_DOCK_BATTERY),
- false, this);
+ false, this, UserHandle.USER_ALL);
cr.registerContentObserver(
Settings.System.getUriFor(Settings.System.QS_DYNAMIC_IME),
- false, this);
+ false, this, UserHandle.USER_ALL);
cr.registerContentObserver(
Settings.System.getUriFor(Settings.System.QS_DYNAMIC_USBTETHER),
- false, this);
+ false, this, UserHandle.USER_ALL);
cr.registerContentObserver(
Settings.System.getUriFor(Settings.System.QS_DYNAMIC_WIFI),
- false, this);
+ false, this, UserHandle.USER_ALL);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsController.java
index f72b56c..a6e4420 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsController.java
@@ -61,6 +61,7 @@ import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
+import android.os.UserHandle;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
@@ -173,7 +174,8 @@ public class QuickSettingsController {
// Read the stored list of tiles
ContentResolver resolver = mContext.getContentResolver();
LayoutInflater inflater = LayoutInflater.from(mContext);
- String tiles = Settings.System.getString(resolver, Settings.System.QUICK_SETTINGS_TILES);
+ String tiles = Settings.System.getStringForUser(resolver,
+ Settings.System.QUICK_SETTINGS_TILES, UserHandle.USER_CURRENT);
if (tiles == null) {
Log.i(TAG, "Default tiles being loaded");
tiles = TextUtils.join(TILE_DELIMITER, TILES_DEFAULT);
@@ -260,12 +262,14 @@ public class QuickSettingsController {
// Load the dynamic tiles
// These toggles must be the last ones added to the view, as they will show
// only when they are needed
- if (Settings.System.getInt(resolver, Settings.System.QS_DYNAMIC_ALARM, 1) == 1) {
+ if (Settings.System.getIntForUser(resolver,
+ Settings.System.QS_DYNAMIC_ALARM, 1, UserHandle.USER_CURRENT) == 1) {
QuickSettingsTile qs = new AlarmTile(mContext, this, mHandler);
qs.setupQuickSettingsTile(inflater, mContainerView);
mQuickSettingsTiles.add(qs);
}
- if (Settings.System.getInt(resolver, Settings.System.QS_DYNAMIC_BUGREPORT, 1) == 1) {
+ if (Settings.System.getIntForUser(resolver,
+ Settings.System.QS_DYNAMIC_BUGREPORT, 1, UserHandle.USER_CURRENT) == 1) {
QuickSettingsTile qs = new BugReportTile(mContext, this, mHandler);
qs.setupQuickSettingsTile(inflater, mContainerView);
mQuickSettingsTiles.add(qs);
@@ -273,17 +277,20 @@ public class QuickSettingsController {
if (!dockBatteryLoaded) {
loadDockBatteryTile(resolver, inflater);
}
- if (Settings.System.getInt(resolver, Settings.System.QS_DYNAMIC_WIFI, 1) == 1) {
+ if (Settings.System.getIntForUser(resolver,
+ Settings.System.QS_DYNAMIC_WIFI, 1, UserHandle.USER_CURRENT) == 1) {
QuickSettingsTile qs = new WiFiDisplayTile(mContext, this);
qs.setupQuickSettingsTile(inflater, mContainerView);
mQuickSettingsTiles.add(qs);
}
- if (deviceSupportsImeSwitcher(mContext) && Settings.System.getInt(resolver, Settings.System.QS_DYNAMIC_IME, 1) == 1) {
+ if (deviceSupportsImeSwitcher(mContext) && Settings.System.getIntForUser(resolver,
+ Settings.System.QS_DYNAMIC_IME, 1, UserHandle.USER_CURRENT) == 1) {
mIMETile = new InputMethodTile(mContext, this);
mIMETile.setupQuickSettingsTile(inflater, mContainerView);
mQuickSettingsTiles.add(mIMETile);
}
- if (deviceSupportsUsbTether(mContext) && Settings.System.getInt(resolver, Settings.System.QS_DYNAMIC_USBTETHER, 1) == 1) {
+ if (deviceSupportsUsbTether(mContext) && Settings.System.getIntForUser(resolver,
+ Settings.System.QS_DYNAMIC_USBTETHER, 1, UserHandle.USER_CURRENT) == 1) {
QuickSettingsTile qs = new UsbTetherTile(mContext, this);
qs.setupQuickSettingsTile(inflater, mContainerView);
mQuickSettingsTiles.add(qs);
@@ -294,7 +301,8 @@ public class QuickSettingsController {
if (!deviceSupportsDockBattery(mContext)) {
return;
}
- if (Settings.System.getInt(resolver, Settings.System.QS_DYNAMIC_DOCK_BATTERY, 1) == 0) {
+ if (Settings.System.getIntForUser(resolver,
+ Settings.System.QS_DYNAMIC_DOCK_BATTERY, 1, UserHandle.USER_CURRENT) == 0) {
return;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
index 0ed886e..e3a2216 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
@@ -26,6 +26,7 @@ import android.content.IntentFilter;
import android.database.ContentObserver;
import android.os.BatteryManager;
import android.os.Handler;
+import android.os.UserHandle;
import android.provider.Settings;
import android.view.View;
import android.widget.ImageView;
@@ -249,10 +250,11 @@ public class BatteryController extends BroadcastReceiver {
}
}
- private void updateSettings() {
+ public void updateSettings() {
ContentResolver resolver = mContext.getContentResolver();
- mBatteryStyle = (Settings.System.getInt(resolver,
- Settings.System.STATUS_BAR_BATTERY, BATTERY_STYLE_NORMAL));
+ mBatteryStyle = (Settings.System.getIntForUser(resolver,
+ Settings.System.STATUS_BAR_BATTERY, BATTERY_STYLE_NORMAL,
+ UserHandle.USER_CURRENT));
updateBattery();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CircleBattery.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CircleBattery.java
index c4bd4b4..a434876 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/CircleBattery.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/CircleBattery.java
@@ -34,6 +34,7 @@ import android.graphics.Rect;
import android.graphics.RectF;
import android.os.BatteryManager;
import android.os.Handler;
+import android.os.UserHandle;
import android.provider.Settings;
import android.util.AttributeSet;
import android.view.View;
@@ -97,14 +98,7 @@ public class CircleBattery extends ImageView implements BatteryController.Batter
@Override
public void onChange(boolean selfChange) {
- int batteryStyle = Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.STATUS_BAR_BATTERY, 0);
-
- mActivated = (batteryStyle == BatteryController.BATTERY_STYLE_CIRCLE
- || batteryStyle == BatteryController.BATTERY_STYLE_CIRCLE_PERCENT);
- mPercentage = (batteryStyle == BatteryController.BATTERY_STYLE_CIRCLE_PERCENT);
-
- updateVisibility();
+ updateSettings();
}
}
@@ -181,6 +175,17 @@ public class CircleBattery extends ImageView implements BatteryController.Batter
}
}
+ public void updateSettings() {
+ int batteryStyle = Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.STATUS_BAR_BATTERY, 0, UserHandle.USER_CURRENT);
+
+ mActivated = (batteryStyle == BatteryController.BATTERY_STYLE_CIRCLE
+ || batteryStyle == BatteryController.BATTERY_STYLE_CIRCLE_PERCENT);
+ mPercentage = (batteryStyle == BatteryController.BATTERY_STYLE_CIRCLE_PERCENT);
+
+ updateVisibility();
+ }
+
@Override
public void onBatteryLevelChanged(int level, int status) {
mLevel = level;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
index 7779b1f..3c1d89e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
@@ -26,6 +26,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.database.ContentObserver;
import android.os.Handler;
+import android.os.UserHandle;
import android.provider.AlarmClock;
import android.provider.Settings;
import android.text.Spannable;
@@ -56,13 +57,13 @@ public class Clock extends TextView implements OnClickListener, OnLongClickListe
private SimpleDateFormat mClockFormat;
private Locale mLocale;
private SettingsObserver mObserver;
+ private boolean mHidden;
private static final int AM_PM_STYLE_NORMAL = 0;
private static final int AM_PM_STYLE_SMALL = 1;
private static final int AM_PM_STYLE_GONE = 2;
private int mAmPmStyle = AM_PM_STYLE_GONE;
- private boolean mShowClock;
Handler mHandler;
@@ -108,6 +109,11 @@ public class Clock extends TextView implements OnClickListener, OnLongClickListe
updateSettings();
}
+ public void setHidden(boolean hidden) {
+ mHidden = hidden;
+ updateVisibility();
+ }
+
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
@@ -250,11 +256,9 @@ public class Clock extends TextView implements OnClickListener, OnLongClickListe
}
- private void updateSettings(){
- ContentResolver resolver = mContext.getContentResolver();
-
- int amPmStyle = (Settings.System.getInt(resolver,
- Settings.System.STATUS_BAR_AM_PM, 2));
+ public void updateSettings() {
+ int amPmStyle = Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.STATUS_BAR_AM_PM, 2, UserHandle.USER_CURRENT);
if (mAmPmStyle != amPmStyle) {
mAmPmStyle = amPmStyle;
@@ -265,13 +269,13 @@ public class Clock extends TextView implements OnClickListener, OnLongClickListe
}
}
- mShowClock = (Settings.System.getInt(resolver,
- Settings.System.STATUS_BAR_CLOCK, 1) == 1);
+ updateVisibility();
+ }
- if(mShowClock)
- setVisibility(View.VISIBLE);
- else
- setVisibility(View.GONE);
+ private void updateVisibility() {
+ boolean showClock = Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.STATUS_BAR_CLOCK, 1, UserHandle.USER_CURRENT) == 1;
+ setVisibility(showClock && !mHidden ? View.VISIBLE : View.GONE);
}
private void collapseStartActivity(Intent what) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/BrightnessButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/BrightnessButton.java
index 2d4da29..649b6c4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/BrightnessButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/BrightnessButton.java
@@ -12,6 +12,7 @@ import android.os.IPowerManager;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.UserHandle;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
@@ -112,17 +113,18 @@ public class BrightnessButton extends PowerButton {
int brightness = BACKLIGHTS[backlightIndex];
if (brightness == AUTO_BACKLIGHT) {
- Settings.System.putInt(resolver, Settings.System.SCREEN_BRIGHTNESS_MODE,
- Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
+ Settings.System.putIntForUser(resolver, Settings.System.SCREEN_BRIGHTNESS_MODE,
+ Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC, UserHandle.USER_CURRENT);
} else {
if (mAutoBrightnessSupported) {
- Settings.System.putInt(resolver, Settings.System.SCREEN_BRIGHTNESS_MODE,
- Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
+ Settings.System.putIntForUser(resolver, Settings.System.SCREEN_BRIGHTNESS_MODE,
+ Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL, UserHandle.USER_CURRENT);
}
if (power != null) {
power.setBacklightBrightness(brightness);
}
- Settings.System.putInt(resolver, Settings.System.SCREEN_BRIGHTNESS, brightness);
+ Settings.System.putIntForUser(resolver, Settings.System.SCREEN_BRIGHTNESS,
+ brightness, UserHandle.USER_CURRENT);
}
}
@@ -143,19 +145,20 @@ public class BrightnessButton extends PowerButton {
@Override
protected void onChangeUri(ContentResolver resolver, Uri uri) {
if (BRIGHTNESS_URI.equals(uri)) {
- mCurrentBrightness = Settings.System.getInt(resolver,
- Settings.System.SCREEN_BRIGHTNESS, 0);
+ mCurrentBrightness = Settings.System.getIntForUser(resolver,
+ Settings.System.SCREEN_BRIGHTNESS, 0, UserHandle.USER_CURRENT);
} else if (BRIGHTNESS_MODE_URI.equals(uri)) {
- mAutoBrightness = (Settings.System.getInt(resolver,
- Settings.System.SCREEN_BRIGHTNESS_MODE, 0) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
+ mAutoBrightness = (Settings.System.getIntForUser(resolver,
+ Settings.System.SCREEN_BRIGHTNESS_MODE, 0, UserHandle.USER_CURRENT)
+ == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
} else {
updateSettings(resolver);
}
}
private void updateSettings(ContentResolver resolver) {
- String[] modes = parseStoredValue(Settings.System.getString(
- resolver, Settings.System.EXPANDED_BRIGHTNESS_MODE));
+ String[] modes = parseStoredValue(Settings.System.getStringForUser(
+ resolver, Settings.System.EXPANDED_BRIGHTNESS_MODE, UserHandle.USER_CURRENT));
if (modes == null || modes.length == 0) {
mBacklightValues = new int[] {
0, 1, 2, 3, 4, 5
@@ -167,13 +170,13 @@ public class BrightnessButton extends PowerButton {
}
}
- mAutoBrightness = (Settings.System.getInt(resolver, Settings.System.SCREEN_BRIGHTNESS_MODE,
- 0) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
+ mAutoBrightness = (Settings.System.getIntForUser(resolver, Settings.System.SCREEN_BRIGHTNESS_MODE,
+ 0, UserHandle.USER_CURRENT) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
if (mAutoBrightness) {
mCurrentBrightness = AUTO_BACKLIGHT;
} else {
- mCurrentBrightness = Settings.System.getInt(resolver,
- Settings.System.SCREEN_BRIGHTNESS, -1);
+ mCurrentBrightness = Settings.System.getIntForUser(resolver,
+ Settings.System.SCREEN_BRIGHTNESS, -1, UserHandle.USER_CURRENT);
for (int i = 0; i < BACKLIGHTS.length; i++) {
if (mCurrentBrightness == BACKLIGHTS[i]) {
mCurrentBacklightIndex = i;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/FlashlightButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/FlashlightButton.java
index cf8ed2d..e3e361f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/FlashlightButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/FlashlightButton.java
@@ -5,6 +5,7 @@ import com.android.systemui.R;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
+import android.os.UserHandle;
import android.provider.Settings;
import java.util.ArrayList;
@@ -21,7 +22,8 @@ public class FlashlightButton extends PowerButton {
@Override
protected void updateState(Context context) {
- boolean enabled = Settings.System.getInt(context.getContentResolver(), Settings.System.TORCH_STATE, 0) == 1;
+ boolean enabled = Settings.System.getIntForUser(context.getContentResolver(),
+ Settings.System.TORCH_STATE, 0, UserHandle.USER_CURRENT) == 1;
if(enabled) {
mIcon = R.drawable.stat_flashlight_on;
mState = STATE_ENABLED;
@@ -33,8 +35,8 @@ public class FlashlightButton extends PowerButton {
@Override
protected void toggleState(Context context) {
- boolean bright = Settings.System.getInt(context.getContentResolver(),
- Settings.System.EXPANDED_FLASH_MODE, 0) == 1;
+ boolean bright = Settings.System.getIntForUser(context.getContentResolver(),
+ Settings.System.EXPANDED_FLASH_MODE, 0, UserHandle.USER_CURRENT) == 1;
Intent i = new Intent("net.cactii.flash2.TOGGLE_FLASHLIGHT");
i.putExtra("bright", bright);
context.sendBroadcast(i);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/NetworkModeButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/NetworkModeButton.java
index c4ee5d2..a3ff9bb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/NetworkModeButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/NetworkModeButton.java
@@ -6,6 +6,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
+import android.os.UserHandle;
import android.provider.Settings.SettingNotFoundException;
import android.provider.Settings;
import android.util.Log;
@@ -187,8 +188,8 @@ public class NetworkModeButton extends PowerButton{
}
private static int getCurrentCMMode(Context context) {
- return Settings.System.getInt(context.getContentResolver(),
+ return Settings.System.getIntForUser(context.getContentResolver(),
Settings.System.EXPANDED_NETWORK_MODE,
- CM_MODE_3G2G);
+ CM_MODE_3G2G, UserHandle.USER_CURRENT);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerWidget.java b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerWidget.java
index ae63720..1bbe8fc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerWidget.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerWidget.java
@@ -26,6 +26,7 @@ import android.database.ContentObserver;
import android.net.Uri;
import android.net.wimax.WimaxHelper;
import android.os.Handler;
+import android.os.UserHandle;
import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Log;
@@ -171,7 +172,8 @@ public class PowerWidget extends FrameLayout {
Log.i(TAG, "Setting up widget");
- String buttons = Settings.System.getString(mContext.getContentResolver(), Settings.System.WIDGET_BUTTONS);
+ String buttons = Settings.System.getStringForUser(mContext.getContentResolver(),
+ Settings.System.WIDGET_BUTTONS, UserHandle.USER_CURRENT);
if (buttons == null) {
Log.i(TAG, "Default buttons being loaded");
buttons = BUTTONS_DEFAULT;
@@ -394,8 +396,8 @@ public class PowerWidget extends FrameLayout {
public void updateVisibility() {
// now check if we need to display the widget still
- boolean displayPowerWidget = Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.EXPANDED_VIEW_WIDGET, 0) == 1;
+ boolean displayPowerWidget = Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.EXPANDED_VIEW_WIDGET, 0, UserHandle.USER_CURRENT) == 1;
if(!displayPowerWidget) {
setVisibility(View.GONE);
} else {
@@ -405,21 +407,21 @@ public class PowerWidget extends FrameLayout {
private void updateScrollbar() {
if (mScrollView == null) return;
- boolean hideScrollBar = Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.EXPANDED_HIDE_SCROLLBAR, 0) == 1;
+ boolean hideScrollBar = Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.EXPANDED_HIDE_SCROLLBAR, 0, UserHandle.USER_CURRENT) == 1;
mScrollView.setHorizontalScrollBarEnabled(!hideScrollBar);
}
private void updateHapticFeedbackSetting() {
ContentResolver cr = mContext.getContentResolver();
- int expandedHapticFeedback = Settings.System.getInt(cr,
- Settings.System.EXPANDED_HAPTIC_FEEDBACK, 2);
+ int expandedHapticFeedback = Settings.System.getIntForUser(cr,
+ Settings.System.EXPANDED_HAPTIC_FEEDBACK, 2, UserHandle.USER_CURRENT);
long[] clickPattern = null, longClickPattern = null;
boolean hapticFeedback;
if (expandedHapticFeedback == 2) {
- hapticFeedback = Settings.System.getInt(cr,
- Settings.System.HAPTIC_FEEDBACK_ENABLED, 1) == 1;
+ hapticFeedback = Settings.System.getIntForUser(cr,
+ Settings.System.HAPTIC_FEEDBACK_ENABLED, 1, UserHandle.USER_CURRENT) == 1;
} else {
hapticFeedback = (expandedHapticFeedback == 1);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/ScreenTimeoutButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/ScreenTimeoutButton.java
index 15f4977..ee80b8d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/ScreenTimeoutButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/ScreenTimeoutButton.java
@@ -6,6 +6,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
+import android.os.UserHandle;
import android.provider.Settings;
import android.view.Gravity;
import android.view.View;
@@ -98,9 +99,9 @@ public class ScreenTimeoutButton extends PowerButton {
screenTimeout = SCREEN_TIMEOUT_MIN;
}
- Settings.System.putInt(
+ Settings.System.putIntForUser(
context.getContentResolver(),
- Settings.System.SCREEN_OFF_TIMEOUT, screenTimeout);
+ Settings.System.SCREEN_OFF_TIMEOUT, screenTimeout, UserHandle.USER_CURRENT);
// cancel any previous toast
if (mToast != null) {
@@ -160,15 +161,15 @@ public class ScreenTimeoutButton extends PowerButton {
}
private static int getScreenTimeout(Context context) {
- return Settings.System.getInt(
+ return Settings.System.getIntForUser(
context.getContentResolver(),
- Settings.System.SCREEN_OFF_TIMEOUT, 0);
+ Settings.System.SCREEN_OFF_TIMEOUT, 0, UserHandle.USER_CURRENT);
}
private static int getCurrentCMMode(Context context) {
- return Settings.System.getInt(context.getContentResolver(),
+ return Settings.System.getIntForUser(context.getContentResolver(),
Settings.System.EXPANDED_SCREENTIMEOUT_MODE,
- CM_MODE_15_60_300);
+ CM_MODE_15_60_300, UserHandle.USER_CURRENT);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/SoundButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/SoundButton.java
index 7f54ba3..1a4fdaa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/SoundButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/SoundButton.java
@@ -10,6 +10,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
import android.net.Uri;
+import android.os.UserHandle;
import android.os.Vibrator;
import android.provider.Settings;
import android.util.Log;
@@ -128,8 +129,8 @@ public class SoundButton extends PowerButton {
}
private void updateSettings(ContentResolver resolver) {
- String[] modes = parseStoredValue(Settings.System.getString(
- resolver, Settings.System.EXPANDED_RING_MODE));
+ String[] modes = parseStoredValue(Settings.System.getStringForUser(
+ resolver, Settings.System.EXPANDED_RING_MODE, UserHandle.USER_CURRENT));
if (modes == null || modes.length == 0) {
mRingerValues = new int[] {
0, 1, 2, 3
@@ -146,8 +147,8 @@ public class SoundButton extends PowerButton {
ensureAudioManager(context);
ContentResolver resolver = context.getContentResolver();
- boolean vibrateWhenRinging = Settings.System.getInt(resolver,
- Settings.System.VIBRATE_WHEN_RINGING, 0) == 1;
+ boolean vibrateWhenRinging = Settings.System.getIntForUser(resolver,
+ Settings.System.VIBRATE_WHEN_RINGING, 0, UserHandle.USER_CURRENT) == 1;
int ringerMode = mAudioManager.getRingerMode();
Ringer ringer = new Ringer(ringerMode, vibrateWhenRinging);
for (int i = 0; i < mRingers.length; i++) {
@@ -183,8 +184,8 @@ public class SoundButton extends PowerButton {
// Set the desired state
ContentResolver resolver = context.getContentResolver();
- Settings.System.putInt(resolver, Settings.System.VIBRATE_WHEN_RINGING,
- (mVibrateWhenRinging ? 1 : 0));
+ Settings.System.putIntForUser(resolver, Settings.System.VIBRATE_WHEN_RINGING,
+ (mVibrateWhenRinging ? 1 : 0), UserHandle.USER_CURRENT);
mAudioManager.setRingerMode(mRingerMode);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index 5d37af2..d40bff6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -76,6 +76,7 @@ import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.BluetoothController;
import com.android.systemui.statusbar.policy.CircleBattery;
+import com.android.systemui.statusbar.policy.Clock;
import com.android.systemui.statusbar.policy.CompatModeButton;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.NetworkController;
@@ -163,6 +164,9 @@ public class TabletStatusBar extends BaseStatusBar implements
ViewGroup mBarContents;
+ SignalClusterView mSignalView;
+ Clock mClock;
+
// hide system chrome ("lights out") support
View mShadow;
@@ -181,9 +185,6 @@ public class TabletStatusBar extends BaseStatusBar implements
private InputMethodsPanel mInputMethodsPanel;
private CompatModePanel mCompatModePanel;
- // clock
- private boolean mShowClock;
-
private int mSystemUiVisibility = 0;
private int mNavigationIconHints = 0;
@@ -559,9 +560,10 @@ public class TabletStatusBar extends BaseStatusBar implements
mBluetoothController.addIconView((ImageView)sb.findViewById(R.id.bluetooth));
mNetworkController = new NetworkController(mContext);
- final SignalClusterView signalCluster =
- (SignalClusterView)sb.findViewById(R.id.signal_cluster);
- mNetworkController.addSignalCluster(signalCluster);
+ mSignalView = (SignalClusterView) sb.findViewById(R.id.signal_cluster);
+ mNetworkController.addSignalCluster(mSignalView);
+
+ mClock = (Clock) sb.findViewById(R.id.clock);
// The navigation buttons
mBackButton = (ImageView)sb.findViewById(R.id.back);
@@ -943,16 +945,12 @@ public class TabletStatusBar extends BaseStatusBar implements
}
public void showClock(boolean show) {
- ContentResolver resolver = mContext.getContentResolver();
- View clock = mBarContents.findViewById(R.id.clock);
- View network_text = mBarContents.findViewById(R.id.network_text);
- mShowClock = (Settings.System.getInt(resolver,
- Settings.System.STATUS_BAR_CLOCK, 1) == 1);
- if (clock != null) {
- clock.setVisibility(show ? (mShowClock ? View.VISIBLE : View.GONE) : View.GONE);
+ if (mClock != null) {
+ mClock.setHidden(!show);
}
- if (network_text != null) {
- network_text.setVisibility((!show) ? View.VISIBLE : View.GONE);
+ View networkText = mBarContents.findViewById(R.id.network_text);
+ if (networkText != null) {
+ networkText.setVisibility(show ? View.GONE : View.VISIBLE);
}
}
@@ -1615,6 +1613,20 @@ public class TabletStatusBar extends BaseStatusBar implements
return mNotificationPanel.getVisibility() == View.VISIBLE
|| (mDisabled & StatusBarManager.DISABLE_HOME) != 0;
}
+
+ @Override
+ public void userSwitched(int newUserId) {
+ if (mSignalView != null) {
+ mSignalView.updateSettings();
+ }
+ if (mClock != null) {
+ mClock.updateSettings();
+ }
+ if (mBatteryController != null) {
+ mBatteryController.updateSettings();
+ }
+ super.userSwitched(newUserId);
+ }
}