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

Commit 2e4be87d authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11420186 from 3dbc338c to 24Q2-release

Change-Id: I9f0cf8796360c15cbc25fec610d940111fa89ebc
parents 65c96c28 3dbc338c
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -27,3 +27,10 @@ flag {
  description: "Support emergency call only for data only cellular service."
  description: "Support emergency call only for data only cellular service."
  bug: "296097429"
  bug: "296097429"
}
}

flag {
  name: "support_psim_to_esim_conversion"
  namespace: "telephony"
  description: "Support the psim to esim conversion."
  bug: "315073761"
}
 No newline at end of file
+0 −23
Original line number Original line Diff line number Diff line
@@ -16,10 +16,7 @@


package com.android.internal.telephony;
package com.android.internal.telephony;


import static android.telephony.NetworkRegistrationInfo.DOMAIN_CS;
import static android.telephony.NetworkRegistrationInfo.DOMAIN_CS_PS;
import static android.telephony.NetworkRegistrationInfo.DOMAIN_PS;
import static android.telephony.NetworkRegistrationInfo.DOMAIN_PS;
import static android.telephony.NetworkRegistrationInfo.DOMAIN_UNKNOWN;


import static com.android.internal.telephony.CommandException.Error.GENERIC_FAILURE;
import static com.android.internal.telephony.CommandException.Error.GENERIC_FAILURE;
import static com.android.internal.telephony.CommandException.Error.SIM_BUSY;
import static com.android.internal.telephony.CommandException.Error.SIM_BUSY;
@@ -75,7 +72,6 @@ import android.telecom.VideoProfile;
import android.telephony.AccessNetworkConstants.TransportType;
import android.telephony.AccessNetworkConstants.TransportType;
import android.telephony.Annotation.DataActivityType;
import android.telephony.Annotation.DataActivityType;
import android.telephony.Annotation.RadioPowerState;
import android.telephony.Annotation.RadioPowerState;
import android.telephony.AnomalyReporter;
import android.telephony.BarringInfo;
import android.telephony.BarringInfo;
import android.telephony.CarrierConfigManager;
import android.telephony.CarrierConfigManager;
import android.telephony.CellBroadcastIdRange;
import android.telephony.CellBroadcastIdRange;
@@ -152,7 +148,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.List;
import java.util.Locale;
import java.util.Locale;
import java.util.Set;
import java.util.Set;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.Pattern;
@@ -1503,24 +1498,6 @@ public class GsmCdmaPhone extends Phone {
                && (isWpsCall ? allowWpsOverIms : true);
                && (isWpsCall ? allowWpsOverIms : true);


        Bundle extras = dialArgs.intentExtras;
        Bundle extras = dialArgs.intentExtras;
        if (extras != null && extras.containsKey(PhoneConstants.EXTRA_COMPARE_DOMAIN)) {
            int domain = extras.getInt(PhoneConstants.EXTRA_DIAL_DOMAIN);
            if (!isEmergency && (!isMmiCode || isPotentialUssdCode)) {
                if ((domain == DOMAIN_PS && !useImsForCall)
                        || (domain == DOMAIN_CS && useImsForCall)
                        || domain == DOMAIN_UNKNOWN || domain == DOMAIN_CS_PS) {
                    loge("[Anomaly] legacy-useImsForCall:" + useImsForCall
                            + ", NCDS-domain:" + domain);

                    AnomalyReporter.reportAnomaly(
                            UUID.fromString("bfae6c2e-ca2f-4121-b167-9cad26a3b353"),
                            "Domain selection results don't match. useImsForCall:"
                                    + useImsForCall + ", NCDS-domain:" + domain);
                }
            }
            extras.remove(PhoneConstants.EXTRA_COMPARE_DOMAIN);
        }

        // Only when the domain selection service is supported, EXTRA_DIAL_DOMAIN extra shall exist.
        // Only when the domain selection service is supported, EXTRA_DIAL_DOMAIN extra shall exist.
        if (extras != null && extras.containsKey(PhoneConstants.EXTRA_DIAL_DOMAIN)) {
        if (extras != null && extras.containsKey(PhoneConstants.EXTRA_DIAL_DOMAIN)) {
            int domain = extras.getInt(PhoneConstants.EXTRA_DIAL_DOMAIN);
            int domain = extras.getInt(PhoneConstants.EXTRA_DIAL_DOMAIN);
+34 −32
Original line number Original line Diff line number Diff line
@@ -128,13 +128,13 @@ public class EmergencyStateTracker {
    // A runnable which is used to automatically exit from Ecm after a period of time.
    // A runnable which is used to automatically exit from Ecm after a period of time.
    private final Runnable mExitEcmRunnable = this::exitEmergencyCallbackMode;
    private final Runnable mExitEcmRunnable = this::exitEmergencyCallbackMode;
    // Tracks emergency calls by callId that have reached {@link Call.State#ACTIVE}.
    // Tracks emergency calls by callId that have reached {@link Call.State#ACTIVE}.
    private final Set<String> mActiveEmergencyCalls = new ArraySet<>();
    private final Set<android.telecom.Connection> mActiveEmergencyCalls = new ArraySet<>();
    private Phone mPhoneToExit;
    private Phone mPhoneToExit;
    private int mPdnDisconnectionTimeoutMs = DEFAULT_EPDN_DISCONNECTION_TIMEOUT_MS;
    private int mPdnDisconnectionTimeoutMs = DEFAULT_EPDN_DISCONNECTION_TIMEOUT_MS;
    private final Object mLock = new Object();
    private final Object mLock = new Object();
    private Phone mPhone;
    private Phone mPhone;
    // Tracks ongoing emergency callId to handle a second emergency call
    // Tracks ongoing emergency connection to handle a second emergency call
    private String mOngoingCallId;
    private android.telecom.Connection mOngoingConnection;
    // Domain of the active emergency call. Assuming here that there will only be one domain active.
    // Domain of the active emergency call. Assuming here that there will only be one domain active.
    private int mEmergencyCallDomain = NetworkRegistrationInfo.DOMAIN_UNKNOWN;
    private int mEmergencyCallDomain = NetworkRegistrationInfo.DOMAIN_UNKNOWN;
    private CompletableFuture<Integer> mCallEmergencyModeFuture;
    private CompletableFuture<Integer> mCallEmergencyModeFuture;
@@ -498,21 +498,22 @@ public class EmergencyStateTracker {
     * Handles turning on radio and switching DDS.
     * Handles turning on radio and switching DDS.
     *
     *
     * @param phone                 the {@code Phone} on which to process the emergency call.
     * @param phone                 the {@code Phone} on which to process the emergency call.
     * @param callId                the call id on which to process the emergency call.
     * @param c                     the {@code Connection} on which to process the emergency call.
     * @param isTestEmergencyNumber whether this is a test emergency number.
     * @param isTestEmergencyNumber whether this is a test emergency number.
     * @return a {@code CompletableFuture} that results in {@code DisconnectCause.NOT_DISCONNECTED}
     * @return a {@code CompletableFuture} that results in {@code DisconnectCause.NOT_DISCONNECTED}
     *         if emergency call successfully started.
     *         if emergency call successfully started.
     */
     */
    public CompletableFuture<Integer> startEmergencyCall(@NonNull Phone phone,
    public CompletableFuture<Integer> startEmergencyCall(@NonNull Phone phone,
            @NonNull String callId, boolean isTestEmergencyNumber) {
            @NonNull android.telecom.Connection c, boolean isTestEmergencyNumber) {
        Rlog.i(TAG, "startEmergencyCall: phoneId=" + phone.getPhoneId() + ", callId=" + callId);
        Rlog.i(TAG, "startEmergencyCall: phoneId=" + phone.getPhoneId()
                + ", callId=" + c.getTelecomCallId());


        if (mPhone != null) {
        if (mPhone != null) {
            // Create new future to return as to not interfere with any uncompleted futures.
            // Create new future to return as to not interfere with any uncompleted futures.
            // Case1) When 2nd emergency call is initiated during an active call on the same phone.
            // Case1) When 2nd emergency call is initiated during an active call on the same phone.
            // Case2) While the device is in ECBM, an emergency call is initiated on the same phone.
            // Case2) While the device is in ECBM, an emergency call is initiated on the same phone.
            if (isSamePhone(mPhone, phone) && (!mActiveEmergencyCalls.isEmpty() || isInEcm())) {
            if (isSamePhone(mPhone, phone) && (!mActiveEmergencyCalls.isEmpty() || isInEcm())) {
                mOngoingCallId = callId;
                mOngoingConnection = c;
                mIsTestEmergencyNumber = isTestEmergencyNumber;
                mIsTestEmergencyNumber = isTestEmergencyNumber;
                // Ensure that domain selector requests scan.
                // Ensure that domain selector requests scan.
                mLastEmergencyRegResult = new EmergencyRegResult(
                mLastEmergencyRegResult = new EmergencyRegResult(
@@ -547,13 +548,13 @@ public class EmergencyStateTracker {
            }
            }


            mPhone = phone;
            mPhone = phone;
            mOngoingCallId = callId;
            mOngoingConnection = c;
            mIsTestEmergencyNumber = isTestEmergencyNumber;
            mIsTestEmergencyNumber = isTestEmergencyNumber;
            return mCallEmergencyModeFuture;
            return mCallEmergencyModeFuture;
        }
        }


        mPhone = phone;
        mPhone = phone;
        mOngoingCallId = callId;
        mOngoingConnection = c;
        mIsTestEmergencyNumber = isTestEmergencyNumber;
        mIsTestEmergencyNumber = isTestEmergencyNumber;
        turnOnRadioAndSwitchDds(mPhone, EMERGENCY_TYPE_CALL, mIsTestEmergencyNumber);
        turnOnRadioAndSwitchDds(mPhone, EMERGENCY_TYPE_CALL, mIsTestEmergencyNumber);
        return mCallEmergencyModeFuture;
        return mCallEmergencyModeFuture;
@@ -566,13 +567,13 @@ public class EmergencyStateTracker {
     * Enter ECM only once all active emergency calls have ended. If a call never reached
     * Enter ECM only once all active emergency calls have ended. If a call never reached
     * {@link Call.State#ACTIVE}, then no need to enter ECM.
     * {@link Call.State#ACTIVE}, then no need to enter ECM.
     *
     *
     * @param callId the call id on which to end the emergency call.
     * @param c the emergency call disconnected.
     */
     */
    public void endCall(@NonNull String callId) {
    public void endCall(@NonNull android.telecom.Connection c) {
        boolean wasActive = mActiveEmergencyCalls.remove(callId);
        boolean wasActive = mActiveEmergencyCalls.remove(c);


        if (Objects.equals(mOngoingCallId, callId)) {
        if (Objects.equals(mOngoingConnection, c)) {
            mOngoingCallId = null;
            mOngoingConnection = null;
            mOngoingCallProperties = 0;
            mOngoingCallProperties = 0;
        }
        }


@@ -580,11 +581,11 @@ public class EmergencyStateTracker {
                && isEmergencyCallbackModeSupported()) {
                && isEmergencyCallbackModeSupported()) {
            enterEmergencyCallbackMode();
            enterEmergencyCallbackMode();


            if (mOngoingCallId == null) {
            if (mOngoingConnection == null) {
                mIsEmergencyCallStartedDuringEmergencySms = false;
                mIsEmergencyCallStartedDuringEmergencySms = false;
                mCallEmergencyModeFuture = null;
                mCallEmergencyModeFuture = null;
            }
            }
        } else if (mOngoingCallId == null) {
        } else if (mOngoingConnection == null) {
            if (isInEcm()) {
            if (isInEcm()) {
                mIsEmergencyCallStartedDuringEmergencySms = false;
                mIsEmergencyCallStartedDuringEmergencySms = false;
                mCallEmergencyModeFuture = null;
                mCallEmergencyModeFuture = null;
@@ -605,7 +606,7 @@ public class EmergencyStateTracker {
        mIsTestEmergencyNumber = false;
        mIsTestEmergencyNumber = false;
        mIsEmergencyCallStartedDuringEmergencySms = false;
        mIsEmergencyCallStartedDuringEmergencySms = false;
        mCallEmergencyModeFuture = null;
        mCallEmergencyModeFuture = null;
        mOngoingCallId = null;
        mOngoingConnection = null;
        mOngoingCallProperties = 0;
        mOngoingCallProperties = 0;
        mPhone = null;
        mPhone = null;
    }
    }
@@ -843,10 +844,10 @@ public class EmergencyStateTracker {
    /**
    /**
     * Notify the tracker that the emergency call domain has been updated.
     * Notify the tracker that the emergency call domain has been updated.
     * @param phoneType The new PHONE_TYPE_* of the call.
     * @param phoneType The new PHONE_TYPE_* of the call.
     * @param callId The ID of the call
     * @param c The connection of the call
     */
     */
    public void onEmergencyCallDomainUpdated(int phoneType, String callId) {
    public void onEmergencyCallDomainUpdated(int phoneType, android.telecom.Connection c) {
        Rlog.d(TAG, "domain update for callId: " + callId);
        Rlog.d(TAG, "domain update for callId: " + c.getTelecomCallId());
        int domain = -1;
        int domain = -1;
        switch(phoneType) {
        switch(phoneType) {
            case (PhoneConstants.PHONE_TYPE_CDMA_LTE):
            case (PhoneConstants.PHONE_TYPE_CDMA_LTE):
@@ -874,13 +875,13 @@ public class EmergencyStateTracker {
     * Handles emergency call state change.
     * Handles emergency call state change.
     *
     *
     * @param state the new call state
     * @param state the new call state
     * @param callId the callId whose state has changed
     * @param c the call whose state has changed
     */
     */
    public void onEmergencyCallStateChanged(Call.State state, String callId) {
    public void onEmergencyCallStateChanged(Call.State state, android.telecom.Connection c) {
        if (state == Call.State.ACTIVE) {
        if (state == Call.State.ACTIVE) {
            mActiveEmergencyCalls.add(callId);
            mActiveEmergencyCalls.add(c);
            if (Objects.equals(mOngoingCallId, callId)) {
            if (Objects.equals(mOngoingConnection, c)) {
                Rlog.i(TAG, "call connected " + callId);
                Rlog.i(TAG, "call connected " + c.getTelecomCallId());
                if (mPhone != null
                if (mPhone != null
                        && isVoWiFi(mOngoingCallProperties)
                        && isVoWiFi(mOngoingCallProperties)
                        && mEmergencyMode == EmergencyConstants.MODE_EMERGENCY_WLAN) {
                        && mEmergencyMode == EmergencyConstants.MODE_EMERGENCY_WLAN) {
@@ -895,10 +896,10 @@ public class EmergencyStateTracker {
     * Handles the change of emergency call properties.
     * Handles the change of emergency call properties.
     *
     *
     * @param properties the new call properties.
     * @param properties the new call properties.
     * @param callId the callId whose state has changed.
     * @param c the call whose state has changed.
     */
     */
    public void onEmergencyCallPropertiesChanged(int properties, String callId) {
    public void onEmergencyCallPropertiesChanged(int properties, android.telecom.Connection c) {
        if (Objects.equals(mOngoingCallId, callId)) {
        if (Objects.equals(mOngoingConnection, c)) {
            mOngoingCallProperties = properties;
            mOngoingCallProperties = properties;
        }
        }
    }
    }
@@ -1161,7 +1162,7 @@ public class EmergencyStateTracker {
            if (isInEcm()) {
            if (isInEcm()) {
                // When the emergency mode is not in MODE_EMERGENCY_CALLBACK,
                // When the emergency mode is not in MODE_EMERGENCY_CALLBACK,
                // it needs to notify the emergency callback mode to modem.
                // it needs to notify the emergency callback mode to modem.
                if (mActiveEmergencyCalls.isEmpty() && mOngoingCallId == null) {
                if (mActiveEmergencyCalls.isEmpty() && mOngoingConnection == null) {
                    setEmergencyMode(mPhone, EMERGENCY_TYPE_CALL, MODE_EMERGENCY_CALLBACK,
                    setEmergencyMode(mPhone, EMERGENCY_TYPE_CALL, MODE_EMERGENCY_CALLBACK,
                            MSG_SET_EMERGENCY_CALLBACK_MODE_DONE);
                            MSG_SET_EMERGENCY_CALLBACK_MODE_DONE);
                }
                }
@@ -1229,7 +1230,7 @@ public class EmergencyStateTracker {
            }
            }


            final Phone phoneForEmergency = phone;
            final Phone phoneForEmergency = phone;
            final String expectedCallId = mOngoingCallId;
            final android.telecom.Connection expectedConnection = mOngoingConnection;
            final int waitForInServiceTimeout =
            final int waitForInServiceTimeout =
                    needToTurnOnRadio ? DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS : 0;
                    needToTurnOnRadio ? DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS : 0;
            Rlog.i(TAG, "turnOnRadioAndSwitchDds: timeout=" + waitForInServiceTimeout);
            Rlog.i(TAG, "turnOnRadioAndSwitchDds: timeout=" + waitForInServiceTimeout);
@@ -1247,8 +1248,9 @@ public class EmergencyStateTracker {
                            completeEmergencyMode(emergencyType, DisconnectCause.POWER_OFF);
                            completeEmergencyMode(emergencyType, DisconnectCause.POWER_OFF);
                        }
                        }
                    } else {
                    } else {
                        if (!Objects.equals(mOngoingCallId, expectedCallId)) {
                        if (!Objects.equals(mOngoingConnection, expectedConnection)) {
                            Rlog.i(TAG, "onComplete " + expectedCallId + " canceled.");
                            Rlog.i(TAG, "onComplete "
                                    + expectedConnection.getTelecomCallId() + " canceled.");
                            return;
                            return;
                        }
                        }
                        switchDdsAndSetEmergencyMode(phone, emergencyType);
                        switchDdsAndSetEmergencyMode(phone, emergencyType);
+31 −0
Original line number Original line Diff line number Diff line
@@ -72,6 +72,7 @@ import com.android.internal.telephony.uicc.UiccSlot;


import java.io.FileDescriptor;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Collections;
import java.util.List;
import java.util.List;
import java.util.Stack;
import java.util.Stack;
@@ -79,6 +80,7 @@ import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;


/** Backing implementation of {@link android.telephony.euicc.EuiccManager}. */
/** Backing implementation of {@link android.telephony.euicc.EuiccManager}. */
public class EuiccController extends IEuiccController.Stub {
public class EuiccController extends IEuiccController.Stub {
@@ -121,6 +123,7 @@ public class EuiccController extends IEuiccController.Stub {
    // the phone process, 3) values are updated remotely by server flags.
    // the phone process, 3) values are updated remotely by server flags.
    private List<String> mSupportedCountries;
    private List<String> mSupportedCountries;
    private List<String> mUnsupportedCountries;
    private List<String> mUnsupportedCountries;
    private List<Integer> mPsimConversionSupportedCarrierIds;


    /** Initialize the instance. Should only be called once. */
    /** Initialize the instance. Should only be called once. */
    public static EuiccController init(Context context, FeatureFlags featureFlags) {
    public static EuiccController init(Context context, FeatureFlags featureFlags) {
@@ -2073,6 +2076,34 @@ public class EuiccController extends IEuiccController.Stub {
        return changeEnabled;
        return changeEnabled;
    }
    }



    @Override
    public void setPsimConversionSupportedCarriers(int[] carrierIds) {
        if (!callerCanWriteEmbeddedSubscriptions()) {
            throw new SecurityException(
                    "Must have WRITE_EMBEDDED_SUBSCRIPTIONS to "
                            + "set pSIM conversion supported carriers");
        }
        mPsimConversionSupportedCarrierIds = Arrays.stream(carrierIds).boxed()
                .collect(Collectors.toList());
    }



    @Override
    public boolean isPsimConversionSupported(int carrierId) {
        if (!callerCanWriteEmbeddedSubscriptions()) {
            throw new SecurityException(
                    "Must have WRITE_EMBEDDED_SUBSCRIPTIONS "
                            + "to check if the carrier is supported pSIM conversion");
        }
        if (mPsimConversionSupportedCarrierIds == null
                || mPsimConversionSupportedCarrierIds.isEmpty()) {
            return false;
        }
        return mPsimConversionSupportedCarrierIds.contains(carrierId);
    }

    /**
    /**
     * Make sure the device has required telephony feature
     * Make sure the device has required telephony feature
     *
     *
+31 −2
Original line number Original line Diff line number Diff line
@@ -284,7 +284,10 @@ public class SubscriptionDatabaseManager extends Handler {
                    SubscriptionInfoInternal::getOnlyNonTerrestrialNetwork),
                    SubscriptionInfoInternal::getOnlyNonTerrestrialNetwork),
            new AbstractMap.SimpleImmutableEntry<>(
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_SERVICE_CAPABILITIES,
                    SimInfo.COLUMN_SERVICE_CAPABILITIES,
                    SubscriptionInfoInternal::getServiceCapabilities)
                    SubscriptionInfoInternal::getServiceCapabilities),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_TRANSFER_STATUS,
                    SubscriptionInfoInternal::getTransferStatus)
    );
    );


    /**
    /**
@@ -418,7 +421,10 @@ public class SubscriptionDatabaseManager extends Handler {
                    SubscriptionDatabaseManager::setNtn),
                    SubscriptionDatabaseManager::setNtn),
            new AbstractMap.SimpleImmutableEntry<>(
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_SERVICE_CAPABILITIES,
                    SimInfo.COLUMN_SERVICE_CAPABILITIES,
                    SubscriptionDatabaseManager::setServiceCapabilities)
                    SubscriptionDatabaseManager::setServiceCapabilities),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_TRANSFER_STATUS,
                    SubscriptionDatabaseManager::setTransferStatus)
    );
    );


    /**
    /**
@@ -2335,6 +2341,10 @@ public class SubscriptionDatabaseManager extends Handler {
            builder.setOnlyNonTerrestrialNetwork(cursor.getInt(cursor.getColumnIndexOrThrow(
            builder.setOnlyNonTerrestrialNetwork(cursor.getInt(cursor.getColumnIndexOrThrow(
                    SimInfo.COLUMN_IS_NTN)));
                    SimInfo.COLUMN_IS_NTN)));
        }
        }
        if (mFeatureFlags.supportPsimToEsimConversion()) {
            builder.setTransferStatus(cursor.getInt(cursor.getColumnIndexOrThrow(
                    SimInfo.COLUMN_TRANSFER_STATUS)));
        }
        return builder.build();
        return builder.build();
    }
    }


@@ -2408,6 +2418,25 @@ public class SubscriptionDatabaseManager extends Handler {
        }
        }
    }
    }


    /**
     * Set the transfer status of the subscriptionInfo that corresponds to subId.
     *
     * @param subId Subscription ID.
     * @param status The transfer status to change.
     *
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setTransferStatus(int subId, int status) {
        if (!mFeatureFlags.supportPsimToEsimConversion()) {
            log("SubscriptionDatabaseManager:supportPsimToEsimConversion is false");
            return;
        }

        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_TRANSFER_STATUS,
                status,
                SubscriptionInfoInternal.Builder::setTransferStatus);
    }

    /**
    /**
     * Log debug messages.
     * Log debug messages.
     *
     *
Loading