diff --git a/core/api/current.txt b/core/api/current.txt index 658d164a1f8ec..eb5ce84780353 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -43310,6 +43310,7 @@ package android.telephony { method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle); method public boolean isWorldPhone(); method @Deprecated public void listen(android.telephony.PhoneStateListener, int); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void rebootModem(); method public void registerTelephonyCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyCallback); method public void registerTelephonyCallback(boolean, boolean, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyCallback); method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void requestCellInfoUpdate(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CellInfoCallback); diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 3af71d54ad90d..9e17e8937a886 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -13256,7 +13256,7 @@ package android.telephony { method public boolean needsOtaServiceProvisioning(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void notifyOtaEmergencyNumberDbInstalled(); method @RequiresPermission(android.Manifest.permission.REBOOT) public int prepareForUnattendedReboot(); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean rebootRadio(); + method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean rebootRadio(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void removeCarrierPrivilegesListener(@NonNull android.telephony.TelephonyManager.CarrierPrivilegesListener); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void reportDefaultNetworkStatus(boolean); method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.MODIFY_PHONE_STATE}) public void requestCellInfoUpdate(@NonNull android.os.WorkSource, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CellInfoCallback); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index ba1a6edd74ad2..81bcf75a52144 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -7639,7 +7639,7 @@ 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 + * TODO: remove this one. use {@link #rebootModem()} 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 @@ -7706,6 +7706,8 @@ public class TelephonyManager { * * @return {@code true} on success; {@code false} on any failure. * + * @deprecated Using {@link #rebootModem()} instead. + * * @hide */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @@ -7725,6 +7727,30 @@ public class TelephonyManager { return false; } + /** + * Generate a radio modem reset. Used for device configuration by some carriers. + * + *

Requires Permission: + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling + * app has carrier privileges (see {@link #hasCarrierPrivileges}). + * @throws IllegalStateException if the Telephony process is not currently available. + * @throws RuntimeException + */ + @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) + public void rebootModem() { + try { + ITelephony telephony = getITelephony(); + if (telephony == null) { + throw new IllegalStateException("telephony service is null."); + } + telephony.rebootModem(getSlotIndex()); + } catch (RemoteException ex) { + Rlog.e(TAG, "rebootRadio RemoteException", ex); + throw ex.rethrowAsRuntimeException(); + } + } + /** * Return an appropriate subscription ID for any situation. *