From e1a5c99a2a4149c67174110895041e8074bfb429 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Fri, 29 Mar 2024 13:10:09 -0700 Subject: [PATCH] Remove the tests for `rotate` and `crop` from the Android `scenario_app`. (flutter/engine#51769) Closes https://github.com/flutter/flutter/issues/145957. As @jonahwilliams and @johnmccutchan and I discussed (https://github.com/flutter/flutter/issues/144407), the functionality that was being tested was actually _Android's_ ability to rotate and crop `SurfaceTexture`-backed textures. This same functionality doesn't even exist in the `ImageReader`-based textures (read: modern Android devices): > Due to an oversight by Android, ImageReader backed surfaces do not respect metadata applied to the surface (rotation & crop). Rotation information is not available at all and crop information is corrupted by the ImageReader (only the width/height is propagated the origin offset is not). We might decide to re-add this functionality in the Dart `Texture` widget, but given we'll be migrating our plugins to `SurfaceProducer` (again, read: using `ImageTexture` for most Android phones), it's pointless to test this (and isn't even testing Flutter's code). This reduces our test suite significantly (8 tests down to 2), which should also help with runtime and flakiness. /cc @zanderso who I'm sure will be stoked. --- .../testing/scenario_app/android/README.md | 26 +++++++ .../scenario_app/android/app/build.gradle | 1 + .../scenario_app/android/app/gradle.lockfile | 29 +++++--- .../scenariosui/ExternalTextureTests.java | 73 +------------------ .../ExternalTextureFlutterActivity.java | 24 ++---- .../android/expected_golden_output.txt | 8 +- 6 files changed, 56 insertions(+), 105 deletions(-) diff --git a/engine/src/flutter/testing/scenario_app/android/README.md b/engine/src/flutter/testing/scenario_app/android/README.md index c3d5e0cb7f..d4e4627eec 100644 --- a/engine/src/flutter/testing/scenario_app/android/README.md +++ b/engine/src/flutter/testing/scenario_app/android/README.md @@ -355,6 +355,32 @@ device (you might find it easier trying the `stdout` of the test first, which uses rudimentary log filtering). In the case of multiple runs, the logs are prefixed with the test configuration and run attempt. +### Gradle is failing due to an "not part of the dependency lock state" error + +If you update dependencies in the `app/build.gradle` file, you may encounter an +error (probably in CI) that looks like: + +```txt +FAILED: scenario_app/reports/lint-results.xml +vpython3 ../../flutter/testing/rules/run_gradle.py /b/s/w/ir/cache/builder/src/flutter/testing/scenario_app/android lint --no-daemon -Pflutter_jar=/b/s/w/ir/cache/builder/src/out/android_emulator_skia_debug_x64/flutter.jar -Pout_dir=/b/s/w/ir/cache/builder/src/out/android_emulator_skia_debug_x64/scenario_app --project-cache-dir=/b/s/w/ir/cache/builder/src/out/android_emulator_skia_debug_x64/scenario_app/.gradle --gradle-user-home=/b/s/w/ir/cache/builder/src/out/android_emulator_skia_debug_x64/scenario_app/.gradle + +FAILURE: Build failed with an exception. + +* What went wrong: +Execution failed for task ':app:checkDebugAarMetadata'. +> Could not resolve all files for configuration ':app:debugRuntimeClasspath'. + > Resolved 'org.hamcrest:hamcrest-core:1.3' which is not part of the dependency lock state + > Resolved 'com.google.code.findbugs:jsr305:2.0.2' which is not part of the dependency lock state +``` + +This is because [`gradle.lockfile`](./app/gradle.lockfile) is out of date. To +update it, run: + +```sh +cd testing/scenario_app/android +$ENGINE_SRC/third_party/gradle/bin/gradle app:dependencies --write-locks +``` + ## Getting Help To suggest changes, or highlight problems, please [file an issue](https://github.com/flutter/flutter/issues/new?labels=e:%20scenario-app,engine,platform-android,fyi-android,team-engine). diff --git a/engine/src/flutter/testing/scenario_app/android/app/build.gradle b/engine/src/flutter/testing/scenario_app/android/app/build.gradle index c65cc89148..821915b3e5 100644 --- a/engine/src/flutter/testing/scenario_app/android/app/build.gradle +++ b/engine/src/flutter/testing/scenario_app/android/app/build.gradle @@ -59,6 +59,7 @@ dependencies { } implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.google.android.material:material:1.0.0' + implementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test:rules:1.2.0' diff --git a/engine/src/flutter/testing/scenario_app/android/app/gradle.lockfile b/engine/src/flutter/testing/scenario_app/android/app/gradle.lockfile index e083af965d..fedf60cf04 100644 --- a/engine/src/flutter/testing/scenario_app/android/app/gradle.lockfile +++ b/engine/src/flutter/testing/scenario_app/android/app/gradle.lockfile @@ -2,7 +2,7 @@ # Manual edits can break the build and are not advised. # This file is expected to be part of source control. androidx.activity:activity:1.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath -androidx.annotation:annotation-experimental:1.1.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath +androidx.annotation:annotation-experimental:1.1.0=debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.annotation:annotation:1.0.0=androidTestImplementationDependenciesMetadata,debugAndroidTestImplementationDependenciesMetadata androidx.annotation:annotation:1.2.0=debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.appcompat:appcompat:1.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath @@ -11,6 +11,7 @@ androidx.arch.core:core-runtime:2.0.0=debugAndroidTestCompileClasspath,debugComp androidx.asynclayoutinflater:asynclayoutinflater:1.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.cardview:cardview:1.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.collection:collection:1.1.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath +androidx.concurrent:concurrent-futures:1.1.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.constraintlayout:constraintlayout-solver:1.1.3=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.constraintlayout:constraintlayout:1.1.3=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.coordinatorlayout:coordinatorlayout:1.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath @@ -24,7 +25,7 @@ androidx.interpolator:interpolator:1.0.0=debugAndroidTestCompileClasspath,debugC androidx.legacy:legacy-support-core-ui:1.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.legacy:legacy-support-core-utils:1.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.lifecycle:lifecycle-common-java8:2.2.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath -androidx.lifecycle:lifecycle-common:2.2.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath +androidx.lifecycle:lifecycle-common:2.3.1=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.lifecycle:lifecycle-livedata-core:2.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.lifecycle:lifecycle-livedata:2.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.lifecycle:lifecycle-runtime:2.2.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath @@ -38,10 +39,15 @@ androidx.slidingpanelayout:slidingpanelayout:1.0.0=debugAndroidTestCompileClassp androidx.swiperefreshlayout:swiperefreshlayout:1.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.test.espresso:espresso-core:3.2.0=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath androidx.test.espresso:espresso-idling-resource:3.2.0=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath -androidx.test:monitor:1.2.0=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath +androidx.test.ext:junit:1.1.5=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath +androidx.test.services:storage:1.4.2=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath +androidx.test:annotation:1.0.1=debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath +androidx.test:core:1.5.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath +androidx.test:monitor:1.2.0=androidTestImplementationDependenciesMetadata,debugAndroidTestImplementationDependenciesMetadata +androidx.test:monitor:1.6.1=debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.test:rules:1.2.0=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath androidx.test:runner:1.2.0=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath -androidx.tracing:tracing:1.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath +androidx.tracing:tracing:1.0.0=debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.transition:transition:1.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.vectordrawable:vectordrawable-animated:1.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath androidx.vectordrawable:vectordrawable:1.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath @@ -80,12 +86,14 @@ com.android:zipflinger:7.0.0=lintClassPath com.beust:jcommander:1.78=lintClassPath com.github.javaparser:javaparser-core:3.17.0=lintClassPath com.google.android.material:material:1.0.0=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath -com.google.code.findbugs:jsr305:3.0.2=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath,lintClassPath +com.google.code.findbugs:jsr305:2.0.2=debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath +com.google.code.findbugs:jsr305:3.0.2=androidTestImplementationDependenciesMetadata,debugAndroidTestImplementationDependenciesMetadata,lintClassPath com.google.code.gson:gson:2.8.6=lintClassPath com.google.errorprone:error_prone_annotations:2.3.4=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath,lintClassPath com.google.guava:failureaccess:1.0.1=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath,lintClassPath com.google.guava:guava:30.1-android=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath com.google.guava:guava:30.1-jre=lintClassPath +com.google.guava:listenablefuture:1.0=debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath,lintClassPath com.google.j2objc:j2objc-annotations:1.3=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath,lintClassPath com.google.jimfs:jimfs:1.1=lintClassPath @@ -122,8 +130,9 @@ jakarta.activation:jakarta.activation-api:1.2.1=lintClassPath jakarta.xml.bind:jakarta.xml.bind-api:2.3.2=lintClassPath javax.inject:javax.inject:1=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath,lintClassPath jline:jline:2.14.6=lintClassPath -junit:junit:4.12=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath +junit:junit:4.12=androidTestImplementationDependenciesMetadata,debugAndroidTestImplementationDependenciesMetadata junit:junit:4.13.1=lintClassPath +junit:junit:4.13.2=debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath net.java.dev.jna:jna-platform:5.6.0=lintClassPath net.java.dev.jna:jna:5.6.0=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath,lintClassPath net.sf.jopt-simple:jopt-simple:4.9=lintClassPath @@ -165,7 +174,7 @@ org.codehaus.groovy:groovy-xml:3.0.7=lintClassPath org.codehaus.groovy:groovy:3.0.7=lintClassPath org.glassfish.jaxb:jaxb-runtime:2.3.2=lintClassPath org.glassfish.jaxb:txw2:2.3.2=lintClassPath -org.hamcrest:hamcrest-core:1.3=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath,lintClassPath +org.hamcrest:hamcrest-core:1.3=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,lintClassPath,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath org.hamcrest:hamcrest-integration:1.3=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath org.hamcrest:hamcrest-library:1.3=androidTestImplementationDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestImplementationDependenciesMetadata,debugAndroidTestRuntimeClasspath org.jacoco:org.jacoco.agent:0.8.8=androidJacocoAnt @@ -181,14 +190,16 @@ org.jetbrains.kotlin:kotlin-reflect:1.6.10=kotlinCompilerClasspath,kotlinKlibCom org.jetbrains.kotlin:kotlin-script-runtime:1.6.10=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath org.jetbrains.kotlin:kotlin-stdlib-common:1.4.21=androidTestImplementationDependenciesMetadata,debugAndroidTestImplementationDependenciesMetadata org.jetbrains.kotlin:kotlin-stdlib-common:1.4.32=lintClassPath -org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10=apiDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugApiDependenciesMetadata,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath,releaseApiDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10=apiDependenciesMetadata,debugApiDependenciesMetadata,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath,releaseApiDependenciesMetadata +org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10=debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.32=lintClassPath org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10=apiDependenciesMetadata,debugAndroidTestCompileClasspath,debugApiDependenciesMetadata,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseApiDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.32=lintClassPath org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10=apiDependenciesMetadata,debugAndroidTestCompileClasspath,debugApiDependenciesMetadata,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseApiDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath org.jetbrains.kotlin:kotlin-stdlib:1.4.21=androidTestImplementationDependenciesMetadata,debugAndroidTestImplementationDependenciesMetadata org.jetbrains.kotlin:kotlin-stdlib:1.4.32=lintClassPath -org.jetbrains.kotlin:kotlin-stdlib:1.6.10=apiDependenciesMetadata,debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugApiDependenciesMetadata,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath,releaseApiDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:1.6.10=apiDependenciesMetadata,debugApiDependenciesMetadata,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath,releaseApiDependenciesMetadata +org.jetbrains.kotlin:kotlin-stdlib:1.7.10=debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.2=debugAndroidTestCompileClasspath,debugCompileClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,releaseCompileClasspath,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2=debugAndroidTestCompileClasspath,debugCompileClasspath,debugImplementationDependenciesMetadata,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,implementationDependenciesMetadata,releaseCompileClasspath,releaseImplementationDependenciesMetadata,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/ExternalTextureTests.java b/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/ExternalTextureTests.java index dd02b4956e..38383810ae 100644 --- a/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/ExternalTextureTests.java +++ b/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/ExternalTextureTests.java @@ -4,15 +4,11 @@ package dev.flutter.scenariosui; -import static io.flutter.Build.API_LEVELS; - import android.content.Intent; -import android.graphics.Rect; import androidx.annotation.NonNull; +import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.LargeTest; -import androidx.test.filters.SdkSuppress; import androidx.test.rule.ActivityTestRule; -import androidx.test.runner.AndroidJUnit4; import dev.flutter.scenarios.ExternalTextureFlutterActivity; import org.junit.Before; import org.junit.Rule; @@ -22,10 +18,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class ExternalTextureTests { - private static final int SURFACE_WIDTH = 192; - private static final int SURFACE_HEIGHT = 256; - - Intent intent; + private Intent intent; @Rule @NonNull public ActivityTestRule activityRule = @@ -54,66 +47,4 @@ public class ExternalTextureTests { ScreenshotUtil.capture( activityRule.launchActivity(intent), "ExternalTextureTests_testMediaSurface"); } - - @Test - public void testRotatedMediaSurface_90() throws Exception { - intent.putExtra("scenario_name", "display_texture"); - intent.putExtra("surface_renderer", "media"); - intent.putExtra("rotation", 90); - ScreenshotUtil.capture( - activityRule.launchActivity(intent), "ExternalTextureTests_testRotatedMediaSurface_90"); - } - - @Test - public void testRotatedMediaSurface_180() throws Exception { - intent.putExtra("scenario_name", "display_texture"); - intent.putExtra("surface_renderer", "media"); - intent.putExtra("rotation", 180); - ScreenshotUtil.capture( - activityRule.launchActivity(intent), "ExternalTextureTests_testRotatedMediaSurface_180"); - } - - @Test - public void testRotatedMediaSurface_270() throws Exception { - intent.putExtra("scenario_name", "display_texture"); - intent.putExtra("surface_renderer", "media"); - intent.putExtra("rotation", 270); - ScreenshotUtil.capture( - activityRule.launchActivity(intent), "ExternalTextureTests_testRotatedMediaSurface_270"); - } - - @Test - @SdkSuppress(minSdkVersion = API_LEVELS.API_23) - public void testCroppedMediaSurface_bottomLeft() throws Exception { - intent.putExtra("scenario_name", "display_texture"); - intent.putExtra("surface_renderer", "image"); - intent.putExtra("crop", new Rect(0, 0, SURFACE_WIDTH / 2, SURFACE_HEIGHT / 2)); - ScreenshotUtil.capture( - activityRule.launchActivity(intent), - "ExternalTextureTests_testCroppedMediaSurface_bottomLeft"); - } - - @Test - @SdkSuppress(minSdkVersion = API_LEVELS.API_23) - public void testCroppedMediaSurface_topRight() throws Exception { - intent.putExtra("scenario_name", "display_texture"); - intent.putExtra("surface_renderer", "image"); - intent.putExtra( - "crop", new Rect(SURFACE_WIDTH / 2, SURFACE_HEIGHT / 2, SURFACE_WIDTH, SURFACE_HEIGHT)); - ScreenshotUtil.capture( - activityRule.launchActivity(intent), - "ExternalTextureTests_testCroppedMediaSurface_topRight"); - } - - @Test - @SdkSuppress(minSdkVersion = API_LEVELS.API_23) - public void testCroppedRotatedMediaSurface_bottomLeft_90() throws Exception { - intent.putExtra("scenario_name", "display_texture"); - intent.putExtra("surface_renderer", "image"); - intent.putExtra("crop", new Rect(0, 0, SURFACE_WIDTH / 2, SURFACE_HEIGHT / 2)); - intent.putExtra("rotation", 90); - ScreenshotUtil.capture( - activityRule.launchActivity(intent), - "ExternalTextureTests_testCroppedRotatedMediaSurface_bottomLeft_90"); - } } diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/ExternalTextureFlutterActivity.java b/engine/src/flutter/testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/ExternalTextureFlutterActivity.java index 9b42bff82a..753f2e2690 100644 --- a/engine/src/flutter/testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/ExternalTextureFlutterActivity.java +++ b/engine/src/flutter/testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/ExternalTextureFlutterActivity.java @@ -11,7 +11,6 @@ import android.graphics.Canvas; import android.graphics.ImageFormat; import android.graphics.LinearGradient; import android.graphics.Paint; -import android.graphics.Rect; import android.graphics.Shader.TileMode; import android.hardware.HardwareBuffer; import android.media.Image; @@ -62,7 +61,7 @@ public class ExternalTextureFlutterActivity extends TestActivity { String surfaceRenderer = getIntent().getStringExtra("surface_renderer"); assert surfaceRenderer != null; - flutterRenderer = selectSurfaceRenderer(surfaceRenderer, getIntent().getExtras()); + flutterRenderer = selectSurfaceRenderer(surfaceRenderer); // Create and place a SurfaceView above the Flutter content. SurfaceView surfaceView = new SurfaceView(getContext()); @@ -98,19 +97,18 @@ public class ExternalTextureFlutterActivity extends TestActivity { } } - private SurfaceRenderer selectSurfaceRenderer(String surfaceRenderer, Bundle extras) { + private SurfaceRenderer selectSurfaceRenderer(String surfaceRenderer) { switch (surfaceRenderer) { case "image": if (VERSION.SDK_INT >= API_LEVELS.API_23) { // CanvasSurfaceRenderer doesn't work correctly when used with ImageSurfaceRenderer. // Use MediaSurfaceRenderer for now. - return new ImageSurfaceRenderer( - selectSurfaceRenderer("media", extras), extras.getParcelable("crop")); + return new ImageSurfaceRenderer(selectSurfaceRenderer("media")); } else { throw new RuntimeException("ImageSurfaceRenderer not supported"); } case "media": - return new MediaSurfaceRenderer(this::createMediaExtractor, extras.getInt("rotation", 0)); + return new MediaSurfaceRenderer(this::createMediaExtractor); case "canvas": default: return new CanvasSurfaceRenderer(); @@ -220,7 +218,6 @@ public class ExternalTextureFlutterActivity extends TestActivity { /** Decodes a sample video into the attached Surface. */ private static class MediaSurfaceRenderer implements SurfaceRenderer { private final Supplier extractorSupplier; - private final int rotation; private CountDownLatch onFirstFrame; private Surface surface; @@ -228,9 +225,8 @@ public class ExternalTextureFlutterActivity extends TestActivity { private MediaFormat format; private Thread decodeThread; - protected MediaSurfaceRenderer(Supplier extractorSupplier, int rotation) { + protected MediaSurfaceRenderer(Supplier extractorSupplier) { this.extractorSupplier = extractorSupplier; - this.rotation = rotation; } @Override @@ -241,10 +237,6 @@ public class ExternalTextureFlutterActivity extends TestActivity { extractor = extractorSupplier.get(); format = extractor.getTrackFormat(0); - // NOTE: MediaFormat.KEY_ROTATION was not available until 23+, but the key is still handled on - // API 21+. - format.setInteger("rotation-degrees", rotation); - decodeThread = new Thread(this::decodeThreadMain); decodeThread.start(); } @@ -338,8 +330,6 @@ public class ExternalTextureFlutterActivity extends TestActivity { @RequiresApi(API_LEVELS.API_23) private static class ImageSurfaceRenderer implements SurfaceRenderer { private final SurfaceRenderer inner; - private final Rect crop; - private CountDownLatch onFirstFrame; private ImageReader reader; private ImageWriter writer; @@ -350,9 +340,8 @@ public class ExternalTextureFlutterActivity extends TestActivity { private boolean canReadImage = true; private boolean canWriteImage = true; - protected ImageSurfaceRenderer(SurfaceRenderer inner, Rect crop) { + protected ImageSurfaceRenderer(SurfaceRenderer inner) { this.inner = inner; - this.crop = crop; } @Override @@ -399,7 +388,6 @@ public class ExternalTextureFlutterActivity extends TestActivity { canReadImage = false; Image image = reader.acquireLatestImage(); - image.setCropRect(crop); try { canWriteImage = false; writer.queueInputImage(image); diff --git a/engine/src/flutter/testing/scenario_app/android/expected_golden_output.txt b/engine/src/flutter/testing/scenario_app/android/expected_golden_output.txt index da412e233e..2d4b3ad7b4 100644 --- a/engine/src/flutter/testing/scenario_app/android/expected_golden_output.txt +++ b/engine/src/flutter/testing/scenario_app/android/expected_golden_output.txt @@ -1,12 +1,6 @@ DrawSolidBlueScreenTest.png ExternalTextureTests_testCanvasSurface.png -ExternalTextureTests_testCroppedMediaSurface_bottomLeft.png -ExternalTextureTests_testCroppedMediaSurface_topRight.png -ExternalTextureTests_testCroppedRotatedMediaSurface_bottomLeft_90.png ExternalTextureTests_testMediaSurface.png -ExternalTextureTests_testRotatedMediaSurface_180.png -ExternalTextureTests_testRotatedMediaSurface_270.png -ExternalTextureTests_testRotatedMediaSurface_90.png PlatformTextureUiTests_testPlatformView.png PlatformTextureUiTests_testPlatformViewClippath.png PlatformTextureUiTests_testPlatformViewCliprect.png @@ -60,4 +54,4 @@ PlatformViewWithTextureViewUiTest_testPlatformViewTwoIntersectingOverlays.png PlatformViewWithTextureViewUiTest_testPlatformViewWithoutOverlayIntersection.png SpawnEngineTests_testSpawnedEngine.png logcat.txt -noop.txt \ No newline at end of file +noop.txt