【问题标题】:Binder invocation to an incorrect interface During ITelephony Implemetation在 ITelephony 实施期间对错误接口的 Binder 调用
【发布时间】: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#

【问题讨论】:

    标签: java android


    【解决方案1】:

    packagename 应该是 com.android.internal.telephony 而不是您在aidl 目录中的应用包名。

    【讨论】:

      猜你喜欢
      • 2017-01-17
      • 1970-01-01
      • 1970-01-01
      • 2013-06-23
      • 2016-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-25
      相关资源
      最近更新 更多