Get microphone permissions without requesting them and Android

Viewed 34

I'm working on an android based device, and I need to get the microphone permissions as the main app running on it needs it for some interactions. I use a custom ASOP (Android 9) in which I tried to grant the permissions to the specific service that needs it, and also in the main app.

in DefaultPermissionGrantPolicy.java

    PackageParser.Package customAudioServicesPackage = getSystemPackage("com.mycustomaudioservice");
    if (customAudioServicesPackage != null
            && doesPackageSupportRuntimePermissions(customAudioServicesPackage)) {
        grantRuntimePermissions(customAudioServicesPackage, MICROPHONE_PERMISSIONS, userId);
        grantRuntimePermissions(customAudioServicesPackage, STORAGE_PERMISSIONS, userId);
    }

In the app AndroidManifest.xml:

  <uses-permission android:name="android.permission.RECORD_AUDIO" />

but I still don't get the permission unless I give it manually to the service (which runs as a system app) in the app settings.

0 Answers
Related