Loading core/java/android/view/InsetsController.java +3 −3 Original line number Diff line number Diff line Loading @@ -303,7 +303,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } /** Not running an animation. */ @VisibleForTesting(visibility = PACKAGE) @VisibleForTesting public static final int ANIMATION_TYPE_NONE = -1; /** Running animation will show insets */ Loading @@ -317,7 +317,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation public static final int ANIMATION_TYPE_USER = 2; /** Running animation will resize insets */ @VisibleForTesting(visibility = PACKAGE) @VisibleForTesting public static final int ANIMATION_TYPE_RESIZE = 3; @Retention(RetentionPolicy.SOURCE) Loading Loading @@ -1712,7 +1712,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation mImeSourceConsumer.onWindowFocusLost(); } @VisibleForTesting(visibility = PACKAGE) @VisibleForTesting public @AnimationType int getAnimationType(@InsetsType int type) { for (int i = mRunningAnimations.size() - 1; i >= 0; i--) { InsetsAnimationControlRunner control = mRunningAnimations.get(i).runner; Loading core/java/android/view/InsetsSourceConsumer.java +9 −18 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package android.view; import static android.view.InsetsController.ANIMATION_TYPE_NONE; import static android.view.InsetsController.ANIMATION_TYPE_RESIZE; import static android.view.InsetsController.AnimationType; import static android.view.InsetsController.DEBUG; import static android.view.InsetsSourceConsumerProto.ANIMATION_STATE; Loading @@ -32,7 +31,6 @@ import static com.android.internal.annotations.VisibleForTesting.Visibility.PACK import android.annotation.IntDef; import android.annotation.Nullable; import android.graphics.Point; import android.graphics.Rect; import android.util.Log; import android.util.proto.ProtoOutputStream; Loading Loading @@ -181,11 +179,10 @@ public class InsetsSourceConsumer { mController.notifyVisibilityChanged(); } // If there is no animation controlling the leash, make sure the visibility and the // position is up-to-date. final int animType = mController.getAnimationType(mType); if (animType == ANIMATION_TYPE_NONE || animType == ANIMATION_TYPE_RESIZE) { applyRequestedVisibilityAndPositionToControl(); // If we have a new leash, make sure visibility is up-to-date, even though we // didn't want to run an animation above. if (mController.getAnimationType(mType) == ANIMATION_TYPE_NONE) { applyRequestedVisibilityToControl(); } // Remove the surface that owned by last control when it lost. Loading Loading @@ -374,27 +371,21 @@ public class InsetsSourceConsumer { if (DEBUG) Log.d(TAG, "updateSource: " + newSource); } private void applyRequestedVisibilityAndPositionToControl() { if (mSourceControl == null) { return; } final SurfaceControl leash = mSourceControl.getLeash(); if (leash == null) { private void applyRequestedVisibilityToControl() { if (mSourceControl == null || mSourceControl.getLeash() == null) { return; } final boolean requestedVisible = (mController.getRequestedVisibleTypes() & mType) != 0; final Point surfacePosition = mSourceControl.getSurfacePosition(); try (Transaction t = mTransactionSupplier.get()) { if (DEBUG) Log.d(TAG, "applyRequestedVisibilityToControl: " + requestedVisible); if (requestedVisible) { t.show(leash); t.show(mSourceControl.getLeash()); } else { t.hide(leash); t.hide(mSourceControl.getLeash()); } // Ensure the alpha value is aligned with the actual requested visibility. t.setAlpha(leash, requestedVisible ? 1 : 0); t.setPosition(leash, surfacePosition.x, surfacePosition.y); t.setAlpha(mSourceControl.getLeash(), requestedVisible ? 1 : 0); t.apply(); } onPerceptible(requestedVisible); Loading Loading
core/java/android/view/InsetsController.java +3 −3 Original line number Diff line number Diff line Loading @@ -303,7 +303,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } /** Not running an animation. */ @VisibleForTesting(visibility = PACKAGE) @VisibleForTesting public static final int ANIMATION_TYPE_NONE = -1; /** Running animation will show insets */ Loading @@ -317,7 +317,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation public static final int ANIMATION_TYPE_USER = 2; /** Running animation will resize insets */ @VisibleForTesting(visibility = PACKAGE) @VisibleForTesting public static final int ANIMATION_TYPE_RESIZE = 3; @Retention(RetentionPolicy.SOURCE) Loading Loading @@ -1712,7 +1712,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation mImeSourceConsumer.onWindowFocusLost(); } @VisibleForTesting(visibility = PACKAGE) @VisibleForTesting public @AnimationType int getAnimationType(@InsetsType int type) { for (int i = mRunningAnimations.size() - 1; i >= 0; i--) { InsetsAnimationControlRunner control = mRunningAnimations.get(i).runner; Loading
core/java/android/view/InsetsSourceConsumer.java +9 −18 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package android.view; import static android.view.InsetsController.ANIMATION_TYPE_NONE; import static android.view.InsetsController.ANIMATION_TYPE_RESIZE; import static android.view.InsetsController.AnimationType; import static android.view.InsetsController.DEBUG; import static android.view.InsetsSourceConsumerProto.ANIMATION_STATE; Loading @@ -32,7 +31,6 @@ import static com.android.internal.annotations.VisibleForTesting.Visibility.PACK import android.annotation.IntDef; import android.annotation.Nullable; import android.graphics.Point; import android.graphics.Rect; import android.util.Log; import android.util.proto.ProtoOutputStream; Loading Loading @@ -181,11 +179,10 @@ public class InsetsSourceConsumer { mController.notifyVisibilityChanged(); } // If there is no animation controlling the leash, make sure the visibility and the // position is up-to-date. final int animType = mController.getAnimationType(mType); if (animType == ANIMATION_TYPE_NONE || animType == ANIMATION_TYPE_RESIZE) { applyRequestedVisibilityAndPositionToControl(); // If we have a new leash, make sure visibility is up-to-date, even though we // didn't want to run an animation above. if (mController.getAnimationType(mType) == ANIMATION_TYPE_NONE) { applyRequestedVisibilityToControl(); } // Remove the surface that owned by last control when it lost. Loading Loading @@ -374,27 +371,21 @@ public class InsetsSourceConsumer { if (DEBUG) Log.d(TAG, "updateSource: " + newSource); } private void applyRequestedVisibilityAndPositionToControl() { if (mSourceControl == null) { return; } final SurfaceControl leash = mSourceControl.getLeash(); if (leash == null) { private void applyRequestedVisibilityToControl() { if (mSourceControl == null || mSourceControl.getLeash() == null) { return; } final boolean requestedVisible = (mController.getRequestedVisibleTypes() & mType) != 0; final Point surfacePosition = mSourceControl.getSurfacePosition(); try (Transaction t = mTransactionSupplier.get()) { if (DEBUG) Log.d(TAG, "applyRequestedVisibilityToControl: " + requestedVisible); if (requestedVisible) { t.show(leash); t.show(mSourceControl.getLeash()); } else { t.hide(leash); t.hide(mSourceControl.getLeash()); } // Ensure the alpha value is aligned with the actual requested visibility. t.setAlpha(leash, requestedVisible ? 1 : 0); t.setPosition(leash, surfacePosition.x, surfacePosition.y); t.setAlpha(mSourceControl.getLeash(), requestedVisible ? 1 : 0); t.apply(); } onPerceptible(requestedVisible); Loading