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

Commit e4f83a1b authored by Vadim Tryshev's avatar Vadim Tryshev Committed by Automerger Merge Worker
Browse files

Merge "Skiping view capture collection in Launcher3 tests to avoid hidden API...

Merge "Skiping view capture collection in Launcher3 tests to avoid hidden API check exception." into udc-qpr-dev am: 233ca49f am: 56372f09

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/24641480



Change-Id: If6589685d46fc1f56085f1e9424c721b0dbdccb3
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents df3043aa 56372f09
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -103,7 +103,8 @@ public class FailureWatcher extends TestWatcher {

            if (viewCaptureDataSupplier != null) {
                out.putNextEntry(new ZipEntry("FS/data/misc/wmtrace/failed_test.vc"));
                viewCaptureDataSupplier.get().writeTo(out);
                final ExportedData exportedData = viewCaptureDataSupplier.get();
                if (exportedData != null) exportedData.writeTo(out);
                out.closeEntry();
            }
        } catch (Exception ignored) {
+8 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.app.Application
import android.media.permission.SafeCloseable
import android.os.Bundle
import androidx.test.core.app.ApplicationProvider
import androidx.test.platform.app.InstrumentationRegistry
import com.android.app.viewcapture.SimpleViewCapture
import com.android.app.viewcapture.ViewCapture.MAIN_EXECUTOR
import com.android.app.viewcapture.data.ExportedData
@@ -50,6 +51,13 @@ class ViewCaptureRule(var alreadyOpenActivitySupplier: Supplier<Activity?>) : Te
        private set

    override fun apply(base: Statement, description: Description): Statement {
        // Skip view capture collection in Launcher3 tests to avoid hidden API check exception.
        if (
            "com.android.launcher3.tests" ==
                InstrumentationRegistry.getInstrumentation().context.packageName
        )
            return base

        return object : Statement() {
            override fun evaluate() {
                viewCaptureData = null