Commit cc5d1adc authored by Devon Carew's avatar Devon Carew

handle an exit code from android n (#3914)

* handle an exit code from android n

* review comments
parent 15decfca
......@@ -54,13 +54,19 @@ class AndroidDevice extends Device {
String _getProperty(String name) {
if (_properties == null) {
String getpropOutput = runCheckedSync(adbCommandForDevice(<String>['shell', 'getprop']));
RegExp propertyExp = new RegExp(r'\[(.*?)\]: \[(.*?)\]');
_properties = <String, String>{};
for (Match m in propertyExp.allMatches(getpropOutput)) {
_properties[m.group(1)] = m.group(2);
try {
String getpropOutput = runCheckedSync(adbCommandForDevice(<String>['shell', 'getprop']));
RegExp propertyExp = new RegExp(r'\[(.*?)\]: \[(.*?)\]');
for (Match m in propertyExp.allMatches(getpropOutput))
_properties[m.group(1)] = m.group(2);
} catch (error, trace) {
printError('Error retrieving device properties: $error');
printTrace(trace.toString());
}
}
return _properties[name];
}
......
......@@ -6,6 +6,8 @@ import 'dart:async';
final AppContext _defaultContext = new AppContext();
typedef void ErrorHandler(dynamic error);
/// A singleton for application functionality. This singleton can be different
/// on a per-Zone basis.
AppContext get context {
......@@ -56,7 +58,11 @@ class AppContext {
}
}
dynamic runInZone(dynamic method()) {
return runZoned(method, zoneValues: <String, dynamic>{'context': this});
dynamic runInZone(dynamic method(), { ErrorHandler onError }) {
return runZoned(
method,
zoneValues: <String, dynamic>{ 'context': this },
onError: onError
);
}
}
......@@ -64,7 +64,7 @@ class DaemonCommand extends FlutterCommand {
}, daemonCommand: this, notifyingLogger: notifyingLogger);
return daemon.onExit;
});
}, onError: _handleError);
}
dynamic _jsonEncodeObject(dynamic object) {
......@@ -72,6 +72,10 @@ class DaemonCommand extends FlutterCommand {
return _deviceToMap(object);
return object;
}
void _handleError(dynamic error) {
printError('Error from flutter daemon: $error');
}
}
typedef void DispatchComand(Map<String, dynamic> command);
......
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