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

Commit c9f752c6 authored by Nathan Harold's avatar Nathan Harold Committed by Gerrit Code Review
Browse files

Merge changes from topics "barring-cp", "nri-rplmn"

* changes:
  Add Registered PLMN to NetworkRegistrationInfo
  Support getBarringInfo in telephony framework
  Add BARRING_TYPE_UNKNOWN to BarringInfoTest
  Add UnitTest for BarringInfo
  Add CellBarring Indication From HAL
parents 814d22e1 3437eba2
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ public abstract class BaseCommands implements CommandsInterface {
    protected RegistrantList mLceInfoRegistrants = new RegistrantList();
    protected RegistrantList mEmergencyNumberListRegistrants = new RegistrantList();
    protected RegistrantList mUiccApplicationsEnablementRegistrants = new RegistrantList();
    protected RegistrantList mBarringInfoChangedRegistrants = new RegistrantList();

    @UnsupportedAppUsage
    protected Registrant mGsmSmsRegistrant;
@@ -1027,4 +1028,26 @@ public abstract class BaseCommands implements CommandsInterface {
    public void unregisterUiccApplicationEnablementChanged(Handler h) {
        mUiccApplicationsEnablementRegistrants.remove(h);
    }

    /**
     * Registers the handler for RIL_UNSOL_BARRING_INFO_CHANGED events.
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    @Override
    public void registerForBarringInfoChanged(Handler h, int what, Object obj) {
        mBarringInfoChangedRegistrants.addUnique(h, what, obj);
    }

    /**
     * Unregisters the handler for RIL_UNSOL_BARRING_INFO_CHANGED events.
     *
     * @param h Handler for notification message.
     */
    @Override
    public void unregisterForBarringInfoChanged(Handler h) {
        mBarringInfoChangedRegistrants.remove(h);
    }
}
+25 −5
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.internal.telephony;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.hardware.radio.V1_0.RegState;
import android.hardware.radio.V1_4.DataRegStateResult.VopsInfo.hidl_discriminator;
import android.os.AsyncResult;
@@ -25,6 +27,7 @@ import android.os.Message;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.CellIdentity;
import android.telephony.CellIdentityCdma;
import android.telephony.LteVopsSupportInfo;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.NetworkService;
@@ -32,6 +35,9 @@ import android.telephony.NetworkServiceCallback;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;

import com.android.telephony.Rlog;

import com.android.telephony.Rlog;

@@ -195,6 +201,17 @@ public class CellularNetworkService extends NetworkService {
            }
        }

        private @NonNull String getPlmnFromCellIdentity(@Nullable final CellIdentity ci) {
            if (ci == null || ci instanceof CellIdentityCdma) return "";

            final String mcc = ci.getMccString();
            final String mnc = ci.getMncString();

            if (TextUtils.isEmpty(mcc) || TextUtils.isEmpty(mnc)) return "";

            return mcc + mnc;
        }

        private NetworkRegistrationInfo createRegistrationStateFromVoiceRegState(Object result) {
            int transportType = AccessNetworkConstants.TRANSPORT_TYPE_WWAN;
            int domain = NetworkRegistrationInfo.DOMAIN_CS;
@@ -216,10 +233,11 @@ public class CellularNetworkService extends NetworkService {
                List<Integer> availableServices = getAvailableServices(
                        regState, domain, emergencyOnly);
                CellIdentity cellIdentity = CellIdentity.create(voiceRegState.cellIdentity);
                final String rplmn = getPlmnFromCellIdentity(cellIdentity);

                return new NetworkRegistrationInfo(domain, transportType, regState,
                        networkType, reasonForDenial, emergencyOnly, availableServices,
                        cellIdentity, cssSupported, roamingIndicator, systemIsInPrl,
                        cellIdentity, rplmn, cssSupported, roamingIndicator, systemIsInPrl,
                        defaultRoamingIndicator);
            } else if (result instanceof android.hardware.radio.V1_2.VoiceRegStateResult) {
                android.hardware.radio.V1_2.VoiceRegStateResult voiceRegState =
@@ -238,10 +256,11 @@ public class CellularNetworkService extends NetworkService {
                List<Integer> availableServices = getAvailableServices(
                        regState, domain, emergencyOnly);
                CellIdentity cellIdentity = CellIdentity.create(voiceRegState.cellIdentity);
                final String rplmn = getPlmnFromCellIdentity(cellIdentity);

                return new NetworkRegistrationInfo(domain, transportType, regState,
                        networkType, reasonForDenial, emergencyOnly, availableServices,
                        cellIdentity, cssSupported, roamingIndicator, systemIsInPrl,
                        cellIdentity, rplmn, cssSupported, roamingIndicator, systemIsInPrl,
                        defaultRoamingIndicator);
            }

@@ -318,6 +337,7 @@ public class CellularNetworkService extends NetworkService {
                return null;
            }

            String rplmn = getPlmnFromCellIdentity(cellIdentity);
            List<Integer> availableServices = getAvailableServices(
                    regState, domain, emergencyOnly);

@@ -327,9 +347,9 @@ public class CellularNetworkService extends NetworkService {
            }

            return new NetworkRegistrationInfo(domain, transportType, regState, networkType,
                    reasonForDenial, emergencyOnly, availableServices, cellIdentity, maxDataCalls,
                    isDcNrRestricted, isNrAvailable, isEndcAvailable, lteVopsSupportInfo,
                    isUsingCarrierAggregation);
                    reasonForDenial, emergencyOnly, availableServices, cellIdentity, rplmn,
                    maxDataCalls, isDcNrRestricted, isNrAvailable, isEndcAvailable,
                    lteVopsSupportInfo, isUsingCarrierAggregation);
        }

        private LteVopsSupportInfo convertHalLteVopsSupportInfo(
+25 −0
Original line number Diff line number Diff line
@@ -2496,4 +2496,29 @@ public interface CommandsInterface {
    default List<ClientRequestStats> getClientRequestStats() {
        return null;
    }

    /**
     * Registers the handler for RIL_UNSOL_BARRING_INFO_CHANGED events.
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    default void registerForBarringInfoChanged(Handler h, int what, Object obj) {};

    /**
     * Unregisters the handler for RIL_UNSOL_BARRING_INFO_CHANGED events.
     *
     * @param h Handler for notification message.
     */
    default void unregisterForBarringInfoChanged(Handler h) {};

    /**
     * Get all the barring info for the current camped cell applicable to the current user.
     *
     * AsyncResult.result is the object of {@link android.telephony.BarringInfo}.
     *
     * @param result Message will be sent back to handler and result.obj will be the AsycResult.
     */
    default void getBarringInfo(Message result) {};
}
+7 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.os.ServiceManager;
import android.telephony.Annotation.DataFailureCause;
import android.telephony.Annotation.RadioPowerState;
import android.telephony.Annotation.SrvccState;
import android.telephony.BarringInfo;
import android.telephony.CallQuality;
import android.telephony.CellIdentity;
import android.telephony.CellInfo;
@@ -272,6 +273,12 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
                cellIdentity, chosenPlmn, domain, causeCode, additionalCauseCode);
    }

    @Override
    public void notifyBarringInfoChanged(Phone sender, BarringInfo barringInfo) {
        mTelephonyRegistryMgr.notifyBarringInfoChanged(sender.getPhoneId(), sender.getSubId(),
                barringInfo);
    }

    /**
     * Convert the {@link DataActivityState} enum into the TelephonyManager.DATA_* constants for the
     * public API.
+9 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import android.sysprop.TelephonyProperties;
import android.telecom.TelecomManager;
import android.telecom.VideoProfile;
import android.telephony.AccessNetworkConstants;
import android.telephony.BarringInfo;
import android.telephony.CarrierConfigManager;
import android.telephony.CellIdentity;
import android.telephony.DataFailCause;
@@ -338,6 +339,7 @@ public class GsmCdmaPhone extends Phone {
                null);
        mCi.setOnSuppServiceNotification(this, EVENT_SSN, null);
        mCi.setOnRegistrationFailed(this, EVENT_REGISTRATION_FAILED, null);
        mCi.registerForBarringInfoChanged(this, EVENT_BARRING_INFO_CHANGED, null);

        //GSM
        mCi.setOnUSSD(this, EVENT_USSD, null);
@@ -2843,6 +2845,13 @@ public class GsmCdmaPhone extends Phone {
                        rfe.domain, rfe.causeCode, rfe.additionalCauseCode);
                break;

            case EVENT_BARRING_INFO_CHANGED:
                logd("Event BarringInfoChanged Received");
                ar = (AsyncResult) msg.obj;
                BarringInfo barringInfo = (BarringInfo) ar.result;
                mNotifier.notifyBarringInfoChanged(this, barringInfo);
                break;

            case EVENT_SET_CALL_FORWARD_DONE:
                ar = (AsyncResult)msg.obj;
                Cfu cfu = (Cfu) ar.userObj;
Loading