summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/InsetsAnimationControlImpl.java16
-rw-r--r--core/java/android/view/InsetsController.java14
-rw-r--r--core/java/android/view/InsetsSourceConsumer.java2
-rw-r--r--core/java/android/view/SyncRtSurfaceTransactionApplier.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java2
5 files changed, 26 insertions, 19 deletions
diff --git a/core/java/android/view/InsetsAnimationControlImpl.java b/core/java/android/view/InsetsAnimationControlImpl.java
index 7291d0b2f10c..625ddc2549cc 100644
--- a/core/java/android/view/InsetsAnimationControlImpl.java
+++ b/core/java/android/view/InsetsAnimationControlImpl.java
@@ -127,16 +127,18 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll
final Insets offset = Insets.subtract(mShownInsets, mPendingInsets);
ArrayList<SurfaceParams> params = new ArrayList<>();
if (offset.left != 0) {
- updateLeashesForSide(INSET_SIDE_LEFT, offset.left, params, state);
+ updateLeashesForSide(INSET_SIDE_LEFT, offset.left, mPendingInsets.left, params, state);
}
if (offset.top != 0) {
- updateLeashesForSide(INSET_SIDE_TOP, offset.top, params, state);
+ updateLeashesForSide(INSET_SIDE_TOP, offset.top, mPendingInsets.top, params, state);
}
if (offset.right != 0) {
- updateLeashesForSide(INSET_SIDE_RIGHT, offset.right, params, state);
+ updateLeashesForSide(INSET_SIDE_RIGHT, offset.right, mPendingInsets.right, params,
+ state);
}
if (offset.bottom != 0) {
- updateLeashesForSide(INSET_SIDE_BOTTOM, offset.bottom, params, state);
+ updateLeashesForSide(INSET_SIDE_BOTTOM, offset.bottom, mPendingInsets.bottom, params,
+ state);
}
SyncRtSurfaceTransactionApplier applier = mTransactionApplierSupplier.get();
applier.scheduleApply(params.toArray(new SurfaceParams[params.size()]));
@@ -171,7 +173,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll
return Insets.max(Insets.min(insets, mShownInsets), mHiddenInsets);
}
- private void updateLeashesForSide(@InsetSide int side, int inset,
+ private void updateLeashesForSide(@InsetSide int side, int offset, int inset,
ArrayList<SurfaceParams> surfaceParams, InsetsState state) {
ArraySet<InsetsSourceConsumer> items = mSideSourceMap.get(side);
// TODO: Implement behavior when inset spans over multiple types
@@ -182,10 +184,10 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll
mTmpMatrix.setTranslate(source.getFrame().left, source.getFrame().top);
mTmpFrame.set(source.getFrame());
- addTranslationToMatrix(side, inset, mTmpMatrix, mTmpFrame);
+ addTranslationToMatrix(side, offset, mTmpMatrix, mTmpFrame);
state.getSource(source.getType()).setFrame(mTmpFrame);
- surfaceParams.add(new SurfaceParams(leash, 1f, mTmpMatrix, null, 0, 0f));
+ surfaceParams.add(new SurfaceParams(leash, 1f, mTmpMatrix, null, 0, 0f, inset != 0));
}
}
diff --git a/core/java/android/view/InsetsController.java b/core/java/android/view/InsetsController.java
index 4f9ecd575326..8e773799d188 100644
--- a/core/java/android/view/InsetsController.java
+++ b/core/java/android/view/InsetsController.java
@@ -329,6 +329,11 @@ public class InsetsController implements WindowInsetsController {
WindowInsetsAnimationControlListener listener = new WindowInsetsAnimationControlListener() {
@Override
public void onReady(WindowInsetsAnimationController controller, int types) {
+ if (show) {
+ showDirectly(types);
+ } else {
+ hideDirectly(types);
+ }
mAnimator = ObjectAnimator.ofObject(
controller,
new InsetsProperty(),
@@ -356,11 +361,6 @@ public class InsetsController implements WindowInsetsController {
private void onAnimationFinish() {
mAnimationDirection = DIRECTION_NONE;
- if (show) {
- showOnAnimationEnd(types);
- } else {
- hideOnAnimationEnd(types);
- }
}
};
// TODO: Instead of clearing this here, properly wire up
@@ -369,14 +369,14 @@ public class InsetsController implements WindowInsetsController {
controlWindowInsetsAnimation(types, listener);
}
- private void hideOnAnimationEnd(@InsetType int types) {
+ private void hideDirectly(@InsetType int types) {
final ArraySet<Integer> internalTypes = InsetsState.toInternalType(types);
for (int i = internalTypes.size() - 1; i >= 0; i--) {
getSourceConsumer(internalTypes.valueAt(i)).hide();
}
}
- private void showOnAnimationEnd(@InsetType int types) {
+ private void showDirectly(@InsetType int types) {
final ArraySet<Integer> internalTypes = InsetsState.toInternalType(types);
for (int i = internalTypes.size() - 1; i >= 0; i--) {
getSourceConsumer(internalTypes.valueAt(i)).show();
diff --git a/core/java/android/view/InsetsSourceConsumer.java b/core/java/android/view/InsetsSourceConsumer.java
index f48318cd7d0a..cccfd870a3e4 100644
--- a/core/java/android/view/InsetsSourceConsumer.java
+++ b/core/java/android/view/InsetsSourceConsumer.java
@@ -109,7 +109,6 @@ public class InsetsSourceConsumer {
return;
}
mVisible = visible;
- applyHiddenToControl();
applyLocalVisibilityOverride();
mController.notifyVisibilityChanged();
}
@@ -119,7 +118,6 @@ public class InsetsSourceConsumer {
return;
}
- // TODO: Animation
final Transaction t = mTransactionSupplier.get();
if (mVisible) {
t.show(mSourceControl.getLeash());
diff --git a/core/java/android/view/SyncRtSurfaceTransactionApplier.java b/core/java/android/view/SyncRtSurfaceTransactionApplier.java
index 0270acb3aea7..85457cb48218 100644
--- a/core/java/android/view/SyncRtSurfaceTransactionApplier.java
+++ b/core/java/android/view/SyncRtSurfaceTransactionApplier.java
@@ -77,7 +77,11 @@ public class SyncRtSurfaceTransactionApplier {
t.setAlpha(params.surface, params.alpha);
t.setLayer(params.surface, params.layer);
t.setCornerRadius(params.surface, params.cornerRadius);
- t.show(params.surface);
+ if (params.visible) {
+ t.show(params.surface);
+ } else {
+ t.hide(params.surface);
+ }
}
/**
@@ -121,13 +125,14 @@ public class SyncRtSurfaceTransactionApplier {
* @param windowCrop Crop to apply.
*/
public SurfaceParams(SurfaceControl surface, float alpha, Matrix matrix,
- Rect windowCrop, int layer, float cornerRadius) {
+ Rect windowCrop, int layer, float cornerRadius, boolean visible) {
this.surface = surface;
this.alpha = alpha;
this.matrix = new Matrix(matrix);
this.windowCrop = new Rect(windowCrop);
this.layer = layer;
this.cornerRadius = cornerRadius;
+ this.visible = visible;
}
@VisibleForTesting
@@ -147,5 +152,7 @@ public class SyncRtSurfaceTransactionApplier {
@VisibleForTesting
public final int layer;
+
+ public final boolean visible;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java
index e1b231b96693..333239e77d1b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java
@@ -268,7 +268,7 @@ public class ActivityLaunchAnimator {
m.postTranslate(0, (float) (mParams.top - app.position.y));
mWindowCrop.set(mParams.left, 0, mParams.right, mParams.getHeight());
SurfaceParams params = new SurfaceParams(app.leash, 1f /* alpha */, m, mWindowCrop,
- app.prefixOrderIndex, mCornerRadius);
+ app.prefixOrderIndex, mCornerRadius, true /* visible */);
mSyncRtTransactionApplier.scheduleApply(params);
}