Merge "refactor resetNv API to resetRadioConfig and rebootRadio"
This commit is contained in:
@@ -5308,6 +5308,8 @@ package android.telephony {
|
||||
method public boolean isVideoCallingEnabled();
|
||||
method public deprecated boolean isVisualVoicemailEnabled(android.telecom.PhoneAccountHandle);
|
||||
method public boolean needsOtaServiceProvisioning();
|
||||
method public boolean rebootRadio();
|
||||
method public boolean resetRadioConfig();
|
||||
method public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>);
|
||||
method public void setCarrierDataEnabled(boolean);
|
||||
method public void setDataActivationState(int);
|
||||
|
||||
@@ -20,6 +20,7 @@ import static android.content.Context.TELECOM_SERVICE;
|
||||
|
||||
import static com.android.internal.util.Preconditions.checkNotNull;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.RequiresPermission;
|
||||
@@ -5121,6 +5122,9 @@ public class TelephonyManager {
|
||||
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling
|
||||
* app has carrier privileges (see {@link #hasCarrierPrivileges}).
|
||||
*
|
||||
* TODO: remove this one. use {@link #rebootRadio()} for reset type 1 and
|
||||
* {@link #resetRadioConfig()} for reset type 3
|
||||
*
|
||||
* @param resetType reset type: 1: reload NV reset, 2: erase NV reset, 3: factory NV reset
|
||||
* @return true on success; false on any failure.
|
||||
*
|
||||
@@ -5130,8 +5134,15 @@ public class TelephonyManager {
|
||||
public boolean nvResetConfig(int resetType) {
|
||||
try {
|
||||
ITelephony telephony = getITelephony();
|
||||
if (telephony != null)
|
||||
return telephony.nvResetConfig(resetType);
|
||||
if (telephony != null) {
|
||||
if (resetType == 1 /*1: reload NV reset */) {
|
||||
return telephony.rebootModem(getSlotIndex());
|
||||
} else if (resetType == 3 /*3: factory NV reset */) {
|
||||
return telephony.resetModemConfig(getSlotIndex());
|
||||
} else {
|
||||
Rlog.e(TAG, "nvResetConfig unsupported reset type");
|
||||
}
|
||||
}
|
||||
} catch (RemoteException ex) {
|
||||
Rlog.e(TAG, "nvResetConfig RemoteException", ex);
|
||||
} catch (NullPointerException ex) {
|
||||
@@ -5140,6 +5151,61 @@ public class TelephonyManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rollback modem configurations to factory default except some config which are in whitelist.
|
||||
* Used for device configuration by some CDMA operators.
|
||||
*
|
||||
* <p>Requires Permission:
|
||||
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling
|
||||
* app has carrier privileges (see {@link #hasCarrierPrivileges}).
|
||||
*
|
||||
* @return {@code true} on success; {@code false} on any failure.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
|
||||
@SystemApi
|
||||
public boolean resetRadioConfig() {
|
||||
try {
|
||||
ITelephony telephony = getITelephony();
|
||||
if (telephony != null) {
|
||||
return telephony.resetModemConfig(getSlotIndex());
|
||||
}
|
||||
} catch (RemoteException ex) {
|
||||
Rlog.e(TAG, "resetRadioConfig RemoteException", ex);
|
||||
} catch (NullPointerException ex) {
|
||||
Rlog.e(TAG, "resetRadioConfig NPE", ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a radio modem reset. Used for device configuration by some CDMA operators.
|
||||
*
|
||||
* <p>Requires Permission:
|
||||
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling
|
||||
* app has carrier privileges (see {@link #hasCarrierPrivileges}).
|
||||
*
|
||||
* @return {@code true} on success; {@code false} on any failure.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
|
||||
@SystemApi
|
||||
public boolean rebootRadio() {
|
||||
try {
|
||||
ITelephony telephony = getITelephony();
|
||||
if (telephony != null) {
|
||||
return telephony.rebootModem(getSlotIndex());
|
||||
}
|
||||
} catch (RemoteException ex) {
|
||||
Rlog.e(TAG, "rebootRadio RemoteException", ex);
|
||||
} catch (NullPointerException ex) {
|
||||
Rlog.e(TAG, "rebootRadio NPE", ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an appropriate subscription ID for any situation.
|
||||
*
|
||||
|
||||
@@ -638,15 +638,30 @@ interface ITelephony {
|
||||
boolean nvWriteCdmaPrl(in byte[] preferredRoamingList);
|
||||
|
||||
/**
|
||||
* Perform the specified type of NV config reset. The radio will be taken offline
|
||||
* and the device must be rebooted after the operation. Used for device
|
||||
* configuration by some CDMA operators.
|
||||
* Rollback modem configurations to factory default except some config which are in whitelist.
|
||||
* Used for device configuration by some CDMA operators.
|
||||
*
|
||||
* @param resetType the type of reset to perform (1 == factory reset; 2 == NV-only reset).
|
||||
* @return true on success; false on any failure.
|
||||
* <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 slotIndex - device slot.
|
||||
* @return {@code true} on success; {@code false} on any failure.
|
||||
*/
|
||||
boolean nvResetConfig(int resetType);
|
||||
boolean resetModemConfig(int slotIndex);
|
||||
|
||||
/**
|
||||
* Generate a radio modem reset. Used for device configuration by some CDMA operators.
|
||||
* Different than {@link #setRadioPower(boolean)}, modem reboot will power down sim card.
|
||||
*
|
||||
* <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 slotIndex - device slot.
|
||||
* @return {@code true} on success; {@code false} on any failure.
|
||||
*/
|
||||
boolean rebootModem(int slotIndex);
|
||||
/*
|
||||
* Get the calculated preferred network type.
|
||||
* Used for device configuration by some CDMA operators.
|
||||
|
||||
Reference in New Issue
Block a user