mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Merge "Revert "Revert "Using Transaction directly instead of building s..."" into tm-qpr-dev am: d79f84fffe
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20215466 Change-Id: Ic6c00cea6febb0e36e147a4811e73f89fbfd4a78 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -123,6 +123,8 @@ import com.android.quickstep.util.MultiValueUpdateListener;
|
||||
import com.android.quickstep.util.RectFSpringAnim;
|
||||
import com.android.quickstep.util.RemoteAnimationProvider;
|
||||
import com.android.quickstep.util.StaggeredWorkspaceAnim;
|
||||
import com.android.quickstep.util.SurfaceTransaction;
|
||||
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
|
||||
import com.android.quickstep.util.SurfaceTransactionApplier;
|
||||
import com.android.quickstep.util.WorkspaceRevealAnim;
|
||||
import com.android.quickstep.views.FloatingWidgetView;
|
||||
@@ -135,7 +137,6 @@ import com.android.systemui.shared.system.RemoteAnimationDefinitionCompat;
|
||||
import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.RemoteTransitionCompat;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
|
||||
import com.android.wm.shell.startingsurface.IStartingWindowListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -815,10 +816,11 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<SurfaceParams> params = new ArrayList<>();
|
||||
SurfaceTransaction transaction = new SurfaceTransaction();
|
||||
|
||||
for (int i = appTargets.length - 1; i >= 0; i--) {
|
||||
RemoteAnimationTargetCompat target = appTargets[i];
|
||||
SurfaceParams.Builder builder = new SurfaceParams.Builder(target.leash);
|
||||
SurfaceProperties builder = transaction.forSurface(target.leash);
|
||||
|
||||
if (target.mode == MODE_OPENING) {
|
||||
matrix.setScale(scale, scale);
|
||||
@@ -839,11 +841,11 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
|
||||
floatingView.update(mIconAlpha.value, 255, floatingIconBounds, percent, 0f,
|
||||
mWindowRadius.value * scale, true /* isOpening */);
|
||||
builder.withMatrix(matrix)
|
||||
.withWindowCrop(crop)
|
||||
.withAlpha(1f - mIconAlpha.value)
|
||||
.withCornerRadius(mWindowRadius.value)
|
||||
.withShadowRadius(mShadowRadius.value);
|
||||
builder.setMatrix(matrix)
|
||||
.setWindowCrop(crop)
|
||||
.setAlpha(1f - mIconAlpha.value)
|
||||
.setCornerRadius(mWindowRadius.value)
|
||||
.setShadowRadius(mShadowRadius.value);
|
||||
} else if (target.mode == MODE_CLOSING) {
|
||||
if (target.localBounds != null) {
|
||||
final Rect localBounds = target.localBounds;
|
||||
@@ -863,29 +865,26 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
tmpPos.y = tmp;
|
||||
}
|
||||
matrix.setTranslate(tmpPos.x, tmpPos.y);
|
||||
builder.withMatrix(matrix)
|
||||
.withWindowCrop(crop)
|
||||
.withAlpha(1f);
|
||||
builder.setMatrix(matrix)
|
||||
.setWindowCrop(crop)
|
||||
.setAlpha(1f);
|
||||
}
|
||||
params.add(builder.build());
|
||||
}
|
||||
|
||||
if (navBarTarget != null) {
|
||||
final SurfaceParams.Builder navBuilder =
|
||||
new SurfaceParams.Builder(navBarTarget.leash);
|
||||
SurfaceProperties navBuilder =
|
||||
transaction.forSurface(navBarTarget.leash);
|
||||
if (mNavFadeIn.value > mNavFadeIn.getStartValue()) {
|
||||
matrix.setScale(scale, scale);
|
||||
matrix.postTranslate(windowTransX0, windowTransY0);
|
||||
navBuilder.withMatrix(matrix)
|
||||
.withWindowCrop(crop)
|
||||
.withAlpha(mNavFadeIn.value);
|
||||
navBuilder.setMatrix(matrix)
|
||||
.setWindowCrop(crop)
|
||||
.setAlpha(mNavFadeIn.value);
|
||||
} else {
|
||||
navBuilder.withAlpha(mNavFadeOut.value);
|
||||
navBuilder.setAlpha(mNavFadeOut.value);
|
||||
}
|
||||
params.add(navBuilder.build());
|
||||
}
|
||||
|
||||
surfaceApplier.scheduleApply(params.toArray(new SurfaceParams[params.size()]));
|
||||
surfaceApplier.scheduleApply(transaction);
|
||||
}
|
||||
};
|
||||
appAnimator.addUpdateListener(listener);
|
||||
@@ -1001,37 +1000,33 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
matrix.postScale(mAppWindowScale, mAppWindowScale, widgetBackgroundBounds.left,
|
||||
widgetBackgroundBounds.top);
|
||||
|
||||
ArrayList<SurfaceParams> params = new ArrayList<>();
|
||||
SurfaceTransaction transaction = new SurfaceTransaction();
|
||||
float floatingViewAlpha = appTargetsAreTranslucent ? 1 - mPreviewAlpha.value : 1;
|
||||
for (int i = appTargets.length - 1; i >= 0; i--) {
|
||||
RemoteAnimationTargetCompat target = appTargets[i];
|
||||
SurfaceParams.Builder builder = new SurfaceParams.Builder(target.leash);
|
||||
SurfaceProperties builder = transaction.forSurface(target.leash);
|
||||
if (target.mode == MODE_OPENING) {
|
||||
floatingView.update(widgetBackgroundBounds, floatingViewAlpha,
|
||||
mWidgetForegroundAlpha.value, mWidgetFallbackBackgroundAlpha.value,
|
||||
mCornerRadiusProgress.value);
|
||||
builder.withMatrix(matrix)
|
||||
.withWindowCrop(appWindowCrop)
|
||||
.withAlpha(mPreviewAlpha.value)
|
||||
.withCornerRadius(mWindowRadius.value / mAppWindowScale);
|
||||
builder.setMatrix(matrix)
|
||||
.setWindowCrop(appWindowCrop)
|
||||
.setAlpha(mPreviewAlpha.value)
|
||||
.setCornerRadius(mWindowRadius.value / mAppWindowScale);
|
||||
}
|
||||
params.add(builder.build());
|
||||
}
|
||||
|
||||
if (navBarTarget != null) {
|
||||
final SurfaceParams.Builder navBuilder =
|
||||
new SurfaceParams.Builder(navBarTarget.leash);
|
||||
SurfaceProperties navBuilder = transaction.forSurface(navBarTarget.leash);
|
||||
if (mNavFadeIn.value > mNavFadeIn.getStartValue()) {
|
||||
navBuilder.withMatrix(matrix)
|
||||
.withWindowCrop(appWindowCrop)
|
||||
.withAlpha(mNavFadeIn.value);
|
||||
navBuilder.setMatrix(matrix)
|
||||
.setWindowCrop(appWindowCrop)
|
||||
.setAlpha(mNavFadeIn.value);
|
||||
} else {
|
||||
navBuilder.withAlpha(mNavFadeOut.value);
|
||||
navBuilder.setAlpha(mNavFadeOut.value);
|
||||
}
|
||||
params.add(navBuilder.build());
|
||||
}
|
||||
|
||||
surfaceApplier.scheduleApply(params.toArray(new SurfaceParams[params.size()]));
|
||||
surfaceApplier.scheduleApply(transaction);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1226,16 +1221,15 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
unlockAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
SurfaceParams[] params = new SurfaceParams[appTargets.length];
|
||||
SurfaceTransaction transaction = new SurfaceTransaction();
|
||||
for (int i = appTargets.length - 1; i >= 0; i--) {
|
||||
RemoteAnimationTargetCompat target = appTargets[i];
|
||||
params[i] = new SurfaceParams.Builder(target.leash)
|
||||
.withAlpha(1f)
|
||||
.withWindowCrop(target.screenSpaceBounds)
|
||||
.withCornerRadius(cornerRadius)
|
||||
.build();
|
||||
transaction.forSurface(target.leash)
|
||||
.setAlpha(1f)
|
||||
.setWindowCrop(target.screenSpaceBounds)
|
||||
.setCornerRadius(cornerRadius);
|
||||
}
|
||||
surfaceApplier.scheduleApply(params);
|
||||
surfaceApplier.scheduleApply(transaction);
|
||||
}
|
||||
});
|
||||
return unlockAnimator;
|
||||
@@ -1453,10 +1447,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
|
||||
@Override
|
||||
public void onUpdate(float percent, boolean initOnly) {
|
||||
SurfaceParams[] params = new SurfaceParams[appTargets.length];
|
||||
SurfaceTransaction transaction = new SurfaceTransaction();
|
||||
for (int i = appTargets.length - 1; i >= 0; i--) {
|
||||
RemoteAnimationTargetCompat target = appTargets[i];
|
||||
SurfaceParams.Builder builder = new SurfaceParams.Builder(target.leash);
|
||||
SurfaceProperties builder = transaction.forSurface(target.leash);
|
||||
|
||||
if (target.localBounds != null) {
|
||||
tmpPos.set(target.localBounds.left, target.localBounds.top);
|
||||
@@ -1478,20 +1472,19 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
tmpRect.centerY());
|
||||
matrix.postTranslate(0, mDy.value);
|
||||
matrix.postTranslate(tmpPos.x, tmpPos.y);
|
||||
builder.withMatrix(matrix)
|
||||
.withWindowCrop(crop)
|
||||
.withAlpha(mAlpha.value)
|
||||
.withCornerRadius(windowCornerRadius)
|
||||
.withShadowRadius(mShadowRadius.value);
|
||||
builder.setMatrix(matrix)
|
||||
.setWindowCrop(crop)
|
||||
.setAlpha(mAlpha.value)
|
||||
.setCornerRadius(windowCornerRadius)
|
||||
.setShadowRadius(mShadowRadius.value);
|
||||
} else if (target.mode == MODE_OPENING) {
|
||||
matrix.setTranslate(tmpPos.x, tmpPos.y);
|
||||
builder.withMatrix(matrix)
|
||||
.withWindowCrop(crop)
|
||||
.withAlpha(1f);
|
||||
builder.setMatrix(matrix)
|
||||
.setWindowCrop(crop)
|
||||
.setAlpha(1f);
|
||||
}
|
||||
params[i] = builder.build();
|
||||
}
|
||||
surfaceApplier.scheduleApply(params);
|
||||
surfaceApplier.scheduleApply(transaction);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1861,10 +1854,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
|
||||
@Override
|
||||
public void onUpdate(RectF currentRectF, float progress) {
|
||||
SurfaceParams[] params = new SurfaceParams[mAppTargets.length];
|
||||
SurfaceTransaction transaction = new SurfaceTransaction();
|
||||
for (int i = mAppTargets.length - 1; i >= 0; i--) {
|
||||
RemoteAnimationTargetCompat target = mAppTargets[i];
|
||||
SurfaceParams.Builder builder = new SurfaceParams.Builder(target.leash);
|
||||
SurfaceProperties builder = transaction.forSurface(target.leash);
|
||||
|
||||
if (target.localBounds != null) {
|
||||
mTmpPos.set(target.localBounds.left, target.localBounds.top);
|
||||
@@ -1899,18 +1892,17 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
mMatrix.setScale(scale, scale);
|
||||
mMatrix.postTranslate(mCurrentRect.left, mCurrentRect.top);
|
||||
|
||||
builder.withMatrix(mMatrix)
|
||||
.withWindowCrop(mTmpRect)
|
||||
.withAlpha(getWindowAlpha(progress))
|
||||
.withCornerRadius(getCornerRadius(progress) / scale);
|
||||
builder.setMatrix(mMatrix)
|
||||
.setWindowCrop(mTmpRect)
|
||||
.setAlpha(getWindowAlpha(progress))
|
||||
.setCornerRadius(getCornerRadius(progress) / scale);
|
||||
} else if (target.mode == MODE_OPENING) {
|
||||
mMatrix.setTranslate(mTmpPos.x, mTmpPos.y);
|
||||
builder.withMatrix(mMatrix)
|
||||
.withAlpha(1f);
|
||||
builder.setMatrix(mMatrix)
|
||||
.setAlpha(1f);
|
||||
}
|
||||
params[i] = builder.build();
|
||||
}
|
||||
mSurfaceApplier.scheduleApply(params);
|
||||
mSurfaceApplier.scheduleApply(transaction);
|
||||
}
|
||||
|
||||
protected float getWindowAlpha(float progress) {
|
||||
|
||||
@@ -116,6 +116,7 @@ import com.android.quickstep.util.ProtoTracer;
|
||||
import com.android.quickstep.util.RecentsOrientedState;
|
||||
import com.android.quickstep.util.RectFSpringAnim;
|
||||
import com.android.quickstep.util.StaggeredWorkspaceAnim;
|
||||
import com.android.quickstep.util.SurfaceTransaction;
|
||||
import com.android.quickstep.util.SurfaceTransactionApplier;
|
||||
import com.android.quickstep.util.SwipePipToHomeAnimator;
|
||||
import com.android.quickstep.util.TaskViewSimulator;
|
||||
@@ -128,8 +129,6 @@ import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.InputConsumerController;
|
||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
|
||||
import com.android.systemui.shared.system.TaskStackChangeListener;
|
||||
import com.android.systemui.shared.system.TaskStackChangeListeners;
|
||||
import com.android.wm.shell.common.TransactionPool;
|
||||
@@ -2108,16 +2107,13 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
|
||||
// When revealing the app with launcher splash screen, make the app visible
|
||||
// and behind the splash view before the splash is animated away.
|
||||
SyncRtSurfaceTransactionApplierCompat surfaceApplier =
|
||||
new SyncRtSurfaceTransactionApplierCompat(splashView);
|
||||
ArrayList<SurfaceParams> params = new ArrayList<>();
|
||||
SurfaceTransactionApplier surfaceApplier =
|
||||
new SurfaceTransactionApplier(splashView);
|
||||
SurfaceTransaction transaction = new SurfaceTransaction();
|
||||
for (RemoteAnimationTargetCompat target : appearedTaskTargets) {
|
||||
SurfaceParams.Builder builder = new SurfaceParams.Builder(target.leash);
|
||||
builder.withAlpha(1);
|
||||
builder.withLayer(-1);
|
||||
params.add(builder.build());
|
||||
transaction.forSurface(target.leash).setAlpha(1).setLayer(-1);
|
||||
}
|
||||
surfaceApplier.scheduleApply(params.toArray(new SurfaceParams[0]));
|
||||
surfaceApplier.scheduleApply(transaction);
|
||||
|
||||
SplashScreenExitAnimationUtils.startAnimations(splashView, taskTarget.leash,
|
||||
mSplashMainWindowShiftLength, new TransactionPool(), new Rect(),
|
||||
|
||||
@@ -65,12 +65,12 @@ import com.android.launcher3.util.DisplayController;
|
||||
import com.android.quickstep.fallback.FallbackRecentsView;
|
||||
import com.android.quickstep.fallback.RecentsState;
|
||||
import com.android.quickstep.util.RectFSpringAnim;
|
||||
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
|
||||
import com.android.quickstep.util.TransformParams;
|
||||
import com.android.quickstep.util.TransformParams.BuilderProxy;
|
||||
import com.android.systemui.shared.recents.model.Task.TaskKey;
|
||||
import com.android.systemui.shared.system.InputConsumerController;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
@@ -125,18 +125,18 @@ public class FallbackSwipeHandler extends
|
||||
}
|
||||
}
|
||||
|
||||
private void updateHomeActivityTransformDuringSwipeUp(SurfaceParams.Builder builder,
|
||||
private void updateHomeActivityTransformDuringSwipeUp(SurfaceProperties builder,
|
||||
RemoteAnimationTargetCompat app, TransformParams params) {
|
||||
setHomeScaleAndAlpha(builder, app, mCurrentShift.value,
|
||||
Utilities.boundToRange(1 - mCurrentShift.value, 0, 1));
|
||||
}
|
||||
|
||||
private void setHomeScaleAndAlpha(SurfaceParams.Builder builder,
|
||||
private void setHomeScaleAndAlpha(SurfaceProperties builder,
|
||||
RemoteAnimationTargetCompat app, float verticalShift, float alpha) {
|
||||
float scale = Utilities.mapRange(verticalShift, 1, mMaxLauncherScale);
|
||||
mTmpMatrix.setScale(scale, scale,
|
||||
app.localBounds.exactCenterX(), app.localBounds.exactCenterY());
|
||||
builder.withMatrix(mTmpMatrix).withAlpha(alpha);
|
||||
builder.setMatrix(mTmpMatrix).setAlpha(alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -279,12 +279,12 @@ public class FallbackSwipeHandler extends
|
||||
return mTargetRect;
|
||||
}
|
||||
|
||||
private void updateRecentsActivityTransformDuringHomeAnim(SurfaceParams.Builder builder,
|
||||
private void updateRecentsActivityTransformDuringHomeAnim(SurfaceProperties builder,
|
||||
RemoteAnimationTargetCompat app, TransformParams params) {
|
||||
builder.withAlpha(mRecentsAlpha.value);
|
||||
builder.setAlpha(mRecentsAlpha.value);
|
||||
}
|
||||
|
||||
private void updateHomeActivityTransformDuringHomeAnim(SurfaceParams.Builder builder,
|
||||
private void updateHomeActivityTransformDuringHomeAnim(SurfaceProperties builder,
|
||||
RemoteAnimationTargetCompat app, TransformParams params) {
|
||||
setHomeScaleAndAlpha(builder, app, mVerticalShiftForScale.value, mHomeAlpha.value);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||
import com.android.quickstep.util.RectFSpringAnim;
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat;
|
||||
|
||||
/**
|
||||
* Controls the animation of swiping back and returning to launcher.
|
||||
@@ -242,20 +241,17 @@ public class LauncherBackAnimationController {
|
||||
|
||||
/** Transform the target window to match the target rect. */
|
||||
private void applyTransform(RectF targetRect, float cornerRadius) {
|
||||
SyncRtSurfaceTransactionApplierCompat.SurfaceParams.Builder builder =
|
||||
new SyncRtSurfaceTransactionApplierCompat.SurfaceParams.Builder(mBackTarget.leash);
|
||||
final float scale = targetRect.width() / mStartRect.width();
|
||||
mTransformMatrix.reset();
|
||||
mTransformMatrix.setScale(scale, scale);
|
||||
mTransformMatrix.postTranslate(targetRect.left, targetRect.top);
|
||||
builder.withMatrix(mTransformMatrix)
|
||||
.withWindowCrop(mStartRect)
|
||||
.withCornerRadius(cornerRadius);
|
||||
SyncRtSurfaceTransactionApplierCompat.SurfaceParams surfaceParams = builder.build();
|
||||
|
||||
if (surfaceParams.surface.isValid()) {
|
||||
surfaceParams.applyTo(mTransaction);
|
||||
if (mBackTarget.leash.isValid()) {
|
||||
mTransaction.setMatrix(mBackTarget.leash, mTransformMatrix, new float[9]);
|
||||
mTransaction.setWindowCrop(mBackTarget.leash, mStartRect);
|
||||
mTransaction.setCornerRadius(mBackTarget.leash, cornerRadius);
|
||||
}
|
||||
|
||||
mTransaction.apply();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,11 +37,11 @@ import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
import com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle;
|
||||
import com.android.quickstep.util.AnimatorControllerWithResistance;
|
||||
import com.android.quickstep.util.RectFSpringAnim;
|
||||
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
|
||||
import com.android.quickstep.util.TaskViewSimulator;
|
||||
import com.android.quickstep.util.TransformParams;
|
||||
import com.android.quickstep.util.TransformParams.BuilderProxy;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams.Builder;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.function.Consumer;
|
||||
@@ -335,11 +335,11 @@ public abstract class SwipeUpAnimationLogic implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBuildTargetParams(
|
||||
Builder builder, RemoteAnimationTargetCompat app, TransformParams params) {
|
||||
builder.withMatrix(mMatrix)
|
||||
.withWindowCrop(mCropRect)
|
||||
.withCornerRadius(params.getCornerRadius());
|
||||
public void onBuildTargetParams(SurfaceProperties builder, RemoteAnimationTargetCompat app,
|
||||
TransformParams params) {
|
||||
builder.setMatrix(mMatrix)
|
||||
.setWindowCrop(mCropRect)
|
||||
.setCornerRadius(params.getCornerRadius());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -70,6 +70,8 @@ import com.android.launcher3.statemanager.StateManager;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle;
|
||||
import com.android.quickstep.util.MultiValueUpdateListener;
|
||||
import com.android.quickstep.util.SurfaceTransaction;
|
||||
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
|
||||
import com.android.quickstep.util.SurfaceTransactionApplier;
|
||||
import com.android.quickstep.util.TaskViewSimulator;
|
||||
import com.android.quickstep.util.TransformParams;
|
||||
@@ -80,7 +82,6 @@ import com.android.quickstep.views.TaskView;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -250,21 +251,24 @@ public final class TaskViewUtils {
|
||||
|
||||
@Override
|
||||
public void onUpdate(float percent, boolean initOnly) {
|
||||
final SurfaceParams.Builder navBuilder =
|
||||
new SurfaceParams.Builder(navBarTarget.leash);
|
||||
|
||||
|
||||
// TODO Do we need to operate over multiple TVSs for the navbar leash?
|
||||
for (RemoteTargetHandle handle : remoteTargetHandles) {
|
||||
SurfaceTransaction transaction = new SurfaceTransaction();
|
||||
SurfaceProperties navBuilder =
|
||||
transaction.forSurface(navBarTarget.leash);
|
||||
|
||||
if (mNavFadeIn.value > mNavFadeIn.getStartValue()) {
|
||||
TaskViewSimulator taskViewSimulator = handle.getTaskViewSimulator();
|
||||
taskViewSimulator.getCurrentCropRect().round(cropRect);
|
||||
navBuilder.withMatrix(taskViewSimulator.getCurrentMatrix())
|
||||
.withWindowCrop(cropRect)
|
||||
.withAlpha(mNavFadeIn.value);
|
||||
navBuilder.setMatrix(taskViewSimulator.getCurrentMatrix())
|
||||
.setWindowCrop(cropRect)
|
||||
.setAlpha(mNavFadeIn.value);
|
||||
} else {
|
||||
navBuilder.withAlpha(mNavFadeOut.value);
|
||||
navBuilder.setAlpha(mNavFadeOut.value);
|
||||
}
|
||||
handle.getTransformParams().applySurfaceParams(navBuilder.build());
|
||||
handle.getTransformParams().applySurfaceParams(transaction);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -480,7 +484,7 @@ public final class TaskViewUtils {
|
||||
* If {@param launchingTaskView} is not null, then this will play the tasks launch animation
|
||||
* from the position of the GroupedTaskView (when user taps on the TaskView to start it).
|
||||
* Technically this case should be taken care of by
|
||||
* {@link #composeRecentsSplitLaunchAnimatorLegacy()} below, but the way we launch tasks whether
|
||||
* {@link #composeRecentsSplitLaunchAnimatorLegacy} below, but the way we launch tasks whether
|
||||
* it's a single task or multiple tasks results in different entry-points.
|
||||
*
|
||||
* If it is null, then it will simply fade in the starting apps and fade out launcher (for the
|
||||
|
||||
@@ -53,13 +53,13 @@ import com.android.quickstep.RecentsAnimationController;
|
||||
import com.android.quickstep.RecentsAnimationDeviceState;
|
||||
import com.android.quickstep.RecentsAnimationTargets;
|
||||
import com.android.quickstep.TaskAnimationManager;
|
||||
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
|
||||
import com.android.quickstep.util.TransformParams;
|
||||
import com.android.quickstep.util.TransformParams.BuilderProxy;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.InputMonitorCompat;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams.Builder;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -290,9 +290,9 @@ public class DeviceLockedInputConsumer implements InputConsumer,
|
||||
|
||||
@Override
|
||||
public void onBuildTargetParams(
|
||||
Builder builder, RemoteAnimationTargetCompat app, TransformParams params) {
|
||||
SurfaceProperties builder, RemoteAnimationTargetCompat app, TransformParams params) {
|
||||
mMatrix.setTranslate(0, mProgress.value * mMaxTranslationY);
|
||||
builder.withMatrix(mMatrix);
|
||||
builder.setMatrix(mMatrix);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,7 +33,6 @@ import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Build;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.View;
|
||||
import android.view.ViewOutlineProvider;
|
||||
|
||||
@@ -53,9 +52,11 @@ import com.android.quickstep.RecentsAnimationDeviceState;
|
||||
import com.android.quickstep.RemoteTargetGluer;
|
||||
import com.android.quickstep.SwipeUpAnimationLogic;
|
||||
import com.android.quickstep.SwipeUpAnimationLogic.RunningWindowAnim;
|
||||
import com.android.quickstep.util.RecordingSurfaceTransaction;
|
||||
import com.android.quickstep.util.RectFSpringAnim;
|
||||
import com.android.quickstep.util.SurfaceTransaction;
|
||||
import com.android.quickstep.util.SurfaceTransaction.MockProperties;
|
||||
import com.android.quickstep.util.TransformParams;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
abstract class SwipeUpGestureTutorialController extends TutorialController {
|
||||
@@ -415,21 +416,23 @@ abstract class SwipeUpGestureTutorialController extends TutorialController {
|
||||
private class FakeTransformParams extends TransformParams {
|
||||
|
||||
@Override
|
||||
public SurfaceParams[] createSurfaceParams(BuilderProxy proxy) {
|
||||
SurfaceParams.Builder builder = new SurfaceParams.Builder((SurfaceControl) null);
|
||||
proxy.onBuildTargetParams(builder, null, this);
|
||||
return new SurfaceParams[] {builder.build()};
|
||||
public SurfaceTransaction createSurfaceParams(BuilderProxy proxy) {
|
||||
RecordingSurfaceTransaction transaction = new RecordingSurfaceTransaction();
|
||||
proxy.onBuildTargetParams(transaction.mockProperties, null, this);
|
||||
return transaction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applySurfaceParams(SurfaceParams[] params) {
|
||||
SurfaceParams p = params[0];
|
||||
mFakeTaskView.setAnimationMatrix(p.matrix);
|
||||
mFakePreviousTaskView.setAnimationMatrix(p.matrix);
|
||||
mFakeTaskViewRect.set(p.windowCrop);
|
||||
mFakeTaskViewRadius = p.cornerRadius;
|
||||
mFakeTaskView.invalidateOutline();
|
||||
mFakePreviousTaskView.invalidateOutline();
|
||||
public void applySurfaceParams(SurfaceTransaction params) {
|
||||
if (params instanceof RecordingSurfaceTransaction) {
|
||||
MockProperties p = ((RecordingSurfaceTransaction) params).mockProperties;
|
||||
mFakeTaskView.setAnimationMatrix(p.matrix);
|
||||
mFakePreviousTaskView.setAnimationMatrix(p.matrix);
|
||||
mFakeTaskViewRect.set(p.windowCrop);
|
||||
mFakeTaskViewRadius = p.cornerRadius;
|
||||
mFakeTaskView.invalidateOutline();
|
||||
mFakePreviousTaskView.invalidateOutline();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.quickstep.util;
|
||||
|
||||
/**
|
||||
* Extension for {@link SurfaceTransaction} which records the commands for mocking
|
||||
*/
|
||||
public class RecordingSurfaceTransaction extends SurfaceTransaction {
|
||||
|
||||
/**
|
||||
* A mock builder which can be used for recording values
|
||||
*/
|
||||
public final MockProperties mockProperties = new MockProperties();
|
||||
|
||||
}
|
||||
@@ -19,10 +19,10 @@ import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MOD
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.animation.ValueAnimator.AnimatorUpdateListener;
|
||||
import android.view.SurfaceControl.Transaction;
|
||||
|
||||
import com.android.quickstep.RemoteAnimationTargets;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.TransactionCompat;
|
||||
|
||||
/**
|
||||
* Animation listener which fades out the closing targets
|
||||
@@ -40,7 +40,7 @@ public class RemoteFadeOutAnimationListener implements AnimatorUpdateListener {
|
||||
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator valueAnimator) {
|
||||
TransactionCompat t = new TransactionCompat();
|
||||
Transaction t = new Transaction();
|
||||
if (mFirstFrame) {
|
||||
for (RemoteAnimationTargetCompat target : mTarget.unfilteredApps) {
|
||||
t.show(target.leash);
|
||||
|
||||
161
quickstep/src/com/android/quickstep/util/SurfaceTransaction.java
Normal file
161
quickstep/src/com/android/quickstep/util/SurfaceTransaction.java
Normal file
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.quickstep.util;
|
||||
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Rect;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.SurfaceControl.Transaction;
|
||||
|
||||
/**
|
||||
* Helper class for building a {@link Transaction}.
|
||||
*/
|
||||
public class SurfaceTransaction {
|
||||
|
||||
private final Transaction mTransaction = new Transaction();
|
||||
private final float[] mTmpValues = new float[9];
|
||||
|
||||
/**
|
||||
* Creates a new builder for the provided surface
|
||||
*/
|
||||
public SurfaceProperties forSurface(SurfaceControl surface) {
|
||||
return surface.isValid() ? new SurfaceProperties(surface) : new MockProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the final transaction
|
||||
*/
|
||||
public Transaction getTransaction() {
|
||||
return mTransaction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility class to update surface params in a transaction
|
||||
*/
|
||||
public class SurfaceProperties {
|
||||
|
||||
private final SurfaceControl mSurface;
|
||||
|
||||
SurfaceProperties(SurfaceControl surface) {
|
||||
mSurface = surface;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param alpha The alpha value to apply to the surface.
|
||||
* @return this Builder
|
||||
*/
|
||||
public SurfaceProperties setAlpha(float alpha) {
|
||||
mTransaction.setAlpha(mSurface, alpha);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param matrix The matrix to apply to the surface.
|
||||
* @return this Builder
|
||||
*/
|
||||
public SurfaceProperties setMatrix(Matrix matrix) {
|
||||
mTransaction.setMatrix(mSurface, matrix, mTmpValues);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param windowCrop The window crop to apply to the surface.
|
||||
* @return this Builder
|
||||
*/
|
||||
public SurfaceProperties setWindowCrop(Rect windowCrop) {
|
||||
mTransaction.setWindowCrop(mSurface, windowCrop);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param relativeLayer The relative layer.
|
||||
* @return this Builder
|
||||
*/
|
||||
public SurfaceProperties setLayer(int relativeLayer) {
|
||||
mTransaction.setLayer(mSurface, relativeLayer);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param radius the Radius for rounded corners to apply to the surface.
|
||||
* @return this Builder
|
||||
*/
|
||||
public SurfaceProperties setCornerRadius(float radius) {
|
||||
mTransaction.setCornerRadius(mSurface, radius);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param radius the Radius for the shadows to apply to the surface.
|
||||
* @return this Builder
|
||||
*/
|
||||
public SurfaceProperties setShadowRadius(float radius) {
|
||||
mTransaction.setShadowRadius(mSurface, radius);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extension of {@link SurfaceProperties} which just stores all the values locally
|
||||
*/
|
||||
public class MockProperties extends SurfaceProperties {
|
||||
|
||||
public float alpha = -1;
|
||||
public Matrix matrix = null;
|
||||
public Rect windowCrop = null;
|
||||
public float cornerRadius = 0;
|
||||
public float shadowRadius = 0;
|
||||
|
||||
protected MockProperties() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurfaceProperties setAlpha(float alpha) {
|
||||
this.alpha = alpha;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurfaceProperties setMatrix(Matrix matrix) {
|
||||
this.matrix = matrix;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurfaceProperties setWindowCrop(Rect windowCrop) {
|
||||
this.windowCrop = windowCrop;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurfaceProperties setLayer(int relativeLayer) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurfaceProperties setCornerRadius(float radius) {
|
||||
this.cornerRadius = radius;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurfaceProperties setShadowRadius(float radius) {
|
||||
this.shadowRadius = radius;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@ import android.view.View;
|
||||
import android.view.ViewRootImpl;
|
||||
|
||||
import com.android.quickstep.RemoteAnimationTargets.ReleaseCheck;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -70,18 +69,12 @@ public class SurfaceTransactionApplier extends ReleaseCheck {
|
||||
* @param params The surface parameters to apply. DO NOT MODIFY the list after passing into
|
||||
* this method to avoid synchronization issues.
|
||||
*/
|
||||
public void scheduleApply(final SurfaceParams... params) {
|
||||
public void scheduleApply(SurfaceTransaction params) {
|
||||
View view = mTargetViewRootImpl.getView();
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
Transaction t = new Transaction();
|
||||
for (int i = params.length - 1; i >= 0; i--) {
|
||||
SurfaceParams surfaceParams = params[i];
|
||||
if (surfaceParams.surface.isValid()) {
|
||||
surfaceParams.applyTo(t);
|
||||
}
|
||||
}
|
||||
Transaction t = params.getTransaction();
|
||||
|
||||
mLastSequenceNumber++;
|
||||
final int toApplySeqNo = mLastSequenceNumber;
|
||||
@@ -102,7 +95,7 @@ public class SurfaceTransactionApplier extends ReleaseCheck {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of SyncRtSurfaceTransactionApplier, deferring until the target view is
|
||||
* Creates an instance of SurfaceTransactionApplier, deferring until the target view is
|
||||
* attached if necessary.
|
||||
*/
|
||||
public static void create(
|
||||
|
||||
@@ -46,11 +46,11 @@ import com.android.launcher3.util.TraceHelper;
|
||||
import com.android.quickstep.AnimatedFloat;
|
||||
import com.android.quickstep.BaseActivityInterface;
|
||||
import com.android.quickstep.TaskAnimationManager;
|
||||
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
|
||||
import com.android.quickstep.views.TaskView.FullscreenDrawParams;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
import com.android.systemui.shared.recents.utilities.PreviewPositionHelper;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams.Builder;
|
||||
|
||||
/**
|
||||
* A utility class which emulates the layout behavior of TaskView and RecentsView
|
||||
@@ -386,10 +386,10 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
||||
|
||||
@Override
|
||||
public void onBuildTargetParams(
|
||||
Builder builder, RemoteAnimationTargetCompat app, TransformParams params) {
|
||||
builder.withMatrix(mMatrix)
|
||||
.withWindowCrop(mTmpCropRect)
|
||||
.withCornerRadius(getCurrentCornerRadius());
|
||||
SurfaceProperties builder, RemoteAnimationTargetCompat app, TransformParams params) {
|
||||
builder.setMatrix(mMatrix)
|
||||
.setWindowCrop(mTmpCropRect)
|
||||
.setCornerRadius(getCurrentCornerRadius());
|
||||
|
||||
// If mDrawsBelowRecents is unset, no reordering will be enforced.
|
||||
if (mDrawsBelowRecents != null) {
|
||||
@@ -398,7 +398,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
||||
// conflict with layers that WM core positions (ie. the input consumers). For shell
|
||||
// transitions, the animation leashes are reparented to an animation container so we
|
||||
// can bump layers as needed.
|
||||
builder.withLayer(mDrawsBelowRecents
|
||||
builder.setLayer(mDrawsBelowRecents
|
||||
? Integer.MIN_VALUE + 1
|
||||
: ENABLE_SHELL_TRANSITIONS ? Integer.MAX_VALUE : 0);
|
||||
}
|
||||
|
||||
@@ -21,10 +21,8 @@ import android.view.SurfaceControl;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.quickstep.RemoteAnimationTargets;
|
||||
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
|
||||
import com.android.systemui.shared.system.TransactionCompat;
|
||||
|
||||
public class TransformParams {
|
||||
|
||||
@@ -113,8 +111,7 @@ public class TransformParams {
|
||||
* Sets the SyncRtSurfaceTransactionApplierCompat that will apply the SurfaceParams that
|
||||
* are computed based on these TransformParams.
|
||||
*/
|
||||
public TransformParams setSyncTransactionApplier(
|
||||
SurfaceTransactionApplier applier) {
|
||||
public TransformParams setSyncTransactionApplier(SurfaceTransactionApplier applier) {
|
||||
mSyncTransactionApplier = applier;
|
||||
return this;
|
||||
}
|
||||
@@ -137,16 +134,14 @@ public class TransformParams {
|
||||
return this;
|
||||
}
|
||||
|
||||
public SurfaceParams[] createSurfaceParams(BuilderProxy proxy) {
|
||||
public SurfaceTransaction createSurfaceParams(BuilderProxy proxy) {
|
||||
RemoteAnimationTargets targets = mTargetSet;
|
||||
final int appLength = targets.unfilteredApps.length;
|
||||
final int wallpaperLength = targets.wallpapers != null ? targets.wallpapers.length : 0;
|
||||
SurfaceParams[] surfaceParams = new SurfaceParams[appLength + wallpaperLength];
|
||||
SurfaceTransaction transaction = new SurfaceTransaction();
|
||||
mRecentsSurface = getRecentsSurface(targets);
|
||||
|
||||
for (int i = 0; i < appLength; i++) {
|
||||
for (int i = 0; i < targets.unfilteredApps.length; i++) {
|
||||
RemoteAnimationTargetCompat app = targets.unfilteredApps[i];
|
||||
SurfaceParams.Builder builder = new SurfaceParams.Builder(app.leash);
|
||||
SurfaceProperties builder = transaction.forSurface(app.leash);
|
||||
|
||||
if (app.mode == targets.targetMode) {
|
||||
if (app.activityType == RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME) {
|
||||
@@ -156,9 +151,9 @@ public class TransformParams {
|
||||
if (app.activityType == RemoteAnimationTargetCompat.ACTIVITY_TYPE_ASSISTANT
|
||||
&& app.isNotInRecents) {
|
||||
float progress = Utilities.boundToRange(getProgress(), 0, 1);
|
||||
builder.withAlpha(1 - Interpolators.DEACCEL_2_5.getInterpolation(progress));
|
||||
builder.setAlpha(1 - Interpolators.DEACCEL_2_5.getInterpolation(progress));
|
||||
} else {
|
||||
builder.withAlpha(getTargetAlpha());
|
||||
builder.setAlpha(getTargetAlpha());
|
||||
}
|
||||
|
||||
proxy.onBuildTargetParams(builder, app, this);
|
||||
@@ -166,15 +161,15 @@ public class TransformParams {
|
||||
} else {
|
||||
mBaseBuilderProxy.onBuildTargetParams(builder, app, this);
|
||||
}
|
||||
surfaceParams[i] = builder.build();
|
||||
}
|
||||
|
||||
// always put wallpaper layer to bottom.
|
||||
final int wallpaperLength = targets.wallpapers != null ? targets.wallpapers.length : 0;
|
||||
for (int i = 0; i < wallpaperLength; i++) {
|
||||
RemoteAnimationTargetCompat wallpaper = targets.wallpapers[i];
|
||||
surfaceParams[appLength + i] = new SurfaceParams.Builder(wallpaper.leash)
|
||||
.withLayer(Integer.MIN_VALUE).build();
|
||||
transaction.forSurface(wallpaper.leash).setLayer(Integer.MIN_VALUE);
|
||||
}
|
||||
return surfaceParams;
|
||||
return transaction;
|
||||
}
|
||||
|
||||
private static SurfaceControl getRecentsSurface(RemoteAnimationTargets targets) {
|
||||
@@ -213,15 +208,11 @@ public class TransformParams {
|
||||
return mTargetSet;
|
||||
}
|
||||
|
||||
public void applySurfaceParams(SurfaceParams... params) {
|
||||
public void applySurfaceParams(SurfaceTransaction builder) {
|
||||
if (mSyncTransactionApplier != null) {
|
||||
mSyncTransactionApplier.scheduleApply(params);
|
||||
mSyncTransactionApplier.scheduleApply(builder);
|
||||
} else {
|
||||
TransactionCompat t = new TransactionCompat();
|
||||
for (SurfaceParams param : params) {
|
||||
SyncRtSurfaceTransactionApplierCompat.applyParams(t, param);
|
||||
}
|
||||
t.apply();
|
||||
builder.getTransaction().apply();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,9 +220,9 @@ public class TransformParams {
|
||||
public interface BuilderProxy {
|
||||
|
||||
BuilderProxy NO_OP = (builder, app, params) -> { };
|
||||
BuilderProxy ALWAYS_VISIBLE = (builder, app, params) ->builder.withAlpha(1);
|
||||
BuilderProxy ALWAYS_VISIBLE = (builder, app, params) -> builder.setAlpha(1);
|
||||
|
||||
void onBuildTargetParams(SurfaceParams.Builder builder,
|
||||
void onBuildTargetParams(SurfaceProperties builder,
|
||||
RemoteAnimationTargetCompat app, TransformParams params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,6 +180,7 @@ import com.android.quickstep.util.RecentsOrientedState;
|
||||
import com.android.quickstep.util.SplitAnimationTimings;
|
||||
import com.android.quickstep.util.SplitScreenBounds;
|
||||
import com.android.quickstep.util.SplitSelectStateController;
|
||||
import com.android.quickstep.util.SurfaceTransaction;
|
||||
import com.android.quickstep.util.SurfaceTransactionApplier;
|
||||
import com.android.quickstep.util.TaskViewSimulator;
|
||||
import com.android.quickstep.util.TaskVisualsChangeListener;
|
||||
@@ -192,7 +193,6 @@ import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
||||
import com.android.systemui.shared.system.PackageManagerWrapper;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
|
||||
import com.android.systemui.shared.system.TaskStackChangeListener;
|
||||
import com.android.systemui.shared.system.TaskStackChangeListeners;
|
||||
import com.android.wm.shell.pip.IPipAnimationListener;
|
||||
@@ -1077,14 +1077,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
appAnimator.setInterpolator(ACCEL_DEACCEL);
|
||||
appAnimator.addUpdateListener(valueAnimator -> {
|
||||
float percent = valueAnimator.getAnimatedFraction();
|
||||
SurfaceParams.Builder builder = new SurfaceParams.Builder(
|
||||
apps[apps.length - 1].leash);
|
||||
SurfaceTransaction transaction = new SurfaceTransaction();
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.postScale(percent, percent);
|
||||
matrix.postTranslate(mActivity.getDeviceProfile().widthPx * (1 - percent) / 2,
|
||||
mActivity.getDeviceProfile().heightPx * (1 - percent) / 2);
|
||||
builder.withAlpha(percent).withMatrix(matrix);
|
||||
surfaceApplier.scheduleApply(builder.build());
|
||||
transaction.forSurface(apps[apps.length - 1].leash)
|
||||
.setAlpha(percent)
|
||||
.setMatrix(matrix);
|
||||
surfaceApplier.scheduleApply(transaction);
|
||||
});
|
||||
anim.play(appAnimator);
|
||||
anim.addListener(new AnimatorListenerAdapter() {
|
||||
|
||||
@@ -36,7 +36,6 @@ import android.appwidget.AppWidgetProviderInfo;
|
||||
import android.content.ComponentName;
|
||||
import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.SmallTest;
|
||||
@@ -111,7 +110,6 @@ public final class WidgetsPredicationUpdateTaskTest {
|
||||
doReturn(allWidgets).when(manager).getInstalledProvidersForProfile(eq(myUserHandle()));
|
||||
doAnswer(i -> {
|
||||
String pkg = i.getArgument(0);
|
||||
Log.e("Hello", "Getting v " + pkg);
|
||||
return TextUtils.isEmpty(pkg) ? allWidgets : allWidgets.stream()
|
||||
.filter(a -> pkg.equals(a.provider.getPackageName()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -24,7 +24,6 @@ import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.util.ArrayMap;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceControl;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.SmallTest;
|
||||
@@ -42,8 +41,8 @@ import com.android.launcher3.util.window.CachedDisplayInfo;
|
||||
import com.android.launcher3.util.window.WindowManagerProxy;
|
||||
import com.android.quickstep.FallbackActivityInterface;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.util.SurfaceTransaction.MockProperties;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
@@ -207,17 +206,21 @@ public class TaskViewSimulatorTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurfaceParams[] createSurfaceParams(BuilderProxy proxy) {
|
||||
SurfaceParams.Builder builder = new SurfaceParams.Builder((SurfaceControl) null);
|
||||
proxy.onBuildTargetParams(builder, mock(RemoteAnimationTargetCompat.class), this);
|
||||
return new SurfaceParams[] {builder.build()};
|
||||
public SurfaceTransaction createSurfaceParams(BuilderProxy proxy) {
|
||||
RecordingSurfaceTransaction transaction = new RecordingSurfaceTransaction();
|
||||
proxy.onBuildTargetParams(
|
||||
transaction.mockProperties, mock(RemoteAnimationTargetCompat.class), this);
|
||||
return transaction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applySurfaceParams(SurfaceParams[] params) {
|
||||
public void applySurfaceParams(SurfaceTransaction params) {
|
||||
Assert.assertTrue(params instanceof RecordingSurfaceTransaction);
|
||||
MockProperties p = ((RecordingSurfaceTransaction) params).mockProperties;
|
||||
|
||||
// Verify that the task position remains the same
|
||||
RectF newAppBounds = new RectF(mAppBounds);
|
||||
params[0].matrix.mapRect(newAppBounds);
|
||||
p.matrix.mapRect(newAppBounds);
|
||||
Assert.assertThat(newAppBounds, new AlmostSame(mAppBounds));
|
||||
|
||||
System.err.println("Bounds mapped: " + mAppBounds + " => " + newAppBounds);
|
||||
|
||||
Reference in New Issue
Block a user