forked from flutter/packages
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Platform view devicelab ad banner scroll list real ads (#145239)
Reland flutter/flutter#144745, which was reverted due to a the Android app ads not being set up correctly, crashing on launch: flutter/flutter#145228 Add the missing [`com.google.android.gms.ads.APPLICATION_ID` `meta-data` tag](https://developers.google.com/admob/android/quick-start#import_the_mobile_ads_sdk) to the manifest. Validated both `platform_views_scroll_perf__timeline_summary` and `platform_views_scroll_perf_impeller__timeline_summary` ran locally on an Android emulator. Successful presubmit runs: https://ci.chromium.org/ui/p/flutter/builders/try/Linux_pixel_7pro%20platform_views_scroll_perf__timeline_summary/4/overview https://ci.chromium.org/ui/p/flutter/builders/try/Linux_pixel_7pro%20platform_views_scroll_perf_impeller__timeline_summary/4/overview Original commit message: _________ This benchmark is to measure the platform view performance improvement. It is similar to https://github.com/lucalooz/flutter_ads_list_perf There's still a pending issue flutter/flutter#144339 Fixes flutter/flutter#143534 Fixes flutter/flutter#143257
- Loading branch information
Showing
20 changed files
with
560 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 76 additions & 22 deletions
98
dev/benchmarks/platform_views_layout/android/project-app.lockfile
Large diffs are not rendered by default.
Oops, something went wrong.
126 changes: 126 additions & 0 deletions
126
dev/benchmarks/platform_views_layout/android/project-google_mobile_ads.lockfile
Large diffs are not rendered by default.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
dev/benchmarks/platform_views_layout/android/project-webview_flutter_android.lockfile
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
dev/benchmarks/platform_views_layout/ios/Flutter/Debug.xcconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" | ||
#include "Generated.xcconfig" |
1 change: 1 addition & 0 deletions
1
dev/benchmarks/platform_views_layout/ios/Flutter/Release.xcconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" | ||
#include "Generated.xcconfig" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
dev/benchmarks/platform_views_layout/ios/Runner.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
dev/benchmarks/platform_views_layout/lib/main_ad_banners.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// 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)); | ||
}, | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.