summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/java/android/provider/Settings.java37
-rwxr-xr-xservices/java/com/android/server/VibratorService.java17
-rw-r--r--services/java/com/android/server/display/OverlayDisplayAdapter.java42
-rw-r--r--services/java/com/android/server/input/InputManagerService.java20
-rw-r--r--services/java/com/android/server/power/PowerManagerService.java72
5 files changed, 115 insertions, 73 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 9aae1ec..2c3e519 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -4851,25 +4851,6 @@ public final class Settings {
"contacts_preauth_uri_expiration";
/**
- * Overlay display devices setting.
- * The associated value is a specially formatted string that describes the
- * size and density of simulated secondary display devices.
- * <p>
- * Format: {width}x{height}/{dpi};...
- * </p><p>
- * Example:
- * <ul>
- * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li>
- * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first
- * at 1080p and the second at 720p.</li>
- * <li>If the value is empty, then no overlay display devices are created.</li>
- * </ul></p>
- *
- * @hide
- */
- public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
-
- /**
* This are the settings to be backed up.
*
* NOTE: Settings are backed up and restored in the order they appear
@@ -5741,6 +5722,24 @@ public final class Settings {
*/
public static final String MODE_RINGER = "mode_ringer";
+ /**
+ * Overlay display devices setting.
+ * The associated value is a specially formatted string that describes the
+ * size and density of simulated secondary display devices.
+ * <p>
+ * Format: {width}x{height}/{dpi};...
+ * </p><p>
+ * Example:
+ * <ul>
+ * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li>
+ * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first
+ * at 1080p and the second at 720p.</li>
+ * <li>If the value is empty, then no overlay display devices are created.</li>
+ * </ul></p>
+ *
+ * @hide
+ */
+ public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
// Populated lazily, guarded by class object:
private static NameValueCache sNameValueCache = new NameValueCache(
diff --git a/services/java/com/android/server/VibratorService.java b/services/java/com/android/server/VibratorService.java
index 72fde11..df91dec 100755
--- a/services/java/com/android/server/VibratorService.java
+++ b/services/java/com/android/server/VibratorService.java
@@ -31,6 +31,7 @@ import android.os.RemoteException;
import android.os.IBinder;
import android.os.Binder;
import android.os.SystemClock;
+import android.os.UserHandle;
import android.os.Vibrator;
import android.os.WorkSource;
import android.provider.Settings;
@@ -139,6 +140,7 @@ public class VibratorService extends IVibratorService.Stub
public void systemReady() {
mIm = (InputManager)mContext.getSystemService(Context.INPUT_SERVICE);
+
mContext.getContentResolver().registerContentObserver(
Settings.System.getUriFor(Settings.System.VIBRATE_INPUT_DEVICES), true,
new ContentObserver(mH) {
@@ -146,7 +148,15 @@ public class VibratorService extends IVibratorService.Stub
public void onChange(boolean selfChange) {
updateInputDeviceVibrators();
}
- });
+ }, UserHandle.USER_ALL);
+
+ mContext.registerReceiver(new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ updateInputDeviceVibrators();
+ }
+ }, new IntentFilter(Intent.ACTION_USER_SWITCHED), null, mH);
+
updateInputDeviceVibrators();
}
@@ -341,8 +351,9 @@ public class VibratorService extends IVibratorService.Stub
synchronized (mInputDeviceVibrators) {
mVibrateInputDevicesSetting = false;
try {
- mVibrateInputDevicesSetting = Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.VIBRATE_INPUT_DEVICES) > 0;
+ mVibrateInputDevicesSetting = Settings.System.getIntForUser(
+ mContext.getContentResolver(),
+ Settings.System.VIBRATE_INPUT_DEVICES, UserHandle.USER_CURRENT) > 0;
} catch (SettingNotFoundException snfe) {
}
diff --git a/services/java/com/android/server/display/OverlayDisplayAdapter.java b/services/java/com/android/server/display/OverlayDisplayAdapter.java
index 75ddd24..0767fc0 100644
--- a/services/java/com/android/server/display/OverlayDisplayAdapter.java
+++ b/services/java/com/android/server/display/OverlayDisplayAdapter.java
@@ -19,10 +19,14 @@ package com.android.server.display;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.IndentingPrintWriter;
+import android.content.BroadcastReceiver;
import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
import android.database.ContentObserver;
import android.os.Handler;
import android.os.IBinder;
+import android.os.UserHandle;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.Slog;
@@ -88,19 +92,28 @@ final class OverlayDisplayAdapter extends DisplayAdapter {
@Override
public void run() {
getContext().getContentResolver().registerContentObserver(
- Settings.System.getUriFor(Settings.Secure.OVERLAY_DISPLAY_DEVICES),
- true, new SettingsObserver(getHandler()));
-
- synchronized (getSyncRoot()) {
- updateOverlayDisplayDevicesLocked();
- }
+ Settings.Global.getUriFor(Settings.Global.OVERLAY_DISPLAY_DEVICES),
+ true, new ContentObserver(getHandler()) {
+ @Override
+ public void onChange(boolean selfChange) {
+ updateOverlayDisplayDevices();
+ }
+ });
+
+ updateOverlayDisplayDevices();
}
});
}
+ private void updateOverlayDisplayDevices() {
+ synchronized (getSyncRoot()) {
+ updateOverlayDisplayDevicesLocked();
+ }
+ }
+
private void updateOverlayDisplayDevicesLocked() {
- String value = Settings.System.getString(getContext().getContentResolver(),
- Settings.Secure.OVERLAY_DISPLAY_DEVICES);
+ String value = Settings.Global.getString(getContext().getContentResolver(),
+ Settings.Global.OVERLAY_DISPLAY_DEVICES);
if (value == null) {
value = "";
}
@@ -171,19 +184,6 @@ final class OverlayDisplayAdapter extends DisplayAdapter {
}
}
- private final class SettingsObserver extends ContentObserver {
- public SettingsObserver(Handler handler) {
- super(handler);
- }
-
- @Override
- public void onChange(boolean selfChange) {
- synchronized (getSyncRoot()) {
- updateOverlayDisplayDevicesLocked();
- }
- }
- }
-
private final class OverlayDisplayDevice extends DisplayDevice {
private final String mName;
private final int mWidth;
diff --git a/services/java/com/android/server/input/InputManagerService.java b/services/java/com/android/server/input/InputManagerService.java
index 948c0e0..0b4a721 100644
--- a/services/java/com/android/server/input/InputManagerService.java
+++ b/services/java/com/android/server/input/InputManagerService.java
@@ -241,6 +241,14 @@ public class InputManagerService extends IInputManager.Stub
registerPointerSpeedSettingObserver();
registerShowTouchesSettingObserver();
+ mContext.registerReceiver(new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ updatePointerSpeedFromSettings();
+ updateShowTouchesFromSettings();
+ }
+ }, new IntentFilter(Intent.ACTION_USER_SWITCHED), null, mHandler);
+
updatePointerSpeedFromSettings();
updateShowTouchesFromSettings();
}
@@ -1073,14 +1081,14 @@ public class InputManagerService extends IInputManager.Stub
public void onChange(boolean selfChange) {
updatePointerSpeedFromSettings();
}
- });
+ }, UserHandle.USER_ALL);
}
private int getPointerSpeedSetting() {
int speed = InputManager.DEFAULT_POINTER_SPEED;
try {
- speed = Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.POINTER_SPEED);
+ speed = Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.POINTER_SPEED, UserHandle.USER_CURRENT);
} catch (SettingNotFoundException snfe) {
}
return speed;
@@ -1099,14 +1107,14 @@ public class InputManagerService extends IInputManager.Stub
public void onChange(boolean selfChange) {
updateShowTouchesFromSettings();
}
- });
+ }, UserHandle.USER_ALL);
}
private int getShowTouchesSetting(int defaultValue) {
int result = defaultValue;
try {
- result = Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.SHOW_TOUCHES);
+ result = Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.SHOW_TOUCHES, UserHandle.USER_CURRENT);
} catch (SettingNotFoundException snfe) {
}
return result;
diff --git a/services/java/com/android/server/power/PowerManagerService.java b/services/java/com/android/server/power/PowerManagerService.java
index 7052ed5..030eb5e 100644
--- a/services/java/com/android/server/power/PowerManagerService.java
+++ b/services/java/com/android/server/power/PowerManagerService.java
@@ -48,6 +48,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
+import android.os.UserHandle;
import android.os.WorkSource;
import android.provider.Settings;
import android.service.dreams.Dream;
@@ -357,34 +358,44 @@ public final class PowerManagerService extends IPowerManager.Stub
// Register for broadcasts from other components of the system.
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
- mContext.registerReceiver(new BatteryReceiver(), filter);
+ mContext.registerReceiver(new BatteryReceiver(), filter, null, mHandler);
filter = new IntentFilter();
filter.addAction(Intent.ACTION_BOOT_COMPLETED);
- mContext.registerReceiver(new BootCompletedReceiver(), filter);
+ mContext.registerReceiver(new BootCompletedReceiver(), filter, null, mHandler);
filter = new IntentFilter();
filter.addAction(Intent.ACTION_DOCK_EVENT);
- mContext.registerReceiver(new DockReceiver(), filter);
+ mContext.registerReceiver(new DockReceiver(), filter, null, mHandler);
filter = new IntentFilter();
filter.addAction(Dream.ACTION_DREAMING_STOPPED);
- mContext.registerReceiver(new DreamReceiver(), filter);
+ mContext.registerReceiver(new DreamReceiver(), filter, null, mHandler);
+
+ filter = new IntentFilter();
+ filter.addAction(Intent.ACTION_USER_SWITCHED);
+ mContext.registerReceiver(new UserSwitchedReceiver(), filter, null, mHandler);
// Register for settings changes.
final ContentResolver resolver = mContext.getContentResolver();
resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.SCREENSAVER_ENABLED), false, mSettingsObserver);
+ Settings.Secure.SCREENSAVER_ENABLED),
+ false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP), false, mSettingsObserver);
+ Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP),
+ false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.System.getUriFor(
- Settings.System.SCREEN_OFF_TIMEOUT), false, mSettingsObserver);
+ Settings.System.SCREEN_OFF_TIMEOUT),
+ false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.Global.getUriFor(
- Settings.Global.STAY_ON_WHILE_PLUGGED_IN), false, mSettingsObserver);
+ Settings.Global.STAY_ON_WHILE_PLUGGED_IN),
+ false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.System.getUriFor(
- Settings.System.SCREEN_BRIGHTNESS), false, mSettingsObserver);
+ Settings.System.SCREEN_BRIGHTNESS),
+ false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.System.getUriFor(
- Settings.System.SCREEN_BRIGHTNESS_MODE), false, mSettingsObserver);
+ Settings.System.SCREEN_BRIGHTNESS_MODE),
+ false, mSettingsObserver, UserHandle.USER_ALL);
// Go.
readConfigurationLocked();
@@ -406,34 +417,38 @@ public final class PowerManagerService extends IPowerManager.Stub
private void updateSettingsLocked() {
final ContentResolver resolver = mContext.getContentResolver();
- mDreamsEnabledSetting = (Settings.Secure.getInt(resolver,
- Settings.Secure.SCREENSAVER_ENABLED, 0) != 0);
- mDreamsActivateOnSleepSetting = (Settings.Secure.getInt(resolver,
- Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 0) != 0);
- mScreenOffTimeoutSetting = Settings.System.getInt(resolver,
- Settings.System.SCREEN_OFF_TIMEOUT, DEFAULT_SCREEN_OFF_TIMEOUT);
+ mDreamsEnabledSetting = (Settings.Secure.getIntForUser(resolver,
+ Settings.Secure.SCREENSAVER_ENABLED, 0,
+ UserHandle.USER_CURRENT) != 0);
+ mDreamsActivateOnSleepSetting = (Settings.Secure.getIntForUser(resolver,
+ Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 0,
+ UserHandle.USER_CURRENT) != 0);
+ mScreenOffTimeoutSetting = Settings.System.getIntForUser(resolver,
+ Settings.System.SCREEN_OFF_TIMEOUT, DEFAULT_SCREEN_OFF_TIMEOUT,
+ UserHandle.USER_CURRENT);
mStayOnWhilePluggedInSetting = Settings.Global.getInt(resolver,
- Settings.Global.STAY_ON_WHILE_PLUGGED_IN,
- BatteryManager.BATTERY_PLUGGED_AC);
+ Settings.Global.STAY_ON_WHILE_PLUGGED_IN, BatteryManager.BATTERY_PLUGGED_AC);
final int oldScreenBrightnessSetting = mScreenBrightnessSetting;
- mScreenBrightnessSetting = Settings.System.getInt(resolver,
- Settings.System.SCREEN_BRIGHTNESS, mScreenBrightnessSettingDefault);
+ mScreenBrightnessSetting = Settings.System.getIntForUser(resolver,
+ Settings.System.SCREEN_BRIGHTNESS, mScreenBrightnessSettingDefault,
+ UserHandle.USER_CURRENT);
if (oldScreenBrightnessSetting != mScreenBrightnessSetting) {
mTemporaryScreenBrightnessSettingOverride = -1;
}
final float oldScreenAutoBrightnessAdjustmentSetting =
mScreenAutoBrightnessAdjustmentSetting;
- mScreenAutoBrightnessAdjustmentSetting = Settings.System.getFloat(resolver,
- Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, 0.0f);
+ mScreenAutoBrightnessAdjustmentSetting = Settings.System.getFloatForUser(resolver,
+ Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, 0.0f,
+ UserHandle.USER_CURRENT);
if (oldScreenAutoBrightnessAdjustmentSetting != mScreenAutoBrightnessAdjustmentSetting) {
mTemporaryScreenAutoBrightnessAdjustmentSettingOverride = Float.NaN;
}
- mScreenBrightnessModeSetting = Settings.System.getInt(resolver,
+ mScreenBrightnessModeSetting = Settings.System.getIntForUser(resolver,
Settings.System.SCREEN_BRIGHTNESS_MODE,
- Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
+ Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL, UserHandle.USER_CURRENT);
mDirty |= DIRTY_SETTINGS;
}
@@ -1962,6 +1977,15 @@ public final class PowerManagerService extends IPowerManager.Stub
}
}
+ private final class UserSwitchedReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ synchronized (mLock) {
+ handleSettingsChangedLocked();
+ }
+ }
+ }
+
private final class SettingsObserver extends ContentObserver {
public SettingsObserver(Handler handler) {
super(handler);