Merge "ViewRootImpl: Pass buffer to finishDrawing when requested" into rvc-dev

This commit is contained in:
Rob Carr
2020-04-09 20:26:43 +00:00
committed by Android (Google) Code Review
6 changed files with 40 additions and 7 deletions

View File

@@ -3017,6 +3017,10 @@ public final class ViewRootImpl implements ViewParent,
if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME) != 0) {
reportNextDraw();
}
if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_BLAST_SYNC) != 0) {
reportNextDraw();
setUseBLASTSyncTransaction();
}
boolean cancelDraw = mAttachInfo.mTreeObserver.dispatchOnPreDraw() || !isViewVisible;
@@ -3725,7 +3729,7 @@ public final class ViewRootImpl implements ViewParent,
if (needFrameCompleteCallback) {
final Handler handler = mAttachInfo.mHandler;
mAttachInfo.mThreadedRenderer.setFrameCompleteCallback((long frameNr) -> {
finishBLASTSync();
finishBLASTSync(!reportNextDraw);
handler.postAtFrontOfQueue(() -> {
if (reportNextDraw) {
// TODO: Use the frame number
@@ -3759,7 +3763,7 @@ public final class ViewRootImpl implements ViewParent,
if (usingAsyncReport && !canUseAsync) {
mAttachInfo.mThreadedRenderer.setFrameCompleteCallback(null);
usingAsyncReport = false;
finishBLASTSync();
finishBLASTSync(true /* apply */);
}
} finally {
mIsDrawing = false;
@@ -9576,10 +9580,15 @@ public final class ViewRootImpl implements ViewParent,
mNextDrawUseBLASTSyncTransaction = true;
}
private void finishBLASTSync() {
private void finishBLASTSync(boolean apply) {
if (mNextReportConsumeBLAST) {
mNextReportConsumeBLAST = false;
mRtBLASTSyncTransaction.apply();
if (apply) {
mRtBLASTSyncTransaction.apply();
} else {
mSurfaceChangedTransaction.merge(mRtBLASTSyncTransaction);
}
}
}

View File

@@ -101,6 +101,14 @@ public final class WindowManagerGlobal {
*/
public static final int RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS = 0x40;
/**
* This flag indicates the client should not directly submit it's next frame,
* but instead should pass it in the postDrawTransaction of
* {@link WindowManagerService#finishDrawing}. This is used by the WM
* BLASTSyncEngine to synchronize rendering of multiple windows.
*/
public static final int RELAYOUT_RES_BLAST_SYNC = 0x80;
/**
* Flag for relayout: the client will be later giving
* internal insets; as a result, the window will not impact other window

View File

@@ -2577,4 +2577,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
return willSync;
}
boolean useBLASTSync() {
return mUsingBLASTSyncTransaction;
}
}

View File

@@ -73,6 +73,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import static android.view.WindowManager.REMOVE_CONTENT_MODE_UNDEFINED;
import static android.view.WindowManagerGlobal.ADD_OKAY;
import static android.view.WindowManagerGlobal.RELAYOUT_DEFER_SURFACE_DESTROY;
import static android.view.WindowManagerGlobal.RELAYOUT_RES_BLAST_SYNC;
import static android.view.WindowManagerGlobal.RELAYOUT_RES_SURFACE_CHANGED;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_INVALID;
@@ -2110,6 +2111,10 @@ public class WindowManagerService extends IWindowManager.Stub
win.finishSeamlessRotation(false /* timeout */);
}
if (win.useBLASTSync()) {
result |= RELAYOUT_RES_BLAST_SYNC;
}
int attrChanges = 0;
int flagChanges = 0;
int privateFlagChanges = 0;

View File

@@ -53,8 +53,9 @@ public class TaskOrganizerMultiWindowTest extends Activity {
return true;
}
float x = e.getX(0);
float x = e.getRawX(0);
float ratio = (float) x / (float) getWidth() ;
ratio = 1-ratio;
LinearLayout.LayoutParams lp1 =
new LinearLayout.LayoutParams(0,
@@ -172,10 +173,14 @@ public class TaskOrganizerMultiWindowTest extends Activity {
setContentView(splitView);
}
private void addFlags(Intent intent) {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
}
Intent makeSettingsIntent() {
Intent intent = new Intent();
intent.setAction(android.provider.Settings.ACTION_SETTINGS);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
addFlags(intent);
return intent;
}
@@ -183,7 +188,7 @@ public class TaskOrganizerMultiWindowTest extends Activity {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_APP_CONTACTS);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
addFlags(intent);
return intent;
}

View File

@@ -80,8 +80,10 @@ class TaskView extends SurfaceView implements SurfaceHolder.Callback {
} catch (Exception e) {
// System server died.. oh well
}
t.reparent(leash, getSurfaceControl())
.setPosition(leash, 0, 0)
.show(leash)
.apply();
}
}