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

Commit 3c5232c2 authored by TAKAHASHI Uichiro's avatar TAKAHASHI Uichiro Committed by arunvoddu
Browse files

Introduced forceResetCarrierKeysForImsiEncryption TestAPI to delete Imsi Certificate.

CTS test case required to delete the IMSI certificate multiple times, where as
Framework allows to delete it only once in 12 Hours.
This API will delete the IMSI certificate with out any condition check.

Bug: 235296888
Test: cts-tradefed run cts -m CtsTelephonyTestCases
-t android.telephony.cts.TelephonyManagerTest

Flag: com.android.internal.telephony.flags.force_imsi_certificate_delete

Change-Id: I3bfb6b322388c4f39e3370c6c1e1792dfe48ded4
parent a8c92455
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -96,3 +96,14 @@ flag {
    description: "This flag controls to get a carrier id using a carrier identifier."
    bug:"378778278"
}

# OWNER=arunvoddu TARGET=25Q2
flag {
    name: "force_imsi_certificate_delete"
    namespace: "telephony"
    description: "This flag controls the IMSI certificate delete with out any condition."
    bug:"235296888"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
+14 −10
Original line number Diff line number Diff line
@@ -275,19 +275,23 @@ public class CarrierInfoManager {
     * Resets the Carrier Keys in the database. This involves 2 steps:
     * 1. Delete the keys from the database.
     * 2. Send an intent to download new Certificates.
     *
     * @param context       Context
     * @param mPhoneId      phoneId
     *
     * @param forceResetAll to skip the check of the RESET_CARRIER_KEY_RATE_LIMIT.
     */
    public void resetCarrierKeysForImsiEncryption(Context context, int mPhoneId) {
        Log.i(LOG_TAG, "resetting carrier key");
    public void resetCarrierKeysForImsiEncryption(Context context, int mPhoneId,
            boolean forceResetAll) {
        Log.i(LOG_TAG, "resetting carrier key, forceResetAll = " +forceResetAll);
        // Check rate limit.
        long now = System.currentTimeMillis();
        if (!forceResetAll) {
            if (now - mLastAccessResetCarrierKey < RESET_CARRIER_KEY_RATE_LIMIT) {
                Log.i(LOG_TAG, "resetCarrierKeysForImsiEncryption: Access rate exceeded");
                return;
            }
            mLastAccessResetCarrierKey = now;
        }

        int subId = SubscriptionManager.getSubscriptionId(mPhoneId);
        if (!SubscriptionManager.isValidSubscriptionId(subId)) {
+6 −1
Original line number Diff line number Diff line
@@ -2189,7 +2189,12 @@ public class GsmCdmaPhone extends Phone {

    @Override
    public void resetCarrierKeysForImsiEncryption() {
        mCIM.resetCarrierKeysForImsiEncryption(mContext, mPhoneId);
        mCIM.resetCarrierKeysForImsiEncryption(mContext, mPhoneId, false);
    }

    @Override
    public void resetCarrierKeysForImsiEncryption(boolean forceResetAll) {
        mCIM.resetCarrierKeysForImsiEncryption(mContext, mPhoneId, forceResetAll);
    }

    @Override
+10 −0
Original line number Diff line number Diff line
@@ -4075,6 +4075,16 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        return;
    }

    /**
     * Resets the Carrier Keys in the database. This involves 2 steps:
     * 1. Delete the keys from the database.
     * 2. Send an intent to download new Certificates.
     *
     * @param forceResetAll : Force delete the downloaded key if any.
     */
    public void resetCarrierKeysForImsiEncryption(boolean forceResetAll) {
    }

    /**
     * Return if UT capability of ImsPhone is enabled or not
     */