Loading api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -6150,6 +6150,7 @@ package android.telephony { method public boolean getEmergencyCallbackMode(); method public java.lang.String getIsimDomain(); method public int getPreferredNetworkType(int); method public int getPreferredNetworkTypeBitmap(); method public int getRadioPowerState(); method public int getSimApplicationState(); method public int getSimCardState(); Loading Loading @@ -6178,6 +6179,7 @@ package android.telephony { method public void setDataActivationState(int); method public deprecated void setDataEnabled(int, boolean); method public void setDataRoamingEnabled(boolean); method public boolean setPreferredNetworkTypeBitmap(int); method public boolean setRadio(boolean); method public boolean setRadioPower(boolean); method public void setSimPowerState(int); Loading telephony/java/android/telephony/TelephonyManager.java +64 −1 Original line number Diff line number Diff line Loading @@ -6382,8 +6382,9 @@ public class TelephonyManager { public @PrefNetworkMode int getPreferredNetworkType(int subId) { try { ITelephony telephony = getITelephony(); if (telephony != null) if (telephony != null) { return telephony.getPreferredNetworkType(subId); } } catch (RemoteException ex) { Rlog.e(TAG, "getPreferredNetworkType RemoteException", ex); } catch (NullPointerException ex) { Loading @@ -6392,6 +6393,37 @@ public class TelephonyManager { return -1; } /** * Get the preferred network type bitmap. * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()} * * <p>Requires Permission: * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE} * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). * * @return a 32-bit bitmap. * * @hide */ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @SystemApi public @NetworkTypeBitMask int getPreferredNetworkTypeBitmap() { try { ITelephony telephony = getITelephony(); if (telephony != null) { return RadioAccessFamily.getRafFromNetworkType( telephony.getPreferredNetworkType(getSubId())); } } catch (RemoteException ex) { Rlog.e(TAG, "getPreferredNetworkTypeBitmap RemoteException", ex); } catch (NullPointerException ex) { Rlog.e(TAG, "getPreferredNetworkTypeBitmap NPE", ex); } return 0; } /** * Sets the network selection mode to automatic. * Loading Loading @@ -6606,6 +6638,37 @@ public class TelephonyManager { return false; } /** * Set the preferred network type bitmap. * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()} * * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling * app has carrier privileges (see {@link #hasCarrierPrivileges}). * * @param networkTypeBitmap a 32-bit bitmap. * @return true on success; false on any failure. * @hide */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @SystemApi public boolean setPreferredNetworkTypeBitmap(@NetworkTypeBitMask int networkTypeBitmap) { try { ITelephony telephony = getITelephony(); if (telephony != null) { return telephony.setPreferredNetworkType( getSubId(), RadioAccessFamily.getNetworkTypeFromRaf(networkTypeBitmap)); } } catch (RemoteException ex) { Rlog.e(TAG, "setPreferredNetworkType RemoteException", ex); } catch (NullPointerException ex) { Rlog.e(TAG, "setPreferredNetworkType NPE", ex); } return false; } /** * Set the preferred network type to global mode which includes LTE, CDMA, EvDo and GSM/WCDMA. * Loading Loading
api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -6150,6 +6150,7 @@ package android.telephony { method public boolean getEmergencyCallbackMode(); method public java.lang.String getIsimDomain(); method public int getPreferredNetworkType(int); method public int getPreferredNetworkTypeBitmap(); method public int getRadioPowerState(); method public int getSimApplicationState(); method public int getSimCardState(); Loading Loading @@ -6178,6 +6179,7 @@ package android.telephony { method public void setDataActivationState(int); method public deprecated void setDataEnabled(int, boolean); method public void setDataRoamingEnabled(boolean); method public boolean setPreferredNetworkTypeBitmap(int); method public boolean setRadio(boolean); method public boolean setRadioPower(boolean); method public void setSimPowerState(int); Loading
telephony/java/android/telephony/TelephonyManager.java +64 −1 Original line number Diff line number Diff line Loading @@ -6382,8 +6382,9 @@ public class TelephonyManager { public @PrefNetworkMode int getPreferredNetworkType(int subId) { try { ITelephony telephony = getITelephony(); if (telephony != null) if (telephony != null) { return telephony.getPreferredNetworkType(subId); } } catch (RemoteException ex) { Rlog.e(TAG, "getPreferredNetworkType RemoteException", ex); } catch (NullPointerException ex) { Loading @@ -6392,6 +6393,37 @@ public class TelephonyManager { return -1; } /** * Get the preferred network type bitmap. * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()} * * <p>Requires Permission: * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE} * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). * * @return a 32-bit bitmap. * * @hide */ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @SystemApi public @NetworkTypeBitMask int getPreferredNetworkTypeBitmap() { try { ITelephony telephony = getITelephony(); if (telephony != null) { return RadioAccessFamily.getRafFromNetworkType( telephony.getPreferredNetworkType(getSubId())); } } catch (RemoteException ex) { Rlog.e(TAG, "getPreferredNetworkTypeBitmap RemoteException", ex); } catch (NullPointerException ex) { Rlog.e(TAG, "getPreferredNetworkTypeBitmap NPE", ex); } return 0; } /** * Sets the network selection mode to automatic. * Loading Loading @@ -6606,6 +6638,37 @@ public class TelephonyManager { return false; } /** * Set the preferred network type bitmap. * * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()} * * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling * app has carrier privileges (see {@link #hasCarrierPrivileges}). * * @param networkTypeBitmap a 32-bit bitmap. * @return true on success; false on any failure. * @hide */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @SystemApi public boolean setPreferredNetworkTypeBitmap(@NetworkTypeBitMask int networkTypeBitmap) { try { ITelephony telephony = getITelephony(); if (telephony != null) { return telephony.setPreferredNetworkType( getSubId(), RadioAccessFamily.getNetworkTypeFromRaf(networkTypeBitmap)); } } catch (RemoteException ex) { Rlog.e(TAG, "setPreferredNetworkType RemoteException", ex); } catch (NullPointerException ex) { Rlog.e(TAG, "setPreferredNetworkType NPE", ex); } return false; } /** * Set the preferred network type to global mode which includes LTE, CDMA, EvDo and GSM/WCDMA. * Loading