Merge "Do not show the notification footer until the user is set up." into rvc-dev am: e124ab6c0f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15878982 Change-Id: I44c61db7e6f85361668e910bc04646d97ac3dede
This commit is contained in:
@@ -157,6 +157,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.statusbar.policy.ZenModeController;
|
import com.android.systemui.statusbar.policy.ZenModeController;
|
||||||
@@ -300,6 +302,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;
|
||||||
@@ -508,6 +511,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
private final NotifPipeline mNotifPipeline;
|
private final NotifPipeline mNotifPipeline;
|
||||||
private final NotifCollection mNotifCollection;
|
private final NotifCollection mNotifCollection;
|
||||||
private final NotificationEntryManager mEntryManager;
|
private final NotificationEntryManager mEntryManager;
|
||||||
|
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
|
||||||
@@ -648,6 +653,29 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
}, HIGH_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL,
|
}, HIGH_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL,
|
||||||
Settings.Secure.NOTIFICATION_HISTORY_ENABLED);
|
Settings.Secure.NOTIFICATION_HISTORY_ENABLED);
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
mFeatureFlags = featureFlags;
|
mFeatureFlags = featureFlags;
|
||||||
mNotifPipeline = notifPipeline;
|
mNotifPipeline = notifPipeline;
|
||||||
mEntryManager = entryManager;
|
mEntryManager = entryManager;
|
||||||
@@ -772,6 +800,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
}
|
}
|
||||||
boolean showDismissView = mClearAllEnabled && hasActiveClearableNotifications(ROWS_ALL);
|
boolean showDismissView = mClearAllEnabled && hasActiveClearableNotifications(ROWS_ALL);
|
||||||
boolean showFooterView = (showDismissView || hasActiveNotifications())
|
boolean showFooterView = (showDismissView || hasActiveNotifications())
|
||||||
|
&& mIsCurrentUserSetup // see: b/193149550
|
||||||
&& mStatusBarState != StatusBarState.KEYGUARD
|
&& mStatusBarState != StatusBarState.KEYGUARD
|
||||||
&& !mRemoteInputManager.getController().isRemoteInputActive();
|
&& !mRemoteInputManager.getController().isRemoteInputActive();
|
||||||
boolean showHistory = Settings.Secure.getIntForUser(mContext.getContentResolver(),
|
boolean showHistory = Settings.Secure.getIntForUser(mContext.getContentResolver(),
|
||||||
@@ -5923,6 +5952,16 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
return MathUtils.smoothStep(0, totalDistance, dragDownAmount);
|
return MathUtils.smoothStep(0, totalDistance, dragDownAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -349,6 +349,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, mEntryManager.getActiveNotificationsCount());
|
assertEquals(0, mEntryManager.getActiveNotificationsCount());
|
||||||
|
|
||||||
FooterView view = mock(FooterView.class);
|
FooterView view = mock(FooterView.class);
|
||||||
@@ -360,6 +361,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(new NotificationEntryBuilder().build());
|
entries.add(new NotificationEntryBuilder().build());
|
||||||
addEntriesToEntryManager(entries);
|
addEntriesToEntryManager(entries);
|
||||||
@@ -379,6 +382,7 @@ 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(new NotificationEntryBuilder().build());
|
entries.add(new NotificationEntryBuilder().build());
|
||||||
@@ -395,9 +399,30 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
verify(mStackScroller).updateFooterView(true, true, true);
|
verify(mStackScroller).updateFooterView(true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateFooter_oneClearableNotification_beforeUserSetup() {
|
||||||
|
setBarStateForTest(StatusBarState.SHADE);
|
||||||
|
mStackScroller.setCurrentUserSetup(false);
|
||||||
|
|
||||||
|
ArrayList<NotificationEntry> entries = new ArrayList<>();
|
||||||
|
entries.add(new NotificationEntryBuilder().build());
|
||||||
|
addEntriesToEntryManager(entries);
|
||||||
|
|
||||||
|
ExpandableNotificationRow row = mock(ExpandableNotificationRow.class);
|
||||||
|
when(row.canViewBeDismissed()).thenReturn(true);
|
||||||
|
when(mStackScroller.getChildCount()).thenReturn(1);
|
||||||
|
when(mStackScroller.getChildAt(anyInt())).thenReturn(row);
|
||||||
|
|
||||||
|
FooterView view = mock(FooterView.class);
|
||||||
|
mStackScroller.setFooterView(view);
|
||||||
|
mStackScroller.updateFooter();
|
||||||
|
verify(mStackScroller).updateFooterView(false, true, 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(new NotificationEntryBuilder().build());
|
entries.add(new NotificationEntryBuilder().build());
|
||||||
@@ -411,6 +436,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