Enables emulatorControl from convention plugins

Change-Id: I2d544e9605b7c24eb8cf6528425bd95ab9b1e51f
ja/edge-to-edge-dropshots
Jose Alcérreca 8 months ago
parent ec53bddb9b
commit 9c101f2224

@ -61,15 +61,6 @@ android {
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
}
}
testOptions {
unitTests {
isIncludeAndroidResources = true
}
// Espresso Device
emulatorControl {
enable = true
}
}
namespace = "com.google.samples.apps.nowinandroid"
}

@ -91,36 +91,34 @@ class EdgeToEdgeTest {
@Before
fun enableDemoMode() {
UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()).apply {
executeShellCommand(
"settings put global development_settings_enabled 1",
)
executeShellCommand("settings put global sysui_demo_allowed 1")
executeShellCommand(
"am broadcast -a com.android.systemui.demo -e command " +
"enter",
)
executeShellCommand(
"am broadcast -a com.android.systemui.demo -e command " +
"notifications -e visible false",
)
executeShellCommand(
"am broadcast -a com.android.systemui.demo -e command " +
"clock -e hhmm 1234",
)
executeShellCommand(
"am broadcast -a com.android.systemui.demo -e command " +
"network -e wifi hide",
)
executeShellCommand(
"am broadcast -a com.android.systemui.demo -e command " +
"network -e mobile hide",
)
executeShellCommand(
"am broadcast -a com.android.systemui.demo -e command " +
"network -e satellite hide",
)
}
executeShellCommand(
"settings put global development_settings_enabled 1",
)
executeShellCommand("settings put global sysui_demo_allowed 1")
executeShellCommand(
"am broadcast -a com.android.systemui.demo -e command " +
"enter",
)
executeShellCommand(
"am broadcast -a com.android.systemui.demo -e command " +
"notifications -e visible false",
)
executeShellCommand(
"am broadcast -a com.android.systemui.demo -e command " +
"clock -e hhmm 1234",
)
executeShellCommand(
"am broadcast -a com.android.systemui.demo -e command " +
"network -e wifi hide",
)
executeShellCommand(
"am broadcast -a com.android.systemui.demo -e command " +
"network -e mobile hide",
)
executeShellCommand(
"am broadcast -a com.android.systemui.demo -e command " +
"network -e satellite hide",
)
}
@After
@ -332,7 +330,7 @@ class EdgeToEdgeTest {
private fun executeShellCommand(command: String) {
runOnUiThread {
InstrumentationRegistry.getInstrumentation().uiAutomation.executeShellCommand(command)
UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()).executeShellCommand(command)
}
// ADB commands are not synchronized. This sleep was found empirically.
Thread.sleep(20)

@ -42,6 +42,8 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
@Suppress("UnstableApiUsage")
testOptions.animationsDisabled = true
configureGradleManagedDevices(this)
testOptions.emulatorControl.enable = true
// testOptions.unitTests.isIncludeAndroidResources
}
extensions.configure<ApplicationAndroidComponentsExtension> {
configurePrintApksTask(this)

@ -32,6 +32,7 @@ class AndroidFeatureConventionPlugin : Plugin<Project> {
extensions.configure<LibraryExtension> {
testOptions.animationsDisabled = true
testOptions.emulatorControl.enable = true
configureGradleManagedDevices(this)
}

@ -40,6 +40,7 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
defaultConfig.targetSdk = 35
defaultConfig.testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testOptions.animationsDisabled = true
testOptions.emulatorControl.enable = true
configureFlavors(this)
configureGradleManagedDevices(this)
// The resource prefix is derived from the module name,

Loading…
Cancel
Save