Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 800e8438 authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN
Browse files

Acquire lock to write NetworkStackConnector

As Java reference writes are atomic, the previous code should not have
issues, but since mConnector is marked @GuardedBy it could trigger
static analysis.

Test: m
Change-Id: I5a6174a4f32c349e593d0a16d58293d608a487c7
parent 69b967f5
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -200,10 +200,8 @@ public class NetworkStack {
            return null;
        }

        synchronized (mPendingNetStackRequests) {
        return INetworkStackConnector.Stub.asInterface(connector);
    }
    }

    private void requestConnector(@NonNull NetworkStackCallback request) {
        // TODO: PID check.
@@ -217,8 +215,11 @@ public class NetworkStack {
        if (!mNetworkStackStartRequested) {
            // The network stack is not being started in this process, e.g. this process is not
            // the system server. Get a remote connector registered by the system server.
            mConnector = getRemoteConnector();
            request.onNetworkStackConnected(mConnector);
            final INetworkStackConnector connector = getRemoteConnector();
            synchronized (mPendingNetStackRequests) {
                mConnector = connector;
            }
            request.onNetworkStackConnected(connector);
            return;
        }