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

Commit 86211fe9 authored by Ajinkya Chalke's avatar Ajinkya Chalke Committed by Android (Google) Code Review
Browse files

Merge "Move app bubble taskId check to CachedState."

parents 7558efa6 6b2e3a71
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -1058,6 +1058,11 @@ public class BubbleController implements ConfigurationChangeListener {
        }
    }

    /** Sets the app bubble's taskId which is cached for SysUI. */
    public void setAppBubbleTaskId(int taskId) {
        mImpl.mCachedState.setAppBubbleTaskId(taskId);
    }

    /**
     * Fills the overflow bubbles by loading them from disk.
     */
@@ -1636,6 +1641,7 @@ public class BubbleController implements ConfigurationChangeListener {
            private HashSet<String> mSuppressedBubbleKeys = new HashSet<>();
            private HashMap<String, String> mSuppressedGroupToNotifKeys = new HashMap<>();
            private HashMap<String, Bubble> mShortcutIdToBubble = new HashMap<>();
            private int mAppBubbleTaskId = INVALID_TASK_ID;

            private ArrayList<Bubble> mTmpBubbles = new ArrayList<>();

@@ -1667,12 +1673,22 @@ public class BubbleController implements ConfigurationChangeListener {

                mSuppressedBubbleKeys.clear();
                mShortcutIdToBubble.clear();
                mAppBubbleTaskId = INVALID_TASK_ID;
                for (Bubble b : mTmpBubbles) {
                    mShortcutIdToBubble.put(b.getShortcutId(), b);
                    updateBubbleSuppressedState(b);

                    if (KEY_APP_BUBBLE.equals(b.getKey())) {
                        mAppBubbleTaskId = b.getTaskId();
                    }
                }
            }

            /** Sets the app bubble's taskId which is cached for SysUI. */
            synchronized void setAppBubbleTaskId(int taskId) {
                mAppBubbleTaskId = taskId;
            }

            /**
             * Updates a specific bubble suppressed state.  This is used mainly because notification
             * suppression changes don't go through the same BubbleData update mechanism.
@@ -1722,6 +1738,8 @@ public class BubbleController implements ConfigurationChangeListener {
                for (String key : mSuppressedGroupToNotifKeys.keySet()) {
                    pw.println("   suppressing: " + key);
                }

                pw.print("mAppBubbleTaskId: " + mAppBubbleTaskId);
            }
        }

@@ -1773,8 +1791,7 @@ public class BubbleController implements ConfigurationChangeListener {

        @Override
        public boolean isAppBubbleTaskId(int taskId) {
            Bubble appBubble = mBubbleData.getBubbleInStackWithKey(KEY_APP_BUBBLE);
            return appBubble != null && appBubble.getTaskId() == taskId;
            return mCachedState.mAppBubbleTaskId == taskId;
        }

        @Override
+5 −0
Original line number Diff line number Diff line
@@ -278,6 +278,11 @@ public class BubbleExpandedView extends LinearLayout {
            // The taskId is saved to use for removeTask, preventing appearance in recent tasks.
            mTaskId = taskId;

            if (Bubble.KEY_APP_BUBBLE.equals(getBubbleKey())) {
                // Let the controller know sooner what the taskId is.
                mController.setAppBubbleTaskId(mTaskId);
            }

            // With the task org, the taskAppeared callback will only happen once the task has
            // already drawn
            setContentVisibility(true);