Don't use WMS.mWindowMap to synchronize WM critical section (36/n)
Use new field WMS.mGlobalLock instead. This will make it easier to
switch the lock to the same object used by ActivityTaskManagerService
in an upcoming CL.
Test: Existing tests pass
Bug: 80414790
Change-Id: I4202e9028395d79cc60b01ed795528b469a16bf1
diff --git a/services/core/java/com/android/server/wm/DragDropController.java b/services/core/java/com/android/server/wm/DragDropController.java
index f42e979..ce8c979 100644
--- a/services/core/java/com/android/server/wm/DragDropController.java
+++ b/services/core/java/com/android/server/wm/DragDropController.java
@@ -104,7 +104,7 @@
final boolean callbackResult = mCallback.get().prePerformDrag(window, dragToken,
touchSource, touchX, touchY, thumbCenterX, thumbCenterY, data);
try {
- synchronized (mService.mWindowMap) {
+ synchronized (mService.mGlobalLock) {
try {
if (!callbackResult) {
Slog.w(TAG_WM, "IDragDropCallback rejects the performDrag request");
@@ -209,7 +209,7 @@
mCallback.get().preReportDropResult(window, consumed);
try {
- synchronized (mService.mWindowMap) {
+ synchronized (mService.mGlobalLock) {
if (mDragState == null) {
// Most likely the drop recipient ANRed and we ended the drag
// out from under it. Log the issue and move on.
@@ -248,7 +248,7 @@
mCallback.get().preCancelDragAndDrop(dragToken);
try {
- synchronized (mService.mWindowMap) {
+ synchronized (mService.mGlobalLock) {
if (mDragState == null) {
Slog.w(TAG_WM, "cancelDragAndDrop() without prepareDrag()");
throw new IllegalStateException("cancelDragAndDrop() without prepareDrag()");
@@ -277,7 +277,7 @@
* @param newY Y coordinate value in dp in the screen coordinate
*/
void handleMotionEvent(boolean keepHandling, float newX, float newY) {
- synchronized (mService.mWindowMap) {
+ synchronized (mService.mGlobalLock) {
if (!dragDropActiveLocked()) {
// The drag has ended but the clean-up message has not been processed by
// window manager. Drop events that occur after this until window manager
@@ -352,7 +352,7 @@
Slog.w(TAG_WM, "Timeout ending drag to win " + win);
}
- synchronized (mService.mWindowMap) {
+ synchronized (mService.mGlobalLock) {
// !!! TODO: ANR the drag-receiving app
if (mDragState != null) {
mDragState.mDragResult = false;
@@ -368,14 +368,14 @@
final DragState.InputInterceptor interceptor =
(DragState.InputInterceptor) msg.obj;
if (interceptor == null) return;
- synchronized (mService.mWindowMap) {
+ synchronized (mService.mGlobalLock) {
interceptor.tearDown();
}
break;
}
case MSG_ANIMATION_END: {
- synchronized (mService.mWindowMap) {
+ synchronized (mService.mGlobalLock) {
if (mDragState == null) {
Slog.wtf(TAG_WM, "mDragState unexpectedly became null while " +
"plyaing animation");