summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-09-25 17:02:26 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-09-25 17:03:11 -0700
commitb32e221699201cb647beae3fe0a1771fd5a41cf4 (patch)
tree54d5f76a31728976ba75e590c077cefc1448ac82 /services
parent0a52088e58a6ddea0966ba9cd2fbc7bd3e23809a (diff)
parentbf6f6f9de72c9fd15e6bda9f228c05a9b37d6324 (diff)
downloadframeworks_base-b32e221699201cb647beae3fe0a1771fd5a41cf4.zip
frameworks_base-b32e221699201cb647beae3fe0a1771fd5a41cf4.tar.gz
frameworks_base-b32e221699201cb647beae3fe0a1771fd5a41cf4.tar.bz2
Merge changes I332f020f,I632648ac into jb-mr1-dev
* changes: Update references to migrated global settings. Handle user switched for settings changes.
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/BackupManagerService.java8
-rwxr-xr-xservices/java/com/android/server/BluetoothManagerService.java8
-rw-r--r--services/java/com/android/server/ConnectivityService.java18
-rw-r--r--services/java/com/android/server/DockObserver.java18
-rw-r--r--services/java/com/android/server/NetworkTimeUpdateService.java6
-rwxr-xr-xservices/java/com/android/server/NotificationManagerService.java4
-rw-r--r--services/java/com/android/server/SamplingProfilerService.java6
-rwxr-xr-xservices/java/com/android/server/VibratorService.java17
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java8
-rw-r--r--services/java/com/android/server/connectivity/Tethering.java4
-rw-r--r--services/java/com/android/server/display/OverlayDisplayAdapter.java42
-rw-r--r--services/java/com/android/server/input/InputManagerService.java20
-rwxr-xr-xservices/java/com/android/server/location/GpsLocationProvider.java8
-rw-r--r--services/java/com/android/server/pm/PackageManagerService.java4
-rw-r--r--services/java/com/android/server/power/PowerManagerService.java72
-rw-r--r--services/java/com/android/server/usb/UsbDeviceManager.java8
-rwxr-xr-xservices/java/com/android/server/wm/WindowManagerService.java4
17 files changed, 149 insertions, 106 deletions
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 5e2b425..15fc479 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -729,14 +729,14 @@ class BackupManagerService extends IBackupManager.Stub {
final ContentResolver resolver = context.getContentResolver();
boolean areEnabled = Settings.Secure.getInt(resolver,
Settings.Secure.BACKUP_ENABLED, 0) != 0;
- mProvisioned = Settings.Secure.getInt(resolver,
- Settings.Secure.DEVICE_PROVISIONED, 0) != 0;
+ mProvisioned = Settings.Global.getInt(resolver,
+ Settings.Global.DEVICE_PROVISIONED, 0) != 0;
mAutoRestore = Settings.Secure.getInt(resolver,
Settings.Secure.BACKUP_AUTO_RESTORE, 1) != 0;
mProvisionedObserver = new ProvisionedObserver(mBackupHandler);
resolver.registerContentObserver(
- Settings.Secure.getUriFor(Settings.Secure.DEVICE_PROVISIONED),
+ Settings.Global.getUriFor(Settings.Global.DEVICE_PROVISIONED),
false, mProvisionedObserver);
// If Encrypted file systems is enabled or disabled, this call will return the
@@ -4956,7 +4956,7 @@ class BackupManagerService extends IBackupManager.Stub {
boolean deviceIsProvisioned() {
final ContentResolver resolver = mContext.getContentResolver();
- return (Settings.Secure.getInt(resolver, Settings.Secure.DEVICE_PROVISIONED, 0) != 0);
+ return (Settings.Global.getInt(resolver, Settings.Global.DEVICE_PROVISIONED, 0) != 0);
}
// Run a *full* backup pass for the given package, writing the resulting data stream
diff --git a/services/java/com/android/server/BluetoothManagerService.java b/services/java/com/android/server/BluetoothManagerService.java
index e68686d..aa5ae3d 100755
--- a/services/java/com/android/server/BluetoothManagerService.java
+++ b/services/java/com/android/server/BluetoothManagerService.java
@@ -159,8 +159,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
* Returns true if the Bluetooth saved state is "on"
*/
private final boolean isBluetoothPersistedStateOn() {
- return Settings.Secure.getInt(mContentResolver,
- Settings.Secure.BLUETOOTH_ON, 0) ==1;
+ return Settings.Global.getInt(mContentResolver,
+ Settings.Global.BLUETOOTH_ON, 0) ==1;
}
/**
@@ -168,8 +168,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
*
*/
private void persistBluetoothSetting(boolean setOn) {
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.BLUETOOTH_ON,
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.BLUETOOTH_ON,
setOn ? 1 : 0);
}
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 9676eb9..ceb17c7 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -701,7 +701,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
mNetConfigs[preference].isDefault()) {
if (mNetworkPreference != preference) {
final ContentResolver cr = mContext.getContentResolver();
- Settings.Secure.putInt(cr, Settings.Secure.NETWORK_PREFERENCE, preference);
+ Settings.Global.putInt(cr, Settings.Global.NETWORK_PREFERENCE, preference);
synchronized(this) {
mNetworkPreference = preference;
}
@@ -724,8 +724,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private int getPersistedNetworkPreference() {
final ContentResolver cr = mContext.getContentResolver();
- final int networkPrefSetting = Settings.Secure
- .getInt(cr, Settings.Secure.NETWORK_PREFERENCE, -1);
+ final int networkPrefSetting = Settings.Global
+ .getInt(cr, Settings.Global.NETWORK_PREFERENCE, -1);
if (networkPrefSetting != -1) {
return networkPrefSetting;
}
@@ -2108,14 +2108,14 @@ public class ConnectivityService extends IConnectivityManager.Stub {
final int timeout;
if (ConnectivityManager.isNetworkTypeMobile(type)) {
- timeout = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.DATA_ACTIVITY_TIMEOUT_MOBILE,
+ timeout = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE,
0);
// Canonicalize mobile network type
type = ConnectivityManager.TYPE_MOBILE;
} else if (ConnectivityManager.TYPE_WIFI == type) {
- timeout = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.DATA_ACTIVITY_TIMEOUT_WIFI,
+ timeout = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI,
0);
} else {
// do not track any other networks
@@ -2930,8 +2930,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
public boolean isTetheringSupported() {
enforceTetherAccessPermission();
int defaultVal = (SystemProperties.get("ro.tether.denied").equals("true") ? 0 : 1);
- boolean tetherEnabledInSettings = (Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.TETHER_SUPPORTED, defaultVal) != 0);
+ boolean tetherEnabledInSettings = (Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.TETHER_SUPPORTED, defaultVal) != 0);
return tetherEnabledInSettings && mTetheringConfigValid;
}
diff --git a/services/java/com/android/server/DockObserver.java b/services/java/com/android/server/DockObserver.java
index 65c39f2..8ad5a91 100644
--- a/services/java/com/android/server/DockObserver.java
+++ b/services/java/com/android/server/DockObserver.java
@@ -147,8 +147,8 @@ final class DockObserver extends UEventObserver {
final ContentResolver cr = mContext.getContentResolver();
- if (Settings.Secure.getInt(cr,
- Settings.Secure.DEVICE_PROVISIONED, 0) == 0) {
+ if (Settings.Global.getInt(cr,
+ Settings.Global.DEVICE_PROVISIONED, 0) == 0) {
Slog.i(TAG, "Device not provisioned, skipping dock broadcast");
return;
}
@@ -168,29 +168,29 @@ final class DockObserver extends UEventObserver {
// User feedback to confirm dock connection. Particularly
// useful for flaky contact pins...
- if (Settings.System.getInt(cr,
- Settings.System.DOCK_SOUNDS_ENABLED, 1) == 1) {
+ if (Settings.Global.getInt(cr,
+ Settings.Global.DOCK_SOUNDS_ENABLED, 1) == 1) {
String whichSound = null;
if (mDockState == Intent.EXTRA_DOCK_STATE_UNDOCKED) {
if ((mPreviousDockState == Intent.EXTRA_DOCK_STATE_DESK) ||
(mPreviousDockState == Intent.EXTRA_DOCK_STATE_LE_DESK) ||
(mPreviousDockState == Intent.EXTRA_DOCK_STATE_HE_DESK)) {
- whichSound = Settings.System.DESK_UNDOCK_SOUND;
+ whichSound = Settings.Global.DESK_UNDOCK_SOUND;
} else if (mPreviousDockState == Intent.EXTRA_DOCK_STATE_CAR) {
- whichSound = Settings.System.CAR_UNDOCK_SOUND;
+ whichSound = Settings.Global.CAR_UNDOCK_SOUND;
}
} else {
if ((mDockState == Intent.EXTRA_DOCK_STATE_DESK) ||
(mDockState == Intent.EXTRA_DOCK_STATE_LE_DESK) ||
(mDockState == Intent.EXTRA_DOCK_STATE_HE_DESK)) {
- whichSound = Settings.System.DESK_DOCK_SOUND;
+ whichSound = Settings.Global.DESK_DOCK_SOUND;
} else if (mDockState == Intent.EXTRA_DOCK_STATE_CAR) {
- whichSound = Settings.System.CAR_DOCK_SOUND;
+ whichSound = Settings.Global.CAR_DOCK_SOUND;
}
}
if (whichSound != null) {
- final String soundPath = Settings.System.getString(cr, whichSound);
+ final String soundPath = Settings.Global.getString(cr, whichSound);
if (soundPath != null) {
final Uri soundUri = Uri.parse("file://" + soundPath);
if (soundUri != null) {
diff --git a/services/java/com/android/server/NetworkTimeUpdateService.java b/services/java/com/android/server/NetworkTimeUpdateService.java
index 76972bc..790be55 100644
--- a/services/java/com/android/server/NetworkTimeUpdateService.java
+++ b/services/java/com/android/server/NetworkTimeUpdateService.java
@@ -215,8 +215,8 @@ public class NetworkTimeUpdateService {
* Checks if the user prefers to automatically set the time.
*/
private boolean isAutomaticTimeRequested() {
- return Settings.System.getInt(mContext.getContentResolver(), Settings.System.AUTO_TIME, 0)
- != 0;
+ return Settings.Global.getInt(
+ mContext.getContentResolver(), Settings.Global.AUTO_TIME, 0) != 0;
}
/** Receiver for Nitz time events */
@@ -289,7 +289,7 @@ public class NetworkTimeUpdateService {
void observe(Context context) {
ContentResolver resolver = context.getContentResolver();
- resolver.registerContentObserver(Settings.System.getUriFor(Settings.System.AUTO_TIME),
+ resolver.registerContentObserver(Settings.Global.getUriFor(Settings.Global.AUTO_TIME),
false, this);
}
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index bab4f7a..76194ae 100755
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -626,8 +626,8 @@ public class NotificationManagerService extends INotificationManager.Stub
// After that, including subsequent boots, init with notifications turned on.
// This works on the first boot because the setup wizard will toggle this
// flag at least once and we'll go back to 0 after that.
- if (0 == Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.DEVICE_PROVISIONED, 0)) {
+ if (0 == Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.DEVICE_PROVISIONED, 0)) {
mDisabledNotifications = StatusBarManager.DISABLE_NOTIFICATION_ALERTS;
}
diff --git a/services/java/com/android/server/SamplingProfilerService.java b/services/java/com/android/server/SamplingProfilerService.java
index 0034d2c..fbf1aa4 100644
--- a/services/java/com/android/server/SamplingProfilerService.java
+++ b/services/java/com/android/server/SamplingProfilerService.java
@@ -90,7 +90,7 @@ public class SamplingProfilerService extends Binder {
private void registerSettingObserver(Context context) {
ContentResolver contentResolver = context.getContentResolver();
contentResolver.registerContentObserver(
- Settings.Secure.getUriFor(Settings.Secure.SAMPLING_PROFILER_MS),
+ Settings.Global.getUriFor(Settings.Global.SAMPLING_PROFILER_MS),
false, new SamplingProfilerSettingsObserver(contentResolver));
}
@@ -111,8 +111,8 @@ public class SamplingProfilerService extends Binder {
}
@Override
public void onChange(boolean selfChange) {
- Integer samplingProfilerMs = Settings.Secure.getInt(
- mContentResolver, Settings.Secure.SAMPLING_PROFILER_MS, 0);
+ Integer samplingProfilerMs = Settings.Global.getInt(
+ mContentResolver, Settings.Global.SAMPLING_PROFILER_MS, 0);
// setting this secure property will start or stop sampling profiler,
// as well as adjust the the time between taking snapshots.
SystemProperties.set("persist.sys.profiler_ms", samplingProfilerMs.toString());
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/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 3427699..b266bd4 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -2266,8 +2266,8 @@ public final class ActivityManagerService extends ActivityManagerNative
// low-level factory test mode.
final ContentResolver resolver = mContext.getContentResolver();
if (mFactoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL &&
- Settings.Secure.getInt(resolver,
- Settings.Secure.DEVICE_PROVISIONED, 0) != 0) {
+ Settings.Global.getInt(resolver,
+ Settings.Global.DEVICE_PROVISIONED, 0) != 0) {
mCheckedForSetup = true;
// See if we should be showing the platform update setup UI.
@@ -8312,8 +8312,8 @@ public final class ActivityManagerService extends ActivityManagerNative
addErrorToDropBox("wtf", r, processName, null, null, tag, null, null, crashInfo);
if (r != null && r.pid != Process.myPid() &&
- Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.WTF_IS_FATAL, 0) != 0) {
+ Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.WTF_IS_FATAL, 0) != 0) {
crashApplication(r, crashInfo);
return true;
} else {
diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java
index d8f3546..b38d617 100644
--- a/services/java/com/android/server/connectivity/Tethering.java
+++ b/services/java/com/android/server/connectivity/Tethering.java
@@ -627,8 +627,8 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
}
public void checkDunRequired() {
- int secureSetting = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.TETHER_DUN_REQUIRED, 2);
+ int secureSetting = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.TETHER_DUN_REQUIRED, 2);
synchronized (mPublicSync) {
// 2 = not set, 0 = DUN not required, 1 = DUN required
if (secureSetting != 2) {
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/location/GpsLocationProvider.java b/services/java/com/android/server/location/GpsLocationProvider.java
index bb11fe7..28870a2 100755
--- a/services/java/com/android/server/location/GpsLocationProvider.java
+++ b/services/java/com/android/server/location/GpsLocationProvider.java
@@ -535,8 +535,8 @@ public class GpsLocationProvider implements LocationProviderInterface {
}
if (info != null) {
- boolean dataEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.MOBILE_DATA, 1) == 1;
+ boolean dataEnabled = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.MOBILE_DATA, 1) == 1;
boolean networkAvailable = info.isAvailable() && dataEnabled;
String defaultApn = getSelectedApn();
if (defaultApn == null) {
@@ -952,8 +952,8 @@ public class GpsLocationProvider implements LocationProviderInterface {
mStarted = true;
mPositionMode = GPS_POSITION_MODE_STANDALONE;
- if (Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.ASSISTED_GPS_ENABLED, 1) != 0) {
+ if (Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.ASSISTED_GPS_ENABLED, 1) != 0) {
if (hasCapability(GPS_CAPABILITY_MSB)) {
mPositionMode = GPS_POSITION_MODE_MS_BASED;
}
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index 4800e7db..c4cdd07 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -5907,8 +5907,8 @@ public class PackageManagerService extends IPackageManager.Stub {
* @return the current "allow unknown sources" setting
*/
private int getUnknownSourcesSettings() {
- return android.provider.Settings.Secure.getInt(mContext.getContentResolver(),
- android.provider.Settings.Secure.INSTALL_NON_MARKET_APPS,
+ return android.provider.Settings.Global.getInt(mContext.getContentResolver(),
+ android.provider.Settings.Global.INSTALL_NON_MARKET_APPS,
-1);
}
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);
diff --git a/services/java/com/android/server/usb/UsbDeviceManager.java b/services/java/com/android/server/usb/UsbDeviceManager.java
index 8f13501..10011aa 100644
--- a/services/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/java/com/android/server/usb/UsbDeviceManager.java
@@ -124,8 +124,8 @@ public class UsbDeviceManager {
}
@Override
public void onChange(boolean selfChange) {
- boolean enable = (Settings.Secure.getInt(mContentResolver,
- Settings.Secure.ADB_ENABLED, 0) > 0);
+ boolean enable = (Settings.Global.getInt(mContentResolver,
+ Settings.Global.ADB_ENABLED, 0) > 0);
mHandler.sendMessage(MSG_ENABLE_ADB, enable);
}
}
@@ -190,7 +190,7 @@ public class UsbDeviceManager {
mUseUsbNotification = !massStorageSupported;
// make sure the ADB_ENABLED setting value matches the current state
- Settings.Secure.putInt(mContentResolver, Settings.Secure.ADB_ENABLED, mAdbEnabled ? 1 : 0);
+ Settings.Global.putInt(mContentResolver, Settings.Global.ADB_ENABLED, mAdbEnabled ? 1 : 0);
mHandler.sendEmptyMessage(MSG_SYSTEM_READY);
}
@@ -351,7 +351,7 @@ public class UsbDeviceManager {
// register observer to listen for settings changes
mContentResolver.registerContentObserver(
- Settings.Secure.getUriFor(Settings.Secure.ADB_ENABLED),
+ Settings.Global.getUriFor(Settings.Global.ADB_ENABLED),
false, new AdbSettingsObserver());
// Watch for USB configuration changes
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index c09c261..efedbd8 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -7946,8 +7946,8 @@ public class WindowManagerService extends IWindowManager.Stub
synchronized(mWindowMap) {
final DisplayContent displayContent = getDisplayContentLocked(displayId);
setForcedDisplayDensityLocked(displayContent, displayContent.mInitialDisplayDensity);
- Settings.Secure.putString(mContext.getContentResolver(),
- Settings.Secure.DISPLAY_DENSITY_FORCED, "");
+ Settings.Global.putString(mContext.getContentResolver(),
+ Settings.Global.DISPLAY_DENSITY_FORCED, "");
}
}