@@ -41,6 +41,7 @@ class AndroidAppInstaller(configuration: Configuration) {
41
41
}
42
42
}
43
43
reinstall(device, applicationInfo.applicationPackage, applicationApk, bundle.splitApks ? : emptyList())
44
+ appops(device, applicationInfo.applicationPackage)
44
45
}
45
46
46
47
bundle.extraApplications?.let { extraApplications ->
@@ -53,22 +54,21 @@ class AndroidAppInstaller(configuration: Configuration) {
53
54
54
55
logger.debug { " Installing instrumentation package to ${device.serialNumber} " }
55
56
reinstall(device, applicationInfo.instrumentationPackage, bundle.testApplication)
56
- appops(device, applicationInfo.instrumentationPackage)
57
57
logger.debug { " Prepare installation finished for ${device.serialNumber} " }
58
58
}
59
59
60
- private suspend fun appops (device : AndroidDevice , instrumentationPackage : String ) {
60
+ private suspend fun appops (device : AndroidDevice , applicationPackage : String ) {
61
61
if (androidConfiguration.mockLocation) {
62
62
if (device.apiLevel < 23 ) {
63
63
logger.warn { " Can't setup mock location: device ${device.serialNumber} doesn't support appops" }
64
64
return
65
65
}
66
66
67
- val appopsMessage = device.criticalExecuteShellCommand(" appops set $instrumentationPackage android:mock_location allow" )
67
+ val appopsMessage = device.criticalExecuteShellCommand(" appops set $applicationPackage android:mock_location allow" )
68
68
appopsMessage.let {
69
69
if (it.exitCode != 0 ) {
70
70
val (output, _) = device.criticalExecuteShellCommand(" appops query-op android:mock_location allow" )
71
- logger.error { " Can't set android:mock_location on $instrumentationPackage . List of apps currently using android:mock_location:$output " }
71
+ logger.error { " Can't set android:mock_location on $applicationPackage . List of apps currently using android:mock_location:$output " }
72
72
}
73
73
}
74
74
}
0 commit comments