Loading telephony/java/android/telephony/TelephonyManager.java +97 −52 Original line number Diff line number Diff line Loading @@ -911,7 +911,7 @@ public class TelephonyManager { * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ public String getDeviceSoftwareVersion() { return getDeviceSoftwareVersion(getDefaultSim()); return getDeviceSoftwareVersion(getSlotIndex()); } /** Loading Loading @@ -997,7 +997,7 @@ public class TelephonyManager { * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ public String getImei() { return getImei(getDefaultSim()); return getImei(getSlotIndex()); } /** Loading Loading @@ -1029,7 +1029,7 @@ public class TelephonyManager { * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ public String getMeid() { return getMeid(getDefaultSim()); return getMeid(getSlotIndex()); } /** Loading Loading @@ -1059,7 +1059,7 @@ public class TelephonyManager { */ /** {@hide}*/ public String getNai() { return getNai(getDefaultSim()); return getNai(getSlotIndex()); } /** Loading Loading @@ -1303,7 +1303,7 @@ public class TelephonyManager { } private int getPhoneTypeFromProperty() { return getPhoneTypeFromProperty(getDefaultPhone()); return getPhoneTypeFromProperty(getPhoneId()); } /** {@hide} */ Loading @@ -1317,7 +1317,7 @@ public class TelephonyManager { } private int getPhoneTypeFromNetworkType() { return getPhoneTypeFromNetworkType(getDefaultPhone()); return getPhoneTypeFromNetworkType(getPhoneId()); } /** {@hide} */ Loading Loading @@ -1500,7 +1500,7 @@ public class TelephonyManager { * on a CDMA network). */ public String getNetworkOperator() { return getNetworkOperatorForPhone(getDefaultPhone()); return getNetworkOperatorForPhone(getPhoneId()); } /** Loading Loading @@ -1546,7 +1546,7 @@ public class TelephonyManager { * @see #createForPhoneAccountHandle(PhoneAccountHandle) */ public String getNetworkSpecifier() { return String.valueOf(mSubId); return String.valueOf(getSubId()); } /** Loading @@ -1565,7 +1565,7 @@ public class TelephonyManager { public PersistableBundle getCarrierConfig() { CarrierConfigManager carrierConfigManager = mContext .getSystemService(CarrierConfigManager.class); return carrierConfigManager.getConfigForSubId(mSubId); return carrierConfigManager.getConfigForSubId(getSubId()); } /** Loading Loading @@ -1602,7 +1602,7 @@ public class TelephonyManager { * on a CDMA network). */ public String getNetworkCountryIso() { return getNetworkCountryIsoForPhone(getDefaultPhone()); return getNetworkCountryIsoForPhone(getPhoneId()); } /** Loading Loading @@ -1748,6 +1748,9 @@ public class TelephonyManager { * Returns a constant indicating the radio technology (network type) * currently in use on the device for data transmission. * * If this object has been created with {@link #createForSubscriptionId}, applies to the given * subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * <p> * Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} Loading @@ -1772,7 +1775,7 @@ public class TelephonyManager { * @see #NETWORK_TYPE_HSPAP */ public int getDataNetworkType() { return getDataNetworkType(getSubId()); return getDataNetworkType(getSubId(SubscriptionManager.getDefaultDataSubscriptionId())); } /** Loading Loading @@ -1996,7 +1999,7 @@ public class TelephonyManager { * @return true if a ICC card is present */ public boolean hasIccCard() { return hasIccCard(getDefaultSim()); return hasIccCard(getSlotIndex()); } /** Loading Loading @@ -2037,7 +2040,7 @@ public class TelephonyManager { * @see #SIM_STATE_CARD_RESTRICTED */ public int getSimState() { int slotIndex = getDefaultSim(); int slotIndex = getSlotIndex(); // slotIndex may be invalid due to sim being absent. In that case query all slots to get // sim state if (slotIndex < 0) { Loading Loading @@ -2166,7 +2169,7 @@ public class TelephonyManager { * @see #getSimState */ public String getSimOperatorName() { return getSimOperatorNameForPhone(getDefaultPhone()); return getSimOperatorNameForPhone(getPhoneId()); } /** Loading Loading @@ -2198,7 +2201,7 @@ public class TelephonyManager { * Returns the ISO country code equivalent for the SIM provider's country code. */ public String getSimCountryIso() { return getSimCountryIsoForPhone(getDefaultPhone()); return getSimCountryIsoForPhone(getPhoneId()); } /** Loading Loading @@ -2754,7 +2757,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony != null) { return telephony .getVisualVoicemailPackageName(mContext.getOpPackageName(), mSubId); .getVisualVoicemailPackageName(mContext.getOpPackageName(), getSubId()); } } catch (RemoteException ex) { } catch (NullPointerException ex) { Loading Loading @@ -4057,35 +4060,67 @@ public class TelephonyManager { * subId is returned. Otherwise, the default subId will be returned. */ private int getSubId() { if (mSubId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) { return getDefaultSubscription(); if (SubscriptionManager.isUsableSubIdValue(mSubId)) { return mSubId; } return SubscriptionManager.getDefaultSubscriptionId(); } /** * Return an appropriate subscription ID for any situation. * * If this object has been created with {@link #createForSubscriptionId}, then the provided * subId is returned. Otherwise, the preferred subId which is based on caller's context is * returned. * {@see SubscriptionManager#getDefaultDataSubscriptionId()} * {@see SubscriptionManager#getDefaultVoiceSubscriptionId()} * {@see SubscriptionManager#getDefaultSmsSubscriptionId()} */ private int getSubId(int preferredSubId) { if (SubscriptionManager.isUsableSubIdValue(mSubId)) { return mSubId; } return preferredSubId; } /** * Returns Default subscription. * Return an appropriate phone ID for any situation. * * If this object has been created with {@link #createForSubscriptionId}, then the phoneId * associated with the provided subId is returned. Otherwise, the default phoneId associated * with the default subId will be returned. */ private static int getDefaultSubscription() { return SubscriptionManager.getDefaultSubscriptionId(); private int getPhoneId() { return SubscriptionManager.getPhoneId(getSubId()); } /** * Returns Default phone. * Return an appropriate phone ID for any situation. * * If this object has been created with {@link #createForSubscriptionId}, then the phoneId * associated with the provided subId is returned. Otherwise, return the phoneId associated * with the preferred subId based on caller's context. * {@see SubscriptionManager#getDefaultDataSubscriptionId()} * {@see SubscriptionManager#getDefaultVoiceSubscriptionId()} * {@see SubscriptionManager#getDefaultSmsSubscriptionId()} */ private static int getDefaultPhone() { return SubscriptionManager.getPhoneId(SubscriptionManager.getDefaultSubscriptionId()); private int getPhoneId(int preferredSubId) { return SubscriptionManager.getPhoneId(getSubId(preferredSubId)); } /** * @return default SIM's slot index. If SIM is not inserted, return default SIM slot index. * Return an appropriate slot index for any situation. * * if this object has been created with {@link #createForSubscriptionId}, then the slot index * associated with the provided subId is returned. Otherwise, return the slot index associated * with the default subId. * If SIM is not inserted, return default SIM slot index. * * {@hide} */ @VisibleForTesting public int getDefaultSim() { int slotIndex = SubscriptionManager.getSlotIndex( SubscriptionManager.getDefaultSubscriptionId()); public int getSlotIndex() { int slotIndex = SubscriptionManager.getSlotIndex(getSubId()); if (slotIndex == SubscriptionManager.SIM_NOT_INSERTED) { slotIndex = SubscriptionManager.DEFAULT_SIM_SLOT_INDEX; } Loading Loading @@ -4902,7 +4937,7 @@ public class TelephonyManager { /** @hide */ @SystemApi public List<String> getCarrierPackageNamesForIntent(Intent intent) { return getCarrierPackageNamesForIntentAndPhone(intent, getDefaultPhone()); return getCarrierPackageNamesForIntentAndPhone(intent, getPhoneId()); } /** @hide */ Loading Loading @@ -5164,7 +5199,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { telephony.handleUssdRequest(mSubId, ussdRequest, wrappedCallback); telephony.handleUssdRequest(getSubId(), ussdRequest, wrappedCallback); } } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#sendUSSDCode", e); Loading @@ -5184,7 +5219,8 @@ public class TelephonyManager { public boolean isConcurrentVoiceAndDataSupported() { try { ITelephony telephony = getITelephony(); return (telephony == null ? false : telephony.isConcurrentVoiceAndDataAllowed(mSubId)); return (telephony == null ? false : telephony.isConcurrentVoiceAndDataAllowed( getSubId())); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#isConcurrentVoiceAndDataAllowed", e); } Loading Loading @@ -5321,6 +5357,8 @@ public class TelephonyManager { /** * Turns mobile data on or off. * If this object has been created with {@link #createForSubscriptionId}, applies to the given * subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the Loading @@ -5331,7 +5369,7 @@ public class TelephonyManager { * @see #hasCarrierPrivileges */ public void setDataEnabled(boolean enable) { setDataEnabled(getSubId(), enable); setDataEnabled(getSubId(SubscriptionManager.getDefaultDataSubscriptionId()), enable); } /** @hide */ Loading Loading @@ -5361,6 +5399,9 @@ public class TelephonyManager { /** * Returns whether mobile data is enabled or not. * * If this object has been created with {@link #createForSubscriptionId}, applies to the given * subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * <p>Requires one of the following permissions: * {@link android.Manifest.permission#ACCESS_NETWORK_STATE ACCESS_NETWORK_STATE}, * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}, or that the Loading @@ -5376,7 +5417,7 @@ public class TelephonyManager { */ @SuppressWarnings("deprecation") public boolean isDataEnabled() { return getDataEnabled(getSubId()); return getDataEnabled(getSubId(SubscriptionManager.getDefaultDataSubscriptionId())); } /** Loading Loading @@ -5626,7 +5667,7 @@ public class TelephonyManager { * @hide */ public void setSimOperatorNumeric(String numeric) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setSimOperatorNumericForPhone(phoneId, numeric); } Loading @@ -5646,7 +5687,7 @@ public class TelephonyManager { * @hide */ public void setSimOperatorName(String name) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setSimOperatorNameForPhone(phoneId, name); } Loading @@ -5666,7 +5707,7 @@ public class TelephonyManager { * @hide */ public void setSimCountryIso(String iso) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setSimCountryIsoForPhone(phoneId, iso); } Loading @@ -5686,7 +5727,7 @@ public class TelephonyManager { * @hide */ public void setSimState(String state) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setSimStateForPhone(phoneId, state); } Loading @@ -5711,7 +5752,7 @@ public class TelephonyManager { * @hide **/ public void setSimPowerState(boolean powerUp) { setSimPowerStateForSlot(getDefaultSim(), powerUp); setSimPowerStateForSlot(getSlotIndex(), powerUp); } /** Loading Loading @@ -5745,7 +5786,7 @@ public class TelephonyManager { * @hide */ public void setBasebandVersion(String version) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setBasebandVersionForPhone(phoneId, version); } Loading @@ -5772,7 +5813,7 @@ public class TelephonyManager { * @hide */ public void setPhoneType(int type) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setPhoneType(phoneId, type); } Loading Loading @@ -5800,7 +5841,7 @@ public class TelephonyManager { * @hide */ public String getOtaSpNumberSchema(String defaultValue) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); return getOtaSpNumberSchemaForPhone(phoneId, defaultValue); } Loading Loading @@ -5831,7 +5872,7 @@ public class TelephonyManager { * @hide */ public boolean getSmsReceiveCapable(boolean defaultValue) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); return getSmsReceiveCapableForPhone(phoneId, defaultValue); } Loading Loading @@ -5862,7 +5903,7 @@ public class TelephonyManager { * @hide */ public boolean getSmsSendCapable(boolean defaultValue) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); return getSmsSendCapableForPhone(phoneId, defaultValue); } Loading Loading @@ -5890,7 +5931,7 @@ public class TelephonyManager { * @hide */ public void setNetworkOperatorName(String name) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setNetworkOperatorNameForPhone(phoneId, name); } Loading @@ -5912,7 +5953,7 @@ public class TelephonyManager { * @hide */ public void setNetworkOperatorNumeric(String numeric) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setNetworkOperatorNumericForPhone(phoneId, numeric); } Loading @@ -5932,7 +5973,7 @@ public class TelephonyManager { * @hide */ public void setNetworkRoaming(boolean isRoaming) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setNetworkRoamingForPhone(phoneId, isRoaming); } Loading @@ -5956,7 +5997,7 @@ public class TelephonyManager { * @hide */ public void setNetworkCountryIso(String iso) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setNetworkCountryIsoForPhone(phoneId, iso); } Loading @@ -5976,11 +6017,15 @@ public class TelephonyManager { /** * Set the network type currently in use on the device for data transmission. * * If this object has been created with {@link #createForSubscriptionId}, applies to the * phoneId associated with the given subId. Otherwise, applies to the phoneId associated with * {@link SubscriptionManager#getDefaultDataSubscriptionId()} * @param type the network type currently in use on the device for data transmission * @hide */ public void setDataNetworkType(int type) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(SubscriptionManager.getDefaultDataSubscriptionId()); setDataNetworkTypeForPhone(phoneId, type); } Loading Loading @@ -6200,7 +6245,7 @@ public class TelephonyManager { * @hide */ public String getAidForAppType(int appType) { return getAidForAppType(getDefaultSubscription(), appType); return getAidForAppType(getSubId(), appType); } /** Loading Loading @@ -6234,7 +6279,7 @@ public class TelephonyManager { * @hide */ public String getEsn() { return getEsn(getDefaultSubscription()); return getEsn(getSubId()); } /** Loading Loading @@ -6267,7 +6312,7 @@ public class TelephonyManager { * @hide */ public String getCdmaPrlVersion() { return getCdmaPrlVersion(getDefaultSubscription()); return getCdmaPrlVersion(getSubId()); } /** Loading Loading
telephony/java/android/telephony/TelephonyManager.java +97 −52 Original line number Diff line number Diff line Loading @@ -911,7 +911,7 @@ public class TelephonyManager { * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ public String getDeviceSoftwareVersion() { return getDeviceSoftwareVersion(getDefaultSim()); return getDeviceSoftwareVersion(getSlotIndex()); } /** Loading Loading @@ -997,7 +997,7 @@ public class TelephonyManager { * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ public String getImei() { return getImei(getDefaultSim()); return getImei(getSlotIndex()); } /** Loading Loading @@ -1029,7 +1029,7 @@ public class TelephonyManager { * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ public String getMeid() { return getMeid(getDefaultSim()); return getMeid(getSlotIndex()); } /** Loading Loading @@ -1059,7 +1059,7 @@ public class TelephonyManager { */ /** {@hide}*/ public String getNai() { return getNai(getDefaultSim()); return getNai(getSlotIndex()); } /** Loading Loading @@ -1303,7 +1303,7 @@ public class TelephonyManager { } private int getPhoneTypeFromProperty() { return getPhoneTypeFromProperty(getDefaultPhone()); return getPhoneTypeFromProperty(getPhoneId()); } /** {@hide} */ Loading @@ -1317,7 +1317,7 @@ public class TelephonyManager { } private int getPhoneTypeFromNetworkType() { return getPhoneTypeFromNetworkType(getDefaultPhone()); return getPhoneTypeFromNetworkType(getPhoneId()); } /** {@hide} */ Loading Loading @@ -1500,7 +1500,7 @@ public class TelephonyManager { * on a CDMA network). */ public String getNetworkOperator() { return getNetworkOperatorForPhone(getDefaultPhone()); return getNetworkOperatorForPhone(getPhoneId()); } /** Loading Loading @@ -1546,7 +1546,7 @@ public class TelephonyManager { * @see #createForPhoneAccountHandle(PhoneAccountHandle) */ public String getNetworkSpecifier() { return String.valueOf(mSubId); return String.valueOf(getSubId()); } /** Loading @@ -1565,7 +1565,7 @@ public class TelephonyManager { public PersistableBundle getCarrierConfig() { CarrierConfigManager carrierConfigManager = mContext .getSystemService(CarrierConfigManager.class); return carrierConfigManager.getConfigForSubId(mSubId); return carrierConfigManager.getConfigForSubId(getSubId()); } /** Loading Loading @@ -1602,7 +1602,7 @@ public class TelephonyManager { * on a CDMA network). */ public String getNetworkCountryIso() { return getNetworkCountryIsoForPhone(getDefaultPhone()); return getNetworkCountryIsoForPhone(getPhoneId()); } /** Loading Loading @@ -1748,6 +1748,9 @@ public class TelephonyManager { * Returns a constant indicating the radio technology (network type) * currently in use on the device for data transmission. * * If this object has been created with {@link #createForSubscriptionId}, applies to the given * subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * <p> * Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} Loading @@ -1772,7 +1775,7 @@ public class TelephonyManager { * @see #NETWORK_TYPE_HSPAP */ public int getDataNetworkType() { return getDataNetworkType(getSubId()); return getDataNetworkType(getSubId(SubscriptionManager.getDefaultDataSubscriptionId())); } /** Loading Loading @@ -1996,7 +1999,7 @@ public class TelephonyManager { * @return true if a ICC card is present */ public boolean hasIccCard() { return hasIccCard(getDefaultSim()); return hasIccCard(getSlotIndex()); } /** Loading Loading @@ -2037,7 +2040,7 @@ public class TelephonyManager { * @see #SIM_STATE_CARD_RESTRICTED */ public int getSimState() { int slotIndex = getDefaultSim(); int slotIndex = getSlotIndex(); // slotIndex may be invalid due to sim being absent. In that case query all slots to get // sim state if (slotIndex < 0) { Loading Loading @@ -2166,7 +2169,7 @@ public class TelephonyManager { * @see #getSimState */ public String getSimOperatorName() { return getSimOperatorNameForPhone(getDefaultPhone()); return getSimOperatorNameForPhone(getPhoneId()); } /** Loading Loading @@ -2198,7 +2201,7 @@ public class TelephonyManager { * Returns the ISO country code equivalent for the SIM provider's country code. */ public String getSimCountryIso() { return getSimCountryIsoForPhone(getDefaultPhone()); return getSimCountryIsoForPhone(getPhoneId()); } /** Loading Loading @@ -2754,7 +2757,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony != null) { return telephony .getVisualVoicemailPackageName(mContext.getOpPackageName(), mSubId); .getVisualVoicemailPackageName(mContext.getOpPackageName(), getSubId()); } } catch (RemoteException ex) { } catch (NullPointerException ex) { Loading Loading @@ -4057,35 +4060,67 @@ public class TelephonyManager { * subId is returned. Otherwise, the default subId will be returned. */ private int getSubId() { if (mSubId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) { return getDefaultSubscription(); if (SubscriptionManager.isUsableSubIdValue(mSubId)) { return mSubId; } return SubscriptionManager.getDefaultSubscriptionId(); } /** * Return an appropriate subscription ID for any situation. * * If this object has been created with {@link #createForSubscriptionId}, then the provided * subId is returned. Otherwise, the preferred subId which is based on caller's context is * returned. * {@see SubscriptionManager#getDefaultDataSubscriptionId()} * {@see SubscriptionManager#getDefaultVoiceSubscriptionId()} * {@see SubscriptionManager#getDefaultSmsSubscriptionId()} */ private int getSubId(int preferredSubId) { if (SubscriptionManager.isUsableSubIdValue(mSubId)) { return mSubId; } return preferredSubId; } /** * Returns Default subscription. * Return an appropriate phone ID for any situation. * * If this object has been created with {@link #createForSubscriptionId}, then the phoneId * associated with the provided subId is returned. Otherwise, the default phoneId associated * with the default subId will be returned. */ private static int getDefaultSubscription() { return SubscriptionManager.getDefaultSubscriptionId(); private int getPhoneId() { return SubscriptionManager.getPhoneId(getSubId()); } /** * Returns Default phone. * Return an appropriate phone ID for any situation. * * If this object has been created with {@link #createForSubscriptionId}, then the phoneId * associated with the provided subId is returned. Otherwise, return the phoneId associated * with the preferred subId based on caller's context. * {@see SubscriptionManager#getDefaultDataSubscriptionId()} * {@see SubscriptionManager#getDefaultVoiceSubscriptionId()} * {@see SubscriptionManager#getDefaultSmsSubscriptionId()} */ private static int getDefaultPhone() { return SubscriptionManager.getPhoneId(SubscriptionManager.getDefaultSubscriptionId()); private int getPhoneId(int preferredSubId) { return SubscriptionManager.getPhoneId(getSubId(preferredSubId)); } /** * @return default SIM's slot index. If SIM is not inserted, return default SIM slot index. * Return an appropriate slot index for any situation. * * if this object has been created with {@link #createForSubscriptionId}, then the slot index * associated with the provided subId is returned. Otherwise, return the slot index associated * with the default subId. * If SIM is not inserted, return default SIM slot index. * * {@hide} */ @VisibleForTesting public int getDefaultSim() { int slotIndex = SubscriptionManager.getSlotIndex( SubscriptionManager.getDefaultSubscriptionId()); public int getSlotIndex() { int slotIndex = SubscriptionManager.getSlotIndex(getSubId()); if (slotIndex == SubscriptionManager.SIM_NOT_INSERTED) { slotIndex = SubscriptionManager.DEFAULT_SIM_SLOT_INDEX; } Loading Loading @@ -4902,7 +4937,7 @@ public class TelephonyManager { /** @hide */ @SystemApi public List<String> getCarrierPackageNamesForIntent(Intent intent) { return getCarrierPackageNamesForIntentAndPhone(intent, getDefaultPhone()); return getCarrierPackageNamesForIntentAndPhone(intent, getPhoneId()); } /** @hide */ Loading Loading @@ -5164,7 +5199,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { telephony.handleUssdRequest(mSubId, ussdRequest, wrappedCallback); telephony.handleUssdRequest(getSubId(), ussdRequest, wrappedCallback); } } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#sendUSSDCode", e); Loading @@ -5184,7 +5219,8 @@ public class TelephonyManager { public boolean isConcurrentVoiceAndDataSupported() { try { ITelephony telephony = getITelephony(); return (telephony == null ? false : telephony.isConcurrentVoiceAndDataAllowed(mSubId)); return (telephony == null ? false : telephony.isConcurrentVoiceAndDataAllowed( getSubId())); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#isConcurrentVoiceAndDataAllowed", e); } Loading Loading @@ -5321,6 +5357,8 @@ public class TelephonyManager { /** * Turns mobile data on or off. * If this object has been created with {@link #createForSubscriptionId}, applies to the given * subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the Loading @@ -5331,7 +5369,7 @@ public class TelephonyManager { * @see #hasCarrierPrivileges */ public void setDataEnabled(boolean enable) { setDataEnabled(getSubId(), enable); setDataEnabled(getSubId(SubscriptionManager.getDefaultDataSubscriptionId()), enable); } /** @hide */ Loading Loading @@ -5361,6 +5399,9 @@ public class TelephonyManager { /** * Returns whether mobile data is enabled or not. * * If this object has been created with {@link #createForSubscriptionId}, applies to the given * subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * <p>Requires one of the following permissions: * {@link android.Manifest.permission#ACCESS_NETWORK_STATE ACCESS_NETWORK_STATE}, * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}, or that the Loading @@ -5376,7 +5417,7 @@ public class TelephonyManager { */ @SuppressWarnings("deprecation") public boolean isDataEnabled() { return getDataEnabled(getSubId()); return getDataEnabled(getSubId(SubscriptionManager.getDefaultDataSubscriptionId())); } /** Loading Loading @@ -5626,7 +5667,7 @@ public class TelephonyManager { * @hide */ public void setSimOperatorNumeric(String numeric) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setSimOperatorNumericForPhone(phoneId, numeric); } Loading @@ -5646,7 +5687,7 @@ public class TelephonyManager { * @hide */ public void setSimOperatorName(String name) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setSimOperatorNameForPhone(phoneId, name); } Loading @@ -5666,7 +5707,7 @@ public class TelephonyManager { * @hide */ public void setSimCountryIso(String iso) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setSimCountryIsoForPhone(phoneId, iso); } Loading @@ -5686,7 +5727,7 @@ public class TelephonyManager { * @hide */ public void setSimState(String state) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setSimStateForPhone(phoneId, state); } Loading @@ -5711,7 +5752,7 @@ public class TelephonyManager { * @hide **/ public void setSimPowerState(boolean powerUp) { setSimPowerStateForSlot(getDefaultSim(), powerUp); setSimPowerStateForSlot(getSlotIndex(), powerUp); } /** Loading Loading @@ -5745,7 +5786,7 @@ public class TelephonyManager { * @hide */ public void setBasebandVersion(String version) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setBasebandVersionForPhone(phoneId, version); } Loading @@ -5772,7 +5813,7 @@ public class TelephonyManager { * @hide */ public void setPhoneType(int type) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setPhoneType(phoneId, type); } Loading Loading @@ -5800,7 +5841,7 @@ public class TelephonyManager { * @hide */ public String getOtaSpNumberSchema(String defaultValue) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); return getOtaSpNumberSchemaForPhone(phoneId, defaultValue); } Loading Loading @@ -5831,7 +5872,7 @@ public class TelephonyManager { * @hide */ public boolean getSmsReceiveCapable(boolean defaultValue) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); return getSmsReceiveCapableForPhone(phoneId, defaultValue); } Loading Loading @@ -5862,7 +5903,7 @@ public class TelephonyManager { * @hide */ public boolean getSmsSendCapable(boolean defaultValue) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); return getSmsSendCapableForPhone(phoneId, defaultValue); } Loading Loading @@ -5890,7 +5931,7 @@ public class TelephonyManager { * @hide */ public void setNetworkOperatorName(String name) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setNetworkOperatorNameForPhone(phoneId, name); } Loading @@ -5912,7 +5953,7 @@ public class TelephonyManager { * @hide */ public void setNetworkOperatorNumeric(String numeric) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setNetworkOperatorNumericForPhone(phoneId, numeric); } Loading @@ -5932,7 +5973,7 @@ public class TelephonyManager { * @hide */ public void setNetworkRoaming(boolean isRoaming) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setNetworkRoamingForPhone(phoneId, isRoaming); } Loading @@ -5956,7 +5997,7 @@ public class TelephonyManager { * @hide */ public void setNetworkCountryIso(String iso) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(); setNetworkCountryIsoForPhone(phoneId, iso); } Loading @@ -5976,11 +6017,15 @@ public class TelephonyManager { /** * Set the network type currently in use on the device for data transmission. * * If this object has been created with {@link #createForSubscriptionId}, applies to the * phoneId associated with the given subId. Otherwise, applies to the phoneId associated with * {@link SubscriptionManager#getDefaultDataSubscriptionId()} * @param type the network type currently in use on the device for data transmission * @hide */ public void setDataNetworkType(int type) { int phoneId = getDefaultPhone(); int phoneId = getPhoneId(SubscriptionManager.getDefaultDataSubscriptionId()); setDataNetworkTypeForPhone(phoneId, type); } Loading Loading @@ -6200,7 +6245,7 @@ public class TelephonyManager { * @hide */ public String getAidForAppType(int appType) { return getAidForAppType(getDefaultSubscription(), appType); return getAidForAppType(getSubId(), appType); } /** Loading Loading @@ -6234,7 +6279,7 @@ public class TelephonyManager { * @hide */ public String getEsn() { return getEsn(getDefaultSubscription()); return getEsn(getSubId()); } /** Loading Loading @@ -6267,7 +6312,7 @@ public class TelephonyManager { * @hide */ public String getCdmaPrlVersion() { return getCdmaPrlVersion(getDefaultSubscription()); return getCdmaPrlVersion(getSubId()); } /** Loading