summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/ActivityThread.java2
-rw-r--r--core/java/android/hardware/camera2/legacy/CameraDeviceState.java42
-rw-r--r--core/java/android/hardware/camera2/legacy/GLThreadManager.java82
-rw-r--r--core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java14
-rw-r--r--core/java/android/hardware/camera2/legacy/RequestThreadManager.java36
-rw-r--r--core/java/android/view/HardwareRenderer.java12
-rw-r--r--core/java/android/view/ViewRootImpl.java3
-rw-r--r--core/java/android/view/WindowManagerGlobal.java34
-rw-r--r--core/res/res/values-mcc310-mnc150/config.xml4
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/model/MutexFileProvider.java2
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceDelegate.java1
-rw-r--r--services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java16
-rwxr-xr-xservices/core/java/com/android/server/am/ActiveServices.java6
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityManagerService.java16
14 files changed, 185 insertions, 85 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 7d0d27fdef2e..dd49009281f3 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -5132,6 +5132,8 @@ public final class ActivityThread {
// process.
if (!ActivityManager.isHighEndGfx()) {
HardwareRenderer.disable(true);
+ } else {
+ HardwareRenderer.enableForegroundTrimming();
}
ActivityThread thread = new ActivityThread();
thread.attach(true);
diff --git a/core/java/android/hardware/camera2/legacy/CameraDeviceState.java b/core/java/android/hardware/camera2/legacy/CameraDeviceState.java
index 6aab53cf3c03..e96c15f7a270 100644
--- a/core/java/android/hardware/camera2/legacy/CameraDeviceState.java
+++ b/core/java/android/hardware/camera2/legacy/CameraDeviceState.java
@@ -16,8 +16,8 @@
package android.hardware.camera2.legacy;
+import android.hardware.camera2.impl.CameraDeviceImpl;
import android.hardware.camera2.impl.CameraMetadataNative;
-import android.hardware.camera2.utils.CameraBinderDecorator;
import android.os.Handler;
import android.util.Log;
@@ -53,7 +53,7 @@ public class CameraDeviceState {
"CAPTURING"};
private int mCurrentState = STATE_UNCONFIGURED;
- private int mCurrentError = CameraBinderDecorator.NO_ERROR;
+ private int mCurrentError = NO_CAPTURE_ERROR;
private RequestHolder mCurrentRequest = null;
@@ -87,7 +87,7 @@ public class CameraDeviceState {
* </p>
*
* @param error the error to set. Should be one of the error codes defined in
- * {@link android.hardware.camera2.utils.CameraBinderDecorator}.
+ * {@link CameraDeviceImpl.CameraDeviceCallbacks}.
*/
public synchronized void setError(int error) {
mCurrentError = error;
@@ -102,11 +102,11 @@ public class CameraDeviceState {
* {@link CameraDeviceStateListener#onConfiguring()} will be called.
* </p>
*
- * @return {@link CameraBinderDecorator#NO_ERROR}, or an error if one has occurred.
+ * @return {@code false} if an error has occurred.
*/
- public synchronized int setConfiguring() {
+ public synchronized boolean setConfiguring() {
doStateTransition(STATE_CONFIGURING);
- return mCurrentError;
+ return mCurrentError == NO_CAPTURE_ERROR;
}
/**
@@ -117,11 +117,11 @@ public class CameraDeviceState {
* {@link CameraDeviceStateListener#onIdle()} will be called.
* </p>
*
- * @return {@link CameraBinderDecorator#NO_ERROR}, or an error if one has occurred.
+ * @return {@code false} if an error has occurred.
*/
- public synchronized int setIdle() {
+ public synchronized boolean setIdle() {
doStateTransition(STATE_IDLE);
- return mCurrentError;
+ return mCurrentError == NO_CAPTURE_ERROR;
}
/**
@@ -137,13 +137,13 @@ public class CameraDeviceState {
* @param captureError Report a recoverable error for a single request using a valid
* error code for {@code ICameraDeviceCallbacks}, or
* {@link #NO_CAPTURE_ERROR}
- * @return {@link CameraBinderDecorator#NO_ERROR}, or an error if one has occurred.
+ * @return {@code false} if an error has occurred.
*/
- public synchronized int setCaptureStart(final RequestHolder request, long timestamp,
+ public synchronized boolean setCaptureStart(final RequestHolder request, long timestamp,
int captureError) {
mCurrentRequest = request;
doStateTransition(STATE_CAPTURING, timestamp, captureError);
- return mCurrentError;
+ return mCurrentError == NO_CAPTURE_ERROR;
}
/**
@@ -161,16 +161,16 @@ public class CameraDeviceState {
* @param captureError Report a recoverable error for a single buffer or result using a valid
* error code for {@code ICameraDeviceCallbacks}, or
* {@link #NO_CAPTURE_ERROR}.
- * @return {@link CameraBinderDecorator#NO_ERROR}, or an error if one has occurred.
+ * @return {@code false} if an error has occurred.
*/
- public synchronized int setCaptureResult(final RequestHolder request,
+ public synchronized boolean setCaptureResult(final RequestHolder request,
final CameraMetadataNative result,
final int captureError) {
if (mCurrentState != STATE_CAPTURING) {
Log.e(TAG, "Cannot receive result while in state: " + mCurrentState);
- mCurrentError = CameraBinderDecorator.INVALID_OPERATION;
+ mCurrentError = CameraDeviceImpl.CameraDeviceCallbacks.ERROR_CAMERA_DEVICE;
doStateTransition(STATE_ERROR);
- return mCurrentError;
+ return mCurrentError == NO_CAPTURE_ERROR;
}
if (mCurrentHandler != null && mCurrentListener != null) {
@@ -190,7 +190,7 @@ public class CameraDeviceState {
});
}
}
- return mCurrentError;
+ return mCurrentError == NO_CAPTURE_ERROR;
}
/**
@@ -206,7 +206,7 @@ public class CameraDeviceState {
}
private void doStateTransition(int newState) {
- doStateTransition(newState, /*timestamp*/0, CameraBinderDecorator.NO_ERROR);
+ doStateTransition(newState, /*timestamp*/0, NO_CAPTURE_ERROR);
}
private void doStateTransition(int newState, final long timestamp, final int error) {
@@ -233,7 +233,7 @@ public class CameraDeviceState {
case STATE_CONFIGURING:
if (mCurrentState != STATE_UNCONFIGURED && mCurrentState != STATE_IDLE) {
Log.e(TAG, "Cannot call configure while in state: " + mCurrentState);
- mCurrentError = CameraBinderDecorator.INVALID_OPERATION;
+ mCurrentError = CameraDeviceImpl.CameraDeviceCallbacks.ERROR_CAMERA_DEVICE;
doStateTransition(STATE_ERROR);
break;
}
@@ -255,7 +255,7 @@ public class CameraDeviceState {
if (mCurrentState != STATE_CONFIGURING && mCurrentState != STATE_CAPTURING) {
Log.e(TAG, "Cannot call idle while in state: " + mCurrentState);
- mCurrentError = CameraBinderDecorator.INVALID_OPERATION;
+ mCurrentError = CameraDeviceImpl.CameraDeviceCallbacks.ERROR_CAMERA_DEVICE;
doStateTransition(STATE_ERROR);
break;
}
@@ -274,7 +274,7 @@ public class CameraDeviceState {
case STATE_CAPTURING:
if (mCurrentState != STATE_IDLE && mCurrentState != STATE_CAPTURING) {
Log.e(TAG, "Cannot call capture while in state: " + mCurrentState);
- mCurrentError = CameraBinderDecorator.INVALID_OPERATION;
+ mCurrentError = CameraDeviceImpl.CameraDeviceCallbacks.ERROR_CAMERA_DEVICE;
doStateTransition(STATE_ERROR);
break;
}
diff --git a/core/java/android/hardware/camera2/legacy/GLThreadManager.java b/core/java/android/hardware/camera2/legacy/GLThreadManager.java
index 2c584ef7752c..c8e014783239 100644
--- a/core/java/android/hardware/camera2/legacy/GLThreadManager.java
+++ b/core/java/android/hardware/camera2/legacy/GLThreadManager.java
@@ -17,6 +17,7 @@
package android.hardware.camera2.legacy;
import android.graphics.SurfaceTexture;
+import android.hardware.camera2.impl.CameraDeviceImpl;
import android.os.ConditionVariable;
import android.os.Handler;
import android.os.Message;
@@ -42,6 +43,8 @@ public class GLThreadManager {
private CaptureCollector mCaptureCollector;
+ private final CameraDeviceState mDeviceState;
+
private final SurfaceTextureRenderer mTextureRenderer;
private final RequestHandlerThread mGLHandlerThread;
@@ -76,42 +79,47 @@ public class GLThreadManager {
if (mCleanup) {
return true;
}
- switch (msg.what) {
- case MSG_NEW_CONFIGURATION:
- ConfigureHolder configure = (ConfigureHolder) msg.obj;
- mTextureRenderer.cleanupEGLContext();
- mTextureRenderer.configureSurfaces(configure.surfaces);
- mCaptureCollector = checkNotNull(configure.collector);
- configure.condition.open();
- mConfigured = true;
- break;
- case MSG_NEW_FRAME:
- if (mDroppingFrames) {
- Log.w(TAG, "Ignoring frame.");
+ try {
+ switch (msg.what) {
+ case MSG_NEW_CONFIGURATION:
+ ConfigureHolder configure = (ConfigureHolder) msg.obj;
+ mTextureRenderer.cleanupEGLContext();
+ mTextureRenderer.configureSurfaces(configure.surfaces);
+ mCaptureCollector = checkNotNull(configure.collector);
+ configure.condition.open();
+ mConfigured = true;
+ break;
+ case MSG_NEW_FRAME:
+ if (mDroppingFrames) {
+ Log.w(TAG, "Ignoring frame.");
+ break;
+ }
+ if (DEBUG) {
+ mPrevCounter.countAndLog();
+ }
+ if (!mConfigured) {
+ Log.e(TAG, "Dropping frame, EGL context not configured!");
+ }
+ mTextureRenderer.drawIntoSurfaces(mCaptureCollector);
+ break;
+ case MSG_CLEANUP:
+ mTextureRenderer.cleanupEGLContext();
+ mCleanup = true;
+ mConfigured = false;
+ break;
+ case MSG_DROP_FRAMES:
+ mDroppingFrames = true;
+ break;
+ case MSG_ALLOW_FRAMES:
+ mDroppingFrames = false;
+ break;
+ default:
+ Log.e(TAG, "Unhandled message " + msg.what + " on GLThread.");
break;
- }
- if (DEBUG) {
- mPrevCounter.countAndLog();
- }
- if (!mConfigured) {
- Log.e(TAG, "Dropping frame, EGL context not configured!");
- }
- mTextureRenderer.drawIntoSurfaces(mCaptureCollector);
- break;
- case MSG_CLEANUP:
- mTextureRenderer.cleanupEGLContext();
- mCleanup = true;
- mConfigured = false;
- break;
- case MSG_DROP_FRAMES:
- mDroppingFrames = true;
- break;
- case MSG_ALLOW_FRAMES:
- mDroppingFrames = false;
- break;
- default:
- Log.e(TAG, "Unhandled message " + msg.what + " on GLThread.");
- break;
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "Received exception on GL render thread: ", e);
+ mDeviceState.setError(CameraDeviceImpl.CameraDeviceCallbacks.ERROR_CAMERA_DEVICE);
}
return true;
}
@@ -122,11 +130,13 @@ public class GLThreadManager {
*
* @param cameraId the camera id for this thread.
* @param facing direction the camera is facing.
+ * @param state {@link CameraDeviceState} to use for error handling.
*/
- public GLThreadManager(int cameraId, int facing) {
+ public GLThreadManager(int cameraId, int facing, CameraDeviceState state) {
mTextureRenderer = new SurfaceTextureRenderer(facing);
TAG = String.format("CameraDeviceGLThread-%d", cameraId);
mGLHandlerThread = new RequestHandlerThread(TAG, mGLHandlerCb);
+ mDeviceState = state;
}
/**
diff --git a/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java b/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java
index 9143152d0522..a724b4142274 100644
--- a/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java
+++ b/core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java
@@ -26,6 +26,7 @@ import android.hardware.camera2.ICameraDeviceCallbacks;
import android.hardware.camera2.params.StreamConfiguration;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.hardware.camera2.utils.ArrayUtils;
+import android.hardware.camera2.utils.CameraBinderDecorator;
import android.hardware.camera2.utils.LongParcelable;
import android.hardware.camera2.impl.CameraMetadataNative;
import android.hardware.camera2.utils.CameraRuntimeException;
@@ -288,17 +289,18 @@ public class LegacyCameraDevice implements AutoCloseable {
}
}
- int error = mDeviceState.setConfiguring();
- if (error == NO_ERROR) {
+ boolean success = false;
+ if (mDeviceState.setConfiguring()) {
mRequestThreadManager.configure(outputs);
- error = mDeviceState.setIdle();
+ success = mDeviceState.setIdle();
}
- if (error == NO_ERROR) {
+ if (success) {
mConfiguredSurfaces = outputs != null ? new ArrayList<>(outputs) : null;
+ } else {
+ return CameraBinderDecorator.INVALID_OPERATION;
}
-
- return error;
+ return CameraBinderDecorator.NO_ERROR;
}
/**
diff --git a/core/java/android/hardware/camera2/legacy/RequestThreadManager.java b/core/java/android/hardware/camera2/legacy/RequestThreadManager.java
index 87ee1eef64f2..788b6d8db16a 100644
--- a/core/java/android/hardware/camera2/legacy/RequestThreadManager.java
+++ b/core/java/android/hardware/camera2/legacy/RequestThreadManager.java
@@ -98,6 +98,7 @@ public class RequestThreadManager {
private SurfaceTexture mDummyTexture;
private Surface mDummySurface;
+ private final Object mIdleLock = new Object();
private final FpsCounter mPrevCounter = new FpsCounter("Incoming Preview");
private final FpsCounter mRequestCounter = new FpsCounter("Incoming Requests");
@@ -173,6 +174,14 @@ public class RequestThreadManager {
}
}
+ private final Camera.ErrorCallback mErrorCallback = new Camera.ErrorCallback() {
+ @Override
+ public void onError(int i, Camera camera) {
+ Log.e(TAG, "Received error " + i + " from the Camera1 ErrorCallback");
+ mDeviceState.setError(CameraDeviceImpl.CameraDeviceCallbacks.ERROR_CAMERA_DEVICE);
+ }
+ };
+
private final ConditionVariable mReceivedJpeg = new ConditionVariable(false);
private final Camera.PictureCallback mJpegCallback = new Camera.PictureCallback() {
@@ -405,7 +414,7 @@ public class RequestThreadManager {
// TODO: Detect and optimize single-output paths here to skip stream teeing.
if (mGLThreadManager == null) {
- mGLThreadManager = new GLThreadManager(mCameraId, facing);
+ mGLThreadManager = new GLThreadManager(mCameraId, facing, mDeviceState);
mGLThreadManager.start();
}
mGLThreadManager.waitUntilStarted();
@@ -617,9 +626,20 @@ public class RequestThreadManager {
CameraDeviceImpl.CameraDeviceCallbacks.ERROR_CAMERA_DEVICE);
break;
}
- mDeviceState.setIdle();
- break;
- } else {
+
+ synchronized (mIdleLock) {
+ // Retry the the request queue.
+ nextBurst = mRequestQueue.getNext();
+
+ // If we still have no queued requests, go idle.
+ if (nextBurst == null) {
+ mDeviceState.setIdle();
+ break;
+ }
+ }
+ }
+
+ if (nextBurst != null) {
// Queue another capture if we did not get the last burst.
handler.sendEmptyMessage(MSG_SUBMIT_CAPTURE_REQUEST);
}
@@ -831,6 +851,7 @@ public class RequestThreadManager {
mFaceDetectMapper = new LegacyFaceDetectMapper(mCamera, mCharacteristics);
mCaptureCollector = new CaptureCollector(MAX_IN_FLIGHT_REQUESTS, mDeviceState);
mRequestThread = new RequestHandlerThread(name, mRequestHandlerCb);
+ mCamera.setErrorCallback(mErrorCallback);
}
/**
@@ -883,8 +904,11 @@ public class RequestThreadManager {
public int submitCaptureRequests(List<CaptureRequest> requests, boolean repeating,
/*out*/LongParcelable frameNumber) {
Handler handler = mRequestThread.waitAndGetHandler();
- int ret = mRequestQueue.submit(requests, repeating, frameNumber);
- handler.sendEmptyMessage(MSG_SUBMIT_CAPTURE_REQUEST);
+ int ret;
+ synchronized (mIdleLock) {
+ ret = mRequestQueue.submit(requests, repeating, frameNumber);
+ handler.sendEmptyMessage(MSG_SUBMIT_CAPTURE_REQUEST);
+ }
return ret;
}
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index edb379884441..904e33f0aca1 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -186,6 +186,18 @@ public abstract class HardwareRenderer {
}
}
+ public static boolean sTrimForeground = false;
+
+ /**
+ * Controls whether or not the hardware renderer should aggressively
+ * trim memory. Note that this must not be set for any process that
+ * uses WebView! This should be only used by system_process or similar
+ * that do not go into the background.
+ */
+ public static void enableForegroundTrimming() {
+ sTrimForeground = true;
+ }
+
/**
* Indicates whether hardware acceleration is available under any form for
* the view hierarchy.
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 43ab4ef33b85..b1d3d450a7f8 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -804,6 +804,9 @@ public final class ViewRootImpl implements ViewParent,
if (mAppVisible != visible) {
mAppVisible = visible;
scheduleTraversals();
+ if (!mAppVisible) {
+ WindowManagerGlobal.trimForeground();
+ }
}
}
diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java
index c39ec9704415..08160c8976a1 100644
--- a/core/java/android/view/WindowManagerGlobal.java
+++ b/core/java/android/view/WindowManagerGlobal.java
@@ -375,6 +375,9 @@ public final class WindowManagerGlobal {
mDyingViews.remove(view);
}
}
+ if (HardwareRenderer.sTrimForeground && HardwareRenderer.isAvailable()) {
+ doTrimForeground();
+ }
}
private int findViewLocked(View view, boolean required) {
@@ -413,6 +416,35 @@ public final class WindowManagerGlobal {
}
HardwareRenderer.trimMemory(level);
+
+ if (HardwareRenderer.sTrimForeground) {
+ doTrimForeground();
+ }
+ }
+ }
+
+ public static void trimForeground() {
+ if (HardwareRenderer.sTrimForeground && HardwareRenderer.isAvailable()) {
+ WindowManagerGlobal wm = WindowManagerGlobal.getInstance();
+ wm.doTrimForeground();
+ }
+ }
+
+ private void doTrimForeground() {
+ boolean hasVisibleWindows = false;
+ synchronized (mLock) {
+ for (int i = mRoots.size() - 1; i >= 0; --i) {
+ if (mRoots.get(i).getHostVisibility() == View.VISIBLE
+ && mRoots.get(i).mAttachInfo.mHardwareRenderer != null) {
+ hasVisibleWindows = true;
+ } else {
+ mRoots.get(i).destroyHardwareResources();
+ }
+ }
+ }
+ if (!hasVisibleWindows) {
+ HardwareRenderer.trimMemory(
+ ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
}
}
@@ -428,7 +460,7 @@ public final class WindowManagerGlobal {
for (int i = 0; i < count; i++) {
ViewRootImpl root = mRoots.get(i);
String name = getWindowName(root);
- pw.printf("\n\t%s", name);
+ pw.printf("\n\t%s (visibility=%d)", name, root.getHostVisibility());
HardwareRenderer renderer =
root.getView().mAttachInfo.mHardwareRenderer;
diff --git a/core/res/res/values-mcc310-mnc150/config.xml b/core/res/res/values-mcc310-mnc150/config.xml
index f1936f43bd02..3f9330d9a760 100644
--- a/core/res/res/values-mcc310-mnc150/config.xml
+++ b/core/res/res/values-mcc310-mnc150/config.xml
@@ -33,4 +33,8 @@
<item>315</item>
<item>316</item>
</string-array>
+ <string-array translatable="false" name="config_twoDigitNumberPattern">
+ <item>"0"</item>
+ <item>"00"</item>
+ </string-array>
</resources>
diff --git a/packages/PrintSpooler/src/com/android/printspooler/model/MutexFileProvider.java b/packages/PrintSpooler/src/com/android/printspooler/model/MutexFileProvider.java
index 1f48638d8d3e..0df5e3cf18d7 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/model/MutexFileProvider.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/model/MutexFileProvider.java
@@ -93,7 +93,7 @@ public final class MutexFileProvider {
public void releaseFile() {
synchronized (mLock) {
if (mOwnerThread != Thread.currentThread()) {
- throw new IllegalStateException("Not acquired");
+ return;
}
if (DEBUG) {
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceDelegate.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceDelegate.java
index aac02add704e..e9ca5c97ad6c 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceDelegate.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceDelegate.java
@@ -295,6 +295,7 @@ public class KeyguardServiceDelegate {
stretch, stretch, type, flags, PixelFormat.TRANSLUCENT);
lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
lp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
+ lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED;
lp.setTitle("KeyguardScrim");
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
wm.addView(view, lp);
diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
index d05de697d40f..86cfdb98b715 100644
--- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
+++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
@@ -434,6 +434,8 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
}
}
+ clearProvidersAndHostsTagsLocked();
+
loadGroupWidgetProvidersLocked(newProfileIds);
loadGroupStateLocked(newProfileIds);
}
@@ -2372,6 +2374,20 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
}
}
+ private void clearProvidersAndHostsTagsLocked() {
+ final int providerCount = mProviders.size();
+ for (int i = 0; i < providerCount; i++) {
+ Provider provider = mProviders.get(i);
+ provider.tag = TAG_UNDEFINED;
+ }
+
+ final int hostCount = mHosts.size();
+ for (int i = 0; i < hostCount; i++) {
+ Host host = mHosts.get(i);
+ host.tag = TAG_UNDEFINED;
+ }
+ }
+
private boolean writeProfileStateToFileLocked(FileOutputStream stream, int userId) {
int N;
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index 1f537befe810..34d7cb37cb61 100755
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -2351,7 +2351,7 @@ public final class ActiveServices {
void serviceTimeout(ProcessRecord proc) {
String anrMessage = null;
- synchronized(this) {
+ synchronized(mAm) {
if (proc.executingServices.size() == 0 || proc.thread == null) {
return;
}
@@ -2647,7 +2647,7 @@ public final class ActiveServices {
int opti, boolean dumpAll) {
ArrayList<ServiceRecord> services = new ArrayList<ServiceRecord>();
- synchronized (this) {
+ synchronized (mAm) {
int[] users = mAm.getUsersLocked();
if ("all".equals(name)) {
for (int user : users) {
@@ -2721,7 +2721,7 @@ public final class ActiveServices {
private void dumpService(String prefix, FileDescriptor fd, PrintWriter pw,
final ServiceRecord r, String[] args, boolean dumpAll) {
String innerPrefix = prefix + " ";
- synchronized (this) {
+ synchronized (mAm) {
pw.print(prefix); pw.print("SERVICE ");
pw.print(r.shortName); pw.print(" ");
pw.print(Integer.toHexString(System.identityHashCode(r)));
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 95097891b3ec..04e18171eb3f 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -937,13 +937,6 @@ public final class ActivityManagerService extends ActivityManagerNative
private boolean mRunningVoice = false;
/**
- * Set while the keyguard is waiting for an activity to draw.
- * In this state, if we are sleeping, we allow Activities to launch
- * so that they can draw before Keyguard dismisses itself.
- */
- private boolean mKeyguardWaitingForDraw = false;
-
- /**
* State of external calls telling us if the device is asleep.
*/
private boolean mWentToSleep = false;
@@ -6256,7 +6249,10 @@ public final class ActivityManagerService extends ActivityManagerNative
synchronized (this) {
if (DEBUG_LOCKSCREEN) logLockScreen("");
mWindowManager.keyguardWaitingForActivityDrawn();
- mKeyguardWaitingForDraw = true;
+ if (mLockScreenShown) {
+ mLockScreenShown = false;
+ comeOutOfSleepIfNeededLocked();
+ }
}
} finally {
Binder.restoreCallingIdentity(token);
@@ -9959,7 +9955,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
public boolean isSleeping() {
- return mSleeping && !mKeyguardWaitingForDraw;
+ return mSleeping;
}
void goingToSleep() {
@@ -9980,7 +9976,6 @@ public final class ActivityManagerService extends ActivityManagerNative
if (mWentToSleep && !mRunningVoice) {
if (!mSleeping) {
mSleeping = true;
- mKeyguardWaitingForDraw = false;
mStackSupervisor.goingToSleepLocked();
// Initialize the wake times of all processes.
@@ -10089,7 +10084,6 @@ public final class ActivityManagerService extends ActivityManagerNative
try {
if (DEBUG_LOCKSCREEN) logLockScreen(" shown=" + shown);
mLockScreenShown = shown;
- mKeyguardWaitingForDraw = false;
comeOutOfSleepIfNeededLocked();
} finally {
Binder.restoreCallingIdentity(ident);