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

Commit 2ed348b6 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Update DragZoneFactory to flag gate full screen zones

Bug: 416297506
Flag: com.android.wm.shell.enable_bubble_to_fullscreen
Test: atest DragZoneFactoryTest
Test: atest DragZoneFactoryScreenshotTest

Change-Id: I87c93ee5a22394089112095de17b4e3ec45af0a9
parent 6c53f5ce
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ android_test {
        "truth",
        "platform-parametric-runner-lib",
        "platform-screenshot-diff-core",
        "platform-test-annotations",
        "platform-test-rules",
    ],
    libs: [
        "android.test.base.stubs.system",
+7 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import android.content.Context
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable
import android.platform.test.annotations.EnableFlags
import android.platform.test.flag.junit.SetFlagsRule
import android.view.View
import android.view.WindowManager
import android.widget.FrameLayout
@@ -29,6 +31,8 @@ import androidx.core.graphics.green
import androidx.core.graphics.red
import androidx.core.graphics.toColorInt
import androidx.test.core.app.ApplicationProvider.getApplicationContext
import com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_TO_FULLSCREEN
import com.android.wm.shell.Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE
import com.android.wm.shell.shared.bubbles.DragZoneFactory.BubbleBarPropertiesProvider
import com.android.wm.shell.shared.bubbles.DragZoneFactory.DesktopWindowModeChecker
import com.android.wm.shell.shared.bubbles.DragZoneFactory.SplitScreenModeChecker
@@ -45,6 +49,7 @@ import platform.test.screenshot.ViewScreenshotTestRule
import platform.test.screenshot.ViewScreenshotTestRule.Mode
import platform.test.screenshot.getEmulatedDevicePathConfig

@EnableFlags(FLAG_ENABLE_BUBBLE_TO_FULLSCREEN, FLAG_ENABLE_CREATE_ANY_BUBBLE)
@RunWith(ParameterizedAndroidJunit4::class)
class DragZoneFactoryScreenshotTest(private val param: Param) {
    companion object {
@@ -108,6 +113,8 @@ class DragZoneFactoryScreenshotTest(private val param: Param) {
        override fun toString() = "${emulationSpec}_$testName"
    }

    @get:Rule val flagsRule = SetFlagsRule()

    @get:Rule
    val screenshotRule =
        ViewScreenshotTestRule(
+6 −2
Original line number Diff line number Diff line
@@ -220,7 +220,9 @@ class DragZoneFactory(
            is DraggedObject.Bubble -> {
                dragZones.add(createDismissDragZone())
                dragZones.addAll(createBubbleCornerDragZones())
                if (BubbleAnythingFlagHelper.enableBubbleToFullscreen()) {
                    dragZones.add(createFullScreenDragZone())
                }
                if (shouldShowDesktopWindowDragZones()) {
                    dragZones.add(createDesktopWindowDragZoneForBubble())
                }
@@ -228,7 +230,9 @@ class DragZoneFactory(
            }
            is DraggedObject.ExpandedView -> {
                dragZones.add(createDismissDragZone())
                if (BubbleAnythingFlagHelper.enableBubbleToFullscreen()) {
                    dragZones.add(createFullScreenDragZone())
                }
                if (shouldShowDesktopWindowDragZones()) {
                    dragZones.add(createDesktopWindowDragZoneForExpandedView())
                }
+8 −0
Original line number Diff line number Diff line
@@ -19,24 +19,32 @@ package com.android.wm.shell.shared.bubbles
import android.content.Context
import android.graphics.Insets
import android.graphics.Rect
import android.platform.test.annotations.EnableFlags
import android.platform.test.flag.junit.SetFlagsRule
import androidx.test.core.app.ApplicationProvider.getApplicationContext
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_TO_FULLSCREEN
import com.android.wm.shell.Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE
import com.android.wm.shell.shared.bubbles.DragZoneFactory.BubbleBarPropertiesProvider
import com.android.wm.shell.shared.bubbles.DragZoneFactory.DesktopWindowModeChecker
import com.android.wm.shell.shared.bubbles.DragZoneFactory.SplitScreenModeChecker
import com.android.wm.shell.shared.bubbles.DragZoneFactory.SplitScreenModeChecker.SplitScreenMode
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

private typealias DragZoneVerifier = (dragZone: DragZone) -> Unit

@SmallTest
@EnableFlags(FLAG_ENABLE_BUBBLE_TO_FULLSCREEN, FLAG_ENABLE_CREATE_ANY_BUBBLE)
@RunWith(AndroidJUnit4::class)
/** Unit tests for [DragZoneFactory]. */
class DragZoneFactoryTest {

    @get:Rule val flagsRule = SetFlagsRule()

    private val context = getApplicationContext<Context>()
    private lateinit var dragZoneFactory: DragZoneFactory
    private val tabletPortrait =