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

Commit 2116f0e1 authored by mattsziklay's avatar mattsziklay
Browse files

Skip fade out animator if current type is NO_INDICATOR.

In rare cases, an indicator can attempt to fade out before its initial
type is determined and it's begun to fade in, causing a crash due to
invalid argument type when fetching indicator bounds.

Since no indicator is present, we don't need to animate; simply run the
callback and return.

Bug: 368007073
Test: Manual
Flag: EXEMPT bugfix
Change-Id: Ief33c022f0e53c14ce4aada4d1cd3286215dd8d4
parent fe25ea1a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -120,6 +120,7 @@ public class DesktopModeVisualIndicator {
    private View mView;
    private IndicatorType mCurrentType;
    private DragStartState mDragStartState;
    private boolean mIsReleased;

    public DesktopModeVisualIndicator(SyncTransactionQueue syncQueue,
            ActivityManager.RunningTaskInfo taskInfo, DisplayController displayController,
@@ -240,6 +241,7 @@ public class DesktopModeVisualIndicator {
     * Create a fullscreen indicator with no animation
     */
    private void createView() {
        if (mIsReleased) return;
        final SurfaceControl.Transaction t = new SurfaceControl.Transaction();
        final Resources resources = mContext.getResources();
        final DisplayMetrics metrics = resources.getDisplayMetrics();
@@ -295,6 +297,12 @@ public class DesktopModeVisualIndicator {
     * @param finishCallback called when animation ends or gets cancelled
     */
    void fadeOutIndicator(@Nullable Runnable finishCallback) {
        if (mCurrentType == NO_INDICATOR) {
            // In rare cases, fade out can be requested before the indicator has determined its
            // initial type and started animating in. In this case, no animator is needed.
            finishCallback.run();
            return;
        }
        final VisualIndicatorAnimator animator = VisualIndicatorAnimator
                .fadeBoundsOut(mView, mCurrentType,
                        mDisplayController.getDisplayLayout(mTaskInfo.displayId));
@@ -335,6 +343,7 @@ public class DesktopModeVisualIndicator {
     * Release the indicator and its components when it is no longer needed.
     */
    public void releaseVisualIndicator(SurfaceControl.Transaction t) {
        mIsReleased = true;
        if (mViewHost == null) return;
        if (mViewHost != null) {
            mViewHost.release();