Loading telephony/java/android/telephony/TelephonyManager.java +119 −0 Original line number Diff line number Diff line Loading @@ -134,6 +134,22 @@ public class TelephonyManager { static final int NEVER_USE = 2; } /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = {"NETWORK_SELECTION_MODE_"}, value = { NETWORK_SELECTION_MODE_UNKNOWN, NETWORK_SELECTION_MODE_AUTO, NETWORK_SELECTION_MODE_MANUAL}) public @interface NetworkSelectionMode {} /** @hide */ public static final int NETWORK_SELECTION_MODE_UNKNOWN = 0; /** @hide */ public static final int NETWORK_SELECTION_MODE_AUTO = 1; /** @hide */ public static final int NETWORK_SELECTION_MODE_MANUAL = 2; /** The otaspMode passed to PhoneStateListener#onOtaspChanged */ /** @hide */ static public final int OTASP_UNINITIALIZED = 0; Loading Loading @@ -5835,6 +5851,31 @@ public class TelephonyManager { return false; } /** * Get the network selection mode. * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * @return the network selection mode. * * @hide */ @NetworkSelectionMode @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getNetworkSelectionMode() { int mode = NETWORK_SELECTION_MODE_UNKNOWN; try { ITelephony telephony = getITelephony(); if (telephony != null) { mode = telephony.getNetworkSelectionMode(getSubId()); } } catch (RemoteException ex) { Rlog.e(TAG, "getNetworkSelectionMode RemoteException", ex); } return mode; } /** * Set the preferred network type. * Used for device configuration by some CDMA operators. Loading Loading @@ -6748,6 +6789,84 @@ public class TelephonyManager { return isDataRoamingEnabled; } /** * Gets the roaming mode for CDMA phone. * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * @return one of {@link #CDMA_ROAMING_MODE_RADIO_DEFAULT}, {@link #CDMA_ROAMING_MODE_HOME}, * {@link #CDMA_ROAMING_MODE_AFFILIATED}, {@link #CDMA_ROAMING_MODE_ANY}. * * @hide */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getCdmaRoamingMode() { int mode = CDMA_ROAMING_MODE_RADIO_DEFAULT; try { ITelephony telephony = getITelephony(); if (telephony != null) { mode = telephony.getCdmaRoamingMode(getSubId()); } } catch (RemoteException ex) { Log.e(TAG, "Error calling ITelephony#getCdmaRoamingMode", ex); } return mode; } /** * Sets the roaming mode for CDMA phone to the given mode {@code mode}. * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * @param mode should be one of {@link #CDMA_ROAMING_MODE_RADIO_DEFAULT}, * {@link #CDMA_ROAMING_MODE_HOME}, {@link #CDMA_ROAMING_MODE_AFFILIATED}, * {@link #CDMA_ROAMING_MODE_ANY}. * * @return {@code true} if successed. * * @hide */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setCdmaRoamingMode(int mode) { try { ITelephony telephony = getITelephony(); if (telephony != null) { return telephony.setCdmaRoamingMode(getSubId(), mode); } } catch (RemoteException ex) { Log.e(TAG, "Error calling ITelephony#setCdmaRoamingMode", ex); } return false; } /** * Sets the subscription mode for CDMA phone to the given mode {@code mode}. * * @param mode CDMA subscription mode * * @return {@code true} if successed. * * @see Phone#CDMA_SUBSCRIPTION_UNKNOWN * @see Phone#CDMA_SUBSCRIPTION_RUIM_SIM * @see Phone#CDMA_SUBSCRIPTION_NV * * @hide */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setCdmaSubscriptionMode(int mode) { try { ITelephony telephony = getITelephony(); if (telephony != null) { return telephony.setCdmaSubscriptionMode(getSubId(), mode); } } catch (RemoteException ex) { Log.e(TAG, "Error calling ITelephony#setCdmaSubscriptionMode", ex); } return false; } /** * Enables/Disables the data roaming on the subscription. * Loading telephony/java/com/android/internal/telephony/ITelephony.aidl +33 −0 Original line number Diff line number Diff line Loading @@ -1535,6 +1535,34 @@ interface ITelephony { */ void setDataRoamingEnabled(int subId, boolean isEnabled); /** * Gets the roaming mode for the CDMA phone with the subscription id {@code subId}. * * @param the subscription id. * @return the roaming mode for CDMA phone. */ int getCdmaRoamingMode(int subId); /** * Sets the roaming mode on the CDMA phone with the subscription {@code subId} to the given * roaming mode {@code mode}. * * @param subId the subscription id. * @param mode the roaming mode should be set. * @return {@code true} if successed. */ boolean setCdmaRoamingMode(int subId, int mode); /** * Sets the subscription mode for CDMA phone with the subscription {@code subId} to the given * subscription mode {@code mode}. * * @param subId the subscription id. * @param mode the subscription mode should be set. * @return {@code true} if successed. */ boolean setCdmaSubscriptionMode(int subId, int mode); /** * A test API to override carrier information including mccmnc, imsi, iccid, gid1, gid2, * plmn and spn. This would be handy for, eg, forcing a particular carrier id, carrier's config Loading @@ -1559,4 +1587,9 @@ interface ITelephony { * @hide */ int getNumberOfModemsWithSimultaneousDataConnections(int subId, String callingPackage); /** * Return the network selection mode on the subscription with id {@code subId}. */ int getNetworkSelectionMode(int subId); } Loading
telephony/java/android/telephony/TelephonyManager.java +119 −0 Original line number Diff line number Diff line Loading @@ -134,6 +134,22 @@ public class TelephonyManager { static final int NEVER_USE = 2; } /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = {"NETWORK_SELECTION_MODE_"}, value = { NETWORK_SELECTION_MODE_UNKNOWN, NETWORK_SELECTION_MODE_AUTO, NETWORK_SELECTION_MODE_MANUAL}) public @interface NetworkSelectionMode {} /** @hide */ public static final int NETWORK_SELECTION_MODE_UNKNOWN = 0; /** @hide */ public static final int NETWORK_SELECTION_MODE_AUTO = 1; /** @hide */ public static final int NETWORK_SELECTION_MODE_MANUAL = 2; /** The otaspMode passed to PhoneStateListener#onOtaspChanged */ /** @hide */ static public final int OTASP_UNINITIALIZED = 0; Loading Loading @@ -5835,6 +5851,31 @@ public class TelephonyManager { return false; } /** * Get the network selection mode. * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * @return the network selection mode. * * @hide */ @NetworkSelectionMode @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getNetworkSelectionMode() { int mode = NETWORK_SELECTION_MODE_UNKNOWN; try { ITelephony telephony = getITelephony(); if (telephony != null) { mode = telephony.getNetworkSelectionMode(getSubId()); } } catch (RemoteException ex) { Rlog.e(TAG, "getNetworkSelectionMode RemoteException", ex); } return mode; } /** * Set the preferred network type. * Used for device configuration by some CDMA operators. Loading Loading @@ -6748,6 +6789,84 @@ public class TelephonyManager { return isDataRoamingEnabled; } /** * Gets the roaming mode for CDMA phone. * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * @return one of {@link #CDMA_ROAMING_MODE_RADIO_DEFAULT}, {@link #CDMA_ROAMING_MODE_HOME}, * {@link #CDMA_ROAMING_MODE_AFFILIATED}, {@link #CDMA_ROAMING_MODE_ANY}. * * @hide */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getCdmaRoamingMode() { int mode = CDMA_ROAMING_MODE_RADIO_DEFAULT; try { ITelephony telephony = getITelephony(); if (telephony != null) { mode = telephony.getCdmaRoamingMode(getSubId()); } } catch (RemoteException ex) { Log.e(TAG, "Error calling ITelephony#getCdmaRoamingMode", ex); } return mode; } /** * Sets the roaming mode for CDMA phone to the given mode {@code mode}. * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()} * * @param mode should be one of {@link #CDMA_ROAMING_MODE_RADIO_DEFAULT}, * {@link #CDMA_ROAMING_MODE_HOME}, {@link #CDMA_ROAMING_MODE_AFFILIATED}, * {@link #CDMA_ROAMING_MODE_ANY}. * * @return {@code true} if successed. * * @hide */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setCdmaRoamingMode(int mode) { try { ITelephony telephony = getITelephony(); if (telephony != null) { return telephony.setCdmaRoamingMode(getSubId(), mode); } } catch (RemoteException ex) { Log.e(TAG, "Error calling ITelephony#setCdmaRoamingMode", ex); } return false; } /** * Sets the subscription mode for CDMA phone to the given mode {@code mode}. * * @param mode CDMA subscription mode * * @return {@code true} if successed. * * @see Phone#CDMA_SUBSCRIPTION_UNKNOWN * @see Phone#CDMA_SUBSCRIPTION_RUIM_SIM * @see Phone#CDMA_SUBSCRIPTION_NV * * @hide */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setCdmaSubscriptionMode(int mode) { try { ITelephony telephony = getITelephony(); if (telephony != null) { return telephony.setCdmaSubscriptionMode(getSubId(), mode); } } catch (RemoteException ex) { Log.e(TAG, "Error calling ITelephony#setCdmaSubscriptionMode", ex); } return false; } /** * Enables/Disables the data roaming on the subscription. * Loading
telephony/java/com/android/internal/telephony/ITelephony.aidl +33 −0 Original line number Diff line number Diff line Loading @@ -1535,6 +1535,34 @@ interface ITelephony { */ void setDataRoamingEnabled(int subId, boolean isEnabled); /** * Gets the roaming mode for the CDMA phone with the subscription id {@code subId}. * * @param the subscription id. * @return the roaming mode for CDMA phone. */ int getCdmaRoamingMode(int subId); /** * Sets the roaming mode on the CDMA phone with the subscription {@code subId} to the given * roaming mode {@code mode}. * * @param subId the subscription id. * @param mode the roaming mode should be set. * @return {@code true} if successed. */ boolean setCdmaRoamingMode(int subId, int mode); /** * Sets the subscription mode for CDMA phone with the subscription {@code subId} to the given * subscription mode {@code mode}. * * @param subId the subscription id. * @param mode the subscription mode should be set. * @return {@code true} if successed. */ boolean setCdmaSubscriptionMode(int subId, int mode); /** * A test API to override carrier information including mccmnc, imsi, iccid, gid1, gid2, * plmn and spn. This would be handy for, eg, forcing a particular carrier id, carrier's config Loading @@ -1559,4 +1587,9 @@ interface ITelephony { * @hide */ int getNumberOfModemsWithSimultaneousDataConnections(int subId, String callingPackage); /** * Return the network selection mode on the subscription with id {@code subId}. */ int getNetworkSelectionMode(int subId); }