Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/FooterView.java +19 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ public class FooterView extends StackScrollerDecorView { private final int mClearAllTopPadding; private FooterViewButton mDismissButton; private FooterViewButton mManageButton; private boolean mShowHistory; public FooterView(Context context, AttributeSet attrs) { super(context, attrs); Loading Loading @@ -72,15 +73,30 @@ public class FooterView extends StackScrollerDecorView { || touchY > mContent.getY() + mContent.getHeight(); } public void showHistory(boolean showHistory) { mShowHistory = showHistory; if (mShowHistory) { mManageButton.setText(R.string.manage_notifications_history_text); mManageButton.setContentDescription( mContext.getString(R.string.manage_notifications_history_text)); } else { mManageButton.setText(R.string.manage_notifications_text); mManageButton.setContentDescription( mContext.getString(R.string.manage_notifications_text)); } } public boolean isHistoryShown() { return mShowHistory; } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDismissButton.setText(R.string.clear_all_notifications_text); mDismissButton.setContentDescription( mContext.getString(R.string.accessibility_clear_all)); mManageButton.setText(R.string.manage_notifications_history_text); mManageButton.setContentDescription( mContext.getString(R.string.manage_notifications_history_text)); showHistory(mShowHistory); } public boolean isButtonVisible() { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +18 −10 Original line number Diff line number Diff line Loading @@ -628,8 +628,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd mHighPriorityBeforeSpeedBump = "1".equals(newValue); } else if (key.equals(Settings.Secure.NOTIFICATION_DISMISS_RTL)) { updateDismissRtlSetting("1".equals(newValue)); } else if (key.equals(Settings.Secure.NOTIFICATION_HISTORY_ENABLED)) { updateFooter(); } }, HIGH_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL); }, HIGH_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL, Settings.Secure.NOTIFICATION_HISTORY_ENABLED); mFeatureFlags = featureFlags; mNotifPipeline = notifPipeline; Loading Loading @@ -742,12 +745,17 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd @VisibleForTesting @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void updateFooter() { if (mFooterView == null) { return; } boolean showDismissView = mClearAllEnabled && hasActiveClearableNotifications(ROWS_ALL); boolean showFooterView = (showDismissView || hasActiveNotifications()) && mStatusBarState != StatusBarState.KEYGUARD && !mRemoteInputManager.getController().isRemoteInputActive(); boolean showHistory = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.NOTIFICATION_HISTORY_ENABLED, 0) == 1; updateFooterView(showFooterView, showDismissView); updateFooterView(showFooterView, showDismissView, showHistory); } /** Loading Loading @@ -4979,13 +4987,14 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void updateFooterView(boolean visible, boolean showDismissView) { public void updateFooterView(boolean visible, boolean showDismissView, boolean showHistory) { if (mFooterView == null) { return; } boolean animate = mIsExpanded && mAnimationsEnabled; mFooterView.setVisible(visible, animate); mFooterView.setSecondaryVisible(showDismissView, animate); mFooterView.showHistory(showHistory); } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) Loading Loading @@ -5565,12 +5574,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd mIconAreaController = controller; } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void manageNotifications(View v) { Intent intent = new Intent(Settings.ACTION_NOTIFICATION_HISTORY); mStatusBar.startActivity(intent, true, true, Intent.FLAG_ACTIVITY_SINGLE_TOP); } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) @VisibleForTesting void clearNotifications( Loading Loading @@ -5705,7 +5708,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd mMetricsLogger.action(MetricsEvent.ACTION_DISMISS_ALL_NOTES); clearNotifications(ROWS_ALL, true /* closeShade */); }); footerView.setManageButtonClickListener(this::manageNotifications); footerView.setManageButtonClickListener(v -> { Intent intent = footerView.isHistoryShown() ? new Intent( Settings.ACTION_NOTIFICATION_HISTORY) : new Intent( Settings.ACTION_NOTIFICATION_SETTINGS); mStatusBar.startActivity(intent, true, true, Intent.FLAG_ACTIVITY_SINGLE_TOP); }); setFooterView(footerView); } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FooterViewTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static org.mockito.Mockito.mock; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; Loading Loading @@ -66,6 +67,22 @@ public class FooterViewTest extends SysuiTestCase { assertTrue(mView.findViewById(R.id.manage_text).hasOnClickListeners()); } @Test public void setHistoryShown() { mView.showHistory(true); assertTrue(mView.isHistoryShown()); assertTrue(((TextView) mView.findViewById(R.id.manage_text)) .getText().toString().contains("History")); } @Test public void setHistoryNotShown() { mView.showHistory(false); assertFalse(mView.isHistoryShown()); assertTrue(((TextView) mView.findViewById(R.id.manage_text)) .getText().toString().contains("Manage")); } @Test public void testPerformVisibilityAnimation() { mView.setVisible(false /* visible */, false /* animate */); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +16 −6 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ package com.android.systemui.statusbar.notification.stack; import static android.provider.Settings.Secure.NOTIFICATION_HISTORY_ENABLED; import static android.provider.Settings.Secure.NOTIFICATION_NEW_INTERRUPTION_MODEL; import static junit.framework.Assert.assertEquals; Loading Loading @@ -151,6 +152,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { NOTIFICATION_NEW_INTERRUPTION_MODEL, 0); Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_NEW_INTERRUPTION_MODEL, 1); Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_HISTORY_ENABLED, 1); // Inject dependencies before initializing the layout mDependency.injectMockDependency(VisualStabilityManager.class); Loading Loading @@ -311,7 +313,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { mStackScroller.setFooterView(view); when(view.willBeGone()).thenReturn(true); mStackScroller.updateFooterView(true, false); mStackScroller.updateFooterView(true, false, true); verify(view).setVisible(eq(true), anyBoolean()); verify(view).setSecondaryVisible(eq(false), anyBoolean()); Loading @@ -323,7 +325,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { mStackScroller.setFooterView(view); when(view.willBeGone()).thenReturn(true); mStackScroller.updateFooterView(true, true); mStackScroller.updateFooterView(true, true, true); verify(view).setVisible(eq(true), anyBoolean()); verify(view).setSecondaryVisible(eq(true), anyBoolean()); Loading @@ -344,8 +346,10 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { setBarStateForTest(StatusBarState.SHADE); assertEquals(0, mEntryManager.getActiveNotificationsCount()); FooterView view = mock(FooterView.class); mStackScroller.setFooterView(view); mStackScroller.updateFooter(); verify(mStackScroller, atLeastOnce()).updateFooterView(false, false); verify(mStackScroller, atLeastOnce()).updateFooterView(false, false, true); } @Test Loading @@ -361,8 +365,10 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { when(mStackScroller.getChildAt(anyInt())).thenReturn(row); when(mRemoteInputController.isRemoteInputActive()).thenReturn(true); FooterView view = mock(FooterView.class); mStackScroller.setFooterView(view); mStackScroller.updateFooter(); verify(mStackScroller).updateFooterView(false, true); verify(mStackScroller).updateFooterView(false, true, true); } @Test Loading @@ -378,8 +384,10 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { when(mStackScroller.getChildCount()).thenReturn(1); when(mStackScroller.getChildAt(anyInt())).thenReturn(row); FooterView view = mock(FooterView.class); mStackScroller.setFooterView(view); mStackScroller.updateFooter(); verify(mStackScroller).updateFooterView(true, true); verify(mStackScroller).updateFooterView(true, true, true); } @Test Loading @@ -390,8 +398,10 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { entries.add(new NotificationEntryBuilder().build()); addEntriesToEntryManager(entries); FooterView view = mock(FooterView.class); mStackScroller.setFooterView(view); mStackScroller.updateFooter(); verify(mStackScroller).updateFooterView(true, false); verify(mStackScroller).updateFooterView(true, false, true); } @Test Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/FooterView.java +19 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ public class FooterView extends StackScrollerDecorView { private final int mClearAllTopPadding; private FooterViewButton mDismissButton; private FooterViewButton mManageButton; private boolean mShowHistory; public FooterView(Context context, AttributeSet attrs) { super(context, attrs); Loading Loading @@ -72,15 +73,30 @@ public class FooterView extends StackScrollerDecorView { || touchY > mContent.getY() + mContent.getHeight(); } public void showHistory(boolean showHistory) { mShowHistory = showHistory; if (mShowHistory) { mManageButton.setText(R.string.manage_notifications_history_text); mManageButton.setContentDescription( mContext.getString(R.string.manage_notifications_history_text)); } else { mManageButton.setText(R.string.manage_notifications_text); mManageButton.setContentDescription( mContext.getString(R.string.manage_notifications_text)); } } public boolean isHistoryShown() { return mShowHistory; } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDismissButton.setText(R.string.clear_all_notifications_text); mDismissButton.setContentDescription( mContext.getString(R.string.accessibility_clear_all)); mManageButton.setText(R.string.manage_notifications_history_text); mManageButton.setContentDescription( mContext.getString(R.string.manage_notifications_history_text)); showHistory(mShowHistory); } public boolean isButtonVisible() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +18 −10 Original line number Diff line number Diff line Loading @@ -628,8 +628,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd mHighPriorityBeforeSpeedBump = "1".equals(newValue); } else if (key.equals(Settings.Secure.NOTIFICATION_DISMISS_RTL)) { updateDismissRtlSetting("1".equals(newValue)); } else if (key.equals(Settings.Secure.NOTIFICATION_HISTORY_ENABLED)) { updateFooter(); } }, HIGH_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL); }, HIGH_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL, Settings.Secure.NOTIFICATION_HISTORY_ENABLED); mFeatureFlags = featureFlags; mNotifPipeline = notifPipeline; Loading Loading @@ -742,12 +745,17 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd @VisibleForTesting @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void updateFooter() { if (mFooterView == null) { return; } boolean showDismissView = mClearAllEnabled && hasActiveClearableNotifications(ROWS_ALL); boolean showFooterView = (showDismissView || hasActiveNotifications()) && mStatusBarState != StatusBarState.KEYGUARD && !mRemoteInputManager.getController().isRemoteInputActive(); boolean showHistory = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.NOTIFICATION_HISTORY_ENABLED, 0) == 1; updateFooterView(showFooterView, showDismissView); updateFooterView(showFooterView, showDismissView, showHistory); } /** Loading Loading @@ -4979,13 +4987,14 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void updateFooterView(boolean visible, boolean showDismissView) { public void updateFooterView(boolean visible, boolean showDismissView, boolean showHistory) { if (mFooterView == null) { return; } boolean animate = mIsExpanded && mAnimationsEnabled; mFooterView.setVisible(visible, animate); mFooterView.setSecondaryVisible(showDismissView, animate); mFooterView.showHistory(showHistory); } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) Loading Loading @@ -5565,12 +5574,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd mIconAreaController = controller; } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void manageNotifications(View v) { Intent intent = new Intent(Settings.ACTION_NOTIFICATION_HISTORY); mStatusBar.startActivity(intent, true, true, Intent.FLAG_ACTIVITY_SINGLE_TOP); } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) @VisibleForTesting void clearNotifications( Loading Loading @@ -5705,7 +5708,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd mMetricsLogger.action(MetricsEvent.ACTION_DISMISS_ALL_NOTES); clearNotifications(ROWS_ALL, true /* closeShade */); }); footerView.setManageButtonClickListener(this::manageNotifications); footerView.setManageButtonClickListener(v -> { Intent intent = footerView.isHistoryShown() ? new Intent( Settings.ACTION_NOTIFICATION_HISTORY) : new Intent( Settings.ACTION_NOTIFICATION_SETTINGS); mStatusBar.startActivity(intent, true, true, Intent.FLAG_ACTIVITY_SINGLE_TOP); }); setFooterView(footerView); } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FooterViewTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static org.mockito.Mockito.mock; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; Loading Loading @@ -66,6 +67,22 @@ public class FooterViewTest extends SysuiTestCase { assertTrue(mView.findViewById(R.id.manage_text).hasOnClickListeners()); } @Test public void setHistoryShown() { mView.showHistory(true); assertTrue(mView.isHistoryShown()); assertTrue(((TextView) mView.findViewById(R.id.manage_text)) .getText().toString().contains("History")); } @Test public void setHistoryNotShown() { mView.showHistory(false); assertFalse(mView.isHistoryShown()); assertTrue(((TextView) mView.findViewById(R.id.manage_text)) .getText().toString().contains("Manage")); } @Test public void testPerformVisibilityAnimation() { mView.setVisible(false /* visible */, false /* animate */); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +16 −6 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ package com.android.systemui.statusbar.notification.stack; import static android.provider.Settings.Secure.NOTIFICATION_HISTORY_ENABLED; import static android.provider.Settings.Secure.NOTIFICATION_NEW_INTERRUPTION_MODEL; import static junit.framework.Assert.assertEquals; Loading Loading @@ -151,6 +152,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { NOTIFICATION_NEW_INTERRUPTION_MODEL, 0); Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_NEW_INTERRUPTION_MODEL, 1); Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_HISTORY_ENABLED, 1); // Inject dependencies before initializing the layout mDependency.injectMockDependency(VisualStabilityManager.class); Loading Loading @@ -311,7 +313,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { mStackScroller.setFooterView(view); when(view.willBeGone()).thenReturn(true); mStackScroller.updateFooterView(true, false); mStackScroller.updateFooterView(true, false, true); verify(view).setVisible(eq(true), anyBoolean()); verify(view).setSecondaryVisible(eq(false), anyBoolean()); Loading @@ -323,7 +325,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { mStackScroller.setFooterView(view); when(view.willBeGone()).thenReturn(true); mStackScroller.updateFooterView(true, true); mStackScroller.updateFooterView(true, true, true); verify(view).setVisible(eq(true), anyBoolean()); verify(view).setSecondaryVisible(eq(true), anyBoolean()); Loading @@ -344,8 +346,10 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { setBarStateForTest(StatusBarState.SHADE); assertEquals(0, mEntryManager.getActiveNotificationsCount()); FooterView view = mock(FooterView.class); mStackScroller.setFooterView(view); mStackScroller.updateFooter(); verify(mStackScroller, atLeastOnce()).updateFooterView(false, false); verify(mStackScroller, atLeastOnce()).updateFooterView(false, false, true); } @Test Loading @@ -361,8 +365,10 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { when(mStackScroller.getChildAt(anyInt())).thenReturn(row); when(mRemoteInputController.isRemoteInputActive()).thenReturn(true); FooterView view = mock(FooterView.class); mStackScroller.setFooterView(view); mStackScroller.updateFooter(); verify(mStackScroller).updateFooterView(false, true); verify(mStackScroller).updateFooterView(false, true, true); } @Test Loading @@ -378,8 +384,10 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { when(mStackScroller.getChildCount()).thenReturn(1); when(mStackScroller.getChildAt(anyInt())).thenReturn(row); FooterView view = mock(FooterView.class); mStackScroller.setFooterView(view); mStackScroller.updateFooter(); verify(mStackScroller).updateFooterView(true, true); verify(mStackScroller).updateFooterView(true, true, true); } @Test Loading @@ -390,8 +398,10 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { entries.add(new NotificationEntryBuilder().build()); addEntriesToEntryManager(entries); FooterView view = mock(FooterView.class); mStackScroller.setFooterView(view); mStackScroller.updateFooter(); verify(mStackScroller).updateFooterView(true, false); verify(mStackScroller).updateFooterView(true, false, true); } @Test Loading