Don't let everyone reach into NotificationData.Entry for its row
Test: atest SystemUITests
Change-Id: I0b4b66769afcf39c35800d293c22263e31790788
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java
index f49c5b4..9d0556f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/AlertingNotificationManagerTest.java
@@ -120,7 +120,7 @@
mTestHandler = Handler.createAsync(Looper.myLooper());
mSbn = createNewNotification(0 /* id */);
mEntry = new NotificationData.Entry(mSbn);
- mEntry.row = mRow;
+ mEntry.setRow(mRow);
mAlertingNotificationManager = createAlertingNotificationManager();
}
@@ -171,7 +171,7 @@
for (int i = 0; i < TEST_NUM_NOTIFICATIONS; i++) {
StatusBarNotification sbn = createNewNotification(i);
NotificationData.Entry entry = new NotificationData.Entry(sbn);
- entry.row = mRow;
+ entry.setRow(mRow);
mAlertingNotificationManager.showNotification(entry);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java
index d409e2b..b5d305d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java
@@ -78,7 +78,7 @@
mSbn = new StatusBarNotification(TEST_PACKAGE_NAME, TEST_PACKAGE_NAME, 0, null, TEST_UID,
0, new Notification(), UserHandle.CURRENT, null, 0);
mEntry = new NotificationData.Entry(mSbn);
- mEntry.row = mRow;
+ mEntry.setRow(mRow);
mRemoteInputManager.setUpWithPresenterForTest(mPresenter, mCallback,
mDelegate, mController);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java
index aca1f90..9bed59b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationTestHelper.java
@@ -227,7 +227,7 @@
null /* overrideGroupKey */,
System.currentTimeMillis());
NotificationData.Entry entry = new NotificationData.Entry(sbn);
- entry.row = row;
+ entry.setRow(row);
entry.createIcons(mContext, sbn);
entry.channel = new NotificationChannel(
notification.getChannelId(), notification.getChannelId(), IMPORTANCE_DEFAULT);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java
index 602e613..f64e84c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java
@@ -37,6 +37,7 @@
import com.android.systemui.SysuiTestCase;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
import com.android.systemui.statusbar.notification.NotificationData;
+import com.android.systemui.statusbar.notification.NotificationData.Entry;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.VisualStabilityManager;
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
@@ -95,7 +96,7 @@
private NotificationData.Entry createEntry() throws Exception {
ExpandableNotificationRow row = mHelper.createRow();
NotificationData.Entry entry = new NotificationData.Entry(row.getStatusBarNotification());
- entry.row = row;
+ entry.setRow(row);
return entry;
}
@@ -108,9 +109,9 @@
NotificationData.Entry entry2 = createEntry();
// Set up the prior state to look like three top level notifications.
- mListContainer.addContainerView(entry0.row);
- mListContainer.addContainerView(entry1.row);
- mListContainer.addContainerView(entry2.row);
+ mListContainer.addContainerView(entry0.getRow());
+ mListContainer.addContainerView(entry1.getRow());
+ mListContainer.addContainerView(entry2.getRow());
when(mNotificationData.getActiveNotifications()).thenReturn(
Lists.newArrayList(entry0, entry1, entry2));
@@ -118,15 +119,15 @@
when(mGroupManager.isChildInGroupWithSummary(entry0.notification)).thenReturn(false);
when(mGroupManager.isChildInGroupWithSummary(entry1.notification)).thenReturn(true);
when(mGroupManager.isChildInGroupWithSummary(entry2.notification)).thenReturn(true);
- when(mGroupManager.getGroupSummary(entry1.notification)).thenReturn(entry0.row);
- when(mGroupManager.getGroupSummary(entry2.notification)).thenReturn(entry0.row);
+ when(mGroupManager.getGroupSummary(entry1.notification)).thenReturn(entry0);
+ when(mGroupManager.getGroupSummary(entry2.notification)).thenReturn(entry0);
// Run updateNotifications - the view hierarchy should be reorganized.
mViewHierarchyManager.updateNotificationViews();
- verify(mListContainer).notifyGroupChildAdded(entry1.row);
- verify(mListContainer).notifyGroupChildAdded(entry2.row);
- assertTrue(Lists.newArrayList(entry0.row).equals(mListContainer.mRows));
+ verify(mListContainer).notifyGroupChildAdded(entry1.getRow());
+ verify(mListContainer).notifyGroupChildAdded(entry2.getRow());
+ assertTrue(Lists.newArrayList(entry0.getRow()).equals(mListContainer.mRows));
}
@Test
@@ -135,11 +136,11 @@
NotificationData.Entry entry0 = createEntry();
NotificationData.Entry entry1 = createEntry();
NotificationData.Entry entry2 = createEntry();
- entry0.row.addChildNotification(entry1.row);
- entry0.row.addChildNotification(entry2.row);
+ entry0.getRow().addChildNotification(entry1.getRow());
+ entry0.getRow().addChildNotification(entry2.getRow());
// Set up the prior state to look like one top level notification.
- mListContainer.addContainerView(entry0.row);
+ mListContainer.addContainerView(entry0.getRow());
when(mNotificationData.getActiveNotifications()).thenReturn(
Lists.newArrayList(entry0, entry1, entry2));
@@ -152,10 +153,12 @@
mViewHierarchyManager.updateNotificationViews();
verify(mListContainer).notifyGroupChildRemoved(
- entry1.row, entry0.row.getChildrenContainer());
+ entry1.getRow(), entry0.getRow().getChildrenContainer());
verify(mListContainer).notifyGroupChildRemoved(
- entry2.row, entry0.row.getChildrenContainer());
- assertTrue(Lists.newArrayList(entry0.row, entry1.row, entry2.row).equals(mListContainer.mRows));
+ entry2.getRow(), entry0.getRow().getChildrenContainer());
+ assertTrue(
+ Lists.newArrayList(entry0.getRow(), entry1.getRow(), entry2.getRow())
+ .equals(mListContainer.mRows));
}
@Test
@@ -163,10 +166,10 @@
// Tests two top level notifications becoming a suppressed summary and a child.
NotificationData.Entry entry0 = createEntry();
NotificationData.Entry entry1 = createEntry();
- entry0.row.addChildNotification(entry1.row);
+ entry0.getRow().addChildNotification(entry1.getRow());
// Set up the prior state to look like a top level notification.
- mListContainer.addContainerView(entry0.row);
+ mListContainer.addContainerView(entry0.getRow());
when(mNotificationData.getActiveNotifications()).thenReturn(
Lists.newArrayList(entry0, entry1));
@@ -179,23 +182,23 @@
mViewHierarchyManager.updateNotificationViews();
verify(mListContainer).notifyGroupChildRemoved(
- entry1.row, entry0.row.getChildrenContainer());
- assertTrue(Lists.newArrayList(entry0.row, entry1.row).equals(mListContainer.mRows));
- assertEquals(View.GONE, entry0.row.getVisibility());
- assertEquals(View.VISIBLE, entry1.row.getVisibility());
+ entry1.getRow(), entry0.getRow().getChildrenContainer());
+ assertTrue(Lists.newArrayList(entry0.getRow(), entry1.getRow()).equals(mListContainer.mRows));
+ assertEquals(View.GONE, entry0.getRow().getVisibility());
+ assertEquals(View.VISIBLE, entry1.getRow().getVisibility());
}
@Test
public void testUpdateNotificationViews_appOps() throws Exception {
NotificationData.Entry entry0 = createEntry();
- entry0.row = spy(entry0.row);
+ entry0.setRow(spy(entry0.getRow()));
when(mNotificationData.getActiveNotifications()).thenReturn(
Lists.newArrayList(entry0));
- mListContainer.addContainerView(entry0.row);
+ mListContainer.addContainerView(entry0.getRow());
mViewHierarchyManager.updateNotificationViews();
- verify(entry0.row, times(1)).showAppOpsIcons(any());
+ verify(entry0.getRow(), times(1)).showAppOpsIcons(any());
}
private class FakeListContainer implements NotificationListContainer {
@@ -252,7 +255,7 @@
public void setMaxDisplayedNotifications(int maxNotifications) {}
@Override
- public void snapViewIfNeeded(ExpandableNotificationRow row) {}
+ public void snapViewIfNeeded(Entry entry) {}
@Override
public ViewGroup getViewParentForNotification(NotificationData.Entry entry) {
@@ -271,10 +274,10 @@
}
@Override
- public void cleanUpViewState(View view) {}
+ public void cleanUpViewStateForEntry(Entry entry) { }
@Override
- public boolean isInVisibleLocation(ExpandableNotificationRow row) {
+ public boolean isInVisibleLocation(Entry entry) {
return true;
}
@@ -286,5 +289,6 @@
public boolean hasPulsingNotifications() {
return false;
}
+
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
index d1fe5af..8706e21 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
@@ -262,14 +262,14 @@
NotificationData.Entry.class);
verify(mCallback).onBindRow(entryCaptor.capture(), any(), eq(mSbn), any());
NotificationData.Entry entry = entryCaptor.getValue();
- verify(mRemoteInputManager).bindRow(entry.row);
+ verify(mRemoteInputManager).bindRow(entry.getRow());
// Row content inflation:
verify(mCallback).onNotificationAdded(entry);
verify(mPresenter).updateNotificationViews();
assertEquals(mEntryManager.getNotificationData().get(mSbn.getKey()), entry);
- assertNotNull(entry.row);
+ assertNotNull(entry.getRow());
assertEquals(mEntry.userSentiment,
NotificationListenerService.Ranking.USER_SENTIMENT_NEUTRAL);
}
@@ -294,7 +294,7 @@
verify(mPresenter).updateNotificationViews();
verify(mForegroundServiceController).updateNotification(eq(mSbn), anyInt());
verify(mCallback).onNotificationUpdated(mSbn);
- assertNotNull(mEntry.row);
+ assertNotNull(mEntry.getRow());
assertEquals(mEntry.userSentiment,
NotificationListenerService.Ranking.USER_SENTIMENT_NEGATIVE);
}
@@ -303,7 +303,7 @@
public void testRemoveNotification() throws Exception {
com.android.systemui.util.Assert.isNotMainThread();
- mEntry.row = mRow;
+ mEntry.setRow(mRow);
mEntryManager.getNotificationData().add(mEntry);
mEntryManager.removeNotification(mSbn.getKey(), mRankingMap);
@@ -313,7 +313,7 @@
verify(mMediaManager).onNotificationRemoved(mSbn.getKey());
verify(mForegroundServiceController).removeNotification(mSbn);
- verify(mListContainer).cleanUpViewState(mRow);
+ verify(mListContainer).cleanUpViewStateForEntry(mEntry);
verify(mPresenter).updateNotificationViews();
verify(mCallback).onNotificationRemoved(mSbn.getKey(), mSbn);
verify(mRow).setRemoved();
@@ -332,7 +332,7 @@
extenders.clear();
extenders.add(extender);
- mEntry.row = mRow;
+ mEntry.setRow(mRow);
mEntryManager.getNotificationData().add(mEntry);
mEntryManager.removeNotification(mSbn.getKey(), mRankingMap);
@@ -347,7 +347,7 @@
when(mForegroundServiceController.getStandardLayoutKey(anyInt(), anyString()))
.thenReturn(mEntry.key);
- mEntry.row = mRow;
+ mEntry.setRow(mRow);
mEntryManager.getNotificationData().add(mEntry);
mEntryManager.updateNotificationsForAppOp(
@@ -372,7 +372,7 @@
@Test
public void testAddNotificationExistingAppOps() {
- mEntry.row = mRow;
+ mEntry.setRow(mRow);
mEntryManager.getNotificationData().add(mEntry);
ArraySet<Integer> expected = new ArraySet<>();
expected.add(3);
@@ -395,7 +395,7 @@
@Test
public void testAdd_noExistingAppOps() {
- mEntry.row = mRow;
+ mEntry.setRow(mRow);
mEntryManager.getNotificationData().add(mEntry);
when(mForegroundServiceController.getStandardLayoutKey(
mEntry.notification.getUserId(),
@@ -409,7 +409,7 @@
@Test
public void testAdd_existingAppOpsNotForegroundNoti() {
- mEntry.row = mRow;
+ mEntry.setRow(mRow);
mEntryManager.getNotificationData().add(mEntry);
ArraySet<Integer> ops = new ArraySet<>();
ops.add(3);
@@ -431,7 +431,7 @@
when(mEnvironment.isDeviceProvisioned()).thenReturn(true);
when(mEnvironment.isNotificationForCurrentProfiles(any())).thenReturn(true);
- mEntry.row = mRow;
+ mEntry.setRow(mRow);
mEntry.setInflationTask(mAsyncInflationTask);
mEntryManager.getNotificationData().add(mEntry);
setSmartActions(mEntry.key, new ArrayList<>(Arrays.asList(createAction())));
@@ -447,7 +447,7 @@
when(mDeviceProvisionedController.isDeviceProvisioned()).thenReturn(true);
when(mEnvironment.isNotificationForCurrentProfiles(any())).thenReturn(true);
- mEntry.row = mRow;
+ mEntry.setRow(mRow);
mEntryManager.getNotificationData().add(mEntry);
setSmartActions(mEntry.key, null);
@@ -461,7 +461,7 @@
when(mDeviceProvisionedController.isDeviceProvisioned()).thenReturn(true);
when(mEnvironment.isNotificationForCurrentProfiles(any())).thenReturn(true);
- mEntry.row = null;
+ mEntry.setRow(null);
mEntryManager.getNotificationData().add(mEntry);
setSmartActions(mEntry.key, new ArrayList<>(Arrays.asList(createAction())));
@@ -476,7 +476,7 @@
when(mDeviceProvisionedController.isDeviceProvisioned()).thenReturn(true);
when(mEnvironment.isNotificationForCurrentProfiles(any())).thenReturn(true);
- mEntry.row = null;
+ mEntry.setRow(null);
mEntryManager.mPendingNotifications.put(mEntry.key, mEntry);
setSmartActions(mEntry.key, new ArrayList<>(Arrays.asList(createAction())));
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/VisualStabilityManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/VisualStabilityManagerTest.java
index ffb1c2d..f190979 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/VisualStabilityManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/VisualStabilityManagerTest.java
@@ -47,7 +47,7 @@
public void setUp() {
mVisualStabilityManager.setVisibilityLocationProvider(mLocationProvider);
mEntry = new NotificationData.Entry(mock(StatusBarNotification.class));
- mEntry.row = mRow;
+ mEntry.setRow(mRow);
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java
index 1c7a8e8..3710fa8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java
@@ -89,7 +89,7 @@
mSbn = new StatusBarNotification(TEST_PACKAGE_NAME, TEST_PACKAGE_NAME, 0, null, TEST_UID,
0, new Notification(), UserHandle.CURRENT, null, 0);
mEntry = new NotificationData.Entry(mSbn);
- mEntry.row = mRow;
+ mEntry.setRow(mRow);
mLogger = new TestableNotificationLogger(mBarService);
mLogger.setUpWithContainer(mListContainer);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
index 3d2ea70..2797969 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java
@@ -54,6 +54,7 @@
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
import android.util.ArraySet;
+import android.util.Log;
import android.view.View;
import com.android.systemui.SysuiTestCase;
@@ -177,10 +178,17 @@
NotificationMenuRowPlugin.MenuItem menuItem = createTestMenuItem(realRow);
ExpandableNotificationRow row = spy(realRow);
+
when(row.getWindowToken()).thenReturn(new Binder());
when(row.getGuts()).thenReturn(guts);
doNothing().when(row).inflateGuts();
+ NotificationData.Entry realEntry = realRow.getEntry();
+ NotificationData.Entry entry = spy(realEntry);
+
+ when(entry.getRow()).thenReturn(row);
+ when(entry.getGuts()).thenReturn(guts);
+
mGutsManager.openGuts(row, 0, 0, menuItem);
mTestableLooper.processAllMessages();
verify(guts).openControls(
@@ -190,13 +198,19 @@
anyBoolean(),
any(Runnable.class));
+ // called once by mGutsManager.bindGuts() in mGutsManager.openGuts()
+ verify(row).setGutsView(any());
+
row.onDensityOrFontScaleChanged();
- mGutsManager.onDensityOrFontScaleChanged(row);
+ mGutsManager.onDensityOrFontScaleChanged(entry);
+
mTestableLooper.processAllMessages();
mGutsManager.closeAndSaveGuts(false, false, false, 0, 0, false);
verify(guts).closeControls(anyBoolean(), anyBoolean(), anyInt(), anyInt(), anyBoolean());
+
+ // called again by mGutsManager.bindGuts(), in mGutsManager.onDensityOrFontScaleChanged()
verify(row, times(2)).setGutsView(any());
}
@@ -470,7 +484,7 @@
ExpandableNotificationRow row = spy(createTestNotificationRow());
doReturn(guts).when(row).getGuts();
NotificationData.Entry entry = row.getEntry();
- entry.row = row;
+ entry.setRow(row);
mGutsManager.setExposedGuts(guts);
assertTrue(mGutsManager.shouldExtendLifetime(entry));
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
index 74ce5f6..e65e806 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
@@ -325,7 +325,9 @@
// add notification
ExpandableNotificationRow row = mock(ExpandableNotificationRow.class);
- when(row.isClearable()).thenReturn(true);
+ NotificationData.Entry entry = mock(NotificationData.Entry.class);
+ when(row.getEntry()).thenReturn(entry);
+ when(entry.isClearable()).thenReturn(true);
mStackScroller.addContainerView(row);
mStackScroller.onUpdateRowStates();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java
index 10b0d83..c99e766 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceControllerTest.java
@@ -81,12 +81,12 @@
mFirst.setPinned(true);
when(mHeadsUpManager.hasPinnedHeadsUp()).thenReturn(true);
when(mHeadsUpManager.getTopEntry()).thenReturn(mFirst.getEntry());
- mHeadsUpAppearanceController.onHeadsUpPinned(mFirst);
+ mHeadsUpAppearanceController.onHeadsUpPinned(mFirst.getEntry());
Assert.assertEquals(mFirst.getEntry(), mHeadsUpStatusBarView.getShowingEntry());
mFirst.setPinned(false);
when(mHeadsUpManager.hasPinnedHeadsUp()).thenReturn(false);
- mHeadsUpAppearanceController.onHeadsUpUnPinned(mFirst);
+ mHeadsUpAppearanceController.onHeadsUpUnPinned(mFirst.getEntry());
Assert.assertEquals(null, mHeadsUpStatusBarView.getShowingEntry());
}
@@ -95,12 +95,12 @@
mFirst.setPinned(true);
when(mHeadsUpManager.hasPinnedHeadsUp()).thenReturn(true);
when(mHeadsUpManager.getTopEntry()).thenReturn(mFirst.getEntry());
- mHeadsUpAppearanceController.onHeadsUpPinned(mFirst);
+ mHeadsUpAppearanceController.onHeadsUpPinned(mFirst.getEntry());
Assert.assertTrue(mHeadsUpAppearanceController.isShown());
mFirst.setPinned(false);
when(mHeadsUpManager.hasPinnedHeadsUp()).thenReturn(false);
- mHeadsUpAppearanceController.onHeadsUpUnPinned(mFirst);
+ mHeadsUpAppearanceController.onHeadsUpUnPinned(mFirst.getEntry());
Assert.assertFalse(mHeadsUpAppearanceController.isShown());
}
@@ -109,12 +109,12 @@
mFirst.setPinned(true);
when(mHeadsUpManager.hasPinnedHeadsUp()).thenReturn(true);
when(mHeadsUpManager.getTopEntry()).thenReturn(mFirst.getEntry());
- mHeadsUpAppearanceController.onHeadsUpPinned(mFirst);
+ mHeadsUpAppearanceController.onHeadsUpPinned(mFirst.getEntry());
Assert.assertEquals(mFirst.getHeaderVisibleAmount(), 0.0f, 0.0f);
mFirst.setPinned(false);
when(mHeadsUpManager.hasPinnedHeadsUp()).thenReturn(false);
- mHeadsUpAppearanceController.onHeadsUpUnPinned(mFirst);
+ mHeadsUpAppearanceController.onHeadsUpUnPinned(mFirst.getEntry());
Assert.assertEquals(mFirst.getHeaderVisibleAmount(), 1.0f, 0.0f);
}
@@ -125,12 +125,12 @@
mFirst.setPinned(true);
when(mHeadsUpManager.hasPinnedHeadsUp()).thenReturn(true);
when(mHeadsUpManager.getTopEntry()).thenReturn(mFirst.getEntry());
- mHeadsUpAppearanceController.onHeadsUpPinned(mFirst);
+ mHeadsUpAppearanceController.onHeadsUpPinned(mFirst.getEntry());
Assert.assertEquals(View.INVISIBLE, mOperatorNameView.getVisibility());
mFirst.setPinned(false);
when(mHeadsUpManager.hasPinnedHeadsUp()).thenReturn(false);
- mHeadsUpAppearanceController.onHeadsUpUnPinned(mFirst);
+ mHeadsUpAppearanceController.onHeadsUpUnPinned(mFirst.getEntry());
Assert.assertEquals(View.VISIBLE, mOperatorNameView.getVisibility());
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
index 1070795..44deb10 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhoneTest.java
@@ -97,7 +97,7 @@
@Test
public void testCanRemoveImmediately_notTopEntry() {
NotificationData.Entry laterEntry = new NotificationData.Entry(createNewNotification(1));
- laterEntry.row = mRow;
+ laterEntry.setRow(mRow);
mHeadsUpManager.showNotification(mEntry);
mHeadsUpManager.showNotification(laterEntry);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java
index 96c57f2..c3bc511 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java
@@ -149,7 +149,8 @@
Entry summaryEntry = mGroupTestHelper.createSummaryNotification();
mHeadsUpManager.showNotification(summaryEntry);
Entry childEntry = mGroupTestHelper.createChildNotification();
- when(childEntry.row.isInflationFlagSet(mHeadsUpManager.getContentFlag())).thenReturn(false);
+ when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag()))
+ .thenReturn(false);
mGroupManager.onEntryAdded(summaryEntry);
mGroupManager.onEntryAdded(childEntry);
@@ -166,12 +167,14 @@
Entry summaryEntry = mGroupTestHelper.createSummaryNotification();
mHeadsUpManager.showNotification(summaryEntry);
Entry childEntry = mGroupTestHelper.createChildNotification();
- when(childEntry.row.isInflationFlagSet(mHeadsUpManager.getContentFlag())).thenReturn(false);
+ when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag()))
+ .thenReturn(false);
mGroupManager.onEntryAdded(summaryEntry);
mGroupManager.onEntryAdded(childEntry);
- when(childEntry.row.isInflationFlagSet(mHeadsUpManager.getContentFlag())).thenReturn(true);
+ when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag()))
+ .thenReturn(true);
mGroupAlertTransferHelper.onInflationFinished(childEntry);
// Alert is immediately removed from summary, and we show child as its content is inflated.
@@ -185,7 +188,8 @@
mGroupTestHelper.createSummaryNotification(Notification.GROUP_ALERT_SUMMARY);
NotificationData.Entry childEntry =
mGroupTestHelper.createChildNotification(Notification.GROUP_ALERT_SUMMARY);
- when(childEntry.row.isInflationFlagSet(mHeadsUpManager.getContentFlag())).thenReturn(false);
+ when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag()))
+ .thenReturn(false);
NotificationData.Entry childEntry2 =
mGroupTestHelper.createChildNotification(Notification.GROUP_ALERT_SUMMARY);
mHeadsUpManager.showNotification(summaryEntry);
@@ -199,10 +203,12 @@
mGroupManager.onEntryAdded(childEntry2);
// Child entry finishes its inflation.
- when(childEntry.row.isInflationFlagSet(mHeadsUpManager.getContentFlag())).thenReturn(true);
+ when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag()))
+ .thenReturn(true);
mGroupAlertTransferHelper.onInflationFinished(childEntry);
- verify(childEntry.row, times(1)).freeContentViewWhenSafe(mHeadsUpManager.getContentFlag());
+ verify(childEntry.getRow(), times(1)).freeContentViewWhenSafe(mHeadsUpManager
+ .getContentFlag());
assertFalse(mHeadsUpManager.isAlerting(childEntry.key));
}
@@ -212,7 +218,8 @@
mGroupTestHelper.createSummaryNotification(Notification.GROUP_ALERT_SUMMARY);
NotificationData.Entry childEntry =
mGroupTestHelper.createChildNotification(Notification.GROUP_ALERT_SUMMARY);
- when(childEntry.row.isInflationFlagSet(mHeadsUpManager.getContentFlag())).thenReturn(false);
+ when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag()))
+ .thenReturn(false);
mHeadsUpManager.showNotification(summaryEntry);
// Trigger a transfer of alert state from summary to child.
mGroupManager.onEntryAdded(summaryEntry);
@@ -229,7 +236,8 @@
mGroupTestHelper.createSummaryNotification(Notification.GROUP_ALERT_SUMMARY);
NotificationData.Entry childEntry =
mGroupTestHelper.createChildNotification(Notification.GROUP_ALERT_SUMMARY);
- when(childEntry.row.isInflationFlagSet(mHeadsUpManager.getContentFlag())).thenReturn(false);
+ when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag()))
+ .thenReturn(false);
mHeadsUpManager.showNotification(summaryEntry);
// Trigger a transfer of alert state from summary to child.
mGroupManager.onEntryAdded(summaryEntry);
@@ -251,7 +259,8 @@
mGroupTestHelper.createSummaryNotification(Notification.GROUP_ALERT_SUMMARY);
NotificationData.Entry childEntry =
mGroupTestHelper.createChildNotification(Notification.GROUP_ALERT_SUMMARY);
- when(childEntry.row.isInflationFlagSet(mHeadsUpManager.getContentFlag())).thenReturn(false);
+ when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag()))
+ .thenReturn(false);
mHeadsUpManager.showNotification(summaryEntry);
// Trigger a transfer of alert state from summary to child.
mGroupManager.onEntryAdded(summaryEntry);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerTest.java
index 1483ae5..b0bd1fb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerTest.java
@@ -100,7 +100,7 @@
mGroupManager.onEntryAdded(mGroupTestHelper.createChildNotification());
assertTrue(mGroupManager.isSummaryOfGroup(summaryEntry.notification));
- assertEquals(summaryEntry.row, mGroupManager.getGroupSummary(childEntry.notification));
+ assertEquals(summaryEntry, mGroupManager.getGroupSummary(childEntry.notification));
}
@Test
@@ -143,9 +143,8 @@
// Child entries that are heads upped should be considered separate groups visually even if
// they are the same group logically
- assertEquals(childEntry.row, mGroupManager.getGroupSummary(childEntry.notification));
- assertEquals(summaryEntry.row,
- mGroupManager.getLogicalGroupSummary(childEntry.notification));
+ assertEquals(childEntry, mGroupManager.getGroupSummary(childEntry.notification));
+ assertEquals(summaryEntry, mGroupManager.getLogicalGroupSummary(childEntry.notification));
}
@Test
@@ -161,8 +160,7 @@
// Child entries that are heads upped should be considered separate groups visually even if
// they are the same group logically
- assertEquals(childEntry.row, mGroupManager.getGroupSummary(childEntry.notification));
- assertEquals(summaryEntry.row,
- mGroupManager.getLogicalGroupSummary(childEntry.notification));
+ assertEquals(childEntry, mGroupManager.getGroupSummary(childEntry.notification));
+ assertEquals(summaryEntry, mGroupManager.getLogicalGroupSummary(childEntry.notification));
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupTestHelper.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupTestHelper.java
index 01f44fd4..7ad68eb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupTestHelper.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupTestHelper.java
@@ -81,7 +81,7 @@
0 /* postTime */);
NotificationData.Entry entry = new NotificationData.Entry(sbn);
ExpandableNotificationRow row = mock(ExpandableNotificationRow.class);
- entry.row = row;
+ entry.setRow(row);
when(row.getEntry()).thenReturn(entry);
when(row.getStatusBarNotification()).thenReturn(sbn);
when(row.isInflationFlagSet(anyInt())).thenReturn(true);