Unverified Commit da4d0e4f authored by hellohuanlin's avatar hellohuanlin Committed by GitHub

Reland: "Platform view devicelab ad banner scroll list real ads" (#145224)

Reland https://github.com/flutter/flutter/pull/144745, which got reverted due to Android lockfile. Fixed by `dart dev/tools/bin/generate_gradle_lockfiles.dart`

*List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.*

Fixes https://github.com/flutter/flutter/issues/143534
Fixes https://github.com/flutter/flutter/issues/143257

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
parent d113ee4c
......@@ -4628,6 +4628,16 @@ targets:
["devicelab", "ios", "mac"]
task_name: platform_views_scroll_perf_ios__timeline_summary
- name: Mac_ios platform_views_scroll_perf_ad_banners__timeline_summary
recipe: devicelab/devicelab_drone
presubmit: false
bringup: true
timeout: 60
properties:
tags: >
["devicelab", "ios", "mac"]
task_name: platform_views_scroll_perf_ad_banners__timeline_summary
- name: Mac_ios platform_views_scroll_perf_non_intersecting_impeller_ios__timeline_summary
recipe: devicelab/devicelab_drone
presubmit: false
......
......@@ -207,6 +207,7 @@
/dev/devicelab/bin/tasks/platform_channels_benchmarks_ios.dart @gaaclarke @flutter/engine
/dev/devicelab/bin/tasks/platform_interaction_test_ios.dart @hellohuanlin @flutter/engine
/dev/devicelab/bin/tasks/platform_view_ios__start_up.dart @stuartmorgan @flutter/plugin
/dev/devicelab/bin/tasks/platform_views_scroll_perf_ad_banners__timeline_summary.dart @hellohuanlin @flutter/engine
/dev/devicelab/bin/tasks/platform_views_scroll_perf_ios__timeline_summary.dart @hellohuanlin @flutter/engine
/dev/devicelab/bin/tasks/platform_views_scroll_perf_non_intersecting_impeller_ios__timeline_summary.dart @jonahwilliams @flutter/engine
/dev/devicelab/bin/tasks/post_backdrop_filter_perf_ios__timeline_summary.dart @hellohuanlin @flutter/engine
......
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
......@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
4552BF1971CFF555ACB2839A /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BD993316F35385497F75FF6C /* libPods-Runner.a */; };
647B792C24207B8900ABA501 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 647B792B24207B8900ABA501 /* AppDelegate.m */; };
647B792F24207D1600ABA501 /* DummyPlatformView.m in Sources */ = {isa = PBXBuildFile; fileRef = 647B792E24207D1600ABA501 /* DummyPlatformView.m */; };
647B793224208A4200ABA501 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 647B793024208A4200ABA501 /* GeneratedPluginRegistrant.m */; };
......@@ -31,6 +32,9 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0F4D3146B7B6DF07E43DC73C /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
3269CF3CF6F192082C33C163 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
5E91F24FF1A398625C9C0FA5 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
647B792824207ADD00ABA501 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
647B792B24207B8900ABA501 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
647B792D24207CC400ABA501 /* DummyPlatformView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DummyPlatformView.h; sourceTree = "<group>"; };
......@@ -47,6 +51,7 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BD993316F35385497F75FF6C /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -54,12 +59,31 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4552BF1971CFF555ACB2839A /* libPods-Runner.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
0093AEB0458530A026D4EDDD /* Frameworks */ = {
isa = PBXGroup;
children = (
BD993316F35385497F75FF6C /* libPods-Runner.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
3B86C3C30DA7CC47EE4FB68E /* Pods */ = {
isa = PBXGroup;
children = (
3269CF3CF6F192082C33C163 /* Pods-Runner.debug.xcconfig */,
0F4D3146B7B6DF07E43DC73C /* Pods-Runner.release.xcconfig */,
5E91F24FF1A398625C9C0FA5 /* Pods-Runner.profile.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
......@@ -77,6 +101,8 @@
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
3B86C3C30DA7CC47EE4FB68E /* Pods */,
0093AEB0458530A026D4EDDD /* Frameworks */,
);
sourceTree = "<group>";
};
......@@ -121,12 +147,14 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
F9890346AACD48B6C9FEE2A0 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
9A0E2E29949C30C54EBF3099 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
......@@ -215,6 +243,45 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
9A0E2E29949C30C54EBF3099 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
F9890346AACD48B6C9FEE2A0 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
......@@ -307,6 +374,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
......@@ -430,7 +498,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = S8QB4VV633;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
......@@ -449,6 +517,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
......
......@@ -4,4 +4,7 @@
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
......@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
......@@ -20,8 +22,12 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
......@@ -43,9 +49,5 @@
<true/>
<key>io.flutter.metal_preview</key>
<true/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
void main() {
runApp(
const PlatformViewApp()
);
}
class PlatformViewApp extends StatefulWidget {
const PlatformViewApp({
super.key,
});
@override
PlatformViewAppState createState() => PlatformViewAppState();
}
class PlatformViewAppState extends State<PlatformViewApp> {
AdWidget _getBannerWidget() {
// Test IDs from Admob:
// https://developers.google.com/admob/ios/test-ads
// https://developers.google.com/admob/android/test-ads
final String bannerId = Platform.isAndroid
? 'ca-app-pub-3940256099942544/6300978111'
: 'ca-app-pub-3940256099942544/2934735716';
final BannerAd bannerAd = BannerAd(
adUnitId: bannerId,
request: const AdRequest(),
size: AdSize.banner,
listener: const BannerAdListener(),
);
bannerAd.load();
return AdWidget(ad: bannerAd);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light(),
title: 'Advanced Layout',
home: Scaffold(
appBar: AppBar(title: const Text('Platform View Ad Banners')),
body: ListView.builder(
key: const Key('platform-views-scroll'), // This key is used by the driver test.
itemCount: 250,
itemBuilder: (BuildContext context, int index) {
return index.isEven
// Use 320x50 Admob standard banner size.
? SizedBox(width: 320, height: 50, child: _getBannerWidget())
// Adjust the height to control number of platform views on screen.
// TODO(hellohuanlin): Having more than 5 banners on screen causes an unknown crash.
// See: https://github.com/flutter/flutter/issues/144339
: const SizedBox(height: 150, child: ColoredBox(color: Colors.yellow));
},
),
),
);
}
}
......@@ -9,7 +9,7 @@ dependencies:
sdk: flutter
flutter_driver:
sdk: flutter
google_mobile_ads: 4.0.0
# To change the version of the gallery assets, edit
# //packages/flutter_tools/lib/src/commands/update_packages.dart
# and run
......@@ -25,6 +25,7 @@ dependencies:
material_color_utilities: 0.8.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
meta: 1.12.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
path: 1.9.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
plugin_platform_interface: 2.1.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
source_span: 1.10.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stack_trace: 1.11.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stream_channel: 2.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
......@@ -35,6 +36,10 @@ dependencies:
vector_math: 2.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vm_service: 14.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
webdriver: 3.0.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
webview_flutter: 4.7.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
webview_flutter_android: 3.15.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
webview_flutter_platform_interface: 2.10.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
webview_flutter_wkwebview: 3.12.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dev_dependencies:
flutter_test:
......@@ -84,4 +89,4 @@ flutter:
- packages/flutter_gallery_assets/people/square/ali.png
- packages/flutter_gallery_assets/places/india_chettinad_silk_maker.png
# PUBSPEC CHECKSUM: 76bc
# PUBSPEC CHECKSUM: c673
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
group('scrolling performance test', () {
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
await driver.waitUntilFirstFrameRasterized();
});
tearDownAll(() async {
driver.close();
});
Future<void> testScrollPerf(String listKey, String summaryName) async {
// The slight initial delay avoids starting the timing during a
// period of increased load on the device. Without this delay, the
// benchmark has greater noise.
// See: https://github.com/flutter/flutter/issues/19434
await Future<void>.delayed(const Duration(milliseconds: 250));
final Timeline timeline = await driver.traceAction(() async {
// Find the scrollable stock list
final SerializableFinder list = find.byValueKey(listKey);
for (int j = 0; j < 5; j += 1) {
// Scroll down
for (int i = 0; i < 5; i += 1) {
await driver.scroll(list, 0.0, -300.0, const Duration(milliseconds: 300));
await Future<void>.delayed(const Duration(milliseconds: 500));
}
// Scroll up
for (int i = 0; i < 5; i += 1) {
await driver.scroll(list, 0.0, 300.0, const Duration(milliseconds: 300));
await Future<void>.delayed(const Duration(milliseconds: 500));
}
}
});
final TimelineSummary summary = TimelineSummary.summarize(timeline);
await summary.writeTimelineToFile(summaryName, pretty: true);
}
test('platform_views_scroll_perf', () async {
// Disable frame sync, since there are ongoing animations.
await driver.runUnsynchronized(() async {
await testScrollPerf('platform-views-scroll', 'platform_views_scroll_perf_ad_banners');
});
}, timeout: Timeout.none);
});
}
......@@ -31,9 +31,8 @@ void main() {
final Timeline timeline = await driver.traceAction(() async {
// Find the scrollable stock list
final SerializableFinder list = find.byValueKey(listKey);
expect(list, isNotNull);
for (int j = 0; j < 5; j ++) {
for (int j = 0; j < 5; j += 1) {
// Scroll down
for (int i = 0; i < 5; i += 1) {
await driver.scroll(list, 0.0, -300.0, const Duration(milliseconds: 300));
......
......@@ -31,9 +31,8 @@ void main() {
final Timeline timeline = await driver.traceAction(() async {
// Find the scrollable stock list
final SerializableFinder list = find.byValueKey(listKey);
expect(list, isNotNull);
for (int j = 0; j < 5; j ++) {
for (int j = 0; j < 5; j += 1) {
// Scroll down
for (int i = 0; i < 5; i += 1) {
await driver.scroll(list, 0.0, -300.0, const Duration(milliseconds: 300));
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/widgets.dart';
import 'package:flutter_driver/driver_extension.dart';
import 'package:platform_views_layout/main_ad_banners.dart' as app;
void main() {
enableFlutterDriverExtension();
runApp(const app.PlatformViewApp());
}
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/perf_tests.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios;
await task(createUiKitViewScrollPerfAdBannersTest(enableImpeller: true));
}
......@@ -63,6 +63,17 @@ TaskFunction createUiKitViewScrollPerfTest({bool? enableImpeller}) {
).run;
}
TaskFunction createUiKitViewScrollPerfAdBannersTest({bool? enableImpeller}) {
return PerfTest(
'${flutterDirectory.path}/dev/benchmarks/platform_views_layout',
'test_driver/uikit_view_scroll_perf_ad_banners.dart',
'platform_views_scroll_perf_ad_banners',
testDriver: 'test_driver/scroll_perf_ad_banners_test.dart',
needsFullTimeline: false,
enableImpeller: enableImpeller,
).run;
}
TaskFunction createUiKitViewScrollPerfNonIntersectingTest({bool? enableImpeller}) {
return PerfTest(
'${flutterDirectory.path}/dev/benchmarks/platform_views_layout',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment