Loading core/java/android/view/ViewRootImpl.java +13 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -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; Loading Loading @@ -9576,10 +9580,15 @@ public final class ViewRootImpl implements ViewParent, mNextDrawUseBLASTSyncTransaction = true; } private void finishBLASTSync() { private void finishBLASTSync(boolean apply) { if (mNextReportConsumeBLAST) { mNextReportConsumeBLAST = false; if (apply) { mRtBLASTSyncTransaction.apply(); } else { mSurfaceChangedTransaction.merge(mRtBLASTSyncTransaction); } } } Loading core/java/android/view/WindowManagerGlobal.java +8 −0 Original line number Diff line number Diff line Loading @@ -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 Loading services/core/java/com/android/server/wm/WindowContainer.java +4 −0 Original line number Diff line number Diff line Loading @@ -2577,4 +2577,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< return willSync; } boolean useBLASTSync() { return mUsingBLASTSyncTransaction; } } services/core/java/com/android/server/wm/WindowManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading tests/TaskOrganizerTest/src/com/android/test/taskembed/TaskOrganizerMultiWindowTest.java +8 −3 Original line number Diff line number Diff line Loading @@ -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, Loading Loading @@ -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; } Loading @@ -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; } Loading Loading
core/java/android/view/ViewRootImpl.java +13 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -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; Loading Loading @@ -9576,10 +9580,15 @@ public final class ViewRootImpl implements ViewParent, mNextDrawUseBLASTSyncTransaction = true; } private void finishBLASTSync() { private void finishBLASTSync(boolean apply) { if (mNextReportConsumeBLAST) { mNextReportConsumeBLAST = false; if (apply) { mRtBLASTSyncTransaction.apply(); } else { mSurfaceChangedTransaction.merge(mRtBLASTSyncTransaction); } } } Loading
core/java/android/view/WindowManagerGlobal.java +8 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
services/core/java/com/android/server/wm/WindowContainer.java +4 −0 Original line number Diff line number Diff line Loading @@ -2577,4 +2577,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< return willSync; } boolean useBLASTSync() { return mUsingBLASTSyncTransaction; } }
services/core/java/com/android/server/wm/WindowManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading
tests/TaskOrganizerTest/src/com/android/test/taskembed/TaskOrganizerMultiWindowTest.java +8 −3 Original line number Diff line number Diff line Loading @@ -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, Loading Loading @@ -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; } Loading @@ -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; } Loading