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

Commit 9b7d3a86 authored by Jack Yu's avatar Jack Yu Committed by android-build-merger
Browse files

Merge "Deprecated getDeviceId and added getMeid and getImei"

am: ad2e7405

Change-Id: I4e006290c54a371fc5f080c37f86ca946507d871
parents aadbb2d4 ad2e7405
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -38191,13 +38191,17 @@ package android.telephony {
    method public boolean getDataEnabled();
    method public int getDataNetworkType();
    method public int getDataState();
    method public java.lang.String getDeviceId();
    method public java.lang.String getDeviceId(int);
    method public deprecated java.lang.String getDeviceId();
    method public deprecated java.lang.String getDeviceId(int);
    method public java.lang.String getDeviceSoftwareVersion();
    method public java.lang.String[] getForbiddenPlmns();
    method public java.lang.String getGroupIdLevel1();
    method public java.lang.String getIccAuthentication(int, int, java.lang.String);
    method public java.lang.String getImei();
    method public java.lang.String getImei(int);
    method public java.lang.String getLine1Number();
    method public java.lang.String getMeid();
    method public java.lang.String getMeid(int);
    method public java.lang.String getMmsUAProfUrl();
    method public java.lang.String getMmsUserAgent();
    method public deprecated java.util.List<android.telephony.NeighboringCellInfo> getNeighboringCellInfo();
+4 −2
Original line number Diff line number Diff line
@@ -41409,8 +41409,8 @@ package android.telephony {
    method public boolean getDataEnabled(int);
    method public int getDataNetworkType();
    method public int getDataState();
    method public java.lang.String getDeviceId();
    method public java.lang.String getDeviceId(int);
    method public deprecated java.lang.String getDeviceId();
    method public deprecated java.lang.String getDeviceId(int);
    method public java.lang.String getDeviceSoftwareVersion();
    method public java.lang.String[] getForbiddenPlmns();
    method public java.lang.String getGroupIdLevel1();
@@ -41418,6 +41418,8 @@ package android.telephony {
    method public java.lang.String getImei();
    method public java.lang.String getImei(int);
    method public java.lang.String getLine1Number();
    method public java.lang.String getMeid();
    method public java.lang.String getMeid(int);
    method public java.lang.String getMmsUAProfUrl();
    method public java.lang.String getMmsUserAgent();
    method public deprecated java.util.List<android.telephony.NeighboringCellInfo> getNeighboringCellInfo();
+6 −2
Original line number Diff line number Diff line
@@ -38274,13 +38274,17 @@ package android.telephony {
    method public boolean getDataEnabled();
    method public int getDataNetworkType();
    method public int getDataState();
    method public java.lang.String getDeviceId();
    method public java.lang.String getDeviceId(int);
    method public deprecated java.lang.String getDeviceId();
    method public deprecated java.lang.String getDeviceId(int);
    method public java.lang.String getDeviceSoftwareVersion();
    method public java.lang.String[] getForbiddenPlmns();
    method public java.lang.String getGroupIdLevel1();
    method public java.lang.String getIccAuthentication(int, int, java.lang.String);
    method public java.lang.String getImei();
    method public java.lang.String getImei(int);
    method public java.lang.String getLine1Number();
    method public java.lang.String getMeid();
    method public java.lang.String getMeid(int);
    method public java.lang.String getMmsUAProfUrl();
    method public java.lang.String getMmsUserAgent();
    method public deprecated java.util.List<android.telephony.NeighboringCellInfo> getNeighboringCellInfo();
+57 −11
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.util.Log;

import com.android.ims.internal.IImsServiceController;
import com.android.ims.internal.IImsServiceFeatureListener;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telecom.ITelecomService;
import com.android.internal.telephony.CellNetworkScanResult;
import com.android.internal.telephony.IPhoneSubInfo;
@@ -885,7 +886,11 @@ public class TelephonyManager {
     *
     * <p>Requires Permission:
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     *
     * @deprecated Use (@link getImei} which returns IMEI for GSM or (@link getMeid} which returns
     * MEID for CDMA.
     */
    @Deprecated
    public String getDeviceId() {
        try {
            ITelephony telephony = getITelephony();
@@ -907,7 +912,11 @@ public class TelephonyManager {
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     *
     * @param slotIndex of which deviceID is returned
     *
     * @deprecated Use (@link getImei} which returns IMEI for GSM or (@link getMeid} which returns
     * MEID for CDMA.
     */
    @Deprecated
    public String getDeviceId(int slotIndex) {
        // FIXME this assumes phoneId == slotIndex
        try {
@@ -923,29 +932,25 @@ public class TelephonyManager {
    }

    /**
     * Returns the IMEI. Return null if IMEI is not available.
     * Returns the IMEI (International Mobile Equipment Identity). Return null if IMEI is not
     * available.
     *
     * <p>Requires Permission:
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     *
     * @hide
     */
    @SystemApi
    public String getImei() {
        return getImei(getDefaultSim());
    }

    /**
     * Returns the IMEI. Return null if IMEI is not available.
     * Returns the IMEI (International Mobile Equipment Identity). Return null if IMEI is not
     * available.
     *
     * <p>Requires Permission:
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     *
     * @param slotIndex of which deviceID is returned
     *
     * @hide
     * @param slotIndex of which IMEI is returned
     */
    @SystemApi
    public String getImei(int slotIndex) {
        ITelephony telephony = getITelephony();
        if (telephony == null) return null;
@@ -959,6 +964,37 @@ public class TelephonyManager {
        }
    }

    /**
     * Returns the MEID (Mobile Equipment Identifier). Return null if MEID is not available.
     *
     * <p>Requires Permission:
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     */
    public String getMeid() {
        return getMeid(getDefaultSim());
    }

    /**
     * Returns the MEID (Mobile Equipment Identifier). Return null if MEID is not available.
     *
     * <p>Requires Permission:
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     *
     * @param slotIndex of which MEID is returned
     */
    public String getMeid(int slotIndex) {
        ITelephony telephony = getITelephony();
        if (telephony == null) return null;

        try {
            return telephony.getMeidForSlot(slotIndex, getOpPackageName());
        } catch (RemoteException ex) {
            return null;
        } catch (NullPointerException ex) {
            return null;
        }
    }

    /**
     * Returns the NAI. Return null if NAI is not available.
     *
@@ -3887,9 +3923,19 @@ public class TelephonyManager {
        return SubscriptionManager.getPhoneId(SubscriptionManager.getDefaultSubscriptionId());
    }

    /** {@hide} */
    /**
     *  @return default SIM's slot index. If SIM is not inserted, return default SIM slot index.
     *
     * {@hide}
     */
    @VisibleForTesting
    public int getDefaultSim() {
        return SubscriptionManager.getSlotIndex(SubscriptionManager.getDefaultSubscriptionId());
        int slotIndex = SubscriptionManager.getSlotIndex(
                SubscriptionManager.getDefaultSubscriptionId());
        if (slotIndex == SubscriptionManager.SIM_NOT_INSERTED) {
            slotIndex = SubscriptionManager.DEFAULT_SIM_SLOT_INDEX;
        }
        return slotIndex;
    }

    /**
+10 −0
Original line number Diff line number Diff line
@@ -1061,6 +1061,16 @@ interface ITelephony {
     */
    String getImeiForSlot(int slotIndex, String callingPackage);

    /**
     * Returns the MEID for the given slot.
     *
     * @param slotIndex - device slot.
     * @param callingPackage The package making the call.
     * <p>Requires Permission:
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     */
    String getMeidForSlot(int slotIndex, String callingPackage);

    /**
     * Returns the device software version.
     *