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

Commit d8fb01d8 authored by Eric Lin's avatar Eric Lin
Browse files

Remove premature bubble collapse from NotificationClicker.

NotificationClicker previously collapsed an expanded bubble
unconditionally when a notification was clicked, unless the bubble
conversation icon on the notification was clicked. This behavior was
problematic, especially with the introduction of app bubbles, because
NotificationClicker lacks the context to determine if the click would
reuse an existing, expanded bubble's task.

This change removes the explicit bubble collapse call from
NotificationClicker. In subsequent changes, BubblesTransitionObserver
will handle the decision to collapse or retain an expanded bubble when
an activity transition occurs. This ensures proper behavior for both
chat and app bubbles.

Bug: 390047887
Bug: 407935283
Flag: EXEMPT bug fix
Test: Manual launch BubbleChat app with bubble
Change-Id: I730be20fc9905a8fb9d6b254413267daa098e09b
parent 36567a83
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -3338,13 +3338,6 @@ public class BubbleController implements ConfigurationChangeListener,
            return mCachedState.getBubbleWithShortcutId(shortcutId);
        }

        @Override
        public void collapseStack() {
            mMainExecutor.execute(() -> {
                BubbleController.this.collapseStack();
            });
        }

        @Override
        public void expandStackAndSelectBubble(BubbleEntry entry) {
            mMainExecutor.execute(() -> {
+0 −3
Original line number Diff line number Diff line
@@ -107,9 +107,6 @@ public interface Bubbles {
     */
    boolean isBubbleExpanded(String key);

    /** Tell the stack of bubbles to collapse. */
    void collapseStack();

    /**
     * Request the stack expand if needed, then select the specified Bubble as current.
     * If no bubble exists for this entry, one is created.
+2 −17
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.statusbar.notification;

import android.app.Notification;
@@ -27,9 +28,6 @@ import com.android.systemui.statusbar.notification.collection.EntryAdapter;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.shared.NotificationBundleUi;
import com.android.wm.shell.bubbles.Bubbles;

import java.util.Optional;

import javax.inject.Inject;

@@ -42,7 +40,6 @@ public final class NotificationClicker implements View.OnClickListener {

    private final NotificationClickerLogger mLogger;
    private final PowerInteractor mPowerInteractor;
    private final Optional<Bubbles> mBubblesOptional;
    private final NotificationActivityStarter mNotificationActivityStarter;

    private ExpandableNotificationRow.OnDragSuccessListener mOnDragSuccessListener
@@ -63,11 +60,9 @@ public final class NotificationClicker implements View.OnClickListener {
    private NotificationClicker(
            NotificationClickerLogger logger,
            PowerInteractor powerInteractor,
            Optional<Bubbles> bubblesOptional,
            NotificationActivityStarter notificationActivityStarter) {
        mLogger = logger;
        mPowerInteractor = powerInteractor;
        mBubblesOptional = bubblesOptional;
        mNotificationActivityStarter = notificationActivityStarter;
    }

@@ -108,14 +103,8 @@ public final class NotificationClicker implements View.OnClickListener {
        DejankUtils.postAfterTraversal(() -> row.setJustClicked(false));

        if (NotificationBundleUi.isEnabled()) {
            if (!row.getEntryAdapter().isBubble() && mBubblesOptional.isPresent()) {
                mBubblesOptional.get().collapseStack();
            }
            row.getEntryAdapter().onEntryClicked(row);
        } else {
            if (!row.getEntryLegacy().isBubble() && mBubblesOptional.isPresent()) {
                mBubblesOptional.get().collapseStack();
            }
            mNotificationActivityStarter.onNotificationClicked(row.getEntryLegacy(), row);
        }
    }
@@ -163,14 +152,10 @@ public final class NotificationClicker implements View.OnClickListener {
        }

        /** Builds an instance. */
        public NotificationClicker build(
                Optional<Bubbles> bubblesOptional,
                NotificationActivityStarter notificationActivityStarter
        ) {
        public NotificationClicker build(NotificationActivityStarter notificationActivityStarter) {
            return new NotificationClicker(
                    mLogger,
                    mPowerInteractor,
                    bubblesOptional,
                    notificationActivityStarter);
        }
    }
+1 −3
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ import com.android.systemui.statusbar.notification.logging.NotificationLogger
import com.android.systemui.statusbar.notification.row.NotifBindPipelineInitializer
import com.android.systemui.statusbar.notification.shared.NotificationsLiveDataStoreRefactor
import com.android.systemui.statusbar.notification.stack.NotificationListContainer
import com.android.wm.shell.bubbles.Bubbles
import dagger.Lazy
import java.util.Optional
import javax.inject.Inject
@@ -69,7 +68,6 @@ constructor(
    private val clickerBuilder: NotificationClicker.Builder,
    private val animatedImageNotificationManager: AnimatedImageNotificationManager,
    private val peopleSpaceWidgetManager: PeopleSpaceWidgetManager,
    private val bubblesOptional: Optional<Bubbles>,
) : NotificationsController {

    override fun initialize(
@@ -90,7 +88,7 @@ constructor(
            )

        notificationRowBinder.setNotificationClicker(
            clickerBuilder.build(bubblesOptional, notificationActivityStarter)
            clickerBuilder.build(notificationActivityStarter)
        )
        notificationRowBinder.setUpWithPresenter(presenter, listContainer)
        notifBindPipelineInitializer.initialize()