Commit 71d80fbd authored by John McCutchan's avatar John McCutchan Committed by GitHub

Fix hot reload / restart after the back button dismisses the app on Android (#9455)

- [x] Refresh FlutterViews before issuing a hot reload / restart

Fixes #7248
parent 1e415169
...@@ -324,6 +324,8 @@ class HotRunner extends ResidentRunner { ...@@ -324,6 +324,8 @@ class HotRunner extends ResidentRunner {
} }
Future<OperationResult> _restartFromSources() async { Future<OperationResult> _restartFromSources() async {
printTrace('Refreshing active FlutterViews before restarting.');
await refreshViews();
final Stopwatch restartTimer = new Stopwatch(); final Stopwatch restartTimer = new Stopwatch();
restartTimer.start(); restartTimer.start();
final bool updatedDevFS = await _updateDevFS(); final bool updatedDevFS = await _updateDevFS();
...@@ -409,6 +411,8 @@ class HotRunner extends ResidentRunner { ...@@ -409,6 +411,8 @@ class HotRunner extends ResidentRunner {
} }
Future<OperationResult> _reloadSources({ bool pause: false }) async { Future<OperationResult> _reloadSources({ bool pause: false }) async {
printTrace('Refreshing active FlutterViews before reloading.');
await refreshViews();
if (currentView.uiIsolate == null) if (currentView.uiIsolate == null)
throw 'Application isolate not found'; throw 'Application isolate not found';
// The initial launch is from a script snapshot. When we reload from source // The initial launch is from a script snapshot. When we reload from source
......
...@@ -756,6 +756,7 @@ class VM extends ServiceObjectOwner { ...@@ -756,6 +756,7 @@ class VM extends ServiceObjectOwner {
} }
Future<Null> refreshViews() async { Future<Null> refreshViews() async {
_viewCache.clear();
await vmService.vm.invokeRpc('_flutter.listViews', timeout: kLongRequestTimeout); await vmService.vm.invokeRpc('_flutter.listViews', timeout: kLongRequestTimeout);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment