Merge "Fix issue with callback not being made on the sysui main thread" into sc-dev
This commit is contained in:
@@ -739,14 +739,11 @@ public class BubbleController {
|
|||||||
return (isSummary && isSuppressedSummary) || isSuppressedBubble;
|
return (isSummary && isSuppressedSummary) || isSuppressedBubble;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeSuppressedSummaryIfNecessary(String groupKey, Consumer<String> callback,
|
private void removeSuppressedSummaryIfNecessary(String groupKey, Consumer<String> callback) {
|
||||||
Executor callbackExecutor) {
|
|
||||||
if (mBubbleData.isSummarySuppressed(groupKey)) {
|
if (mBubbleData.isSummarySuppressed(groupKey)) {
|
||||||
mBubbleData.removeSuppressedSummary(groupKey);
|
mBubbleData.removeSuppressedSummary(groupKey);
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callbackExecutor.execute(() -> {
|
callback.accept(mBubbleData.getSummaryKey(groupKey));
|
||||||
callback.accept(mBubbleData.getSummaryKey(groupKey));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1298,8 +1295,10 @@ public class BubbleController {
|
|||||||
public void removeSuppressedSummaryIfNecessary(String groupKey, Consumer<String> callback,
|
public void removeSuppressedSummaryIfNecessary(String groupKey, Consumer<String> callback,
|
||||||
Executor callbackExecutor) {
|
Executor callbackExecutor) {
|
||||||
mMainExecutor.execute(() -> {
|
mMainExecutor.execute(() -> {
|
||||||
BubbleController.this.removeSuppressedSummaryIfNecessary(groupKey, callback,
|
Consumer<String> cb = callback != null
|
||||||
callbackExecutor);
|
? (key) -> callbackExecutor.execute(() -> callback.accept(key))
|
||||||
|
: null;
|
||||||
|
BubbleController.this.removeSuppressedSummaryIfNecessary(groupKey, cb);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1340,10 +1339,13 @@ public class BubbleController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleDismissalInterception(BubbleEntry entry,
|
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 mMainExecutor.executeBlockingForResult(() -> {
|
||||||
return BubbleController.this.handleDismissalInterception(entry, children,
|
return BubbleController.this.handleDismissalInterception(entry, children, cb);
|
||||||
removeCallback);
|
|
||||||
}, Boolean.class);
|
}, Boolean.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public interface Bubbles {
|
|||||||
* @return true if we want to intercept the dismissal of the entry, else false.
|
* @return true if we want to intercept the dismissal of the entry, else false.
|
||||||
*/
|
*/
|
||||||
boolean handleDismissalInterception(BubbleEntry entry, @Nullable List<BubbleEntry> children,
|
boolean handleDismissalInterception(BubbleEntry entry, @Nullable List<BubbleEntry> children,
|
||||||
IntConsumer removeCallback);
|
IntConsumer removeCallback, Executor callbackExecutor);
|
||||||
|
|
||||||
/** Set the proxy to commnuicate with SysUi side components. */
|
/** Set the proxy to commnuicate with SysUi side components. */
|
||||||
void setSysuiProxy(SysuiProxy proxy);
|
void setSysuiProxy(SysuiProxy proxy);
|
||||||
|
|||||||
@@ -633,7 +633,7 @@ public class BubblesManager implements Dumpable {
|
|||||||
} else {
|
} else {
|
||||||
mNotificationGroupManager.onEntryRemoved(entry);
|
mNotificationGroupManager.onEntryRemoved(entry);
|
||||||
}
|
}
|
||||||
});
|
}, mSysuiMainExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user