Merge "Do not show the notification footer until the user is set up." into qt-dev
This commit is contained in:
@@ -140,6 +140,8 @@ import com.android.systemui.statusbar.phone.ShadeController;
|
|||||||
import com.android.systemui.statusbar.phone.StatusBar;
|
import com.android.systemui.statusbar.phone.StatusBar;
|
||||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||||
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
|
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
|
||||||
|
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
|
||||||
|
import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener;
|
||||||
import com.android.systemui.statusbar.policy.HeadsUpUtil;
|
import com.android.systemui.statusbar.policy.HeadsUpUtil;
|
||||||
import com.android.systemui.statusbar.policy.ScrollAdapter;
|
import com.android.systemui.statusbar.policy.ScrollAdapter;
|
||||||
import com.android.systemui.tuner.TunerService;
|
import com.android.systemui.tuner.TunerService;
|
||||||
@@ -280,6 +282,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
private boolean mExpandedInThisMotion;
|
private boolean mExpandedInThisMotion;
|
||||||
private boolean mShouldShowShelfOnly;
|
private boolean mShouldShowShelfOnly;
|
||||||
protected boolean mScrollingEnabled;
|
protected boolean mScrollingEnabled;
|
||||||
|
private boolean mIsCurrentUserSetup;
|
||||||
protected FooterView mFooterView;
|
protected FooterView mFooterView;
|
||||||
protected EmptyShadeView mEmptyShadeView;
|
protected EmptyShadeView mEmptyShadeView;
|
||||||
private boolean mDismissAllInProgress;
|
private boolean mDismissAllInProgress;
|
||||||
@@ -481,6 +484,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
private final Rect mTmpRect = new Rect();
|
private final Rect mTmpRect = new Rect();
|
||||||
private final NotificationEntryManager mEntryManager =
|
private final NotificationEntryManager mEntryManager =
|
||||||
Dependency.get(NotificationEntryManager.class);
|
Dependency.get(NotificationEntryManager.class);
|
||||||
|
private final DeviceProvisionedController mDeviceProvisionedController =
|
||||||
|
Dependency.get(DeviceProvisionedController.class);
|
||||||
private final IStatusBarService mBarService = IStatusBarService.Stub.asInterface(
|
private final IStatusBarService mBarService = IStatusBarService.Stub.asInterface(
|
||||||
ServiceManager.getService(Context.STATUS_BAR_SERVICE));
|
ServiceManager.getService(Context.STATUS_BAR_SERVICE));
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -597,6 +602,28 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
}
|
}
|
||||||
}, HIGH_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL);
|
}, HIGH_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL);
|
||||||
|
|
||||||
|
mDeviceProvisionedController.addCallback(
|
||||||
|
new DeviceProvisionedListener() {
|
||||||
|
@Override
|
||||||
|
public void onDeviceProvisionedChanged() {
|
||||||
|
updateCurrentUserIsSetup();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUserSwitched() {
|
||||||
|
updateCurrentUserIsSetup();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUserSetupChanged() {
|
||||||
|
updateCurrentUserIsSetup();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateCurrentUserIsSetup() {
|
||||||
|
setCurrentUserSetup(mDeviceProvisionedController.isCurrentUserSetup());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
mEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
|
mEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onPostEntryUpdated(NotificationEntry entry) {
|
public void onPostEntryUpdated(NotificationEntry entry) {
|
||||||
@@ -683,6 +710,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
boolean showDismissView = mClearAllEnabled && hasActiveClearableNotifications(ROWS_ALL);
|
boolean showDismissView = mClearAllEnabled && hasActiveClearableNotifications(ROWS_ALL);
|
||||||
boolean showFooterView = (showDismissView ||
|
boolean showFooterView = (showDismissView ||
|
||||||
mEntryManager.getNotificationData().getActiveNotifications().size() != 0)
|
mEntryManager.getNotificationData().getActiveNotifications().size() != 0)
|
||||||
|
&& mIsCurrentUserSetup // see: b/193149550
|
||||||
&& mStatusBarState != StatusBarState.KEYGUARD
|
&& mStatusBarState != StatusBarState.KEYGUARD
|
||||||
&& !mRemoteInputManager.getController().isRemoteInputActive();
|
&& !mRemoteInputManager.getController().isRemoteInputActive();
|
||||||
|
|
||||||
@@ -5734,6 +5762,16 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether the current user is set up, which is required to show the footer (b/193149550)
|
||||||
|
*/
|
||||||
|
public void setCurrentUserSetup(boolean isCurrentUserSetup) {
|
||||||
|
if (mIsCurrentUserSetup != isCurrentUserSetup) {
|
||||||
|
mIsCurrentUserSetup = isCurrentUserSetup;
|
||||||
|
updateFooter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A listener that is notified when the empty space below the notifications is clicked on
|
* A listener that is notified when the empty space below the notifications is clicked on
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -308,6 +308,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testUpdateFooter_noNotifications() {
|
public void testUpdateFooter_noNotifications() {
|
||||||
setBarStateForTest(StatusBarState.SHADE);
|
setBarStateForTest(StatusBarState.SHADE);
|
||||||
|
mStackScroller.setCurrentUserSetup(true);
|
||||||
assertEquals(0, mNotificationData.getActiveNotifications().size());
|
assertEquals(0, mNotificationData.getActiveNotifications().size());
|
||||||
|
|
||||||
mStackScroller.updateFooter();
|
mStackScroller.updateFooter();
|
||||||
@@ -317,6 +318,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testUpdateFooter_remoteInput() {
|
public void testUpdateFooter_remoteInput() {
|
||||||
setBarStateForTest(StatusBarState.SHADE);
|
setBarStateForTest(StatusBarState.SHADE);
|
||||||
|
mStackScroller.setCurrentUserSetup(true);
|
||||||
|
|
||||||
ArrayList<NotificationEntry> entries = new ArrayList<>();
|
ArrayList<NotificationEntry> entries = new ArrayList<>();
|
||||||
entries.add(mock(NotificationEntry.class));
|
entries.add(mock(NotificationEntry.class));
|
||||||
when(mNotificationData.getActiveNotifications()).thenReturn(entries);
|
when(mNotificationData.getActiveNotifications()).thenReturn(entries);
|
||||||
@@ -334,6 +337,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testUpdateFooter_oneClearableNotification() {
|
public void testUpdateFooter_oneClearableNotification() {
|
||||||
setBarStateForTest(StatusBarState.SHADE);
|
setBarStateForTest(StatusBarState.SHADE);
|
||||||
|
mStackScroller.setCurrentUserSetup(true);
|
||||||
|
|
||||||
ArrayList<NotificationEntry> entries = new ArrayList<>();
|
ArrayList<NotificationEntry> entries = new ArrayList<>();
|
||||||
entries.add(mock(NotificationEntry.class));
|
entries.add(mock(NotificationEntry.class));
|
||||||
when(mNotificationData.getActiveNotifications()).thenReturn(entries);
|
when(mNotificationData.getActiveNotifications()).thenReturn(entries);
|
||||||
@@ -347,9 +352,29 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
verify(mStackScroller).updateFooterView(true, true);
|
verify(mStackScroller).updateFooterView(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateFooter_oneClearableNotification_beforeUserSetup() {
|
||||||
|
setBarStateForTest(StatusBarState.SHADE);
|
||||||
|
mStackScroller.setCurrentUserSetup(false);
|
||||||
|
|
||||||
|
ArrayList<NotificationEntry> entries = new ArrayList<>();
|
||||||
|
entries.add(mock(NotificationEntry.class));
|
||||||
|
when(mNotificationData.getActiveNotifications()).thenReturn(entries);
|
||||||
|
|
||||||
|
ExpandableNotificationRow row = mock(ExpandableNotificationRow.class);
|
||||||
|
when(row.canViewBeDismissed()).thenReturn(true);
|
||||||
|
when(mStackScroller.getChildCount()).thenReturn(1);
|
||||||
|
when(mStackScroller.getChildAt(anyInt())).thenReturn(row);
|
||||||
|
|
||||||
|
mStackScroller.updateFooter();
|
||||||
|
verify(mStackScroller).updateFooterView(false, true);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateFooter_oneNonClearableNotification() {
|
public void testUpdateFooter_oneNonClearableNotification() {
|
||||||
setBarStateForTest(StatusBarState.SHADE);
|
setBarStateForTest(StatusBarState.SHADE);
|
||||||
|
mStackScroller.setCurrentUserSetup(true);
|
||||||
|
|
||||||
ArrayList<NotificationEntry> entries = new ArrayList<>();
|
ArrayList<NotificationEntry> entries = new ArrayList<>();
|
||||||
entries.add(mock(NotificationEntry.class));
|
entries.add(mock(NotificationEntry.class));
|
||||||
when(mEntryManager.getNotificationData().getActiveNotifications()).thenReturn(entries);
|
when(mEntryManager.getNotificationData().getActiveNotifications()).thenReturn(entries);
|
||||||
@@ -361,6 +386,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateFooter_atEnd() {
|
public void testUpdateFooter_atEnd() {
|
||||||
|
mStackScroller.setCurrentUserSetup(true);
|
||||||
|
|
||||||
// add footer
|
// add footer
|
||||||
mStackScroller.inflateFooterView();
|
mStackScroller.inflateFooterView();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user