@@ -143,6 +143,7 @@ TaskFunction createBackdropFilterPerfTest({
143
143
testDriver: 'test_driver/backdrop_filter_perf_test.dart' ,
144
144
saveTraceFile: true ,
145
145
enableImpeller: enableImpeller,
146
+ disablePartialRepaint: true ,
146
147
).run;
147
148
}
148
149
@@ -767,6 +768,51 @@ Map<String, dynamic> _average(List<Map<String, dynamic>> results, int iterations
767
768
return tally;
768
769
}
769
770
771
+ /// Opens the file at testDirectory + 'ios/Runner/Info.plist'
772
+ /// and adds the following entry to the application.
773
+ /// <FTLDisablePartialRepaint/>
774
+ /// <true/>
775
+ void _disablePartialRepaint (String testDirectory) {
776
+ final String manifestPath = path.join (
777
+ testDirectory, 'ios' , 'Runner' , 'Info.plist' );
778
+ final File file = File (manifestPath);
779
+
780
+ if (! file.existsSync ()) {
781
+ throw Exception ('Info.plist not found at $manifestPath ' );
782
+ }
783
+
784
+ final String xmlStr = file.readAsStringSync ();
785
+ final XmlDocument xmlDoc = XmlDocument .parse (xmlStr);
786
+ final List <(String , String )> keyPairs = < (String , String )> [
787
+ ('FLTDisablePartialRepaint' , 'true' ),
788
+ ];
789
+
790
+ final XmlElement applicationNode =
791
+ xmlDoc.findAllElements ('dict' ).first;
792
+
793
+ // Check if the meta-data node already exists.
794
+ for (final (String key, String value) in keyPairs) {
795
+ applicationNode.children.add (XmlElement (XmlName ('key' ), < XmlAttribute > [], < XmlNode > [
796
+ XmlText (key)
797
+ ], false ));
798
+ applicationNode.children.add (XmlElement (XmlName (value)));
799
+ }
800
+
801
+ file.writeAsStringSync (xmlDoc.toXmlString (pretty: true , indent: ' ' ));
802
+ }
803
+
804
+ Future <void > _resetPlist (String testDirectory) async {
805
+ final String manifestPath = path.join (
806
+ testDirectory, 'ios' , 'Runner' , 'Info.plist' );
807
+ final File file = File (manifestPath);
808
+
809
+ if (! file.existsSync ()) {
810
+ throw Exception ('Info.plist not found at $manifestPath ' );
811
+ }
812
+
813
+ await exec ('git' , < String > ['checkout' , file.path]);
814
+ }
815
+
770
816
/// Opens the file at testDirectory + 'android/app/src/main/AndroidManifest.xml'
771
817
/// and adds the following entry to the application.
772
818
/// <meta-data
@@ -1124,6 +1170,7 @@ class PerfTest {
1124
1170
this .timeoutSeconds,
1125
1171
this .enableImpeller,
1126
1172
this .forceOpenGLES,
1173
+ this .disablePartialRepaint = false ,
1127
1174
}): _resultFilename = resultFilename;
1128
1175
1129
1176
const PerfTest .e2e (
@@ -1142,6 +1189,7 @@ class PerfTest {
1142
1189
this .timeoutSeconds,
1143
1190
this .enableImpeller,
1144
1191
this .forceOpenGLES,
1192
+ this .disablePartialRepaint = false ,
1145
1193
}) : saveTraceFile = false , timelineFileName = null , _resultFilename = resultFilename;
1146
1194
1147
1195
/// The directory where the app under test is defined.
@@ -1181,6 +1229,9 @@ class PerfTest {
1181
1229
/// Whether the perf test force Impeller's OpenGLES backend.
1182
1230
final bool ? forceOpenGLES;
1183
1231
1232
+ /// Whether partial repaint functionality should be disabled (iOS only).
1233
+ final bool disablePartialRepaint;
1234
+
1184
1235
/// Number of seconds to time out the test after, allowing debug callbacks to run.
1185
1236
final int ? timeoutSeconds;
1186
1237
@@ -1230,14 +1281,42 @@ class PerfTest {
1230
1281
final String ? localEngineHost = localEngineHostFromEnv;
1231
1282
final String ? localEngineSrcPath = localEngineSrcPathFromEnv;
1232
1283
1233
- Future <void > Function ()? manifestReset;
1234
- if (forceOpenGLES ?? false ) {
1235
- assert (enableImpeller! );
1236
- _addOpenGLESToManifest (testDirectory);
1237
- manifestReset = () => _resetManifest (testDirectory);
1284
+ bool changedPlist = false ;
1285
+ bool changedManifest = false ;
1286
+
1287
+ Future <void > resetManifest () async {
1288
+ if (! changedManifest) {
1289
+ return ;
1290
+ }
1291
+ try {
1292
+ await _resetManifest (testDirectory);
1293
+ } catch (err) {
1294
+ print ('Caught exception while trying to reset AndroidManifest: $err ' );
1295
+ }
1296
+ }
1297
+
1298
+ Future <void > resetPlist () async {
1299
+ if (! changedPlist) {
1300
+ return ;
1301
+ }
1302
+ try {
1303
+ await _resetPlist (testDirectory);
1304
+ } catch (err) {
1305
+ print ('Caught exception while trying to reset Info.plist: $err ' );
1306
+ }
1238
1307
}
1239
1308
1240
1309
try {
1310
+ if (forceOpenGLES ?? false ) {
1311
+ assert (enableImpeller! );
1312
+ changedManifest = true ;
1313
+ _addOpenGLESToManifest (testDirectory);
1314
+ }
1315
+ if (disablePartialRepaint) {
1316
+ changedPlist = true ;
1317
+ _disablePartialRepaint (testDirectory);
1318
+ }
1319
+
1241
1320
final List <String > options = < String > [
1242
1321
if (localEngine != null ) ...< String > ['--local-engine' , localEngine],
1243
1322
if (localEngineHost != null ) ...< String > [
@@ -1278,9 +1357,8 @@ class PerfTest {
1278
1357
await flutter ('drive' , options: options);
1279
1358
}
1280
1359
} finally {
1281
- if (manifestReset != null ) {
1282
- await manifestReset ();
1283
- }
1360
+ await resetManifest ();
1361
+ await resetPlist ();
1284
1362
}
1285
1363
1286
1364
final Map <String , dynamic > data = json.decode (
0 commit comments