System app can't get "android.permission.CALL_PRIVILEGED"

-1

I have a system app, push in the /system/app, and I would like to call emergency phone number automatic without sim card. I can't do this through Intent.ACTION_CALL(can't call without sim card) and Intent.ACTION_DIAL(need confirm by user, not automatic), so I turn to CALL_PRIVILEGED.

I add it in my AndroidManifest.xml

<uses-permission android:name="android.permission.CALL_PRIVILEGED" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

but when I run the following code, it still tells me I didn't get permission.

    Intent intent = new Intent("android.intent.action.CALL_PRIVILEGED");
    Uri uri = Uri.parse("tel:112");
    intent.setData(uri);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mContext.startActivity(intent);

java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.CALL_PRIVILEGED dat=tel:xxx flg=0x10000000 cmp=com.android.server.telecom/.PrivilegedCallActivity } from ProcessRecord{ecae56c 15749:voicewakeupautomatedtest/u0a200} (pid=15749, uid=10200) requires android.permission.CALL_PRIVILEGED
java
android
android-permissions
asked on Stack Overflow Jan 4, 2020 by Liu

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0