Merge "Added getSyncTransaction" into rvc-dev am: 652a48156c

Change-Id: I116da3681ce515ab8cbe83e4d9260094623ffbe6
This commit is contained in:
Chavi Weingarten
2020-05-29 15:45:24 +00:00
committed by Automerger Merge Worker
8 changed files with 34 additions and 37 deletions

View File

@@ -5985,9 +5985,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
if (mSurfaceControl != null) { if (mSurfaceControl != null) {
if (show && !mLastSurfaceShowing) { if (show && !mLastSurfaceShowing) {
getPendingTransaction().show(mSurfaceControl); getSyncTransaction().show(mSurfaceControl);
} else if (!show && mLastSurfaceShowing) { } else if (!show && mLastSurfaceShowing) {
getPendingTransaction().hide(mSurfaceControl); getSyncTransaction().hide(mSurfaceControl);
} }
} }
if (mThumbnail != null) { if (mThumbnail != null) {

View File

@@ -3213,7 +3213,7 @@ class ActivityStack extends Task {
} }
private void updateSurfaceBounds() { private void updateSurfaceBounds() {
updateSurfaceSize(getPendingTransaction()); updateSurfaceSize(getSyncTransaction());
updateSurfacePosition(); updateSurfacePosition();
scheduleAnimation(); scheduleAnimation();
} }

View File

@@ -53,7 +53,7 @@ class Dimmer {
@Override @Override
public SurfaceControl.Transaction getPendingTransaction() { public SurfaceControl.Transaction getPendingTransaction() {
return mHost.getPendingTransaction(); return mHost.getSyncTransaction();
} }
@Override @Override

View File

@@ -290,7 +290,7 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {
mDimmer.resetDimStates(); mDimmer.resetDimStates();
} }
if (mDimmer.updateDims(getPendingTransaction(), mTmpDimBoundsRect)) { if (mDimmer.updateDims(getSyncTransaction(), mTmpDimBoundsRect)) {
scheduleAnimation(); scheduleAnimation();
} }
} }

View File

@@ -1923,7 +1923,7 @@ class Task extends WindowContainer<WindowContainer> {
super.onConfigurationChanged(newParentConfig); super.onConfigurationChanged(newParentConfig);
// Only need to update surface size here since the super method will handle updating // Only need to update surface size here since the super method will handle updating
// surface position. // surface position.
updateSurfaceSize(getPendingTransaction()); updateSurfaceSize(getSyncTransaction());
if (wasInPictureInPicture != inPinnedWindowingMode()) { if (wasInPictureInPicture != inPinnedWindowingMode()) {
mStackSupervisor.scheduleUpdatePictureInPictureModeIfNeeded(this, getStack()); mStackSupervisor.scheduleUpdatePictureInPictureModeIfNeeded(this, getStack());
@@ -3475,20 +3475,6 @@ class Task extends WindowContainer<WindowContainer> {
return mDimmer; return mDimmer;
} }
void dim(float alpha) {
mDimmer.dimAbove(getPendingTransaction(), alpha);
scheduleAnimation();
}
void stopDimming() {
mDimmer.stopDim(getPendingTransaction());
scheduleAnimation();
}
boolean isTaskForUser(int userId) {
return mUserId == userId;
}
@Override @Override
void prepareSurfaces() { void prepareSurfaces() {
mDimmer.resetDimStates(); mDimmer.resetDimStates();
@@ -3504,9 +3490,9 @@ class Task extends WindowContainer<WindowContainer> {
mTmpDimBoundsRect.offsetTo(0, 0); mTmpDimBoundsRect.offsetTo(0, 0);
} }
updateShadowsRadius(isFocused(), getPendingTransaction()); updateShadowsRadius(isFocused(), getSyncTransaction());
if (mDimmer.updateDims(getPendingTransaction(), mTmpDimBoundsRect)) { if (mDimmer.updateDims(getSyncTransaction(), mTmpDimBoundsRect)) {
scheduleAnimation(); scheduleAnimation();
} }
} }
@@ -4317,7 +4303,7 @@ class Task extends WindowContainer<WindowContainer> {
// skip this for tasks created by the organizer because they can synchronously update // skip this for tasks created by the organizer because they can synchronously update
// the leash before new children are added to the task. // the leash before new children are added to the task.
if (!mCreatedByOrganizer && mTaskOrganizer != null && !prevHasBeenVisible) { if (!mCreatedByOrganizer && mTaskOrganizer != null && !prevHasBeenVisible) {
getPendingTransaction().hide(getSurfaceControl()); getSyncTransaction().hide(getSurfaceControl());
commitPendingTransaction(); commitPendingTransaction();
} }
@@ -4500,7 +4486,7 @@ class Task extends WindowContainer<WindowContainer> {
* @param hasFocus * @param hasFocus
*/ */
void onWindowFocusChanged(boolean hasFocus) { void onWindowFocusChanged(boolean hasFocus) {
updateShadowsRadius(hasFocus, getPendingTransaction()); updateShadowsRadius(hasFocus, getSyncTransaction());
} }
void onPictureInPictureParamsChanged() { void onPictureInPictureParamsChanged() {

View File

@@ -646,7 +646,7 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
mSplitScreenDividerAnchor = makeChildSurface(null) mSplitScreenDividerAnchor = makeChildSurface(null)
.setName("splitScreenDividerAnchor") .setName("splitScreenDividerAnchor")
.build(); .build();
getPendingTransaction() getSyncTransaction()
.show(mAppAnimationLayer) .show(mAppAnimationLayer)
.show(mBoostedAppAnimationLayer) .show(mBoostedAppAnimationLayer)
.show(mHomeAppAnimationLayer) .show(mHomeAppAnimationLayer)

View File

@@ -386,7 +386,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
// surface animator such that hierarchy is preserved when animating, i.e. // surface animator such that hierarchy is preserved when animating, i.e.
// mSurfaceControl stays attached to the leash and we just reparent the leash to the // mSurfaceControl stays attached to the leash and we just reparent the leash to the
// new parent. // new parent.
reparentSurfaceControl(getPendingTransaction(), mParent.mSurfaceControl); reparentSurfaceControl(getSyncTransaction(), mParent.mSurfaceControl);
} }
if (callback != null) { if (callback != null) {
@@ -404,8 +404,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
private void setInitialSurfaceControlProperties(SurfaceControl surfaceControl) { private void setInitialSurfaceControlProperties(SurfaceControl surfaceControl) {
setSurfaceControl(surfaceControl); setSurfaceControl(surfaceControl);
getPendingTransaction().show(mSurfaceControl); getSyncTransaction().show(mSurfaceControl);
onSurfaceShown(getPendingTransaction()); onSurfaceShown(getSyncTransaction());
updateSurfacePosition(); updateSurfacePosition();
} }
@@ -575,7 +575,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
void removeImmediately() { void removeImmediately() {
final DisplayContent dc = getDisplayContent(); final DisplayContent dc = getDisplayContent();
if (dc != null) { if (dc != null) {
mSurfaceFreezer.unfreeze(getPendingTransaction()); mSurfaceFreezer.unfreeze(getSyncTransaction());
dc.mChangingContainers.remove(this); dc.mChangingContainers.remove(this);
} }
while (!mChildren.isEmpty()) { while (!mChildren.isEmpty()) {
@@ -590,7 +590,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
} }
if (mSurfaceControl != null) { if (mSurfaceControl != null) {
getPendingTransaction().remove(mSurfaceControl); getSyncTransaction().remove(mSurfaceControl);
setSurfaceControl(null); setSurfaceControl(null);
mLastSurfacePosition.set(0, 0); mLastSurfacePosition.set(0, 0);
scheduleAnimation(); scheduleAnimation();
@@ -1002,7 +1002,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
void onChildVisibilityRequested(boolean visible) { void onChildVisibilityRequested(boolean visible) {
// If we are changing visibility, then a snapshot isn't necessary and we are no-longer // If we are changing visibility, then a snapshot isn't necessary and we are no-longer
// part of a change transition. // part of a change transition.
mSurfaceFreezer.unfreeze(getPendingTransaction()); mSurfaceFreezer.unfreeze(getSyncTransaction());
if (mDisplayContent != null) { if (mDisplayContent != null) {
mDisplayContent.mChangingContainers.remove(this); mDisplayContent.mChangingContainers.remove(this);
} }
@@ -1901,7 +1901,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
} }
void assignChildLayers() { void assignChildLayers() {
assignChildLayers(getPendingTransaction()); assignChildLayers(getSyncTransaction());
scheduleAnimation(); scheduleAnimation();
} }
@@ -2050,12 +2050,23 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
return mSurfaceControl; return mSurfaceControl;
} }
@Override /**
public Transaction getPendingTransaction() { * Use this method instead of {@link #getPendingTransaction()} if the Transaction should be
* synchronized with the client.
*
* @return {@link #mBLASTSyncTransaction} if available. Otherwise, returns
* {@link #getPendingTransaction()}
*/
public Transaction getSyncTransaction() {
if (mUsingBLASTSyncTransaction) { if (mUsingBLASTSyncTransaction) {
return mBLASTSyncTransaction; return mBLASTSyncTransaction;
} }
return getPendingTransaction();
}
@Override
public Transaction getPendingTransaction() {
final DisplayContent displayContent = getDisplayContent(); final DisplayContent displayContent = getDisplayContent();
if (displayContent != null && displayContent != this) { if (displayContent != null && displayContent != this) {
return displayContent.getPendingTransaction(); return displayContent.getPendingTransaction();
@@ -2465,7 +2476,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
} }
final void updateSurfacePosition() { final void updateSurfacePosition() {
updateSurfacePosition(getPendingTransaction()); updateSurfacePosition(getSyncTransaction());
} }
void updateSurfacePosition(Transaction t) { void updateSurfacePosition(Transaction t) {

View File

@@ -5240,7 +5240,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
private void applyDims(Dimmer dimmer) { private void applyDims(Dimmer dimmer) {
if (!mAnimatingExit && mAppDied) { if (!mAnimatingExit && mAppDied) {
mIsDimming = true; mIsDimming = true;
dimmer.dimAbove(getPendingTransaction(), this, DEFAULT_DIM_AMOUNT_DEAD_WINDOW); dimmer.dimAbove(getSyncTransaction(), this, DEFAULT_DIM_AMOUNT_DEAD_WINDOW);
} else if ((mAttrs.flags & FLAG_DIM_BEHIND) != 0 && isVisibleNow() && !mHidden) { } else if ((mAttrs.flags & FLAG_DIM_BEHIND) != 0 && isVisibleNow() && !mHidden) {
// Only show a dim behind when the following is satisfied: // Only show a dim behind when the following is satisfied:
// 1. The window has the flag FLAG_DIM_BEHIND // 1. The window has the flag FLAG_DIM_BEHIND
@@ -5248,7 +5248,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// 3. The WS is considered visible according to the isVisible() method // 3. The WS is considered visible according to the isVisible() method
// 4. The WS is not hidden. // 4. The WS is not hidden.
mIsDimming = true; mIsDimming = true;
dimmer.dimBelow(getPendingTransaction(), this, mAttrs.dimAmount); dimmer.dimBelow(getSyncTransaction(), this, mAttrs.dimAmount);
} }
} }