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

Commit 30672941 authored by Mady Mellor's avatar Mady Mellor
Browse files

Don't require resizable check for experimental bubbles

Test: manual - 1) adb shell settings put secure allow_any_notif_to_bubble 1
               2) get an notification for an activity that isn't resizable
               3) longpress on the notif, note the bubble menu is there
               4) select bubble
               => the notification becomes a bubble
Bug: 143173197

Change-Id: Ie0b91971a969203000d9cfa19b50e44fd4c9c490
parent 5d8707ad
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -700,10 +700,11 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
        @Override
        public void onPendingEntryAdded(NotificationEntry entry) {
            boolean previouslyUserCreated = mUserCreatedBubbles.contains(entry.getKey());
            BubbleExperimentConfig.adjustForExperiments(mContext, entry, previouslyUserCreated);
            boolean wasAdjusted = BubbleExperimentConfig.adjustForExperiments(
                    mContext, entry, previouslyUserCreated);

            if (mNotificationInterruptionStateProvider.shouldBubbleUp(entry)
                    && canLaunchInActivityView(mContext, entry)) {
                    && (canLaunchInActivityView(mContext, entry) || wasAdjusted)) {
                updateBubble(entry);
            }
        }
@@ -711,10 +712,11 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
        @Override
        public void onPreEntryUpdated(NotificationEntry entry) {
            boolean previouslyUserCreated = mUserCreatedBubbles.contains(entry.getKey());
            BubbleExperimentConfig.adjustForExperiments(mContext, entry, previouslyUserCreated);
            boolean wasAdjusted = BubbleExperimentConfig.adjustForExperiments(
                    mContext, entry, previouslyUserCreated);

            boolean shouldBubble = mNotificationInterruptionStateProvider.shouldBubbleUp(entry)
                    && canLaunchInActivityView(mContext, entry);
                    && (canLaunchInActivityView(mContext, entry) || wasAdjusted);
            if (!shouldBubble && mBubbleData.hasBubbleWithKey(entry.getKey())) {
                // It was previously a bubble but no longer a bubble -- lets remove it
                removeBubble(entry.getKey(), DISMISS_NO_LONGER_BUBBLE);
@@ -1022,11 +1024,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
        PendingIntent intent = entry.getBubbleMetadata() != null
                ? entry.getBubbleMetadata().getIntent()
                : null;
        return canLaunchIntentInActivityView(context, entry, intent);
    }

    static boolean canLaunchIntentInActivityView(Context context, NotificationEntry entry,
            PendingIntent intent) {
        if (intent == null) {
            Log.w(TAG, "Unable to create bubble -- no intent: " + entry.getKey());
            return false;
+6 −3
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_DYNAMIC;
import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_MANIFEST;
import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_PINNED;

import static com.android.systemui.bubbles.BubbleController.canLaunchIntentInActivityView;
import static com.android.systemui.bubbles.BubbleDebugConfig.DEBUG_EXPERIMENTS;
import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;
@@ -107,8 +106,10 @@ public class BubbleExperimentConfig {
     * If {@link #allowAnyNotifToBubble(Context)} is true, this method creates and adds
     * {@link android.app.Notification.BubbleMetadata} to the notification entry as long as
     * the notification has necessary info for BubbleMetadata.
     *
     * @return whether an adjustment was made.
     */
    static void adjustForExperiments(Context context, NotificationEntry entry,
    static boolean adjustForExperiments(Context context, NotificationEntry entry,
            boolean previouslyUserCreated) {
        Notification.BubbleMetadata metadata = null;
        boolean addedMetadata = false;
@@ -176,7 +177,9 @@ public class BubbleExperimentConfig {
                Log.d(TAG, "Setting FLAG_BUBBLE for: " + entry.getKey());
            }
            entry.setFlagBubble(true);
            return true;
        }
        return addedMetadata;
    }

    static Notification.BubbleMetadata createFromNotif(Context context, NotificationEntry entry) {
@@ -193,7 +196,7 @@ public class BubbleExperimentConfig {
                    ? notification.getLargeIcon()
                    : notification.getSmallIcon();
        }
        if (canLaunchIntentInActivityView(context, entry, intent)) {
        if (intent != null) {
            return new Notification.BubbleMetadata.Builder()
                    .setDesiredHeight(BUBBLE_HEIGHT)
                    .setIcon(icon)