Loading telephony/java/android/telephony/TelephonyManager.java +36 −21 Original line number Diff line number Diff line Loading @@ -717,16 +717,11 @@ public class TelephonyManager { */ /** {@hide} */ public String getDeviceSoftwareVersion(int slotId) { // FIXME methods taking slot id should not use subscription, instead us Uicc directly int[] subId = SubscriptionManager.getSubId(slotId); if (subId == null || subId.length == 0) { return null; } ITelephony telephony = getITelephony(); if (telephony == null) return null; try { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; return info.getDeviceSvnUsingSubId(subId[0], mContext.getOpPackageName()); return telephony.getDeviceSoftwareVersionForSlot(slotId, getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { Loading Loading @@ -798,12 +793,11 @@ public class TelephonyManager { */ /** {@hide} */ public String getImei(int slotId) { int[] subId = SubscriptionManager.getSubId(slotId); ITelephony telephony = getITelephony(); if (telephony == null) return null; try { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; return info.getImeiForSubscriber(subId[0], mContext.getOpPackageName()); return telephony.getImeiForSlot(slotId, getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { Loading Loading @@ -1014,22 +1008,32 @@ public class TelephonyManager { } else { phoneId = SubscriptionManager.getPhoneId(subId); } return getCurrentPhoneTypeForSlot(phoneId); } /** * See getCurrentPhoneType. * * @hide */ public int getCurrentPhoneTypeForSlot(int slotId) { try{ ITelephony telephony = getITelephony(); if (telephony != null && subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { return telephony.getActivePhoneTypeForSubscriber(subId); if (telephony != null) { return telephony.getActivePhoneTypeForSlot(slotId); } else { // This can happen when the ITelephony interface is not up yet. return getPhoneTypeFromProperty(phoneId); return getPhoneTypeFromProperty(slotId); } } catch (RemoteException ex) { // This shouldn't happen in the normal case, as a backup we // read from the system property. return getPhoneTypeFromProperty(phoneId); return getPhoneTypeFromProperty(slotId); } catch (NullPointerException ex) { // This shouldn't happen in the normal case, as a backup we // read from the system property. return getPhoneTypeFromProperty(phoneId); return getPhoneTypeFromProperty(slotId); } } Loading Loading @@ -2555,11 +2559,21 @@ public class TelephonyManager { * @param subId whose call state is returned */ public int getCallState(int subId) { int phoneId = SubscriptionManager.getPhoneId(subId); return getCallStateForSlot(phoneId); } /** * See getCallState. * * @hide */ public int getCallStateForSlot(int slotId) { try { ITelephony telephony = getITelephony(); if (telephony == null) return CALL_STATE_IDLE; return telephony.getCallStateForSubscriber(subId); return telephony.getCallStateForSlot(slotId); } catch (RemoteException ex) { // the phone process is restarting. return CALL_STATE_IDLE; Loading @@ -2569,6 +2583,7 @@ public class TelephonyManager { } } /** Data connection activity: No traffic. */ public static final int DATA_ACTIVITY_NONE = 0x00000000; /** Data connection activity: Currently receiving IP PPP traffic. */ Loading telephony/java/com/android/internal/telephony/ITelephony.aidl +25 −5 Original line number Diff line number Diff line Loading @@ -360,9 +360,9 @@ interface ITelephony { int getCallState(); /** * Returns the call state for a subId. * Returns the call state for a slot. */ int getCallStateForSubscriber(int subId); int getCallStateForSlot(int slotId); int getDataActivity(); int getDataState(); Loading @@ -375,12 +375,12 @@ interface ITelephony { int getActivePhoneType(); /** * Returns the current active phone type as integer for particular subId. * Returns the current active phone type as integer for particular slot. * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE * @param subId user preferred subId. * @param slotId - slot to query. */ int getActivePhoneTypeForSubscriber(int subId); int getActivePhoneTypeForSlot(int slotId); /** * Returns the CDMA ERI icon index to display Loading Loading @@ -991,6 +991,26 @@ interface ITelephony { */ String getDeviceId(String callingPackage); /** * Returns the IMEI for the given slot. * * @param slotId - device slot. * @param callingPackage The package making the call. * <p>Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ String getImeiForSlot(int slotId, String callingPackage); /** * Returns the device software version. * * @param slotId - device slot. * @param callingPackage The package making the call. * <p>Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ String getDeviceSoftwareVersionForSlot(int slotId, String callingPackage); /** * Returns the subscription ID associated with the specified PhoneAccount. */ Loading Loading
telephony/java/android/telephony/TelephonyManager.java +36 −21 Original line number Diff line number Diff line Loading @@ -717,16 +717,11 @@ public class TelephonyManager { */ /** {@hide} */ public String getDeviceSoftwareVersion(int slotId) { // FIXME methods taking slot id should not use subscription, instead us Uicc directly int[] subId = SubscriptionManager.getSubId(slotId); if (subId == null || subId.length == 0) { return null; } ITelephony telephony = getITelephony(); if (telephony == null) return null; try { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; return info.getDeviceSvnUsingSubId(subId[0], mContext.getOpPackageName()); return telephony.getDeviceSoftwareVersionForSlot(slotId, getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { Loading Loading @@ -798,12 +793,11 @@ public class TelephonyManager { */ /** {@hide} */ public String getImei(int slotId) { int[] subId = SubscriptionManager.getSubId(slotId); ITelephony telephony = getITelephony(); if (telephony == null) return null; try { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; return info.getImeiForSubscriber(subId[0], mContext.getOpPackageName()); return telephony.getImeiForSlot(slotId, getOpPackageName()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { Loading Loading @@ -1014,22 +1008,32 @@ public class TelephonyManager { } else { phoneId = SubscriptionManager.getPhoneId(subId); } return getCurrentPhoneTypeForSlot(phoneId); } /** * See getCurrentPhoneType. * * @hide */ public int getCurrentPhoneTypeForSlot(int slotId) { try{ ITelephony telephony = getITelephony(); if (telephony != null && subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { return telephony.getActivePhoneTypeForSubscriber(subId); if (telephony != null) { return telephony.getActivePhoneTypeForSlot(slotId); } else { // This can happen when the ITelephony interface is not up yet. return getPhoneTypeFromProperty(phoneId); return getPhoneTypeFromProperty(slotId); } } catch (RemoteException ex) { // This shouldn't happen in the normal case, as a backup we // read from the system property. return getPhoneTypeFromProperty(phoneId); return getPhoneTypeFromProperty(slotId); } catch (NullPointerException ex) { // This shouldn't happen in the normal case, as a backup we // read from the system property. return getPhoneTypeFromProperty(phoneId); return getPhoneTypeFromProperty(slotId); } } Loading Loading @@ -2555,11 +2559,21 @@ public class TelephonyManager { * @param subId whose call state is returned */ public int getCallState(int subId) { int phoneId = SubscriptionManager.getPhoneId(subId); return getCallStateForSlot(phoneId); } /** * See getCallState. * * @hide */ public int getCallStateForSlot(int slotId) { try { ITelephony telephony = getITelephony(); if (telephony == null) return CALL_STATE_IDLE; return telephony.getCallStateForSubscriber(subId); return telephony.getCallStateForSlot(slotId); } catch (RemoteException ex) { // the phone process is restarting. return CALL_STATE_IDLE; Loading @@ -2569,6 +2583,7 @@ public class TelephonyManager { } } /** Data connection activity: No traffic. */ public static final int DATA_ACTIVITY_NONE = 0x00000000; /** Data connection activity: Currently receiving IP PPP traffic. */ Loading
telephony/java/com/android/internal/telephony/ITelephony.aidl +25 −5 Original line number Diff line number Diff line Loading @@ -360,9 +360,9 @@ interface ITelephony { int getCallState(); /** * Returns the call state for a subId. * Returns the call state for a slot. */ int getCallStateForSubscriber(int subId); int getCallStateForSlot(int slotId); int getDataActivity(); int getDataState(); Loading @@ -375,12 +375,12 @@ interface ITelephony { int getActivePhoneType(); /** * Returns the current active phone type as integer for particular subId. * Returns the current active phone type as integer for particular slot. * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE * @param subId user preferred subId. * @param slotId - slot to query. */ int getActivePhoneTypeForSubscriber(int subId); int getActivePhoneTypeForSlot(int slotId); /** * Returns the CDMA ERI icon index to display Loading Loading @@ -991,6 +991,26 @@ interface ITelephony { */ String getDeviceId(String callingPackage); /** * Returns the IMEI for the given slot. * * @param slotId - device slot. * @param callingPackage The package making the call. * <p>Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ String getImeiForSlot(int slotId, String callingPackage); /** * Returns the device software version. * * @param slotId - device slot. * @param callingPackage The package making the call. * <p>Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ String getDeviceSoftwareVersionForSlot(int slotId, String callingPackage); /** * Returns the subscription ID associated with the specified PhoneAccount. */ Loading