History log of /frameworks/native/libs/vr/libpdx_uds/client_channel_factory.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e41826ac301b9afad1cbfe59c57e27f2495be968 02-May-2017 Alex Vakulenko <avakulenko@google.com> libpdx_uds: Always create channel sockets in the server process

Whenever a client connects to PDX service endpoint, the connected
socket was being used as the channel connection. This makes it
difficult to ensure that the socket has the appropriate SELinux
label applied.

Changed the implementation to make sure that the actual channel socket
pair is created in one place in the server process.

The new Endpoint::CreateChannelSocketPair() is now being used to
create the channel sockets when an incoming connection is accepted
and when PushChannel request is received.

The newly created channel socket is sent to the client in response
to connection request.

Bug: 37646189
Test: Device boots. CubeSea launches.
Change-Id: Id3158484aeb18007f18b279afc60613076f80f14
/frameworks/native/libs/vr/libpdx_uds/client_channel_factory.cpp
6eefa42d33bdddc3603211634f98937b00abc532 18-Apr-2017 Alex Vakulenko <avakulenko@google.com> libpdx_uds: Allow to create Endpoint/ClientChannel from a socket pair

This is important to enable Service/Client operation in unit tests.
Being able to create a pair of Unix domain sockets and construct both
Service and Client so that they can talk to each other without having
to create a physical socket file is convenient.

This change makes it possible to create an instance of Endpoint and
ClientChannel classes based just on a pair of sockets (Endpoint does
take another socket to simulate the main endpoint FD to accept incoming
connection on, but it is not used for this, only the shutdown events
are received from that main socket. Endpoint uses the channel FD to
perform actual communication with the client).

Bug: 37443070
Test: `libpdx_uds_tests` pass
Change-Id: Ifa1a9d03b97bd90282a04715c2105ad37a8de936
/frameworks/native/libs/vr/libpdx_uds/client_channel_factory.cpp
c0fd676fa087b38b63d253536c6fc9513a0470c8 12-Apr-2017 Alex Vakulenko <avakulenko@google.com> libpdx_uds: Handle EACCES error when connecting to PDX service

There is a race condition in the way init process creates socket
files before it forks into a child (see system/core/init/util.cpp,
function create_socket()). It first creates a socket, then calls
bind() which creates a file entry, then calls chown/chmod to change
ownership and access permissions of that file object. If a client
process connects to the socket just after bind() was called but before
chmod(), the socket file will have incorrect permissions and the
connect call will be aborted with EACCESS (Permission denied) error.

We should retry connection in case we get EACCESS. A proper fix would
be is to find a way for init to create the file entry with the proper
permissions to start with, and eliminate the race condition altogether.

Bug: 37171113
Test: `lunch sailfish-eng && m -j32` succeeds
Device boots correctly.
Error recovery is handled correctly even after adding sleep(5)
to init process just before calling chmod on the socket.

Change-Id: If97c316daa0c0be5ff7b5aa302a69aa60e9fb237
/frameworks/native/libs/vr/libpdx_uds/client_channel_factory.cpp
09aa736ee6136787b18807d7ab459feba23cec04 06-Apr-2017 Alex Vakulenko <avakulenko@google.com> libpdx_uds: Fix RPC channel ID allocation to not recycle values as often

The value of channel ID for PDX service on UDS transport was actual file
descriptor value for the data socket. Since channels are open and closed
constantly, it is quite often that channel ID is being reused immediately,
so it is almost impossible to use `cid` as unique identifier for objects
being passed around.

Instead, we now use monotonically growing channel ID value.

To prevent the possibility of using channel ID as the socket FD and vice
versa, changed all helper functions that used to take socket_fd as an int
to explicitly use BorrowedHandle which disables implicit conversion from
int (and hence makes it impossible to mistakenly pass in the channel ID).

Bug: 37082296
Test: `m -j32` succeeds for sailfish-eng
Ran libpdx_uds_tests on the device -> all pass
Device boots and CubeSea and VrHome render correctly with vr_flinger

Change-Id: Ibb8dfee4d6c3f4b6120c0b6e20a253f1b9307c19
/frameworks/native/libs/vr/libpdx_uds/client_channel_factory.cpp
4782814b340bb55a0fbff9f7b6cfd4d27cffd85a 24-Mar-2017 Alex Vakulenko <avakulenko@google.com> libpdx_uds: Improve client connection logic

Handle the case where the service created a socket file but not bound the
socket to it, or not listening for incoming requests yet. Also, if the service
has crashed and left the socket file behind, need to make sure we reconnect
once the service is restarted.

Bug: None
Test: `m -j32` succeeds, device boots and CubeSea app works on Sailfish
Change-Id: I2039cfca6faccd5d1d4b725e454075669484b880
(cherry picked from commit d074fc416a7a90e76a0b28a870080c1dd30079a1)
/frameworks/native/libs/vr/libpdx_uds/client_channel_factory.cpp
e4eec20f6263f4a42ae462456f60ea6c4518bb0a 27-Jan-2017 Alex Vakulenko <avakulenko@google.com> Add DaydreamVR native libraries and services

Upstreaming the main VR system components from master-dreamos-dev
into goog/master.

Bug: None
Test: `m -j32` succeeds. Sailfish boots and basic_vr sample app works
Change-Id: I853015872afc443aecee10411ef2d6b79184d051
/frameworks/native/libs/vr/libpdx_uds/client_channel_factory.cpp