question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add ability to set which permissions should be granted to app

See original GitHub issue

Feature request

I used option autoGrantPermissions, but it takes a lot of time (10 seconds sometimes) and most of them i don’t need. Can we extend the autoGrantPermissions option to able pass string or array of strings of required permissions.

I believe it can speed up configuring time.

Example:

desiredCapabilities: {
...
autoGrantPermissions: ['android.permission.ACCESS_COARSE_LOCATION', 'android.permission.ACCESS_FINE_LOCATION']
...
}

Log:

2019-03-13T14:56:42.507268625Z 2019-03-13 14:56:42:506 - [debug] [ADB] Granting permissions ["android.permission.CAMERA","android.permission.BIND_APPWIDGET","android.permission.WRITE_SETTINGS","android.permission.WRITE_SECURE_SETTINGS","android.permission.MODIFY_PHONE_STATE","android.permission.ACCESS_MOCK_LOCATION","android.permission.ACCESS_COARSE_LOCATION","android.permission.ACCESS_FINE_LOCATION","android.permission.WRITE_EXTERNAL_STORAGE","android.permission.CALL_PHONE","android.permission.FOREGROUND_SERVICE","android.permission.READ_EXTERNAL_STORAGE","android.permission.READ_CONTACTS","android.permission.WRITE_CONTACTS","android.permission.SYSTEM_ALERT_WINDOW","android.permission.READ_PHONE_STATE","android.permission.READ_CALL_LOG","android.permission.RECORD_AUDIO","android.permission.QUICKBOOT_POWERON"] to 'ru.yandex.searchplugin'
2019-03-13T14:56:42.507902712Z 2019-03-13 14:56:42:507 - [debug] [ADB] Got the following command chunks to execute: [["pm","grant","ru.yandex.searchplugin","android.permission.CAMERA",";","pm","grant","ru.yandex.searchplugin","android.permission.BIND_APPWIDGET",";","pm","grant","ru.yandex.searchplugin","android.permission.WRITE_SETTINGS",";","pm","grant","ru.yandex.searchplugin","android.permission.WRITE_SECURE_SETTINGS",";","pm","grant","ru.yandex.searchplugin","android.permission.MODIFY_PHONE_STATE",";","pm","grant","ru.yandex.searchplugin","android.permission.ACCESS_MOCK_LOCATION",";","pm","grant","ru.yandex.searchplugin","android.permission.ACCESS_COARSE_LOCATION",";","pm","grant","ru.yandex.searchplugin","android.permission.ACCESS_FINE_LOCATION",";","pm","grant","ru.yandex.searchplugin","android.permission.WRITE_EXTERNAL_STORAGE",";","pm","grant","ru.yandex.searchplugin","android.permission.CALL_PHONE",";","pm","grant","ru.yandex.searchplugin","android.permission.FOREGROUND_SERVICE",";","pm","grant","ru.yandex.searchplugin","android.permission.READ_EXTERNAL_STORAGE",";","pm","grant","ru.yandex.searchplugin","android.permission.READ_CONTACTS",";","pm","grant","ru.yandex.searchplugin","android.permission.WRITE_CONTACTS",";"],["pm","grant","ru.yandex.searchplugin","android.permission.SYSTEM_ALERT_WINDOW",";","pm","grant","ru.yandex.searchplugin","android.permission.READ_PHONE_STATE",";","pm","grant","ru.yandex.searchplugin","android.permission.READ_CALL_LOG",";","pm","grant","ru.yandex.searchplugin","android.permission.RECORD_AUDIO",";","pm","grant","ru.yandex.searchplugin","android.permission.QUICKBOOT_POWERON",";"]]
2019-03-13T14:56:42.508363783Z 2019-03-13 14:56:42:508 - [debug] [ADB] Running '/opt/android-sdk-linux/platform-tools/adb -P 5037 -s emulator-5554 shell pm grant ru.yandex.searchplugin android.permission.CAMERA \; pm grant ru.yandex.searchplugin android.permission.BIND_APPWIDGET \; pm grant ru.yandex.searchplugin android.permission.WRITE_SETTINGS \; pm grant ru.yandex.searchplugin android.permission.WRITE_SECURE_SETTINGS \; pm grant ru.yandex.searchplugin android.permission.MODIFY_PHONE_STATE \; pm grant ru.yandex.searchplugin android.permission.ACCESS_MOCK_LOCATION \; pm grant ru.yandex.searchplugin android.permission.ACCESS_COARSE_LOCATION \; pm grant ru.yandex.searchplugin android.permission.ACCESS_FINE_LOCATION \; pm grant ru.yandex.searchplugin android.permission.WRITE_EXTERNAL_STORAGE \; pm grant ru.yandex.searchplugin android.permission.CALL_PHONE \; pm grant ru.yandex.searchplugin android.permission.FOREGROUND_SERVICE \; pm grant ru.yandex.searchplugin android.permission.READ_EXTERNAL_STORAGE \; pm grant ru.yandex.searchplugin android.permission.READ_CONTACTS \; pm grant ru.yandex.searchplugin android.permission.WRITE_CONTACTS \;'
2019-03-13T14:56:50.233939499Z 2019-03-13 14:56:50:233 - [debug] [ADB] Running '/opt/android-sdk-linux/platform-tools/adb -P 5037 -s emulator-5554 shell pm grant ru.yandex.searchplugin android.permission.SYSTEM_ALERT_WINDOW \; pm grant ru.yandex.searchplugin android.permission.READ_PHONE_STATE \; pm grant ru.yandex.searchplugin android.permission.READ_CALL_LOG \; pm grant ru.yandex.searchplugin android.permission.RECORD_AUDIO \; pm grant ru.yandex.searchplugin android.permission.QUICKBOOT_POWERON \;'
2019-03-13T14:56:52.415043839Z 2019-03-13 14:56:52:414 - [AndroidDriver] Unable to grant permissions requested. Original error: Error executing adbExec. Original error: 'Command '/opt/android-sdk-linux/platform-tools/adb -P 5037 -s emulator-5554 shell pm grant ru.yandex.searchplugin android.permission.SYSTEM_ALERT_WINDOW \; pm grant ru.yandex.searchplugin android.permission.READ_PHONE_STATE \; pm grant ru.yandex.searchplugin android.permission.READ_CALL_LOG \; pm grant ru.yandex.searchplugin android.permission.RECORD_AUDIO \; pm grant ru.yandex.searchplugin android.permission.QUICKBOOT_POWERON \;' exited with code 1'; Stderr: 'Bad argument: java.lang.IllegalArgumentException: Unknown permission: android.permission.QUICKBOOT_POWERON

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
DudaGodcommented, Mar 21, 2019

I’ve already checked that it works in latest version of appium@1.12.0.

Anyway thank you.

0reactions
lock[bot]commented, Mar 21, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Permissions on Android - Android Developers
If you decide that your app must access restricted data or perform restricted actions to fulfill a use case, declare the appropriate permissions....
Read more >
Review permissions granted to applications - Microsoft Entra
In this article, you'll learn how to review permissions granted to applications in your Azure Active Directory (Azure AD) tenant.
Read more >
App Permissions in Permission Sets - Salesforce Help
App permissions control what users can do within a specific app. For example, the “Import Leads” permission allows users to import leads in...
Read more >
Allow accessibility apps to access your Mac - Apple Support
(You may need to scroll down.) Turn permission on or off for any app in the list. If you don't see the app...
Read more >
App Permissions on Android & How to Control Them - AVG
Concerned about what a particular app can access on your phone? Here's how to manage permissions on a specific app: Open Settings and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found