Merge pull request #1446 from jason-simmons/app_process_restart

Add a --full-restart flag to the start command that controls whether …
This commit is contained in:
Jason Simmons
2016-01-28 14:23:01 -08:00
2 changed files with 7 additions and 15 deletions

View File

@@ -251,7 +251,6 @@ class AndroidDevice extends Device {
}
bool startBundle(AndroidApk apk, String bundlePath, {
bool poke: false,
bool checked: true,
bool traceStartup: false,
String route,
@@ -264,8 +263,7 @@ class AndroidDevice extends Device {
return false;
}
if (!poke)
_forwardObservatoryPort();
_forwardObservatoryPort();
if (clearLogs)
this.clearLogs();
@@ -276,6 +274,7 @@ class AndroidDevice extends Device {
'shell', 'am', 'start',
'-a', 'android.intent.action.RUN',
'-d', deviceTmpPath,
'-f', '0x20000000', // FLAG_ACTIVITY_SINGLE_TOP
]);
if (checked)
cmd.addAll(['--ez', 'enable-checked-mode', 'true']);
@@ -307,7 +306,6 @@ class AndroidDevice extends Device {
if (startBundle(
package,
buildResult.localBundlePath,
poke: platformArgs['poke'],
checked: checked,
traceStartup: platformArgs['trace-startup'],
route: route,

View File

@@ -54,9 +54,9 @@ class StartCommand extends StartCommandBase {
'(defaults to checked/debug mode) (Android only).';
StartCommand() {
argParser.addFlag('poke',
negatable: false,
help: 'Restart the connection to the server.');
argParser.addFlag('full-restart',
defaultsTo: true,
help: 'Stop any currently running application process before starting the app.');
argParser.addFlag('clear-logs',
defaultsTo: true,
help: 'Clear log history before starting the app.');
@@ -71,21 +71,18 @@ class StartCommand extends StartCommandBase {
downloadApplicationPackagesAndConnectToDevices(),
], eagerError: true);
bool poke = argResults['poke'];
bool clearLogs = argResults['clear-logs'];
// Only stop and reinstall if the user did not specify a poke.
int result = await startApp(
devices,
applicationPackages,
toolchain,
target: argResults['target'],
install: !poke,
stop: !poke,
install: true,
stop: argResults['full-restart'],
checked: argResults['checked'],
traceStartup: argResults['trace-startup'],
route: argResults['route'],
poke: poke,
clearLogs: clearLogs
);
@@ -104,7 +101,6 @@ Future<int> startApp(
bool checked: true,
bool traceStartup: false,
String route,
bool poke: false,
bool clearLogs: false
}) async {
@@ -138,8 +134,6 @@ Future<int> startApp(
Map<String, dynamic> platformArgs = <String, dynamic>{};
if (poke != null)
platformArgs['poke'] = poke;
if (traceStartup != null)
platformArgs['trace-startup'] = traceStartup;
if (clearLogs != null)