Merge "Update redaction upon profile changes" into qt-dev

This commit is contained in:
Lucas Dupin
2020-02-03 23:37:07 +00:00
committed by Android (Google) Code Review
2 changed files with 21 additions and 2 deletions

View File

@@ -566,6 +566,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
mRoundnessManager.setAnimatedChildren(mChildrenToAddAnimated); mRoundnessManager.setAnimatedChildren(mChildrenToAddAnimated);
mRoundnessManager.setOnRoundingChangedCallback(this::invalidate); mRoundnessManager.setOnRoundingChangedCallback(this::invalidate);
addOnExpandedHeightListener(mRoundnessManager::setExpanded); addOnExpandedHeightListener(mRoundnessManager::setExpanded);
mLockscreenUserManager.addUserChangedListener(userId ->
updateSensitiveness(false /* animated */));
setOutlineProvider(mOutlineProvider); setOutlineProvider(mOutlineProvider);
// Blocking helper manager wants to know the expanded state, update as well. // Blocking helper manager wants to know the expanded state, update as well.
@@ -4567,7 +4569,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
} }
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW) @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private void setHideSensitive(boolean hideSensitive, boolean animate) { private void updateSensitiveness(boolean animate) {
boolean hideSensitive = mLockscreenUserManager.isAnyProfilePublicMode();
if (hideSensitive != mAmbientState.isHideSensitive()) { if (hideSensitive != mAmbientState.isHideSensitive()) {
int childCount = getChildCount(); int childCount = getChildCount();
for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) {
@@ -5331,7 +5334,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
SysuiStatusBarStateController state = (SysuiStatusBarStateController) SysuiStatusBarStateController state = (SysuiStatusBarStateController)
Dependency.get(StatusBarStateController.class); Dependency.get(StatusBarStateController.class);
setHideSensitive(publicMode, state.goingToFullShade() /* animate */); updateSensitiveness(state.goingToFullShade() /* animate */);
setDimmed(onKeyguard, state.fromShadeLocked() /* animate */); setDimmed(onKeyguard, state.fromShadeLocked() /* animate */);
setExpandingEnabled(!onKeyguard); setExpandingEnabled(!onKeyguard);
ActivatableNotificationView activatedChild = getActivatedChild(); ActivatableNotificationView activatedChild = getActivatedChild();

View File

@@ -57,6 +57,8 @@ import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.AmbientPulseManager; import com.android.systemui.statusbar.AmbientPulseManager;
import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.EmptyShadeView;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationLockscreenUserManager.UserChangedListener;
import com.android.systemui.statusbar.NotificationPresenter; import com.android.systemui.statusbar.NotificationPresenter;
import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.NotificationShelf;
@@ -117,6 +119,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
@Mock private NotificationIconAreaController mNotificationIconAreaController; @Mock private NotificationIconAreaController mNotificationIconAreaController;
@Mock private MetricsLogger mMetricsLogger; @Mock private MetricsLogger mMetricsLogger;
@Mock private NotificationRoundnessManager mNotificationRoundnessManager; @Mock private NotificationRoundnessManager mNotificationRoundnessManager;
@Mock private NotificationLockscreenUserManager mLockscreenUserManager;
private UserChangedListener mUserChangedListener;
private TestableNotificationEntryManager mEntryManager; private TestableNotificationEntryManager mEntryManager;
private int mOriginalInterruptionModelSetting; private int mOriginalInterruptionModelSetting;
@@ -135,6 +139,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
mDependency.injectTestDependency( mDependency.injectTestDependency(
NotificationBlockingHelperManager.class, NotificationBlockingHelperManager.class,
mBlockingHelperManager); mBlockingHelperManager);
mDependency.injectTestDependency(NotificationLockscreenUserManager.class,
mLockscreenUserManager);
mDependency.injectTestDependency(StatusBarStateController.class, mBarState); mDependency.injectTestDependency(StatusBarStateController.class, mBarState);
mDependency.injectTestDependency(MetricsLogger.class, mMetricsLogger); mDependency.injectTestDependency(MetricsLogger.class, mMetricsLogger);
mDependency.injectTestDependency(NotificationRemoteInputManager.class, mDependency.injectTestDependency(NotificationRemoteInputManager.class,
@@ -150,6 +156,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
NotificationShelf notificationShelf = mock(NotificationShelf.class); NotificationShelf notificationShelf = mock(NotificationShelf.class);
ArgumentCaptor<UserChangedListener> userChangedCaptor = ArgumentCaptor
.forClass(UserChangedListener.class);
// The actual class under test. You may need to work with this class directly when // The actual class under test. You may need to work with this class directly when
// testing anonymous class members of mStackScroller, like mMenuEventListener, // testing anonymous class members of mStackScroller, like mMenuEventListener,
@@ -171,6 +179,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
mStackScroller.setGroupManager(mGroupManager); mStackScroller.setGroupManager(mGroupManager);
mStackScroller.setEmptyShadeView(mEmptyShadeView); mStackScroller.setEmptyShadeView(mEmptyShadeView);
mStackScroller.setIconAreaController(mNotificationIconAreaController); mStackScroller.setIconAreaController(mNotificationIconAreaController);
verify(mLockscreenUserManager).addUserChangedListener(userChangedCaptor.capture());
mUserChangedListener = userChangedCaptor.getValue();
// Stub out functionality that isn't necessary to test. // Stub out functionality that isn't necessary to test.
doNothing().when(mBar) doNothing().when(mBar)
@@ -255,6 +265,12 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
verify(mBlockingHelperManager).setNotificationShadeExpanded(100f); verify(mBlockingHelperManager).setNotificationShadeExpanded(100f);
} }
@Test
public void testOnStatePostChange_verifyIfProfileIsPublic() {
mUserChangedListener.onUserChanged(0);
verify(mLockscreenUserManager).isAnyProfilePublicMode();
}
@Test @Test
public void manageNotifications_visible() { public void manageNotifications_visible() {
FooterView view = mock(FooterView.class); FooterView view = mock(FooterView.class);