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

Commit 7d81e6f8 authored by Arun kumar Voddu's avatar Arun kumar Voddu Committed by Android (Google) Code Review
Browse files

Merge "PrimaryImei framework changes"

parents a5bc97e3 10067d3b
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1790,6 +1790,17 @@ public interface CommandsInterface {
     */
    public void getDeviceIdentity(Message response);

    /**
     * Request the device IMEI / IMEI type / IMEISV
     * "response" is ImeiInfo object that contains
     *  [0] ImeiType Indicates whether IMEI is of primary or secondary type
     *  [1] IMEI if GSM subscription is available
     *  [2] IMEISV if GSM subscription is available
     *
     * @param response Message
     */
    public void getImei(Message response);

    /**
     * Request the device MDN / H_SID / H_NID / MIN.
     * "response" is const char **
+27 −6
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.database.SQLException;
import android.hardware.radio.modem.ImeiInfo;
import android.net.Uri;
import android.os.AsyncResult;
import android.os.Build;
@@ -232,12 +233,11 @@ public class GsmCdmaPhone extends Phone {

    private final RegistrantList mVolteSilentRedialRegistrants = new RegistrantList();
    private DialArgs mDialArgs = null;

    private final RegistrantList mEmergencyDomainSelectedRegistrants = new RegistrantList();

    private String mImei;
    private String mImeiSv;
    private String mVmNumber;
    private int mImeiType = IMEI_TYPE_UNKNOWN;

    CellBroadcastConfigTracker mCellBroadcastConfigTracker =
            CellBroadcastConfigTracker.make(this, null);
@@ -1908,6 +1908,11 @@ public class GsmCdmaPhone extends Phone {
        return mImei;
    }

    @Override
    public int getImeiType() {
        return mImeiType;
    }

    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @Override
    public String getEsn() {
@@ -2957,7 +2962,7 @@ public class GsmCdmaPhone extends Phone {

    private void handleRadioAvailable() {
        mCi.getBasebandVersion(obtainMessage(EVENT_GET_BASEBAND_VERSION_DONE));

        mCi.getImei(obtainMessage(EVENT_GET_DEVICE_IMEI_DONE));
        mCi.getDeviceIdentity(obtainMessage(EVENT_GET_DEVICE_IDENTITY_DONE));
        mCi.getRadioCapability(obtainMessage(EVENT_GET_RADIO_CAPABILITY));
        mCi.areUiccApplicationsEnabled(obtainMessage(EVENT_GET_UICC_APPS_ENABLEMENT_DONE));
@@ -3008,7 +3013,21 @@ public class GsmCdmaPhone extends Phone {
                handleRadioAvailable();
            }
            break;

            case EVENT_GET_DEVICE_IMEI_DONE :
                ar = (AsyncResult)msg.obj;
                if (ar.exception != null || ar.result == null) {
                    loge("Exception received : " + ar.exception);
                    break;
                }
                ImeiInfo imeiInfo = (ImeiInfo) ar.result;
                if (!TextUtils.isEmpty(imeiInfo.imei)) {
                    mImeiType = imeiInfo.type;
                    mImei = imeiInfo.imei;
                    mImeiSv = imeiInfo.svn;
                } else {
                    // TODO Report telephony anomaly
                }
                break;
            case EVENT_GET_DEVICE_IDENTITY_DONE:{
                ar = (AsyncResult)msg.obj;

@@ -3016,8 +3035,10 @@ public class GsmCdmaPhone extends Phone {
                    break;
                }
                String[] respId = (String[])ar.result;
                if (TextUtils.isEmpty(mImei)) {
                    mImei = respId[0];
                    mImeiSv = respId[1];
                }
                mEsn  =  respId[2];
                mMeid =  respId[3];
                // some modems return all 0's instead of null/empty string when MEID is unavailable
+9 −3
Original line number Diff line number Diff line
@@ -79,13 +79,19 @@ public class ModemResponse extends IRadioModemResponse.Stub {
    }

    /**
     *
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param imeiInfo imeiInfo object containing ImeiType, device IMEI and IMEISV
     * @param imeiInfo object containing ImeiType, device IMEI and IMEISV
     */
    public void getImeiResponse(RadioResponseInfo responseInfo, ImeiInfo imeiInfo) {
        // TODO as part of the framework coding
        RILRequest rr = mRil.processResponse(HAL_SERVICE_MODEM, responseInfo);
        if (rr != null) {
            if (responseInfo.error == RadioError.NONE) {
                RadioResponse.sendMessageResponse(rr.mResult, imeiInfo);
            }
            mRil.processResponseDone(rr, responseInfo, imeiInfo);
        }
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param config Array of HardwareConfig of the radio
+8 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.hardware.radio.modem.ImeiInfo;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.AsyncResult;
@@ -243,8 +244,9 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    protected static final int EVENT_SET_USAGE_SETTING_DONE = 64;
    protected static final int EVENT_IMS_DEREGISTRATION_TRIGGERED = 65;
    protected static final int EVENT_SET_NULL_CIPHER_AND_INTEGRITY_DONE = 66;
    protected static final int EVENT_GET_DEVICE_IMEI_DONE = 67;

    protected static final int EVENT_LAST = EVENT_SET_NULL_CIPHER_AND_INTEGRITY_DONE;
    protected static final int EVENT_LAST = EVENT_GET_DEVICE_IMEI_DONE;

    // For shared prefs.
    private static final String GSM_ROAMING_LIST_OVERRIDE_PREFIX = "gsm_roaming_list_";
@@ -480,6 +482,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {

    protected LinkBandwidthEstimator mLinkBandwidthEstimator;

    public static final int IMEI_TYPE_UNKNOWN = -1;
    public static final int IMEI_TYPE_PRIMARY = ImeiInfo.ImeiType.PRIMARY;
    public static final int IMEI_TYPE_SECONDARY = ImeiInfo.ImeiType.SECONDARY;

    public IccRecords getIccRecords() {
        return mIccRecords.get();
    }
@@ -4381,6 +4387,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        // When radio capability switch is done, query IMEI value and update it in Phone objects
        // to make it in sync with the IMEI value currently used by Logical-Modem.
        if (capabilitySwitched) {
            mCi.getImei(obtainMessage(EVENT_GET_DEVICE_IMEI_DONE));
            mCi.getDeviceIdentity(obtainMessage(EVENT_GET_DEVICE_IDENTITY_DONE));
        }
    }
+4 −0
Original line number Diff line number Diff line
@@ -1034,6 +1034,10 @@ public interface PhoneInternalInterface {
     */
    String getImei();

    /**
     * Retrieves IMEI type for phones.
     */
    int getImeiType();
    /**
     * Retrieves the IccPhoneBookInterfaceManager of the Phone
     */
Loading