Loading packages/SystemUI/src/com/android/systemui/communal/CommunalHostViewController.java +15 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,21 @@ public class CommunalHostViewController extends ViewController<CommunalHostView> statusBarState, keyguardFadingAway, goingToFullShade, oldStatusBarState); } /** * Set keyguard status view alpha. */ public void setAlpha(float alpha) { if (!mKeyguardVisibilityHelper.isVisibilityAnimating()) { mView.setAlpha(alpha); // Some communal view implementations, such as SurfaceViews, do not behave correctly // inheriting the alpha of their parent. Directly set child alpha here to work around // this. for (int i = mView.getChildCount() - 1; i >= 0; --i) { mView.getChildAt(i).setAlpha(alpha); } } } @Override public void init() { super.init(); Loading packages/SystemUI/src/com/android/systemui/communal/service/CommunalSurfaceViewController.java +1 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,7 @@ public class CommunalSurfaceViewController extends ViewController<SurfaceView> { if (surfacePackage != null) { mView.setChildSurfacePackage(surfacePackage); mView.setZOrderOnTop(true); mView.setUseAlpha(); mView.postInvalidate(); mCommunalStateController.setCommunalViewShowing(true); } else { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +7 −0 Original line number Diff line number Diff line Loading @@ -1574,6 +1574,12 @@ public class NotificationPanelViewController extends PanelViewController { return true; } private void updateCommunal() { if (mCommunalViewController != null) { mCommunalViewController.setAlpha(mKeyguardOnlyContentAlpha); } } private void updateClock() { float alpha = mClockPositionResult.clockAlpha * mKeyguardOnlyContentAlpha; mKeyguardStatusViewController.setAlpha(alpha); Loading Loading @@ -2675,6 +2681,7 @@ public class NotificationPanelViewController extends PanelViewController { updateKeyguardBottomAreaAlpha(); } updateClock(); updateCommunal(); } private void trackMovement(MotionEvent event) { Loading packages/SystemUI/tests/src/com/android/systemui/communal/CommunalHostViewControllerTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,9 @@ public class CommunalHostViewControllerTest extends SysuiTestCase { @Mock private CommunalSource mCommunalSource; @Mock private View mChildView; @Before public void setup() { MockitoAnnotations.initMocks(this); Loading Loading @@ -211,4 +214,16 @@ public class CommunalHostViewControllerTest extends SysuiTestCase { // Verify state controller is notified communal view is hidden. verify(mCommunalStateController).setCommunalViewShowing(false); } @Test public void testAlphaPropagation() { final float alpha = 0.8f; // Ensure alpha setting is propagated to children. when(mCommunalView.getChildCount()).thenReturn(1); when(mCommunalView.getChildAt(0)).thenReturn(mChildView); mController.setAlpha(alpha); verify(mChildView).setAlpha(alpha); verify(mCommunalView).setAlpha(alpha); } } packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +9 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyFloat; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.atLeast; Loading Loading @@ -901,6 +902,14 @@ public class NotificationPanelViewTest extends SysuiTestCase { anyBoolean(), anyBoolean(), anyInt()); } @Test public void testCommunalAlphaUpdate() { // Verify keyguard content alpha changes are propagate. Note the actual value set is not // checked since an interpolation is applied to the incoming value. mNotificationPanelViewController.setKeyguardOnlyContentAlpha(0.8f); verify(mCommunalHostViewController).setAlpha(anyFloat()); } private void triggerPositionClockAndNotifications() { mNotificationPanelViewController.closeQs(); } Loading Loading
packages/SystemUI/src/com/android/systemui/communal/CommunalHostViewController.java +15 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,21 @@ public class CommunalHostViewController extends ViewController<CommunalHostView> statusBarState, keyguardFadingAway, goingToFullShade, oldStatusBarState); } /** * Set keyguard status view alpha. */ public void setAlpha(float alpha) { if (!mKeyguardVisibilityHelper.isVisibilityAnimating()) { mView.setAlpha(alpha); // Some communal view implementations, such as SurfaceViews, do not behave correctly // inheriting the alpha of their parent. Directly set child alpha here to work around // this. for (int i = mView.getChildCount() - 1; i >= 0; --i) { mView.getChildAt(i).setAlpha(alpha); } } } @Override public void init() { super.init(); Loading
packages/SystemUI/src/com/android/systemui/communal/service/CommunalSurfaceViewController.java +1 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,7 @@ public class CommunalSurfaceViewController extends ViewController<SurfaceView> { if (surfacePackage != null) { mView.setChildSurfacePackage(surfacePackage); mView.setZOrderOnTop(true); mView.setUseAlpha(); mView.postInvalidate(); mCommunalStateController.setCommunalViewShowing(true); } else { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +7 −0 Original line number Diff line number Diff line Loading @@ -1574,6 +1574,12 @@ public class NotificationPanelViewController extends PanelViewController { return true; } private void updateCommunal() { if (mCommunalViewController != null) { mCommunalViewController.setAlpha(mKeyguardOnlyContentAlpha); } } private void updateClock() { float alpha = mClockPositionResult.clockAlpha * mKeyguardOnlyContentAlpha; mKeyguardStatusViewController.setAlpha(alpha); Loading Loading @@ -2675,6 +2681,7 @@ public class NotificationPanelViewController extends PanelViewController { updateKeyguardBottomAreaAlpha(); } updateClock(); updateCommunal(); } private void trackMovement(MotionEvent event) { Loading
packages/SystemUI/tests/src/com/android/systemui/communal/CommunalHostViewControllerTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,9 @@ public class CommunalHostViewControllerTest extends SysuiTestCase { @Mock private CommunalSource mCommunalSource; @Mock private View mChildView; @Before public void setup() { MockitoAnnotations.initMocks(this); Loading Loading @@ -211,4 +214,16 @@ public class CommunalHostViewControllerTest extends SysuiTestCase { // Verify state controller is notified communal view is hidden. verify(mCommunalStateController).setCommunalViewShowing(false); } @Test public void testAlphaPropagation() { final float alpha = 0.8f; // Ensure alpha setting is propagated to children. when(mCommunalView.getChildCount()).thenReturn(1); when(mCommunalView.getChildAt(0)).thenReturn(mChildView); mController.setAlpha(alpha); verify(mChildView).setAlpha(alpha); verify(mCommunalView).setAlpha(alpha); } }
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +9 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyFloat; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.atLeast; Loading Loading @@ -901,6 +902,14 @@ public class NotificationPanelViewTest extends SysuiTestCase { anyBoolean(), anyBoolean(), anyInt()); } @Test public void testCommunalAlphaUpdate() { // Verify keyguard content alpha changes are propagate. Note the actual value set is not // checked since an interpolation is applied to the incoming value. mNotificationPanelViewController.setKeyguardOnlyContentAlpha(0.8f); verify(mCommunalHostViewController).setAlpha(anyFloat()); } private void triggerPositionClockAndNotifications() { mNotificationPanelViewController.closeQs(); } Loading