Skip to content

Commit 6ff2a76

Browse files
authored
Merge branch 'master' into use-window-registry
2 parents 8949416 + d18ad52 commit 6ff2a76

16 files changed

Lines changed: 715 additions & 84 deletions

File tree

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:convert';
6+
7+
import 'package:android_driver_extensions/extension.dart';
8+
import 'package:flutter/foundation.dart';
9+
import 'package:flutter/gestures.dart';
10+
import 'package:flutter/material.dart';
11+
import 'package:flutter/rendering.dart';
12+
import 'package:flutter/services.dart';
13+
import 'package:flutter_driver/driver_extension.dart';
14+
15+
import '../src/allow_list_devices.dart';
16+
17+
void main() async {
18+
ensureAndroidDevice();
19+
enableFlutterDriverExtension(
20+
handler: (String? command) async {
21+
return json.encode(<String, Object?>{
22+
'supported': await HybridAndroidViewController.checkIfSupported(),
23+
});
24+
},
25+
commands: <CommandExtension>[nativeDriverCommands],
26+
);
27+
28+
// Run on full screen.
29+
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
30+
runApp(const SimpleClipRectApp());
31+
}
32+
33+
class SimpleClipRectApp extends StatelessWidget {
34+
const SimpleClipRectApp({super.key});
35+
36+
@override
37+
Widget build(BuildContext context) {
38+
return MaterialApp(
39+
theme: ThemeData(elevatedButtonTheme: const ElevatedButtonThemeData()),
40+
home: const ClipRectHomePage(),
41+
);
42+
}
43+
}
44+
45+
class ClipRectHomePage extends StatefulWidget {
46+
const ClipRectHomePage({super.key});
47+
48+
@override
49+
State<ClipRectHomePage> createState() => _ClipRectHomePageState();
50+
}
51+
52+
class _ClipRectHomePageState extends State<ClipRectHomePage> {
53+
bool _isClipped = false;
54+
55+
void _toggleClip() {
56+
setState(() {
57+
_isClipped = !_isClipped;
58+
});
59+
}
60+
61+
@override
62+
Widget build(BuildContext context) {
63+
// Content that will be clipped
64+
Widget content = const Stack(
65+
alignment: Alignment.center,
66+
children: <Widget>[
67+
// Background
68+
SizedBox.square(dimension: 500, child: ColoredBox(color: Colors.green)),
69+
// Platform View
70+
SizedBox.square(
71+
dimension: 400,
72+
child: _HybridCompositionAndroidPlatformView(
73+
viewType: 'blue_orange_gradient_surface_view_platform_view',
74+
),
75+
),
76+
],
77+
);
78+
79+
// Apply the ClipRect conditionally
80+
if (_isClipped) {
81+
content = ClipRect(clipper: const SimpleRectClipper(dimension: 300.0), child: content);
82+
}
83+
84+
return Scaffold(
85+
body: Column(
86+
children: <Widget>[
87+
// Button to toggle the clip state
88+
Padding(
89+
padding: const EdgeInsets.all(8.0),
90+
child: ElevatedButton(
91+
key: const ValueKey<String>('toggle_cliprect_button'),
92+
onPressed: _toggleClip,
93+
child: Text(_isClipped ? 'Disable ClipRect' : 'Enable ClipRect'),
94+
),
95+
),
96+
// Expanded takes remaining space for the clipped content
97+
Expanded(child: Center(child: content)),
98+
],
99+
),
100+
);
101+
}
102+
}
103+
104+
// A simple clipper that enforces a strict bounding box of the specified dimension
105+
class SimpleRectClipper extends CustomClipper<Rect> {
106+
const SimpleRectClipper({required this.dimension});
107+
108+
final double dimension;
109+
110+
@override
111+
Rect getClip(Size size) {
112+
// Centers the clip area over the widget
113+
return Rect.fromCenter(
114+
center: Offset(size.width / 2, size.height / 2),
115+
width: dimension,
116+
height: dimension,
117+
);
118+
}
119+
120+
@override
121+
bool shouldReclip(covariant SimpleRectClipper oldClipper) {
122+
return oldClipper.dimension != dimension;
123+
}
124+
}
125+
126+
// --- Platform View Definition ---
127+
final class _HybridCompositionAndroidPlatformView extends StatelessWidget {
128+
const _HybridCompositionAndroidPlatformView({required this.viewType});
129+
130+
final String viewType;
131+
132+
@override
133+
Widget build(BuildContext context) {
134+
return PlatformViewLink(
135+
viewType: viewType,
136+
surfaceFactory: (BuildContext context, PlatformViewController controller) {
137+
return AndroidViewSurface(
138+
controller: controller as AndroidViewController,
139+
gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
140+
hitTestBehavior: PlatformViewHitTestBehavior.transparent,
141+
);
142+
},
143+
onCreatePlatformView: (PlatformViewCreationParams params) {
144+
return PlatformViewsService.initHybridAndroidView(
145+
id: params.id,
146+
viewType: viewType,
147+
layoutDirection: TextDirection.ltr,
148+
creationParamsCodec: const StandardMessageCodec(),
149+
)
150+
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
151+
..create();
152+
},
153+
);
154+
}
155+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:convert';
6+
7+
import 'package:android_driver_extensions/native_driver.dart';
8+
import 'package:android_driver_extensions/skia_gold.dart';
9+
import 'package:flutter_driver/flutter_driver.dart';
10+
import 'package:test/test.dart';
11+
12+
import '../_luci_skia_gold_prelude.dart';
13+
14+
/// For local debugging, a (local) golden-file is required as a baseline:
15+
///
16+
/// ```sh
17+
/// # Checkout HEAD, i.e. *before* changes you want to test.
18+
/// UPDATE_GOLDENS=1 flutter drive lib/hcpp/platform_view_cliprect_surfaceview_main.dart
19+
///
20+
/// # Make your changes.
21+
///
22+
/// # Run the test against baseline.
23+
/// flutter drive lib/hcpp/platform_view_cliprect_surfaceview_main.dart
24+
/// ```
25+
///
26+
/// For a convenient way to deflake a test, see `tool/deflake.dart`.
27+
void main() async {
28+
const goldenPrefix = 'hybrid_composition_pp_platform_view';
29+
30+
late final FlutterDriver flutterDriver;
31+
late final NativeDriver nativeDriver;
32+
33+
setUpAll(() async {
34+
if (isLuci) {
35+
await enableSkiaGoldComparator(namePrefix: 'android_engine_test$goldenVariant');
36+
}
37+
flutterDriver = await FlutterDriver.connect();
38+
nativeDriver = await AndroidNativeDriver.connect(flutterDriver);
39+
await nativeDriver.configureForScreenshotTesting();
40+
await flutterDriver.waitUntilFirstFrameRasterized();
41+
});
42+
43+
tearDownAll(() async {
44+
await nativeDriver.close();
45+
await flutterDriver.close();
46+
});
47+
48+
test('verify that HCPP is supported and enabled', () async {
49+
final response = json.decode(await flutterDriver.requestData('')) as Map<String, Object?>;
50+
51+
expect(response['supported'], true);
52+
}, timeout: Timeout.none);
53+
54+
test('should screenshot a platform view with no rect clipping', () async {
55+
await expectLater(
56+
nativeDriver.screenshot(),
57+
matchesGoldenFile('$goldenPrefix.no_rect_clipping_surfaceview.png'),
58+
);
59+
}, timeout: Timeout.none);
60+
61+
test('should properly clip surfaceview', () async {
62+
await flutterDriver.tap(find.byValueKey('toggle_cliprect_button'));
63+
await expectLater(
64+
nativeDriver.screenshot(),
65+
matchesGoldenFile('$goldenPrefix.yes_rect_clipping_surfaceview.png'),
66+
);
67+
}, timeout: Timeout.none);
68+
}

docs/Flutter-Self-Service-Index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,4 +315,4 @@ Flutter provides multiple functionality through self-service services. Most of t
315315
</table>
316316

317317

318-
Googlers can access the internal version using [go/flutter-self-service](http://go/flutter-self-service)
318+
Googlers can access the internal version using [go/flutter-self-service](https://goto.google.com/flutter-self-service)

docs/engine/rbe/rbe.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ ninja: fatal: pipe: Too many open files
167167
```
168168

169169
Increase the maximum number of open files on your machine with the instructions
170-
[here](http://go/building-chrome-mac#configure-your-mac-for-remote-execution).
170+
[here](https://goto.google.com/building-chrome-mac#configure-your-mac-for-remote-execution).
171171

172172
### Slow builds
173173

@@ -192,7 +192,7 @@ to various background and monitoring processes running. See
192192
[here](https://buganizer.corp.google.com/issues/324404733#comment16) for how to
193193
disable some of them. You should also disable Spotlight scanning of the engine
194194
source directory as described
195-
[here](http://go/building-chrome-mac#add-the-source-directory-to-the-spotlight-privacy-list).
195+
[here](https://goto.google.com/building-chrome-mac#add-the-source-directory-to-the-spotlight-privacy-list).
196196

197197
When RBE builds are slow, non-RBE builds may be faster, especially incremental
198198
builds. You can disable remote builds without invalidating your existing build
@@ -244,7 +244,7 @@ This can be debugged by doing a local build with RBE turned off.
244244
[this GitHub repository](https://github.com/bazelbuild/reclient). The tools are not
245245
well-documented, so the source code is the source of truth for the command
246246
line flags that they accept, for example.
247-
* Internal-facing RBE migration guide is [here](http://go/reclient-migration-guide).
247+
* Internal-facing RBE migration guide is [here](https://goto.google.com/reclient-migration-guide).
248248
(Mostly focused on Chrome and Android, so not all parts are relevant to
249249
Flutter.)
250250
* The version of RBE for local development is set in the DEPS file

docs/infra/Rolling-Dart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,4 @@ flutter test --local-engine=host_debug --local-engine-host=host_debug
103103

104104
13. Once the bot cycles green, the [Autorollers](../infra/Autorollers.md) will roll the engine into the flutter/flutter repo. When this happens, monitor the flutter [build bots](https://flutter-dashboard.appspot.com/build.html). If there is a failure, revert the Dart roll in flutter/engine, debug the problem and fix it or file a P0 issue against Dart. Please monitor the [flutter benchmarks dashboard](https://flutter-dashboard.appspot.com/benchmarks.html) and if any regressions are noticed please file P0 issues for all regressions **and revert the Dart roll**. The next roll is blocked until these issues/regressions are fixed.
105105

106-
14. When you are done please update the spreadsheet at [http://go/dart-flutter-rolls](http://go/dart-flutter-rolls) with the git hash of the Dart revision that was rolled into the flutter engine. This hash will be used for rolling Dart into Google's internal code repository and would be picked as a potential candidate for a dev release. Also make sure you send an email to the next person on the list and make sure the person acknowledges picking up the roll baton.
106+
14. When you are done please update the spreadsheet at [go/dart-flutter-rolls](https://goto.google.com/dart-flutter-rolls) with the git hash of the Dart revision that was rolled into the flutter engine. This hash will be used for rolling Dart into Google's internal code repository and would be picked as a potential candidate for a dev release. Also make sure you send an email to the next person on the list and make sure the person acknowledges picking up the roll baton.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
The process to update the framework's Material fonts (currently, Roboto) and [icons](https://github.com/flutter/flutter/blob/main/packages/flutter/lib/src/material/icons.dart) has been largely simplified and automated. See [go/effortless-flutter-font-updates](http://go/effortless-flutter-font-updates) (Google-only, sorry). The steps used prior to automation are available in this page's history.
1+
The process to update the framework's Material fonts (currently, Roboto) and [icons](https://github.com/flutter/flutter/blob/main/packages/flutter/lib/src/material/icons.dart) has been largely simplified and automated. See [go/effortless-flutter-font-updates](https://goto.google.com/effortless-flutter-font-updates) (Google-only, sorry). The steps used prior to automation are available in this page's history.
22

33
If you notice an issue with fonts or icons (e.g. a missing icon), please file an [issue](https://github.com/flutter/flutter/issues/new/choose). Consider starting the issue title with `[Fonts]` or `[Icons]` to make it stand out.
44

5-
_(This page is referenced by comments in the Flutter codebase.)_
5+
_(This page is referenced by comments in the Flutter codebase.)_

docs/platforms/android/Android-Platform-Views.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ You can enable HCPP using one of the following methods:
6868

6969
### Limitations and Known Issues
7070
The following is a list of limitations and known issues. If you encounter an issue not listed below, please file an issue!
71-
- **SurfaceView Compatibility**: Opting in is currently not recommended if your application contains a platform view which is or contains a native [`SurfaceView`](https://developer.android.com/reference/android/view/SurfaceView) (often used by video players or map plugins), due to clipping issues. This is tracked in https://github.com/flutter/flutter/issues/175546.
7271
- **Complex Overlay Stacking**: Transparent platform views will not display correctly in layout stacks structured as: Flutter canvas -> Platform View -> Overlay -> Transparent Platform View, when all four of these layers intersect.
7372

7473
## Virtual Display

docs/platforms/android/New-Android-version.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ First, find the new Android API release notes online and follow the instructions
5858
Flutter now includes a script to download, package, and upload the Android SDK to CIPD. These CIPD packages are then used as dependencies by the Flutter engine and recipes (go/flutter-luci-recipes) so that there is a stable archived version of the Android SDK to depend on. The script is located in the flutter/flutter repo under `engine/src/flutter/tools/android_sdk/create_cipd_packages.sh`.
5959

6060
> Before uploading to CIPD, please double-check that the Android SDK configurations in the text file are correct.
61-
> Be cautious when uploading new packages to CIPD because it is difficult to undo. If you need to remove an uploaded CIPD tag, follow the documentation [here](http://go/flutter-luci-playbook#remove-duplicated-cipd-tags).
61+
> Be cautious when uploading new packages to CIPD because it is difficult to undo. If you need to remove an uploaded CIPD tag, follow the documentation [here](https://goto.google.com/flutter-luci-playbook#remove-duplicated-cipd-tags).
6262
6363
Please do not manually upload a new Android API version to CIPD. Instead, follow these steps:
6464

docs/platforms/android/Uploading-New-Java-Version-to-CIPD.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Uploading New Java Version to CIPD
22

33
We store the Java Version package on CIPD for use on CI. For more information read the internal
4-
docs [here](http://go/luci-cipd).
4+
docs [here](https://goto.google.com/luci-cipd).
55

66
Some links in the instructions below are Google-internal.
77

@@ -10,7 +10,7 @@ Some links in the instructions below are Google-internal.
1010
### Request Access to CIPD
1111

1212
1. Request temporary write access to upload packages to CIPD
13-
via http://go/flutter-luci-cipd#requesting-write-read-access-to-cipd-packages.
13+
via https://goto.google.com/flutter-luci-cipd#requesting-write-read-access-to-cipd-packages.
1414

1515
2. Wait about 5-30 minutes for access rights to sync. To check if your rights have synced, see if
1616
you are a member of this
@@ -68,5 +68,5 @@ Some links in the instructions below are Google-internal.
6868
### Troubleshooting CIPD (Optional)
6969

7070
If you accidentally uploaded the incorrect package to CIPD, you can delete the tag using these
71-
instructions [here](http://go/flutter-luci-playbook#remove-duplicated-cipd-tags).
72-
Then, re-upload the correct Java version pacakge to CIPD.
71+
instructions [here](https://goto.google.com/flutter-luci-playbook#remove-duplicated-cipd-tags).
72+
Then, re-upload the correct Java version pacakge to CIPD.

docs/releases/Bad-Builds.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Flutter Bad Builds Triage Guidelines (for Googlers)
22

3-
1. If you encounter a serious P0 flutter production Google3 or a GitHub issue, triage the issue and check if the issue is already part of Flutter's bad build [tracker](http://go/flutter-bad-builds).
4-
If the issue is not listed in Flutter bad builds [tracker](http://go/flutter-bad-builds), check that it meets the below criteria to qualify for bad builds visibility -
3+
1. If you encounter a serious P0 flutter production Google3 or a GitHub issue, triage the issue and check if the issue is already part of Flutter's bad build [tracker](https://goto.google.com/flutter-bad-builds).
4+
If the issue is not listed in Flutter bad builds [tracker](https://goto.google.com/flutter-bad-builds), check that it meets the below criteria to qualify for bad builds visibility -
55
* A P0 bug
66
* Can be in any component, Flutter’s component or Flutter user’s component
77
* Must be a bug, not a feature request
@@ -10,7 +10,7 @@ If the issue is not listed in Flutter bad builds [tracker](http://go/flutter-bad
1010

1111
2. If there is a buganizer for this already and no GitHub issue, create a GitHub bug in the GitHub repo. Label the GitHub bug with label _a: production_ and _customer: google_.
1212

13-
3. Add following information to Flutter bad builds visibility [tracker](http://go/flutter-bad-builds)
13+
3. Add following information to Flutter bad builds visibility [tracker](https://goto.google.com/flutter-bad-builds)
1414
* Issue create date - this can be either buganizer or GitHub issue create date
1515
* Triaged by - your LDAP
1616
* Github issue id
@@ -23,4 +23,4 @@ If the issue is not listed in Flutter bad builds [tracker](http://go/flutter-bad
2323

2424
5. Once a fix has been merged, enter the “End bad build commit hash 1 URL”.
2525

26-
6. There are cases when a fix is merged as part of 2 different commits. In that case, you can use the "End bad build commit hash 2 URL" column to populate the second commits hash information. Automation will take care of finding the corresponding End bad build commit CL based on the End bad build commit URL you entered.
26+
6. There are cases when a fix is merged as part of 2 different commits. In that case, you can use the "End bad build commit hash 2 URL" column to populate the second commits hash information. Automation will take care of finding the corresponding End bad build commit CL based on the End bad build commit URL you entered.

0 commit comments

Comments
 (0)