Sunday, January 27, 2019

Modify Android Permissions with ADB

First:
Lets get a list of permissions:
./adb shell pm list permissions -d -g


Second:
Query against each permission:
./adb shell cmd appops query-op {X} allow | sort
./adb shell cmd appops query-op {X} default | sort
Where {X} is the Permission Name. Example:
./adb shell cmd appops query-op READ_SMS allow | sort

Third:
Change the permission for a specific package:
./adb shell cmd appops set {Y} {X} ignore
Where {Y} is the package name, {X} is the Permission Name. Example:
 ./adb shell cmd appops set com.whatsapp WRITE_CONTACTS ignore

Fourth:
Some important permissions you need to change:
VIBRATE
RUN_IN_BACKGROUND
WRITE_SETTINGS
PICTURE_IN_PICTURE
WIFI_SCAN
CAMERA
USE_FINGERPRINT
MONITOR_LOCATION
MONITOR_HIGH_POWER_LOCATION
TOAST_WINDOW
READ_EXTERNAL_STORAGE
WRITE_EXTERNAL_STORAGE

No comments: