Loading services/core/java/com/android/server/connectivity/QosCallbackTracker.java +13 −13 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 " Loading Loading @@ -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); Loading @@ -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)); }); } Loading Loading
services/core/java/com/android/server/connectivity/QosCallbackTracker.java +13 −13 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 " Loading Loading @@ -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); Loading @@ -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)); }); } Loading