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

Commit bb54baba authored by Erik Kline's avatar Erik Kline Committed by android-build-merger
Browse files

Merge "request{LinkProperties,NetworkCapabilities} no longer needed" am: 75dfc5bd

am: 0f901af9

Change-Id: I891abf2a1a4138b9d80b8544ac6d09deda8d3d62
parents b48eb4f7 0f901af9
Loading
Loading
Loading
Loading
+0 −44
Original line number Diff line number Diff line
@@ -1058,28 +1058,6 @@ public class ConnectivityManager {
        }
    }

    /**
     * Request that this callback be invoked at ConnectivityService's earliest
     * convenience with the current satisfying network's LinkProperties.
     * If no such network exists no callback invocation is performed.
     *
     * The callback must have been registered with #requestNetwork() or
     * #registerDefaultNetworkCallback(); callbacks registered with
     * registerNetworkCallback() are not specific to any particular Network so
     * do not cause any updates.
     *
     * TODO: Delete once callers are updated.
     *
     * @hide
     */
    public void requestLinkProperties(NetworkCallback networkCallback) {
        try {
            mService.requestLinkProperties(networkCallback.networkRequest);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Get the {@link android.net.NetworkCapabilities} for the given {@link Network}.  This
     * will return {@code null} if the network is unknown.
@@ -1097,28 +1075,6 @@ public class ConnectivityManager {
        }
    }

    /**
     * Request that this callback be invoked at ConnectivityService's earliest
     * convenience with the current satisfying network's NetworkCapabilities.
     * If no such network exists no callback invocation is performed.
     *
     * The callback must have been registered with #requestNetwork() or
     * #registerDefaultNetworkCallback(); callbacks registered with
     * registerNetworkCallback() are not specific to any particular Network so
     * do not cause any updates.
     *
     * TODO: Delete once callers are updated.
     *
     * @hide
     */
    public void requestNetworkCapabilities(NetworkCallback networkCallback) {
        try {
            mService.requestNetworkCapabilities(networkCallback.networkRequest);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Gets the URL that should be used for resolving whether a captive portal is present.
     * 1. This URL should respond with a 204 response to a GET request to indicate no captive
+0 −2
Original line number Diff line number Diff line
@@ -156,8 +156,6 @@ interface IConnectivityManager
    void pendingListenForNetwork(in NetworkCapabilities networkCapabilities,
            in PendingIntent operation);

    void requestLinkProperties(in NetworkRequest networkRequest);
    void requestNetworkCapabilities(in NetworkRequest networkRequest);
    void releaseNetworkRequest(in NetworkRequest networkRequest);

    void setAcceptUnvalidated(in Network network, boolean accept, boolean always);
+0 −62
Original line number Diff line number Diff line
@@ -395,16 +395,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
     */
    private static final int EVENT_REGISTER_NETWORK_LISTENER_WITH_INTENT = 31;

    /**
     * Indicates a caller has requested to have its callback invoked with
     * the latest LinkProperties or NetworkCapabilities.
     *
     * arg1 = UID of caller
     * obj  = NetworkRequest
     */
    private static final int EVENT_REQUEST_LINKPROPERTIES  = 32;
    private static final int EVENT_REQUEST_NETCAPABILITIES = 33;

    /** Handler thread used for both of the handlers below. */
    @VisibleForTesting
    protected final HandlerThread mHandlerThread;
@@ -2574,34 +2564,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
        return nri;
    }

    private void handleRequestCallbackUpdate(NetworkRequest request, int callingUid,
            String description, int callbackType) {
        final NetworkRequestInfo nri = getNriForAppRequest(request, callingUid, description);
        if (nri == null) return;

        final NetworkAgentInfo nai = mNetworkForRequestId.get(nri.request.requestId);
        // The network that is satisfying this request may have changed since
        // the application requested the update.
        //
        // - If the request is no longer satisfied, don't send any updates.
        // - If the request is satisfied by a different network, it is the
        //   caller's responsibility to check that the Network object in the
        //   callback matches the network that was returned in the last
        //   onAvailable() callback for this request.
        if (nai == null) return;
        callCallbackForRequest(nri, nai, callbackType, 0);
    }

    private void handleRequestLinkProperties(NetworkRequest request, int callingUid) {
        handleRequestCallbackUpdate(request, callingUid,
                "request LinkProperties", ConnectivityManager.CALLBACK_IP_CHANGED);
    }

    private void handleRequestNetworkCapabilities(NetworkRequest request, int callingUid) {
        handleRequestCallbackUpdate(request, callingUid,
                "request NetworkCapabilities", ConnectivityManager.CALLBACK_CAP_CHANGED);
    }

    private void handleTimedOutNetworkRequest(final NetworkRequestInfo nri) {
        if (mNetworkRequests.get(nri.request) != null && mNetworkForRequestId.get(
                nri.request.requestId) == null) {
@@ -2983,12 +2945,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
                    handleMobileDataAlwaysOn();
                    break;
                }
                case EVENT_REQUEST_LINKPROPERTIES:
                    handleRequestLinkProperties((NetworkRequest) msg.obj, msg.arg1);
                    break;
                case EVENT_REQUEST_NETCAPABILITIES:
                    handleRequestNetworkCapabilities((NetworkRequest) msg.obj, msg.arg1);
                    break;
                // Sent by KeepaliveTracker to process an app request on the state machine thread.
                case NetworkAgent.CMD_START_PACKET_KEEPALIVE: {
                    mKeepaliveTracker.handleStartKeepalive(msg);
@@ -4348,24 +4304,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
        mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_LISTENER, nri));
    }

    // TODO: Delete once callers are updated.
    @Override
    public void requestLinkProperties(NetworkRequest networkRequest) {
        ensureNetworkRequestHasType(networkRequest);
        if (networkRequest.type == NetworkRequest.Type.LISTEN) return;
        mHandler.sendMessage(mHandler.obtainMessage(
                EVENT_REQUEST_LINKPROPERTIES, getCallingUid(), 0, networkRequest));
    }

    // TODO: Delete once callers are updated.
    @Override
    public void requestNetworkCapabilities(NetworkRequest networkRequest) {
        ensureNetworkRequestHasType(networkRequest);
        if (networkRequest.type == NetworkRequest.Type.LISTEN) return;
        mHandler.sendMessage(mHandler.obtainMessage(
                EVENT_REQUEST_NETCAPABILITIES, getCallingUid(), 0, networkRequest));
    }

    @Override
    public void releaseNetworkRequest(NetworkRequest networkRequest) {
        ensureNetworkRequestHasType(networkRequest);
+2 −8
Original line number Diff line number Diff line
@@ -186,6 +186,7 @@ public class UpstreamNetworkMonitor {
        switch (callbackType) {
            case CALLBACK_LISTEN_ALL:
                break;

            case CALLBACK_TRACK_DEFAULT:
                if (mDefaultNetworkCallback == null) {
                    // The callback was unregistered in the interval between
@@ -198,11 +199,9 @@ public class UpstreamNetworkMonitor {
                    // These request*() calls can be deleted post oag/339444.
                    return;
                }

                cm().requestNetworkCapabilities(mDefaultNetworkCallback);
                cm().requestLinkProperties(mDefaultNetworkCallback);
                mCurrentDefault = network;
                break;

            case CALLBACK_MOBILE_REQUEST:
                if (mMobileNetworkCallback == null) {
                    // The callback was unregistered in the interval between
@@ -211,13 +210,8 @@ public class UpstreamNetworkMonitor {
                    //
                    // Clean-up of this network entry is deferred to the
                    // handling of onLost() by other callbacks.
                    //
                    // These request*() calls can be deleted post oag/339444.
                    return;
                }

                cm().requestNetworkCapabilities(mMobileNetworkCallback);
                cm().requestLinkProperties(mMobileNetworkCallback);
                break;
        }

+0 −14
Original line number Diff line number Diff line
@@ -1927,20 +1927,6 @@ public class ConnectivityServiceTest extends AndroidTestCase {
        dfltNetworkCallback.expectAvailableAndSuspendedCallbacks(mCellNetworkAgent);
        dfltNetworkCallback.assertNoCallback();

        // Request a NetworkCapabilities update; only the requesting callback is notified.
        // TODO: Delete this together with Connectivity{Manager,Service} code.
        mCm.requestNetworkCapabilities(dfltNetworkCallback);
        dfltNetworkCallback.expectCallback(CallbackState.NETWORK_CAPABILITIES, mCellNetworkAgent);
        cellNetworkCallback.assertNoCallback();
        dfltNetworkCallback.assertNoCallback();

        // Request a LinkProperties update; only the requesting callback is notified.
        // TODO: Delete this together with Connectivity{Manager,Service} code.
        mCm.requestLinkProperties(dfltNetworkCallback);
        dfltNetworkCallback.expectCallback(CallbackState.LINK_PROPERTIES, mCellNetworkAgent);
        cellNetworkCallback.assertNoCallback();
        dfltNetworkCallback.assertNoCallback();

        mCm.unregisterNetworkCallback(dfltNetworkCallback);
        mCm.unregisterNetworkCallback(cellNetworkCallback);
    }