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

Commit f6aad9b2 authored by Liran Binyamin's avatar Liran Binyamin Committed by Android (Google) Code Review
Browse files

Merge "Update DragZoneFactory to flag gate full screen zones" into main

parents 36d43fd8 2ed348b6
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 =