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

Commit 12acf151 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Remove @hide CollectionUtils in QosCallbackTracker"

parents e32c7c48 31ed0441
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ import android.os.IBinder;
import android.telephony.data.EpsBearerQosSessionAttributes;
import android.util.Log;

import com.android.internal.util.CollectionUtils;
import com.android.net.module.util.CollectionUtils;
import com.android.server.ConnectivityService;

import java.util.ArrayList;
@@ -156,12 +156,13 @@ public class QosCallbackTracker {

    private void handleUnregisterCallback(@NonNull final IBinder binder,
            final boolean sendToNetworkAgent) {
        final QosCallbackAgentConnection agentConnection =
                CollectionUtils.find(mConnections, c -> c.getBinder().equals(binder));
        if (agentConnection == null) {
            logw("handleUnregisterCallback: agentConnection is null");
        final int connIndex =
                CollectionUtils.indexOf(mConnections, c -> c.getBinder().equals(binder));
        if (connIndex < 0) {
            logw("handleUnregisterCallback: no matching agentConnection");
            return;
        }
        final QosCallbackAgentConnection agentConnection = mConnections.get(connIndex);

        if (DBG) {
            log("handleUnregisterCallback: unregister "
@@ -226,10 +227,10 @@ public class QosCallbackTracker {
     * @param network the network that was released
     */
    public void handleNetworkReleased(@Nullable final Network network) {
        final List<QosCallbackAgentConnection> connections =
                CollectionUtils.filter(mConnections, ac -> ac.getNetwork().equals(network));

        for (final QosCallbackAgentConnection agentConnection : connections) {
        // Iterate in reverse order as agent connections will be removed when unregistering
        for (int i = mConnections.size() - 1; i >= 0; i--) {
            final QosCallbackAgentConnection agentConnection = mConnections.get(i);
            if (!agentConnection.getNetwork().equals(network)) continue;
            agentConnection.sendEventQosCallbackError(
                    QosCallbackException.EX_TYPE_FILTER_NETWORK_RELEASED);

@@ -247,15 +248,14 @@ public class QosCallbackTracker {
            @NonNull final String logPrefix,
            @NonNull final AgentConnectionAction action) {
        mConnectivityServiceHandler.post(() -> {
            final QosCallbackAgentConnection ac =
                    CollectionUtils.find(mConnections,
            final int acIndex = CollectionUtils.indexOf(mConnections,
                            c -> c.getAgentCallbackId() == qosCallbackId);
            if (ac == null) {
            if (acIndex == -1) {
                loge(logPrefix + ": " + qosCallbackId + " missing callback id");
                return;
            }

            action.execute(ac);
            action.execute(mConnections.get(acIndex));
        });
    }