Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3886b25e authored by Tiger's avatar Tiger Committed by Tiger Huang
Browse files

Avoid a potential ArrayIndexOutOfBoundsException

This CL removes hideInsetSourceViewOverflows which contains the error.

Fix: 331841845
Bug: 202383002
Bug: 297494486
Bug: 234093736
Test: presubmit
Change-Id: Ie601441298661ad6c5157bc6c48953391a45e558
parent 69a62d57
Loading
Loading
Loading
Loading
+0 −25
Original line number Diff line number Diff line
@@ -3286,10 +3286,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<

            if (isTaskTransitOld(transit) && getWindowingMode() == WINDOWING_MODE_FULLSCREEN) {
                animationRunnerBuilder.setTaskBackgroundColor(getTaskAnimationBackgroundColor());
                // TODO: Remove when we migrate to shell (b/202383002)
                if (mWmService.mTaskTransitionSpec != null) {
                    animationRunnerBuilder.hideInsetSourceViewOverflows();
                }
            }

            // Check if the animation requests to show background color for Activity and embedded
@@ -4255,27 +4251,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
            }
        }

        private void hideInsetSourceViewOverflows() {
            final SparseArray<InsetsSourceProvider> providers =
                    getDisplayContent().getInsetsStateController().getSourceProviders();
            for (int i = providers.size(); i >= 0; i--) {
                final InsetsSourceProvider insetProvider = providers.valueAt(i);
                if (!insetProvider.getSource().hasFlags(InsetsSource.FLAG_INSETS_ROUNDED_CORNER)) {
                    return;
                }

                // Will apply it immediately to current leash and to all future inset animations
                // until we disable it.
                insetProvider.setCropToProvidingInsetsBounds(getPendingTransaction());

                // Only clear the size restriction of the inset once the surface animation is over
                // and not if it's canceled to be replace by another animation.
                mOnAnimationFinished.add(() -> {
                    insetProvider.removeCropToProvidingInsetsBounds(getPendingTransaction());
                });
            }
        }

        private IAnimationStarter build() {
            return (Transaction t, AnimationAdapter adapter, boolean hidden,
                    @AnimationType int type, @Nullable AnimationAdapter snapshotAnim) -> {