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

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

Merge "PrimaryImei framework changes"

parents 556c5004 5ee0cc23
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -44361,6 +44361,7 @@ package android.telephony {
    method @Deprecated public int getPhoneCount();
    method public int getPhoneType();
    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PHONE_STATE}) public int getPreferredOpportunisticDataSubscription();
    method @NonNull public String getPrimaryImei();
    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.ACCESS_COARSE_LOCATION}) public android.telephony.ServiceState getServiceState();
    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.ACCESS_COARSE_LOCATION}) public android.telephony.ServiceState getServiceState(int);
    method @Nullable public android.telephony.SignalStrength getSignalStrength();
+43 −0
Original line number Diff line number Diff line
@@ -17960,4 +17960,47 @@ public class TelephonyManager {
        }
        return false;
    }
    /*
     * Returns the primary IMEI (International Mobile Equipment Identity) of the device as
     * mentioned in GSMA TS.37. {@link #getImei(int)} returns the IMEI that belongs to the selected
     * slotID whereas this API {@link #getPrimaryImei()} returns primary IMEI of the device.
     * A single SIM device with only one IMEI will be set by default as primary IMEI.
     * A multi-SIM device with multiple IMEIs will have one of the IMEIs set as primary as
     * mentioned in GSMA TS37_2.2_REQ_8.
     *
     * <p>Requires one of the following permissions
     * <ul>
     *     <li>If the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission; this
     *     is a privileged permission that can only be granted to apps preloaded on the device.
     *     <li>If the calling app is the device owner of a fully-managed device, a profile
     *     owner of an organization-owned device, or their delegates (see {@link
     *     android.app.admin.DevicePolicyManager#getEnrollmentSpecificId()}).
     *     <li>If the calling app has carrier privileges (see {@link #hasCarrierPrivileges}) on any
     *     active subscription.
     *     <li>If the calling app is the default SMS role holder (see {@link
     *     RoleManager#isRoleHeld(String)}).
     *     <li>If the calling app has been granted the
     *      {@link Manifest.permission#USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER} permission.
     * </ul>
     *
     * @return Primary IMEI of type string
     * @throws UnsupportedOperationException if the radio doesn't support this feature.
     * @throws SecurityException if the caller does not have the required permission/privileges
     */
    @NonNull
    @RequiresFeature(PackageManager.FEATURE_TELEPHONY_GSM)
    public String getPrimaryImei() {
        try {
            ITelephony telephony = getITelephony();
            if (telephony == null) {
                Rlog.e(TAG, "getPrimaryImei(): IPhoneSubInfo instance is NULL");
                throw new IllegalStateException("Telephony service not available.");
            }
            return telephony.getPrimaryImei(getOpPackageName(), getAttributionTag());
        } catch (RemoteException ex) {
            Rlog.e(TAG, "getPrimaryImei() RemoteException : " + ex);
            throw ex.rethrowAsRuntimeException();
        }
    }
}
+10 −0
Original line number Diff line number Diff line
@@ -1320,6 +1320,16 @@ interface ITelephony {
     */
    String getImeiForSlot(int slotIndex, String callingPackage, String callingFeatureId);

    /**
     * Returns the primary IMEI of the device
     *
     * @param callingPackage The package name of the caller
     * @param callingFeatureId The feature Id of the calling package
     * @throws UnsupportedOperationException if the radio doesn't support this feature.
     * @throws SecurityException if the caller does not have the required permission/privileges
     */
    String getPrimaryImei(String callingPackage, String callingFeatureId);

    /**
     * Returns the Type Allocation Code from the IMEI for the given slot.
     *
+1 −1
Original line number Diff line number Diff line
@@ -500,7 +500,7 @@ public interface RILConstants {
    int RIL_REQUEST_GET_SIM_PHONEBOOK_CAPACITY = 149;
    int RIL_REQUEST_GET_SIM_PHONEBOOK_RECORDS = 150;
    int RIL_REQUEST_UPDATE_SIM_PHONEBOOK_RECORD = 151;

    int RIL_REQUEST_DEVICE_IMEI = 152;
    /* The following requests are not defined in RIL.h */
    int RIL_REQUEST_HAL_NON_RIL_BASE = 200;
    int RIL_REQUEST_GET_SLOT_STATUS = 200;