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

Commit a61012f1 authored by Nataniel Borges's avatar Nataniel Borges Committed by Automerger Merge Worker
Browse files

[DO NOT MERGE] Sync flicker from master to sc-v2 am: c8287a93

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15716594

Change-Id: I1c8ba8041d346d6991fd113b60e75184aa849ea6
parents 5ecc1cd1 c8287a93
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -41,9 +41,9 @@ import java.io.PrintWriter;
 */
 */
class ImeTracingServerImpl extends ImeTracing {
class ImeTracingServerImpl extends ImeTracing {
    private static final String TRACE_DIRNAME = "/data/misc/wmtrace/";
    private static final String TRACE_DIRNAME = "/data/misc/wmtrace/";
    private static final String TRACE_FILENAME_CLIENTS = "ime_trace_clients.pb";
    private static final String TRACE_FILENAME_CLIENTS = "ime_trace_clients.winscope";
    private static final String TRACE_FILENAME_IMS = "ime_trace_service.pb";
    private static final String TRACE_FILENAME_IMS = "ime_trace_service.winscope";
    private static final String TRACE_FILENAME_IMMS = "ime_trace_managerservice.pb";
    private static final String TRACE_FILENAME_IMMS = "ime_trace_managerservice.winscope";
    private static final int BUFFER_CAPACITY = 4096 * 1024;
    private static final int BUFFER_CAPACITY = 4096 * 1024;


    // Needed for winscope to auto-detect the dump type. Explained further in
    // Needed for winscope to auto-detect the dump type. Explained further in
+1 −1
Original line number Original line Diff line number Diff line
@@ -28,7 +28,7 @@ import java.io.File;
 */
 */
public class ProtoLogImpl extends BaseProtoLogImpl {
public class ProtoLogImpl extends BaseProtoLogImpl {
    private static final int BUFFER_CAPACITY = 1024 * 1024;
    private static final int BUFFER_CAPACITY = 1024 * 1024;
    private static final String LOG_FILENAME = "/data/misc/wmtrace/wm_log.pb";
    private static final String LOG_FILENAME = "/data/misc/wmtrace/wm_log.winscope";
    private static final String VIEWER_CONFIG_FILENAME = "/system/etc/protolog.conf.json.gz";
    private static final String VIEWER_CONFIG_FILENAME = "/system/etc/protolog.conf.json.gz";


    private static ProtoLogImpl sServiceInstance = null;
    private static ProtoLogImpl sServiceInstance = null;
+32 −28
Original line number Original line Diff line number Diff line
@@ -17,11 +17,14 @@
package com.android.wm.shell.flicker.helpers
package com.android.wm.shell.flicker.helpers


import android.app.Instrumentation
import android.app.Instrumentation
import android.graphics.Rect
import android.media.session.MediaController
import android.media.session.MediaController
import android.media.session.MediaSessionManager
import android.media.session.MediaSessionManager
import android.os.SystemClock
import android.os.SystemClock
import androidx.test.uiautomator.By
import androidx.test.uiautomator.By
import androidx.test.uiautomator.BySelector
import androidx.test.uiautomator.BySelector
import androidx.test.uiautomator.Until
import com.android.server.wm.flicker.helpers.FIND_TIMEOUT
import com.android.server.wm.flicker.helpers.SYSTEMUI_PACKAGE
import com.android.server.wm.flicker.helpers.SYSTEMUI_PACKAGE
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import com.android.wm.shell.flicker.pip.tv.closeTvPipWindow
import com.android.wm.shell.flicker.pip.tv.closeTvPipWindow
@@ -85,6 +88,10 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper(


        // Wait on WMHelper or simply wait for 3 seconds
        // Wait on WMHelper or simply wait for 3 seconds
        wmHelper?.waitFor("hasPipWindow") { it.wmState.hasPipWindow() } ?: SystemClock.sleep(3_000)
        wmHelper?.waitFor("hasPipWindow") { it.wmState.hasPipWindow() } ?: SystemClock.sleep(3_000)
        // when entering pip, the dismiss button is visible at the start. to ensure the pip
        // animation is complete, wait until the pip dismiss button is no longer visible. 
        // b/176822698: dismiss-only state will be removed in the future
        uiDevice.wait(Until.gone(By.res(SYSTEMUI_PACKAGE, "dismiss")), FIND_TIMEOUT)
    }
    }


    fun clickStartMediaSessionButton() {
    fun clickStartMediaSessionButton() {
@@ -113,25 +120,25 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
        }
        }
    }
    }


    private fun getWindowRect(wmHelper: WindowManagerStateHelper): Rect {
        val windowRegion = wmHelper.getWindowRegion(component)
        require(!windowRegion.isEmpty) {
            "Unable to find a PIP window in the current state"
        }
        return windowRegion.bounds
    }

    /**
    /**
     * Expands the pip window and dismisses it by clicking on the X button.
     * Expands the pip window and dismisses it by clicking on the X button.
     *
     * Note, currently the View coordinates reported by the accessibility are relative to
     * the window, so the correct coordinates need to be calculated
     *
     * For example, in a PIP window located at Rect(508, 1444 - 1036, 1741), the
     * dismiss button coordinates are shown as Rect(650, 0 - 782, 132), with center in
     * Point(716, 66), instead of Point(970, 1403)
     *
     * See b/179337864
     */
     */
    fun closePipWindow(wmHelper: WindowManagerStateHelper) {
    fun closePipWindow(wmHelper: WindowManagerStateHelper) {
        if (isTelevision) {
        if (isTelevision) {
            uiDevice.closeTvPipWindow()
            uiDevice.closeTvPipWindow()
        } else {
        } else {
            expandPipWindow(wmHelper)
            val windowRect = getWindowRect(wmHelper)
            uiDevice.click(windowRect.centerX(), windowRect.centerY())
            val exitPipObject = uiDevice.findObject(By.res(SYSTEMUI_PACKAGE, "dismiss"))
            val exitPipObject = uiDevice.findObject(By.res(SYSTEMUI_PACKAGE, "dismiss"))
            requireNotNull(exitPipObject) { "PIP window dismiss button not found" }
                    ?: error("PIP window dismiss button not found")
            val dismissButtonBounds = exitPipObject.visibleBounds
            val dismissButtonBounds = exitPipObject.visibleBounds
            uiDevice.click(dismissButtonBounds.centerX(), dismissButtonBounds.centerY())
            uiDevice.click(dismissButtonBounds.centerX(), dismissButtonBounds.centerY())
        }
        }
@@ -142,32 +149,29 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
    }
    }


    /**
    /**
     * Click once on the PIP window to expand it
     * Close the pip window by pressing the expand button
     */
     */
    fun expandPipWindow(wmHelper: WindowManagerStateHelper) {
    fun expandPipWindowToApp(wmHelper: WindowManagerStateHelper) {
        val windowRegion = wmHelper.getWindowRegion(component)
        val windowRect = getWindowRect(wmHelper)
        require(!windowRegion.isEmpty) {
            "Unable to find a PIP window in the current state"
        }
        val windowRect = windowRegion.bounds
        uiDevice.click(windowRect.centerX(), windowRect.centerY())
        uiDevice.click(windowRect.centerX(), windowRect.centerY())
        // Ensure WindowManagerService wait until all animations have completed
        // search and interact with the expand button
        val expandSelector = By.res(SYSTEMUI_PACKAGE, "expand_button")
        uiDevice.wait(Until.hasObject(expandSelector), FIND_TIMEOUT)
        val expandPipObject = uiDevice.findObject(expandSelector)
                ?: error("PIP window expand button not found")
        val expandButtonBounds = expandPipObject.visibleBounds
        uiDevice.click(expandButtonBounds.centerX(), expandButtonBounds.centerY())
        wmHelper.waitFor("!hasPipWindow") { !it.wmState.hasPipWindow() }
        wmHelper.waitForAppTransitionIdle()
        wmHelper.waitForAppTransitionIdle()
        mInstrumentation.uiAutomation.syncInputTransactions()
    }
    }


    /**
    /**
     * Double click on the PIP window to reopen to app
     * Double click on the PIP window to expand it
     */
     */
    fun expandPipWindowToApp(wmHelper: WindowManagerStateHelper) {
    fun doubleClickPipWindow(wmHelper: WindowManagerStateHelper) {
        val windowRegion = wmHelper.getWindowRegion(component)
        val windowRect = getWindowRect(wmHelper)
        require(!windowRegion.isEmpty) {
            "Unable to find a PIP window in the current state"
        }
        val windowRect = windowRegion.bounds
        uiDevice.click(windowRect.centerX(), windowRect.centerY())
        uiDevice.click(windowRect.centerX(), windowRect.centerY())
        uiDevice.click(windowRect.centerX(), windowRect.centerY())
        uiDevice.click(windowRect.centerX(), windowRect.centerY())
        wmHelper.waitFor("!hasPipWindow") { !it.wmState.hasPipWindow() }
        wmHelper.waitForAppTransitionIdle()
        wmHelper.waitForAppTransitionIdle()
    }
    }


+1 −2
Original line number Original line Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.wm.shell.flicker.legacysplitscreen
package com.android.wm.shell.flicker.legacysplitscreen


import android.content.ComponentName
import android.content.ComponentName
import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit
import android.platform.test.annotations.Presubmit
import android.view.Surface
import android.view.Surface
import androidx.test.filters.FlakyTest
import androidx.test.filters.FlakyTest
@@ -113,7 +112,7 @@ class ExitPrimarySplitScreenShowSecondaryFullscreen(
    override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
    override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
            super.visibleLayersShownMoreThanOneConsecutiveEntry()
            super.visibleLayersShownMoreThanOneConsecutiveEntry()


    @Postsubmit
    @Presubmit
    @Test
    @Test
    override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
    override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
            super.visibleWindowsShownMoreThanOneConsecutiveEntry()
            super.visibleWindowsShownMoreThanOneConsecutiveEntry()
+1 −1
Original line number Original line Diff line number Diff line
@@ -104,7 +104,7 @@ class LegacySplitScreenToLauncher(


    @Presubmit
    @Presubmit
    @Test
    @Test
    fun entireScreenCovered() = testSpec.entireScreenCovered(testSpec.config.endRotation)
    fun entireScreenCovered() = testSpec.entireScreenCovered()


    @Presubmit
    @Presubmit
    @Test
    @Test
Loading