Search in sources :

Example 1 with IPhoneSubInfo

use of com.android.internal.telephony.IPhoneSubInfo in project platform_frameworks_base by android.

the class TelephonyManager method getNai.

/**
     * Returns the NAI. Return null if NAI is not available.
     *
     *  @param slotId of which Nai is returned
     */
/** {@hide}*/
public String getNai(int slotId) {
    int[] subId = SubscriptionManager.getSubId(slotId);
    try {
        IPhoneSubInfo info = getSubscriberInfo();
        if (info == null)
            return null;
        String nai = info.getNaiForSubscriber(subId[0], mContext.getOpPackageName());
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Rlog.v(TAG, "Nai = " + nai);
        }
        return nai;
    } catch (RemoteException ex) {
        return null;
    } catch (NullPointerException ex) {
        return null;
    }
}
Also used : IPhoneSubInfo(com.android.internal.telephony.IPhoneSubInfo) RemoteException(android.os.RemoteException)

Example 2 with IPhoneSubInfo

use of com.android.internal.telephony.IPhoneSubInfo in project android_frameworks_base by DirtyUnicorns.

the class TelephonyManager method getNai.

/**
     * Returns the NAI. Return null if NAI is not available.
     *
     *  @param slotId of which Nai is returned
     */
/** {@hide}*/
public String getNai(int slotId) {
    int[] subId = SubscriptionManager.getSubId(slotId);
    try {
        IPhoneSubInfo info = getSubscriberInfo();
        if (info == null)
            return null;
        String nai = info.getNaiForSubscriber(subId[0], mContext.getOpPackageName());
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Rlog.v(TAG, "Nai = " + nai);
        }
        return nai;
    } catch (RemoteException ex) {
        return null;
    } catch (NullPointerException ex) {
        return null;
    }
}
Also used : IPhoneSubInfo(com.android.internal.telephony.IPhoneSubInfo) RemoteException(android.os.RemoteException)

Example 3 with IPhoneSubInfo

use of com.android.internal.telephony.IPhoneSubInfo in project android_frameworks_base by ResurrectionRemix.

the class TelephonyManager method getNai.

/**
     * Returns the NAI. Return null if NAI is not available.
     *
     *  @param slotId of which Nai is returned
     */
/** {@hide}*/
public String getNai(int slotId) {
    int[] subId = SubscriptionManager.getSubId(slotId);
    try {
        IPhoneSubInfo info = getSubscriberInfo();
        if (info == null)
            return null;
        String nai = info.getNaiForSubscriber(subId[0], mContext.getOpPackageName());
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Rlog.v(TAG, "Nai = " + nai);
        }
        return nai;
    } catch (RemoteException ex) {
        return null;
    } catch (NullPointerException ex) {
        return null;
    }
}
Also used : IPhoneSubInfo(com.android.internal.telephony.IPhoneSubInfo) RemoteException(android.os.RemoteException)

Example 4 with IPhoneSubInfo

use of com.android.internal.telephony.IPhoneSubInfo in project android_frameworks_base by ResurrectionRemix.

the class TelephonyManager method getLine1Number.

/**
     * Returns the phone number string for line 1, for example, the MSISDN
     * for a GSM phone for a particular subscription. Return null if it is unavailable.
     * <p>
     * Requires Permission:
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     *   OR
     *   {@link android.Manifest.permission#READ_SMS}
     * <p>
     * The default SMS app can also use this.
     *
     * @param subId whose phone number for line 1 is returned
     * @hide
     */
public String getLine1Number(int subId) {
    android.util.SeempLog.record_str(9, "" + subId);
    String number = null;
    try {
        ITelephony telephony = getITelephony();
        if (telephony != null)
            number = telephony.getLine1NumberForDisplay(subId, mContext.getOpPackageName());
    } catch (RemoteException ex) {
    } catch (NullPointerException ex) {
    }
    if (number != null) {
        return number;
    }
    try {
        IPhoneSubInfo info = getSubscriberInfo();
        if (info == null)
            return null;
        return info.getLine1NumberForSubscriber(subId, mContext.getOpPackageName());
    } catch (RemoteException ex) {
        return null;
    } catch (NullPointerException ex) {
        // This could happen before phone restarts due to crashing
        return null;
    }
}
Also used : IPhoneSubInfo(com.android.internal.telephony.IPhoneSubInfo) RemoteException(android.os.RemoteException) ITelephony(com.android.internal.telephony.ITelephony)

Example 5 with IPhoneSubInfo

use of com.android.internal.telephony.IPhoneSubInfo in project android_frameworks_base by crdroidandroid.

the class TelephonyManager method getLine1Number.

/**
     * Returns the phone number string for line 1, for example, the MSISDN
     * for a GSM phone for a particular subscription. Return null if it is unavailable.
     * <p>
     * Requires Permission:
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     *   OR
     *   {@link android.Manifest.permission#READ_SMS}
     * <p>
     * The default SMS app can also use this.
     *
     * @param subId whose phone number for line 1 is returned
     * @hide
     */
public String getLine1Number(int subId) {
    android.util.SeempLog.record_str(9, "" + subId);
    String number = null;
    try {
        ITelephony telephony = getITelephony();
        if (telephony != null)
            number = telephony.getLine1NumberForDisplay(subId, mContext.getOpPackageName());
    } catch (RemoteException ex) {
    } catch (NullPointerException ex) {
    }
    if (number != null) {
        return number;
    }
    try {
        IPhoneSubInfo info = getSubscriberInfo();
        if (info == null)
            return null;
        return info.getLine1NumberForSubscriber(subId, mContext.getOpPackageName());
    } catch (RemoteException ex) {
        return null;
    } catch (NullPointerException ex) {
        // This could happen before phone restarts due to crashing
        return null;
    }
}
Also used : IPhoneSubInfo(com.android.internal.telephony.IPhoneSubInfo) RemoteException(android.os.RemoteException) ITelephony(com.android.internal.telephony.ITelephony)

Aggregations

RemoteException (android.os.RemoteException)6 IPhoneSubInfo (com.android.internal.telephony.IPhoneSubInfo)6 ITelephony (com.android.internal.telephony.ITelephony)2