Skip to content

Commit a02c017

Browse files
authored
make it work on <API 24 (flutter#27398)
1 parent a22a3ca commit a02c017

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

testing/scenario_app/android/app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ dependencies {
4747
implementation 'com.google.android.material:material:1.0.0'
4848
implementation 'androidx.lifecycle:lifecycle-common-java8:2.2.0-alpha01'
4949
implementation "com.squareup.leakcanary:leakcanary-android:$leakcanary_version"
50+
implementation 'com.google.guava:guava:28.1-android'
5051
testImplementation 'junit:junit:4.12'
5152
androidTestImplementation 'androidx.test:runner:1.2.0'
5253
androidTestImplementation 'androidx.test:rules:1.2.0'

testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenarios/EngineLaunchE2ETest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
import androidx.test.InstrumentationRegistry;
1111
import androidx.test.internal.runner.junit4.statement.UiThreadStatement;
1212
import androidx.test.runner.AndroidJUnit4;
13+
import com.google.common.util.concurrent.SettableFuture;
1314
import io.flutter.embedding.engine.FlutterEngine;
1415
import io.flutter.embedding.engine.dart.DartExecutor;
1516
import java.util.Arrays;
1617
import java.util.Locale;
17-
import java.util.concurrent.CompletableFuture;
1818
import java.util.concurrent.ExecutionException;
1919
import java.util.concurrent.TimeUnit;
2020
import java.util.concurrent.TimeoutException;
@@ -34,7 +34,7 @@ public void smokeTestEngineLaunch() throws Throwable {
3434
// as @UiThreadTest because having the message handler and the CompletableFuture both being
3535
// on the same thread will create deadlocks.
3636
UiThreadStatement.runOnUiThread(() -> engine.set(new FlutterEngine(applicationContext)));
37-
CompletableFuture<Boolean> statusReceived = new CompletableFuture<>();
37+
SettableFuture<Boolean> statusReceived = new SettableFuture<>();
3838

3939
// Resolve locale to `en_US`.
4040
// This is required, so `window.locale` in populated in dart.
@@ -49,8 +49,7 @@ public void smokeTestEngineLaunch() throws Throwable {
4949
.get()
5050
.getDartExecutor()
5151
.setMessageHandler(
52-
"waiting_for_status",
53-
(byteBuffer, binaryReply) -> statusReceived.complete(Boolean.TRUE));
52+
"waiting_for_status", (byteBuffer, binaryReply) -> statusReceived.set(Boolean.TRUE));
5453

5554
// Launching the entrypoint will run the Dart code that sends the "waiting_for_status" platform
5655
// message.

0 commit comments

Comments
 (0)