AWS Device Farm - Android 仪器化测试的权限

AWS Device Farm - permissions for Android Instrumented test

是否可以为 AWS 设备场中的 espresso 插装测试授予安全权限?我需要在 Android 10 及更高版本中授予“android.permission.ACCESS_BACKGROUND_LOCATION”,它是安全的,只能在应用程序的系统设置中授予。

您可以在 pre_test 阶段

中使用以下示例命令在自定义 YML 文件中为 espresso 插装测试授予安全权限
# These next lines set the permissions of the app
- adb shell pm grant io.appium.settings android.permission.ACCESS_COARSE_LOCATION
- adb shell pm grant io.appium.settings android.permission.ACCESS_FINE_LOCATION
- adb shell pm grant io.appium.settings android.permission.CHANGE_CONFIGURATION
- adb shell am start -W -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000
- adb shell appops set io.appium.settings android:mock_location allow