Merge "Make control panel black" into rvc-dev

This commit is contained in:
Lucas Dupin
2020-04-07 16:12:09 +00:00
committed by Android (Google) Code Review
4 changed files with 39 additions and 10 deletions

View File

@@ -27,7 +27,7 @@
android:paddingRight="@dimen/global_actions_grid_item_side_margin"
android:layout_marginRight="3dp"
android:layout_marginLeft="3dp"
android:background="@drawable/rounded_bg_full">
android:background="@drawable/control_background">
<LinearLayout
android:layout_width="@dimen/global_actions_grid_item_width"
android:layout_height="@dimen/global_actions_grid_item_height"
@@ -42,7 +42,7 @@
android:layout_marginLeft="@dimen/global_actions_grid_item_icon_side_margin"
android:layout_marginRight="@dimen/global_actions_grid_item_icon_side_margin"
android:scaleType="centerInside"
android:tint="@color/global_actions_text" />
android:tint="@color/control_default_foreground" />
<TextView
android:id="@*android:id/message"
@@ -53,7 +53,7 @@
android:singleLine="true"
android:gravity="center"
android:textSize="12dp"
android:textColor="@color/global_actions_text"
android:textColor="@color/control_default_foreground"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
@@ -62,7 +62,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/global_actions_text"
android:textColor="@color/control_default_foreground"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</LinearLayout>

View File

@@ -489,6 +489,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
mAdapter = new MyAdapter();
mDepthController.setShowingHomeControls(shouldShowControls());
ActionsDialog dialog = new ActionsDialog(mContext, mAdapter, getWalletPanelViewController(),
mDepthController, mSysuiColorExtractor, mStatusBarService,
mNotificationShadeWindowController,
@@ -1780,8 +1781,12 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
}
if (mBackgroundDrawable == null) {
mBackgroundDrawable = new ScrimDrawable();
mScrimAlpha = mBlurUtils.supportsBlursOnWindows()
? ScrimController.BLUR_SCRIM_ALPHA : ScrimController.BUSY_SCRIM_ALPHA;
if (mControlsUiController != null) {
mScrimAlpha = 1.0f;
} else {
mScrimAlpha = mBlurUtils.supportsBlursOnWindows()
? ScrimController.BLUR_SCRIM_ALPHA : ScrimController.BUSY_SCRIM_ALPHA;
}
}
getWindow().setBackgroundDrawable(mBackgroundDrawable);
}
@@ -1841,8 +1846,9 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
if (!(mBackgroundDrawable instanceof ScrimDrawable)) {
return;
}
((ScrimDrawable) mBackgroundDrawable).setColor(colors.supportsDarkText() ? Color.WHITE
: Color.BLACK, animate);
boolean hasControls = mControlsUiController != null;
((ScrimDrawable) mBackgroundDrawable).setColor(
!hasControls && colors.supportsDarkText() ? Color.WHITE : Color.BLACK, animate);
View decorView = getWindow().getDecorView();
if (colors.supportsDarkText()) {
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR |

View File

@@ -74,6 +74,7 @@ class NotificationShadeDepthController @Inject constructor(
var shadeSpring = DepthAnimation()
@VisibleForTesting
var globalActionsSpring = DepthAnimation()
var showingHomeControls: Boolean = false
@VisibleForTesting
var brightnessMirrorSpring = DepthAnimation()
@@ -133,7 +134,14 @@ class NotificationShadeDepthController @Inject constructor(
shadeRadius = 0f
}
}
val blur = max(shadeRadius.toInt(), globalActionsSpring.radius)
// Home controls have black background, this means that we should not have blur when they
// are fully visible, otherwise we'll enter Client Composition unnecessarily.
var globalActionsRadius = globalActionsSpring.radius
if (showingHomeControls) {
globalActionsRadius = 0
}
val blur = max(shadeRadius.toInt(), globalActionsRadius)
blurUtils.applyBlur(blurRoot?.viewRootImpl ?: root.viewRootImpl, blur)
try {
wallpaperManager.setWallpaperZoomOut(root.windowToken,

View File

@@ -117,11 +117,26 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
}
@Test
fun updateGlobalDialogVisibility_appliesBlur() {
fun updateGlobalDialogVisibility_animatesBlur() {
notificationShadeDepthController.updateGlobalDialogVisibility(0.5f, root)
verify(globalActionsSpring).animateTo(eq(maxBlur / 2), safeEq(root))
}
@Test
fun updateGlobalDialogVisibility_appliesBlur_withoutHomeControls() {
`when`(globalActionsSpring.radius).thenReturn(maxBlur)
notificationShadeDepthController.updateBlurCallback.doFrame(0)
verify(blurUtils).applyBlur(any(), eq(maxBlur))
}
@Test
fun updateGlobalDialogVisibility_appliesBlur_unlessHomeControls() {
notificationShadeDepthController.showingHomeControls = true
`when`(globalActionsSpring.radius).thenReturn(maxBlur)
notificationShadeDepthController.updateBlurCallback.doFrame(0)
verify(blurUtils).applyBlur(any(), eq(0))
}
@Test
fun updateBlurCallback_setsBlurAndZoom() {
notificationShadeDepthController.updateBlurCallback.doFrame(0)