Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java +14 −14 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableView; import com.android.systemui.statusbar.phone.KeyguardBypassController; import java.util.HashSet; Loading @@ -40,27 +39,24 @@ public class NotificationRoundnessManager { private final ExpandableView[] mLastInSectionViews; private final ExpandableView[] mTmpFirstInSectionViews; private final ExpandableView[] mTmpLastInSectionViews; private final KeyguardBypassController mBypassController; private boolean mExpanded; private HashSet<ExpandableView> mAnimatedChildren; private Runnable mRoundingChangedCallback; private ExpandableNotificationRow mTrackedHeadsUp; private float mAppearFraction; private boolean mRoundForPulsingViews; private ExpandableView mSwipedView = null; private ExpandableView mViewBeforeSwipedView = null; private ExpandableView mViewAfterSwipedView = null; @Inject NotificationRoundnessManager( KeyguardBypassController keyguardBypassController, NotificationSectionsFeatureManager sectionsFeatureManager) { NotificationRoundnessManager(NotificationSectionsFeatureManager sectionsFeatureManager) { int numberOfSections = sectionsFeatureManager.getNumberOfBuckets(); mFirstInSectionViews = new ExpandableView[numberOfSections]; mLastInSectionViews = new ExpandableView[numberOfSections]; mTmpFirstInSectionViews = new ExpandableView[numberOfSections]; mTmpLastInSectionViews = new ExpandableView[numberOfSections]; mBypassController = keyguardBypassController; } public void updateView(ExpandableView view, boolean animate) { Loading @@ -85,8 +81,8 @@ public class NotificationRoundnessManager { return false; } final float topRoundness = getRoundness(view, true /* top */); final float bottomRoundness = getRoundness(view, false /* top */); final float topRoundness = getRoundnessFraction(view, true /* top */); final float bottomRoundness = getRoundnessFraction(view, false /* top */); final boolean topChanged = view.setTopRoundness(topRoundness, animate); final boolean bottomChanged = view.setBottomRoundness(bottomRoundness, animate); Loading Loading @@ -131,7 +127,7 @@ public class NotificationRoundnessManager { ExpandableView oldViewBefore = mViewBeforeSwipedView; mViewBeforeSwipedView = viewBefore; if (oldViewBefore != null) { final float bottomRoundness = getRoundness(oldViewBefore, false /* top */); final float bottomRoundness = getRoundnessFraction(oldViewBefore, false /* top */); oldViewBefore.setBottomRoundness(bottomRoundness, animate); } if (viewBefore != null) { Loading @@ -141,8 +137,8 @@ public class NotificationRoundnessManager { ExpandableView oldSwipedview = mSwipedView; mSwipedView = viewSwiped; if (oldSwipedview != null) { final float bottomRoundness = getRoundness(oldSwipedview, false /* top */); final float topRoundness = getRoundness(oldSwipedview, true /* top */); final float bottomRoundness = getRoundnessFraction(oldSwipedview, false /* top */); final float topRoundness = getRoundnessFraction(oldSwipedview, true /* top */); oldSwipedview.setTopRoundness(topRoundness, animate); oldSwipedview.setBottomRoundness(bottomRoundness, animate); } Loading @@ -154,7 +150,7 @@ public class NotificationRoundnessManager { ExpandableView oldViewAfter = mViewAfterSwipedView; mViewAfterSwipedView = viewAfter; if (oldViewAfter != null) { final float topRoundness = getRoundness(oldViewAfter, true /* top */); final float topRoundness = getRoundnessFraction(oldViewAfter, true /* top */); oldViewAfter.setTopRoundness(topRoundness, animate); } if (viewAfter != null) { Loading @@ -162,7 +158,7 @@ public class NotificationRoundnessManager { } } private float getRoundness(ExpandableView view, boolean top) { private float getRoundnessFraction(ExpandableView view, boolean top) { if (view == null) { return 0f; } Loading @@ -186,7 +182,7 @@ public class NotificationRoundnessManager { // rounded. return MathUtils.saturate(1.0f - mAppearFraction); } if (view.showingPulsing() && !mBypassController.getBypassEnabled()) { if (view.showingPulsing() && mRoundForPulsingViews) { return 1.0f; } final Resources resources = view.getResources(); Loading Loading @@ -289,4 +285,8 @@ public class NotificationRoundnessManager { updateView(previous, true /* animate */); } } public void setShouldRoundPulsingViews(boolean shouldRoundPulsingViews) { mRoundForPulsingViews = shouldRoundPulsingViews; } } packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +5 −0 Original line number Diff line number Diff line Loading @@ -698,6 +698,11 @@ public class NotificationStackScrollLayoutController { }); mView.setShadeController(mShadeController); mKeyguardBypassController.registerOnBypassStateChangedListener( isEnabled -> mNotificationRoundnessManager.setShouldRoundPulsingViews(!isEnabled)); mNotificationRoundnessManager.setShouldRoundPulsingViews( !mKeyguardBypassController.getBypassEnabled()); if (mFgFeatureController.isForegroundServiceDismissalEnabled()) { mView.initializeForegroundServiceSection( (ForegroundServiceDungeonView) mFgServicesSectionController.createView( Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java +1 −5 Original line number Diff line number Diff line Loading @@ -37,14 +37,12 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableView; import com.android.systemui.statusbar.notification.row.NotificationTestHelper; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.util.DeviceConfigProxy; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.util.HashSet; Loading @@ -59,8 +57,6 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase { private Runnable mRoundnessCallback = mock(Runnable.class); private ExpandableNotificationRow mFirst; private ExpandableNotificationRow mSecond; @Mock private KeyguardBypassController mBypassController; private float mSmallRadiusRatio; @Before Loading @@ -70,7 +66,6 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase { mSmallRadiusRatio = resources.getDimension(R.dimen.notification_corner_radius_small) / resources.getDimension(R.dimen.notification_corner_radius); mRoundnessManager = new NotificationRoundnessManager( mBypassController, new NotificationSectionsFeatureManager(new DeviceConfigProxy(), mContext)); allowTestableLooperAsMainThread(); NotificationTestHelper testHelper = new NotificationTestHelper( Loading @@ -90,6 +85,7 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase { createSection(null, null) }); mRoundnessManager.setExpanded(1.0f, 1.0f); mRoundnessManager.setShouldRoundPulsingViews(true); reset(mRoundnessCallback); } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java +14 −14 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableView; import com.android.systemui.statusbar.phone.KeyguardBypassController; import java.util.HashSet; Loading @@ -40,27 +39,24 @@ public class NotificationRoundnessManager { private final ExpandableView[] mLastInSectionViews; private final ExpandableView[] mTmpFirstInSectionViews; private final ExpandableView[] mTmpLastInSectionViews; private final KeyguardBypassController mBypassController; private boolean mExpanded; private HashSet<ExpandableView> mAnimatedChildren; private Runnable mRoundingChangedCallback; private ExpandableNotificationRow mTrackedHeadsUp; private float mAppearFraction; private boolean mRoundForPulsingViews; private ExpandableView mSwipedView = null; private ExpandableView mViewBeforeSwipedView = null; private ExpandableView mViewAfterSwipedView = null; @Inject NotificationRoundnessManager( KeyguardBypassController keyguardBypassController, NotificationSectionsFeatureManager sectionsFeatureManager) { NotificationRoundnessManager(NotificationSectionsFeatureManager sectionsFeatureManager) { int numberOfSections = sectionsFeatureManager.getNumberOfBuckets(); mFirstInSectionViews = new ExpandableView[numberOfSections]; mLastInSectionViews = new ExpandableView[numberOfSections]; mTmpFirstInSectionViews = new ExpandableView[numberOfSections]; mTmpLastInSectionViews = new ExpandableView[numberOfSections]; mBypassController = keyguardBypassController; } public void updateView(ExpandableView view, boolean animate) { Loading @@ -85,8 +81,8 @@ public class NotificationRoundnessManager { return false; } final float topRoundness = getRoundness(view, true /* top */); final float bottomRoundness = getRoundness(view, false /* top */); final float topRoundness = getRoundnessFraction(view, true /* top */); final float bottomRoundness = getRoundnessFraction(view, false /* top */); final boolean topChanged = view.setTopRoundness(topRoundness, animate); final boolean bottomChanged = view.setBottomRoundness(bottomRoundness, animate); Loading Loading @@ -131,7 +127,7 @@ public class NotificationRoundnessManager { ExpandableView oldViewBefore = mViewBeforeSwipedView; mViewBeforeSwipedView = viewBefore; if (oldViewBefore != null) { final float bottomRoundness = getRoundness(oldViewBefore, false /* top */); final float bottomRoundness = getRoundnessFraction(oldViewBefore, false /* top */); oldViewBefore.setBottomRoundness(bottomRoundness, animate); } if (viewBefore != null) { Loading @@ -141,8 +137,8 @@ public class NotificationRoundnessManager { ExpandableView oldSwipedview = mSwipedView; mSwipedView = viewSwiped; if (oldSwipedview != null) { final float bottomRoundness = getRoundness(oldSwipedview, false /* top */); final float topRoundness = getRoundness(oldSwipedview, true /* top */); final float bottomRoundness = getRoundnessFraction(oldSwipedview, false /* top */); final float topRoundness = getRoundnessFraction(oldSwipedview, true /* top */); oldSwipedview.setTopRoundness(topRoundness, animate); oldSwipedview.setBottomRoundness(bottomRoundness, animate); } Loading @@ -154,7 +150,7 @@ public class NotificationRoundnessManager { ExpandableView oldViewAfter = mViewAfterSwipedView; mViewAfterSwipedView = viewAfter; if (oldViewAfter != null) { final float topRoundness = getRoundness(oldViewAfter, true /* top */); final float topRoundness = getRoundnessFraction(oldViewAfter, true /* top */); oldViewAfter.setTopRoundness(topRoundness, animate); } if (viewAfter != null) { Loading @@ -162,7 +158,7 @@ public class NotificationRoundnessManager { } } private float getRoundness(ExpandableView view, boolean top) { private float getRoundnessFraction(ExpandableView view, boolean top) { if (view == null) { return 0f; } Loading @@ -186,7 +182,7 @@ public class NotificationRoundnessManager { // rounded. return MathUtils.saturate(1.0f - mAppearFraction); } if (view.showingPulsing() && !mBypassController.getBypassEnabled()) { if (view.showingPulsing() && mRoundForPulsingViews) { return 1.0f; } final Resources resources = view.getResources(); Loading Loading @@ -289,4 +285,8 @@ public class NotificationRoundnessManager { updateView(previous, true /* animate */); } } public void setShouldRoundPulsingViews(boolean shouldRoundPulsingViews) { mRoundForPulsingViews = shouldRoundPulsingViews; } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +5 −0 Original line number Diff line number Diff line Loading @@ -698,6 +698,11 @@ public class NotificationStackScrollLayoutController { }); mView.setShadeController(mShadeController); mKeyguardBypassController.registerOnBypassStateChangedListener( isEnabled -> mNotificationRoundnessManager.setShouldRoundPulsingViews(!isEnabled)); mNotificationRoundnessManager.setShouldRoundPulsingViews( !mKeyguardBypassController.getBypassEnabled()); if (mFgFeatureController.isForegroundServiceDismissalEnabled()) { mView.initializeForegroundServiceSection( (ForegroundServiceDungeonView) mFgServicesSectionController.createView( Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java +1 −5 Original line number Diff line number Diff line Loading @@ -37,14 +37,12 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableView; import com.android.systemui.statusbar.notification.row.NotificationTestHelper; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.util.DeviceConfigProxy; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.util.HashSet; Loading @@ -59,8 +57,6 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase { private Runnable mRoundnessCallback = mock(Runnable.class); private ExpandableNotificationRow mFirst; private ExpandableNotificationRow mSecond; @Mock private KeyguardBypassController mBypassController; private float mSmallRadiusRatio; @Before Loading @@ -70,7 +66,6 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase { mSmallRadiusRatio = resources.getDimension(R.dimen.notification_corner_radius_small) / resources.getDimension(R.dimen.notification_corner_radius); mRoundnessManager = new NotificationRoundnessManager( mBypassController, new NotificationSectionsFeatureManager(new DeviceConfigProxy(), mContext)); allowTestableLooperAsMainThread(); NotificationTestHelper testHelper = new NotificationTestHelper( Loading @@ -90,6 +85,7 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase { createSection(null, null) }); mRoundnessManager.setExpanded(1.0f, 1.0f); mRoundnessManager.setShouldRoundPulsingViews(true); reset(mRoundnessCallback); } Loading