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

Commit 0d0354c2 authored by Lyn Han's avatar Lyn Han
Browse files

Check if inflation task is cancelled post execute

Fixes: 159994627
Test: treehugger
Change-Id: I8fe254db178eb3fc6def26cb4e32c2f3ce7a8e72
parent 021baba4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -697,6 +697,9 @@ class Bubble implements BubbleViewProvider {
        pw.print("  desiredHeight: "); pw.println(getDesiredHeightString());
        pw.print("  suppressNotif: "); pw.println(shouldSuppressNotification());
        pw.print("  autoExpand:    "); pw.println(shouldAutoExpand());
        if (mExpandedView != null) {
            mExpandedView.dump(fd, pw, args);
        }
    }

    @Override
+20 −2
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import static com.android.systemui.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_EXPAND
import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;

import android.annotation.NonNull;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.app.ActivityOptions;
@@ -77,6 +78,9 @@ import com.android.systemui.R;
import com.android.systemui.recents.TriangleShape;
import com.android.systemui.statusbar.AlphaOptimizedButton;

import java.io.FileDescriptor;
import java.io.PrintWriter;

/**
 * Container for the expanded bubble view, handles rendering the caret and settings icon.
 */
@@ -602,14 +606,17 @@ public class BubbleExpandedView extends LinearLayout {
     */
    void update(Bubble bubble) {
        if (DEBUG_BUBBLE_EXPANDED_VIEW) {
            Log.d(TAG, "update: bubble=" + (bubble != null ? bubble.getKey() : "null"));
            Log.d(TAG, "update: bubble=" + bubble);
        }
        if (mStackView == null) {
            Log.w(TAG, "Stack is null for bubble: " + bubble);
            return;
        }
        boolean isNew = mBubble == null || didBackingContentChange(bubble);
        if (isNew || bubble != null && bubble.getKey().equals(mBubble.getKey())) {
            mBubble = bubble;
            mSettingsIcon.setContentDescription(getResources().getString(
                    R.string.bubbles_settings_button_description, bubble.getAppName()));

            mSettingsIcon.setAccessibilityDelegate(
                    new AccessibilityDelegate() {
                        @Override
@@ -817,4 +824,15 @@ public class BubbleExpandedView extends LinearLayout {
        }
        return null;
    }

    /**
     * Description of current expanded view state.
     */
    public void dump(
            @NonNull FileDescriptor fd, @NonNull PrintWriter pw, @NonNull String[] args) {
        pw.print("BubbleExpandedView");
        pw.print("  taskId:               "); pw.println(mTaskId);
        pw.print("  activityViewStatus:   "); pw.println(mActivityViewStatus);
        pw.print("  stackView:            "); pw.println(mStackView);
    }
}
+6 −5
Original line number Diff line number Diff line
@@ -103,13 +103,14 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask

    @Override
    protected void onPostExecute(BubbleViewInfo viewInfo) {
        if (viewInfo != null) {
        if (isCancelled() || viewInfo == null) {
            return;
        }
        mBubble.setViewInfo(viewInfo);
            if (mCallback != null && !isCancelled()) {
        if (mCallback != null) {
            mCallback.onBubbleViewsReady(mBubble);
        }
    }
    }

    /**
     * Info necessary to render a bubble.