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

Commit 8057fed7 authored by Ioana Alexandru's avatar Ioana Alexandru Committed by Android (Google) Code Review
Browse files

Merge changes Id036fa48,I54402913 into main

* changes:
  Inline BaseHeadsUpManager addEntry
  Set up deviceless testing for BaseHeadsUpManagerTest
parents 802522a2 3e856627
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -46,12 +46,12 @@ import android.content.Intent;
import android.graphics.Region;
import android.os.UserHandle;
import android.service.notification.StatusBarNotification;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.test.filters.SmallTest;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import com.android.internal.logging.UiEventLogger;
import com.android.internal.logging.testing.UiEventLoggerFake;
@@ -75,8 +75,8 @@ import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;

@SmallTest
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
@RunWith(AndroidJUnit4.class)
public class BaseHeadsUpManagerTest extends SysuiTestCase {
    @Rule
    public MockitoRule rule = MockitoJUnit.rule();
+9 −14
Original line number Diff line number Diff line
@@ -158,7 +158,15 @@ public abstract class BaseHeadsUpManager implements HeadsUpManager {
    @Override
    public void showNotification(@NonNull NotificationEntry entry) {
        mLogger.logShowNotification(entry);
        addEntry(entry);

        // Add new entry and begin managing it
        HeadsUpEntry headsUpEntry = createHeadsUpEntry();
        headsUpEntry.setEntry(entry);
        mHeadsUpEntryMap.put(entry.getKey(), headsUpEntry);
        onEntryAdded(headsUpEntry);
        entry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        entry.setIsHeadsUpEntry(true);

        updateNotification(entry.getKey(), true /* shouldHeadsUpAgain */);
        entry.setInterruption();
    }
@@ -318,19 +326,6 @@ public abstract class BaseHeadsUpManager implements HeadsUpManager {
        return FLAG_CONTENT_VIEW_HEADS_UP;
    }

    /**
     * Add a new entry and begin managing it.
     * @param entry the entry to add
     */
    protected final void addEntry(@NonNull NotificationEntry entry) {
        HeadsUpEntry headsUpEntry = createHeadsUpEntry();
        headsUpEntry.setEntry(entry);
        mHeadsUpEntryMap.put(entry.getKey(), headsUpEntry);
        onEntryAdded(headsUpEntry);
        entry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        entry.setIsHeadsUpEntry(true);
    }

    /**
     * Manager-specific logic that should occur when an entry is added.
     * @param headsUpEntry entry added