Merge "Fix missing notifs after swipe" into tm-qpr-dev

This commit is contained in:
Lyn Han
2022-09-08 16:42:46 +00:00
committed by Android (Google) Code Review
4 changed files with 16 additions and 4 deletions

View File

@@ -170,7 +170,8 @@ public class Bubble implements BubbleViewProvider {
@VisibleForTesting(visibility = PRIVATE)
public Bubble(@NonNull final String key, @NonNull final ShortcutInfo shortcutInfo,
final int desiredHeight, final int desiredHeightResId, @Nullable final String title,
int taskId, @Nullable final String locus, Executor mainExecutor) {
int taskId, @Nullable final String locus, Executor mainExecutor,
final Bubbles.BubbleMetadataFlagListener listener) {
Objects.requireNonNull(key);
Objects.requireNonNull(shortcutInfo);
mMetadataShortcutId = shortcutInfo.getId();
@@ -188,11 +189,12 @@ public class Bubble implements BubbleViewProvider {
mShowBubbleUpdateDot = false;
mMainExecutor = mainExecutor;
mTaskId = taskId;
mBubbleMetadataFlagListener = listener;
}
@VisibleForTesting(visibility = PRIVATE)
public Bubble(@NonNull final BubbleEntry entry,
@Nullable final Bubbles.BubbleMetadataFlagListener listener,
final Bubbles.BubbleMetadataFlagListener listener,
final Bubbles.PendingIntentCanceledListener intentCancelListener,
Executor mainExecutor) {
mKey = entry.getKey();
@@ -830,6 +832,7 @@ public class Bubble implements BubbleViewProvider {
pw.print(" desiredHeight: "); pw.println(getDesiredHeightString());
pw.print(" suppressNotif: "); pw.println(shouldSuppressNotification());
pw.print(" autoExpand: "); pw.println(shouldAutoExpand());
pw.print(" bubbleMetadataFlagListener null: " + (mBubbleMetadataFlagListener == null));
if (mExpandedView != null) {
mExpandedView.dump(pw);
}

View File

@@ -309,6 +309,7 @@ public class BubbleController implements ConfigurationChangeListener {
protected void onInit() {
mBubbleData.setListener(mBubbleDataListener);
mBubbleData.setSuppressionChangedListener(this::onBubbleMetadataFlagChanged);
mDataRepository.setSuppressionChangedListener(this::onBubbleMetadataFlagChanged);
mBubbleData.setPendingIntentCancelledListener(bubble -> {
if (bubble.getBubbleIntent() == null) {

View File

@@ -158,7 +158,6 @@ public class BubbleData {
@Nullable
private Listener mListener;
@Nullable
private Bubbles.BubbleMetadataFlagListener mBubbleMetadataFlagListener;
private Bubbles.PendingIntentCanceledListener mCancelledListener;

View File

@@ -25,6 +25,7 @@ import android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_PINNED_BY_ANY_LA
import android.content.pm.UserInfo
import android.os.UserHandle
import android.util.Log
import com.android.wm.shell.bubbles.Bubbles.BubbleMetadataFlagListener
import com.android.wm.shell.bubbles.storage.BubbleEntity
import com.android.wm.shell.bubbles.storage.BubblePersistentRepository
import com.android.wm.shell.bubbles.storage.BubbleVolatileRepository
@@ -47,6 +48,13 @@ internal class BubbleDataRepository(
private val ioScope = CoroutineScope(Dispatchers.IO)
private var job: Job? = null
// For use in Bubble construction.
private lateinit var bubbleMetadataFlagListener: BubbleMetadataFlagListener
fun setSuppressionChangedListener(listener: BubbleMetadataFlagListener) {
bubbleMetadataFlagListener = listener
}
/**
* Adds the bubble in memory, then persists the snapshot after adding the bubble to disk
* asynchronously.
@@ -197,7 +205,8 @@ internal class BubbleDataRepository(
entity.title,
entity.taskId,
entity.locus,
mainExecutor
mainExecutor,
bubbleMetadataFlagListener
)
}
}