summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/input/InputDispatcher.cpp6
-rw-r--r--services/input/InputDispatcher.h2
-rw-r--r--services/input/InputListener.cpp6
-rw-r--r--services/input/InputListener.h6
-rw-r--r--services/input/InputReader.cpp29
-rw-r--r--services/input/InputReader.h6
-rw-r--r--services/input/tests/InputDispatcher_test.cpp2
-rw-r--r--services/input/tests/InputReader_test.cpp8
-rw-r--r--services/java/com/android/server/AppWidgetServiceImpl.java40
-rw-r--r--services/java/com/android/server/BackupManagerService.java63
-rw-r--r--services/java/com/android/server/BatteryService.java8
-rw-r--r--services/java/com/android/server/ConnectivityService.java44
-rw-r--r--services/java/com/android/server/DevicePolicyManagerService.java6
-rw-r--r--services/java/com/android/server/DeviceStorageMonitorService.java20
-rw-r--r--services/java/com/android/server/DropBoxManagerService.java26
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java31
-rw-r--r--services/java/com/android/server/NsdService.java6
-rw-r--r--services/java/com/android/server/ServiceWatcher.java2
-rw-r--r--services/java/com/android/server/StatusBarManagerService.java26
-rw-r--r--services/java/com/android/server/ThrottleService.java60
-rw-r--r--services/java/com/android/server/UiModeManagerService.java4
-rw-r--r--services/java/com/android/server/Watchdog.java29
-rw-r--r--services/java/com/android/server/accessibility/AccessibilityManagerService.java171
-rw-r--r--services/java/com/android/server/accessibility/TouchExplorer.java5
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java9
-rw-r--r--services/java/com/android/server/display/DisplayManagerService.java43
-rw-r--r--services/java/com/android/server/display/WifiDisplayAdapter.java28
-rw-r--r--services/java/com/android/server/dreams/DreamController.java5
-rw-r--r--services/java/com/android/server/input/InputManagerService.java14
-rw-r--r--services/java/com/android/server/location/LocationBlacklist.java2
-rw-r--r--services/java/com/android/server/net/NetworkStatsService.java6
-rw-r--r--services/java/com/android/server/pm/PackageManagerService.java13
-rwxr-xr-xservices/java/com/android/server/wm/WindowManagerService.java21
-rw-r--r--services/java/com/android/server/wm/WindowState.java17
-rw-r--r--services/jni/com_android_server_input_InputManagerService.cpp12
-rw-r--r--services/tests/servicestests/src/com/android/server/DropBoxTest.java20
-rw-r--r--services/tests/servicestests/src/com/android/server/ThrottleServiceTest.java12
37 files changed, 516 insertions, 292 deletions
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp
index 87a6c1b..be0cec9 100644
--- a/services/input/InputDispatcher.cpp
+++ b/services/input/InputDispatcher.cpp
@@ -2485,15 +2485,15 @@ bool InputDispatcher::shouldSendMotionToInputFilterLocked(const NotifyMotionArgs
void InputDispatcher::notifySwitch(const NotifySwitchArgs* args) {
#if DEBUG_INBOUND_EVENT_DETAILS
- ALOGD("notifySwitch - eventTime=%lld, policyFlags=0x%x, switchCode=%d, switchValue=%d",
+ ALOGD("notifySwitch - eventTime=%lld, policyFlags=0x%x, switchValues=0x%08x, switchMask=0x%08x",
args->eventTime, args->policyFlags,
- args->switchCode, args->switchValue);
+ args->switchValues, args->switchMask);
#endif
uint32_t policyFlags = args->policyFlags;
policyFlags |= POLICY_FLAG_TRUSTED;
mPolicy->notifySwitch(args->eventTime,
- args->switchCode, args->switchValue, policyFlags);
+ args->switchValues, args->switchMask, policyFlags);
}
void InputDispatcher::notifyDeviceReset(const NotifyDeviceResetArgs* args) {
diff --git a/services/input/InputDispatcher.h b/services/input/InputDispatcher.h
index af7ff5e..6099c43 100644
--- a/services/input/InputDispatcher.h
+++ b/services/input/InputDispatcher.h
@@ -248,7 +248,7 @@ public:
/* Notifies the policy about switch events.
*/
virtual void notifySwitch(nsecs_t when,
- int32_t switchCode, int32_t switchValue, uint32_t policyFlags) = 0;
+ uint32_t switchValues, uint32_t switchMask, uint32_t policyFlags) = 0;
/* Poke user activity for an event dispatched to a window. */
virtual void pokeUserActivity(nsecs_t eventTime, int32_t eventType) = 0;
diff --git a/services/input/InputListener.cpp b/services/input/InputListener.cpp
index c2705b0..85bb0ed 100644
--- a/services/input/InputListener.cpp
+++ b/services/input/InputListener.cpp
@@ -104,14 +104,14 @@ void NotifyMotionArgs::notify(const sp<InputListenerInterface>& listener) const
// --- NotifySwitchArgs ---
NotifySwitchArgs::NotifySwitchArgs(nsecs_t eventTime, uint32_t policyFlags,
- int32_t switchCode, int32_t switchValue) :
+ uint32_t switchValues, uint32_t switchMask) :
eventTime(eventTime), policyFlags(policyFlags),
- switchCode(switchCode), switchValue(switchValue) {
+ switchValues(switchValues), switchMask(switchMask) {
}
NotifySwitchArgs::NotifySwitchArgs(const NotifySwitchArgs& other) :
eventTime(other.eventTime), policyFlags(other.policyFlags),
- switchCode(other.switchCode), switchValue(other.switchValue) {
+ switchValues(other.switchValues), switchMask(other.switchMask) {
}
void NotifySwitchArgs::notify(const sp<InputListenerInterface>& listener) const {
diff --git a/services/input/InputListener.h b/services/input/InputListener.h
index 486852b..cd7c25a 100644
--- a/services/input/InputListener.h
+++ b/services/input/InputListener.h
@@ -116,13 +116,13 @@ struct NotifyMotionArgs : public NotifyArgs {
struct NotifySwitchArgs : public NotifyArgs {
nsecs_t eventTime;
uint32_t policyFlags;
- int32_t switchCode;
- int32_t switchValue;
+ uint32_t switchValues;
+ uint32_t switchMask;
inline NotifySwitchArgs() { }
NotifySwitchArgs(nsecs_t eventTime, uint32_t policyFlags,
- int32_t switchCode, int32_t switchValue);
+ uint32_t switchValues, uint32_t switchMask);
NotifySwitchArgs(const NotifySwitchArgs& other);
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index d56b9a9..cebfeb4 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -1800,7 +1800,7 @@ void InputMapper::dumpRawAbsoluteAxisInfo(String8& dump,
// --- SwitchInputMapper ---
SwitchInputMapper::SwitchInputMapper(InputDevice* device) :
- InputMapper(device) {
+ InputMapper(device), mUpdatedSwitchValues(0), mUpdatedSwitchMask(0) {
}
SwitchInputMapper::~SwitchInputMapper() {
@@ -1813,14 +1813,33 @@ uint32_t SwitchInputMapper::getSources() {
void SwitchInputMapper::process(const RawEvent* rawEvent) {
switch (rawEvent->type) {
case EV_SW:
- processSwitch(rawEvent->when, rawEvent->code, rawEvent->value);
+ processSwitch(rawEvent->code, rawEvent->value);
break;
+
+ case EV_SYN:
+ if (rawEvent->code == SYN_REPORT) {
+ sync(rawEvent->when);
+ }
}
}
-void SwitchInputMapper::processSwitch(nsecs_t when, int32_t switchCode, int32_t switchValue) {
- NotifySwitchArgs args(when, 0, switchCode, switchValue);
- getListener()->notifySwitch(&args);
+void SwitchInputMapper::processSwitch(int32_t switchCode, int32_t switchValue) {
+ if (switchCode >= 0 && switchCode < 32) {
+ if (switchValue) {
+ mUpdatedSwitchValues |= 1 << switchCode;
+ }
+ mUpdatedSwitchMask |= 1 << switchCode;
+ }
+}
+
+void SwitchInputMapper::sync(nsecs_t when) {
+ if (mUpdatedSwitchMask) {
+ NotifySwitchArgs args(when, 0, mUpdatedSwitchValues, mUpdatedSwitchMask);
+ getListener()->notifySwitch(&args);
+
+ mUpdatedSwitchValues = 0;
+ mUpdatedSwitchMask = 0;
+ }
}
int32_t SwitchInputMapper::getSwitchState(uint32_t sourceMask, int32_t switchCode) {
diff --git a/services/input/InputReader.h b/services/input/InputReader.h
index e1a8dd8..61b21e2 100644
--- a/services/input/InputReader.h
+++ b/services/input/InputReader.h
@@ -962,7 +962,11 @@ public:
virtual int32_t getSwitchState(uint32_t sourceMask, int32_t switchCode);
private:
- void processSwitch(nsecs_t when, int32_t switchCode, int32_t switchValue);
+ uint32_t mUpdatedSwitchValues;
+ uint32_t mUpdatedSwitchMask;
+
+ void processSwitch(int32_t switchCode, int32_t switchValue);
+ void sync(nsecs_t when);
};
diff --git a/services/input/tests/InputDispatcher_test.cpp b/services/input/tests/InputDispatcher_test.cpp
index 961566f..ed2b4a5 100644
--- a/services/input/tests/InputDispatcher_test.cpp
+++ b/services/input/tests/InputDispatcher_test.cpp
@@ -86,7 +86,7 @@ private:
}
virtual void notifySwitch(nsecs_t when,
- int32_t switchCode, int32_t switchValue, uint32_t policyFlags) {
+ uint32_t switchValues, uint32_t switchMask, uint32_t policyFlags) {
}
virtual void pokeUserActivity(nsecs_t eventTime, int32_t eventType) {
diff --git a/services/input/tests/InputReader_test.cpp b/services/input/tests/InputReader_test.cpp
index c6dbbf3..14065d2 100644
--- a/services/input/tests/InputReader_test.cpp
+++ b/services/input/tests/InputReader_test.cpp
@@ -1493,12 +1493,16 @@ TEST_F(SwitchInputMapperTest, Process) {
addMapperAndConfigure(mapper);
process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SW, SW_LID, 1);
+ process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SW, SW_JACK_PHYSICAL_INSERT, 1);
+ process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SW, SW_HEADPHONE_INSERT, 0);
+ process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0);
NotifySwitchArgs args;
ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifySwitchWasCalled(&args));
ASSERT_EQ(ARBITRARY_TIME, args.eventTime);
- ASSERT_EQ(SW_LID, args.switchCode);
- ASSERT_EQ(1, args.switchValue);
+ ASSERT_EQ((1 << SW_LID) | (1 << SW_JACK_PHYSICAL_INSERT), args.switchValues);
+ ASSERT_EQ((1 << SW_LID) | (1 << SW_JACK_PHYSICAL_INSERT) | (1 << SW_HEADPHONE_INSERT),
+ args.switchMask);
ASSERT_EQ(uint32_t(0), args.policyFlags);
}
diff --git a/services/java/com/android/server/AppWidgetServiceImpl.java b/services/java/com/android/server/AppWidgetServiceImpl.java
index 8ec67c4..e77f8cf 100644
--- a/services/java/com/android/server/AppWidgetServiceImpl.java
+++ b/services/java/com/android/server/AppWidgetServiceImpl.java
@@ -534,6 +534,7 @@ class AppWidgetServiceImpl {
final long ident = Binder.clearCallingIdentity();
try {
synchronized (mAppWidgetIds) {
+ options = cloneIfLocalBinder(options);
ensureStateLoadedLocked();
AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
if (id == null) {
@@ -817,7 +818,7 @@ class AppWidgetServiceImpl {
ensureStateLoadedLocked();
AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
if (id != null && id.provider != null && !id.provider.zombie) {
- return id.provider.info;
+ return cloneIfLocalBinder(id.provider.info);
}
return null;
}
@@ -828,7 +829,7 @@ class AppWidgetServiceImpl {
ensureStateLoadedLocked();
AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
if (id != null) {
- return id.views;
+ return cloneIfLocalBinder(id.views);
}
return null;
}
@@ -842,7 +843,7 @@ class AppWidgetServiceImpl {
for (int i = 0; i < N; i++) {
Provider p = mInstalledProviders.get(i);
if (!p.zombie) {
- result.add(p.info);
+ result.add(cloneIfLocalBinder(p.info));
}
}
return result;
@@ -881,6 +882,7 @@ class AppWidgetServiceImpl {
public void updateAppWidgetOptions(int appWidgetId, Bundle options) {
synchronized (mAppWidgetIds) {
+ options = cloneIfLocalBinder(options);
ensureStateLoadedLocked();
AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
@@ -907,7 +909,7 @@ class AppWidgetServiceImpl {
ensureStateLoadedLocked();
AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
if (id != null && id.options != null) {
- return id.options;
+ return cloneIfLocalBinder(id.options);
} else {
return Bundle.EMPTY;
}
@@ -1062,6 +1064,34 @@ class AppWidgetServiceImpl {
}
}
+ private boolean isLocalBinder() {
+ return Process.myPid() == Binder.getCallingPid();
+ }
+
+ private RemoteViews cloneIfLocalBinder(RemoteViews rv) {
+ if (isLocalBinder() && rv != null) {
+ return rv.clone();
+ }
+ return rv;
+ }
+
+ private AppWidgetProviderInfo cloneIfLocalBinder(AppWidgetProviderInfo info) {
+ if (isLocalBinder() && info != null) {
+ return info.clone();
+ }
+ return info;
+ }
+
+ private Bundle cloneIfLocalBinder(Bundle bundle) {
+ // Note: this is only a shallow copy. For now this will be fine, but it could be problematic
+ // if we start adding objects to the options. Further, it would only be an issue if keyguard
+ // used such options.
+ if (isLocalBinder() && bundle != null) {
+ return (Bundle) bundle.clone();
+ }
+ return bundle;
+ }
+
public int[] startListening(IAppWidgetHost callbacks, String packageName, int hostId,
List<RemoteViews> updatedViews) {
int callingUid = enforceCallingUid(packageName);
@@ -1078,7 +1108,7 @@ class AppWidgetServiceImpl {
for (int i = 0; i < N; i++) {
AppWidgetId id = instances.get(i);
updatedIds[i] = id.appWidgetId;
- updatedViews.add(id.views);
+ updatedViews.add(cloneIfLocalBinder(id.views));
}
return updatedIds;
}
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 15fc479..9f01eca 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -2451,6 +2451,21 @@ class BackupManagerService extends IBackupManager.Stub {
}
}
+ // Cull any packages that run as system-domain uids but do not define their
+ // own backup agents
+ for (int i = 0; i < packagesToBackup.size(); ) {
+ PackageInfo pkg = packagesToBackup.get(i);
+ if ((pkg.applicationInfo.uid < Process.FIRST_APPLICATION_UID)
+ && (pkg.applicationInfo.backupAgentName == null)) {
+ if (MORE_DEBUG) {
+ Slog.i(TAG, "... ignoring non-agent system package " + pkg.packageName);
+ }
+ packagesToBackup.remove(i);
+ } else {
+ i++;
+ }
+ }
+
FileOutputStream ofstream = new FileOutputStream(mOutputFile.getFileDescriptor());
OutputStream out = null;
@@ -3669,29 +3684,37 @@ class BackupManagerService extends IBackupManager.Stub {
// Fall through to IGNORE if the app explicitly disallows backup
final int flags = pkgInfo.applicationInfo.flags;
if ((flags & ApplicationInfo.FLAG_ALLOW_BACKUP) != 0) {
- // Verify signatures against any installed version; if they
- // don't match, then we fall though and ignore the data. The
- // signatureMatch() method explicitly ignores the signature
- // check for packages installed on the system partition, because
- // such packages are signed with the platform cert instead of
- // the app developer's cert, so they're different on every
- // device.
- if (signaturesMatch(sigs, pkgInfo)) {
- if (pkgInfo.versionCode >= version) {
- Slog.i(TAG, "Sig + version match; taking data");
- policy = RestorePolicy.ACCEPT;
+ // Restore system-uid-space packages only if they have
+ // defined a custom backup agent
+ if ((pkgInfo.applicationInfo.uid >= Process.FIRST_APPLICATION_UID)
+ || (pkgInfo.applicationInfo.backupAgentName != null)) {
+ // Verify signatures against any installed version; if they
+ // don't match, then we fall though and ignore the data. The
+ // signatureMatch() method explicitly ignores the signature
+ // check for packages installed on the system partition, because
+ // such packages are signed with the platform cert instead of
+ // the app developer's cert, so they're different on every
+ // device.
+ if (signaturesMatch(sigs, pkgInfo)) {
+ if (pkgInfo.versionCode >= version) {
+ Slog.i(TAG, "Sig + version match; taking data");
+ policy = RestorePolicy.ACCEPT;
+ } else {
+ // The data is from a newer version of the app than
+ // is presently installed. That means we can only
+ // use it if the matching apk is also supplied.
+ Slog.d(TAG, "Data version " + version
+ + " is newer than installed version "
+ + pkgInfo.versionCode + " - requiring apk");
+ policy = RestorePolicy.ACCEPT_IF_APK;
+ }
} else {
- // The data is from a newer version of the app than
- // is presently installed. That means we can only
- // use it if the matching apk is also supplied.
- Slog.d(TAG, "Data version " + version
- + " is newer than installed version "
- + pkgInfo.versionCode + " - requiring apk");
- policy = RestorePolicy.ACCEPT_IF_APK;
+ Slog.w(TAG, "Restore manifest signatures do not match "
+ + "installed application for " + info.packageName);
}
} else {
- Slog.w(TAG, "Restore manifest signatures do not match "
- + "installed application for " + info.packageName);
+ Slog.w(TAG, "Package " + info.packageName
+ + " is system level with no agent");
}
} else {
if (DEBUG) Slog.i(TAG, "Restore manifest from "
diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java
index fe8529b..0b4871d 100644
--- a/services/java/com/android/server/BatteryService.java
+++ b/services/java/com/android/server/BatteryService.java
@@ -463,10 +463,10 @@ public class BatteryService extends Binder {
private final void logOutlier(long duration) {
ContentResolver cr = mContext.getContentResolver();
- String dischargeThresholdString = Settings.Secure.getString(cr,
- Settings.Secure.BATTERY_DISCHARGE_THRESHOLD);
- String durationThresholdString = Settings.Secure.getString(cr,
- Settings.Secure.BATTERY_DISCHARGE_DURATION_THRESHOLD);
+ String dischargeThresholdString = Settings.Global.getString(cr,
+ Settings.Global.BATTERY_DISCHARGE_THRESHOLD);
+ String durationThresholdString = Settings.Global.getString(cr,
+ Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD);
if (dischargeThresholdString != null && durationThresholdString != null) {
try {
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index ceb17c7..033aa1e 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -378,8 +378,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
}
// read our default dns server ip
- String dns = Settings.Secure.getString(context.getContentResolver(),
- Settings.Secure.DEFAULT_DNS_SERVER);
+ String dns = Settings.Global.getString(context.getContentResolver(),
+ Settings.Global.DEFAULT_DNS_SERVER);
if (dns == null || dns.length() == 0) {
dns = context.getResources().getString(
com.android.internal.R.string.config_default_dns_server);
@@ -715,9 +715,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
/** Check system properties for the default value then use secure settings value, if any. */
int defaultDelay = SystemProperties.getInt(
- "conn." + Settings.Secure.CONNECTIVITY_CHANGE_DELAY,
- Settings.Secure.CONNECTIVITY_CHANGE_DELAY_DEFAULT);
- return Settings.Secure.getInt(cr, Settings.Secure.CONNECTIVITY_CHANGE_DELAY,
+ "conn." + Settings.Global.CONNECTIVITY_CHANGE_DELAY,
+ ConnectivityManager.CONNECTIVITY_CHANGE_DELAY_DEFAULT);
+ return Settings.Global.getInt(cr, Settings.Global.CONNECTIVITY_CHANGE_DELAY,
defaultDelay);
}
@@ -1509,8 +1509,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
// which is where we store the value and maybe make this
// asynchronous.
enforceAccessPermission();
- boolean retVal = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.MOBILE_DATA, 1) == 1;
+ boolean retVal = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.MOBILE_DATA, 1) == 1;
if (VDBG) log("getMobileDataEnabled returning " + retVal);
return retVal;
}
@@ -2997,11 +2997,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
if (VDBG) log("handleInetConditionChange: starting a change hold");
// setup a new hold to debounce this
if (mDefaultInetCondition > 50) {
- delay = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.INET_CONDITION_DEBOUNCE_UP_DELAY, 500);
+ delay = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY, 500);
} else {
- delay = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.INET_CONDITION_DEBOUNCE_DOWN_DELAY, 3000);
+ delay = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY, 3000);
}
mInetConditionChangeInFlight = true;
mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_INET_CONDITION_HOLD_END,
@@ -3070,9 +3070,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
mGlobalProxy = null;
}
ContentResolver res = mContext.getContentResolver();
- Settings.Secure.putString(res, Settings.Secure.GLOBAL_HTTP_PROXY_HOST, host);
- Settings.Secure.putInt(res, Settings.Secure.GLOBAL_HTTP_PROXY_PORT, port);
- Settings.Secure.putString(res, Settings.Secure.GLOBAL_HTTP_PROXY_EXCLUSION_LIST,
+ Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST, host);
+ Settings.Global.putInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, port);
+ Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST,
exclList);
}
@@ -3084,10 +3084,10 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private void loadGlobalProxy() {
ContentResolver res = mContext.getContentResolver();
- String host = Settings.Secure.getString(res, Settings.Secure.GLOBAL_HTTP_PROXY_HOST);
- int port = Settings.Secure.getInt(res, Settings.Secure.GLOBAL_HTTP_PROXY_PORT, 0);
- String exclList = Settings.Secure.getString(res,
- Settings.Secure.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
+ String host = Settings.Global.getString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST);
+ int port = Settings.Global.getInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, 0);
+ String exclList = Settings.Global.getString(res,
+ Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
if (!TextUtils.isEmpty(host)) {
ProxyProperties proxyProperties = new ProxyProperties(host, port, exclList);
synchronized (mGlobalProxyLock) {
@@ -3118,8 +3118,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
}
private void handleDeprecatedGlobalHttpProxy() {
- String proxy = Settings.Secure.getString(mContext.getContentResolver(),
- Settings.Secure.HTTP_PROXY);
+ String proxy = Settings.Global.getString(mContext.getContentResolver(),
+ Settings.Global.HTTP_PROXY);
if (!TextUtils.isEmpty(proxy)) {
String data[] = proxy.split(":");
String proxyHost = data[0];
@@ -3162,8 +3162,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
void observe(Context context) {
ContentResolver resolver = context.getContentResolver();
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.HTTP_PROXY), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.HTTP_PROXY), false, this);
}
@Override
diff --git a/services/java/com/android/server/DevicePolicyManagerService.java b/services/java/com/android/server/DevicePolicyManagerService.java
index 83fa55b..9607624 100644
--- a/services/java/com/android/server/DevicePolicyManagerService.java
+++ b/services/java/com/android/server/DevicePolicyManagerService.java
@@ -2124,9 +2124,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
exclusionList = exclusionList.trim();
ContentResolver res = mContext.getContentResolver();
- Settings.Secure.putString(res, Settings.Secure.GLOBAL_HTTP_PROXY_HOST, data[0]);
- Settings.Secure.putInt(res, Settings.Secure.GLOBAL_HTTP_PROXY_PORT, proxyPort);
- Settings.Secure.putString(res, Settings.Secure.GLOBAL_HTTP_PROXY_EXCLUSION_LIST,
+ Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_HOST, data[0]);
+ Settings.Global.putInt(res, Settings.Global.GLOBAL_HTTP_PROXY_PORT, proxyPort);
+ Settings.Global.putString(res, Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST,
exclusionList);
}
diff --git a/services/java/com/android/server/DeviceStorageMonitorService.java b/services/java/com/android/server/DeviceStorageMonitorService.java
index 750a2fb..a4c376d 100644
--- a/services/java/com/android/server/DeviceStorageMonitorService.java
+++ b/services/java/com/android/server/DeviceStorageMonitorService.java
@@ -163,8 +163,8 @@ public class DeviceStorageMonitorService extends Binder {
mFreeMem = Long.parseLong(debugFreeMem);
}
// Read the log interval from secure settings
- long freeMemLogInterval = Settings.Secure.getLong(mContentResolver,
- Settings.Secure.SYS_FREE_STORAGE_LOG_INTERVAL,
+ long freeMemLogInterval = Settings.Global.getLong(mContentResolver,
+ Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL,
DEFAULT_FREE_STORAGE_LOG_INTERVAL_IN_MINUTES)*60*1000;
//log the amount of free memory in event log
long currTime = SystemClock.elapsedRealtime();
@@ -190,8 +190,8 @@ public class DeviceStorageMonitorService extends Binder {
mFreeMem, mFreeSystem, mFreeCache);
}
// Read the reporting threshold from secure settings
- long threshold = Settings.Secure.getLong(mContentResolver,
- Settings.Secure.DISK_FREE_CHANGE_REPORTING_THRESHOLD,
+ long threshold = Settings.Global.getLong(mContentResolver,
+ Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD,
DEFAULT_DISK_FREE_CHANGE_REPORTING_THRESHOLD);
// If mFree changed significantly log the new value
long delta = mFreeMem - mLastReportedFreeMem;
@@ -309,15 +309,15 @@ public class DeviceStorageMonitorService extends Binder {
* any way
*/
private long getMemThreshold() {
- long value = Settings.Secure.getInt(
+ long value = Settings.Global.getInt(
mContentResolver,
- Settings.Secure.SYS_STORAGE_THRESHOLD_PERCENTAGE,
+ Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE,
DEFAULT_THRESHOLD_PERCENTAGE);
if(localLOGV) Slog.v(TAG, "Threshold Percentage="+value);
value = (value*mTotalMemory)/100;
- long maxValue = Settings.Secure.getInt(
+ long maxValue = Settings.Global.getInt(
mContentResolver,
- Settings.Secure.SYS_STORAGE_THRESHOLD_MAX_BYTES,
+ Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES,
DEFAULT_THRESHOLD_MAX_BYTES);
//evaluate threshold value
return value < maxValue ? value : maxValue;
@@ -329,9 +329,9 @@ public class DeviceStorageMonitorService extends Binder {
* any way
*/
private int getMemFullThreshold() {
- int value = Settings.Secure.getInt(
+ int value = Settings.Global.getInt(
mContentResolver,
- Settings.Secure.SYS_STORAGE_FULL_THRESHOLD_BYTES,
+ Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES,
DEFAULT_FULL_THRESHOLD_BYTES);
if(localLOGV) Slog.v(TAG, "Full Threshold Bytes="+value);
return value;
diff --git a/services/java/com/android/server/DropBoxManagerService.java b/services/java/com/android/server/DropBoxManagerService.java
index 0b12410..5008270 100644
--- a/services/java/com/android/server/DropBoxManagerService.java
+++ b/services/java/com/android/server/DropBoxManagerService.java
@@ -146,7 +146,7 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
context.registerReceiver(mReceiver, filter);
mContentResolver.registerContentObserver(
- Settings.Secure.CONTENT_URI, true,
+ Settings.Global.CONTENT_URI, true,
new ContentObserver(new Handler()) {
@Override
public void onChange(boolean selfChange) {
@@ -265,8 +265,8 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
}
public boolean isTagEnabled(String tag) {
- return !"disabled".equals(Settings.Secure.getString(
- mContentResolver, Settings.Secure.DROPBOX_TAG_PREFIX + tag));
+ return !"disabled".equals(Settings.Global.getString(
+ mContentResolver, Settings.Global.DROPBOX_TAG_PREFIX + tag));
}
public synchronized DropBoxManager.Entry getNextEntry(String tag, long millis) {
@@ -688,10 +688,10 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
private synchronized long trimToFit() {
// Expunge aged items (including tombstones marking deleted data).
- int ageSeconds = Settings.Secure.getInt(mContentResolver,
- Settings.Secure.DROPBOX_AGE_SECONDS, DEFAULT_AGE_SECONDS);
- int maxFiles = Settings.Secure.getInt(mContentResolver,
- Settings.Secure.DROPBOX_MAX_FILES, DEFAULT_MAX_FILES);
+ int ageSeconds = Settings.Global.getInt(mContentResolver,
+ Settings.Global.DROPBOX_AGE_SECONDS, DEFAULT_AGE_SECONDS);
+ int maxFiles = Settings.Global.getInt(mContentResolver,
+ Settings.Global.DROPBOX_MAX_FILES, DEFAULT_MAX_FILES);
long cutoffMillis = System.currentTimeMillis() - ageSeconds * 1000;
while (!mAllFiles.contents.isEmpty()) {
EntryFile entry = mAllFiles.contents.first();
@@ -710,12 +710,12 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
long uptimeMillis = SystemClock.uptimeMillis();
if (uptimeMillis > mCachedQuotaUptimeMillis + QUOTA_RESCAN_MILLIS) {
- int quotaPercent = Settings.Secure.getInt(mContentResolver,
- Settings.Secure.DROPBOX_QUOTA_PERCENT, DEFAULT_QUOTA_PERCENT);
- int reservePercent = Settings.Secure.getInt(mContentResolver,
- Settings.Secure.DROPBOX_RESERVE_PERCENT, DEFAULT_RESERVE_PERCENT);
- int quotaKb = Settings.Secure.getInt(mContentResolver,
- Settings.Secure.DROPBOX_QUOTA_KB, DEFAULT_QUOTA_KB);
+ int quotaPercent = Settings.Global.getInt(mContentResolver,
+ Settings.Global.DROPBOX_QUOTA_PERCENT, DEFAULT_QUOTA_PERCENT);
+ int reservePercent = Settings.Global.getInt(mContentResolver,
+ Settings.Global.DROPBOX_RESERVE_PERCENT, DEFAULT_RESERVE_PERCENT);
+ int quotaKb = Settings.Global.getInt(mContentResolver,
+ Settings.Global.DROPBOX_QUOTA_KB, DEFAULT_QUOTA_KB);
mStatFs.restat(mDropBoxDir.getPath());
int available = mStatFs.getAvailableBlocks();
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 6952d72..ec58e43 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -171,8 +171,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
final SettingsObserver mSettingsObserver;
final IWindowManager mIWindowManager;
final HandlerCaller mCaller;
- private final InputMethodFileManager mFileManager;
- private final InputMethodAndSubtypeListManager mImListManager;
+ private InputMethodFileManager mFileManager;
+ private InputMethodAndSubtypeListManager mImListManager;
private final HardKeyboardListener mHardKeyboardListener;
private final WindowManagerService mWindowManagerService;
@@ -625,11 +625,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
mShowOngoingImeSwitcherForPhones = false;
- synchronized (mMethodMap) {
- mFileManager = new InputMethodFileManager(mMethodMap);
- }
- mImListManager = new InputMethodAndSubtypeListManager(context, this);
-
final IntentFilter broadcastFilter = new IntentFilter();
broadcastFilter.addAction(Intent.ACTION_SCREEN_ON);
broadcastFilter.addAction(Intent.ACTION_SCREEN_OFF);
@@ -643,7 +638,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
new IUserSwitchObserver.Stub() {
@Override
public void onUserSwitching(int newUserId, IRemoteCallback reply) {
- switchUser(newUserId);
+ synchronized(mMethodMap) {
+ switchUserLocked(newUserId);
+ }
if (reply != null) {
try {
reply.sendResult(null);
@@ -665,6 +662,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
// mSettings should be created before buildInputMethodListLocked
mSettings = new InputMethodSettings(
mRes, context.getContentResolver(), mMethodMap, mMethodList, userId);
+ mFileManager = new InputMethodFileManager(mMethodMap, userId);
+ mImListManager = new InputMethodAndSubtypeListManager(context, this);
// Just checking if defaultImiId is empty or not
final String defaultImiId = mSettings.getSelectedInputMethod();
@@ -736,6 +735,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
if (DEBUG) {
Slog.i(TAG, "Locale has been changed to " + newLocale);
}
+ // InputMethodAndSubtypeListManager should be reset when the locale is changed.
+ mImListManager = new InputMethodAndSubtypeListManager(mContext, this);
buildInputMethodListLocked(mMethodList, mMethodMap);
if (!updateOnlyWhenLocaleChanged) {
final String selectedImiId = mSettings.getSelectedInputMethod();
@@ -744,6 +745,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
// set the current ime to the proper one.
resetDefaultImeLocked(mContext);
}
+ } else {
+ // If the locale is changed, needs to reset the default ime
+ resetDefaultImeLocked(mContext);
}
updateFromSettingsLocked();
mLastSystemLocale = newLocale;
@@ -761,8 +765,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
resetAllInternalStateLocked(true);
}
- private void switchUser(int newUserId) {
+ private void switchUserLocked(int newUserId) {
mSettings.setCurrentUserId(newUserId);
+ // InputMethodFileManager should be reset when the user is changed
+ mFileManager = new InputMethodFileManager(mMethodMap, newUserId);
resetAllInternalStateLocked(false);
}
@@ -3816,6 +3822,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
}
+ // TODO: Cache the state for each user and reset when the cached user is removed.
private static class InputMethodFileManager {
private static final String SYSTEM_PATH = "system";
private static final String INPUT_METHOD_PATH = "inputmethod";
@@ -3834,12 +3841,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
private final HashMap<String, InputMethodInfo> mMethodMap;
private final HashMap<String, List<InputMethodSubtype>> mAdditionalSubtypesMap =
new HashMap<String, List<InputMethodSubtype>>();
- public InputMethodFileManager(HashMap<String, InputMethodInfo> methodMap) {
+ public InputMethodFileManager(HashMap<String, InputMethodInfo> methodMap, int userId) {
if (methodMap == null) {
throw new NullPointerException("methodMap is null");
}
mMethodMap = methodMap;
- final File systemDir = new File(Environment.getDataDirectory(), SYSTEM_PATH);
+ final File systemDir = userId == UserHandle.USER_OWNER
+ ? new File(Environment.getDataDirectory(), SYSTEM_PATH)
+ : Environment.getUserSystemDirectory(userId);
final File inputMethodDir = new File(systemDir, INPUT_METHOD_PATH);
if (!inputMethodDir.mkdirs()) {
Slog.w(TAG, "Couldn't create dir.: " + inputMethodDir.getAbsolutePath());
diff --git a/services/java/com/android/server/NsdService.java b/services/java/com/android/server/NsdService.java
index 2a7a2eb..1b9742c 100644
--- a/services/java/com/android/server/NsdService.java
+++ b/services/java/com/android/server/NsdService.java
@@ -131,7 +131,7 @@ public class NsdService extends INsdManager.Stub {
};
mContext.getContentResolver().registerContentObserver(
- Settings.Secure.getUriFor(Settings.Secure.NSD_ON),
+ Settings.Global.getUriFor(Settings.Global.NSD_ON),
false, contentObserver);
}
@@ -433,7 +433,7 @@ public class NsdService extends INsdManager.Stub {
public void setEnabled(boolean enable) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL,
"NsdService");
- Settings.Secure.putInt(mContentResolver, Settings.Secure.NSD_ON, enable ? 1 : 0);
+ Settings.Global.putInt(mContentResolver, Settings.Global.NSD_ON, enable ? 1 : 0);
if (enable) {
mNsdStateMachine.sendMessage(NsdManager.ENABLE);
} else {
@@ -453,7 +453,7 @@ public class NsdService extends INsdManager.Stub {
}
private boolean isNsdEnabled() {
- boolean ret = Settings.Secure.getInt(mContentResolver, Settings.Secure.NSD_ON, 1) == 1;
+ boolean ret = Settings.Global.getInt(mContentResolver, Settings.Global.NSD_ON, 1) == 1;
if (DBG) Slog.d(TAG, "Network service discovery enabled " + ret);
return ret;
}
diff --git a/services/java/com/android/server/ServiceWatcher.java b/services/java/com/android/server/ServiceWatcher.java
index 0dfaa05..e99949b 100644
--- a/services/java/com/android/server/ServiceWatcher.java
+++ b/services/java/com/android/server/ServiceWatcher.java
@@ -170,7 +170,7 @@ public class ServiceWatcher implements ServiceConnection {
}
if (D) Log.d(mTag, "binding " + packageName + " (version " + version + ")");
mContext.bindService(intent, this, Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND
- | Context.BIND_ALLOW_OOM_MANAGEMENT);
+ | Context.BIND_ALLOW_OOM_MANAGEMENT | Context.BIND_NOT_VISIBLE);
}
private boolean isSignatureMatch(Signature[] signatures) {
diff --git a/services/java/com/android/server/StatusBarManagerService.java b/services/java/com/android/server/StatusBarManagerService.java
index b567992..87b0eb3 100644
--- a/services/java/com/android/server/StatusBarManagerService.java
+++ b/services/java/com/android/server/StatusBarManagerService.java
@@ -117,45 +117,34 @@ public class StatusBarManagerService extends IStatusBarService.Stub
// ================================================================================
// From IStatusBarService
// ================================================================================
- public void expandNotifications() {
+ public void expandNotificationsPanel() {
enforceExpandStatusBar();
if (mBar != null) {
try {
- mBar.animateExpandNotifications();
+ mBar.animateExpandNotificationsPanel();
} catch (RemoteException ex) {
}
}
}
- public void collapseNotifications() {
+ public void collapsePanels() {
enforceExpandStatusBar();
if (mBar != null) {
try {
- mBar.animateCollapseNotifications();
+ mBar.animateCollapsePanels();
} catch (RemoteException ex) {
}
}
}
- public void expandQuickSettings() {
+ public void expandSettingsPanel() {
enforceExpandStatusBar();
if (mBar != null) {
try {
- mBar.animateExpandQuickSettings();
- } catch (RemoteException ex) {
- }
- }
- }
-
- public void collapseQuickSettings() {
- enforceExpandStatusBar();
-
- if (mBar != null) {
- try {
- mBar.animateCollapseQuickSettings();
+ mBar.animateExpandSettingsPanel();
} catch (RemoteException ex) {
}
}
@@ -620,8 +609,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub
String action = intent.getAction();
if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)
|| Intent.ACTION_SCREEN_OFF.equals(action)) {
- collapseNotifications();
- collapseQuickSettings();
+ collapsePanels();
}
/*
else if (Telephony.Intents.SPN_STRINGS_UPDATED_ACTION.equals(action)) {
diff --git a/services/java/com/android/server/ThrottleService.java b/services/java/com/android/server/ThrottleService.java
index f36d73a..75eb3c4 100644
--- a/services/java/com/android/server/ThrottleService.java
+++ b/services/java/com/android/server/ThrottleService.java
@@ -211,20 +211,20 @@ public class ThrottleService extends IThrottleManager.Stub {
void register(Context context) {
ContentResolver resolver = context.getContentResolver();
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.THROTTLE_POLLING_SEC), false, this);
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.THROTTLE_THRESHOLD_BYTES), false, this);
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.THROTTLE_VALUE_KBITSPS), false, this);
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.THROTTLE_RESET_DAY), false, this);
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.THROTTLE_NOTIFICATION_TYPE), false, this);
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.THROTTLE_HELP_URI), false, this);
- resolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.THROTTLE_MAX_NTP_CACHE_AGE_SEC), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.THROTTLE_POLLING_SEC), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.THROTTLE_THRESHOLD_BYTES), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.THROTTLE_VALUE_KBITSPS), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.THROTTLE_RESET_DAY), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.THROTTLE_NOTIFICATION_TYPE), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.THROTTLE_HELP_URI), false, this);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.THROTTLE_MAX_NTP_CACHE_AGE_SEC), false, this);
}
void unregister(Context context) {
@@ -297,8 +297,8 @@ public class ThrottleService extends IThrottleManager.Stub {
public String getHelpUri() {
enforceAccessPermission();
- return Settings.Secure.getString(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_HELP_URI);
+ return Settings.Global.getString(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_HELP_URI);
}
// TODO - fetch for the iface
@@ -436,18 +436,18 @@ public class ThrottleService extends IThrottleManager.Stub {
int pollingPeriod = mContext.getResources().getInteger(
R.integer.config_datause_polling_period_sec);
- mPolicyPollPeriodSec = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_POLLING_SEC, pollingPeriod);
+ mPolicyPollPeriodSec = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_POLLING_SEC, pollingPeriod);
// TODO - remove testing stuff?
long defaultThreshold = mContext.getResources().getInteger(
R.integer.config_datause_threshold_bytes);
int defaultValue = mContext.getResources().getInteger(
R.integer.config_datause_throttle_kbitsps);
- long threshold = Settings.Secure.getLong(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_THRESHOLD_BYTES, defaultThreshold);
- int value = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_VALUE_KBITSPS, defaultValue);
+ long threshold = Settings.Global.getLong(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_THRESHOLD_BYTES, defaultThreshold);
+ int value = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_VALUE_KBITSPS, defaultValue);
mPolicyThreshold.set(threshold);
mPolicyThrottleValue.set(value);
@@ -456,14 +456,14 @@ public class ThrottleService extends IThrottleManager.Stub {
mPolicyThreshold.set(TESTING_THRESHOLD);
}
- mPolicyResetDay = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_RESET_DAY, -1);
+ mPolicyResetDay = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_RESET_DAY, -1);
if (mPolicyResetDay == -1 ||
((mPolicyResetDay < 1) || (mPolicyResetDay > 28))) {
Random g = new Random();
mPolicyResetDay = 1 + g.nextInt(28); // 1-28
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_RESET_DAY, mPolicyResetDay);
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_RESET_DAY, mPolicyResetDay);
}
if (mIface == null) {
mPolicyThreshold.set(0);
@@ -471,11 +471,11 @@ public class ThrottleService extends IThrottleManager.Stub {
int defaultNotificationType = mContext.getResources().getInteger(
R.integer.config_datause_notification_type);
- mPolicyNotificationsAllowedMask = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_NOTIFICATION_TYPE, defaultNotificationType);
+ mPolicyNotificationsAllowedMask = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_NOTIFICATION_TYPE, defaultNotificationType);
- final int maxNtpCacheAgeSec = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.THROTTLE_MAX_NTP_CACHE_AGE_SEC,
+ final int maxNtpCacheAgeSec = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.THROTTLE_MAX_NTP_CACHE_AGE_SEC,
(int) (MAX_NTP_CACHE_AGE / 1000));
mMaxNtpCacheAge = maxNtpCacheAgeSec * 1000;
diff --git a/services/java/com/android/server/UiModeManagerService.java b/services/java/com/android/server/UiModeManagerService.java
index 07e8f18..3b8caba 100644
--- a/services/java/com/android/server/UiModeManagerService.java
+++ b/services/java/com/android/server/UiModeManagerService.java
@@ -25,7 +25,6 @@ import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.StatusBarManager;
import android.app.UiModeManager;
-import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -497,7 +496,8 @@ class UiModeManagerService extends IUiModeManager.Stub {
sendConfigurationLocked();
// If we did not start a dock app, then start dreaming if supported.
- if (!dockAppStarted && isScreenSaverEnabled() && isScreenSaverActivatedOnDock()) {
+ if (category != null && !dockAppStarted
+ && isScreenSaverEnabled() && isScreenSaverActivatedOnDock()) {
Slog.i(TAG, "Activating dream while docked.");
try {
IDreamManager dreamManagerService = IDreamManager.Stub.asInterface(
diff --git a/services/java/com/android/server/Watchdog.java b/services/java/com/android/server/Watchdog.java
index 9edfad6..9dbe503 100644
--- a/services/java/com/android/server/Watchdog.java
+++ b/services/java/com/android/server/Watchdog.java
@@ -33,7 +33,6 @@ import android.os.Process;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
-import android.provider.Settings;
import android.util.EventLog;
import android.util.Log;
import android.util.Slog;
@@ -118,9 +117,7 @@ public class Watchdog extends Thread {
case MONITOR: {
// See if we should force a reboot.
int rebootInterval = mReqRebootInterval >= 0
- ? mReqRebootInterval : Settings.Secure.getInt(
- mResolver, Settings.Secure.REBOOT_INTERVAL,
- REBOOT_DEFAULT_INTERVAL);
+ ? mReqRebootInterval : REBOOT_DEFAULT_INTERVAL;
if (mRebootInterval != rebootInterval) {
mRebootInterval = rebootInterval;
// We have been running long enough that a reboot can
@@ -226,9 +223,7 @@ public class Watchdog extends Thread {
void checkReboot(boolean fromAlarm) {
int rebootInterval = mReqRebootInterval >= 0 ? mReqRebootInterval
- : Settings.Secure.getInt(
- mResolver, Settings.Secure.REBOOT_INTERVAL,
- REBOOT_DEFAULT_INTERVAL);
+ : REBOOT_DEFAULT_INTERVAL;
mRebootInterval = rebootInterval;
if (rebootInterval <= 0) {
// No reboot interval requested.
@@ -238,17 +233,11 @@ public class Watchdog extends Thread {
}
long rebootStartTime = mReqRebootStartTime >= 0 ? mReqRebootStartTime
- : Settings.Secure.getLong(
- mResolver, Settings.Secure.REBOOT_START_TIME,
- REBOOT_DEFAULT_START_TIME);
+ : REBOOT_DEFAULT_START_TIME;
long rebootWindowMillis = (mReqRebootWindow >= 0 ? mReqRebootWindow
- : Settings.Secure.getLong(
- mResolver, Settings.Secure.REBOOT_WINDOW,
- REBOOT_DEFAULT_WINDOW)) * 1000;
+ : REBOOT_DEFAULT_WINDOW) * 1000;
long recheckInterval = (mReqRecheckInterval >= 0 ? mReqRecheckInterval
- : Settings.Secure.getLong(
- mResolver, Settings.Secure.MEMCHECK_RECHECK_INTERVAL,
- MEMCHECK_DEFAULT_RECHECK_INTERVAL)) * 1000;
+ : MEMCHECK_DEFAULT_RECHECK_INTERVAL) * 1000;
retrieveBrutalityAmount();
@@ -325,13 +314,9 @@ public class Watchdog extends Thread {
*/
void retrieveBrutalityAmount() {
mMinScreenOff = (mReqMinScreenOff >= 0 ? mReqMinScreenOff
- : Settings.Secure.getInt(
- mResolver, Settings.Secure.MEMCHECK_MIN_SCREEN_OFF,
- MEMCHECK_DEFAULT_MIN_SCREEN_OFF)) * 1000;
+ : MEMCHECK_DEFAULT_MIN_SCREEN_OFF) * 1000;
mMinAlarm = (mReqMinNextAlarm >= 0 ? mReqMinNextAlarm
- : Settings.Secure.getInt(
- mResolver, Settings.Secure.MEMCHECK_MIN_ALARM,
- MEMCHECK_DEFAULT_MIN_ALARM)) * 1000;
+ : MEMCHECK_DEFAULT_MIN_ALARM) * 1000;
}
/**
diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
index 25f98de..2f57eb0 100644
--- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -56,6 +56,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.UserHandle;
+import android.os.UserManager;
import android.provider.Settings;
import android.text.TextUtils;
import android.text.TextUtils.SimpleStringSplitter;
@@ -108,9 +109,16 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
private static final String LOG_TAG = "AccessibilityManagerService";
+ // TODO: This is arbitrary. When there is time implement this by watching
+ // when that accessibility services are bound.
+ private static final int WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS = 5000;
+
private static final String FUNCTION_REGISTER_UI_TEST_AUTOMATION_SERVICE =
"registerUiTestAutomationService";
+ private static final String TEMPORARY_ENABLE_ACCESSIBILITY_UNTIL_KEYGUARD_REMOVED =
+ "temporaryEnableAccessibilityStateUntilKeyguardRemoved";
+
private static final char COMPONENT_NAME_SEPARATOR = ':';
private static final int OWN_PROCESS_ID = android.os.Process.myPid();
@@ -157,6 +165,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
private final SparseArray<UserState> mUserStates = new SparseArray<UserState>();
+ private final TempUserStateChangeMemento mTempStateChangeForCurrentUserMemento =
+ new TempUserStateChangeMemento();
+
private int mCurrentUserId = UserHandle.USER_OWNER;
private UserState getCurrentUserStateLocked() {
@@ -268,12 +279,13 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
// package changes
monitor.register(mContext, null, UserHandle.ALL, true);
- // user change
- IntentFilter userFilter = new IntentFilter();
- userFilter.addAction(Intent.ACTION_USER_SWITCHED);
- userFilter.addAction(Intent.ACTION_USER_REMOVED);
+ // user change and unlock
+ IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(Intent.ACTION_USER_SWITCHED);
+ intentFilter.addAction(Intent.ACTION_USER_REMOVED);
+ intentFilter.addAction(Intent.ACTION_USER_PRESENT);
- mContext.registerReceiver(new BroadcastReceiver() {
+ mContext.registerReceiverAsUser(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
@@ -281,9 +293,11 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
switchUser(intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0));
} else if (Intent.ACTION_USER_REMOVED.equals(action)) {
removeUser(intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0));
+ } else if (Intent.ACTION_USER_PRESENT.equals(action)) {
+ restoreStateFromMementoIfNeeded();
}
}
- }, userFilter);
+ }, UserHandle.ALL, intentFilter, null, null);
}
public int addClient(IAccessibilityManagerClient client, int userId) {
@@ -510,6 +524,37 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
}
}
+ public void temporaryEnableAccessibilityStateUntilKeyguardRemoved(
+ ComponentName service, boolean touchExplorationEnabled) {
+ mSecurityPolicy.enforceCallingPermission(
+ Manifest.permission.TEMPORARY_ENABLE_ACCESSIBILITY,
+ TEMPORARY_ENABLE_ACCESSIBILITY_UNTIL_KEYGUARD_REMOVED);
+ try {
+ if (!mWindowManagerService.isKeyguardLocked()) {
+ return;
+ }
+ } catch (RemoteException re) {
+ return;
+ }
+ synchronized (mLock) {
+ UserState userState = getCurrentUserStateLocked();
+ // Stash the old state so we can restore it when the keyguard is gone.
+ mTempStateChangeForCurrentUserMemento.initialize(mCurrentUserId, getCurrentUserStateLocked());
+ // Set the temporary state.
+ userState.mIsAccessibilityEnabled = true;
+ userState.mIsTouchExplorationEnabled= touchExplorationEnabled;
+ userState.mIsDisplayMagnificationEnabled = false;
+ userState.mEnabledServices.clear();
+ userState.mEnabledServices.add(service);
+ userState.mTouchExplorationGrantedServices.clear();
+ userState.mTouchExplorationGrantedServices.add(service);
+ // Update the internal state.
+ performServiceManagementLocked(userState);
+ updateInputFilterLocked(userState);
+ scheduleSendStateToClientsLocked(userState);
+ }
+ }
+
public void unregisterUiTestAutomationService(IAccessibilityServiceClient serviceClient) {
synchronized (mLock) {
// Automation service is not bound, so pretend it died to perform clean up.
@@ -600,9 +645,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
private void switchUser(int userId) {
synchronized (mLock) {
- if (userId == mCurrentUserId) {
- return;
- }
+ // The user switched so we do not need to restore the current user
+ // state since we will fully rebuild it when he becomes current again.
+ mTempStateChangeForCurrentUserMemento.clear();
// Disconnect from services for the old user.
UserState oldUserState = getUserStateLocked(mCurrentUserId);
@@ -620,6 +665,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
// Recreate the internal state for the new user.
mMainHandler.obtainMessage(MainHandler.MSG_SEND_RECREATE_INTERNAL_STATE,
mCurrentUserId, 0).sendToTarget();
+
+ // Schedule announcement of the current user if needed.
+ mMainHandler.sendEmptyMessageDelayed(MainHandler.MSG_ANNOUNCE_NEW_USER_IF_NEEDED,
+ WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS);
}
}
@@ -629,6 +678,21 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
}
}
+ private void restoreStateFromMementoIfNeeded() {
+ synchronized (mLock) {
+ if (mTempStateChangeForCurrentUserMemento.mUserId != UserHandle.USER_NULL) {
+ UserState userState = getCurrentUserStateLocked();
+ // Restore the state from the memento.
+ mTempStateChangeForCurrentUserMemento.applyTo(userState);
+ mTempStateChangeForCurrentUserMemento.clear();
+ // Update the internal state.
+ performServiceManagementLocked(userState);
+ updateInputFilterLocked(userState);
+ scheduleSendStateToClientsLocked(userState);
+ }
+ }
+ }
+
private Service getQueryBridge() {
if (mQueryBridge == null) {
AccessibilityServiceInfo info = new AccessibilityServiceInfo();
@@ -763,7 +827,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
private void tryAddServiceLocked(Service service, int userId) {
try {
UserState userState = getUserStateLocked(userId);
- if (userState.mServices.contains(service) || !service.isConfigured()) {
+ if (userState.mServices.contains(service)) {
return;
}
service.linkToOwnDeath();
@@ -812,7 +876,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
private boolean canDispathEventLocked(Service service, AccessibilityEvent event,
int handledFeedbackTypes) {
- if (!service.isConfigured()) {
+ if (!service.canReceiveEvents()) {
return false;
}
@@ -1076,6 +1140,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
handleDisplayMagnificationEnabledSettingChangedLocked(userState);
handleAccessibilityEnabledSettingChangedLocked(userState);
+ performServiceManagementLocked(userState);
updateInputFilterLocked(userState);
scheduleSendStateToClientsLocked(userState);
}
@@ -1084,6 +1149,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
userState.mIsAccessibilityEnabled = Settings.Secure.getIntForUser(
mContext.getContentResolver(),
Settings.Secure.ACCESSIBILITY_ENABLED, 0, userState.mUserId) == 1;
+ }
+
+ private void performServiceManagementLocked(UserState userState) {
if (userState.mIsAccessibilityEnabled ) {
manageServicesLocked(userState);
} else {
@@ -1124,7 +1192,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
private void tryEnableTouchExplorationLocked(final Service service) {
UserState userState = getUserStateLocked(service.mUserId);
- if (!userState.mIsTouchExplorationEnabled && service.mRequestTouchExplorationMode) {
+ if (!userState.mIsTouchExplorationEnabled && service.mRequestTouchExplorationMode
+ && service.canReceiveEvents()) {
final boolean canToggleTouchExploration =
userState.mTouchExplorationGrantedServices.contains(service.mComponentName);
if (!service.mIsAutomation && !canToggleTouchExploration) {
@@ -1137,6 +1206,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
}
private void tryDisableTouchExplorationLocked(Service service) {
+ if (!service.canReceiveEvents()) {
+ return;
+ }
UserState userState = getUserStateLocked(service.mUserId);
if (userState.mIsTouchExplorationEnabled) {
final int serviceCount = userState.mServices.size();
@@ -1186,6 +1258,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
public static final int MSG_SEND_CLEARED_STATE_TO_CLIENTS_FOR_USER = 3;
public static final int MSG_SEND_RECREATE_INTERNAL_STATE = 4;
public static final int MSG_UPDATE_ACTIVE_WINDOW = 5;
+ public static final int MSG_ANNOUNCE_NEW_USER_IF_NEEDED = 6;
public MainHandler(Looper looper) {
super(looper);
@@ -1226,6 +1299,25 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
final int eventType = msg.arg2;
mSecurityPolicy.updateActiveWindow(windowId, eventType);
} break;
+ case MSG_ANNOUNCE_NEW_USER_IF_NEEDED: {
+ announceNewUserIfNeeded();
+ } break;
+ }
+ }
+
+ private void announceNewUserIfNeeded() {
+ synchronized (mLock) {
+ UserState userState = getCurrentUserStateLocked();
+ if (userState.mIsAccessibilityEnabled) {
+ UserManager userManager = (UserManager) mContext.getSystemService(
+ Context.USER_SERVICE);
+ String message = mContext.getString(R.string.user_switched,
+ userManager.getUserInfo(mCurrentUserId).name);
+ AccessibilityEvent event = AccessibilityEvent.obtain(
+ AccessibilityEvent.TYPE_ANNOUNCEMENT);
+ event.getText().add(message);
+ sendAccessibilityEvent(event, mCurrentUserId);
+ }
}
}
@@ -1376,7 +1468,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
// If this service is up and running we may have to enable touch
// exploration, otherwise this will happen when the service connects.
synchronized (mLock) {
- if (isConfigured()) {
+ if (canReceiveEvents()) {
if (mRequestTouchExplorationMode) {
tryEnableTouchExplorationLocked(this);
} else {
@@ -1417,13 +1509,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
return false;
}
- /**
- * Returns if the service is configured i.e. at least event types of interest
- * and feedback type must be set.
- *
- * @return True if the service is configured, false otherwise.
- */
- public boolean isConfigured() {
+ public boolean canReceiveEvents() {
return (mEventTypes != 0 && mFeedbackType != 0 && mService != null);
}
@@ -1940,7 +2026,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
StatusBarManager statusBarManager = (StatusBarManager) mContext.getSystemService(
android.app.Service.STATUS_BAR_SERVICE);
- statusBarManager.expandNotifications();
+ statusBarManager.expandNotificationsPanel();
Binder.restoreCallingIdentity(token);
}
@@ -1950,7 +2036,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
StatusBarManager statusBarManager = (StatusBarManager) mContext.getSystemService(
android.app.Service.STATUS_BAR_SERVICE);
- statusBarManager.expandQuickSettings();
+ statusBarManager.expandSettingsPanel();
Binder.restoreCallingIdentity(token);
}
@@ -2229,6 +2315,46 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
}
}
+ private class TempUserStateChangeMemento {
+ public int mUserId = UserHandle.USER_NULL;
+ public boolean mIsAccessibilityEnabled;
+ public boolean mIsTouchExplorationEnabled;
+ public boolean mIsDisplayMagnificationEnabled;
+ public final Set<ComponentName> mEnabledServices = new HashSet<ComponentName>();
+ public final Set<ComponentName> mTouchExplorationGrantedServices =
+ new HashSet<ComponentName>();
+
+ public void initialize(int userId, UserState userState) {
+ mUserId = userId;
+ mIsAccessibilityEnabled = userState.mIsAccessibilityEnabled;
+ mIsTouchExplorationEnabled = userState.mIsTouchExplorationEnabled;
+ mIsDisplayMagnificationEnabled = userState.mIsDisplayMagnificationEnabled;
+ mEnabledServices.clear();
+ mEnabledServices.addAll(userState.mEnabledServices);
+ mTouchExplorationGrantedServices.clear();
+ mTouchExplorationGrantedServices.addAll(userState.mTouchExplorationGrantedServices);
+ }
+
+ public void applyTo(UserState userState) {
+ userState.mIsAccessibilityEnabled = mIsAccessibilityEnabled;
+ userState.mIsTouchExplorationEnabled = mIsTouchExplorationEnabled;
+ userState.mIsDisplayMagnificationEnabled = mIsDisplayMagnificationEnabled;
+ userState.mEnabledServices.clear();
+ userState.mEnabledServices.addAll(mEnabledServices);
+ userState.mTouchExplorationGrantedServices.clear();
+ userState.mTouchExplorationGrantedServices.addAll(mTouchExplorationGrantedServices);
+ }
+
+ public void clear() {
+ mUserId = UserHandle.USER_NULL;
+ mIsAccessibilityEnabled = false;
+ mIsTouchExplorationEnabled = false;
+ mIsDisplayMagnificationEnabled = false;
+ mEnabledServices.clear();
+ mTouchExplorationGrantedServices.clear();
+ }
+ }
+
private final class AccessibilityContentObserver extends ContentObserver {
private final Uri mAccessibilityEnabledUri = Settings.Secure.getUriFor(
@@ -2272,6 +2398,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
if (mUiAutomationService == null) {
UserState userState = getCurrentUserStateLocked();
handleAccessibilityEnabledSettingChangedLocked(userState);
+ performServiceManagementLocked(userState);
updateInputFilterLocked(userState);
scheduleSendStateToClientsLocked(userState);
}
diff --git a/services/java/com/android/server/accessibility/TouchExplorer.java b/services/java/com/android/server/accessibility/TouchExplorer.java
index 921bed7..542cc07 100644
--- a/services/java/com/android/server/accessibility/TouchExplorer.java
+++ b/services/java/com/android/server/accessibility/TouchExplorer.java
@@ -1300,6 +1300,11 @@ class TouchExplorer implements EventStreamTransformation {
@Override
public void run() {
+ // Announce the end of gesture recognition.
+ sendAccessibilityEvent(AccessibilityEvent.TYPE_GESTURE_DETECTION_END);
+ // Clearing puts is in touch exploration state with a finger already
+ // down, so announce the transition to exploration state.
+ sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START);
clear();
}
}
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 370d427..bfefe67 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -8464,8 +8464,8 @@ public final class ActivityManagerService extends ActivityManagerNative
sb.append(crashInfo.stackTrace);
}
- String setting = Settings.Secure.ERROR_LOGCAT_PREFIX + dropboxTag;
- int lines = Settings.Secure.getInt(mContext.getContentResolver(), setting, 0);
+ String setting = Settings.Global.ERROR_LOGCAT_PREFIX + dropboxTag;
+ int lines = Settings.Global.getInt(mContext.getContentResolver(), setting, 0);
if (lines > 0) {
sb.append("\n");
@@ -11514,8 +11514,9 @@ public final class ActivityManagerService extends ActivityManagerNative
* Prevent non-system code (defined here to be non-persistent
* processes) from sending protected broadcasts.
*/
- if (callingUid == Process.SYSTEM_UID || callingUid == Process.PHONE_UID
- || callingUid == Process.SHELL_UID || callingUid == Process.BLUETOOTH_UID ||
+ int callingAppId = UserHandle.getAppId(callingUid);
+ if (callingAppId == Process.SYSTEM_UID || callingAppId == Process.PHONE_UID
+ || callingAppId == Process.SHELL_UID || callingAppId == Process.BLUETOOTH_UID ||
callingUid == 0) {
// Always okay.
} else if (callerApp == null || !callerApp.persistent) {
diff --git a/services/java/com/android/server/display/DisplayManagerService.java b/services/java/com/android/server/display/DisplayManagerService.java
index 85f3b56..f348cb6 100644
--- a/services/java/com/android/server/display/DisplayManagerService.java
+++ b/services/java/com/android/server/display/DisplayManagerService.java
@@ -352,11 +352,6 @@ public final class DisplayManagerService extends IDisplayManager.Stub {
@Override // Binder call
public void scanWifiDisplays() {
- if (mContext.checkCallingPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission");
- }
-
final long token = Binder.clearCallingIdentity();
try {
synchronized (mSyncRoot) {
@@ -371,19 +366,16 @@ public final class DisplayManagerService extends IDisplayManager.Stub {
@Override // Binder call
public void connectWifiDisplay(String address) {
- if (mContext.checkCallingPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission");
- }
if (address == null) {
throw new IllegalArgumentException("address must not be null");
}
+ final boolean trusted = canCallerConfigureWifiDisplay();
final long token = Binder.clearCallingIdentity();
try {
synchronized (mSyncRoot) {
if (mWifiDisplayAdapter != null) {
- mWifiDisplayAdapter.requestConnectLocked(address);
+ mWifiDisplayAdapter.requestConnectLocked(address, trusted);
}
}
} finally {
@@ -393,11 +385,6 @@ public final class DisplayManagerService extends IDisplayManager.Stub {
@Override // Binder call
public void disconnectWifiDisplay() {
- if (mContext.checkCallingPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission");
- }
-
final long token = Binder.clearCallingIdentity();
try {
synchronized (mSyncRoot) {
@@ -412,13 +399,13 @@ public final class DisplayManagerService extends IDisplayManager.Stub {
@Override // Binder call
public void renameWifiDisplay(String address, String alias) {
- if (mContext.checkCallingPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission");
- }
if (address == null) {
throw new IllegalArgumentException("address must not be null");
}
+ if (!canCallerConfigureWifiDisplay()) {
+ throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission to "
+ + "rename a wifi display.");
+ }
final long token = Binder.clearCallingIdentity();
try {
@@ -434,13 +421,13 @@ public final class DisplayManagerService extends IDisplayManager.Stub {
@Override // Binder call
public void forgetWifiDisplay(String address) {
- if (mContext.checkCallingPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission");
- }
if (address == null) {
throw new IllegalArgumentException("address must not be null");
}
+ if (!canCallerConfigureWifiDisplay()) {
+ throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission to "
+ + "forget a wifi display.");
+ }
final long token = Binder.clearCallingIdentity();
try {
@@ -456,11 +443,6 @@ public final class DisplayManagerService extends IDisplayManager.Stub {
@Override // Binder call
public WifiDisplayStatus getWifiDisplayStatus() {
- if (mContext.checkCallingPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Requires CONFIGURE_WIFI_DISPLAY permission");
- }
-
final long token = Binder.clearCallingIdentity();
try {
synchronized (mSyncRoot) {
@@ -475,6 +457,11 @@ public final class DisplayManagerService extends IDisplayManager.Stub {
}
}
+ private boolean canCallerConfigureWifiDisplay() {
+ return mContext.checkCallingPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY)
+ == PackageManager.PERMISSION_GRANTED;
+ }
+
private void registerDefaultDisplayAdapter() {
// Register default display adapter.
synchronized (mSyncRoot) {
diff --git a/services/java/com/android/server/display/WifiDisplayAdapter.java b/services/java/com/android/server/display/WifiDisplayAdapter.java
index 1d50ded..4a89be7 100644
--- a/services/java/com/android/server/display/WifiDisplayAdapter.java
+++ b/services/java/com/android/server/display/WifiDisplayAdapter.java
@@ -27,6 +27,7 @@ import android.hardware.display.WifiDisplayStatus;
import android.media.RemoteDisplay;
import android.os.Handler;
import android.os.IBinder;
+import android.util.Slog;
import android.view.Surface;
import java.io.PrintWriter;
@@ -121,7 +122,17 @@ final class WifiDisplayAdapter extends DisplayAdapter {
});
}
- public void requestConnectLocked(final String address) {
+ public void requestConnectLocked(final String address, final boolean trusted) {
+ if (!trusted) {
+ synchronized (getSyncRoot()) {
+ if (!isRememberedDisplayLocked(address)) {
+ Slog.w(TAG, "Ignoring request by an untrusted client to connect to "
+ + "an unknown wifi display: " + address);
+ return;
+ }
+ }
+ }
+
getHandler().post(new Runnable() {
@Override
public void run() {
@@ -132,6 +143,15 @@ final class WifiDisplayAdapter extends DisplayAdapter {
});
}
+ private boolean isRememberedDisplayLocked(String address) {
+ for (WifiDisplay display : mRememberedDisplays) {
+ if (display.getDeviceAddress().equals(address)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public void requestDisconnectLocked() {
getHandler().post(new Runnable() {
@Override
@@ -241,10 +261,8 @@ final class WifiDisplayAdapter extends DisplayAdapter {
getWifiDisplayStatusLocked());
}
- // Send protected broadcast about wifi display status to receivers that
- // have the required permission.
- getContext().sendBroadcast(intent,
- android.Manifest.permission.CONFIGURE_WIFI_DISPLAY);
+ // Send protected broadcast about wifi display status to registered receivers.
+ getContext().sendBroadcast(intent);
}
};
diff --git a/services/java/com/android/server/dreams/DreamController.java b/services/java/com/android/server/dreams/DreamController.java
index 81c80187..c01a45d 100644
--- a/services/java/com/android/server/dreams/DreamController.java
+++ b/services/java/com/android/server/dreams/DreamController.java
@@ -53,6 +53,8 @@ final class DreamController {
private final Intent mDreamingStoppedIntent = new Intent(Dream.ACTION_DREAMING_STOPPED)
.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
+ private final Intent mCloseNotificationShadeIntent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
+
private DreamRecord mCurrentDream;
public DreamController(Context context, Handler handler, Listener listener) {
@@ -81,6 +83,9 @@ final class DreamController {
public void startDream(Binder token, ComponentName name, boolean isTest, int userId) {
stopDream();
+ // Close the notification shade
+ mContext.sendBroadcast(mCloseNotificationShadeIntent);
+
Slog.i(TAG, "Starting dream: name=" + name + ", isTest=" + isTest + ", userId=" + userId);
mCurrentDream = new DreamRecord(token, name, isTest, userId);
diff --git a/services/java/com/android/server/input/InputManagerService.java b/services/java/com/android/server/input/InputManagerService.java
index 0b4a721..7b0c452 100644
--- a/services/java/com/android/server/input/InputManagerService.java
+++ b/services/java/com/android/server/input/InputManagerService.java
@@ -1238,11 +1238,15 @@ public class InputManagerService extends IInputManager.Stub
}
// Native callback.
- private void notifySwitch(long whenNanos, int switchCode, int switchValue) {
- switch (switchCode) {
- case SW_LID:
- mWindowManagerCallbacks.notifyLidSwitchChanged(whenNanos, switchValue == 0);
- break;
+ private void notifySwitch(long whenNanos, int switchValues, int switchMask) {
+ if (DEBUG) {
+ Slog.d(TAG, "notifySwitch: values=" + Integer.toHexString(switchValues)
+ + ", mask=" + Integer.toHexString(switchMask));
+ }
+
+ if ((switchMask & (1 << SW_LID)) != 0) {
+ final boolean lidOpen = ((switchValues & (1 << SW_LID)) == 0);
+ mWindowManagerCallbacks.notifyLidSwitchChanged(whenNanos, lidOpen);
}
}
diff --git a/services/java/com/android/server/location/LocationBlacklist.java b/services/java/com/android/server/location/LocationBlacklist.java
index 71fa9f9..6ad1a92 100644
--- a/services/java/com/android/server/location/LocationBlacklist.java
+++ b/services/java/com/android/server/location/LocationBlacklist.java
@@ -78,6 +78,7 @@ public final class LocationBlacklist extends ContentObserver {
* (package name matches blacklist, and does not match whitelist)
*/
public boolean isBlacklisted(String packageName) {
+ /*
synchronized (mLock) {
for (String black : mBlacklist) {
if (packageName.startsWith(black)) {
@@ -91,6 +92,7 @@ public final class LocationBlacklist extends ContentObserver {
}
}
}
+ */
return false;
}
diff --git a/services/java/com/android/server/net/NetworkStatsService.java b/services/java/com/android/server/net/NetworkStatsService.java
index f2748a3..0efdead 100644
--- a/services/java/com/android/server/net/NetworkStatsService.java
+++ b/services/java/com/android/server/net/NetworkStatsService.java
@@ -104,7 +104,7 @@ import android.os.RemoteException;
import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
-import android.provider.Settings.Secure;
+import android.provider.Settings.Global;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.EventLog;
@@ -696,7 +696,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
/**
* Update {@link NetworkStatsRecorder} and {@link #mGlobalAlertBytes} to
* reflect current {@link #mPersistThreshold} value. Always defers to
- * {@link Secure} values when defined.
+ * {@link Global} values when defined.
*/
private void updatePersistThresholds() {
mDevRecorder.setPersistThreshold(mSettings.getDevPersistBytes(mPersistThreshold));
@@ -1263,7 +1263,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
/**
* Default external settings that read from
- * {@link android.provider.Settings.Secure}.
+ * {@link android.provider.Settings.Global}.
*/
private static class DefaultNetworkStatsSettings implements NetworkStatsSettings {
private final ContentResolver mResolver;
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index cf22f53..1eafd9c 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -10019,16 +10019,16 @@ public class PackageManagerService extends IPackageManager.Stub {
}
if (loc == PackageHelper.APP_INSTALL_AUTO || loc == PackageHelper.APP_INSTALL_INTERNAL
|| loc == PackageHelper.APP_INSTALL_EXTERNAL) {
- android.provider.Settings.System.putInt(mContext.getContentResolver(),
- android.provider.Settings.Secure.DEFAULT_INSTALL_LOCATION, loc);
+ android.provider.Settings.Global.putInt(mContext.getContentResolver(),
+ android.provider.Settings.Global.DEFAULT_INSTALL_LOCATION, loc);
return true;
}
return false;
}
public int getInstallLocation() {
- return android.provider.Settings.System.getInt(mContext.getContentResolver(),
- android.provider.Settings.Secure.DEFAULT_INSTALL_LOCATION,
+ return android.provider.Settings.Global.getInt(mContext.getContentResolver(),
+ android.provider.Settings.Global.DEFAULT_INSTALL_LOCATION,
PackageHelper.APP_INSTALL_AUTO);
}
@@ -10120,8 +10120,9 @@ public class PackageManagerService extends IPackageManager.Stub {
*/
private boolean isPermissionEnforcedDefault(String permission) {
if (READ_EXTERNAL_STORAGE.equals(permission)) {
- return Secure.getInt(mContext.getContentResolver(),
- Secure.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT, 0) != 0;
+ return android.provider.Settings.Global.getInt(mContext.getContentResolver(),
+ android.provider.Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT, 0)
+ != 0;
} else {
return true;
}
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index efedbd8..23ce52e 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -74,7 +74,6 @@ import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Region;
import android.hardware.display.DisplayManager;
-import android.hardware.input.InputManager;
import android.os.Binder;
import android.os.Bundle;
import android.os.Debug;
@@ -2749,7 +2748,8 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
- if (DEBUG_LAYOUT) Slog.v(TAG, "Relayout " + win + ": " + win.mAttrs);
+ if (DEBUG_LAYOUT) Slog.v(TAG, "Relayout " + win + ": viewVisibility=" + viewVisibility
+ + " " + requestedWidth + "x" + requestedHeight + " " + win.mAttrs);
win.mEnforceSizeCompat = (win.mAttrs.flags & FLAG_COMPATIBLE_WINDOW) != 0;
@@ -4036,7 +4036,8 @@ public class WindowManagerService extends IWindowManager.Stub
}
changed = mFocusedApp != newFocus;
mFocusedApp = newFocus;
- if (DEBUG_FOCUS) Slog.v(TAG, "Set focused app to: " + mFocusedApp);
+ if (DEBUG_FOCUS) Slog.v(TAG, "Set focused app to: " + mFocusedApp
+ + " moveFocusNow=" + moveFocusNow);
if (changed) {
mInputMonitor.setFocusedAppLw(newFocus);
}
@@ -8296,7 +8297,8 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_LAYOUT && !win.mLayoutAttached) {
Slog.v(TAG, "1ST PASS " + win
+ ": gone=" + gone + " mHaveFrame=" + win.mHaveFrame
- + " mLayoutAttached=" + win.mLayoutAttached);
+ + " mLayoutAttached=" + win.mLayoutAttached
+ + " screen changed=" + win.isConfigDiff(ActivityInfo.CONFIG_SCREEN_SIZE));
final AppWindowToken atoken = win.mAppToken;
if (gone) Slog.v(TAG, " GONE: mViewVisibility="
+ win.mViewVisibility + " mRelayoutCalled="
@@ -8318,6 +8320,7 @@ public class WindowManagerService extends IWindowManager.Stub
// windows, since that means "perform layout as normal,
// just don't display").
if (!gone || !win.mHaveFrame || win.mLayoutNeeded
+ || win.isConfigDiff(ActivityInfo.CONFIG_SCREEN_SIZE)
|| win.mAttrs.type == TYPE_UNIVERSE_BACKGROUND) {
if (!win.mLayoutAttached) {
if (initial) {
@@ -8753,10 +8756,7 @@ public class WindowManagerService extends IWindowManager.Stub
!w.mLastContentInsets.equals(w.mContentInsets);
w.mVisibleInsetsChanged |=
!w.mLastVisibleInsets.equals(w.mVisibleInsets);
- boolean configChanged =
- w.mConfiguration != mCurConfiguration
- && (w.mConfiguration == null
- || mCurConfiguration.diff(w.mConfiguration) != 0);
+ boolean configChanged = w.isConfigChanged();
if (DEBUG_CONFIGURATION && configChanged) {
Slog.v(TAG, "Win " + w + " config changed: "
+ mCurConfiguration);
@@ -9254,10 +9254,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_RESIZE || DEBUG_ORIENTATION) Slog.v(TAG,
"Reporting new frame to " + win + ": " + win.mCompatFrame);
int diff = 0;
- boolean configChanged =
- win.mConfiguration != mCurConfiguration
- && (win.mConfiguration == null
- || (diff=mCurConfiguration.diff(win.mConfiguration)) != 0);
+ boolean configChanged = win.isConfigChanged();
if ((DEBUG_RESIZE || DEBUG_ORIENTATION || DEBUG_CONFIGURATION)
&& configChanged) {
Slog.i(TAG, "Sending new config to window " + win + ": "
diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java
index ac958b8..9963d14 100644
--- a/services/java/com/android/server/wm/WindowState.java
+++ b/services/java/com/android/server/wm/WindowState.java
@@ -574,6 +574,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
return mAttrs;
}
+ @Override
public boolean getNeedsMenuLw(WindowManagerPolicy.WindowState bottom) {
int index = -1;
WindowState ws = this;
@@ -612,6 +613,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
return mLayer;
}
+ @Override
public IApplicationToken getAppToken() {
return mAppToken != null ? mAppToken.appToken : null;
}
@@ -801,12 +803,13 @@ final class WindowState implements WindowManagerPolicy.WindowState {
return mWinAnimator.mAnimation != null;
}
+ @Override
public boolean isGoneForLayoutLw() {
final AppWindowToken atoken = mAppToken;
return mViewVisibility == View.GONE
|| !mRelayoutCalled
|| (atoken == null && mRootToken.hidden)
- || (atoken != null && atoken.hiddenRequested)
+ || (atoken != null && (atoken.hiddenRequested || atoken.hidden))
|| mAttachedHidden
|| mExiting || mDestroying;
}
@@ -849,6 +852,18 @@ final class WindowState implements WindowManagerPolicy.WindowState {
mFrame.right >= screenWidth && mFrame.bottom >= screenHeight;
}
+ boolean isConfigChanged() {
+ return mConfiguration != mService.mCurConfiguration
+ && (mConfiguration == null
+ || (mConfiguration.diff(mService.mCurConfiguration) != 0));
+ }
+
+ boolean isConfigDiff(int mask) {
+ return mConfiguration != mService.mCurConfiguration
+ && mConfiguration != null
+ && (mConfiguration.diff(mService.mCurConfiguration) & mask) != 0;
+ }
+
void removeLocked() {
disposeInputChannel();
diff --git a/services/jni/com_android_server_input_InputManagerService.cpp b/services/jni/com_android_server_input_InputManagerService.cpp
index 319cacd..a97becf 100644
--- a/services/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/jni/com_android_server_input_InputManagerService.cpp
@@ -187,7 +187,7 @@ public:
/* --- InputDispatcherPolicyInterface implementation --- */
- virtual void notifySwitch(nsecs_t when, int32_t switchCode, int32_t switchValue,
+ virtual void notifySwitch(nsecs_t when, uint32_t switchValues, uint32_t switchMask,
uint32_t policyFlags);
virtual void notifyConfigurationChanged(nsecs_t when);
virtual nsecs_t notifyANR(const sp<InputApplicationHandle>& inputApplicationHandle,
@@ -527,17 +527,17 @@ String8 NativeInputManager::getDeviceAlias(const InputDeviceIdentifier& identifi
return result;
}
-void NativeInputManager::notifySwitch(nsecs_t when, int32_t switchCode,
- int32_t switchValue, uint32_t policyFlags) {
+void NativeInputManager::notifySwitch(nsecs_t when,
+ uint32_t switchValues, uint32_t switchMask, uint32_t policyFlags) {
#if DEBUG_INPUT_DISPATCHER_POLICY
- ALOGD("notifySwitch - when=%lld, switchCode=%d, switchValue=%d, policyFlags=0x%x",
- when, switchCode, switchValue, policyFlags);
+ ALOGD("notifySwitch - when=%lld, switchValues=0x%08x, switchMask=0x%08x, policyFlags=0x%x",
+ when, switchValues, switchMask, policyFlags);
#endif
JNIEnv* env = jniEnv();
env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifySwitch,
- when, switchCode, switchValue);
+ when, switchValues, switchMask);
checkAndClearExceptionFromCallback(env, "notifySwitch");
}
diff --git a/services/tests/servicestests/src/com/android/server/DropBoxTest.java b/services/tests/servicestests/src/com/android/server/DropBoxTest.java
index f3baff4..6ce0a48 100644
--- a/services/tests/servicestests/src/com/android/server/DropBoxTest.java
+++ b/services/tests/servicestests/src/com/android/server/DropBoxTest.java
@@ -45,10 +45,10 @@ import java.util.zip.GZIPOutputStream;
public class DropBoxTest extends AndroidTestCase {
public void tearDown() throws Exception {
ContentResolver cr = getContext().getContentResolver();
- Settings.Secure.putString(cr, Settings.Secure.DROPBOX_AGE_SECONDS, "");
- Settings.Secure.putString(cr, Settings.Secure.DROPBOX_MAX_FILES, "");
- Settings.Secure.putString(cr, Settings.Secure.DROPBOX_QUOTA_KB, "");
- Settings.Secure.putString(cr, Settings.Secure.DROPBOX_TAG_PREFIX + "DropBoxTest", "");
+ Settings.Global.putString(cr, Settings.Global.DROPBOX_AGE_SECONDS, "");
+ Settings.Global.putString(cr, Settings.Global.DROPBOX_MAX_FILES, "");
+ Settings.Global.putString(cr, Settings.Global.DROPBOX_QUOTA_KB, "");
+ Settings.Global.putString(cr, Settings.Global.DROPBOX_TAG_PREFIX + "DropBoxTest", "");
}
public void testAddText() throws Exception {
@@ -254,13 +254,13 @@ public class DropBoxTest extends AndroidTestCase {
assertTrue(dropbox.isTagEnabled("DropBoxTest"));
ContentResolver cr = getContext().getContentResolver();
- Settings.Secure.putString(cr, Settings.Secure.DROPBOX_TAG_PREFIX + "DropBoxTest",
+ Settings.Global.putString(cr, Settings.Global.DROPBOX_TAG_PREFIX + "DropBoxTest",
"disabled");
dropbox.addText("DropBoxTest", "TEST-DISABLED");
assertFalse(dropbox.isTagEnabled("DropBoxTest"));
- Settings.Secure.putString(cr, Settings.Secure.DROPBOX_TAG_PREFIX + "DropBoxTest",
+ Settings.Global.putString(cr, Settings.Global.DROPBOX_TAG_PREFIX + "DropBoxTest",
"");
dropbox.addText("DropBoxTest", "TEST-ENABLED-AGAIN");
@@ -330,7 +330,7 @@ public class DropBoxTest extends AndroidTestCase {
// Limit storage to 10 blocks
int kb = blockSize * 10 / 1024;
ContentResolver cr = getContext().getContentResolver();
- Settings.Secure.putString(cr, Settings.Secure.DROPBOX_QUOTA_KB, Integer.toString(kb));
+ Settings.Global.putString(cr, Settings.Global.DROPBOX_QUOTA_KB, Integer.toString(kb));
// Three tags using a total of 12 blocks:
// DropBoxTest0 [ ][ ]
@@ -432,8 +432,8 @@ public class DropBoxTest extends AndroidTestCase {
// Limit storage to 10 blocks with an expiration of 1 second
int kb = blockSize * 10 / 1024;
ContentResolver cr = getContext().getContentResolver();
- Settings.Secure.putString(cr, Settings.Secure.DROPBOX_AGE_SECONDS, "1");
- Settings.Secure.putString(cr, Settings.Secure.DROPBOX_QUOTA_KB, Integer.toString(kb));
+ Settings.Global.putString(cr, Settings.Global.DROPBOX_AGE_SECONDS, "1");
+ Settings.Global.putString(cr, Settings.Global.DROPBOX_QUOTA_KB, Integer.toString(kb));
// Write one normal entry and another so big that it is instantly tombstoned
long before = System.currentTimeMillis();
@@ -497,7 +497,7 @@ public class DropBoxTest extends AndroidTestCase {
// Limit to 3 files and add one more entry
ContentResolver cr = getContext().getContentResolver();
- Settings.Secure.putString(cr, Settings.Secure.DROPBOX_MAX_FILES, "3");
+ Settings.Global.putString(cr, Settings.Global.DROPBOX_MAX_FILES, "3");
dropbox.addText("DropBoxTest", "TEST6");
// Verify only 3 files left
diff --git a/services/tests/servicestests/src/com/android/server/ThrottleServiceTest.java b/services/tests/servicestests/src/com/android/server/ThrottleServiceTest.java
index afa0eec..569acee 100644
--- a/services/tests/servicestests/src/com/android/server/ThrottleServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/ThrottleServiceTest.java
@@ -242,9 +242,9 @@ public class ThrottleServiceTest extends AndroidTestCase {
*/
public void setThrottlePolicy(long thresholdBytes, int valueKbitps, int resetDay) {
final ContentResolver resolver = getContext().getContentResolver();
- Settings.Secure.putLong(resolver, Settings.Secure.THROTTLE_THRESHOLD_BYTES, thresholdBytes);
- Settings.Secure.putInt(resolver, Settings.Secure.THROTTLE_VALUE_KBITSPS, valueKbitps);
- Settings.Secure.putInt(resolver, Settings.Secure.THROTTLE_RESET_DAY, resetDay);
+ Settings.Global.putLong(resolver, Settings.Global.THROTTLE_THRESHOLD_BYTES, thresholdBytes);
+ Settings.Global.putInt(resolver, Settings.Global.THROTTLE_VALUE_KBITSPS, valueKbitps);
+ Settings.Global.putInt(resolver, Settings.Global.THROTTLE_RESET_DAY, resetDay);
}
/**
@@ -252,9 +252,9 @@ public class ThrottleServiceTest extends AndroidTestCase {
*/
public void clearThrottlePolicy() {
final ContentResolver resolver = getContext().getContentResolver();
- Settings.Secure.putString(resolver, Settings.Secure.THROTTLE_THRESHOLD_BYTES, null);
- Settings.Secure.putString(resolver, Settings.Secure.THROTTLE_VALUE_KBITSPS, null);
- Settings.Secure.putString(resolver, Settings.Secure.THROTTLE_RESET_DAY, null);
+ Settings.Global.putString(resolver, Settings.Global.THROTTLE_THRESHOLD_BYTES, null);
+ Settings.Global.putString(resolver, Settings.Global.THROTTLE_VALUE_KBITSPS, null);
+ Settings.Global.putString(resolver, Settings.Global.THROTTLE_RESET_DAY, null);
}
/**