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

Commit 83c2ecbd authored by arunvoddu's avatar arunvoddu
Browse files

Fetches sim service table from the EF_SST elementary file of the sim

Bug: 217794026
Test: Atest Verification completed
Change-Id: I2445a8a419cc5abf9c602e1cd25536cc681604a6
parent 98b28f19
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.telephony.TelephonyFrameworkInitializer;
import android.util.EventLog;

import com.android.internal.telephony.uicc.IsimRecords;
import com.android.internal.telephony.uicc.SIMRecords;
import com.android.internal.telephony.uicc.UiccCardApplication;
import com.android.internal.telephony.uicc.UiccPort;
import com.android.telephony.Rlog;
@@ -418,6 +419,29 @@ public class PhoneSubInfoController extends IPhoneSubInfo.Stub {
                });
    }

    /**
     * Returns the USIM service table that fetched from EFUST elementary field that are loaded
     * based on the appType.
     */
    public String getSimServiceTable(int subId, int appType) throws RemoteException {
        return callPhoneMethodForSubIdWithPrivilegedCheck(subId, "getSimServiceTable",
                (phone) -> {
                    UiccPort uiccPort = phone.getUiccPort();
                    if (uiccPort == null || uiccPort.getUiccProfile() == null) {
                        loge("getSimServiceTable(): uiccPort or uiccProfile is null");
                        return null;
                    }
                    UiccCardApplication uiccApp = uiccPort.getUiccProfile().getApplicationByType(
                            appType);
                    if (uiccApp == null) {
                        loge("getSimServiceTable(): no app with specified apptype="
                                + appType);
                        return null;
                    }
                    return ((SIMRecords)uiccApp.getIccRecords()).getSimServiceTable();
                });
    }

    @Override
    public String getIccSimChallengeResponse(int subId, int appType, int authType, String data,
            String callingPackage, String callingFeatureId) throws RemoteException {
+56 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.internal.telephony.uicc;

public final class IsimServiceTable extends IccServiceTable {
    private static final String TAG = "IsimServiceTable";
    public enum IsimService {
        PCSCF_ADDRESS,
        GBA,                                // Generic Bootstrapping Architecture (GBA)
        HTTP_DIGEST,
        GBA_LOCALKEY_ESTABLISHMENT,         // GBA-based Local Key Establishment Mechanism
        PCSCF_DISCOVERY_FOR_IMS,            // Support of P-CSCF discovery for IMS Local Break Out
        SMS,
        SMSR,                               // Short Message Status Reports
        SM_OVERIP_AND_DATA_DL_VIA_SMS_PP,   // Support for SM-over-IP including data download via
        // SMS-PP
        COMMUNICATION_CONTROL_FOR_IMS_BY_ISIM,
        UICC_ACCESS_TO_IMS
    }

    public IsimServiceTable(byte[] table) {
        super(table);
    }

    public boolean isAvailable(IsimService service) {
        return super.isAvailable(service.ordinal());
    }

    @Override
    protected String getTag() {
        return TAG;
    }

    @Override
    protected Object[] getValues() {
        return IsimService.values();
    }

    public byte[] getISIMServiceTable() {
        return mServiceTable;
    }
}
+14 −1
Original line number Diff line number Diff line
@@ -225,6 +225,11 @@ public class IsimUiccRecords extends IccRecords implements IsimRecords {
        }
    }

    @VisibleForTesting
    public EfIsimIstLoaded getIsimIstObject() {
        return new EfIsimIstLoaded();
    }

    private class EfIsimSmssLoaded implements IccRecords.IccRecordLoaded {

        @Override
@@ -484,11 +489,11 @@ public class IsimUiccRecords extends IccRecords implements IsimRecords {
        pw.println("IsimRecords: " + this);
        pw.println(" extends:");
        super.dump(fd, pw, args);
        pw.println(" mIsimServiceTable=" + getIsimServiceTable());
        if (DUMP_RECORDS) {
            pw.println(" mIsimImpi=" + mIsimImpi);
            pw.println(" mIsimDomain=" + mIsimDomain);
            pw.println(" mIsimImpu[]=" + Arrays.toString(mIsimImpu));
            pw.println(" mIsimIst" + mIsimIst);
            pw.println(" mIsimPcscf" + mIsimPcscf);
            pw.println(" mPsismsc=" + mPsiSmsc);
            pw.println(" mSmss TPMR=" + getSmssTpmrValue());
@@ -496,6 +501,14 @@ public class IsimUiccRecords extends IccRecords implements IsimRecords {
        pw.flush();
    }

    // Just to return the Enums of service table to print in DUMP
    private IsimServiceTable getIsimServiceTable() {
        if (mIsimIst != null) {
            byte[] istTable = IccUtils.hexStringToBytes(mIsimIst);
            return new IsimServiceTable(istTable);
        }
        return null;
    }
    @Override
    public int getVoiceMessageCount() {
        return 0; // Not applicable to Isim
+13 −1
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ public class SIMRecords extends IccRecords {
    private static final int EVENT_UPDATE_DONE = 14 + SIM_RECORD_EVENT_BASE;
    protected static final int EVENT_GET_PNN_DONE = 15 + SIM_RECORD_EVENT_BASE;
    protected static final int EVENT_GET_OPL_DONE = 16 + SIM_RECORD_EVENT_BASE;
    private static final int EVENT_GET_SST_DONE = 17 + SIM_RECORD_EVENT_BASE;
    protected static final int EVENT_GET_SST_DONE = 17 + SIM_RECORD_EVENT_BASE;
    private static final int EVENT_GET_ALL_SMS_DONE = 18 + SIM_RECORD_EVENT_BASE;
    private static final int EVENT_MARK_SMS_READ_DONE = 19 + SIM_RECORD_EVENT_BASE;
    private static final int EVENT_SET_MBDN_DONE = 20 + SIM_RECORD_EVENT_BASE;
@@ -279,6 +279,18 @@ public class SIMRecords extends IccRecords {
        return mUsimServiceTable;
    }

    /**
     * Fetches the USIM service table from UsimServiceTable
     *
     * @return HexString representation of USIM service table
     */
    public String getSimServiceTable() {
        if (mUsimServiceTable != null) {
            return IccUtils.bytesToHexString(mUsimServiceTable.getUSIMServiceTable());
        }
        return null;
    }

    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    private int getExtFromEf(int ef) {
        int ext;
+4 −0
Original line number Diff line number Diff line
@@ -157,4 +157,8 @@ public final class UsimServiceTable extends IccServiceTable {
    protected Object[] getValues() {
        return UsimService.values();
    }

    public byte[] getUSIMServiceTable() {
        return mServiceTable;
    }
}
Loading