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

Commit 7fb48017 authored by Ömer Faruk Yılmaz's avatar Ömer Faruk Yılmaz
Browse files

Add CheckFlagsRule to tests with `@RequiresFlags[Enabled|Disabled]`

To enable Global lint CheckFlagsRuleDetector, we need to first fix
(or baseline) all existing errors.

For context on the development of this new lint, see b/430031210.

Bug: 435371380
Test: m FunctionalTestsDesktopMode
Flag: EXEMPT test change
Change-Id: I1a84034c760788d0c38196ddc6dc047ee5c42e55
parent 1f8bbc65
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.wm.shell.scenarios

import android.app.Instrumentation
import android.platform.test.annotations.RequiresFlagsEnabled
import android.platform.test.flag.junit.DeviceFlagsValueProvider
import android.provider.Settings
import android.tools.traces.parsers.WindowManagerStateHelper
import androidx.test.platform.app.InstrumentationRegistry
@@ -44,8 +43,7 @@ abstract class DisableDisplayMirroringSwitch : TestScenarioBase() {
    private val wmHelper = WindowManagerStateHelper(instrumentation)
    private val tapl = LauncherInstrumentation()

    @get:Rule(order = 0) val checkFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()
    @get:Rule(order = 1) val connectedDisplayRule = SimulatedConnectedDisplayTestRule()
    @get:Rule val connectedDisplayRule = SimulatedConnectedDisplayTestRule()

    @Before
    fun setup() {
+2 −4
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.wm.shell.scenarios

import android.app.Instrumentation
import android.platform.test.annotations.RequiresFlagsEnabled
import android.platform.test.flag.junit.DeviceFlagsValueProvider
import android.provider.Settings
import android.tools.traces.parsers.WindowManagerStateHelper
import androidx.test.platform.app.InstrumentationRegistry
@@ -44,8 +43,7 @@ abstract class EnableDisplayMirroringSwitch : TestScenarioBase() {
    private val wmHelper = WindowManagerStateHelper(instrumentation)
    private val tapl = LauncherInstrumentation()

    @get:Rule(order = 0) val checkFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()
    @get:Rule(order = 1) val connectedDisplayRule = SimulatedConnectedDisplayTestRule()
    @get:Rule val connectedDisplayRule = SimulatedConnectedDisplayTestRule()

    @Before
    fun setup() {
+1 −6
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.wm.shell.scenarios

import android.app.Instrumentation
import android.platform.test.annotations.RequiresFlagsEnabled
import android.platform.test.flag.junit.DeviceFlagsValueProvider
import android.tools.Rotation
import android.tools.traces.parsers.WindowManagerStateHelper
import androidx.test.platform.app.InstrumentationRegistry
@@ -51,11 +50,7 @@ abstract class MaximizeAppWindowWithDragToTopDragZoneInDesktopFirst(
    private val device = UiDevice.getInstance(instrumentation)
    val testApp = DesktopModeAppHelper(SimpleAppHelper(instrumentation))

    @get:Rule(order = 0)
    val checkFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()

    @get:Rule(order = 1)
    val connectedDisplayRule = SimulatedConnectedDisplayTestRule()
    @get:Rule val connectedDisplayRule = SimulatedConnectedDisplayTestRule()

    @Before
    fun setup() {
+1 −7
Original line number Diff line number Diff line
@@ -17,12 +17,10 @@
package com.android.wm.shell.scenarios

import android.app.Instrumentation
import android.platform.test.flag.junit.DeviceFlagsValueProvider
import android.tools.Rotation
import android.tools.traces.parsers.WindowManagerStateHelper
import android.window.DesktopExperienceFlags
import androidx.test.platform.app.InstrumentationRegistry
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.server.wm.flicker.helpers.DesktopModeAppHelper
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.wm.shell.ExtendedDisplaySettingsSession
@@ -48,11 +46,7 @@ constructor(private val rotation: Rotation = Rotation.ROTATION_0) : TestScenario
    private val extendedDisplaySettingsSession =
        ExtendedDisplaySettingsSession(instrumentation.context.contentResolver)

    @get:Rule(order = 0)
    val checkFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()

    @get:Rule(order = 1)
    val connectedDisplayRule = SimulatedConnectedDisplayTestRule()
    @get:Rule val connectedDisplayRule = SimulatedConnectedDisplayTestRule()

    @Before
    fun setup() {
+1 −3
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.wm.shell.scenarios

import android.platform.test.annotations.RequiresFlagsEnabled
import android.platform.test.flag.junit.DeviceFlagsValueProvider
import com.android.window.flags.Flags
import org.junit.After
import org.junit.Assume.assumeTrue
@@ -38,8 +37,7 @@ abstract class RestartAppInDesktopMode(
    isLandscapeApp: Boolean = true,
) : DesktopScenarioCustomAppTestBase(isResizable, isLandscapeApp) {

    @get:Rule(order = 0) val checkFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()
    @get:Rule(order = 1) val connectedDisplayRule = SimulatedConnectedDisplayTestRule()
    @get:Rule val connectedDisplayRule = SimulatedConnectedDisplayTestRule()

    @Before
    fun setup() {
Loading