diff --git a/dev/devicelab/lib/tasks/perf_tests.dart b/dev/devicelab/lib/tasks/perf_tests.dart index 71462ce5e8..b5ab1f692f 100644 --- a/dev/devicelab/lib/tasks/perf_tests.dart +++ b/dev/devicelab/lib/tasks/perf_tests.dart @@ -816,15 +816,7 @@ Future _resetPlist(String testDirectory) async { await exec('git', ['checkout', file.path]); } -/// Opens the file at testDirectory + 'android/app/src/main/AndroidManifest.xml' -/// and adds the following entry to the application. -/// -/// -void _addOpenGLESToManifest(String testDirectory) { +void _addMetadataToManifest(String testDirectory, List<(String, String)> keyPairs) { final String manifestPath = path.join( testDirectory, 'android', 'app', 'src', 'main', 'AndroidManifest.xml'); final File file = File(manifestPath); @@ -835,11 +827,6 @@ void _addOpenGLESToManifest(String testDirectory) { final String xmlStr = file.readAsStringSync(); final XmlDocument xmlDoc = XmlDocument.parse(xmlStr); - final List<(String, String)> keyPairs = <(String, String)>[ - ('io.flutter.embedding.android.ImpellerBackend', 'opengles'), - ('io.flutter.embedding.android.EnableOpenGLGPUTracing', 'true') - ]; - final XmlElement applicationNode = xmlDoc.findAllElements('application').first; @@ -860,7 +847,6 @@ void _addOpenGLESToManifest(String testDirectory) { XmlAttribute(XmlName('android:value'), value) ], ); - applicationNode.children.add(metaData); } } @@ -868,6 +854,33 @@ void _addOpenGLESToManifest(String testDirectory) { file.writeAsStringSync(xmlDoc.toXmlString(pretty: true, indent: ' ')); } +/// Opens the file at testDirectory + 'android/app/src/main/AndroidManifest.xml' +/// +void _addVulkanGPUTracingToManifest(String testDirectory) { + final List<(String, String)> keyPairs = <(String, String)>[ + ('io.flutter.embedding.android.EnableVulkanGPUTracing', 'true'), + ]; + _addMetadataToManifest(testDirectory, keyPairs); +} + +/// Opens the file at testDirectory + 'android/app/src/main/AndroidManifest.xml' +/// and adds the following entry to the application. +/// +/// +void _addOpenGLESToManifest(String testDirectory) { + final List<(String, String)> keyPairs = <(String, String)>[ + ('io.flutter.embedding.android.ImpellerBackend', 'opengles'), + ('io.flutter.embedding.android.EnableOpenGLGPUTracing', 'true'), + ]; + _addMetadataToManifest(testDirectory, keyPairs); +} + Future _resetManifest(String testDirectory) async { final String manifestPath = path.join( testDirectory, 'android', 'app', 'src', 'main', 'AndroidManifest.xml'); @@ -1311,10 +1324,12 @@ class PerfTest { } try { - if (forceOpenGLES ?? false) { - assert(enableImpeller!); + if (enableImpeller ?? false) { changedManifest = true; - _addOpenGLESToManifest(testDirectory); + _addVulkanGPUTracingToManifest(testDirectory); + if (forceOpenGLES ?? false) { + _addOpenGLESToManifest(testDirectory); + } } if (disablePartialRepaint) { changedPlist = true;