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

Commit d0ab0bbf authored by Lyn Han's avatar Lyn Han Committed by Android (Google) Code Review
Browse files

Merge "Auto-expand bubble for priority notif" into rvc-dev

parents 5d544ddf b5397972
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -1020,6 +1020,26 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
        }
    }

    /**
     * When a notification is marked Priority, expand the stack if needed,
     * then (maybe create and) select the given bubble.
     *
     * @param entry the notification for the bubble to show
     */
    public void onUserChangedImportance(NotificationEntry entry) {
        try {
            int flags = Notification.BubbleMetadata.FLAG_SUPPRESS_NOTIFICATION;
            flags |= Notification.BubbleMetadata.FLAG_AUTO_EXPAND_BUBBLE;
            mBarService.onNotificationBubbleChanged(entry.getKey(), true, flags);
        } catch (RemoteException e) {
            Log.e(TAG, e.getMessage());
        }
        mShadeController.collapsePanel(true);
        if (entry.getRow() != null) {
            entry.getRow().updateBubbleButton();
        }
    }

    /**
     * Directs a back gesture at the bubble stack. When opened, the current expanded bubble
     * is forwarded a back key down/up pair.
+5 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.view.accessibility.AccessibilityManager;

import com.android.internal.logging.MetricsLogger;
import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dagger.qualifiers.UiBackground;
@@ -114,7 +115,8 @@ public interface NotificationsModule {
            ShortcutManager shortcutManager,
            ChannelEditorDialogController channelEditorDialogController,
            CurrentUserContextTracker contextTracker,
            Provider<PriorityOnboardingDialogController.Builder> builderProvider) {
            Provider<PriorityOnboardingDialogController.Builder> builderProvider,
            BubbleController bubbleController) {
        return new NotificationGutsManager(
                context,
                visualStabilityManager,
@@ -128,7 +130,8 @@ public interface NotificationsModule {
                shortcutManager,
                channelEditorDialogController,
                contextTracker,
                builderProvider);
                builderProvider,
                bubbleController);
    }

    /** Provides an instance of {@link VisualStabilityManager} */
+8 −2
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.settingslib.notification.ConversationIconFactory;
import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.statusbar.notification.NotificationChannelHelper;
@@ -91,7 +92,7 @@ public class NotificationConversationInfo extends LinearLayout implements
    private VisualStabilityManager mVisualStabilityManager;
    private Handler mMainHandler;
    private Handler mBgHandler;

    private BubbleController mBubbleController;
    private String mPackageName;
    private String mAppName;
    private int mAppUid;
@@ -219,7 +220,8 @@ public class NotificationConversationInfo extends LinearLayout implements
            boolean isDeviceProvisioned,
            @Main Handler mainHandler,
            @Background Handler bgHandler,
            OnConversationSettingsClickListener onConversationSettingsClickListener) {
            OnConversationSettingsClickListener onConversationSettingsClickListener,
            BubbleController bubbleController) {
        mSelectedAction = -1;
        mINotificationManager = iNotificationManager;
        mVisualStabilityManager = visualStabilityManager;
@@ -238,6 +240,7 @@ public class NotificationConversationInfo extends LinearLayout implements
        mIconFactory = conversationIconFactory;
        mUserContext = userContext;
        mBubbleMetadata = bubbleMetadata;
        mBubbleController = bubbleController;
        mBuilderProvider = builderProvider;
        mMainHandler = mainHandler;
        mBgHandler = bgHandler;
@@ -627,6 +630,9 @@ public class NotificationConversationInfo extends LinearLayout implements
                                mINotificationManager.setBubblesAllowed(mAppPkg, mAppUid,
                                        BUBBLE_PREFERENCE_SELECTED);
                            }
                            post(() -> {
                                mBubbleController.onUserChangedImportance(mEntry);
                            });
                        }
                        mChannelToUpdate.setImportance(Math.max(
                                mChannelToUpdate.getOriginalImportance(), IMPORTANCE_DEFAULT));
+7 −2
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import com.android.settingslib.notification.ConversationIconFactory;
import com.android.systemui.Dependency;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
@@ -113,6 +114,7 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
    private final Lazy<StatusBar> mStatusBarLazy;
    private final Handler mMainHandler;
    private final Handler mBgHandler;
    private final BubbleController mBubbleController;
    private Runnable mOpenRunnable;
    private final INotificationManager mNotificationManager;
    private final LauncherApps mLauncherApps;
@@ -132,7 +134,8 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
            ShortcutManager shortcutManager,
            ChannelEditorDialogController channelEditorDialogController,
            CurrentUserContextTracker contextTracker,
            Provider<PriorityOnboardingDialogController.Builder> builderProvider) {
            Provider<PriorityOnboardingDialogController.Builder> builderProvider,
            BubbleController bubbleController) {
        mContext = context;
        mVisualStabilityManager = visualStabilityManager;
        mStatusBarLazy = statusBarLazy;
@@ -146,6 +149,7 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
        mContextTracker = contextTracker;
        mBuilderProvider = builderProvider;
        mChannelEditorDialogController = channelEditorDialogController;
        mBubbleController = bubbleController;
    }

    public void setUpWithPresenter(NotificationPresenter presenter,
@@ -480,7 +484,8 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
                mDeviceProvisionedController.isDeviceProvisioned(),
                mMainHandler,
                mBgHandler,
                onConversationSettingsListener);
                onConversationSettingsListener,
                mBubbleController);
    }

    /**
+26 −26
Original line number Diff line number Diff line
@@ -256,7 +256,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);
        final ImageView view = mNotificationInfo.findViewById(R.id.conversation_icon);
        assertEquals(mIconDrawable, view.getDrawable());
    }
@@ -280,7 +280,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);
        final TextView textView = mNotificationInfo.findViewById(R.id.pkg_name);
        assertTrue(textView.getText().toString().contains("App Name"));
        assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility());
@@ -331,7 +331,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);
        final TextView textView = mNotificationInfo.findViewById(R.id.group_name);
        assertTrue(textView.getText().toString().contains(group.getName()));
        assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility());
@@ -356,7 +356,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);
        final TextView textView = mNotificationInfo.findViewById(R.id.group_name);
        assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility());
        assertEquals(GONE, textView.getVisibility());
@@ -380,7 +380,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);
        final TextView nameView = mNotificationInfo.findViewById(R.id.delegate_name);
        assertEquals(GONE, nameView.getVisibility());
    }
@@ -415,7 +415,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);
        final TextView nameView = mNotificationInfo.findViewById(R.id.delegate_name);
        assertEquals(VISIBLE, nameView.getVisibility());
        assertTrue(nameView.getText().toString().contains("Proxied"));
@@ -443,7 +443,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);

        final View settingsButton = mNotificationInfo.findViewById(R.id.info);
        settingsButton.performClick();
@@ -469,7 +469,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);
        final View settingsButton = mNotificationInfo.findViewById(R.id.info);
        assertTrue(settingsButton.getVisibility() != View.VISIBLE);
    }
@@ -496,7 +496,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                false,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);
        final View settingsButton = mNotificationInfo.findViewById(R.id.info);
        assertTrue(settingsButton.getVisibility() != View.VISIBLE);
    }
@@ -521,7 +521,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);
        View view = mNotificationInfo.findViewById(R.id.silence);
        assertThat(view.isSelected()).isTrue();
    }
@@ -549,7 +549,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);
        View view = mNotificationInfo.findViewById(R.id.default_behavior);
        assertThat(view.isSelected()).isTrue();
        assertThat(((TextView) view.findViewById(R.id.default_summary)).getText()).isEqualTo(
@@ -580,7 +580,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);
        View view = mNotificationInfo.findViewById(R.id.default_behavior);
        assertThat(view.isSelected()).isTrue();
        assertThat(((TextView) view.findViewById(R.id.default_summary)).getText()).isEqualTo(
@@ -610,7 +610,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);

        View fave = mNotificationInfo.findViewById(R.id.priority);
        fave.performClick();
@@ -654,7 +654,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);

        mNotificationInfo.findViewById(R.id.default_behavior).performClick();
        mTestableLooper.processAllMessages();
@@ -697,7 +697,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);

        View silence = mNotificationInfo.findViewById(R.id.silence);

@@ -741,7 +741,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);

        View fave = mNotificationInfo.findViewById(R.id.priority);
        fave.performClick();
@@ -778,7 +778,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);

        View fave = mNotificationInfo.findViewById(R.id.priority);
        fave.performClick();
@@ -814,7 +814,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);

        View fave = mNotificationInfo.findViewById(R.id.priority);
        fave.performClick();
@@ -852,7 +852,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);

        mNotificationInfo.findViewById(R.id.default_behavior).performClick();
        mNotificationInfo.findViewById(R.id.done).performClick();
@@ -888,7 +888,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);

        mNotificationInfo.findViewById(R.id.default_behavior).performClick();
        mNotificationInfo.findViewById(R.id.done).performClick();
@@ -924,7 +924,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);

        mNotificationInfo.findViewById(R.id.default_behavior).performClick();
        mNotificationInfo.findViewById(R.id.done).performClick();
@@ -959,7 +959,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);

        View silence = mNotificationInfo.findViewById(R.id.silence);
        silence.performClick();
@@ -993,7 +993,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);

        verify(mMockINotificationManager, times(1)).createConversationNotificationChannelForPackage(
                anyString(), anyInt(), anyString(), any(), eq(CONVERSATION_ID));
@@ -1018,7 +1018,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                mBuilderProvider,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);

        verify(mMockINotificationManager, never()).createConversationNotificationChannelForPackage(
                anyString(), anyInt(), anyString(), any(), eq(CONVERSATION_ID));
@@ -1053,7 +1053,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                () -> b,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);

        // WHEN user clicks "priority"
        mNotificationInfo.setSelectedAction(NotificationConversationInfo.ACTION_FAVORITE);
@@ -1093,7 +1093,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
                () -> b,
                true,
                mTestHandler,
                mTestHandler, null);
                mTestHandler, null, mBubbleController);

        // WHEN user clicks "priority"
        mNotificationInfo.setSelectedAction(NotificationConversationInfo.ACTION_FAVORITE);
Loading