@@ -13,7 +13,6 @@ import com.malinskiy.marathon.device.DeviceEvent
13
13
import com.malinskiy.marathon.device.DeviceEvent.DeviceConnected
14
14
import com.malinskiy.marathon.device.DeviceEvent.DeviceDisconnected
15
15
import com.malinskiy.marathon.device.DeviceProvider
16
- import com.malinskiy.marathon.exceptions.NoDevicesException
17
16
import com.malinskiy.marathon.execution.Configuration
18
17
import com.malinskiy.marathon.execution.StrictRunChecker
19
18
import com.malinskiy.marathon.io.AttachmentManager
@@ -68,33 +67,7 @@ class DdmlibDeviceProvider(
68
67
AndroidDebugBridge .addDeviceChangeListener(this )
69
68
70
69
logger.debug(" Creating ADB bridge" )
71
- val adb = AndroidDebugBridge .createBridge(vendorConfiguration.adbPath.absolutePath, false , ADB_INIT_TIMEOUT .toMillis(), TimeUnit .MILLISECONDS )
72
-
73
- var getDevicesCountdown = config.noDevicesTimeoutMillis
74
- val sleepTime = DEFAULT_DDM_LIB_SLEEP_TIME
75
- while (! adb.hasInitialDeviceList() || ! adb.hasDevices() && getDevicesCountdown >= 0 ) {
76
- logger.debug(" No devices, waiting..." )
77
-
78
- try {
79
- delay(sleepTime)
80
- } catch (e: InterruptedException ) {
81
- throw TimeoutException (" Timeout getting device list" , e)
82
- }
83
- getDevicesCountdown - = sleepTime
84
- }
85
-
86
- logger.debug(" Finished waiting for a device" )
87
-
88
- if (adb.devices.isNotEmpty()) {
89
- logger.debug(" Initial connected devices: {}" , adb.devices.joinToString(" , " ))
90
- adb.devices.forEach {
91
- deviceConnected(it)
92
- }
93
- }
94
-
95
- if (! adb.hasInitialDeviceList() || ! adb.hasDevices()) {
96
- throw NoDevicesException ()
97
- }
70
+ AndroidDebugBridge .createBridge(vendorConfiguration.adbPath.absolutePath, false , ADB_INIT_TIMEOUT .toMillis(), TimeUnit .MILLISECONDS )
98
71
}
99
72
100
73
private fun getDeviceOrPut (androidDevice : DdmlibAndroidDevice ): DdmlibAndroidDevice {
@@ -118,8 +91,6 @@ class DdmlibDeviceProvider(
118
91
}
119
92
}
120
93
121
- private fun AndroidDebugBridge.hasDevices (): Boolean = devices.isNotEmpty()
122
-
123
94
override suspend fun terminate () {
124
95
job.completeRecursively()
125
96
job.join()
@@ -250,6 +221,5 @@ class DdmlibDeviceProvider(
250
221
companion object {
251
222
private val ADB_INIT_TIMEOUT = Duration .ofSeconds(60 )
252
223
private const val DEFAULT_DDM_LIB_TIMEOUT = 30000
253
- private const val DEFAULT_DDM_LIB_SLEEP_TIME = 500L
254
224
}
255
225
}
0 commit comments