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

Unverified Commit 3769bd9c authored by Michael Bestas's avatar Michael Bestas
Browse files

Merge tag 'android-13.0.0_r11' into staging/lineage-20.0_merge-android-13.0.0_r11

Android 13.0.0 release 11

# -----BEGIN PGP SIGNATURE-----
#
# iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCY0jiSwAKCRDorT+BmrEO
# eIIHAJ9EM8JErjLSQjmgrrUfHQaxNOAEewCghxLQ4jStR0DinDqVbjhst6sjECA=
# =Atlh
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri Oct 14 07:15:07 2022 EEST
# gpg:                using DSA key 4340D13570EF945E83810964E8AD3F819AB10E78
# gpg: Good signature from "The Android Open Source Project <initial-contribution@android.com>" [marginal]
# gpg: initial-contribution@android.com: Verified 1352 signatures in the past
#      11 months.  Encrypted 4 messages in the past 9 months.
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 4340 D135 70EF 945E 8381  0964 E8AD 3F81 9AB1 0E78

# By Ling Ma (9) and others
# Via Android Build Coastguard Worker (270) and others
* tag 'android-13.0.0_r11': (33 commits)
  Fixed a crash when data network does not have PCO
  Fixed a race condition for early arrived PCO data
  Supported UNKNOWN in IWLAN handover rule
  Revert "Add dump reset for rcs metrics"
  Handle IMS call start failure in Westworld metrics.
  Revert "Fix APM race conditions in ServiceStateTracker"
  Revert "Fix APM race conditions in ServiceStateTracker"
  Fix voice call setup duration metrics.
  Notify source transport for upcoming handover
  Update ImsStats registration stat RAT on service state change
  Send IA to modem when SIM switch or refresh
  Fix APM race conditions in ServiceStateTracker
  Fix APM race conditions in ServiceStateTracker
  Avoid Showing Dialog in SetUpWizard.
  Remove the temporary changes.
  New data stack wait for data disconnected on all subs for APM on
  Fix Sync preferred apn and preferred apn set id
  Revert "Sync preferred apn and preferred apn set id"
  Restart anomaly report counter when QNS crash
  Revert "Sync preferred apn and preferred apn set id"
  ...

 Conflicts:
	src/java/com/android/internal/telephony/data/DataNetwork.java

Change-Id: Ie26dbd84410caf5bbf2ae4c47329f6854c63310b
parents e5f9b7f6 2ad8d21c
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -500,6 +500,14 @@ public class CellularNetworkService extends NetworkService {
            final String rplmn = regResult.registeredPlmn;
            final int reasonForDenial = regResult.reasonForDenial;

            if (regState == NetworkRegistrationInfo.REGISTRATION_STATE_DENIED
                    && reasonForDenial
                    == android.hardware.radio.network.RegistrationFailCause.NONE) {
                AnomalyReporter.reportAnomaly(
                        UUID.fromString("62ed270f-e139-418a-a427-8bcc1bca8f20"),
                            "RIL Missing Reg Fail Reason", mPhone.getCarrierId());
            }

            int networkType = ServiceState.rilRadioTechnologyToNetworkType(regResult.rat);
            if (networkType == TelephonyManager.NETWORK_TYPE_LTE_CA) {
                networkType = TelephonyManager.NETWORK_TYPE_LTE;
@@ -582,6 +590,14 @@ public class CellularNetworkService extends NetworkService {
            networkType =
                    getNetworkTypeForCellIdentity(networkType, cellIdentity, mPhone.getCarrierId());

            if (regState == NetworkRegistrationInfo.REGISTRATION_STATE_DENIED
                    && reasonForDenial
                    == android.hardware.radio.network.RegistrationFailCause.NONE) {
                AnomalyReporter.reportAnomaly(
                        UUID.fromString("62ed270f-e139-418a-a427-8bcc1bca8f20"),
                            "RIL Missing Reg Fail Reason", mPhone.getCarrierId());
            }

            // Conditional parameters for specific RANs
            boolean cssSupported = false;
            int roamingIndicator = 0;
+10 −19
Original line number Diff line number Diff line
@@ -486,20 +486,12 @@ public class LocaleTracker extends Handler {
        String countryIso = "";
        String countryIsoDebugInfo = "empty as default";

        // For time zone detection we want the best geographical match we can get, which may differ
        // from the countryIso.
        String timeZoneCountryIso = null;
        String timeZoneCountryIsoDebugInfo = null;

        if (!TextUtils.isEmpty(mOperatorNumeric)) {
            MccMnc mccMnc = MccMnc.fromOperatorNumeric(mOperatorNumeric);
            if (mccMnc != null) {
                countryIso = MccTable.countryCodeForMcc(mccMnc.mcc);
                countryIso = MccTable.geoCountryCodeForMccMnc(mccMnc);
                countryIsoDebugInfo = "OperatorNumeric(" + mOperatorNumeric
                        + "): MccTable.countryCodeForMcc(\"" + mccMnc.mcc + "\")";
                timeZoneCountryIso = MccTable.geoCountryCodeForMccMnc(mccMnc);
                timeZoneCountryIsoDebugInfo =
                        "OperatorNumeric: MccTable.geoCountryCodeForMccMnc(" + mccMnc + ")";
                        + "): MccTable.geoCountryCodeForMccMnc(\"" + mccMnc + "\")";
            } else {
                loge("updateLocale: Can't get country from operator numeric. mOperatorNumeric = "
                        + mOperatorNumeric);
@@ -509,15 +501,19 @@ public class LocaleTracker extends Handler {
        // If for any reason we can't get country from operator numeric, try to get it from cell
        // info.
        if (TextUtils.isEmpty(countryIso)) {
            // Find the most prevalent MCC from surrounding cell towers.
            String mcc = getMccFromCellInfo();
            if (mcc != null) {
                countryIso = MccTable.countryCodeForMcc(mcc);
                countryIsoDebugInfo = "CellInfo: MccTable.countryCodeForMcc(\"" + mcc + "\")";

                // Some MCC+MNC combinations are known to be used in countries other than those
                // that the MCC alone would suggest. Do a second pass of nearby cells that match
                // the most frequently observed MCC to see if this could be one of those cases.
                MccMnc mccMnc = getMccMncFromCellInfo(mcc);
                if (mccMnc != null) {
                    timeZoneCountryIso = MccTable.geoCountryCodeForMccMnc(mccMnc);
                    timeZoneCountryIsoDebugInfo =
                    countryIso = MccTable.geoCountryCodeForMccMnc(mccMnc);
                    countryIsoDebugInfo =
                            "CellInfo: MccTable.geoCountryCodeForMccMnc(" + mccMnc + ")";
                }
            }
@@ -526,8 +522,6 @@ public class LocaleTracker extends Handler {
        if (mCountryOverride != null) {
            countryIso = mCountryOverride;
            countryIsoDebugInfo = "mCountryOverride = \"" + mCountryOverride + "\"";
            timeZoneCountryIso = countryIso;
            timeZoneCountryIsoDebugInfo = countryIsoDebugInfo;
        }

        if (!mPhone.isRadioOn()) {
@@ -569,6 +563,8 @@ public class LocaleTracker extends Handler {

        // Pass the geographical country information to the telephony time zone detection code.

        String timeZoneCountryIso = countryIso;
        String timeZoneCountryIsoDebugInfo = countryIsoDebugInfo;
        boolean isTestMcc = false;
        if (!TextUtils.isEmpty(mOperatorNumeric)) {
            // For a test cell (MCC 001), the NitzStateMachine requires handleCountryDetected("") in
@@ -579,11 +575,6 @@ public class LocaleTracker extends Handler {
                timeZoneCountryIsoDebugInfo = "Test cell: " + mOperatorNumeric;
            }
        }
        if (timeZoneCountryIso == null) {
            // After this timeZoneCountryIso may still be null.
            timeZoneCountryIso = countryIso;
            timeZoneCountryIsoDebugInfo = "Defaulted: " + countryIsoDebugInfo;
        }
        log("updateLocale: timeZoneCountryIso = " + timeZoneCountryIso
                + ", timeZoneCountryIsoDebugInfo = " + timeZoneCountryIsoDebugInfo);

+7 −5
Original line number Diff line number Diff line
@@ -760,6 +760,12 @@ public class MultiSimSettingController extends Handler {
            boolean voiceSelected, boolean smsSelected) {
        int dialogType = EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_NONE;

        // Do not show preference selection dialog during SuW as there is fullscreen activity to
        // choose preference.
        if (Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.DEVICE_PROVISIONED, 0) == 0) {
            return dialogType;
        }
        // If a primary subscription is removed and only one is left active, ask user
        // for preferred sub selection if any default setting is not set.
        // If another primary subscription is added or default data is not selected, ask
@@ -768,12 +774,8 @@ public class MultiSimSettingController extends Handler {
                && (!dataSelected || !smsSelected || !voiceSelected)) {
            dialogType = EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_ALL;
        } else if (mPrimarySubList.size() > 1 && (isUserVisibleChange(change)
                || (change == PRIMARY_SUB_INITIALIZED && !dataSelected
                && Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.DEVICE_PROVISIONED, 0) != 0))) {
                || (change == PRIMARY_SUB_INITIALIZED && !dataSelected))) {
            // If change is SWAPPED_IN_GROUP or MARKED_OPPT, don't ask user again.
            // In default DSDS devices, do not show data selection dialog during SuW as there is
            // fullscreen activity to choose data preference.
            dialogType = EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_DATA;
        }

+66 −45
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ import com.android.internal.telephony.data.AccessNetworksManager;
import com.android.internal.telephony.data.DataNetwork;
import com.android.internal.telephony.data.DataNetworkController.DataNetworkControllerCallback;
import com.android.internal.telephony.dataconnection.DataConnection;
import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.metrics.ServiceStateStats;
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
@@ -285,7 +286,6 @@ public class ServiceStateTracker extends Handler {
    // Timeout event used when delaying radio power off to wait for IMS deregistration to happen.
    private static final int EVENT_POWER_OFF_RADIO_IMS_DEREG_TIMEOUT   = 62;
    protected static final int EVENT_RESET_LAST_KNOWN_CELL_IDENTITY    = 63;
    private static final int EVENT_REGISTER_DATA_NETWORK_EXISTING_CHANGED = 64;
    // Telecom has un/registered a PhoneAccount that provides OTT voice calling capability, e.g.
    // wi-fi calling.
    protected static final int EVENT_TELECOM_VOICE_SERVICE_STATE_OVERRIDE_CHANGED = 65;
@@ -620,11 +620,11 @@ public class ServiceStateTracker extends Handler {
    private int mLastKnownAreaCode = CellInfo.UNAVAILABLE;

    /**
     * Indicating if there is any data network existing. This is used in airplane mode turning on
     * scenario, where service state tracker should wait all data disconnected before powering
     * down the modem.
     * Data network controller callback for all data disconnected. This is used when turning on
     * airplane mode, where service state tracker should wait for all data disconnected on all
     * subscriptions before powering down the modem.
     */
    private boolean mAnyDataExisting = false;
    private DataNetworkControllerCallback mDataDisconnectedCallback;

    public ServiceStateTracker(GsmCdmaPhone phone, CommandsInterface ci) {
        mNitzState = TelephonyComponentFactory.getInstance()
@@ -722,7 +722,15 @@ public class ServiceStateTracker extends Handler {
                CarrierServiceStateTracker.CARRIER_EVENT_IMS_CAPABILITIES_CHANGED, null);

        if (mPhone.isUsingNewDataStack()) {
            sendEmptyMessage(EVENT_REGISTER_DATA_NETWORK_EXISTING_CHANGED);
            mDataDisconnectedCallback = new DataNetworkControllerCallback(this::post) {
                @Override
                public void onAnyDataNetworkExistingChanged(boolean anyDataExisting) {
                    log("onAnyDataNetworkExistingChanged: anyDataExisting=" + anyDataExisting);
                    if (!anyDataExisting) {
                        sendEmptyMessage(EVENT_ALL_DATA_DISCONNECTED);
                    }
                }
            };
        }
    }

@@ -898,7 +906,7 @@ public class ServiceStateTracker extends Handler {
        if (nrs != null) {
            int rat = ServiceState.networkTypeToRilRadioTechnology(
                    nrs.getAccessNetworkTechnology());
            int drs = regCodeToServiceState(nrs.getRegistrationState());
            int drs = regCodeToServiceState(nrs.getInitialRegistrationState());
            return new Pair<>(drs, rat);
        }
        return null;
@@ -1471,30 +1479,26 @@ public class ServiceStateTracker extends Handler {
                }
                break;

            case EVENT_REGISTER_DATA_NETWORK_EXISTING_CHANGED: {
                mPhone.getDataNetworkController().registerDataNetworkControllerCallback(
                        new DataNetworkControllerCallback(this::post) {
                        @Override
                        public void onAnyDataNetworkExistingChanged(boolean anyDataExisting) {
                            if (mAnyDataExisting != anyDataExisting) {
                                mAnyDataExisting = anyDataExisting;
                                log("onAnyDataNetworkExistingChanged: anyDataExisting="
                                        + anyDataExisting);
                                if (!mAnyDataExisting) {
                                    sendEmptyMessage(EVENT_ALL_DATA_DISCONNECTED);
                                }
                            }
                        }
                        });
                break;
            }
            case EVENT_ALL_DATA_DISCONNECTED:
                if (mPhone.isUsingNewDataStack()) {
                    log("EVENT_ALL_DATA_DISCONNECTED");
                    if (mPendingRadioPowerOffAfterDataOff) {
                    if (!mPendingRadioPowerOffAfterDataOff) return;
                    boolean areAllDataDisconnectedOnAllPhones = true;
                    for (Phone phone : PhoneFactory.getPhones()) {
                        if (phone.getDataNetworkController().areAllDataDisconnected()) {
                            phone.getDataNetworkController()
                                    .unregisterDataNetworkControllerCallback(
                                            mDataDisconnectedCallback);
                        } else {
                            log("Still waiting for all data disconnected on phone: "
                                    + phone.getSubId());
                            areAllDataDisconnectedOnAllPhones = false;
                        }
                    }
                    if (areAllDataDisconnectedOnAllPhones) {
                        mPendingRadioPowerOffAfterDataOff = false;
                        removeMessages(EVENT_SET_RADIO_POWER_OFF);
                        if (DBG) log("EVENT_ALL_DATA_DISCONNECTED, turn radio off now.");
                        if (DBG) log("Data disconnected for all phones, turn radio off now.");
                        hangupAndPowerOff();
                    }
                    return;
@@ -1698,6 +1702,10 @@ public class ServiceStateTracker extends Handler {
                        TelephonyMetrics.getInstance().writeServiceStateChanged(
                                mPhone.getPhoneId(), mSS);
                        mPhone.getVoiceCallSessionStats().onServiceStateChanged(mSS);
                        ImsPhone imsPhone = (ImsPhone) mPhone.getImsPhone();
                        if (imsPhone != null) {
                            imsPhone.getImsStats().onServiceStateChanged(mSS);
                        }
                        mServiceStateStats.onServiceStateChanged(mSS);
                    }
                }
@@ -2195,14 +2203,14 @@ public class ServiceStateTracker extends Handler {
        if (wlanPsRegState != null
                && wlanPsRegState.getAccessNetworkTechnology()
                == TelephonyManager.NETWORK_TYPE_IWLAN
                && wlanPsRegState.getRegistrationState()
                && wlanPsRegState.getInitialRegistrationState()
                == NetworkRegistrationInfo.REGISTRATION_STATE_HOME
                && isIwlanPreferred) {
            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.getRegistrationState();
            int regState = wwanPsRegState.getInitialRegistrationState();
            serviceState.setDataRegState(regCodeToServiceState(regState));
        }
        if (DBG) {
@@ -2218,7 +2226,7 @@ public class ServiceStateTracker extends Handler {
                VoiceSpecificRegistrationInfo voiceSpecificStates =
                        networkRegState.getVoiceSpecificInfo();

                int registrationState = networkRegState.getRegistrationState();
                int registrationState = networkRegState.getInitialRegistrationState();
                int cssIndicator = voiceSpecificStates.cssSupported ? 1 : 0;
                int newVoiceRat = ServiceState.networkTypeToRilRadioTechnology(
                        networkRegState.getAccessNetworkTechnology());
@@ -2300,7 +2308,7 @@ public class ServiceStateTracker extends Handler {
                mNewSS.addNetworkRegistrationInfo(networkRegState);
                DataSpecificRegistrationInfo dataSpecificStates =
                        networkRegState.getDataSpecificInfo();
                int registrationState = networkRegState.getRegistrationState();
                int registrationState = networkRegState.getInitialRegistrationState();
                int serviceState = regCodeToServiceState(registrationState);
                int newDataRat = ServiceState.networkTypeToRilRadioTechnology(
                        networkRegState.getAccessNetworkTechnology());
@@ -3539,9 +3547,9 @@ public class ServiceStateTracker extends Handler {
                anyDataRatChanged = true;
            }

            int oldRegState = oldNrs != null ? oldNrs.getRegistrationState()
            int oldRegState = oldNrs != null ? oldNrs.getInitialRegistrationState()
                    : NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN;
            int newRegState = newNrs != null ? newNrs.getRegistrationState()
            int newRegState = newNrs != null ? newNrs.getInitialRegistrationState()
                    : NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN;
            hasDataRegStateChanged.put(transport, oldRegState != newRegState);
            if (oldRegState != newRegState) {
@@ -3817,6 +3825,10 @@ public class ServiceStateTracker extends Handler {

            TelephonyMetrics.getInstance().writeServiceStateChanged(mPhone.getPhoneId(), mSS);
            mPhone.getVoiceCallSessionStats().onServiceStateChanged(mSS);
            ImsPhone imsPhone = (ImsPhone) mPhone.getImsPhone();
            if (imsPhone != null) {
                imsPhone.getImsStats().onServiceStateChanged(mSS);
            }
            mServiceStateStats.onServiceStateChanged(mSS);
        }

@@ -4253,7 +4265,7 @@ public class ServiceStateTracker extends Handler {
    }

    /**
     * Do not set roaming state in case of oprators considered non-roaming.
     * Do not set roaming state in case of operators considered non-roaming.
     *
     * Can use mcc or mcc+mnc as item of
     * {@link CarrierConfigManager#KEY_NON_ROAMING_OPERATOR_STRING_ARRAY}.
@@ -5010,17 +5022,27 @@ public class ServiceStateTracker extends Handler {
        synchronized (this) {
            if (!mPendingRadioPowerOffAfterDataOff) {
                if (mPhone.isUsingNewDataStack()) {
                    if (mAnyDataExisting) {
                        log("powerOffRadioSafely: Tear down all data networks.");
                    for (Phone phone : PhoneFactory.getPhones()) {
                        if (!phone.getDataNetworkController().areAllDataDisconnected()) {
                            log("powerOffRadioSafely: Data is active on phone " + phone.getSubId()
                                    + ". Wait for all data disconnect.");
                            mPendingRadioPowerOffAfterDataOff = true;
                            phone.getDataNetworkController().registerDataNetworkControllerCallback(
                                    mDataDisconnectedCallback);
                        }
                    }

                    // Tear down outside of the disconnected check to prevent race conditions.
                    mPhone.getDataNetworkController().tearDownAllDataNetworks(
                            DataNetwork.TEAR_DOWN_REASON_AIRPLANE_MODE_ON);

                    if (mPendingRadioPowerOffAfterDataOff) {
                        sendEmptyMessageDelayed(EVENT_SET_RADIO_POWER_OFF,
                                POWER_OFF_ALL_DATA_NETWORKS_DISCONNECTED_TIMEOUT);
                    } else {
                        log("powerOffRadioSafely: No data is connected.");
                        sendEmptyMessage(EVENT_ALL_DATA_DISCONNECTED);
                        log("powerOffRadioSafely: No data is connected, turn off radio now.");
                        hangupAndPowerOff();
                    }
                    mPendingRadioPowerOffAfterDataOff = true;
                    return;
                }
                int dds = SubscriptionManager.getDefaultDataSubscriptionId();
@@ -5072,8 +5094,8 @@ public class ServiceStateTracker extends Handler {
                    msg.arg1 = ++mPendingRadioPowerOffAfterDataOffTag;
                    if (sendMessageDelayed(msg, 30000)) {
                        if (DBG) {
                            log("powerOffRadioSafely: Wait up to 30s for data to isconnect, then"
                                    + " turn off radio.");
                            log("powerOffRadioSafely: Wait up to 30s for data to disconnect, "
                                    + "then turn off radio.");
                        }
                        mPendingRadioPowerOffAfterDataOff = true;
                    } else {
@@ -5337,7 +5359,6 @@ public class ServiceStateTracker extends Handler {
        dumpCellInfoList(pw);
        pw.flush();
        pw.println(" mAllowedNetworkTypes=" + mAllowedNetworkTypes);
        pw.println(" mAnyDataExisting=" + mAnyDataExisting);
        pw.println(" mMaxDataCalls=" + mMaxDataCalls);
        pw.println(" mNewMaxDataCalls=" + mNewMaxDataCalls);
        pw.println(" mReasonDataDenied=" + mReasonDataDenied);
@@ -5672,7 +5693,7 @@ public class ServiceStateTracker extends Handler {
                NetworkRegistrationInfo wlanNri = new NetworkRegistrationInfo.Builder()
                        .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WLAN)
                        .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
                        .setRegistrationState(wwanNri.getRegistrationState())
                        .setRegistrationState(wwanNri.getInitialRegistrationState())
                        .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_IWLAN)
                        .setRejectCause(wwanNri.getRejectCause())
                        .setEmergencyOnly(wwanNri.isEmergencyEnabled())
+5 −1
Original line number Diff line number Diff line
@@ -106,7 +106,11 @@ public class SlidingWindowEventCounter {
     * @return A string describing the anomaly event
     */
    public @NonNull String getFrequencyString() {
        return String.format("%d times within %d ms.", mNumOccurrences, mWindowSizeMillis);
        if (mWindowSizeMillis >= 1000L) {
            return mNumOccurrences + " times within " + mWindowSizeMillis / 1000L + " seconds";
        } else {
            return mNumOccurrences + " times within " + mWindowSizeMillis + "ms";
        }
    }

    @Override
Loading