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

Commit 35264cb7 authored by Winson Chung's avatar Winson Chung
Browse files

Fix issue with callback not being made on the sysui main thread

Bug: 182705044
Test: atest SystemUITests
Change-Id: I83457f75a35e22f6e06c94e18b807ab88f59dd09
parent a416ee18
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -701,14 +701,11 @@ public class BubbleController {
        return (isSummary && isSuppressedSummary) || isSuppressedBubble;
    }

    private void removeSuppressedSummaryIfNecessary(String groupKey, Consumer<String> callback,
            Executor callbackExecutor) {
    private void removeSuppressedSummaryIfNecessary(String groupKey, Consumer<String> callback) {
        if (mBubbleData.isSummarySuppressed(groupKey)) {
            mBubbleData.removeSuppressedSummary(groupKey);
            if (callback != null) {
                callbackExecutor.execute(() -> {
                callback.accept(mBubbleData.getSummaryKey(groupKey));
                });
            }
        }
    }
@@ -1252,8 +1249,10 @@ public class BubbleController {
        public void removeSuppressedSummaryIfNecessary(String groupKey, Consumer<String> callback,
                Executor callbackExecutor) {
            mMainExecutor.execute(() -> {
                BubbleController.this.removeSuppressedSummaryIfNecessary(groupKey, callback,
                        callbackExecutor);
                Consumer<String> cb = callback != null
                        ? (key) -> callbackExecutor.execute(() -> callback.accept(key))
                        : null;
                BubbleController.this.removeSuppressedSummaryIfNecessary(groupKey, cb);
            });
        }

@@ -1294,10 +1293,13 @@ public class BubbleController {

        @Override
        public boolean handleDismissalInterception(BubbleEntry entry,
                @Nullable List<BubbleEntry> children, IntConsumer removeCallback) {
                @Nullable List<BubbleEntry> children, IntConsumer removeCallback,
                Executor callbackExecutor) {
            IntConsumer cb = removeCallback != null
                    ? (index) -> callbackExecutor.execute(() -> removeCallback.accept(index))
                    : null;
            return mMainExecutor.executeBlockingForResult(() -> {
                return BubbleController.this.handleDismissalInterception(entry, children,
                        removeCallback);
                return BubbleController.this.handleDismissalInterception(entry, children, cb);
            }, Boolean.class);
        }

+1 −1
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ public interface Bubbles {
     * @return true if we want to intercept the dismissal of the entry, else false.
     */
    boolean handleDismissalInterception(BubbleEntry entry, @Nullable List<BubbleEntry> children,
            IntConsumer removeCallback);
            IntConsumer removeCallback, Executor callbackExecutor);

    /** Set the proxy to commnuicate with SysUi side components. */
    void setSysuiProxy(SysuiProxy proxy);
+1 −1
Original line number Diff line number Diff line
@@ -630,7 +630,7 @@ public class BubblesManager implements Dumpable {
                    } else {
                        mNotificationGroupManager.onEntryRemoved(entry);
                    }
                });
                }, mSysuiMainExecutor);
    }

    /**