Получаю ParcelFileDecriptor таким образом ParcelFileDescriptor.fromSocket(socket) чтобы потом передать через AIDL в другой процесс. Но иногда он мне возвращает не валидный где FileDescriptor равен -1. И когда я пытаюсь передать через AIDL то получаю крэш. Почему такое происходит?
1 ответ
Возможно, в работе уже есть какой-то объект? В документации написано так: ParcelFileDescriptor fromSocket (Socket socket)
Create a new ParcelFileDescriptor from the specified Socket. The new ParcelFileDescriptor holds a dup of the original FileDescriptor in the Socket, so you must still close the Socket as well as the new ParcelFileDescriptor.