How to grant permission for application which is downloaded from play store?

Rubanraj Ravichandran picture Rubanraj Ravichandran · May 9, 2015 · Viewed 10.5k times · Source

Already I know google denied this dump permission except system applications from version 4.1 and more.

But still I can able to grant this dump permission using following command for debuggable applications.,

command :

adb shell pm grant "com.packageName" android.permission.DUMP

But i cannot do the same for the applications which is downloaded from play store,

command :

adb shell pm grant "com.playStoreApp" android.permission.DUMP

error :

Operation not allowed: java.lang.SecurityException: Package com.playStoreApp has not requested permission android.permission.DUMP

Is there is any hack or work around to grant permission for play store apps?

Thanks in advance.

Answer

PaulR picture PaulR · Sep 17, 2015

There is not a workaround. android.permission.Dump is protected by system, signature, and development permission protection levels. Line 1993 of the source shows you this. If your APK is signed with the framework cert, is in the priv-app directory, or debuggable (see below) you can use the pm service to grant the permission, but otherwise the code specifically prevents what you're asking for (line 2624 of source).

Debuggable APKs can be created through setting the debuggable attribute on a buildType via build.gradle. Sample Android DSL:

android {
    ...
    buildTypes {
        debug {
            debuggable true
            ...
        }
        quality_assurance {
            debuggable true
        }
    ...
}