在安卓11上,远程绑定服务绑定在从客户端应用程序调用时失败
问题仅限于Android 11。
1:使用带有AIDL接口的远程绑定服务的。此服务来自服务B,该服务还使用AIDL接口。
public class IPCEnterpriseServicePcsc extends IPCServicePcsc {
...
protected IPCEnterpriseInterfaceLicense licenseBinder;
...
}
public class IPCEnterpriseInterfaceLicense extends IRemotePcscServiceLicense.Stub {...}
public class IPCServicePcsc extends IPCService {
...
protected IPCInterfacePcsc mBinder;
...
}
public class IPCInterfacePcsc extends IRemotePcscService.Stub{...}下面的2.是定义服务的服务器应用程序的说明:
<service android:label="@string/pcsc_service_name" android:name=".IPCEnterpriseServicePcsc" >
<intent-filter>
<action android:name="com.baimobile.android.enterprise.credential.service.ipc.action.BIND_PCSC" />
<action android:name="com.baimobile.android.enterprise.credential.service.ipc.action.BIND_LICENSE" />
<action android:name="com.baimobile.android.enterprise.credential.service.license.action.VALIDATE_USER_LICENSE_INFO" />
</intent-filter>
</service>
server app id is "com.baimobile.android.enterprise.credential.service"来自客户端应用程序的3.1,服务'IPCEnterpriseServicePcsc‘被调用如下:
意图=新的Intent("com.baimobile.android.enterprise.credential.service.ipc.action.BIND_LICENSE");intent.setPackage("com.baimobile.android.enterprise.credential.service");intent.putExtra(“接口”、"IRemotePcscServiceLicense");
布尔pcscServiceInstalled =appContext.bindService(意图,connectionToPcscInterface,Context.BIND_AUTO_CREATE);
3.2: connectionToPcscInterface定义为:
private ServiceConnection connectionToPcscInterface = new ServiceConnection() {
public void onServiceConnected(ComponentName remoteComponent, IBinder binder) {...};
public void onServiceDisconnected(ComponentName arg0) {..};
}3.3:在步骤3.1中使用成功的appContext.bindService(),步骤3.2中指导的onServiceConnected()由服务调用。这里我们正在进行一些验证,然后绑定到基类服务IPCServicePcsc。
Intent intent = new Intent("com.baimobile.android.pcsclite.service.ipc.action.BIND_PCSC");
intent.setPackage("com.baimobile.android.enterprise.credential.service");
intent.putExtra("Interface","IRemotePcscService"); // Request the PC/SC interface instead of the license interface.
pcscServiceInstalled = appContext.bindService(intent, connectionToPcscInterface, Context.BIND_AUTO_CREATE);
if( ! pcscServiceInstalled ){
Log.e("TAG","bindService failed.");
}问题陈述:直到Android10,客户端应用程序能够很好地连接这些服务,但是在Android11上,绑定步骤3.3失败。
任何知道什么可能是问题,并寻找建议,以排除它。在Android 11上,似乎有什么东西坏了或者变硬了。
发布于 2021-03-23 10:57:38
谢谢CommonsWare!你的建议帮助解决了这个问题。
为了在查询中使用AndroidManifest.xml,必须进行升级,
https://stackoverflow.com/questions/66691117
复制相似问题