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

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

Snap for 5389215 from 760b360a to qt-release

Change-Id: Ib0c548492aaa422849e60373ae00d158cec5ac58
parents bac2af9b 760b360a
Loading
Loading
Loading
Loading
+29 −25
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

/**
@@ -129,22 +131,22 @@ public class CellularNetworkService extends NetworkService {
            switch (halRegState) {
                case RegState.NOT_REG_MT_NOT_SEARCHING_OP:
                case RegState.NOT_REG_MT_NOT_SEARCHING_OP_EM:
                    return NetworkRegistrationInfo.REG_STATE_NOT_REG_NOT_SEARCHING;
                    return NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING;
                case RegState.REG_HOME:
                    return NetworkRegistrationInfo.REG_STATE_HOME;
                    return NetworkRegistrationInfo.REGISTRATION_STATE_HOME;
                case RegState.NOT_REG_MT_SEARCHING_OP:
                case RegState.NOT_REG_MT_SEARCHING_OP_EM:
                    return NetworkRegistrationInfo.REG_STATE_NOT_REG_SEARCHING;
                    return NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING;
                case RegState.REG_DENIED:
                case RegState.REG_DENIED_EM:
                    return NetworkRegistrationInfo.REG_STATE_DENIED;
                    return NetworkRegistrationInfo.REGISTRATION_STATE_DENIED;
                case RegState.UNKNOWN:
                case RegState.UNKNOWN_EM:
                    return NetworkRegistrationInfo.REG_STATE_UNKNOWN;
                    return NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN;
                case RegState.REG_ROAMING:
                    return NetworkRegistrationInfo.REG_STATE_ROAMING;
                    return NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING;
                default:
                    return NetworkRegistrationInfo.REG_STATE_NOT_REG_NOT_SEARCHING;
                    return NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING;
            }
        }

@@ -166,24 +168,23 @@ public class CellularNetworkService extends NetworkService {
            }
        }

        private int[] getAvailableServices(int regState, int domain, boolean emergencyOnly) {
            int[] availableServices = null;
        private List<Integer> getAvailableServices(int regState, int domain,
                                                   boolean emergencyOnly) {
            List<Integer> availableServices = new ArrayList<>();

            // In emergency only states, only SERVICE_TYPE_EMERGENCY is available.
            // Otherwise, certain services are available only if it's registered on home or roaming
            // network.
            if (emergencyOnly) {
                availableServices = new int[] {NetworkRegistrationInfo.SERVICE_TYPE_EMERGENCY};
            } else if (regState == NetworkRegistrationInfo.REG_STATE_ROAMING
                    || regState == NetworkRegistrationInfo.REG_STATE_HOME) {
                availableServices.add(NetworkRegistrationInfo.SERVICE_TYPE_EMERGENCY);
            } else if (regState == NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING
                    || regState == NetworkRegistrationInfo.REGISTRATION_STATE_HOME) {
                if (domain == NetworkRegistrationInfo.DOMAIN_PS) {
                    availableServices = new int[] {NetworkRegistrationInfo.SERVICE_TYPE_DATA};
                    availableServices.add(NetworkRegistrationInfo.SERVICE_TYPE_DATA);
                } else if (domain == NetworkRegistrationInfo.DOMAIN_CS) {
                    availableServices = new int[] {
                            NetworkRegistrationInfo.SERVICE_TYPE_VOICE,
                            NetworkRegistrationInfo.SERVICE_TYPE_SMS,
                            NetworkRegistrationInfo.SERVICE_TYPE_VIDEO
                    };
                    availableServices.add(NetworkRegistrationInfo.SERVICE_TYPE_VOICE);
                    availableServices.add(NetworkRegistrationInfo.SERVICE_TYPE_SMS);
                    availableServices.add(NetworkRegistrationInfo.SERVICE_TYPE_VIDEO);
                }
            }

@@ -224,7 +225,7 @@ public class CellularNetworkService extends NetworkService {
                int roamingIndicator = voiceRegState.roamingIndicator;
                int systemIsInPrl = voiceRegState.systemIsInPrl;
                int defaultRoamingIndicator = voiceRegState.defaultRoamingIndicator;
                int[] availableServices = getAvailableServices(
                List<Integer> availableServices = getAvailableServices(
                        regState, domain, emergencyOnly);
                CellIdentity cellIdentity =
                        convertHalCellIdentityToCellIdentity(voiceRegState.cellIdentity);
@@ -244,7 +245,7 @@ public class CellularNetworkService extends NetworkService {
                int roamingIndicator = voiceRegState.roamingIndicator;
                int systemIsInPrl = voiceRegState.systemIsInPrl;
                int defaultRoamingIndicator = voiceRegState.defaultRoamingIndicator;
                int[] availableServices = getAvailableServices(
                List<Integer> availableServices = getAvailableServices(
                        regState, domain, emergencyOnly);
                CellIdentity cellIdentity =
                        convertHalCellIdentityToCellIdentity(voiceRegState.cellIdentity);
@@ -270,15 +271,16 @@ public class CellularNetworkService extends NetworkService {
                int reasonForDenial = dataRegState.reasonDataDenied;
                boolean emergencyOnly = isEmergencyOnly(dataRegState.regState);
                int maxDataCalls = dataRegState.maxDataCalls;
                int[] availableServices = getAvailableServices(regState, domain, emergencyOnly);
                List<Integer> availableServices = getAvailableServices(
                        regState, domain, emergencyOnly);
                CellIdentity cellIdentity =
                        convertHalCellIdentityToCellIdentity(dataRegState.cellIdentity);
                LteVopsSupportInfo lteVopsSupportInfo =
                        new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE,
                        LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE);
                return new NetworkRegistrationInfo(domain, transportType, regState,
                        accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices,
                        cellIdentity, maxDataCalls, false /* isDcNrRestricted */,
                        accessNetworkTechnology, reasonForDenial, emergencyOnly,
                        availableServices, cellIdentity, maxDataCalls, false /* isDcNrRestricted */,
                        false /* isNrAvailable */, false /* isEnDcAvailable */, lteVopsSupportInfo);

            } else if (result instanceof android.hardware.radio.V1_2.DataRegStateResult) {
@@ -289,7 +291,8 @@ public class CellularNetworkService extends NetworkService {
                int reasonForDenial = dataRegState.reasonDataDenied;
                boolean emergencyOnly = isEmergencyOnly(dataRegState.regState);
                int maxDataCalls = dataRegState.maxDataCalls;
                int[] availableServices = getAvailableServices(regState, domain, emergencyOnly);
                List<Integer> availableServices = getAvailableServices(
                        regState, domain, emergencyOnly);
                CellIdentity cellIdentity =
                        convertHalCellIdentityToCellIdentity(dataRegState.cellIdentity);
                LteVopsSupportInfo lteVopsSupportInfo =
@@ -309,7 +312,8 @@ public class CellularNetworkService extends NetworkService {
                int reasonForDenial = dataRegState.base.reasonDataDenied;
                boolean emergencyOnly = isEmergencyOnly(dataRegState.base.regState);
                int maxDataCalls = dataRegState.base.maxDataCalls;
                int[] availableServices = getAvailableServices(regState, domain, emergencyOnly);
                List<Integer> availableServices = getAvailableServices(
                        regState, domain, emergencyOnly);
                CellIdentity cellIdentity =
                        convertHalCellIdentityToCellIdentity(dataRegState.base.cellIdentity);
                android.hardware.radio.V1_4.NrIndicators nrIndicators = dataRegState.nrIndicators;
+10 −2
Original line number Diff line number Diff line
@@ -408,8 +408,16 @@ public class LocaleTracker extends Handler {
            // Set the country code for wifi. This sets allowed wifi channels based on the
            // country of the carrier we see. If we can't see any, reset to 0 so we don't
            // broadcast on forbidden channels.
            ((WifiManager) mPhone.getContext().getSystemService(Context.WIFI_SERVICE))
                    .setCountryCode(countryIso);
            WifiManager wifiManager = (WifiManager) mPhone.getContext()
                    .getSystemService(Context.WIFI_SERVICE);
            if (wifiManager != null) {
                wifiManager.setCountryCode(countryIso);
            } else {
                msg = "Wifi manager is not available.";
                log(msg);
                mLocalLog.log(msg);
            }


            Intent intent = new Intent(TelephonyManager.ACTION_NETWORK_COUNTRY_CHANGED);
            intent.putExtra(TelephonyManager.EXTRA_NETWORK_COUNTRY, countryIso);
+4 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.telephony.ModemActivityInfo;
import android.telephony.NeighboringCellInfo;
import android.telephony.PhoneNumberUtils;
import android.telephony.RadioAccessFamily;
import android.telephony.Rlog;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -64,6 +65,8 @@ import java.util.Collections;
import java.util.List;

public class RadioResponse extends IRadioResponse.Stub {
    private static final String TAG = RadioResponse.class.getSimpleName();

    // The number of the required config values for broadcast SMS stored in the C struct
    // RIL_CDMA_BroadcastServiceInfo
    private static final int CDMA_BSI_NO_OF_INTS_STRUCT = 3;
@@ -1014,7 +1017,7 @@ public class RadioResponse extends IRadioResponse.Stub {
     */
    public void getDeviceIdentityResponse(RadioResponseInfo responseInfo, String imei,
                                          String imeisv, String esn, String meid) {
        responseStrings(responseInfo, imei, imeisv, esn, meid);
        responseStrings(responseInfo, Rlog.pii(TAG, imei), imeisv, esn, meid);
    }

    /**
+27 −26
Original line number Diff line number Diff line
@@ -797,7 +797,7 @@ public class ServiceStateTracker extends Handler {
        if (nrs != null) {
            int rat = ServiceState.networkTypeToRilRadioTechnology(
                    nrs.getAccessNetworkTechnology());
            int drs = regCodeToServiceState(nrs.getRegState());
            int drs = regCodeToServiceState(nrs.getRegistrationState());
            if (DBG) {
                log("notifyDataRegStateRilRadioTechnologyChanged: drs=" + drs + " rat=" + rat);
            }
@@ -1515,7 +1515,7 @@ public class ServiceStateTracker extends Handler {
                    mLastPhysicalChannelConfigList = list;
                    boolean hasChanged =
                            updateNrFrequencyRangeFromPhysicalChannelConfigs(list, mSS);
                    hasChanged |= updateNrStatusFromPhysicalChannelConfigs(
                    hasChanged |= updateNrStateFromPhysicalChannelConfigs(
                            list,
                            mSS.getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS,
                                    AccessNetworkType.EUTRAN));
@@ -1895,13 +1895,13 @@ public class ServiceStateTracker extends Handler {
        return cdmaRoaming && !isSameOperatorNameFromSimAndSS(s);
    }

    private boolean isNrStatusChanged(
    private boolean isNrStateChanged(
            NetworkRegistrationInfo oldRegState, NetworkRegistrationInfo newRegState) {
        if (oldRegState == null || newRegState == null) {
            return oldRegState != newRegState;
        }

        return oldRegState.getNrStatus() != newRegState.getNrStatus();
        return oldRegState.getNrState() != newRegState.getNrState();
    }

    private boolean updateNrFrequencyRangeFromPhysicalChannelConfigs(
@@ -1933,7 +1933,7 @@ public class ServiceStateTracker extends Handler {
        return hasChanged;
    }

    private boolean updateNrStatusFromPhysicalChannelConfigs(
    private boolean updateNrStateFromPhysicalChannelConfigs(
            List<PhysicalChannelConfig> configs, NetworkRegistrationInfo regState) {

        if (regState == null || configs == null) return false;
@@ -1947,19 +1947,19 @@ public class ServiceStateTracker extends Handler {
            }
        }

        int newNrStatus = regState.getNrStatus();
        int newNrState = regState.getNrState();
        if (hasNrSecondaryServingCell) {
            if (regState.getNrStatus() == NetworkRegistrationInfo.NR_STATUS_NOT_RESTRICTED) {
                newNrStatus = NetworkRegistrationInfo.NR_STATUS_CONNECTED;
            if (regState.getNrState() == NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED) {
                newNrState = NetworkRegistrationInfo.NR_STATE_CONNECTED;
            }
        } else {
            if (regState.getNrStatus() == NetworkRegistrationInfo.NR_STATUS_CONNECTED) {
                newNrStatus = NetworkRegistrationInfo.NR_STATUS_NOT_RESTRICTED;
            if (regState.getNrState() == NetworkRegistrationInfo.NR_STATE_CONNECTED) {
                newNrState = NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED;
            }
        }

        boolean hasChanged = newNrStatus != regState.getNrStatus();
        regState.setNrStatus(newNrStatus);
        boolean hasChanged = newNrState != regState.getNrState();
        regState.setNrState(newNrState);
        return hasChanged;
    }

@@ -1984,13 +1984,14 @@ public class ServiceStateTracker extends Handler {
        if (wlanPsRegState != null
                && wlanPsRegState.getAccessNetworkTechnology()
                == TelephonyManager.NETWORK_TYPE_IWLAN
                && wlanPsRegState.getRegState() == NetworkRegistrationInfo.REG_STATE_HOME) {
                && wlanPsRegState.getRegistrationState()
                == NetworkRegistrationInfo.REGISTRATION_STATE_HOME) {
            serviceState.setRilDataRadioTechnology(ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN);
            serviceState.setDataRegState(ServiceState.STATE_IN_SERVICE);
        } else if (wwanPsRegState != null) {
            // If the device is not camped on IWLAN, then we use cellular PS registration state
            // to compute reg state and rat.
            int regState = wwanPsRegState.getRegState();
            int regState = wwanPsRegState.getRegistrationState();
            int dataRat = ServiceState.networkTypeToRilRadioTechnology(
                    wwanPsRegState.getAccessNetworkTechnology());
            serviceState.setDataRegState(regCodeToServiceState(regState));
@@ -2009,7 +2010,7 @@ public class ServiceStateTracker extends Handler {
                VoiceSpecificRegistrationStates voiceSpecificStates =
                        networkRegState.getVoiceSpecificStates();

                int registrationState = networkRegState.getRegState();
                int registrationState = networkRegState.getRegistrationState();
                int cssIndicator = voiceSpecificStates.cssSupported ? 1 : 0;
                int newVoiceRat = ServiceState.networkTypeToRilRadioTechnology(
                        networkRegState.getAccessNetworkTechnology());
@@ -2097,7 +2098,7 @@ public class ServiceStateTracker extends Handler {
                mNewSS.addNetworkRegistrationInfo(networkRegState);
                DataSpecificRegistrationStates dataSpecificStates =
                        networkRegState.getDataSpecificStates();
                int registrationState = networkRegState.getRegState();
                int registrationState = networkRegState.getRegistrationState();
                int serviceState = regCodeToServiceState(registrationState);
                int newDataRat = ServiceState.networkTypeToRilRadioTechnology(
                        networkRegState.getAccessNetworkTechnology());
@@ -2113,7 +2114,7 @@ public class ServiceStateTracker extends Handler {
                    mLastPhysicalChannelConfigList = null;
                    updateNrFrequencyRangeFromPhysicalChannelConfigs(null, mNewSS);
                }
                updateNrStatusFromPhysicalChannelConfigs(
                updateNrStateFromPhysicalChannelConfigs(
                        mLastPhysicalChannelConfigList, networkRegState);
                setPhyCellInfoFromCellIdentity(mNewSS, networkRegState.getCellIdentity());

@@ -3072,10 +3073,10 @@ public class ServiceStateTracker extends Handler {
                anyDataRatChanged = true;
            }

            int oldRegState = oldNrs != null ? oldNrs.getRegState()
                    : NetworkRegistrationInfo.REG_STATE_UNKNOWN;
            int newRegState = newNrs != null ? newNrs.getRegState()
                    : NetworkRegistrationInfo.REG_STATE_UNKNOWN;
            int oldRegState = oldNrs != null ? oldNrs.getRegistrationState()
                    : NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN;
            int newRegState = newNrs != null ? newNrs.getRegistrationState()
                    : NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN;
            hasDataRegStateChanged.put(transport, oldRegState != newRegState);
            if (oldRegState != newRegState) {
                anyDataRegChanged = true;
@@ -3088,7 +3089,7 @@ public class ServiceStateTracker extends Handler {
        boolean hasNrFrequencyRangeChanged =
                mSS.getNrFrequencyRange() != mNewSS.getNrFrequencyRange();

        boolean hasNrStatusChanged = isNrStatusChanged(
        boolean hasNrStateChanged = isNrStateChanged(
                mSS.getNetworkRegistrationInfo(
                        NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkType.EUTRAN),
                mNewSS.getNetworkRegistrationInfo(
@@ -3172,7 +3173,7 @@ public class ServiceStateTracker extends Handler {
                    + " hasLostMultiApnSupport = " + hasLostMultiApnSupport
                    + " hasCssIndicatorChanged = " + hasCssIndicatorChanged
                    + " hasNrFrequencyRangeChanged = " + hasNrFrequencyRangeChanged
                    + " hasNrStatusChanged = " + hasNrStatusChanged);
                    + " hasNrStateChanged = " + hasNrStateChanged);
        }

        // Add an event log when connection state changes
@@ -3578,8 +3579,8 @@ public class ServiceStateTracker extends Handler {
     * to service state */
    private int regCodeToServiceState(int code) {
        switch (code) {
            case NetworkRegistrationInfo.REG_STATE_HOME:
            case NetworkRegistrationInfo.REG_STATE_ROAMING:
            case NetworkRegistrationInfo.REGISTRATION_STATE_HOME:
            case NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING:
                return ServiceState.STATE_IN_SERVICE;
            default:
                return ServiceState.STATE_OUT_OF_SERVICE;
@@ -3591,7 +3592,7 @@ public class ServiceStateTracker extends Handler {
     * returns true if registered roam, false otherwise
     */
    private boolean regCodeIsRoaming (int code) {
        return NetworkRegistrationInfo.REG_STATE_ROAMING == code;
        return NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING == code;
    }

    private boolean isSameOperatorNameFromSimAndSS(ServiceState s) {
+2 −42
Original line number Diff line number Diff line
@@ -365,8 +365,6 @@ public class SubscriptionController extends ISub.Stub {
                SubscriptionManager.IS_OPPORTUNISTIC)) == 1;
        String groupUUID = cursor.getString(cursor.getColumnIndexOrThrow(
                SubscriptionManager.GROUP_UUID));
        boolean isMetered = cursor.getInt(cursor.getColumnIndexOrThrow(
                SubscriptionManager.IS_METERED)) == 1;
        int profileClass = cursor.getInt(cursor.getColumnIndexOrThrow(
                SubscriptionManager.PROFILE_CLASS));
        int subType = cursor.getInt(cursor.getColumnIndexOrThrow(
@@ -383,8 +381,7 @@ public class SubscriptionController extends ISub.Stub {
                    + isEmbedded + " accessRules:" + Arrays.toString(accessRules)
                    + " cardId:" + cardIdToPrint + " publicCardId:" + publicCardId
                    + " isOpportunistic:" + isOpportunistic + " groupUUID:" + groupUUID
                    + " isMetered:" + isMetered + " profileClass:" + profileClass
                    + " subscriptionType: " + subType);
                    + " profileClass:" + profileClass + " subscriptionType: " + subType);
        }

        // If line1number has been set to a different number, use it instead.
@@ -395,7 +392,7 @@ public class SubscriptionController extends ISub.Stub {
        return new SubscriptionInfo(id, iccId, simSlotIndex, displayName, carrierName,
            nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc, countryIso,
            isEmbedded, accessRules, cardId, publicCardId, isOpportunistic, groupUUID,
            isMetered, false /* isGroupDisabled */, carrierId, profileClass, subType);
            false /* isGroupDisabled */, carrierId, profileClass, subType);
    }

    /**
@@ -2416,7 +2413,6 @@ public class SubscriptionController extends ISub.Stub {
            case SubscriptionManager.CB_OPT_OUT_DIALOG:
            case SubscriptionManager.ENHANCED_4G_MODE_ENABLED:
            case SubscriptionManager.IS_OPPORTUNISTIC:
            case SubscriptionManager.IS_METERED:
            case SubscriptionManager.VT_IMS_ENABLED:
            case SubscriptionManager.WFC_IMS_ENABLED:
            case SubscriptionManager.WFC_IMS_MODE:
@@ -2477,7 +2473,6 @@ public class SubscriptionController extends ISub.Stub {
                        case SubscriptionManager.WFC_IMS_ROAMING_ENABLED:
                        case SubscriptionManager.IS_OPPORTUNISTIC:
                        case SubscriptionManager.GROUP_UUID:
                        case SubscriptionManager.IS_METERED:
                            resultValue = cursor.getInt(0) + "";
                            break;
                        default:
@@ -2651,41 +2646,6 @@ public class SubscriptionController extends ISub.Stub {
        }
    }

    /**
     * Set whether a subscription is metered
     *
     * Throws SecurityException if doesn't have required permission.
     *
     * @param isMetered whether it’s a metered subscription.
     * @param subId the unique SubscriptionInfo index in database
     * @param callingPackage The package making the IPC.
     * @return the number of records updated
     */
    @Override
    public int setMetered(boolean isMetered, int subId, String callingPackage) {
        try {
            TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
                    mContext, subId, callingPackage);
        } catch (SecurityException e) {
            // The subscription may be inactive eSIM profile. If so, check the access rule in
            // database.
            enforceCarrierPrivilegeOnInactiveSub(subId, callingPackage,
                    "Caller requires permission on sub " + subId);
        }

        long token = Binder.clearCallingIdentity();
        try {
            int ret = setSubscriptionProperty(subId, SubscriptionManager.IS_METERED,
                    String.valueOf(isMetered ? 1 : 0));

            if (ret != 0) notifySubscriptionInfoChanged();

            return ret;
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }

    /**
     * Get subscription info from database, and check whether caller has carrier privilege
     * permission with it. If checking fails, throws SecurityException.
Loading