首页 > 解决方案 > 我可以使用 com.android.internal.Itelephony 吗?

问题描述

我问我是否可以使用 com.android.internal.Itelephony 并使用这个包的方法。我可以通过 exoloit 这个包中包含的方法来实现这个接口。

标签: javaandroid

解决方案


I dont think so. The ITelephony package is internal so you cannot get reference it in the standard format else you use reflection to access the methods. e.g

TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);

Method m1 = tm.getClass().getDeclaredMethod("getITelephony");
m1.setAccessible(true);
Object iTelephony = m1.invoke(tm);

Method m3 = iTelephony.getClass().getDeclaredMethod("endCall"); 

m2.invoke(iTelephony);

You will need the following permissions to make it work

READ_PHONE_STATE

CALL_PHONE

Note in some cases it might not work until you add the permission MODIFY_PHONE_STATE which is granted to system apps only


推荐阅读