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

Commit 852dc446 authored by Jordan Liu's avatar Jordan Liu
Browse files

Use subid in deleteCarrierInfoForImsiEncryption

Bug: 183015820
Test: manual
Change-Id: Iec03ca2da6f8814d3cc3036c9daed5f066297383
(cherry picked from commit 69610ab4)
parent 2551aaed
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -254,7 +254,13 @@ public class CarrierInfoManager {
            return;
        }
        mLastAccessResetCarrierKey = now;
        deleteCarrierInfoForImsiEncryption(context);
        int[] subIds = context.getSystemService(SubscriptionManager.class)
                .getSubscriptionIds(mPhoneId);
        if (subIds == null || subIds.length < 1) {
            Log.e(LOG_TAG, "Could not reset carrier keys, subscription for mPhoneId=" + mPhoneId);
            return;
        }
        deleteCarrierInfoForImsiEncryption(context, subIds[0]);
        Intent resetIntent = new Intent(TelephonyIntents.ACTION_CARRIER_CERTIFICATE_DOWNLOAD);
        SubscriptionManager.putPhoneIdAndSubIdExtra(resetIntent, mPhoneId);
        context.sendBroadcastAsUser(resetIntent, UserHandle.ALL);
@@ -264,12 +270,12 @@ public class CarrierInfoManager {
     * Deletes all the keys for a given Carrier from the device keystore.
     * @param context Context
     */
    public static void deleteCarrierInfoForImsiEncryption(Context context) {
        Log.i(LOG_TAG, "deleting carrier key from db");
    public static void deleteCarrierInfoForImsiEncryption(Context context, int subId) {
        Log.i(LOG_TAG, "deleting carrier key from db for subId=" + subId);
        String mcc = "";
        String mnc = "";
        final TelephonyManager telephonyManager =
                (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class)
                .createForSubscriptionId(subId);
        String simOperator = telephonyManager.getSimOperator();
        if (!TextUtils.isEmpty(simOperator)) {
            mcc = simOperator.substring(0, 3);
+1 −1
Original line number Diff line number Diff line
@@ -1889,7 +1889,7 @@ public class GsmCdmaPhone extends Phone {

    @Override
    public void deleteCarrierInfoForImsiEncryption() {
        CarrierInfoManager.deleteCarrierInfoForImsiEncryption(mContext);
        CarrierInfoManager.deleteCarrierInfoForImsiEncryption(mContext, getSubId());
    }

    @Override