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

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

Snap for 6378851 from 6a51c683 to rvc-release

Change-Id: I832c31ef5d2d23dd8f298ce8abc58674c99a41bc
parents 12d205c7 6a51c683
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager.SimState;
import android.telephony.UiccAccessRule;
import android.telephony.euicc.EuiccManager;
import android.text.TextUtils;
@@ -1134,7 +1135,13 @@ public class SubscriptionInfoUpdater extends Handler {
        }
    }

    private static String simStateString(int state) {
    /**
     * Convert SIM state into string
     *
     * @param state SIM state
     * @return SIM state in string format
     */
    public static String simStateString(@SimState int state) {
        switch (state) {
            case TelephonyManager.SIM_STATE_UNKNOWN:
                return "UNKNOWN";
+30 −12
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.internal.telephony.gsm.SuppServiceNotification;
import com.android.internal.telephony.imsphone.ImsExternalCallTracker;
import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.imsphone.ImsPhoneCall;
import com.android.internal.telephony.imsphone.ImsPhoneCallTracker;
import com.android.internal.telephony.test.TestConferenceEventPackageParser;
import com.android.internal.telephony.util.TelephonyUtils;
import com.android.telephony.Rlog;
@@ -76,6 +77,15 @@ public class TelephonyTester {
            "com.android.internal.telephony.TestDialogEventPackage";

    private static final String EXTRA_FILENAME = "filename";
    /**
     * Used to inject the conference event package by bypassing the ImsCall and doing the
     * injection via ImsPhoneCallTracker.  This is useful in scenarios where the
     * adb shell cmd phone ims conference-event-package disable
     * command is used to disable network CEP data and it is desired to still inject CEP data.
     * Where the network CEP data is not explicitly disabled using the command above, it is not
     * necessary to bypass the ImsCall.
     */
    private static final String EXTRA_BYPASS_IMSCALL = "bypassImsCall";
    private static final String EXTRA_STARTPACKAGE = "startPackage";
    private static final String EXTRA_SENDPACKAGE = "sendPackage";
    private static final String EXTRA_DIALOGID = "dialogId";
@@ -162,7 +172,8 @@ public class TelephonyTester {
                } else if (action.equals(ACTION_TEST_CONFERENCE_EVENT_PACKAGE)) {
                    log("inject simulated conference event package");
                    handleTestConferenceEventPackage(context,
                            intent.getStringExtra(EXTRA_FILENAME));
                            intent.getStringExtra(EXTRA_FILENAME),
                            intent.getBooleanExtra(EXTRA_BYPASS_IMSCALL, false));
                } else if (action.equals(ACTION_TEST_DIALOG_EVENT_PACKAGE)) {
                    log("handle test dialog event package intent");
                    handleTestDialogEventPackageIntent(intent);
@@ -277,22 +288,15 @@ public class TelephonyTester {
     * @param context The context.
     * @param fileName The name of the test conference event package file to read.
     */
    private void handleTestConferenceEventPackage(Context context, String fileName) {
    private void handleTestConferenceEventPackage(Context context, String fileName,
            boolean isBypassingImsCall) {
        // Attempt to get the active IMS call before parsing the test XML file.
        ImsPhone imsPhone = (ImsPhone) mPhone;
        if (imsPhone == null) {
            return;
        }

        ImsPhoneCall imsPhoneCall = imsPhone.getForegroundCall();
        if (imsPhoneCall == null) {
            return;
        }

        ImsCall imsCall = imsPhoneCall.getImsCall();
        if (imsCall == null) {
            return;
        }
        ImsPhoneCallTracker tracker = (ImsPhoneCallTracker) imsPhone.getCallTracker();

        File packageFile = new File(context.getFilesDir(), fileName);
        final FileInputStream is;
@@ -309,8 +313,22 @@ public class TelephonyTester {
            return;
        }

        if (isBypassingImsCall) {
            tracker.injectTestConferenceState(imsConferenceState);
        } else {
            ImsPhoneCall imsPhoneCall = imsPhone.getForegroundCall();
            if (imsPhoneCall == null) {
                return;
            }

            ImsCall imsCall = imsPhoneCall.getImsCall();
            if (imsCall == null) {
                return;
            }

            imsCall.conferenceStateUpdated(imsConferenceState);
        }
    }

    /**
     * Handles intents containing test dialog event package data.
+109 −34
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ import android.telephony.SubscriptionPlan;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyFrameworkInitializer;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager.SimState;
import android.telephony.cdma.CdmaCellLocation;
import android.telephony.data.ApnSetting;
import android.telephony.data.DataProfile;
@@ -105,6 +106,7 @@ import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.PhoneSwitcher;
import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.SettingsObserver;
import com.android.internal.telephony.SubscriptionInfoUpdater;
import com.android.internal.telephony.dataconnection.DataConnectionReasons.DataAllowedReasonType;
import com.android.internal.telephony.dataconnection.DataConnectionReasons.DataDisallowedReasonType;
import com.android.internal.telephony.dataconnection.DataEnabledSettings.DataEnabledChangedReason;
@@ -337,7 +339,8 @@ public class DcTracker extends Handler {
    private final Map<String, Integer> m5GIconMapping = new HashMap<>();
    private String mDataIconPattern = "";

    private int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
    @SimState
    private int mSimState = TelephonyManager.SIM_STATE_UNKNOWN;

    private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver () {
        @Override
@@ -366,10 +369,29 @@ public class DcTracker extends Handler {
            } else if (action.equals(INTENT_PROVISIONING_APN_ALARM)) {
                if (DBG) log("Provisioning apn alarm");
                onActionIntentProvisioningApnAlarm(intent);
            } else if (action.equals(TelephonyManager.ACTION_SIM_CARD_STATE_CHANGED)
                    || action.equals(TelephonyManager.ACTION_SIM_APPLICATION_STATE_CHANGED)) {
                if (mPhone.getPhoneId() == intent.getIntExtra(SubscriptionManager.EXTRA_SLOT_INDEX,
                        SubscriptionManager.INVALID_SIM_SLOT_INDEX)) {
                    int simState = intent.getIntExtra(TelephonyManager.EXTRA_SIM_STATE,
                            TelephonyManager.SIM_STATE_UNKNOWN);
                    sendMessage(obtainMessage(DctConstants.EVENT_SIM_STATE_UPDATED, simState, 0));
                }
            } else if (action.equals(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED)) {
                sendMessage(obtainMessage(DctConstants.EVENT_CARRIER_CONFIG_CHANGED,
                        intent.getIntExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX,
                                SubscriptionManager.INVALID_SUBSCRIPTION_ID), 0));
                if (mPhone.getPhoneId() == intent.getIntExtra(CarrierConfigManager.EXTRA_SLOT_INDEX,
                        SubscriptionManager.INVALID_SIM_SLOT_INDEX)) {
                    if (intent.getBooleanExtra(
                            CarrierConfigManager.EXTRA_REBROADCAST_ON_UNLOCK, false)) {
                        // Ignore the rebroadcast one to prevent multiple carrier config changed
                        // event during boot up.
                        return;
                    }
                    int subId = intent.getIntExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX,
                            SubscriptionManager.INVALID_SUBSCRIPTION_ID);
                    if (SubscriptionManager.isValidSubscriptionId(subId)) {
                        sendEmptyMessage(DctConstants.EVENT_CARRIER_CONFIG_CHANGED);
                    }
                }
            } else {
                if (DBG) log("onReceive: Unknown action=" + action);
            }
@@ -602,6 +624,8 @@ public class DcTracker extends Handler {
    private ConcurrentHashMap<String, Pair<Integer, Integer>> mBandwidths =
            new ConcurrentHashMap<>();

    private boolean mConfigReady = false;

    /**
     * Handles changes to the APN db.
     */
@@ -682,6 +706,8 @@ public class DcTracker extends Handler {
        filter.addAction(INTENT_DATA_STALL_ALARM);
        filter.addAction(INTENT_PROVISIONING_APN_ALARM);
        filter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
        filter.addAction(TelephonyManager.ACTION_SIM_CARD_STATE_CHANGED);
        filter.addAction(TelephonyManager.ACTION_SIM_APPLICATION_STATE_CHANGED);

        mDataEnabledSettings = mPhone.getDataEnabledSettings();

@@ -2205,8 +2231,11 @@ public class DcTracker extends Handler {
        removeMessages(DctConstants.EVENT_DATA_RECONNECT, apnContext);
    }

    private void onSubscriptionChanged() {
        if (DBG) log("onSubscriptionChanged");
    /**
     * Read configuration. Note this must be called after carrier config is ready.
     */
    private void readConfiguration() {
        log("readConfiguration");
        if (mTransportType == AccessNetworkConstants.TRANSPORT_TYPE_WWAN) {
            // Auto attach is for cellular only.
            mAutoAttachOnCreationConfig = mPhone.getContext().getResources()
@@ -2217,19 +2246,48 @@ public class DcTracker extends Handler {
        setDefaultDataRoamingEnabled();
        read5GConfiguration();
        registerSettingsObserver();
        mConfigReady = true;
    }

    /**
     * @return {@code true} if carrier config has been applied.
     */
    private boolean isCarrierConfigApplied() {
        CarrierConfigManager configManager = (CarrierConfigManager) mPhone.getContext()
                .getSystemService(Context.CARRIER_CONFIG_SERVICE);
        if (configManager != null) {
            PersistableBundle b = configManager.getConfigForSubId(mPhone.getSubId());
            if (b != null) {
                return CarrierConfigManager.isConfigForIdentifiedCarrier(b);
            }
        }
        return false;
    }

    private void onCarrierConfigChanged() {
        if (DBG) log("onCarrierConfigChanged");

        if (!isCarrierConfigApplied()) {
            log("onCarrierConfigChanged: Carrier config is not ready yet.");
            return;
        }

        readConfiguration();

        if (mSimState == TelephonyManager.SIM_STATE_LOADED) {
            createAllApnList();
            setDataProfilesAsNeeded();
        if (mPhone.getSubId() != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
            setInitialAttachApn();
            setupDataOnAllConnectableApns(Phone.REASON_CARRIER_CHANGE, RetryFailures.ALWAYS);
        } else {
            log("onCarrierConfigChanged: SIM is not loaded yet.");
        }
        mPhone.notifyAllActiveDataConnections();
        setupDataOnAllConnectableApns(Phone.REASON_SIM_LOADED, RetryFailures.ALWAYS);
    }

    private void onSimNotReady() {
        if (DBG) log("onSimNotReady");
    private void onSimAbsent() {
        if (DBG) log("onSimAbsent");

        mConfigReady = false;
        cleanUpAllConnectionsInternal(true, Phone.REASON_SIM_NOT_READY);
        mAllApnSettings.clear();
        mAutoAttachOnCreationConfig = false;
@@ -2240,6 +2298,27 @@ public class DcTracker extends Handler {
        setDataProfilesAsNeeded();
    }

    private void onSimStateUpdated(@SimState int simState) {
        mSimState = simState;

        if (DBG) {
            log("onSimStateUpdated: state=" + SubscriptionInfoUpdater.simStateString(mSimState));
        }

        if (mSimState == TelephonyManager.SIM_STATE_ABSENT) {
            onSimAbsent();
        } else if (mSimState == TelephonyManager.SIM_STATE_LOADED) {
            if (mConfigReady) {
                createAllApnList();
                setDataProfilesAsNeeded();
                setInitialAttachApn();
                setupDataOnAllConnectableApns(Phone.REASON_SIM_LOADED, RetryFailures.ALWAYS);
            } else {
                log("onSimStateUpdated: config not ready yet.");
            }
        }
    }

    private DataConnection checkForCompatibleDataConnection(ApnContext apnContext) {
        int apnType = apnContext.getApnTypeBitmask();
        ArrayList<ApnSetting> dunSettings = null;
@@ -2391,12 +2470,17 @@ public class DcTracker extends Handler {
        }
        apnContext.setEnabled(true);
        apnContext.resetErrorCodeRetries();

        if (mConfigReady || apnContext.getApnTypeBitmask() == ApnSetting.TYPE_EMERGENCY) {
            if (trySetupData(apnContext, requestType)) {
                addRequestNetworkCompleteMsg(onCompleteMsg, apnType);
            } else {
                sendRequestNetworkCompleteMsg(onCompleteMsg, false, mTransportType,
                        requestType, DataFailCause.NONE);
            }
        } else {
            log("onEnableApn: config not ready yet.");
        }
    }

    public void disableApn(@ApnType int apnType, @ReleaseNetworkType int releaseType) {
@@ -3761,7 +3845,11 @@ public class DcTracker extends Handler {
                reevaluateUnmeteredConnections();
                break;
            case DctConstants.EVENT_CARRIER_CONFIG_CHANGED:
                onCarrierConfigChanged(msg.arg1);
                onCarrierConfigChanged();
                break;
            case DctConstants.EVENT_SIM_STATE_UPDATED:
                int simState = msg.arg1;
                onSimStateUpdated(simState);
                break;
            default:
                Rlog.e("DcTracker", "Unhandled event=" + msg);
@@ -4063,6 +4151,7 @@ public class DcTracker extends Handler {
        TelephonyDisplayInfo telephonyDisplayInfo =
                new TelephonyDisplayInfo(dataNetworkType, displayNetworkType);
        if (!telephonyDisplayInfo.equals(mTelephonyDisplayInfo)) {
            log("Display info changed. " + telephonyDisplayInfo);
            mTelephonyDisplayInfo = telephonyDisplayInfo;
            mPhone.notifyDisplayInfoChanged(telephonyDisplayInfo);
            return true;
@@ -4147,6 +4236,8 @@ public class DcTracker extends Handler {
        pw.flush();
        pw.println(" mRequestedApnType=" + mRequestedApnType);
        pw.println(" mPhone=" + mPhone.getPhoneName());
        pw.println(" mConfigReady=" + mConfigReady);
        pw.println(" mSimState=" + SubscriptionInfoUpdater.simStateString(mSimState));
        pw.println(" mActivity=" + mActivity);
        pw.println(" mState=" + mState);
        pw.println(" mTxPkts=" + mTxPkts);
@@ -5126,20 +5217,4 @@ public class DcTracker extends Handler {
        updateLinkBandwidths(bandwidths, useLte);
        update5GIconMapping(nr5GIconConfiguration);
    }

    // This handles carrier config changed event. We intentionally to use this for SIM loaded/absent
    // event. There are several data setup related configuration stored in carrier config. We have
    // to wait carrier config ready before we can setup a data.
    private void onCarrierConfigChanged(int subId) {
        // TODO: Remove this check after b/152149072 is fixed because carrier config might
        // actually change without sub id change.
        if (mSubId == subId) return;
        mSubId = subId;
        if (DBG) log("onCarrierConfigChanged subId=" + subId);
        if (SubscriptionManager.isValidSubscriptionId(subId)) {
            onSubscriptionChanged();
        } else {
            onSimNotReady();
        }
    }
}
+26 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsConferenceState;
import android.telephony.ims.ImsMmTelManager;
import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.ImsStreamMediaProfile;
@@ -506,6 +507,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    private boolean mIsViLteDataMetered = false;
    private boolean mAlwaysPlayRemoteHoldTone = false;
    private boolean mAutoRetryFailedWifiEmergencyCall = false;
    private boolean mSupportCepOnPeer = true;
    // Tracks the state of our background/foreground calls while a call hold/swap operation is
    // in progress. Values listed above.
    private HoldSwapState mHoldSwitchingState = HoldSwapState.INACTIVE;
@@ -1391,6 +1393,8 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                CarrierConfigManager.KEY_ALWAYS_PLAY_REMOTE_HOLD_TONE_BOOL);
        mAutoRetryFailedWifiEmergencyCall = carrierConfig.getBoolean(
                CarrierConfigManager.KEY_AUTO_RETRY_FAILED_WIFI_EMERGENCY_CALL);
        mSupportCepOnPeer = carrierConfig.getBoolean(
                CarrierConfigManager.KEY_SUPPORT_IMS_CONFERENCE_EVENT_PACKAGE_ON_PEER_BOOL);

        String[] mappings = carrierConfig
                .getStringArray(CarrierConfigManager.KEY_IMS_REASONINFO_MAPPING_STRING_ARRAY);
@@ -3325,6 +3329,11 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                return;
            }

            if (!mSupportCepOnPeer && !call.isConferenceHost()) {
                logi("onConferenceParticipantsStateChanged - ignore CEP on peer");
                return;
            }

            ImsPhoneConnection conn = findConnection(call);
            if (conn != null) {
                updateConferenceParticipantsTiming(participants);
@@ -4142,6 +4151,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        pw.println(" mCallQualityMetrics=" + mCallQualityMetrics);
        pw.println(" mCallQualityMetricsHistory=" + mCallQualityMetricsHistory);
        pw.println(" mIsConferenceEventPackageHandlingEnabled=" + mIsConferenceEventPackageEnabled);
        pw.println(" mSupportCepOnPeer=" + mSupportCepOnPeer);
        pw.println(" Event Log:");
        pw.increaseIndent();
        mOperationLocalLog.dump(pw);
@@ -4826,6 +4836,22 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        return mPhone;
    }

    @VisibleForTesting
    public void setSupportCepOnPeer(boolean isSupported) {
        mSupportCepOnPeer = isSupported;
    }

    /**
     * Injects a test conference state into an ongoing IMS call.
     * @param state The injected state.
     */
    public void injectTestConferenceState(@NonNull ImsConferenceState state) {
        List<ConferenceParticipant> participants = ImsCall.parseConferenceState(state);
        for (ImsPhoneConnection connection : getConnections()) {
            connection.updateConferenceParticipants(participants);
        }
    }

    /**
     * Sets whether CEP handling is enabled or disabled.
     * @param isEnabled
+88 −273

File changed.

Preview size limit exceeded, changes collapsed.

Loading