Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a8531e3 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Make control panel black

Background is now black, when showing home controls, without changing
the UI for legacy experiences.

Test: atest NotificationShadeDepthControllerTest
Test: open power menu on lock screen and home screen
Fixes: 151950882
Change-Id: Ieb183f9200a7eba8790640f863a0c7324d3b6faa
parent fc294e86
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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>
+10 −4
Original line number Diff line number Diff line
@@ -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,9 +1781,13 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
            }
            if (mBackgroundDrawable == null) {
                mBackgroundDrawable = new ScrimDrawable();
                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 |
+9 −1
Original line number Diff line number Diff line
@@ -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,
+16 −1
Original line number Diff line number Diff line
@@ -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)