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

Commit d44df344 authored by jasonwshsu's avatar jasonwshsu
Browse files

[Drag To Hide] Fix test case fail

Root Cause: onDetachedFromWindow_menuIsGone will fail due to menuView is visible with no content under drag to hide feature enabled
Solution: Don't need to show menuView if there is no content contains

Bug: 298718415
Flag: ACONFIG com.android.systemui.floating_menu_drag_to_hide DEVELOPMENT
Test: atest MenuViewLayerTest
Change-Id: Id5abc9965fe468bd2c2c0890bd1256009dbd9473
parent 6bf8e9bd
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -240,7 +240,9 @@ class MenuViewLayer extends FrameLayout implements
        mMenuView.setOnTargetFeaturesChangeListener(newTargetFeatures -> {
            if (Flags.floatingMenuDragToHide()) {
                dismissNotification();
                if (newTargetFeatures.size() > 0) {
                    undo();
                }
            } else {
                if (newTargetFeatures.size() < 1) {
                    return;
+3 −3
Original line number Diff line number Diff line
@@ -187,16 +187,16 @@ public class MenuViewLayerTest extends SysuiTestCase {
    @Test
    public void onAttachedToWindow_menuIsVisible() {
        mMenuViewLayer.onAttachedToWindow();
        final View menuView = mMenuViewLayer.getChildAt(LayerIndex.MENU_VIEW);

        final View menuView = mMenuViewLayer.getChildAt(LayerIndex.MENU_VIEW);
        assertThat(menuView.getVisibility()).isEqualTo(VISIBLE);
    }

    @Test
    public void onAttachedToWindow_menuIsGone() {
    public void onDetachedFromWindow_menuIsGone() {
        mMenuViewLayer.onDetachedFromWindow();
        final View menuView = mMenuViewLayer.getChildAt(LayerIndex.MENU_VIEW);

        final View menuView = mMenuViewLayer.getChildAt(LayerIndex.MENU_VIEW);
        assertThat(menuView.getVisibility()).isEqualTo(GONE);
    }