From 3fe7cbff90bec38ad8822e528e0834cb078d18ab Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Wed, 12 Apr 2017 14:09:51 +0200 Subject: [PATCH] Add permissions grant for liblinphone tester --- liblinphone_tester/build.gradle | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/liblinphone_tester/build.gradle b/liblinphone_tester/build.gradle index 5bcdadabe..b8737bdd6 100644 --- a/liblinphone_tester/build.gradle +++ b/liblinphone_tester/build.gradle @@ -86,6 +86,37 @@ android { } } +// Grant permissions +task grantPermissionCamera(type: Exec, dependsOn: 'installDebugAndroidTest') { + def applicationId = "${getPackageName()}.test" + def adb = android.getAdbExe().toString() + outputs.dir '.' + commandLine "${adb} shell pm grant ${applicationId} android.permission.CAMERA" +} + +task grantPermissionStorage(type: Exec, dependsOn: 'installDebugAndroidTest') { + def applicationId = "${getPackageName()}.test" + def adb = android.getAdbExe().toString() + outputs.dir '.' + commandLine "${adb} shell pm grant ${applicationId} android.permission.WRITE_EXTERNAL_STORAGE" +} + +task grantPermissionAudio(type: Exec, dependsOn: 'installDebugAndroidTest') { + def applicationId = "${getPackageName()}.test" + def adb = android.getAdbExe().toString() + outputs.dir '.' + commandLine "${adb} shell pm grant ${applicationId} android.permission.RECORD_AUDIO" +} + +// When we launch test +tasks.whenTaskAdded { task -> + if (task.name.startsWith('connectedDebugAndroidTest')) { + task.dependsOn grantPermissionCamera + task.dependsOn grantPermissionAudio + task.dependsOn grantPermissionStorage + } +} + tasks.withType(Test) { testLogging { exceptionFormat 'full'