Merge "Cleanup window callbacks locking" into nyc-dev
This commit is contained in:
@@ -85,6 +85,7 @@ import android.view.inputmethod.InputMethodManager;
|
|||||||
import android.widget.Scroller;
|
import android.widget.Scroller;
|
||||||
|
|
||||||
import com.android.internal.R;
|
import com.android.internal.R;
|
||||||
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.os.IResultReceiver;
|
import com.android.internal.os.IResultReceiver;
|
||||||
import com.android.internal.os.SomeArgs;
|
import com.android.internal.os.SomeArgs;
|
||||||
import com.android.internal.policy.PhoneFallbackEventHandler;
|
import com.android.internal.policy.PhoneFallbackEventHandler;
|
||||||
@@ -154,7 +155,12 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
|
|
||||||
static final ArrayList<ComponentCallbacks> sConfigCallbacks = new ArrayList();
|
static final ArrayList<ComponentCallbacks> sConfigCallbacks = new ArrayList();
|
||||||
|
|
||||||
final ArrayList<WindowCallbacks> mWindowCallbacks = new ArrayList();
|
/**
|
||||||
|
* This list must only be modified by the main thread, so a lock is only needed when changing
|
||||||
|
* the list or when accessing the list from a non-main thread.
|
||||||
|
*/
|
||||||
|
@GuardedBy("mWindowCallbacks")
|
||||||
|
final ArrayList<WindowCallbacks> mWindowCallbacks = new ArrayList<>();
|
||||||
final Context mContext;
|
final Context mContext;
|
||||||
final IWindowSession mWindowSession;
|
final IWindowSession mWindowSession;
|
||||||
final Display mDisplay;
|
final Display mDisplay;
|
||||||
@@ -2437,10 +2443,8 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
@Override
|
@Override
|
||||||
public void onHardwarePostDraw(DisplayListCanvas canvas) {
|
public void onHardwarePostDraw(DisplayListCanvas canvas) {
|
||||||
drawAccessibilityFocusedDrawableIfNeeded(canvas);
|
drawAccessibilityFocusedDrawableIfNeeded(canvas);
|
||||||
synchronized (mWindowCallbacks) {
|
for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) {
|
||||||
for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) {
|
mWindowCallbacks.get(i).onPostDraw(canvas);
|
||||||
mWindowCallbacks.get(i).onPostDraw(canvas);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7092,11 +7096,9 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
Rect stableInsets, int resizeMode) {
|
Rect stableInsets, int resizeMode) {
|
||||||
if (!mDragResizing) {
|
if (!mDragResizing) {
|
||||||
mDragResizing = true;
|
mDragResizing = true;
|
||||||
synchronized (mWindowCallbacks) {
|
for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) {
|
||||||
for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) {
|
mWindowCallbacks.get(i).onWindowDragResizeStart(initialBounds, fullscreen,
|
||||||
mWindowCallbacks.get(i).onWindowDragResizeStart(initialBounds, fullscreen,
|
systemInsets, stableInsets, resizeMode);
|
||||||
systemInsets, stableInsets, resizeMode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mFullRedrawNeeded = true;
|
mFullRedrawNeeded = true;
|
||||||
}
|
}
|
||||||
@@ -7108,10 +7110,8 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
private void endDragResizing() {
|
private void endDragResizing() {
|
||||||
if (mDragResizing) {
|
if (mDragResizing) {
|
||||||
mDragResizing = false;
|
mDragResizing = false;
|
||||||
synchronized (mWindowCallbacks) {
|
for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) {
|
||||||
for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) {
|
mWindowCallbacks.get(i).onWindowDragResizeEnd();
|
||||||
mWindowCallbacks.get(i).onWindowDragResizeEnd();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mFullRedrawNeeded = true;
|
mFullRedrawNeeded = true;
|
||||||
}
|
}
|
||||||
@@ -7119,13 +7119,11 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
|
|
||||||
private boolean updateContentDrawBounds() {
|
private boolean updateContentDrawBounds() {
|
||||||
boolean updated = false;
|
boolean updated = false;
|
||||||
synchronized (mWindowCallbacks) {
|
for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) {
|
||||||
for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) {
|
updated |= mWindowCallbacks.get(i).onContentDrawn(
|
||||||
updated |= mWindowCallbacks.get(i).onContentDrawn(
|
mWindowAttributes.surfaceInsets.left,
|
||||||
mWindowAttributes.surfaceInsets.left,
|
mWindowAttributes.surfaceInsets.top,
|
||||||
mWindowAttributes.surfaceInsets.top,
|
mWidth, mHeight);
|
||||||
mWidth, mHeight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return updated | (mDragResizing && mReportNextDraw);
|
return updated | (mDragResizing && mReportNextDraw);
|
||||||
}
|
}
|
||||||
@@ -7134,10 +7132,8 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
if (mReportNextDraw) {
|
if (mReportNextDraw) {
|
||||||
mWindowDrawCountDown = new CountDownLatch(mWindowCallbacks.size());
|
mWindowDrawCountDown = new CountDownLatch(mWindowCallbacks.size());
|
||||||
}
|
}
|
||||||
synchronized (mWindowCallbacks) {
|
for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) {
|
||||||
for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) {
|
mWindowCallbacks.get(i).onRequestDraw(mReportNextDraw);
|
||||||
mWindowCallbacks.get(i).onRequestDraw(mReportNextDraw);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user