diff options
author | 2015-07-30 20:39:46 +0000 | |
---|---|---|
committer | 2015-08-04 09:03:55 +0000 | |
commit | 73d4fc94dff31477e7882286784001956b170863 (patch) | |
tree | ca3b470398ed02563d5704d1c9583836c1d489e1 /src/main/java/com/google/devtools/build/lib/runtime | |
parent | d0d29795787a12a1594dcb1581bc2d2448d9a7d9 (diff) |
Add "warm" starting to mobile-install.
This introduces a new way to stop applications when deploying incremental
changes that saves the current app state for the next run. This allows things
like the back stack, and View/Fragment/Activity saved state to be restored when
the app next launches, making it easier to quickly iterate on code changes.
It adds a "--start" flag to mobile-install that replaces "--start_app".
--start accepts an argument describing the mode: no, cold, or warm. "no" is
now the equivalent of "--nostart_app", "cold" is the equivalent of
"--start_app", and "warm" is the new start mode.
Note that this is only useful with incremental installs, as Android clears out
any previously saved state when an APK is replaced.
--
MOS_MIGRATED_REVID=99508790
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/commands/MobileInstallCommand.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/MobileInstallCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/MobileInstallCommand.java index b68adb859e..13e2837dff 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/MobileInstallCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/MobileInstallCommand.java @@ -16,7 +16,9 @@ package com.google.devtools.build.lib.runtime.commands; import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.analysis.OutputGroupProvider; import com.google.devtools.build.lib.buildtool.BuildRequest; +import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.rules.android.WriteAdbArgsAction; +import com.google.devtools.build.lib.rules.android.WriteAdbArgsAction.StartType; import com.google.devtools.build.lib.runtime.BlazeCommand; import com.google.devtools.build.lib.runtime.BlazeRuntime; import com.google.devtools.build.lib.runtime.Command; @@ -64,6 +66,13 @@ public class MobileInstallCommand implements BlazeCommand { @Override public ExitCode exec(BlazeRuntime runtime, OptionsProvider options) { + Options mobileInstallOptions = options.getOptions(Options.class); + WriteAdbArgsAction.Options adbOptions = options.getOptions(WriteAdbArgsAction.Options.class); + if (adbOptions.start == StartType.WARM && !mobileInstallOptions.incremental) { + runtime.getReporter().handle(Event.warn( + "Warm start is enabled, but will have no effect on a non-incremental build")); + } + List<String> targets = ProjectFileSupport.getTargets(runtime, options); BuildRequest request = BuildRequest.create( this.getClass().getAnnotation(Command.class).name(), options, |