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

Commit 3a989797 authored by Nataniel Borges's avatar Nataniel Borges
Browse files

[DO NOT MERGE] Compatibilize UDC dev to master

This is a marge of all CLs from

https://googleplex-android-review.git.corp.google.com/q/topic:%22flicker-ir%22

Test: atest FlickerLibTests
Bug: 262369733
Change-Id: I563ce33a9acac70cf4ffc2ad6a5c12fce4506987
parent 189d4f92
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ android_test {
    static_libs: [
        "androidx.test.ext.junit",
        "flickerlib",
        "flickerlib-apphelpers",
        "flickerlib-helpers",
        "truth-prebuilt",
        "app-helpers-core",
        "launcher-helper-lib",
+4 −0
Original line number Diff line number Diff line
@@ -24,7 +24,11 @@
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
        <option name="run-command" value="settings put secure show_ime_with_hard_keyboard 1" />
        <option name="run-command" value="settings put system show_touches 1" />
        <option name="run-command" value="settings put system pointer_location 1" />
        <option name="teardown-command" value="settings delete secure show_ime_with_hard_keyboard" />
        <option name="teardown-command" value="settings delete system show_touches" />
        <option name="teardown-command" value="settings delete system pointer_location" />
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
        <option name="cleanup-apks" value="true"/>
+4 −4
Original line number Diff line number Diff line
@@ -18,12 +18,13 @@ package com.android.wm.shell.flicker

import android.app.Instrumentation
import android.platform.test.annotations.Presubmit
import android.tools.common.datatypes.component.ComponentNameMatcher
import android.tools.device.flicker.junit.FlickerBuilderProvider
import android.tools.device.flicker.legacy.FlickerBuilder
import android.tools.device.flicker.legacy.FlickerTest
import androidx.test.platform.app.InstrumentationRegistry
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.server.wm.flicker.FlickerBuilder
import com.android.server.wm.flicker.FlickerTest
import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.junit.FlickerBuilderProvider
import com.android.server.wm.flicker.navBarLayerIsVisibleAtStartAndEnd
import com.android.server.wm.flicker.navBarLayerPositionAtStartAndEnd
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
@@ -32,7 +33,6 @@ import com.android.server.wm.flicker.statusBarLayerPositionAtStartAndEnd
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.taskBarLayerIsVisibleAtStartAndEnd
import com.android.server.wm.flicker.taskBarWindowIsAlwaysVisible
import com.android.server.wm.traces.common.component.matchers.ComponentNameMatcher
import org.junit.Assume
import org.junit.Test

+30 −20
Original line number Diff line number Diff line
@@ -18,13 +18,13 @@

package com.android.wm.shell.flicker

import com.android.server.wm.flicker.FlickerTest
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.traces.layers.LayerTraceEntrySubject
import com.android.server.wm.flicker.traces.layers.LayersTraceSubject
import com.android.server.wm.traces.common.component.matchers.IComponentMatcher
import com.android.server.wm.traces.common.region.Region
import com.android.server.wm.traces.common.service.PlatformConsts
import android.tools.common.Rotation
import android.tools.common.datatypes.Region
import android.tools.common.datatypes.component.IComponentMatcher
import android.tools.common.flicker.subject.layers.LayerTraceEntrySubject
import android.tools.common.flicker.subject.layers.LayersTraceSubject
import android.tools.device.flicker.legacy.FlickerTest
import android.tools.device.helpers.WindowUtils

fun FlickerTest.appPairsDividerIsVisibleAtEnd() {
    assertLayersEnd { this.isVisible(APP_PAIR_SPLIT_DIVIDER_COMPONENT) }
@@ -247,7 +247,7 @@ fun LayersTraceSubject.splitAppLayerBoundsSnapToDivider(
    component: IComponentMatcher,
    landscapePosLeft: Boolean,
    portraitPosTop: Boolean,
    rotation: PlatformConsts.Rotation
    rotation: Rotation
): LayersTraceSubject {
    return invoke("splitAppLayerBoundsSnapToDivider") {
        it.splitAppLayerBoundsSnapToDivider(component, landscapePosLeft, portraitPosTop, rotation)
@@ -258,11 +258,13 @@ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider(
    component: IComponentMatcher,
    landscapePosLeft: Boolean,
    portraitPosTop: Boolean,
    rotation: PlatformConsts.Rotation
    rotation: Rotation
): LayerTraceEntrySubject {
    val displayBounds = WindowUtils.getDisplayBounds(rotation)
    return invoke {
        val dividerRegion = layer(SPLIT_SCREEN_DIVIDER_COMPONENT).visibleRegion.region
        val dividerRegion =
            layer(SPLIT_SCREEN_DIVIDER_COMPONENT)?.visibleRegion?.region
                ?: error("$SPLIT_SCREEN_DIVIDER_COMPONENT component not found")
        visibleRegion(component)
            .coversAtMost(
                if (displayBounds.width > displayBounds.height) {
@@ -367,46 +369,54 @@ fun FlickerTest.dockedStackDividerNotExistsAtEnd() {
}

fun FlickerTest.appPairsPrimaryBoundsIsVisibleAtEnd(
    rotation: PlatformConsts.Rotation,
    rotation: Rotation,
    primaryComponent: IComponentMatcher
) {
    assertLayersEnd {
        val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region
        val dividerRegion =
            layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT)?.visibleRegion?.region
                ?: error("$APP_PAIR_SPLIT_DIVIDER_COMPONENT component not found")
        visibleRegion(primaryComponent).overlaps(getPrimaryRegion(dividerRegion, rotation))
    }
}

fun FlickerTest.dockedStackPrimaryBoundsIsVisibleAtEnd(
    rotation: PlatformConsts.Rotation,
    rotation: Rotation,
    primaryComponent: IComponentMatcher
) {
    assertLayersEnd {
        val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region
        val dividerRegion =
            layer(DOCKED_STACK_DIVIDER_COMPONENT)?.visibleRegion?.region
                ?: error("$DOCKED_STACK_DIVIDER_COMPONENT component not found")
        visibleRegion(primaryComponent).overlaps(getPrimaryRegion(dividerRegion, rotation))
    }
}

fun FlickerTest.appPairsSecondaryBoundsIsVisibleAtEnd(
    rotation: PlatformConsts.Rotation,
    rotation: Rotation,
    secondaryComponent: IComponentMatcher
) {
    assertLayersEnd {
        val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region
        val dividerRegion =
            layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT)?.visibleRegion?.region
                ?: error("$APP_PAIR_SPLIT_DIVIDER_COMPONENT component not found")
        visibleRegion(secondaryComponent).overlaps(getSecondaryRegion(dividerRegion, rotation))
    }
}

fun FlickerTest.dockedStackSecondaryBoundsIsVisibleAtEnd(
    rotation: PlatformConsts.Rotation,
    rotation: Rotation,
    secondaryComponent: IComponentMatcher
) {
    assertLayersEnd {
        val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region
        val dividerRegion =
            layer(DOCKED_STACK_DIVIDER_COMPONENT)?.visibleRegion?.region
                ?: error("$DOCKED_STACK_DIVIDER_COMPONENT component not found")
        visibleRegion(secondaryComponent).overlaps(getSecondaryRegion(dividerRegion, rotation))
    }
}

fun getPrimaryRegion(dividerRegion: Region, rotation: PlatformConsts.Rotation): Region {
fun getPrimaryRegion(dividerRegion: Region, rotation: Rotation): Region {
    val displayBounds = WindowUtils.getDisplayBounds(rotation)
    return if (rotation.isRotated()) {
        Region.from(
@@ -425,7 +435,7 @@ fun getPrimaryRegion(dividerRegion: Region, rotation: PlatformConsts.Rotation):
    }
}

fun getSecondaryRegion(dividerRegion: Region, rotation: PlatformConsts.Rotation): Region {
fun getSecondaryRegion(dividerRegion: Region, rotation: Rotation): Region {
    val displayBounds = WindowUtils.getDisplayBounds(rotation)
    return if (rotation.isRotated()) {
        Region.from(
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@

package com.android.wm.shell.flicker

import com.android.server.wm.traces.common.component.matchers.ComponentNameMatcher
import android.tools.common.datatypes.component.ComponentNameMatcher

const val SYSTEM_UI_PACKAGE_NAME = "com.android.systemui"
const val LAUNCHER_UI_PACKAGE_NAME = "com.google.android.apps.nexuslauncher"
Loading