我有一个系统服务 KioskService。在这个系统服务中,我像这样调用另一个系统服务 DpcService:
public class KioskService extends IKioskService.Stub{
private Context mContext;
private IDpcService dpcService;
public KioskService(Context context) {
mContext = context;
}
@Override
public void exitKiosk() {
try{
String[] emptyArray = {""};
dpcService = IDpcService.Stub.asInterface(getBinder("dpc"));
dpcService.setLockTaskPackages(emptyArray);
}
catch(Exception e){
Log.e("TAG","Exit Kiosk Exception",e);
}
}
private IBinder getBinder(String serviceName) {
IBinder serviceBinder;
serviceBinder = ServiceManager.getService(serviceName);
if (serviceBinder == null) {
return null;
}
return serviceBinder;
}
}
但是我收到此错误:
05-06 06:40:00.088 604 604 E SELinux : avc: denied { find } for service=msi_dpc pid=5375 uid=1000 scontext=u:r:kiosk_app:s0 tcontext=u:object_r:dpc_service:s0 tclass=service_manager许可=0
我想,原因是因为使用 Selinux 策略,我必须允许我的 kiosk 服务使用我的 dpc 服务。如果是这种情况,我该怎么做?