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

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

Snap for 11336776 from 3cb9b30c to 24Q2-release

Change-Id: Icb942cb1bb7bdf6c2f93eac32ceca230cde3f3de
parents 4ca41243 3cb9b30c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -31,6 +31,13 @@ flag {
flag {
  name: "enable_modem_cipher_transparency"
  namespace: "telephony"
  description: "Guards APIs for enabling and disabling modem cipher transparency."
  bug: "283336425"
}

flag {
  name: "enable_modem_cipher_transparency_unsol_events"
  namespace: "telephony"
  description: "Allows the framework to register for SecurityAlgorithmChanged events and emit notifications to the user when a device is using null ciphers."
  bug: "283336425"
}
+8 −1
Original line number Diff line number Diff line
@@ -15,6 +15,13 @@ flag {
flag {
    name: "carrier_restriction_status"
    namespace: "telephony"
    description: "This flag control the visibility of the getCarrierRestrictionStatus in carrierRestrictionRules class."
    description: "This flag controls the visibility of the getCarrierRestrictionStatus in carrierRestrictionRules class."
    bug:"313553044"
}

flag {
    name: "carrier_restriction_rules_enhancement"
    namespace: "telephony"
    description: "This flag controls the new enhancements to the existing carrier restrictions rules"
    bug:"317226653"
}
 No newline at end of file
+18 −7
Original line number Diff line number Diff line
@@ -538,9 +538,11 @@ public class GsmCdmaPhone extends Phone {
                    this, EVENT_CELL_IDENTIFIER_DISCLOSURE, null);
        }

        if (mFeatureFlags.enableModemCipherTransparency()) {
            logi("enable_modem_cipher_transparency is on. Registering for security algorithm "
                    + "updates from phone " + getPhoneId());
        if (mFeatureFlags.enableModemCipherTransparencyUnsolEvents()) {
            logi(
                    "enable_modem_cipher_transparency_unsol_events is on. Registering for security "
                            + "algorithm updates from phone "
                            + getPhoneId());
            mNullCipherNotifier =
                    mTelephonyComponentFactory
                            .inject(NullCipherNotifier.class.getName())
@@ -3720,7 +3722,8 @@ public class GsmCdmaPhone extends Phone {

            case EVENT_SECURITY_ALGORITHM_UPDATE:
                logd("EVENT_SECURITY_ALGORITHM_UPDATE phoneId = " + getPhoneId());
                if (mFeatureFlags.enableModemCipherTransparency() && mNullCipherNotifier != null) {
                if (mFeatureFlags.enableModemCipherTransparencyUnsolEvents()
                        && mNullCipherNotifier != null) {
                    ar = (AsyncResult) msg.obj;
                    SecurityAlgorithmUpdate update = (SecurityAlgorithmUpdate) ar.result;
                    mNullCipherNotifier.onSecurityAlgorithmUpdate(getPhoneId(), update);
@@ -5373,11 +5376,19 @@ public class GsmCdmaPhone extends Phone {
        }
        boolean prefEnabled = getNullCipherNotificationsPreferenceEnabled();

        // The notifier is tied to handling unsolicited updates from the modem, not the
        // enable/disable API.
        if (mFeatureFlags.enableModemCipherTransparencyUnsolEvents()) {
            if (prefEnabled) {
                mNullCipherNotifier.enable();
            } else {
                mNullCipherNotifier.disable();
            }
        } else {
            logi(
                    "Not toggling enable state for cipher notifier. Feature flag "
                            + "enable_modem_cipher_transparency_unsol_events is disabled.");
        }

        mCi.setSecurityAlgorithmsUpdatedEnabled(prefEnabled,
                obtainMessage(EVENT_SET_SECURITY_ALGORITHMS_UPDATED_ENABLED_DONE));
+83 −0
Original line number Diff line number Diff line
@@ -305,6 +305,7 @@ import android.net.LinkAddress;
import android.net.LinkProperties;
import android.os.SystemClock;
import android.service.carrier.CarrierIdentifier;
import android.telephony.CarrierInfo;
import android.telephony.AccessNetworkConstants;
import android.telephony.Annotation;
import android.telephony.BarringInfo;
@@ -4039,6 +4040,9 @@ public class RILUtils {
    public static List<CarrierIdentifier> convertHalCarrierList(
            android.hardware.radio.sim.Carrier[] carrierList) {
        List<CarrierIdentifier> ret = new ArrayList<>();
        if (carrierList == null) {
            return ret;
        }
        for (int i = 0; i < carrierList.length; i++) {
            String mcc = carrierList[i].mcc;
            String mnc = carrierList[i].mnc;
@@ -4059,6 +4063,85 @@ public class RILUtils {
        return ret;
    }

    /**
     * Convert an array of CarrierInfo defined in
     * radio/aidl/android/hardware/radio/sim/CarrierInfo.aidl to a list of CarrierInfo
     * defined in android/service/carrier/CarrierInfo.java
     *
     * @param carrierInfos array of CarrierInfo defined in
     *                     radio/aidl/android/hardware/radio/sim/CarrierInfo.aidl
     * @return The converted list of CarrierInfo
     */
    public static List<CarrierInfo> convertAidlCarrierInfoList(
            android.hardware.radio.sim.CarrierInfo[] carrierInfos) {
        List<CarrierInfo> carrierInfoList = new ArrayList<>();
        if (carrierInfos == null) {
            loge("convertAidlCarrierInfoList received NULL carrierInfos");
            return carrierInfoList;
        }
        for (int index = 0; index < carrierInfos.length; index++) {
            String mcc = carrierInfos[index].mcc;
            String mnc = carrierInfos[index].mnc;
            String spn = carrierInfos[index].spn;
            String gid1 = carrierInfos[index].gid1;
            String gid2 = carrierInfos[index].gid2;
            String imsi = carrierInfos[index].imsiPrefix;
            String iccid = carrierInfos[index].iccid;
            String impi = carrierInfos[index].impi;
            List<android.hardware.radio.sim.Plmn> halEhplmn = carrierInfos[index].ehplmn;
            List<String> eHplmnList = new ArrayList<>();
            if (halEhplmn != null) {
                for (int plmnIndex = 0; plmnIndex < halEhplmn.size(); plmnIndex++) {
                    String ehplmnMcc = halEhplmn.get(plmnIndex).mcc;
                    String ehplmnMnc = halEhplmn.get(plmnIndex).mnc;
                    eHplmnList.add(ehplmnMcc + "," + ehplmnMnc);
                }
            } else {
                loge("convertAidlCarrierInfoList ehplmList is NULL");
            }
            CarrierInfo carrierInfo = new CarrierInfo(mcc, mnc, spn, gid1, gid2, imsi, iccid, impi,
                    eHplmnList);
            carrierInfoList.add(carrierInfo);
        }
        return carrierInfoList;
    }

    /**
     * Convert the sim policy defined in
     * radio/aidl/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl to the equivalent sim
     * policy defined in android.telephony/CarrierRestrictionRules.MultiSimPolicy
     *
     * @param multiSimPolicy of type defined in SimLockMultiSimPolicy.aidl
     * @return int of type CarrierRestrictionRules.MultiSimPolicy
     */
    public static @CarrierRestrictionRules.MultiSimPolicy int convertAidlSimLockMultiSimPolicy(
            int multiSimPolicy) {
        switch (multiSimPolicy) {
            case android.hardware.radio.sim.SimLockMultiSimPolicy.ONE_VALID_SIM_MUST_BE_PRESENT:
                return CarrierRestrictionRules.MULTISIM_POLICY_ONE_VALID_SIM_MUST_BE_PRESENT;
            case android.hardware.radio.sim.SimLockMultiSimPolicy.APPLY_TO_ALL_SLOTS:
                return CarrierRestrictionRules.MULTISIM_POLICY_APPLY_TO_ALL_SLOTS;
            case android.hardware.radio.sim.SimLockMultiSimPolicy.APPLY_TO_ONLY_SLOT_1:
                return CarrierRestrictionRules.MULTISIM_POLICY_APPLY_TO_ONLY_SLOT_1;
            case android.hardware.radio.sim.SimLockMultiSimPolicy.VALID_SIM_MUST_PRESENT_ON_SLOT_1:
                return CarrierRestrictionRules.MULTISIM_POLICY_VALID_SIM_MUST_PRESENT_ON_SLOT_1;
            case android.hardware.radio.sim.SimLockMultiSimPolicy.
                    ACTIVE_SERVICE_ON_SLOT_1_TO_UNBLOCK_OTHER_SLOTS:
                return CarrierRestrictionRules.
                        MULTISIM_POLICY_ACTIVE_SERVICE_ON_SLOT_1_TO_UNBLOCK_OTHER_SLOTS;
            case android.hardware.radio.sim.SimLockMultiSimPolicy.
                    ACTIVE_SERVICE_ON_ANY_SLOT_TO_UNBLOCK_OTHER_SLOTS:
                return CarrierRestrictionRules.
                        MULTISIM_POLICY_ACTIVE_SERVICE_ON_ANY_SLOT_TO_UNBLOCK_OTHER_SLOTS;
            case android.hardware.radio.sim.SimLockMultiSimPolicy.ALL_SIMS_MUST_BE_VALID:
                return CarrierRestrictionRules.MULTISIM_POLICY_ALL_SIMS_MUST_BE_VALID;
            case android.hardware.radio.sim.SimLockMultiSimPolicy.SLOT_POLICY_OTHER:
                return CarrierRestrictionRules.MULTISIM_POLICY_SLOT_POLICY_OTHER;
            default:
                return CarrierRestrictionRules.MULTISIM_POLICY_NONE;
        }
    }

    /**
     * Convert CardStatus defined in radio/1.0, 1.5/types.hal to IccCardStatus
     * @param cardStatus CardStatus defined in radio/1.0, 1.5/types.hal
+12 −17
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static android.telephony.TelephonyManager.HAL_SERVICE_SIM;

import android.hardware.radio.RadioError;
import android.hardware.radio.RadioResponseInfo;
import android.hardware.radio.sim.CarrierRestrictions;
import android.hardware.radio.sim.IRadioSimResponse;
import android.telephony.CarrierRestrictionRules;
import android.telephony.TelephonyManager;
@@ -116,28 +115,24 @@ public class SimResponse extends IRadioSimResponse.Stub {
        if (rr == null) {
            return;
        }
        CarrierRestrictionRules ret;
        int policy = CarrierRestrictionRules.MULTISIM_POLICY_NONE;
        if (multiSimPolicy
                == android.hardware.radio.sim.SimLockMultiSimPolicy.ONE_VALID_SIM_MUST_BE_PRESENT) {
            policy = CarrierRestrictionRules.MULTISIM_POLICY_ONE_VALID_SIM_MUST_BE_PRESENT;
        }

        int policy = RILUtils.convertAidlSimLockMultiSimPolicy(multiSimPolicy);
        int carrierRestrictionDefault =
                CarrierRestrictionRules.CARRIER_RESTRICTION_DEFAULT_NOT_ALLOWED;
        if (!carrierRestrictions.allowedCarriersPrioritized) {
            carrierRestrictionDefault = CarrierRestrictionRules.CARRIER_RESTRICTION_DEFAULT_ALLOWED;
        }
        ret = CarrierRestrictionRules.newBuilder()
                .setAllowedCarriers(RILUtils.convertHalCarrierList(
                        carrierRestrictions.allowedCarriers))
                .setExcludedCarriers(RILUtils.convertHalCarrierList(
                        carrierRestrictions.excludedCarriers))
                .setDefaultCarrierRestriction(carrierRestrictionDefault)
                .setMultiSimPolicy(policy)
                .setCarrierRestrictionStatus(carrierRestrictions.status)
                .build();

        CarrierRestrictionRules ret = CarrierRestrictionRules.newBuilder().setAllowedCarriers(
                RILUtils.convertHalCarrierList(
                        carrierRestrictions.allowedCarriers)).setExcludedCarriers(
                RILUtils.convertHalCarrierList(
                        carrierRestrictions.excludedCarriers)).setDefaultCarrierRestriction(
                carrierRestrictionDefault).setMultiSimPolicy(policy).setCarrierRestrictionStatus(
                carrierRestrictions.status).setAllowedCarrierInfo(
                RILUtils.convertAidlCarrierInfoList(
                        carrierRestrictions.allowedCarrierInfoList)).setExcludedCarrierInfo(
                RILUtils.convertAidlCarrierInfoList(
                        carrierRestrictions.excludedCarrierInfoList)).build();
        if (responseInfo.error == RadioError.NONE) {
            RadioResponse.sendMessageResponse(rr.mResult, ret);
        }
Loading