Add get/set PreferredNetworkTypeBitmap
Bug: 111453000 Test: build Change-Id: Icbd3b2108ce8eb75e863dcf38fb8249c1e37ea91
This commit is contained in:
@@ -6097,6 +6097,7 @@ package android.telephony {
|
|||||||
method public boolean getEmergencyCallbackMode();
|
method public boolean getEmergencyCallbackMode();
|
||||||
method public java.lang.String getIsimDomain();
|
method public java.lang.String getIsimDomain();
|
||||||
method public int getPreferredNetworkType(int);
|
method public int getPreferredNetworkType(int);
|
||||||
|
method public int getPreferredNetworkTypeBitmap();
|
||||||
method public int getRadioPowerState();
|
method public int getRadioPowerState();
|
||||||
method public int getSimApplicationState();
|
method public int getSimApplicationState();
|
||||||
method public int getSimCardState();
|
method public int getSimCardState();
|
||||||
@@ -6125,6 +6126,7 @@ package android.telephony {
|
|||||||
method public void setDataActivationState(int);
|
method public void setDataActivationState(int);
|
||||||
method public deprecated void setDataEnabled(int, boolean);
|
method public deprecated void setDataEnabled(int, boolean);
|
||||||
method public void setDataRoamingEnabled(boolean);
|
method public void setDataRoamingEnabled(boolean);
|
||||||
|
method public boolean setPreferredNetworkTypeBitmap(int);
|
||||||
method public boolean setRadio(boolean);
|
method public boolean setRadio(boolean);
|
||||||
method public boolean setRadioPower(boolean);
|
method public boolean setRadioPower(boolean);
|
||||||
method public void setSimPowerState(int);
|
method public void setSimPowerState(int);
|
||||||
|
|||||||
@@ -6382,8 +6382,9 @@ public class TelephonyManager {
|
|||||||
public @PrefNetworkMode int getPreferredNetworkType(int subId) {
|
public @PrefNetworkMode int getPreferredNetworkType(int subId) {
|
||||||
try {
|
try {
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony != null)
|
if (telephony != null) {
|
||||||
return telephony.getPreferredNetworkType(subId);
|
return telephony.getPreferredNetworkType(subId);
|
||||||
|
}
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
Rlog.e(TAG, "getPreferredNetworkType RemoteException", ex);
|
Rlog.e(TAG, "getPreferredNetworkType RemoteException", ex);
|
||||||
} catch (NullPointerException ex) {
|
} catch (NullPointerException ex) {
|
||||||
@@ -6392,6 +6393,37 @@ public class TelephonyManager {
|
|||||||
return -1;
|
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.
|
* Sets the network selection mode to automatic.
|
||||||
*
|
*
|
||||||
@@ -6606,6 +6638,37 @@ public class TelephonyManager {
|
|||||||
return false;
|
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.
|
* Set the preferred network type to global mode which includes LTE, CDMA, EvDo and GSM/WCDMA.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user