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

Commit 32b2f3b6 authored by Jack Yu's avatar Jack Yu Committed by Gerrit Code Review
Browse files

Merge changes Ie0385211,I251c678d

* changes:
  Migrated QosCallbackTracker to the new data stack.
  Move QosCallbackTracker to the new location
parents 1b23ba6c 0e55df93
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import android.telephony.data.DataCallResponse;
import android.telephony.data.DataProfile;
import android.telephony.data.DataService;
import android.telephony.data.DataServiceCallback;
import android.telephony.data.QosBearerSession;
import android.telephony.data.TrafficDescriptor;
import android.text.TextUtils;
import android.util.IndentingPrintWriter;
@@ -345,6 +346,9 @@ public class DataNetwork extends StateMachine {
    /** The network agent associated with this data network. */
    private @NonNull TelephonyNetworkAgent mNetworkAgent;

    /** QOS callback tracker. This is only created after network connected on WWAN. */
    private @Nullable QosCallbackTracker mQosCallbackTracker;

    /** The data profile used to establish this data network. */
    private final @NonNull DataProfile mDataProfile;

@@ -395,6 +399,9 @@ public class DataNetwork extends StateMachine {
     */
    private @TransportType int mPreferredTransport = AccessNetworkConstants.TRANSPORT_TYPE_INVALID;

    /** The QOS bearer sessions. */
    private @NonNull List<QosBearerSession> mQosBearerSessions = new ArrayList<>();

    /**
     * The network bandwidth.
     */
@@ -779,6 +786,9 @@ public class DataNetwork extends StateMachine {
            mNetworkAgent.markConnected();
            mDataNetworkCallback.invokeFromExecutor(
                    () -> mDataNetworkCallback.onConnected(DataNetwork.this));

            mQosCallbackTracker = new QosCallbackTracker(mNetworkAgent, mPhone);
            mQosCallbackTracker.updateSessions(mQosBearerSessions);
            updateSuspendState();

            mPhone.getDisplayInfoController().registerForTelephonyDisplayInfoChanged(
@@ -1308,6 +1318,11 @@ public class DataNetwork extends StateMachine {
        // updateTcpBufferSizes
        linkProperties.setTcpBufferSizes(getTcpConfig());

        mQosBearerSessions = response.getQosBearerSessions();
        if (mQosCallbackTracker != null) {
            mQosCallbackTracker.updateSessions(mQosBearerSessions);
        }

        if (!linkProperties.equals(mLinkProperties)) {
            mLinkProperties = linkProperties;
            log("sendLinkProperties " + mLinkProperties);
@@ -1649,6 +1664,7 @@ public class DataNetwork extends StateMachine {
        // connection. In this case we assign a slightly higher score of 50. The intention is
        // it will not be replaced by other data networks accidentally in DSDS use case.
        int score = OTHER_NETWORK_SCORE;
        // TODO: Should update the score when attached list changed.
        for (TelephonyNetworkRequest networkRequest : mAttachedNetworkRequestList) {
            if (networkRequest.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
                    && networkRequest.getNetworkSpecifier() == null) {
@@ -1916,9 +1932,12 @@ public class DataNetwork extends StateMachine {
        mNetworkAgent.dump(fd, pw, args);

        pw.println("Attached network requests:");
        pw.increaseIndent();
        for (TelephonyNetworkRequest request : mAttachedNetworkRequestList) {
            pw.println(request);
        }
        pw.decreaseIndent();
        pw.println("mQosBearerSessions=" + mQosBearerSessions);

        pw.println("Local logs:");
        pw.increaseIndent();
+54 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.internal.telephony.data;

import android.annotation.NonNull;
import android.net.NetworkAgent;
import android.net.QosSessionAttributes;

/**
 * The temporary interface that is shared by
 * {@link com.android.internal.telephony.dataconnection.DcNetworkAgent} and
 * {@link com.android.internal.telephony.data.TelephonyNetworkAgent} so they can both interact
 * with {@link QosCallbackTracker}.
 */
// TODO: Remove after DcNetworkAgent is removed.
public interface NotifyQosSessionInterface {
    /**
     * Sends the attributes of Qos Session back to the Application. This method is create for
     * Mockito to mock since
     * {@link NetworkAgent#sendQosSessionAvailable(int, int, QosSessionAttributes)} is
     * {@code final} that can't be mocked.
     *
     * @param qosCallbackId the callback id that the session belongs to.
     * @param sessionId the unique session id across all Qos Sessions.
     * @param attributes the attributes of the Qos Session.
     */
    void notifyQosSessionAvailable(int qosCallbackId, int sessionId,
            @NonNull QosSessionAttributes attributes);

    /**
     * Sends event that the Qos Session was lost. This method is create for Mockito to mock
     * since {@link NetworkAgent#sendQosSessionLost(int, int, int)} is {@code final} that can't be
     * mocked..
     *
     * @param qosCallbackId the callback id that the session belongs to.
     * @param sessionId the unique session id across all Qos Sessions.
     * @param qosSessionType the session type {@code QosSession#QosSessionType}.
     */
    void notifyQosSessionLost(int qosCallbackId, int sessionId, int qosSessionType);
}
+454 −0

File changed and moved.

Preview size limit exceeded, changes collapsed.

+78 −10

File changed.

Preview size limit exceeded, changes collapsed.

+6 −2

File changed.

Preview size limit exceeded, changes collapsed.

Loading