From 6268c04bd790b85a43baa408fbbdbf4119b35716 Mon Sep 17 00:00:00 2001 From: Camille Simon <43054281+camsim99@users.noreply.github.com> Date: Wed, 31 May 2023 09:40:03 -0700 Subject: [PATCH] [Android] Modify Linux_android flutter_engine_group_performance to uninstall app before attempting to install (#127429) Changes `Linux_android flutter_engine_group_performance` to uninstall the app that it uses for testing before attempting to install it again to ensure proper cleanup. Attempt at fixing https://github.com/flutter/flutter/issues/127011. --- .../bin/tasks/flutter_engine_group_performance.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dev/devicelab/bin/tasks/flutter_engine_group_performance.dart b/dev/devicelab/bin/tasks/flutter_engine_group_performance.dart index 727228233a..995b38918e 100644 --- a/dev/devicelab/bin/tasks/flutter_engine_group_performance.dart +++ b/dev/devicelab/bin/tasks/flutter_engine_group_performance.dart @@ -20,6 +20,13 @@ Future _withApkInstall( final DeviceDiscovery devices = DeviceDiscovery(); final AndroidDevice device = await devices.workingDevice as AndroidDevice; await device.unlock(); + try { + // Force proper cleanup before trying to install app. If uninstall fails, + // we log exception and proceed with running the test. + await device.adb(['uninstall', bundleName]); + } on Exception catch (error) { + print('adb uninstall failed with exception: $error. Will proceed with test run.'); + } await device.adb(['install', '-r', apkPath]); try { await body(device);