summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/ConnectivityService.java7
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java4
-rw-r--r--services/java/com/android/server/LocationManagerService.java3
-rw-r--r--services/java/com/android/server/NativeDaemonEvent.java4
-rw-r--r--[-rwxr-xr-x]services/java/com/android/server/NotificationManagerService.java0
-rw-r--r--[-rwxr-xr-x]services/java/com/android/server/VibratorService.java0
-rw-r--r--services/java/com/android/server/WifiService.java4
-rw-r--r--services/java/com/android/server/accessibility/AccessibilityManagerService.java2
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java45
-rw-r--r--[-rwxr-xr-x]services/java/com/android/server/am/ActivityStack.java0
-rw-r--r--[-rwxr-xr-x]services/java/com/android/server/am/package.html0
-rw-r--r--[-rwxr-xr-x]services/java/com/android/server/location/ComprehensiveCountryDetector.java0
-rw-r--r--[-rwxr-xr-x]services/java/com/android/server/location/GpsLocationProvider.java0
-rw-r--r--[-rwxr-xr-x]services/java/com/android/server/location/LocationBasedCountryDetector.java0
-rw-r--r--services/java/com/android/server/net/NetworkPolicyManagerService.java8
-rw-r--r--services/java/com/android/server/net/NetworkStatsService.java10
-rw-r--r--[-rwxr-xr-x]services/java/com/android/server/wm/WindowManagerService.java34
-rw-r--r--[-rwxr-xr-x]services/jni/com_android_server_location_GpsLocationProvider.cpp0
-rw-r--r--[-rwxr-xr-x]services/tests/servicestests/src/com/android/server/location/LocationBasedCountryDetectorTest.java0
19 files changed, 79 insertions, 42 deletions
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index a7c4d73..cccaf1c 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -1183,8 +1183,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
log("startUsingNetworkFeature reconnecting to " + networkType + ": " +
feature);
}
- network.reconnect();
- return PhoneConstants.APN_REQUEST_STARTED;
+ if (network.reconnect()) {
+ return PhoneConstants.APN_REQUEST_STARTED;
+ } else {
+ return PhoneConstants.APN_REQUEST_FAILED;
+ }
} else {
// need to remember this unsupported request so we respond appropriately on stop
synchronized(this) {
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 8eb61dd..cd920b1 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -602,12 +602,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
mHandler = new Handler(this);
mIWindowManager = IWindowManager.Stub.asInterface(
ServiceManager.getService(Context.WINDOW_SERVICE));
- mCaller = new HandlerCaller(context, new HandlerCaller.Callback() {
+ mCaller = new HandlerCaller(context, null, new HandlerCaller.Callback() {
@Override
public void executeMessage(Message msg) {
handleMessage(msg);
}
- });
+ }, true /*asyncHandler*/);
mWindowManagerService = windowManager;
mHardKeyboardListener = new HardKeyboardListener();
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index f21f826..0f08c56 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -1885,13 +1885,12 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
public void removeTestProvider(String provider) {
checkMockPermissionsSafe();
synchronized (mLock) {
- MockProvider mockProvider = mMockProviders.get(provider);
+ MockProvider mockProvider = mMockProviders.remove(provider);
if (mockProvider == null) {
throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
}
long identity = Binder.clearCallingIdentity();
removeProviderLocked(mProvidersByName.get(provider));
- mMockProviders.remove(mockProvider);
// reinstate real provider if available
LocationProviderInterface realProvider = mRealProviders.get(provider);
diff --git a/services/java/com/android/server/NativeDaemonEvent.java b/services/java/com/android/server/NativeDaemonEvent.java
index f11ae1d..2095152 100644
--- a/services/java/com/android/server/NativeDaemonEvent.java
+++ b/services/java/com/android/server/NativeDaemonEvent.java
@@ -223,8 +223,8 @@ public class NativeDaemonEvent {
current++; // skip the trailing quote
}
// unescape stuff within the word
- word.replace("\\\\", "\\");
- word.replace("\\\"", "\"");
+ word = word.replace("\\\\", "\\");
+ word = word.replace("\\\"", "\"");
if (DEBUG_ROUTINE) Slog.e(LOGTAG, "found '" + word + "'");
parsed.add(word);
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index 37d7ce7..37d7ce7 100755..100644
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
diff --git a/services/java/com/android/server/VibratorService.java b/services/java/com/android/server/VibratorService.java
index df91dec..df91dec 100755..100644
--- a/services/java/com/android/server/VibratorService.java
+++ b/services/java/com/android/server/VibratorService.java
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index 98794c9..dfcc72b 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -1577,7 +1577,7 @@ public class WifiService extends IWifiManager.Stub {
}
int uid = Binder.getCallingUid();
- Long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
mBatteryStats.noteWifiMulticastEnabled(uid);
} catch (RemoteException e) {
@@ -1613,7 +1613,7 @@ public class WifiService extends IWifiManager.Stub {
mWifiStateMachine.startFilteringMulticastV4Packets();
}
- Long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
mBatteryStats.noteWifiMulticastDisabled(uid);
} catch (RemoteException e) {
diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
index 671cbfe..a34d44c 100644
--- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -1123,7 +1123,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
return;
}
mEnableTouchExplorationDialog = new AlertDialog.Builder(mContext)
- .setIcon(android.R.drawable.ic_dialog_alert)
+ .setIconAttribute(android.R.attr.alertDialogIcon)
.setPositiveButton(android.R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 49dc220..2ba9a10 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -115,6 +115,7 @@ import android.os.ServiceManager;
import android.os.StrictMode;
import android.os.SystemClock;
import android.os.SystemProperties;
+import android.os.UpdateLock;
import android.os.UserHandle;
import android.provider.Settings;
import android.text.format.Time;
@@ -191,6 +192,7 @@ public final class ActivityManagerService extends ActivityManagerNative
static final boolean DEBUG_POWER = localLOGV || false;
static final boolean DEBUG_POWER_QUICK = DEBUG_POWER || false;
static final boolean DEBUG_MU = localLOGV || false;
+ static final boolean DEBUG_IMMERSIVE = localLOGV || false;
static final boolean VALIDATE_TOKENS = false;
static final boolean SHOW_ACTIVITY_START_TIME = true;
@@ -827,6 +829,12 @@ public final class ActivityManagerService extends ActivityManagerNative
long mLastWriteTime = 0;
/**
+ * Used to retain an update lock when the foreground activity is in
+ * immersive mode.
+ */
+ final UpdateLock mUpdateLock = new UpdateLock("immersive");
+
+ /**
* Set to true after the system has finished booting.
*/
boolean mBooted = false;
@@ -895,6 +903,7 @@ public final class ActivityManagerService extends ActivityManagerNative
static final int REPORT_USER_SWITCH_MSG = 34;
static final int CONTINUE_USER_SWITCH_MSG = 35;
static final int USER_SWITCH_TIMEOUT_MSG = 36;
+ static final int IMMERSIVE_MODE_LOCK_MSG = 37;
static final int FIRST_ACTIVITY_STACK_MSG = 100;
static final int FIRST_BROADCAST_QUEUE_MSG = 200;
@@ -1356,6 +1365,21 @@ public final class ActivityManagerService extends ActivityManagerNative
timeoutUserSwitch((UserStartedState)msg.obj, msg.arg1, msg.arg2);
break;
}
+ case IMMERSIVE_MODE_LOCK_MSG: {
+ final boolean nextState = (msg.arg1 != 0);
+ if (mUpdateLock.isHeld() != nextState) {
+ if (DEBUG_IMMERSIVE) {
+ final ActivityRecord r = (ActivityRecord) msg.obj;
+ Slog.d(TAG, "Applying new update lock state '" + nextState + "' for " + r);
+ }
+ if (nextState) {
+ mUpdateLock.acquire();
+ } else {
+ mUpdateLock.release();
+ }
+ }
+ break;
+ }
}
}
};
@@ -1822,9 +1846,20 @@ public final class ActivityManagerService extends ActivityManagerNative
if (r != null) {
mWindowManager.setFocusedApp(r.appToken, true);
}
+ applyUpdateLockStateLocked(r);
}
}
+ final void applyUpdateLockStateLocked(ActivityRecord r) {
+ // Modifications to the UpdateLock state are done on our handler, outside
+ // the activity manager's locks. The new state is determined based on the
+ // state *now* of the relevant activity record. The object is passed to
+ // the handler solely for logging detail, not to be consulted/modified.
+ final boolean nextState = r != null && r.immersive;
+ mHandler.sendMessage(
+ mHandler.obtainMessage(IMMERSIVE_MODE_LOCK_MSG, (nextState) ? 1 : 0, 0, r));
+ }
+
private final void updateLruProcessInternalLocked(ProcessRecord app, int bestPos) {
// put it on the LRU to keep track of when it should be exited.
int lrui = mLruProcesses.indexOf(app);
@@ -7421,11 +7456,19 @@ public final class ActivityManagerService extends ActivityManagerNative
public void setImmersive(IBinder token, boolean immersive) {
synchronized(this) {
- ActivityRecord r = mMainStack.isInStackLocked(token);
+ final ActivityRecord r = mMainStack.isInStackLocked(token);
if (r == null) {
throw new IllegalArgumentException();
}
r.immersive = immersive;
+
+ // update associated state if we're frontmost
+ if (r == mFocusedActivity) {
+ if (DEBUG_IMMERSIVE) {
+ Slog.d(TAG, "Frontmost changed immersion: "+ r);
+ }
+ applyUpdateLockStateLocked(r);
+ }
}
}
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index 27dd732..27dd732 100755..100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
diff --git a/services/java/com/android/server/am/package.html b/services/java/com/android/server/am/package.html
index c9f96a6..c9f96a6 100755..100644
--- a/services/java/com/android/server/am/package.html
+++ b/services/java/com/android/server/am/package.html
diff --git a/services/java/com/android/server/location/ComprehensiveCountryDetector.java b/services/java/com/android/server/location/ComprehensiveCountryDetector.java
index 354858b..354858b 100755..100644
--- a/services/java/com/android/server/location/ComprehensiveCountryDetector.java
+++ b/services/java/com/android/server/location/ComprehensiveCountryDetector.java
diff --git a/services/java/com/android/server/location/GpsLocationProvider.java b/services/java/com/android/server/location/GpsLocationProvider.java
index c272da4..c272da4 100755..100644
--- a/services/java/com/android/server/location/GpsLocationProvider.java
+++ b/services/java/com/android/server/location/GpsLocationProvider.java
diff --git a/services/java/com/android/server/location/LocationBasedCountryDetector.java b/services/java/com/android/server/location/LocationBasedCountryDetector.java
index 03db621..03db621 100755..100644
--- a/services/java/com/android/server/location/LocationBasedCountryDetector.java
+++ b/services/java/com/android/server/location/LocationBasedCountryDetector.java
diff --git a/services/java/com/android/server/net/NetworkPolicyManagerService.java b/services/java/com/android/server/net/NetworkPolicyManagerService.java
index b839331..b09390c 100644
--- a/services/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -425,11 +425,9 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
private BroadcastReceiver mScreenReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- synchronized (mRulesLock) {
- // screen-related broadcasts are protected by system, no need
- // for permissions check.
- mHandler.obtainMessage(MSG_SCREEN_ON_CHANGED).sendToTarget();
- }
+ // screen-related broadcasts are protected by system, no need
+ // for permissions check.
+ mHandler.obtainMessage(MSG_SCREEN_ON_CHANGED).sendToTarget();
}
};
diff --git a/services/java/com/android/server/net/NetworkStatsService.java b/services/java/com/android/server/net/NetworkStatsService.java
index 546f2be..74be472 100644
--- a/services/java/com/android/server/net/NetworkStatsService.java
+++ b/services/java/com/android/server/net/NetworkStatsService.java
@@ -940,14 +940,14 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
}
private void performPoll(int flags) {
+ // try refreshing time source when stale
+ if (mTime.getCacheAge() > mSettings.getTimeCacheMaxAge()) {
+ mTime.forceRefresh();
+ }
+
synchronized (mStatsLock) {
mWakeLock.acquire();
- // try refreshing time source when stale
- if (mTime.getCacheAge() > mSettings.getTimeCacheMaxAge()) {
- mTime.forceRefresh();
- }
-
try {
performPollLocked(flags);
} finally {
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 5b9fc9a..0466c15 100755..100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -4153,8 +4153,7 @@ public class WindowManagerService extends IWindowManager.Stub
mStartingIconInTransition = false;
mSkipAppTransitionAnimation = false;
mH.removeMessages(H.APP_TRANSITION_TIMEOUT);
- mH.sendMessageDelayed(mH.obtainMessage(H.APP_TRANSITION_TIMEOUT),
- 5000);
+ mH.sendEmptyMessageDelayed(H.APP_TRANSITION_TIMEOUT, 5000);
}
}
}
@@ -4725,8 +4724,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (mAppsFreezingScreen == 1) {
startFreezingDisplayLocked(false, 0, 0);
mH.removeMessages(H.APP_FREEZE_TIMEOUT);
- mH.sendMessageDelayed(mH.obtainMessage(H.APP_FREEZE_TIMEOUT),
- 5000);
+ mH.sendEmptyMessageDelayed(H.APP_FREEZE_TIMEOUT, 5000);
}
}
final int N = wtoken.allAppWindows.size();
@@ -5246,8 +5244,7 @@ public class WindowManagerService extends IWindowManager.Stub
try {
startFreezingDisplayLocked(false, exitAnim, enterAnim);
mH.removeMessages(H.CLIENT_FREEZE_TIMEOUT);
- mH.sendMessageDelayed(mH.obtainMessage(H.CLIENT_FREEZE_TIMEOUT),
- 5000);
+ mH.sendEmptyMessageDelayed(H.CLIENT_FREEZE_TIMEOUT, 5000);
} finally {
Binder.restoreCallingIdentity(origId);
}
@@ -5375,7 +5372,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
// Persist setting
- mH.obtainMessage(H.PERSIST_ANIMATION_SCALE).sendToTarget();
+ mH.sendEmptyMessage(H.PERSIST_ANIMATION_SCALE);
}
public void setAnimationScales(float[] scales) {
@@ -5397,7 +5394,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
// Persist setting
- mH.obtainMessage(H.PERSIST_ANIMATION_SCALE).sendToTarget();
+ mH.sendEmptyMessage(H.PERSIST_ANIMATION_SCALE);
}
private void setAnimatorDurationScale(float scale) {
@@ -5507,8 +5504,7 @@ public class WindowManagerService extends IWindowManager.Stub
hideBootMessagesLocked();
// If the screen still doesn't come up after 30 seconds, give
// up and turn it on.
- Message msg = mH.obtainMessage(H.BOOT_TIMEOUT);
- mH.sendMessageDelayed(msg, 30*1000);
+ mH.sendEmptyMessageDelayed(H.BOOT_TIMEOUT, 30*1000);
}
mPolicy.systemBooted();
@@ -5531,7 +5527,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (!mSystemBooted && !mShowingBootMessages) {
return;
}
- mH.sendMessage(mH.obtainMessage(H.ENABLE_SCREEN));
+ mH.sendEmptyMessage(H.ENABLE_SCREEN);
}
public void performBootTimeout() {
@@ -6107,7 +6103,7 @@ public class WindowManagerService extends IWindowManager.Stub
mWindowsFreezingScreen = true;
mH.removeMessages(H.WINDOW_FREEZE_TIMEOUT);
- mH.sendMessageDelayed(mH.obtainMessage(H.WINDOW_FREEZE_TIMEOUT),
+ mH.sendEmptyMessageDelayed(H.WINDOW_FREEZE_TIMEOUT,
WINDOW_FREEZE_TIMEOUT_DURATION);
mWaitingForConfig = true;
getDefaultDisplayContentLocked().layoutNeeded = true;
@@ -7636,8 +7632,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (mAnimator.mAnimating || mLayoutToAnim.mAnimationScheduled) {
// If we are animating, don't do the gc now but
// delay a bit so we don't interrupt the animation.
- mH.sendMessageDelayed(mH.obtainMessage(H.FORCE_GC),
- 2000);
+ sendEmptyMessageDelayed(H.FORCE_GC, 2000);
return;
}
// If we are currently rotating the display, it will
@@ -7762,7 +7757,7 @@ public class WindowManagerService extends IWindowManager.Stub
// Used to send multiple changes from the animation side to the layout side.
synchronized (mWindowMap) {
if (copyAnimToLayoutParamsLocked()) {
- mH.sendEmptyMessage(CLEAR_PENDING_ACTIONS);
+ sendEmptyMessage(CLEAR_PENDING_ACTIONS);
performLayoutAndPlaceSurfacesLocked();
}
}
@@ -8351,7 +8346,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (mWindowsChanged && !mWindowChangeListeners.isEmpty()) {
mH.removeMessages(H.REPORT_WINDOWS_CHANGE);
- mH.sendMessage(mH.obtainMessage(H.REPORT_WINDOWS_CHANGE));
+ mH.sendEmptyMessage(H.REPORT_WINDOWS_CHANGE);
}
} catch (RuntimeException e) {
mInLayout = false;
@@ -8547,8 +8542,8 @@ public class WindowManagerService extends IWindowManager.Stub
// XXX should probably keep timeout from
// when we first froze the display.
mH.removeMessages(H.WINDOW_FREEZE_TIMEOUT);
- mH.sendMessageDelayed(mH.obtainMessage(
- H.WINDOW_FREEZE_TIMEOUT), WINDOW_FREEZE_TIMEOUT_DURATION);
+ mH.sendEmptyMessageDelayed(H.WINDOW_FREEZE_TIMEOUT,
+ WINDOW_FREEZE_TIMEOUT_DURATION);
}
}
}
@@ -10225,8 +10220,7 @@ public class WindowManagerService extends IWindowManager.Stub
// processes holds on others can be released if they are
// no longer needed.
mH.removeMessages(H.FORCE_GC);
- mH.sendMessageDelayed(mH.obtainMessage(H.FORCE_GC),
- 2000);
+ mH.sendEmptyMessageDelayed(H.FORCE_GC, 2000);
mScreenFrozenLock.release();
diff --git a/services/jni/com_android_server_location_GpsLocationProvider.cpp b/services/jni/com_android_server_location_GpsLocationProvider.cpp
index 50bd46e..50bd46e 100755..100644
--- a/services/jni/com_android_server_location_GpsLocationProvider.cpp
+++ b/services/jni/com_android_server_location_GpsLocationProvider.cpp
diff --git a/services/tests/servicestests/src/com/android/server/location/LocationBasedCountryDetectorTest.java b/services/tests/servicestests/src/com/android/server/location/LocationBasedCountryDetectorTest.java
index 5f5d668..5f5d668 100755..100644
--- a/services/tests/servicestests/src/com/android/server/location/LocationBasedCountryDetectorTest.java
+++ b/services/tests/servicestests/src/com/android/server/location/LocationBasedCountryDetectorTest.java