From 9331f7478a3770e29234241fe5bf90c7db414d61 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Tue, 17 Nov 2020 19:27:47 -0800 Subject: [PATCH] Fix and clean up scenario app for Android (flutter/engine#22540) --- .../flutter/testing/scenario_app/README.md | 2 +- .../.cache/daemon/5.6.4/registry.bin | Bin 0 -> 73 bytes .../flutter/scenariosui/ScreenshotUtil.java | 32 +--------- .../android/app/src/main/AndroidManifest.xml | 3 +- .../app/src/main/res/values/styles.xml | 8 ++- .../scenario_app/compile_android_jit.sh | 2 +- .../UnobstructedPlatformViewTests.m | 12 ++-- .../scenario_app/lib/src/platform_view.dart | 58 ++++-------------- 8 files changed, 28 insertions(+), 89 deletions(-) create mode 100644 engine/src/flutter/testing/scenario_app/android/android/gradle-home/.cache/daemon/5.6.4/registry.bin diff --git a/engine/src/flutter/testing/scenario_app/README.md b/engine/src/flutter/testing/scenario_app/README.md index 131f7186fe..23685c4dee 100644 --- a/engine/src/flutter/testing/scenario_app/README.md +++ b/engine/src/flutter/testing/scenario_app/README.md @@ -46,7 +46,7 @@ The test is run on a x86 emulator. To run the test locally, you must create an e ``` hw.lcd.density = 480 -hw.lcd.height = 1920 +hw.lcd.height = 1680 hw.lcd.width = 1080 lcd.depth = 16 ``` diff --git a/engine/src/flutter/testing/scenario_app/android/android/gradle-home/.cache/daemon/5.6.4/registry.bin b/engine/src/flutter/testing/scenario_app/android/android/gradle-home/.cache/daemon/5.6.4/registry.bin new file mode 100644 index 0000000000000000000000000000000000000000..0f3905597f5bd4e03874f3612dabc22511cc807f GIT binary patch literal 73 zcmZQ%fB;4Y2FB7${x_N-T%kxtCPoJB#I%ysB88HSRE3np)ZF|$g`(8-%;J)wN`<7< T 0) { - statusBarHeight = context.getResources().getDimensionPixelSize(resourceId); - } - return statusBarHeight; - } - - private static int getActionBarHeight(Activity activity) { - int actionBarHeight = 0; - final android.content.res.TypedArray styledAttributes = - activity.getTheme().obtainStyledAttributes(new int[] {android.R.attr.actionBarSize}); - actionBarHeight = (int) styledAttributes.getDimension(0, 0); - styledAttributes.recycle(); - return actionBarHeight; - } - /** * Captures a screenshot of {@code TestableFlutterActivity}. * @@ -182,13 +158,7 @@ public class ScreenshotUtil { Bitmap bitmap = InstrumentationRegistry.getInstrumentation().getUiAutomation().takeScreenshot(); // Remove the status and action bars from the screenshot capture. - bitmap = - Bitmap.createBitmap( - bitmap, - 0, - getStatusBarHeight(), - bitmap.getWidth(), - bitmap.getHeight() - getStatusBarHeight() - getActionBarHeight(activity)); + bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight()); final String screenshotName = String.format("%s__%s", testClass, testName); // Write bitmap to the album. diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/AndroidManifest.xml b/engine/src/flutter/testing/scenario_app/android/app/src/main/AndroidManifest.xml index 1ddceaf516..d5a088de8c 100644 --- a/engine/src/flutter/testing/scenario_app/android/app/src/main/AndroidManifest.xml +++ b/engine/src/flutter/testing/scenario_app/android/app/src/main/AndroidManifest.xml @@ -14,7 +14,8 @@ android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:launchMode="singleTop" - android:windowSoftInputMode="adjustResize"> + android:windowSoftInputMode="adjustResize" + android:theme="@style/FullScreenScreenshot"> diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/styles.xml b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/styles.xml index 545b9c6d2c..26fb230141 100644 --- a/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/styles.xml +++ b/engine/src/flutter/testing/scenario_app/android/app/src/main/res/values/styles.xml @@ -8,9 +8,11 @@ @color/colorAccent -