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

Commit 28704252 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Remove bubble when PendingIntent is canceled" into rvc-dev am: 89c4f82c

Change-Id: I560801c3e8409923bfa5e642d043134a9701c38f
parents 6ff2e063 89c4f82c
Loading
Loading
Loading
Loading
+15 −1
Original line number Original line Diff line number Diff line
@@ -54,6 +54,7 @@ import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.graphics.Rect;
import android.os.Handler;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.service.notification.NotificationListenerService;
import android.service.notification.NotificationListenerService;
@@ -174,6 +175,9 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
    private IStatusBarService mBarService;
    private IStatusBarService mBarService;
    private SysUiState mSysUiState;
    private SysUiState mSysUiState;


    // Used to post to main UI thread
    private Handler mHandler = new Handler();

    // Used for determining view rect for touch interaction
    // Used for determining view rect for touch interaction
    private Rect mTempRect = new Rect();
    private Rect mTempRect = new Rect();


@@ -799,7 +803,17 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
        Bubble bubble = mBubbleData.getOrCreateBubble(notif);
        Bubble bubble = mBubbleData.getOrCreateBubble(notif);
        bubble.setInflateSynchronously(mInflateSynchronously);
        bubble.setInflateSynchronously(mInflateSynchronously);
        bubble.inflate(
        bubble.inflate(
                b -> mBubbleData.notificationEntryUpdated(b, suppressFlyout, showInShade),
                b -> {
                    mBubbleData.notificationEntryUpdated(b, suppressFlyout, showInShade);
                    if (bubble.getBubbleIntent() == null) {
                        return;
                    }
                    bubble.getBubbleIntent().registerCancelListener(pendingIntent -> {
                        mHandler.post(
                                () -> removeBubble(bubble.getEntry(),
                                        BubbleController.DISMISS_INVALID_INTENT));
                    });
                },
                mContext, mStackView, mBubbleIconFactory);
                mContext, mStackView, mBubbleIconFactory);
    }
    }