Handle release stop (#6493)
* implement app.stop() for release runs
* update comment
diff --git a/packages/flutter_tools/lib/src/run.dart b/packages/flutter_tools/lib/src/run.dart
index 3637426..22709cc 100644
--- a/packages/flutter_tools/lib/src/run.dart
+++ b/packages/flutter_tools/lib/src/run.dart
@@ -11,14 +11,13 @@
import 'application_package.dart';
import 'base/logger.dart';
import 'base/utils.dart';
-import 'build_info.dart';
import 'commands/build_apk.dart';
import 'commands/install.dart';
import 'commands/trace.dart';
import 'device.dart';
import 'globals.dart';
-import 'vmservice.dart';
import 'resident_runner.dart';
+import 'vmservice.dart';
class RunAndStayResident extends ResidentRunner {
RunAndStayResident(
@@ -199,8 +198,6 @@
}
printTrace('Application running.');
- if (debuggingOptions.buildMode == BuildMode.release)
- return 0;
if (vmService != null) {
await vmService.vm.refreshViews();
@@ -281,6 +278,13 @@
printStatus('For a more detailed help message, press "h" or F1. To quit, press "q", F10, or Ctrl-C.');
}
}
+
+ @override
+ Future<Null> preStop() async {
+ // If we're running in release mode, stop the app using the device logic.
+ if (vmService == null)
+ await device.stopApp(_package);
+ }
}
void writeRunBenchmarkFile(Stopwatch startTime, [Stopwatch restartTime]) {