I am trying to give BATTERSTATS permission to an app. When I run the command from a PC - it works just fine:
adb shell pm grant com.example.sample.myapplication android.permission.BATTERY_STATS
But the same pm grant command does not work when run from Android app:
java.lang.Process process = Runtime.getRuntime().exec("pm grant com.example.sample.myapplication android.permission.BATTERY_STATS");
Does it require root permission to give this permission?
If it is so, why it does not require the device to be rooted to run it via adb shell?
I am new to Android, please explain a bit more clearly what is happening inside and how to proceed.