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

Commit 3df41c00 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Move NotificationEntry.channel to a getter"

parents e3913dd9 296aec16
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -90,7 +90,6 @@ public final class NotificationEntry {
    public StatusBarNotification notification;
    private Ranking mRanking;

    public NotificationChannel channel;
    public long lastAudiblyAlertedMs;
    public boolean noisy;
    public boolean ambient;
@@ -244,7 +243,6 @@ public final class NotificationEntry {
    public void setRanking(@NonNull Ranking ranking) {
        mRanking = ranking;

        channel = ranking.getChannel();
        lastAudiblyAlertedMs = ranking.getLastAudiblyAlertedMillis();
        importance = ranking.getImportance();
        ambient = ranking.isAmbient();
@@ -260,6 +258,10 @@ public final class NotificationEntry {
        canBubble = ranking.canBubble();
    }

    public NotificationChannel getChannel() {
        return mRanking.getChannel();
    }

    public void setInterruption() {
        interruption = true;
    }
+7 −7
Original line number Diff line number Diff line
@@ -520,7 +520,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    public boolean getIsNonblockable() {
        boolean isNonblockable = Dependency.get(NotificationBlockingHelperManager.class)
                .isNonblockable(mStatusBarNotification.getPackageName(),
                        mEntry.channel.getId());
                        mEntry.getChannel().getId());

        // If the SystemNotifAsyncTask hasn't finished running or retrieved a value, we'll try once
        // again, but in-place on the main thread this time. This should rarely ever get called.
@@ -532,13 +532,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            mEntry.mIsSystemNotification = isSystemNotification(mContext, mStatusBarNotification);
        }

        isNonblockable |= mEntry.channel.isImportanceLockedByOEM();
        isNonblockable |= mEntry.channel.isImportanceLockedByCriticalDeviceFunction();
        isNonblockable |= mEntry.getChannel().isImportanceLockedByOEM();
        isNonblockable |= mEntry.getChannel().isImportanceLockedByCriticalDeviceFunction();

        if (!isNonblockable && mEntry != null && mEntry.mIsSystemNotification != null) {
            if (mEntry.mIsSystemNotification) {
                if (mEntry.channel != null
                        && !mEntry.channel.isBlockableSystem()) {
                if (mEntry.getChannel() != null
                        && !mEntry.getChannel().isBlockableSystem()) {
                    isNonblockable = true;
                }
            }
@@ -2389,7 +2389,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    public ArraySet<NotificationChannel> getUniqueChannels() {
        ArraySet<NotificationChannel> channels = new ArraySet<>();

        channels.add(mEntry.channel);
        channels.add(mEntry.getChannel());

        // If this is a summary, then add in the children notification channels for the
        // same user and pkg.
@@ -2398,7 +2398,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            final int numChildren = childrenRows.size();
            for (int i = 0; i < numChildren; i++) {
                final ExpandableNotificationRow childRow = childrenRows.get(i);
                final NotificationChannel childChannel = childRow.getEntry().channel;
                final NotificationChannel childChannel = childRow.getEntry().getChannel();
                final StatusBarNotification childSbn = childRow.getStatusBarNotification();
                if (childSbn.getUser().equals(mStatusBarNotification.getUser()) &&
                        childSbn.getPackageName().equals(mStatusBarNotification.getPackageName())) {
+1 −1
Original line number Diff line number Diff line
@@ -316,7 +316,7 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
                iNotificationManager,
                mVisualStabilityManager,
                packageName,
                row.getEntry().channel,
                row.getEntry().getChannel(),
                row.getUniqueChannels(),
                sbn,
                mCheckSaveListener,
+3 −2
Original line number Diff line number Diff line
@@ -71,8 +71,8 @@ import com.android.systemui.statusbar.notification.collection.NotificationData;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.phone.DozeParameters;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.StatusBarWindowController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.HeadsUpManager;
@@ -165,7 +165,8 @@ public class BubbleControllerTest extends SysuiTestCase {
        // Return non-null notification data from the NEM
        when(mNotificationEntryManager.getNotificationData()).thenReturn(mNotificationData);
        when(mNotificationData.get(mRow.getEntry().key)).thenReturn(mRow.getEntry());
        when(mNotificationData.getChannel(mRow.getEntry().key)).thenReturn(mRow.getEntry().channel);
        when(mNotificationData.getChannel(mRow.getEntry().key)).thenReturn(
                mRow.getEntry().getChannel());

        mZenModeConfig.suppressedVisualEffects = 0;
        when(mZenModeController.getConfig()).thenReturn(mZenModeConfig);
+13 −4
Original line number Diff line number Diff line
@@ -306,12 +306,21 @@ public class NotificationTestHelper {
                userHandle,
                null /* overrideGroupKey */,
                System.currentTimeMillis());
        NotificationEntry entry = NotificationEntry.buildForTest(sbn);
        final NotificationChannel channel =
                new NotificationChannel(
                        notification.getChannelId(),
                        notification.getChannelId(),
                        importance);
        channel.setBlockableSystem(true);

        NotificationEntry entry = new NotificationEntry(
                sbn,
                new RankingBuilder()
                        .setKey(sbn.getKey())
                        .setChannel(channel)
                        .build());
        entry.setRow(row);
        entry.createIcons(mContext, sbn);
        entry.channel = new NotificationChannel(
                notification.getChannelId(), notification.getChannelId(), importance);
        entry.channel.setBlockableSystem(true);
        row.setEntry(entry);
        row.getNotificationInflater().addInflationFlags(extraInflationFlags);
        NotificationContentInflaterTest.runThenWaitForInflation(
Loading