【发布时间】:2018-06-21 14:57:14
【问题描述】:
我已将 ITelephony AIDL 文件创建为接口,如附图所示。使用此代码时出现以下错误。
Class<?> loadClass = CallBlockerPhoneStateListner.class.getClassLoader().loadClass("android.os.ServiceManager");
Method method = loadClass.getDeclaredMethod("getService", String.class);
IBinder invoke = (IBinder) method.invoke(null, TELEPHONY_SERVICE);
ITelephony iTelephony = ITelephony.Stub.asInterface(invoke);
iTelephony.endCall();
抛出错误:
06-21 11:31:26.977 17511-17511/? W/System.err: java.lang.SecurityException: Binder invocation to an incorrect interface
06-21 11:31:26.977 17511-17511/? W/System.err: at android.os.Parcel.readException(Parcel.java:2005)
06-21 11:31:26.977 17511-17511/? W/System.err: at android.os.Parcel.readException(Parcel.java:1951)
06-21 11:31:26.977 17511-17511/? W/System.err: at jss.s.ITelephony$Stub$Proxy.endCall(ITelephony.java:131)
你能指导如何解决这个问题吗? Ref 取自 https://www.programcreek.com/java-api-examples/?code=384401056/itheima/itheima-master/MobileSafe/src/com/blueice/mobilesafe/service/BlackListService.java#
【问题讨论】: