【发布时间】:2013-09-29 09:32:49
【问题描述】:
我看到一些 SO 帖子讨论了如何以编程方式结束电话,例如,this one。是的,人们只关注结果,但没有人真正解释为什么会起作用?
我尝试了代码,它运行良好。但我想知道更多关于下面发生了什么的细节?为什么通过创建ITelephony.aidl,android隐藏的内部ITelephony接口暴露在我们的项目中?我们自己是如何创建 ITelephony.aidl 和自动生成的 java (/gen/ITelephony.java) link to android 的ITelephony 接口的?是不是因为名字匹配(包名&aidl文件名)?
TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
Class c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
//Why does the android internal ITelephony interface is exposed after created the ITelephony.aidl?
com.android.internal.telephony.ITelephony telephonyService = (ITelephony) m.invoke(tm);
telephonyService.endCall();
【问题讨论】:
标签: android performance android-intent aidl telephonymanager