Merge "Add history onboarding" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b31a5f43d0
@@ -29,6 +29,7 @@ public class FooterView extends StackScrollerDecorView {
|
|||||||
private final int mClearAllTopPadding;
|
private final int mClearAllTopPadding;
|
||||||
private FooterViewButton mDismissButton;
|
private FooterViewButton mDismissButton;
|
||||||
private FooterViewButton mManageButton;
|
private FooterViewButton mManageButton;
|
||||||
|
private boolean mShowHistory;
|
||||||
|
|
||||||
public FooterView(Context context, AttributeSet attrs) {
|
public FooterView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
@@ -72,15 +73,30 @@ public class FooterView extends StackScrollerDecorView {
|
|||||||
|| touchY > mContent.getY() + mContent.getHeight();
|
|| 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
|
@Override
|
||||||
protected void onConfigurationChanged(Configuration newConfig) {
|
protected void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
mDismissButton.setText(R.string.clear_all_notifications_text);
|
mDismissButton.setText(R.string.clear_all_notifications_text);
|
||||||
mDismissButton.setContentDescription(
|
mDismissButton.setContentDescription(
|
||||||
mContext.getString(R.string.accessibility_clear_all));
|
mContext.getString(R.string.accessibility_clear_all));
|
||||||
mManageButton.setText(R.string.manage_notifications_history_text);
|
showHistory(mShowHistory);
|
||||||
mManageButton.setContentDescription(
|
|
||||||
mContext.getString(R.string.manage_notifications_history_text));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isButtonVisible() {
|
public boolean isButtonVisible() {
|
||||||
|
|||||||
@@ -628,8 +628,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
mHighPriorityBeforeSpeedBump = "1".equals(newValue);
|
mHighPriorityBeforeSpeedBump = "1".equals(newValue);
|
||||||
} else if (key.equals(Settings.Secure.NOTIFICATION_DISMISS_RTL)) {
|
} else if (key.equals(Settings.Secure.NOTIFICATION_DISMISS_RTL)) {
|
||||||
updateDismissRtlSetting("1".equals(newValue));
|
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;
|
mFeatureFlags = featureFlags;
|
||||||
mNotifPipeline = notifPipeline;
|
mNotifPipeline = notifPipeline;
|
||||||
@@ -742,12 +745,17 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
||||||
public void updateFooter() {
|
public void updateFooter() {
|
||||||
|
if (mFooterView == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean showDismissView = mClearAllEnabled && hasActiveClearableNotifications(ROWS_ALL);
|
boolean showDismissView = mClearAllEnabled && hasActiveClearableNotifications(ROWS_ALL);
|
||||||
boolean showFooterView = (showDismissView || hasActiveNotifications())
|
boolean showFooterView = (showDismissView || hasActiveNotifications())
|
||||||
&& mStatusBarState != StatusBarState.KEYGUARD
|
&& mStatusBarState != StatusBarState.KEYGUARD
|
||||||
&& !mRemoteInputManager.getController().isRemoteInputActive();
|
&& !mRemoteInputManager.getController().isRemoteInputActive();
|
||||||
|
boolean showHistory = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.NOTIFICATION_HISTORY_ENABLED, 0) == 1;
|
||||||
|
|
||||||
updateFooterView(showFooterView, showDismissView);
|
updateFooterView(showFooterView, showDismissView, showHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4979,13 +4987,14 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
||||||
public void updateFooterView(boolean visible, boolean showDismissView) {
|
public void updateFooterView(boolean visible, boolean showDismissView, boolean showHistory) {
|
||||||
if (mFooterView == null) {
|
if (mFooterView == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean animate = mIsExpanded && mAnimationsEnabled;
|
boolean animate = mIsExpanded && mAnimationsEnabled;
|
||||||
mFooterView.setVisible(visible, animate);
|
mFooterView.setVisible(visible, animate);
|
||||||
mFooterView.setSecondaryVisible(showDismissView, animate);
|
mFooterView.setSecondaryVisible(showDismissView, animate);
|
||||||
|
mFooterView.showHistory(showHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
||||||
@@ -5565,12 +5574,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
mIconAreaController = controller;
|
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)
|
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void clearNotifications(
|
void clearNotifications(
|
||||||
@@ -5705,7 +5708,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
mMetricsLogger.action(MetricsEvent.ACTION_DISMISS_ALL_NOTES);
|
mMetricsLogger.action(MetricsEvent.ACTION_DISMISS_ALL_NOTES);
|
||||||
clearNotifications(ROWS_ALL, true /* closeShade */);
|
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);
|
setFooterView(footerView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import static org.mockito.Mockito.mock;
|
|||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
import androidx.test.runner.AndroidJUnit4;
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
@@ -66,6 +67,22 @@ public class FooterViewTest extends SysuiTestCase {
|
|||||||
assertTrue(mView.findViewById(R.id.manage_text).hasOnClickListeners());
|
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
|
@Test
|
||||||
public void testPerformVisibilityAnimation() {
|
public void testPerformVisibilityAnimation() {
|
||||||
mView.setVisible(false /* visible */, false /* animate */);
|
mView.setVisible(false /* visible */, false /* animate */);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar.notification.stack;
|
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 android.provider.Settings.Secure.NOTIFICATION_NEW_INTERRUPTION_MODEL;
|
||||||
|
|
||||||
import static junit.framework.Assert.assertEquals;
|
import static junit.framework.Assert.assertEquals;
|
||||||
@@ -151,6 +152,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
NOTIFICATION_NEW_INTERRUPTION_MODEL, 0);
|
NOTIFICATION_NEW_INTERRUPTION_MODEL, 0);
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
NOTIFICATION_NEW_INTERRUPTION_MODEL, 1);
|
NOTIFICATION_NEW_INTERRUPTION_MODEL, 1);
|
||||||
|
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_HISTORY_ENABLED, 1);
|
||||||
|
|
||||||
// Inject dependencies before initializing the layout
|
// Inject dependencies before initializing the layout
|
||||||
mDependency.injectMockDependency(VisualStabilityManager.class);
|
mDependency.injectMockDependency(VisualStabilityManager.class);
|
||||||
@@ -311,7 +313,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
mStackScroller.setFooterView(view);
|
mStackScroller.setFooterView(view);
|
||||||
when(view.willBeGone()).thenReturn(true);
|
when(view.willBeGone()).thenReturn(true);
|
||||||
|
|
||||||
mStackScroller.updateFooterView(true, false);
|
mStackScroller.updateFooterView(true, false, true);
|
||||||
|
|
||||||
verify(view).setVisible(eq(true), anyBoolean());
|
verify(view).setVisible(eq(true), anyBoolean());
|
||||||
verify(view).setSecondaryVisible(eq(false), anyBoolean());
|
verify(view).setSecondaryVisible(eq(false), anyBoolean());
|
||||||
@@ -323,7 +325,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
mStackScroller.setFooterView(view);
|
mStackScroller.setFooterView(view);
|
||||||
when(view.willBeGone()).thenReturn(true);
|
when(view.willBeGone()).thenReturn(true);
|
||||||
|
|
||||||
mStackScroller.updateFooterView(true, true);
|
mStackScroller.updateFooterView(true, true, true);
|
||||||
|
|
||||||
verify(view).setVisible(eq(true), anyBoolean());
|
verify(view).setVisible(eq(true), anyBoolean());
|
||||||
verify(view).setSecondaryVisible(eq(true), anyBoolean());
|
verify(view).setSecondaryVisible(eq(true), anyBoolean());
|
||||||
@@ -344,8 +346,10 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
setBarStateForTest(StatusBarState.SHADE);
|
setBarStateForTest(StatusBarState.SHADE);
|
||||||
assertEquals(0, mEntryManager.getActiveNotificationsCount());
|
assertEquals(0, mEntryManager.getActiveNotificationsCount());
|
||||||
|
|
||||||
|
FooterView view = mock(FooterView.class);
|
||||||
|
mStackScroller.setFooterView(view);
|
||||||
mStackScroller.updateFooter();
|
mStackScroller.updateFooter();
|
||||||
verify(mStackScroller, atLeastOnce()).updateFooterView(false, false);
|
verify(mStackScroller, atLeastOnce()).updateFooterView(false, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -361,8 +365,10 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
when(mStackScroller.getChildAt(anyInt())).thenReturn(row);
|
when(mStackScroller.getChildAt(anyInt())).thenReturn(row);
|
||||||
when(mRemoteInputController.isRemoteInputActive()).thenReturn(true);
|
when(mRemoteInputController.isRemoteInputActive()).thenReturn(true);
|
||||||
|
|
||||||
|
FooterView view = mock(FooterView.class);
|
||||||
|
mStackScroller.setFooterView(view);
|
||||||
mStackScroller.updateFooter();
|
mStackScroller.updateFooter();
|
||||||
verify(mStackScroller).updateFooterView(false, true);
|
verify(mStackScroller).updateFooterView(false, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -378,8 +384,10 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
when(mStackScroller.getChildCount()).thenReturn(1);
|
when(mStackScroller.getChildCount()).thenReturn(1);
|
||||||
when(mStackScroller.getChildAt(anyInt())).thenReturn(row);
|
when(mStackScroller.getChildAt(anyInt())).thenReturn(row);
|
||||||
|
|
||||||
|
FooterView view = mock(FooterView.class);
|
||||||
|
mStackScroller.setFooterView(view);
|
||||||
mStackScroller.updateFooter();
|
mStackScroller.updateFooter();
|
||||||
verify(mStackScroller).updateFooterView(true, true);
|
verify(mStackScroller).updateFooterView(true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -390,8 +398,10 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
|
|||||||
entries.add(new NotificationEntryBuilder().build());
|
entries.add(new NotificationEntryBuilder().build());
|
||||||
addEntriesToEntryManager(entries);
|
addEntriesToEntryManager(entries);
|
||||||
|
|
||||||
|
FooterView view = mock(FooterView.class);
|
||||||
|
mStackScroller.setFooterView(view);
|
||||||
mStackScroller.updateFooter();
|
mStackScroller.updateFooter();
|
||||||
verify(mStackScroller).updateFooterView(true, false);
|
verify(mStackScroller).updateFooterView(true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user