我使用ndk构建了一些命令行工具,并在/data/local/tmp中执行它。现在,当我在我的命令行工具中调用一些OpenSLES API时,它提示我“需要android.permission.RECORD_AUDIO”:
W/AudioRecord( 4226): AUDIO_INPUT_FLAG_FAST denied by client
W/ServiceManager( 207): Permission failure: android.permission.RECORD_AUDIO from uid=2000 pid=4226
E/ ( 207): Request requires android.permission.RECORD_AUDIO
D/PowerManagerService( 964): handleSandman: canDream=false, mWakefulness=Asleep
E/AudioFlinger( 207): openRecord() permission denied: recording not allowed
E/AudioRecord( 4226): AudioFlinger could not create record track, status: -1
E/libOpenSLES( 4226): android_audioRecorder_realize(0x453430) error creating AudioRecord object
W/libOpenSLES( 4226): Leaving Object::Realize (SL_RESULT_CONTENT_UNSUPPORTED)
我也尝试授予Shell权限,使用pm grant命令:
pm grant "com.android.shell" android.permission.RECORD_AUDIO
pm grant "com.android.shell" android.permission.RECORD_AUDIO
pm grant "com.android.shell" android.permission.RECORD_AUDIO
Operation not allowed: java.lang.SecurityException: Package com.android.shell has not requested permission android.permission.RECORD_AUDIO
更改/system/etc/permissions/platform.xml也没有效果。
我可以在Android shell中调试我的OpenSLES演示吗?如何在shell中获得更多权限。
每个实验代码片段都必须创建一个jni和java项目,并在更改某些C ++接口时一起修改吗?
我可以直接从shell中的命令工具访问RECORD_AUDIO、CAMERA吗?