Skip to content

Commit 6d064d4

Browse files
Jeff DeCewRafiester
authored andcommitted
Do not show the notification footer until the user is set up.
Bug: 193149550 Test: follow repro steps Merged-In: I49e2b8bcec7b2ce0a9776ff30a64c07f24949da7 Change-Id: I49e2b8bcec7b2ce0a9776ff30a64c07f24949da7 (cherry picked from commit 73c3c0a)
1 parent fdb756a commit 6d064d4

2 files changed

Lines changed: 66 additions & 0 deletions

File tree

packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@
161161
import com.android.systemui.statusbar.phone.StatusBar;
162162
import com.android.systemui.statusbar.policy.ConfigurationController;
163163
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
164+
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
165+
import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener;
164166
import com.android.systemui.statusbar.policy.HeadsUpUtil;
165167
import com.android.systemui.statusbar.policy.ScrollAdapter;
166168
import com.android.systemui.statusbar.policy.ZenModeController;
@@ -304,6 +306,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
304306
private boolean mExpandedInThisMotion;
305307
private boolean mShouldShowShelfOnly;
306308
protected boolean mScrollingEnabled;
309+
private boolean mIsCurrentUserSetup;
307310
protected FooterView mFooterView;
308311
protected EmptyShadeView mEmptyShadeView;
309312
private boolean mDismissAllInProgress;
@@ -514,6 +517,8 @@ public void getOutline(View view, Outline outline) {
514517
private final NotifPipeline mNotifPipeline;
515518
private final NotifCollection mNotifCollection;
516519
private final NotificationEntryManager mEntryManager;
520+
private final DeviceProvisionedController mDeviceProvisionedController =
521+
Dependency.get(DeviceProvisionedController.class);
517522
private final IStatusBarService mBarService = IStatusBarService.Stub.asInterface(
518523
ServiceManager.getService(Context.STATUS_BAR_SERVICE));
519524
@VisibleForTesting
@@ -692,6 +697,29 @@ public NotificationStackScrollLayout(
692697
}, HIGH_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL,
693698
Settings.Secure.NOTIFICATION_HISTORY_ENABLED);
694699

700+
mDeviceProvisionedController.addCallback(
701+
new DeviceProvisionedListener() {
702+
@Override
703+
public void onDeviceProvisionedChanged() {
704+
updateCurrentUserIsSetup();
705+
}
706+
707+
@Override
708+
public void onUserSwitched() {
709+
updateCurrentUserIsSetup();
710+
}
711+
712+
@Override
713+
public void onUserSetupChanged() {
714+
updateCurrentUserIsSetup();
715+
}
716+
717+
private void updateCurrentUserIsSetup() {
718+
setCurrentUserSetup(mDeviceProvisionedController.isCurrentUserSetup());
719+
}
720+
});
721+
722+
695723
mFeatureFlags = featureFlags;
696724
mNotifPipeline = notifPipeline;
697725
mEntryManager = entryManager;
@@ -819,6 +847,7 @@ public void updateFooter() {
819847
boolean showDismissView = mClearAllEnabled && hasActiveClearableNotifications(ROWS_ALL);
820848
mStatusBar.setHasClearableNotifs(hasActiveClearableNotifications(ROWS_ALL));
821849
boolean showFooterView = (showDismissView || hasActiveNotifications())
850+
&& mIsCurrentUserSetup // see: b/193149550
822851
&& mStatusBarState != StatusBarState.KEYGUARD
823852
&& !mRemoteInputManager.getController().isRemoteInputActive();
824853
boolean showHistory = Settings.Secure.getIntForUser(mContext.getContentResolver(),
@@ -6030,6 +6059,16 @@ public float calculateAppearFractionBypass() {
60306059
return MathUtils.smoothStep(0, totalDistance, dragDownAmount);
60316060
}
60326061

6062+
/**
6063+
* Sets whether the current user is set up, which is required to show the footer (b/193149550)
6064+
*/
6065+
public void setCurrentUserSetup(boolean isCurrentUserSetup) {
6066+
if (mIsCurrentUserSetup != isCurrentUserSetup) {
6067+
mIsCurrentUserSetup = isCurrentUserSetup;
6068+
updateFooter();
6069+
}
6070+
}
6071+
60336072
/**
60346073
* A listener that is notified when the empty space below the notifications is clicked on
60356074
*/

packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ public void testInflateFooterView() {
354354
@Test
355355
public void testUpdateFooter_noNotifications() {
356356
setBarStateForTest(StatusBarState.SHADE);
357+
mStackScroller.setCurrentUserSetup(true);
357358
assertEquals(0, mEntryManager.getActiveNotificationsCount());
358359

359360
FooterView view = mock(FooterView.class);
@@ -365,6 +366,8 @@ public void testUpdateFooter_noNotifications() {
365366
@Test
366367
public void testUpdateFooter_remoteInput() {
367368
setBarStateForTest(StatusBarState.SHADE);
369+
mStackScroller.setCurrentUserSetup(true);
370+
368371
ArrayList<NotificationEntry> entries = new ArrayList<>();
369372
entries.add(new NotificationEntryBuilder().build());
370373
addEntriesToEntryManager(entries);
@@ -384,6 +387,7 @@ public void testUpdateFooter_remoteInput() {
384387
@Test
385388
public void testUpdateFooter_oneClearableNotification() {
386389
setBarStateForTest(StatusBarState.SHADE);
390+
mStackScroller.setCurrentUserSetup(true);
387391

388392
ArrayList<NotificationEntry> entries = new ArrayList<>();
389393
entries.add(new NotificationEntryBuilder().build());
@@ -400,9 +404,30 @@ public void testUpdateFooter_oneClearableNotification() {
400404
verify(mStackScroller).updateFooterView(true, true, true);
401405
}
402406

407+
@Test
408+
public void testUpdateFooter_oneClearableNotification_beforeUserSetup() {
409+
setBarStateForTest(StatusBarState.SHADE);
410+
mStackScroller.setCurrentUserSetup(false);
411+
412+
ArrayList<NotificationEntry> entries = new ArrayList<>();
413+
entries.add(new NotificationEntryBuilder().build());
414+
addEntriesToEntryManager(entries);
415+
416+
ExpandableNotificationRow row = mock(ExpandableNotificationRow.class);
417+
when(row.canViewBeDismissed()).thenReturn(true);
418+
when(mStackScroller.getChildCount()).thenReturn(1);
419+
when(mStackScroller.getChildAt(anyInt())).thenReturn(row);
420+
421+
FooterView view = mock(FooterView.class);
422+
mStackScroller.setFooterView(view);
423+
mStackScroller.updateFooter();
424+
verify(mStackScroller).updateFooterView(false, true, true);
425+
}
426+
403427
@Test
404428
public void testUpdateFooter_oneNonClearableNotification() {
405429
setBarStateForTest(StatusBarState.SHADE);
430+
mStackScroller.setCurrentUserSetup(true);
406431

407432
ArrayList<NotificationEntry> entries = new ArrayList<>();
408433
entries.add(new NotificationEntryBuilder().build());
@@ -416,6 +441,8 @@ public void testUpdateFooter_oneNonClearableNotification() {
416441

417442
@Test
418443
public void testUpdateFooter_atEnd() {
444+
mStackScroller.setCurrentUserSetup(true);
445+
419446
// add footer
420447
mStackScroller.inflateFooterView();
421448

0 commit comments

Comments
 (0)