summaryrefslogtreecommitdiff
path: root/core/java/android/view/ViewRootImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/view/ViewRootImpl.java')
-rw-r--r--core/java/android/view/ViewRootImpl.java44
1 files changed, 40 insertions, 4 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 0c30cbb3e149..3fc7ee380055 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -532,6 +532,11 @@ public final class ViewRootImpl implements ViewParent,
boolean mPerformContentCapture;
boolean mReportNextDraw;
+ /**
+ * Set if the reportDraw was requested from WM. If just a local report draw was invoked, there's
+ * no need to report back to system server and can just apply immediately on the client.
+ */
+ boolean mReportDrawToWm;
boolean mFullRedrawNeeded;
boolean mNewSurfaceNeeded;
boolean mForceNextWindowRelayout;
@@ -754,6 +759,8 @@ public final class ViewRootImpl implements ViewParent,
*/
private int mSurfaceSequenceId = 0;
+ private boolean mRelayoutRequested;
+
private String mTag = TAG;
public ViewRootImpl(Context context, Display display) {
@@ -3311,6 +3318,7 @@ public final class ViewRootImpl implements ViewParent,
}
mIsInTraversal = false;
+ mRelayoutRequested = false;
}
private void notifyContentCatpureEvents() {
@@ -3941,10 +3949,18 @@ public final class ViewRootImpl implements ViewParent,
mDrawsNeededToReport++;
}
- void pendingDrawFinished() {
+ void pendingDrawFinished(Transaction t) {
if (mDrawsNeededToReport == 0) {
throw new RuntimeException("Unbalanced drawPending/pendingDrawFinished calls");
}
+
+ if (t != null) {
+ if (DEBUG_BLAST) {
+ Log.d(mTag, "Merging transaction into main window transaction");
+ }
+ mSurfaceChangedTransaction.merge(t);
+ }
+
mDrawsNeededToReport--;
if (mDrawsNeededToReport == 0) {
reportDrawFinished();
@@ -3954,17 +3970,31 @@ public final class ViewRootImpl implements ViewParent,
}
}
+ void pendingDrawFinished() {
+ pendingDrawFinished(null);
+ }
+
private void postDrawFinished() {
mHandler.sendEmptyMessage(MSG_DRAW_FINISHED);
}
private void reportDrawFinished() {
- try {
+ if (DEBUG_BLAST) {
+ Log.d(mTag, "reportDrawFinished");
+ }
+ mDrawsNeededToReport = 0;
+
+ if (!mReportDrawToWm) {
if (DEBUG_BLAST) {
- Log.d(mTag, "reportDrawFinished");
+ Log.d(mTag, "No need to report finishDrawing. Apply immediately");
}
- mDrawsNeededToReport = 0;
+ mSurfaceChangedTransaction.apply();
+ return;
+ }
+
+ try {
mWindowSession.finishDrawing(mWindow, mSurfaceChangedTransaction);
+ mReportDrawToWm = false;
} catch (RemoteException e) {
Log.e(mTag, "Unable to report draw finished", e);
mSurfaceChangedTransaction.apply();
@@ -7756,6 +7786,7 @@ public final class ViewRootImpl implements ViewParent,
private int relayoutWindow(WindowManager.LayoutParams params, int viewVisibility,
boolean insetsPending) throws RemoteException {
+ mRelayoutRequested = true;
float appScale = mAttachInfo.mApplicationScale;
boolean restore = false;
if (params != null && mTranslator != null) {
@@ -9573,6 +9604,7 @@ public final class ViewRootImpl implements ViewParent,
if (mReportNextDraw == false) {
drawPending();
}
+ mReportDrawToWm = true;
mReportNextDraw = true;
}
@@ -10501,4 +10533,8 @@ public final class ViewRootImpl implements ViewParent,
mBLASTDrawConsumer = consume;
return true;
}
+
+ boolean wasRelayoutRequested() {
+ return mRelayoutRequested;
+ }
}