use of com.android.sdklib.AndroidVersion in project android by JetBrains.
the class InstantRunBuilderTest method alternativeUiForHotswap.
@Test
public void alternativeUiForHotswap() throws Exception {
myDumpsysPackageOutput = DUMPSYS_PACKAGE_EXISTS;
myDeviceBuildTimetamp = "100";
myAppInForeground = true;
myRunConfigContext.setSameExecutorAsPreviousSession(true);
when(myDevice.getVersion()).thenReturn(new AndroidVersion(23, null));
setUpDeviceForHotSwap();
// normally we'd do a hotswap
myBuilder.build(myTaskRunner, Collections.emptyList());
assertEquals("gradlew -Pandroid.optional.compilation=INSTANT_DEV -Pandroid.injected.coldswap.mode=MULTIAPK :app:assemble", myTaskRunner.getBuilds());
// but a full apk is forced if this was launched from the new UI
boolean[] couldHaveInvokedHotswapValues = new boolean[] { true, false };
for (boolean couldHaveHotswaped : couldHaveInvokedHotswapValues) {
myRunConfigContext.setForceColdSwap(true, couldHaveHotswaped);
myTaskRunner = new RecordingTaskRunner();
myBuilder.build(myTaskRunner, Collections.emptyList());
assertEquals("gradlew -Pandroid.optional.compilation=INSTANT_DEV,RESTART_ONLY -Pandroid.injected.coldswap.mode=MULTIAPK :app:assemble", myTaskRunner.getBuilds());
}
}
use of com.android.sdklib.AndroidVersion in project android by JetBrains.
the class InstantRunBuilderTest method hotSwapBuild.
@Test
public void hotSwapBuild() throws Exception {
myDumpsysPackageOutput = DUMPSYS_PACKAGE_EXISTS;
myDeviceBuildTimetamp = "100";
myAppInForeground = true;
myRunConfigContext.setSameExecutorAsPreviousSession(true);
when(myDevice.getVersion()).thenReturn(new AndroidVersion(23, null));
setUpDeviceForHotSwap();
myBuilder.build(myTaskRunner, Collections.emptyList());
assertEquals("gradlew -Pandroid.optional.compilation=INSTANT_DEV -Pandroid.injected.coldswap.mode=MULTIAPK :app:assemble", myTaskRunner.getBuilds());
}
use of com.android.sdklib.AndroidVersion in project android by JetBrains.
the class InstantRunBuilderTest method coldSwapBuildIfUsingMultipleProcesses.
@Test
public void coldSwapBuildIfUsingMultipleProcesses() throws Exception {
myDumpsysPackageOutput = DUMPSYS_PACKAGE_EXISTS;
myDeviceBuildTimetamp = "100";
myAppInForeground = true;
myRunConfigContext.setSameExecutorAsPreviousSession(true);
when(myDevice.getVersion()).thenReturn(new AndroidVersion(23, null));
setUpDeviceForHotSwap();
when(myInstantRunContext.usesMultipleProcesses()).thenReturn(true);
myBuilder.build(myTaskRunner, Collections.emptyList());
assertEquals("gradlew -Pandroid.optional.compilation=INSTANT_DEV,RESTART_ONLY -Pandroid.injected.coldswap.mode=MULTIAPK :app:assemble", myTaskRunner.getBuilds());
}
use of com.android.sdklib.AndroidVersion in project android by JetBrains.
the class InstantRunBuilderTest method fullBuildIfNoLocalTimestamp.
@Test
public void fullBuildIfNoLocalTimestamp() throws Exception {
myDumpsysPackageOutput = DUMPSYS_NO_SUCH_PACKAGE;
when(myInstantRunContext.getInstantRunBuildInfo()).thenReturn(null);
when(myDevice.getVersion()).thenReturn(new AndroidVersion(23, null));
myBuilder.build(myTaskRunner, Collections.emptyList());
assertEquals("gradlew -Pandroid.optional.compilation=INSTANT_DEV,FULL_APK -Pandroid.injected.coldswap.mode=MULTIAPK :app:assemble", myTaskRunner.getBuilds());
}
use of com.android.sdklib.AndroidVersion in project android by JetBrains.
the class InstantRunBuilderTest method fullBuildWhenPackageNotInstalledForDefaultUser.
@Test
public void fullBuildWhenPackageNotInstalledForDefaultUser() throws Exception {
myDumpsysPackageOutput = "Packages:\n" + " Package [instant.run] (a1df9a8):\n" + " User 0: installed=false hidden=false stopped=true notLaunched=true enabled=0\n" + " runtime permissions:\n" + " User 10: installed=true hidden=false stopped=true notLaunched=false enabled=0\n" + " runtime permissions:\n";
myDeviceBuildTimetamp = "100";
when(myDevice.getVersion()).thenReturn(new AndroidVersion(23, null));
myBuilder.build(myTaskRunner, Collections.emptyList());
assertEquals("gradlew -Pandroid.optional.compilation=INSTANT_DEV,FULL_APK -Pandroid.injected.coldswap.mode=MULTIAPK :app:assemble", myTaskRunner.getBuilds());
}
Aggregations