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

Commit aeeaee8f authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6360479 from 6ec8fdf8 to rvc-release

Change-Id: I9f354b9f19b492ce396602412c4900fee5f6524f
parents 94565f05 6ec8fdf8
Loading
Loading
Loading
Loading
+31 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,10 @@ import android.os.Registrant;
import android.os.RegistrantList;
import android.os.RegistrantList;
import android.telephony.Annotation.RadioPowerState;
import android.telephony.Annotation.RadioPowerState;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager;
import android.telephony.emergency.EmergencyNumber;

import java.util.ArrayList;
import java.util.List;


/**
/**
 * {@hide}
 * {@hide}
@@ -144,6 +148,11 @@ public abstract class BaseCommands implements CommandsInterface {
    protected Registrant mSsRegistrant;
    protected Registrant mSsRegistrant;
    protected Registrant mRegistrationFailedRegistrant;
    protected Registrant mRegistrationFailedRegistrant;


    // Lock that mLastEmergencyNumberListIndication uses.
    private Object mLastEmergencyNumberListIndicationLock = new Object();
    // Cache last emergency number list indication from radio
    private final List<EmergencyNumber> mLastEmergencyNumberListIndication = new ArrayList<>();

    // Preferred network type received from PhoneFactory.
    // Preferred network type received from PhoneFactory.
    // This is used when establishing a connection to the
    // This is used when establishing a connection to the
    // vendor ril so it starts up in the correct mode.
    // vendor ril so it starts up in the correct mode.
@@ -803,6 +812,14 @@ public abstract class BaseCommands implements CommandsInterface {
    @Override
    @Override
    public void registerForEmergencyNumberList(Handler h, int what, Object obj) {
    public void registerForEmergencyNumberList(Handler h, int what, Object obj) {
        mEmergencyNumberListRegistrants.addUnique(h, what, obj);
        mEmergencyNumberListRegistrants.addUnique(h, what, obj);
        // Notify the last emergency number list from radio to new registrants because they may
        // miss the latest indication (e.g. constructed in a delay after HAL is registrated).
        List<EmergencyNumber> lastEmergencyNumberListIndication =
                getLastEmergencyNumberListIndication();
        if (lastEmergencyNumberListIndication != null) {
            mEmergencyNumberListRegistrants.notifyRegistrants(new AsyncResult(
                    null, getLastEmergencyNumberListIndication(), null));
        }
    }
    }


    @Override
    @Override
@@ -860,6 +877,20 @@ public abstract class BaseCommands implements CommandsInterface {
        }
        }
    }
    }


    protected void cacheEmergencyNumberListIndication(
            List<EmergencyNumber> emergencyNumberListIndication) {
        synchronized (mLastEmergencyNumberListIndicationLock) {
            mLastEmergencyNumberListIndication.clear();
            mLastEmergencyNumberListIndication.addAll(emergencyNumberListIndication);
        }
    }

    private List<EmergencyNumber> getLastEmergencyNumberListIndication() {
        synchronized (mLastEmergencyNumberListIndicationLock) {
            return new ArrayList<>(mLastEmergencyNumberListIndication);
        }
    }

    /**
    /**
     * {@inheritDoc}
     * {@inheritDoc}
     */
     */
+4 −0
Original line number Original line Diff line number Diff line
@@ -328,6 +328,10 @@ public class RadioIndication extends IRadioIndication.Stub {


        if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_EMERGENCY_NUMBER_LIST, response);
        if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_EMERGENCY_NUMBER_LIST, response);


        // Cache emergency number list from last indication.
        mRil.cacheEmergencyNumberListIndication(response);

        // Notify emergency number list from radio to registrants
        mRil.mEmergencyNumberListRegistrants.notifyRegistrants(
        mRil.mEmergencyNumberListRegistrants.notifyRegistrants(
                new AsyncResult(null, response, null));
                new AsyncResult(null, response, null));
    }
    }
+19 −0
Original line number Original line Diff line number Diff line
@@ -1723,6 +1723,7 @@ public class DataConnection extends StateMachine {
                                + " drs=" + mDataRegState
                                + " drs=" + mDataRegState
                                + " mRilRat=" + mRilRat);
                                + " mRilRat=" + mRilRat);
                    }
                    }
                    updateNetworkInfo();
                    break;
                    break;
                default:
                default:
                    if (DBG) {
                    if (DBG) {
@@ -1735,6 +1736,19 @@ public class DataConnection extends StateMachine {
        }
        }
    }
    }


    private void updateNetworkInfo() {
        final ServiceState state = mPhone.getServiceState();

        NetworkRegistrationInfo nri = state.getNetworkRegistrationInfo(
                NetworkRegistrationInfo.DOMAIN_PS, mTransportType);
        int subtype = TelephonyManager.NETWORK_TYPE_UNKNOWN;
        if (nri != null) {
            subtype = nri.getAccessNetworkTechnology();
        }

        mNetworkInfo.setSubtype(subtype, TelephonyManager.getNetworkTypeName(subtype));
    }

    private void updateNetworkInfoSuspendState() {
    private void updateNetworkInfoSuspendState() {
        // this is only called when we are either connected or suspended.  Decide which.
        // this is only called when we are either connected or suspended.  Decide which.
        if (mNetworkAgent == null) {
        if (mNetworkAgent == null) {
@@ -2076,6 +2090,8 @@ public class DataConnection extends StateMachine {
                    mApnSetting != null
                    mApnSetting != null
                        ? mApnSetting.canHandleType(ApnSetting.TYPE_DEFAULT) : false);
                        ? mApnSetting.canHandleType(ApnSetting.TYPE_DEFAULT) : false);


            updateNetworkInfo();

            // If we were retrying there maybe more than one, otherwise they'll only be one.
            // If we were retrying there maybe more than one, otherwise they'll only be one.
            notifyAllWithEvent(null, DctConstants.EVENT_DATA_SETUP_COMPLETE,
            notifyAllWithEvent(null, DctConstants.EVENT_DATA_SETUP_COMPLETE,
                    Phone.REASON_CONNECTED);
                    Phone.REASON_CONNECTED);
@@ -2091,6 +2107,7 @@ public class DataConnection extends StateMachine {


            mNetworkInfo.setDetailedState(NetworkInfo.DetailedState.CONNECTED,
            mNetworkInfo.setDetailedState(NetworkInfo.DetailedState.CONNECTED,
                    mNetworkInfo.getReason(), null);
                    mNetworkInfo.getReason(), null);
            mNetworkInfo.setExtraInfo(mApnSetting.getApnName());
            updateTcpBufferSizes(mRilRat);
            updateTcpBufferSizes(mRilRat);
            updateLinkBandwidthsFromCarrierConfig(mRilRat);
            updateLinkBandwidthsFromCarrierConfig(mRilRat);


@@ -2357,6 +2374,7 @@ public class DataConnection extends StateMachine {
                case EVENT_DATA_CONNECTION_ROAM_ON:
                case EVENT_DATA_CONNECTION_ROAM_ON:
                case EVENT_DATA_CONNECTION_ROAM_OFF:
                case EVENT_DATA_CONNECTION_ROAM_OFF:
                case EVENT_DATA_CONNECTION_OVERRIDE_CHANGED: {
                case EVENT_DATA_CONNECTION_OVERRIDE_CHANGED: {
                    updateNetworkInfo();
                    if (mNetworkAgent != null) {
                    if (mNetworkAgent != null) {
                        mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(),
                        mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(),
                                DataConnection.this);
                                DataConnection.this);
@@ -2378,6 +2396,7 @@ public class DataConnection extends StateMachine {
                }
                }
                case EVENT_DATA_CONNECTION_VOICE_CALL_STARTED:
                case EVENT_DATA_CONNECTION_VOICE_CALL_STARTED:
                case EVENT_DATA_CONNECTION_VOICE_CALL_ENDED: {
                case EVENT_DATA_CONNECTION_VOICE_CALL_ENDED: {
                    updateNetworkInfo();
                    updateNetworkInfoSuspendState();
                    updateNetworkInfoSuspendState();
                    if (mNetworkAgent != null) {
                    if (mNetworkAgent != null) {
                        mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(),
                        mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(),
+3 −14
Original line number Original line Diff line number Diff line
@@ -31,8 +31,6 @@ import android.os.Message;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants.TransportType;
import android.telephony.AccessNetworkConstants.TransportType;
import android.telephony.AnomalyReporter;
import android.telephony.AnomalyReporter;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager;
import android.util.LocalLog;
import android.util.LocalLog;
import android.util.SparseArray;
import android.util.SparseArray;
@@ -284,19 +282,10 @@ public class DcNetworkAgent extends NetworkAgent {
        if (!isOwned(dc, "sendNetworkInfo")) return;
        if (!isOwned(dc, "sendNetworkInfo")) return;
        final NetworkInfo.State oldState = mNetworkInfo.getState();
        final NetworkInfo.State oldState = mNetworkInfo.getState();
        final NetworkInfo.State state = networkInfo.getState();
        final NetworkInfo.State state = networkInfo.getState();
        String extraInfo = dc.getApnSetting().getApnName();
        if (mNetworkInfo.getExtraInfo() != networkInfo.getExtraInfo()) {
        if (mNetworkInfo.getExtraInfo() != extraInfo) {
            setLegacyExtraInfo(networkInfo.getExtraInfo());
            setLegacyExtraInfo(extraInfo);
        }
        }

        int subType = networkInfo.getSubtype();
        final ServiceState serviceState = mPhone.getServiceState();
        NetworkRegistrationInfo nri = serviceState.getNetworkRegistrationInfo(
                NetworkRegistrationInfo.DOMAIN_PS, mTransportType);
        int subType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
        if (nri != null) {
            subType = nri.getAccessNetworkTechnology();
        }

        if (mNetworkInfo.getSubtype() != subType) {
        if (mNetworkInfo.getSubtype() != subType) {
            setLegacySubtype(subType, TelephonyManager.getNetworkTypeName(subType));
            setLegacySubtype(subType, TelephonyManager.getNetworkTypeName(subType));
        }
        }
+26 −29
Original line number Original line Diff line number Diff line
@@ -599,7 +599,7 @@ public class DcTracker extends Handler {
    private ArrayList<DataProfile> mLastDataProfileList = new ArrayList<>();
    private ArrayList<DataProfile> mLastDataProfileList = new ArrayList<>();


    /** RAT name ===> (downstream, upstream) bandwidth values from carrier config. */
    /** RAT name ===> (downstream, upstream) bandwidth values from carrier config. */
    private final ConcurrentHashMap<String, Pair<Integer, Integer>> mBandwidths =
    private ConcurrentHashMap<String, Pair<Integer, Integer>> mBandwidths =
            new ConcurrentHashMap<>();
            new ConcurrentHashMap<>();


    /**
    /**
@@ -3806,8 +3806,7 @@ public class DcTracker extends Handler {
     * @param useLte For NR NSA, whether to use LTE value for upstream or not
     * @param useLte For NR NSA, whether to use LTE value for upstream or not
     */
     */
    private void updateLinkBandwidths(String[] bandwidths, boolean useLte) {
    private void updateLinkBandwidths(String[] bandwidths, boolean useLte) {
        synchronized (mBandwidths) {
        ConcurrentHashMap<String, Pair<Integer, Integer>> temp = new ConcurrentHashMap<>();
            mBandwidths.clear();
        for (String config : bandwidths) {
        for (String config : bandwidths) {
            int downstream = 14;
            int downstream = 14;
            int upstream = 14;
            int upstream = 14;
@@ -3821,25 +3820,23 @@ public class DcTracker extends Handler {
                    } catch (NumberFormatException ignored) {
                    } catch (NumberFormatException ignored) {
                    }
                    }
                }
                }
                    mBandwidths.put(kv[0], new Pair<>(downstream, upstream));
                temp.put(kv[0], new Pair<>(downstream, upstream));
            }
            }
        }
        }
        if (useLte) {
        if (useLte) {
                Pair<Integer, Integer> ltePair = mBandwidths.get(DctConstants.RAT_NAME_LTE);
            Pair<Integer, Integer> ltePair = temp.get(DctConstants.RAT_NAME_LTE);
            if (ltePair != null) {
            if (ltePair != null) {
                    if (mBandwidths.containsKey(DctConstants.RAT_NAME_NR_NSA)) {
                if (temp.containsKey(DctConstants.RAT_NAME_NR_NSA)) {
                        mBandwidths.put(DctConstants.RAT_NAME_NR_NSA, new Pair<>(
                    temp.put(DctConstants.RAT_NAME_NR_NSA, new Pair<>(
                                mBandwidths.get(DctConstants.RAT_NAME_NR_NSA).first,
                            temp.get(DctConstants.RAT_NAME_NR_NSA).first, ltePair.second));
                                ltePair.second));
                    }
                    if (mBandwidths.containsKey(DctConstants.RAT_NAME_NR_NSA_MMWAVE)) {
                        mBandwidths.put(DctConstants.RAT_NAME_NR_NSA_MMWAVE, new Pair<>(
                                mBandwidths.get(DctConstants.RAT_NAME_NR_NSA_MMWAVE).first,
                                ltePair.second));
                }
                }
                if (temp.containsKey(DctConstants.RAT_NAME_NR_NSA_MMWAVE)) {
                    temp.put(DctConstants.RAT_NAME_NR_NSA_MMWAVE, new Pair<>(
                            temp.get(DctConstants.RAT_NAME_NR_NSA_MMWAVE).first, ltePair.second));
                }
                }
            }
            }
        }
        }
        mBandwidths = temp;
        for (DataConnection dc : mDataConnections.values()) {
        for (DataConnection dc : mDataConnections.values()) {
            dc.sendMessage(DataConnection.EVENT_CARRIER_CONFIG_LINK_BANDWIDTHS_CHANGED);
            dc.sendMessage(DataConnection.EVENT_CARRIER_CONFIG_LINK_BANDWIDTHS_CHANGED);
        }
        }