Batch script for granting adb permissions

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
User avatar
Bluscre
Posts: 142
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

Batch script for granting adb permissions

Post by Bluscre » 12 Jan 2020 19:17

On unrooted devices there are some permissions that can be granted via a ADB connection. so it would be nice if there was a batch script that would use ADB to grant all grantable permissions through a PC without root
Unofficial AutoMagic Telegram Group: http://t.me/automagic4android
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.
Sent from my Lenovo TAB 2 A10-70L running Android 6.0.

User avatar
Desmanto
Posts: 2681
Joined: 21 Jul 2017 17:50

Re: Batch script for granting adb permissions

Post by Desmanto » 14 Jan 2020 17:35

Maybe we can just extract all available permission and then create the multiple lines command. Automagic 1.37 has all these permission.

Code: Select all

android.permission.ACCESS_COARSE_LOCATION
android.permission.ACCESS_FINE_LOCATION
android.permission.RECEIVE_BOOT_COMPLETED
android.permission.VIBRATE
android.permission.ACCESS_WIFI_STATE
android.permission.CHANGE_WIFI_STATE
android.permission.ACCESS_LOCATION_EXTRA_COMMANDS
android.permission.BLUETOOTH
android.permission.BLUETOOTH_ADMIN
android.permission.CALL_PHONE
android.permission.CAMERA
android.permission.DISABLE_KEYGUARD
android.permission.FLASHLIGHT
android.permission.GET_TASKS
android.permission.KILL_BACKGROUND_PROCESSES
android.permission.MODIFY_AUDIO_SETTINGS
android.permission.PROCESS_OUTGOING_CALLS
android.permission.READ_CALENDAR
android.permission.READ_CONTACTS
android.permission.READ_PHONE_STATE
android.permission.READ_SYNC_SETTINGS
android.permission.READ_SYNC_STATS
android.permission.RECEIVE_SMS
android.permission.RECORD_AUDIO
android.permission.SEND_SMS
android.permission.SET_WALLPAPER
android.permission.USE_CREDENTIALS
android.permission.WAKE_LOCK
android.permission.WRITE_CALENDAR
android.permission.WRITE_CONTACTS
android.permission.WRITE_EXTERNAL_STORAGE
android.permission.WRITE_SYNC_SETTINGS
android.permission.ACCESS_NETWORK_STATE
android.permission.CHANGE_NETWORK_STATE
android.permission.INTERNET
android.permission.NFC
android.permission.GET_ACCOUNTS
android.permission.READ_CALL_LOG
android.permission.WRITE_CALL_LOG
android.permission.BROADCAST_STICKY
android.permission.ACCESS_NOTIFICATION_POLICY
android.permission.ANSWER_PHONE_CALLS
android.permission.USE_FINGERPRINT
android.permission.USE_BIOMETRIC
android.permission.FOREGROUND_SERVICE
android.permission.WRITE_SECURE_SETTINGS
android.permission.ACTIVITY_RECOGNITION
android.permission.READ_EXTERNAL_STORAGE
android.permission.ACCESS_BACKGROUND_LOCATION
android.permission.ACCESS_MEDIA_LOCATION
To grant all above via adb shell, maybe these lines

Code: Select all

adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.ACCESS_COARSE_LOCATION
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.ACCESS_FINE_LOCATION
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.RECEIVE_BOOT_COMPLETED
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.VIBRATE
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.ACCESS_WIFI_STATE
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.CHANGE_WIFI_STATE
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.ACCESS_LOCATION_EXTRA_COMMANDS
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.BLUETOOTH
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.BLUETOOTH_ADMIN
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.CALL_PHONE
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.CAMERA
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.DISABLE_KEYGUARD
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.FLASHLIGHT
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.GET_TASKS
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.KILL_BACKGROUND_PROCESSES
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.MODIFY_AUDIO_SETTINGS
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.PROCESS_OUTGOING_CALLS
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.READ_CALENDAR
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.READ_CONTACTS
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.READ_PHONE_STATE
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.READ_SYNC_SETTINGS
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.READ_SYNC_STATS
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.RECEIVE_SMS
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.RECORD_AUDIO
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.SEND_SMS
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.SET_WALLPAPER
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.USE_CREDENTIALS
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.WAKE_LOCK
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.WRITE_CALENDAR
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.WRITE_CONTACTS
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.WRITE_EXTERNAL_STORAGE
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.WRITE_SYNC_SETTINGS
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.ACCESS_NETWORK_STATE
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.CHANGE_NETWORK_STATE
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.INTERNET
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.NFC
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.GET_ACCOUNTS
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.READ_CALL_LOG
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.WRITE_CALL_LOG
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.BROADCAST_STICKY
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.ACCESS_NOTIFICATION_POLICY
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.ANSWER_PHONE_CALLS
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.USE_FINGERPRINT
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.USE_BIOMETRIC
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.FOREGROUND_SERVICE
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.WRITE_SECURE_SETTINGS
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.ACTIVITY_RECOGNITION
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.READ_EXTERNAL_STORAGE
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.ACCESS_BACKGROUND_LOCATION
adb shell pm grant ch.gridvision.ppam.androidautomagic android.permission.ACCESS_MEDIA_LOCATION
However, there are some features/permissions those still require manual toggling. I just changed ROM and restore all my apps via migrate. It restored most app permissions correctly, including Automagic. But I still have to manually grant several features/permissions such as :
- Display over other app
- Modify setting
- Usage access
- Notification access
- Device Admin
- Do Not Disturb Access
- Accessibility

So I think although we have the script, there are still some manual stuff need to be done. Can't help with that. That's why I am so lazy to change ROM once I have settled with certain ROM.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply