diff options
| author | 2023-09-17 23:18:03 +0000 | |
|---|---|---|
| committer | 2023-12-20 03:00:31 +0000 | |
| commit | f0a736627cd7548dddfd75f13e95ad8bfccc8b65 (patch) | |
| tree | 53c4ce2d5ffbdb7b233954e6c068cc29443e7c14 | |
| parent | 9b7b17eedf3dd6e0b401d8c6b9e45b8e423af6cc (diff) | |
Enforce map the telephony features with APIs in TelephonyManager
Add/remove/modify @RerequiredFeature.
Add comment the interface throws UnsupportedOperationException when the required feature was not defined.
Bug: 297989574
Test: atest TelephonyManagerTest
Change-Id: I2a0a8df501662184621a530c80c7ee054e9e9aba
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 834 |
1 files changed, 813 insertions, 21 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index f8166e58cd2f..d3cfa999c864 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -510,7 +510,7 @@ public class TelephonyManager { /** @hide */ @UnsupportedAppUsage public TelephonyManager(Context context) { - this(context, SubscriptionManager.DEFAULT_SUBSCRIPTION_ID); + this(context, SubscriptionManager.DEFAULT_SUBSCRIPTION_ID); } /** @hide */ @@ -2126,10 +2126,14 @@ public class TelephonyManager { * the IMEI/SV for GSM phones. Return null if the software version is * not available. * <p> + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY}. */ @RequiresPermission(anyOf = { android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.READ_BASIC_PHONE_STATE}) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY) @Nullable public String getDeviceSoftwareVersion() { return getDeviceSoftwareVersion(getSlotIndex()); @@ -2144,10 +2148,13 @@ public class TelephonyManager { * * @param slotIndex of which deviceID is returned * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY}. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY) @Nullable public String getDeviceSoftwareVersion(int slotIndex) { ITelephony telephony = getITelephony(); @@ -2274,6 +2281,9 @@ public class TelephonyManager { * * See {@link #getImei(int)} for details on the required permissions and behavior * when the caller does not hold sufficient permissions. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_GSM}. */ @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @@ -2316,6 +2326,9 @@ public class TelephonyManager { * </ul> * * @param slotIndex of which IMEI is returned + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_GSM}. */ @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @@ -2336,6 +2349,9 @@ public class TelephonyManager { /** * Returns the Type Allocation Code from the IMEI. Return null if Type Allocation Code is not * available. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_GSM}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_GSM) @Nullable @@ -2348,6 +2364,9 @@ public class TelephonyManager { * available. * * @param slotIndex of which Type Allocation Code is returned + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_GSM}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_GSM) @Nullable @@ -2393,6 +2412,9 @@ public class TelephonyManager { * the READ_PHONE_STATE permission, or if the calling app is targeting API level 29 or * higher, then a SecurityException is thrown.</li> * </ul> + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CDMA}. */ @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @@ -2432,6 +2454,9 @@ public class TelephonyManager { * </ul> * * @param slotIndex of which MEID is returned + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CDMA}. */ @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @@ -2458,6 +2483,9 @@ public class TelephonyManager { /** * Returns the Manufacturer Code from the MEID. Return null if Manufacturer Code is not * available. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CDMA}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CDMA) @Nullable @@ -2470,6 +2498,9 @@ public class TelephonyManager { * available. * * @param slotIndex of which Type Allocation Code is returned + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CDMA}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CDMA) @Nullable @@ -2514,6 +2545,9 @@ public class TelephonyManager { * the READ_PHONE_STATE permission, or if the calling app is targeting API level 29 or * higher, then a SecurityException is thrown.</li> * </ul> + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @@ -2549,10 +2583,14 @@ public class TelephonyManager { *<p> * @return Current location of the device or null if not available. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. + * * @deprecated use {@link #getAllCellInfo} instead, which returns a superset of this API. */ @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) public CellLocation getCellLocation() { try { ITelephony telephony = getITelephony(); @@ -2582,12 +2620,15 @@ public class TelephonyManager { * * @return List of NeighboringCellInfo or null if info unavailable. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @removed * @deprecated Use {@link #getAllCellInfo} which returns a superset of the information * from NeighboringCellInfo, including LTE cell information. */ @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) public List<NeighboringCellInfo> getNeighboringCellInfo() { try { ITelephony telephony = getITelephony(); @@ -2634,9 +2675,12 @@ public class TelephonyManager { * @see #PHONE_TYPE_CDMA * @see #PHONE_TYPE_SIP * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY}. * {@hide} */ @SystemApi + @RequiresFeature(PackageManager.FEATURE_TELEPHONY) public int getCurrentPhoneType() { return getCurrentPhoneType(getSubId()); } @@ -2649,9 +2693,13 @@ public class TelephonyManager { * @see #PHONE_TYPE_CDMA * * @param subId for which phone type is returned + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY}. * @hide */ @SystemApi + @RequiresFeature(PackageManager.FEATURE_TELEPHONY) public int getCurrentPhoneType(int subId) { int phoneId; if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) { @@ -2698,7 +2746,11 @@ public class TelephonyManager { * @see #PHONE_TYPE_GSM * @see #PHONE_TYPE_CDMA * @see #PHONE_TYPE_SIP + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY}. */ + @RequiresFeature(PackageManager.FEATURE_TELEPHONY) public int getPhoneType() { if (!isVoiceCapable()) { return PHONE_TYPE_NONE; @@ -2898,6 +2950,9 @@ public class TelephonyManager { * @see CarrierConfigManager#getConfigForSubId(int) * @see #createForSubscriptionId(int) * @see #createForPhoneAccountHandle(PhoneAccountHandle) + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @WorkerThread @@ -2944,6 +2999,9 @@ public class TelephonyManager { * <p> * @return the lowercase 2 character ISO-3166-1 alpha-2 country code, or empty string if not * available. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) public String getNetworkCountryIso() { @@ -2966,6 +3024,8 @@ public class TelephonyManager { * available. * * @throws IllegalArgumentException when the slotIndex is invalid. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) @@ -3094,9 +3154,13 @@ public class TelephonyManager { * * @deprecated use {@link #getDataNetworkType()} * @return the NETWORK_TYPE_xxxx for current data connection. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) public @NetworkType int getNetworkType() { return getNetworkType(getSubId(SubscriptionManager.getActiveDataSubscriptionId())); } @@ -3185,12 +3249,15 @@ public class TelephonyManager { * @see #NETWORK_TYPE_EHRPD * @see #NETWORK_TYPE_HSPAP * @see #NETWORK_TYPE_NR + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(anyOf = { android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.READ_BASIC_PHONE_STATE}) - @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) public @NetworkType int getDataNetworkType() { return getDataNetworkType(getSubId(SubscriptionManager.getActiveDataSubscriptionId())); } @@ -3231,6 +3298,9 @@ public class TelephonyManager { * or {@link android.Manifest.permission#READ_BASIC_PHONE_STATE * READ_BASIC_PHONE_STATE} or that the calling app has carrier privileges * (see {@link #hasCarrierPrivileges}). + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(anyOf = { @@ -3583,6 +3653,9 @@ public class TelephonyManager { * of whether an active SIM profile is present or not so this API would always return true. * * @return true if a ICC card is present. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public boolean hasIccCard() { @@ -3626,6 +3699,9 @@ public class TelephonyManager { * @see #SIM_STATE_PERM_DISABLED * @see #SIM_STATE_CARD_IO_ERROR * @see #SIM_STATE_CARD_RESTRICTED + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public @SimState int getSimState() { @@ -3667,6 +3743,8 @@ public class TelephonyManager { * @see #SIM_STATE_CARD_RESTRICTED * @see #SIM_STATE_PRESENT * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -3687,11 +3765,14 @@ public class TelephonyManager { * @see #SIM_STATE_CARD_RESTRICTED * @see #SIM_STATE_PRESENT * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide * @deprecated instead use {@link #getSimCardState(int, int)} */ @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @Deprecated public @SimState int getSimCardState(int physicalSlotIndex) { int activePort = getFirstActivePortIndex(physicalSlotIndex); @@ -3713,6 +3794,8 @@ public class TelephonyManager { * @see #SIM_STATE_CARD_RESTRICTED * @see #SIM_STATE_PRESENT * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -3771,6 +3854,8 @@ public class TelephonyManager { * @see #SIM_STATE_PERM_DISABLED * @see #SIM_STATE_LOADED * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -3794,11 +3879,14 @@ public class TelephonyManager { * @see #SIM_STATE_PERM_DISABLED * @see #SIM_STATE_LOADED * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide * @deprecated instead use {@link #getSimApplicationState(int, int)} */ @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @Deprecated public @SimState int getSimApplicationState(int physicalSlotIndex) { int activePort = getFirstActivePortIndex(physicalSlotIndex); @@ -3822,6 +3910,8 @@ public class TelephonyManager { * @see #SIM_STATE_PERM_DISABLED * @see #SIM_STATE_LOADED * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -3862,6 +3952,9 @@ public class TelephonyManager { * * @param appType the uicc app type like {@link APPTYPE_CSIM} * @return true if the specified type of application in UICC CARD or false if no uicc or error. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -3894,6 +3987,9 @@ public class TelephonyManager { * @see #SIM_STATE_PERM_DISABLED * @see #SIM_STATE_CARD_IO_ERROR * @see #SIM_STATE_CARD_RESTRICTED + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public @SimState int getSimState(int slotIndex) { @@ -4091,6 +4187,9 @@ public class TelephonyManager { * the READ_PHONE_STATE permission, or if the calling app is targeting API level 29 or * higher, then a SecurityException is thrown.</li> * </ul> + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @@ -4158,6 +4257,9 @@ public class TelephonyManager { * * @return {@code true} if 3GPP and 3GPP2 radio technologies can be supported at the same time * {@code false} if not supported or unknown + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @SystemApi @@ -4205,6 +4307,9 @@ public class TelephonyManager { * through a factory reset. * * @return card ID of the default eUICC card, if loaded. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_EUICC}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_EUICC) public int getCardIdForDefaultEuicc() { @@ -4238,6 +4343,9 @@ public class TelephonyManager { * @return a list of UiccCardInfo objects, representing information on the currently inserted * UICCs and eUICCs. Each UiccCardInfo in the list will have private information filtered out if * the caller does not have adequate permissions for that card. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @@ -4262,6 +4370,8 @@ public class TelephonyManager { * * @return UiccSlotInfo array. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -4305,6 +4415,9 @@ public class TelephonyManager { * @param physicalSlots The content of the array represents the physical slot index. The array * size should be same as {@link #getUiccSlotsInfo()}. * @return boolean Return true if the switch succeeds, false if the switch fails. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide * @deprecated {@link #setSimSlotMapping(Collection, Executor, Consumer)} */ @@ -4314,6 +4427,7 @@ public class TelephonyManager { @SystemApi @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public boolean switchSlots(int[] physicalSlots) { try { ITelephony telephony = getITelephony(); @@ -4406,6 +4520,8 @@ public class TelephonyManager { * @throws IllegalArgumentException if the caller passes in an invalid collection of * UiccSlotMapping like duplicate data, etc * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -4438,11 +4554,14 @@ public class TelephonyManager { * @return a map indicates the mapping from logical slots to physical slots. The size of the map * should be {@link #getPhoneCount()} if success, otherwise return an empty map. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide * @deprecated use {@link #getSimSlotMapping()} instead. */ @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @NonNull @Deprecated public Map<Integer, Integer> getLogicalToPhysicalSlotMapping() { @@ -4470,6 +4589,9 @@ public class TelephonyManager { * * @return a collection of {@link UiccSlotMapping} which indicates the mapping from logical * slots to ports and physical slots. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -4527,6 +4649,9 @@ public class TelephonyManager { * the READ_PHONE_STATE permission, or if the calling app is targeting API level 29 or * higher, then a SecurityException is thrown.</li> * </ul> + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @@ -4579,6 +4704,8 @@ public class TelephonyManager { * found, and the carrier does not require a key. * @throws IllegalArgumentException when an invalid key is found or when key is required but * not found. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @@ -4624,6 +4751,9 @@ public class TelephonyManager { * Requires Permission: MODIFY_PHONE_STATE. * * @see #getCarrierInfoForImsiEncryption + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @@ -4826,6 +4956,9 @@ public class TelephonyManager { * from disk, as well as on which {@code callback} will be called. * @param callback A callback called when the upload operation terminates, either in success * or in error. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public void uploadCallComposerPicture(@NonNull Path pictureToUpload, @@ -4933,6 +5066,9 @@ public class TelephonyManager { * read, as well as on which the callback will be called. * @param callback A callback called when the upload operation terminates, either in success * or in error. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public void uploadCallComposerPicture(@NonNull InputStream pictureToUpload, @@ -5067,6 +5203,9 @@ public class TelephonyManager { * * <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @@ -5125,6 +5264,8 @@ public class TelephonyManager { * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} * for apps targeting SDK API level 29 and below. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @deprecated use {@link SubscriptionManager#getPhoneNumber(int)} instead. */ @Deprecated @@ -5134,6 +5275,7 @@ public class TelephonyManager { android.Manifest.permission.READ_SMS, android.Manifest.permission.READ_PHONE_NUMBERS }) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public String getLine1Number() { return getLine1Number(getSubId()); } @@ -5200,9 +5342,13 @@ public class TelephonyManager { * @param alphaTag alpha-tagging of the dailing nubmer * @param number The dialing number * @return true if the operation was executed correctly. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @deprecated use {@link SubscriptionManager#setCarrierPhoneNumber(int, String)} instead. */ @Deprecated + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public boolean setLine1NumberForDisplay(String alphaTag, String number) { return setLine1NumberForDisplay(getSubId(), alphaTag, number); } @@ -5322,6 +5468,8 @@ public class TelephonyManager { * {@link SubscriptionManager#createSubscriptionGroup(List)} for the definition of a group, * otherwise return an empty array if there is a failure. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -5407,6 +5555,9 @@ public class TelephonyManager { * * <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @@ -5445,6 +5596,9 @@ public class TelephonyManager { * * @param alphaTag The alpha tag to display. * @param number The voicemail number. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public boolean setVoiceMailNumber(String alphaTag, String number) { @@ -5519,6 +5673,8 @@ public class TelephonyManager { * @see #KEY_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL * @see #KEY_VOICEMAIL_SCRAMBLED_PIN_STRING * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. * @hide */ @SystemApi @@ -5549,6 +5705,9 @@ public class TelephonyManager { * @see #createForSubscriptionId(int) * @see #createForPhoneAccountHandle(PhoneAccountHandle) * @see VisualVoicemailService + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @Nullable @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @@ -5579,6 +5738,9 @@ public class TelephonyManager { * * @see TelecomManager#getDefaultDialerPackage() * @see CarrierConfigManager#KEY_CARRIER_VVM_PACKAGE_NAME_STRING_ARRAY + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public void setVisualVoicemailSmsFilterSettings(VisualVoicemailSmsFilterSettings settings) { @@ -5609,6 +5771,9 @@ public class TelephonyManager { * * @see SmsManager#sendDataMessage(String, String, short, byte[], PendingIntent, PendingIntent) * @see SmsManager#sendTextMessage(String, String, String, PendingIntent, PendingIntent) + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public void sendVisualVoicemailSms(String number, int port, String text, @@ -5794,6 +5959,9 @@ public class TelephonyManager { * @see #SIM_ACTIVATION_STATE_ACTIVATING * @see #SIM_ACTIVATION_STATE_ACTIVATED * @see #SIM_ACTIVATION_STATE_DEACTIVATED + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING} * @hide */ @SystemApi @@ -5842,6 +6010,9 @@ public class TelephonyManager { * @see #SIM_ACTIVATION_STATE_ACTIVATED * @see #SIM_ACTIVATION_STATE_DEACTIVATED * @see #SIM_ACTIVATION_STATE_RESTRICTED + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. * @hide */ @SystemApi @@ -5890,6 +6061,9 @@ public class TelephonyManager { * @see #SIM_ACTIVATION_STATE_ACTIVATING * @see #SIM_ACTIVATION_STATE_ACTIVATED * @see #SIM_ACTIVATION_STATE_DEACTIVATED + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. * @hide */ @SystemApi @@ -5940,6 +6114,9 @@ public class TelephonyManager { * @see #SIM_ACTIVATION_STATE_ACTIVATED * @see #SIM_ACTIVATION_STATE_DEACTIVATED * @see #SIM_ACTIVATION_STATE_RESTRICTED + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. * @hide */ @SystemApi @@ -6018,6 +6195,9 @@ public class TelephonyManager { * * <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @@ -6058,7 +6238,10 @@ public class TelephonyManager { * * @throws SecurityException if the caller does not have carrier privileges or is not the * current default dialer + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public void sendDialerSpecialCode(String inputCode) { try { final ITelephony telephony = getITelephony(); @@ -6129,6 +6312,9 @@ public class TelephonyManager { * * <p>Requires Permission: * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE} + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @Nullable @@ -6154,6 +6340,9 @@ public class TelephonyManager { * Returns the IMS public user identities (IMPU) that were loaded from the ISIM. * @return an array of IMPU strings, with one IMPU per string, or null if * not present or not loaded + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide * @deprecated use {@link #getImsPublicUserIdentities()} */ @@ -6185,6 +6374,8 @@ public class TelephonyManager { * EF_IMPU is not available. * @throws IllegalStateException in case the ISIM hasn’t been loaded * @throws SecurityException if the caller does not have the required permission/privilege + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @NonNull @@ -6240,6 +6431,10 @@ public class TelephonyManager { * targeting API level 31+. * * @return the current call state. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELECOM}. + * * @deprecated Use {@link #getCallStateForSubscription} to retrieve the call state for a * specific telephony subscription (which allows carrier privileged apps), * {@link TelephonyCallback.CallStateListener} for real-time call state updates, or @@ -6247,6 +6442,7 @@ public class TelephonyManager { * device. */ @RequiresPermission(value = android.Manifest.permission.READ_PHONE_STATE, conditional = true) + @RequiresFeature(PackageManager.FEATURE_TELECOM) @Deprecated public @CallState int getCallState() { if (mContext != null) { @@ -6267,6 +6463,9 @@ public class TelephonyManager { * @see TelephonyManager#createForSubscriptionId(int) * @see TelephonyManager#createForPhoneAccountHandle(PhoneAccountHandle) * @return The call state of the subscription associated with this TelephonyManager instance. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) @@ -6327,6 +6526,9 @@ public class TelephonyManager { * @see #DATA_ACTIVITY_OUT * @see #DATA_ACTIVITY_INOUT * @see #DATA_ACTIVITY_DORMANT + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) public int getDataActivity() { @@ -6400,6 +6602,9 @@ public class TelephonyManager { * @see #DATA_SUSPENDED * @see #DATA_DISCONNECTING * @see #DATA_HANDOVER_IN_PROGRESS + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) public int getDataState() { @@ -6585,10 +6790,14 @@ public class TelephonyManager { * Returns the CDMA ERI icon display number. The number is assigned by * 3GPP2 C.R1001-H v1.0 Table 8.1-1. Additionally carriers define their own ERI display numbers. * Defined values are {@link #ERI_ON}, {@link #ERI_OFF}, and {@link #ERI_FLASH}. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CDMA}. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CDMA) public @EriIconIndex int getCdmaEnhancedRoamingIndicatorDisplayNumber() { return getCdmaEriIconIndex(getSubId()); } @@ -6748,6 +6957,9 @@ public class TelephonyManager { * * @return List of {@link android.telephony.CellInfo}; null if cell * information is unavailable. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) @@ -6843,6 +7055,9 @@ public class TelephonyManager { * * @param executor the executor on which callback will be invoked. * @param callback a callback to receive CellInfo. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) @@ -6904,6 +7119,9 @@ public class TelephonyManager { * @param workSource the requestor to whom the power consumption for this should be attributed. * @param executor the executor on which callback will be invoked. * @param callback a callback to receive CellInfo. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @SystemApi @@ -6990,6 +7208,9 @@ public class TelephonyManager { /** * Returns the MMS user agent. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_MESSAGING}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_MESSAGING) public String getMmsUserAgent() { @@ -7006,6 +7227,9 @@ public class TelephonyManager { /** * Returns the MMS user agent profile URL. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_MESSAGING}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_MESSAGING) public String getMmsUAProfUrl() { @@ -7049,8 +7273,12 @@ public class TelephonyManager { * * @param AID Application id. See ETSI 102.221 and 101.220. * @return an IccOpenLogicalChannelResponse object. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @deprecated Replaced by {@link #iccOpenLogicalChannel(String, int)} */ + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @Deprecated public IccOpenLogicalChannelResponse iccOpenLogicalChannel(String AID) { return iccOpenLogicalChannel(getSubId(), AID, -1); @@ -7083,6 +7311,8 @@ public class TelephonyManager { * @param aid Application id. See ETSI 102.221 and 101.220. * @param p2 P2 parameter (described in ISO 7816-4). * @return an IccOpenLogicalChannelResponse object. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide * @deprecated This API is not compatible on eUICC supporting Multiple Enabled Profile(MEP), * instead use {@link #iccOpenLogicalChannelByPort(int, int, String, int)} @@ -7138,9 +7368,13 @@ public class TelephonyManager { * @param aid Application id. See ETSI 102.221 and 101.220. * @param p2 P2 parameter (described in ISO 7816-4). * @return an IccOpenLogicalChannelResponse object. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @SystemApi @NonNull public IccOpenLogicalChannelResponse iccOpenLogicalChannelByPort(int slotIndex, @@ -7193,6 +7427,9 @@ public class TelephonyManager { * @param AID Application id. See ETSI 102.221 and 101.220. * @param p2 P2 parameter (described in ISO 7816-4). * @return an IccOpenLogicalChannelResponse object. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public IccOpenLogicalChannelResponse iccOpenLogicalChannel(String AID, int p2) { @@ -7259,6 +7496,9 @@ public class TelephonyManager { * @param channel is the channel id to be closed as returned by a successful * iccOpenLogicalChannel. * @return true if the channel was closed successfully. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide * @deprecated This API is not compatible on eUICC supporting Multiple Enabled Profile(MEP), * instead use {@link #iccCloseLogicalChannelByPort(int, int, int)} @@ -7303,9 +7543,12 @@ public class TelephonyManager { * @throws IllegalStateException if the Telephony process is not currently available or modem * currently can't process this command. * @throws IllegalArgumentException if invalid arguments are passed. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @SystemApi public void iccCloseLogicalChannelByPort(int slotIndex, int portIndex, int channel) { try { @@ -7341,6 +7584,8 @@ public class TelephonyManager { * iccOpenLogicalChannel. * @return true if the channel was closed successfully. * @throws IllegalArgumentException if input parameters are wrong. e.g., invalid channel + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public boolean iccCloseLogicalChannel(int channel) { @@ -7407,6 +7652,8 @@ public class TelephonyManager { * @param data Data to be sent with the APDU. * @return The APDU response from the ICC card with the status appended at the end, or null if * there is an issue connecting to the Telephony service. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide * @deprecated This API is not compatible on eUICC supporting Multiple Enabled Profile(MEP), * instead use @@ -7454,9 +7701,13 @@ public class TelephonyManager { * @param data Data to be sent with the APDU. * @return The APDU response from the ICC card with the status appended at the end, or null if * there is an issue connecting to the Telephony service. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @SystemApi @NonNull public String iccTransmitApduLogicalChannelByPort(int slotIndex, int portIndex, int channel, @@ -7501,6 +7752,9 @@ public class TelephonyManager { * @param data Data to be sent with the APDU. * @return The APDU response from the ICC card with the status appended at * the end. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public String iccTransmitApduLogicalChannel(int channel, int cla, @@ -7566,6 +7820,9 @@ public class TelephonyManager { * @param data Data to be sent with the APDU. * @return The APDU response from the ICC card with the status appended at * the end. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide * @deprecated This API is not compatible on eUICC supporting Multiple Enabled Profile(MEP), * instead use @@ -7611,9 +7868,13 @@ public class TelephonyManager { * @param data Data to be sent with the APDU. * @return The APDU response from the ICC card with the status appended at * the end. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @SystemApi @NonNull public String iccTransmitApduBasicChannelByPort(int slotIndex, int portIndex, int cla, @@ -7650,6 +7911,9 @@ public class TelephonyManager { * @param data Data to be sent with the APDU. * @return The APDU response from the ICC card with the status appended at * the end. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public String iccTransmitApduBasicChannel(int cla, @@ -7706,6 +7970,9 @@ public class TelephonyManager { * @param p3 P3 value of the APDU command. * @param filePath * @return The APDU response. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public byte[] iccExchangeSimIO(int fileID, int command, int p1, int p2, int p3, @@ -7755,6 +8022,9 @@ public class TelephonyManager { * @return The APDU response from the ICC card in hexadecimal format * with the last 4 bytes being the status word. If the command fails, * returns an empty string. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public String sendEnvelopeWithStatus(String content) { @@ -7916,6 +8186,8 @@ public class TelephonyManager { * * @return {@code true} on success; {@code false} on any failure. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @@ -7946,6 +8218,8 @@ public class TelephonyManager { * * @deprecated Using {@link #rebootModem()} instead. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @@ -7973,6 +8247,8 @@ public class TelephonyManager { * app has carrier privileges (see {@link #hasCarrierPrivileges}). * @throws IllegalStateException if the Telephony process is not currently available. * @throws RuntimeException + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) @@ -8104,6 +8380,9 @@ public class TelephonyManager { * {@link #getMaxNumberVerificationTimeoutMillis()}, whichever is lesser. * @param executor The {@link Executor} that callbacks should be executed on. * @param callback The callback to use for delivering results. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @SystemApi @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @@ -8316,6 +8595,9 @@ public class TelephonyManager { * See 3GPP TS 31.103 (Section 4.2.7) for the definition and more information on this table. * * @return IMS Service Table or null if not present or not loaded + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @Nullable @@ -8434,6 +8716,9 @@ public class TelephonyManager { * Key freshness failure * Authentication error, no memory space available * Authentication error, no memory space available in EFMUK + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ // TODO(b/73660190): This should probably require MODIFY_PHONE_STATE, not // READ_PRIVILEGED_PHONE_STATE. It certainly shouldn't reference the permission in Javadoc since @@ -8490,6 +8775,9 @@ public class TelephonyManager { * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). * * @return an array of forbidden PLMNs or null if not available + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @@ -8540,6 +8828,9 @@ public class TelephonyManager { * @return number of PLMNs that were successfully written to the SIM FPLMN list. * This may be less than the number of PLMNs passed in where the SIM file does not have enough * room for all of the values passed in. Return -1 in the event of an unexpected failure + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @@ -8575,6 +8866,8 @@ public class TelephonyManager { * @param appType of type int of either {@link #APPTYPE_USIM} or {@link #APPTYPE_ISIM}. * @return HexString represents sim service table else null. * @throws SecurityException if the caller does not have the required permission/privileges + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @@ -8611,6 +8904,9 @@ public class TelephonyManager { * state. * * @param slotIndex the sim slot to reset the IMS stack on. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_IMS}. * @hide */ @SystemApi @WorkerThread @@ -9022,12 +9318,15 @@ public class TelephonyManager { * * @return The bitmask of preferred network types. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide * @deprecated Use {@link #getAllowedNetworkTypesBitmask} instead. */ @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @SystemApi + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) public @NetworkTypeBitMask long getPreferredNetworkTypeBitmask() { return getAllowedNetworkTypesBitmask(); } @@ -9046,6 +9345,8 @@ public class TelephonyManager { * * @return The bitmask of allowed network types. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @@ -9071,10 +9372,14 @@ public class TelephonyManager { * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). * * @return the allowed network type bitmask + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide * @deprecated Use {@link #getAllowedNetworkTypesForReason} instead. */ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) @SystemApi @Deprecated public @NetworkTypeBitMask long getAllowedNetworkTypes() { @@ -9099,6 +9404,9 @@ public class TelephonyManager { * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling * app has carrier privileges (see {@link #hasCarrierPrivileges}). + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @@ -9185,6 +9493,9 @@ public class TelephonyManager { * tasks one at a time in serial order. * @param callback Returns network scan results or errors. * @return A NetworkScan obj which contains a callback which can be used to stop the scan. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(allOf = { @@ -9233,11 +9544,15 @@ public class TelephonyManager { * tasks one at a time in serial order. * @param callback Returns network scan results or errors. * @return A NetworkScan obj which contains a callback which can be used to stop the scan. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(allOf = { android.Manifest.permission.MODIFY_PHONE_STATE }) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) public @Nullable NetworkScan requestNetworkScan( @IncludeLocationData int includeLocationData, @NonNull NetworkScanRequest request, @@ -9255,6 +9570,9 @@ public class TelephonyManager { } /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. + * * @deprecated * Use {@link * #requestNetworkScan(NetworkScanRequest, Executor, TelephonyScanManager.NetworkScanCallback)} @@ -9265,6 +9583,7 @@ public class TelephonyManager { android.Manifest.permission.MODIFY_PHONE_STATE, Manifest.permission.ACCESS_FINE_LOCATION }) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) public NetworkScan requestNetworkScan( NetworkScanRequest request, TelephonyScanManager.NetworkScanCallback callback) { return requestNetworkScan(request, AsyncTask.SERIAL_EXECUTOR, callback); @@ -9285,6 +9604,9 @@ public class TelephonyManager { * attaching to the selected PLMN until reboot; otherwise, attach to the chosen PLMN and resume * normal network selection next time. * @return {@code true} on success; {@code false} on any failure. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @@ -9316,6 +9638,9 @@ public class TelephonyManager { * {@link AccessNetworkConstants.AccessNetworkType#UNKNOWN}, modem will select * the next best RAN for network registration. * @return {@code true} on success; {@code false} on any failure. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) @@ -9368,6 +9693,9 @@ public class TelephonyManager { * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). * * @return the network selection mode. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @SuppressAutoDoc // No support for carrier privileges (b/72967236). @RequiresPermission(anyOf = { @@ -9397,6 +9725,9 @@ public class TelephonyManager { * (see {@link #hasCarrierPrivileges}) * * @return manually selected network info on success or empty string on failure + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @SuppressAutoDoc // No support carrier privileges (b/72967236). @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) @@ -9426,6 +9757,8 @@ public class TelephonyManager { * * @return {@code true} if this device is in emergency SMS mode, {@code false} otherwise. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_MESSAGING}. * @hide */ @SystemApi @@ -9495,11 +9828,15 @@ public class TelephonyManager { * * @param networkTypeBitmask The bitmask of preferred network types. * @return true on success; false on any failure. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide * @deprecated Use {@link #setAllowedNetworkTypesForReason} instead. */ @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) @SystemApi public boolean setPreferredNetworkTypeBitmask(@NetworkTypeBitMask long networkTypeBitmask) { try { @@ -9541,6 +9878,10 @@ public class TelephonyManager { * * @param allowedNetworkTypes The bitmask of allowed network types. * @return true on success; false on any failure. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. + * * @hide * @deprecated Use {@link #setAllowedNetworkTypesForReason} instead with reason * {@link #ALLOWED_NETWORK_TYPES_REASON_CARRIER}. @@ -9628,11 +9969,16 @@ public class TelephonyManager { * @throws IllegalStateException if the Telephony process is not currently available. * @throws IllegalArgumentException if invalid AllowedNetworkTypesReason is passed. * @throws SecurityException if the caller does not have the required privileges or if the + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * caller tries to use one of the following security-based reasons without * {@link android.Manifest.permission#MODIFY_PHONE_STATE} permissions. * <ol> * <li>{@code TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G}</li> * </ol> + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature( @@ -9672,6 +10018,8 @@ public class TelephonyManager { * @throws IllegalStateException if the Telephony process is not currently available. * @throws IllegalArgumentException if invalid AllowedNetworkTypesReason is passed. * @throws SecurityException if the caller does not have the required permission/privileges + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresFeature( @@ -9746,6 +10094,9 @@ public class TelephonyManager { * <p>Requires that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). * * @return true on success; false on any failure. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) public boolean setPreferredNetworkTypeToGlobal() { @@ -9771,6 +10122,9 @@ public class TelephonyManager { * Requires Permission: MODIFY_PHONE_STATE. * * @return {@code true} if DUN APN is required for tethering. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. * @hide */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @@ -9824,6 +10178,9 @@ public class TelephonyManager { * is a superset of the checks done in SubscriptionManager#canManageSubscription. * * @return true if the app has carrier privileges. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public boolean hasCarrierPrivileges() { @@ -9871,6 +10228,9 @@ public class TelephonyManager { * * @param brand The brand name to display/set. * @return true if the operation was executed correctly. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public boolean setOperatorBrandOverride(String brand) { @@ -9972,7 +10332,11 @@ public class TelephonyManager { * Expose the rest of ITelephony to @SystemApi */ - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CDMA}. + * @hide + */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CDMA) @@ -9980,7 +10344,11 @@ public class TelephonyManager { return getCdmaMdn(getSubId()); } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CDMA}. + * @hide + */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CDMA) @@ -9997,7 +10365,11 @@ public class TelephonyManager { } } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CDMA}. + * @hide + */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CDMA) @@ -10005,7 +10377,11 @@ public class TelephonyManager { return getCdmaMin(getSubId()); } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CDMA}. + * @hide + */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CDMA) @@ -10022,7 +10398,11 @@ public class TelephonyManager { } } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. + * @hide + */ @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @@ -10039,7 +10419,11 @@ public class TelephonyManager { return CARRIER_PRIVILEGE_STATUS_NO_ACCESS; } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. + * @hide + */ @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @@ -10056,14 +10440,22 @@ public class TelephonyManager { return CARRIER_PRIVILEGE_STATUS_NO_ACCESS; } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. + * @hide + */ @SystemApi @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public List<String> getCarrierPackageNamesForIntent(Intent intent) { return getCarrierPackageNamesForIntentAndPhone(intent, getPhoneId()); } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. + * @hide + */ @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @@ -10090,10 +10482,13 @@ public class TelephonyManager { * @return The system-selected package that provides the {@link CarrierService} implementation * for the current subscription, or {@code null} if none is resolved * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public @Nullable String getCarrierServicePackageName() { return getCarrierServicePackageNameForLogicalSlot(getPhoneId()); } @@ -10107,10 +10502,13 @@ public class TelephonyManager { * @return The system-selected package that provides the {@link CarrierService} implementation * for the slot, or {@code null} if none is resolved * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public @Nullable String getCarrierServicePackageNameForLogicalSlot(int logicalSlotIndex) { try { ITelephony telephony = getITelephony(); @@ -10144,6 +10542,8 @@ public class TelephonyManager { /** * Get the names of packages with carrier privileges for all the active subscriptions. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -10194,6 +10594,8 @@ public class TelephonyManager { * * @throws IllegalArgumentException if requested state is invalid. * @throws SecurityException if the caller does not have the permission. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) @@ -10223,6 +10625,9 @@ public class TelephonyManager { * * @return the user-set status for enriched calling with call composer, either of * {@link #CALL_COMPOSER_STATUS_ON} or {@link #CALL_COMPOSER_STATUS_OFF}. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) @@ -10239,7 +10644,11 @@ public class TelephonyManager { return CALL_COMPOSER_STATUS_OFF; } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. + * @hide + */ @SystemApi @SuppressLint("RequiresPermission") @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) @@ -10254,6 +10663,9 @@ public class TelephonyManager { } /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. + * * @deprecated Use {@link android.telecom.TelecomManager#placeCall(Uri address, * Bundle extras)} instead. * @hide @@ -10261,6 +10673,7 @@ public class TelephonyManager { @Deprecated @SystemApi @RequiresPermission(android.Manifest.permission.CALL_PHONE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public void call(String callingPackage, String number) { try { ITelephony telephony = getITelephony(); @@ -10307,6 +10720,8 @@ public class TelephonyManager { } /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELECOM}. * @deprecated Use {@link android.telecom.TelecomManager#isInCall} instead * @hide */ @@ -10316,12 +10731,15 @@ public class TelephonyManager { android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE }) + @RequiresFeature(PackageManager.FEATURE_TELECOM) public boolean isOffhook() { TelecomManager tm = (TelecomManager) mContext.getSystemService(TELECOM_SERVICE); return tm.isInCall(); } /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELECOM}. * @deprecated Use {@link android.telecom.TelecomManager#isRinging} instead * @hide */ @@ -10331,12 +10749,15 @@ public class TelephonyManager { android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE }) + @RequiresFeature(PackageManager.FEATURE_TELECOM) public boolean isRinging() { TelecomManager tm = (TelecomManager) mContext.getSystemService(TELECOM_SERVICE); return tm.isRinging(); } /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELECOM}. * @deprecated Use {@link android.telecom.TelecomManager#isInCall} instead * @hide */ @@ -10346,12 +10767,15 @@ public class TelephonyManager { android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE }) + @RequiresFeature(PackageManager.FEATURE_TELECOM) public boolean isIdle() { TelecomManager tm = (TelecomManager) mContext.getSystemService(TELECOM_SERVICE); return !tm.isInCall(); } /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @deprecated Use {@link android.telephony.TelephonyManager#getServiceState} instead * @hide */ @@ -10361,6 +10785,7 @@ public class TelephonyManager { android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE }) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) public boolean isRadioOn() { try { ITelephony telephony = getITelephony(); @@ -10372,7 +10797,11 @@ public class TelephonyManager { return false; } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. + * @hide + */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @@ -10387,7 +10816,11 @@ public class TelephonyManager { return false; } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. + * @hide + */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @@ -10403,11 +10836,15 @@ public class TelephonyManager { } /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. + * * @deprecated use {@link #supplyIccLockPin(String)} instead. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @Deprecated public int[] supplyPinReportResult(String pin) { try { @@ -10421,11 +10858,15 @@ public class TelephonyManager { } /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. + * * @deprecated use {@link #supplyIccLockPuk(String, String)} instead. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @Deprecated public int[] supplyPukReportResult(String puk, String pin) { try { @@ -10451,6 +10892,8 @@ public class TelephonyManager { * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling * app has carrier privileges (see {@link #hasCarrierPrivileges}). * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -10487,6 +10930,8 @@ public class TelephonyManager { * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling * app has carrier privileges (see {@link #hasCarrierPrivileges}). * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -10560,6 +11005,9 @@ public class TelephonyManager { * @param callback called by the framework to inform the caller of the result of executing the * USSD request (see {@link UssdResponseCallback}). * @param handler the {@link Handler} to run the request on. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @RequiresPermission(android.Manifest.permission.CALL_PHONE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) @@ -10604,6 +11052,9 @@ public class TelephonyManager { * voice and data simultaneously. This can change based on location or network condition. * * @return {@code true} if simultaneous voice and data supported, and {@code false} otherwise. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) public boolean isConcurrentVoiceAndDataSupported() { @@ -10617,9 +11068,13 @@ public class TelephonyManager { return false; } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. + * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public boolean handlePinMmi(String dialString) { try { ITelephony telephony = getITelephony(); @@ -10631,9 +11086,14 @@ public class TelephonyManager { return false; } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. + * @hide + */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public boolean handlePinMmiForSubscriber(int subId, String dialString) { try { ITelephony telephony = getITelephony(); @@ -10645,7 +11105,11 @@ public class TelephonyManager { return false; } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. + * @hide + */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) @@ -10663,6 +11127,8 @@ public class TelephonyManager { * @deprecated - use the APIs {@link requestRadioPowerOffForReason} and * {@link clearRadioPowerOffForReason}. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @Deprecated @@ -10690,6 +11156,8 @@ public class TelephonyManager { * @deprecated - use the APIs {@link requestRadioPowerOffForReason} and * {@link clearRadioPowerOffForReason}. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @Deprecated @@ -10737,6 +11205,8 @@ public class TelephonyManager { * @throws SecurityException if the caller does not have MODIFY_PHONE_STATE permission. * @throws IllegalStateException if the Telephony service is not currently available. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @SystemApi @@ -10766,6 +11236,8 @@ public class TelephonyManager { * @throws SecurityException if the caller does not have MODIFY_PHONE_STATE permission. * @throws IllegalStateException if the Telephony service is not currently available. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @SystemApi @@ -10795,6 +11267,8 @@ public class TelephonyManager { * @throws SecurityException if the caller does not have READ_PRIVILEGED_PHONE_STATE permission. * @throws IllegalStateException if the Telephony service is not currently available. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @SystemApi @@ -10824,6 +11298,8 @@ public class TelephonyManager { * <p>To know when the radio has completed powering off, use * {@link PhoneStateListener#LISTEN_SERVICE_STATE LISTEN_SERVICE_STATE}. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @SystemApi @@ -10845,6 +11321,9 @@ public class TelephonyManager { * Check if any radio is on over all the slot indexes. * * @return {@code true} if any radio is on over any slot index. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @SystemApi @@ -10891,6 +11370,8 @@ public class TelephonyManager { * {@link android.Manifest.permission#READ_PHONE_STATE} or that the calling * app has carrier privileges (see {@link #hasCarrierPrivileges}). * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @SystemApi @@ -10920,7 +11401,11 @@ public class TelephonyManager { Log.e(TAG, "Do not call TelephonyManager#updateServiceLocation()"); } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. + * @hide + */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) @@ -10935,7 +11420,11 @@ public class TelephonyManager { return false; } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. + * @hide + */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) @@ -10950,7 +11439,11 @@ public class TelephonyManager { return false; } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. + * @hide + */ @SystemApi @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) public boolean isDataConnectivityPossible() { @@ -10965,7 +11458,11 @@ public class TelephonyManager { return false; } - /** @hide */ + /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. + * @hide + */ @SystemApi @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) public boolean needsOtaServiceProvisioning() { @@ -11016,23 +11513,29 @@ public class TelephonyManager { * app has carrier privileges (see {@link #hasCarrierPrivileges}). * * @param enable Whether to enable mobile data. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. * @deprecated use setDataEnabledForReason with reason DATA_ENABLED_REASON_USER instead. * */ @Deprecated @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) public void setDataEnabled(boolean enable) { setDataEnabled(getSubId(SubscriptionManager.getDefaultDataSubscriptionId()), enable); } /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. * @hide * @deprecated use {@link #setDataEnabledForReason(int, boolean)} instead. */ @SystemApi @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) public void setDataEnabled(int subId, boolean enable) { try { setDataEnabledForReason(subId, DATA_ENABLED_REASON_USER, enable); @@ -11043,10 +11546,14 @@ public class TelephonyManager { /** * @deprecated use {@link #isDataEnabled()} instead. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. * @hide */ @SystemApi @Deprecated + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) public boolean getDataEnabled() { return isDataEnabled(); } @@ -11070,6 +11577,9 @@ public class TelephonyManager { * {@link ConnectivityManager#getRestrictBackgroundStatus}. * * @return true if mobile data is enabled. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. */ @RequiresPermission(anyOf = {android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.MODIFY_PHONE_STATE, @@ -11100,6 +11610,9 @@ public class TelephonyManager { * has carrier privileges (see {@link #hasCarrierPrivileges}). * * @return {@code true} if the data roaming is enabled on the subscription, otherwise return + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. * {@code false}. */ @RequiresPermission(anyOf = {android.Manifest.permission.ACCESS_NETWORK_STATE, @@ -11139,6 +11652,8 @@ public class TelephonyManager { * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE} * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CDMA}. * @hide */ @SystemApi @@ -11181,6 +11696,8 @@ public class TelephonyManager { * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling * app has carrier privileges (see {@link #hasCarrierPrivileges}). * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CDMA}. * @hide */ @SystemApi @@ -11249,6 +11766,8 @@ public class TelephonyManager { * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE} * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CDMA}. * @hide */ @SystemApi @@ -11287,6 +11806,8 @@ public class TelephonyManager { * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling * app has carrier privileges (see {@link #hasCarrierPrivileges}). * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CDMA}. * @hide */ @SystemApi @@ -11322,6 +11843,8 @@ public class TelephonyManager { * * @param isEnabled {@code true} to enable mobile data roaming, otherwise disable it. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. * @hide */ @SystemApi @@ -11340,11 +11863,15 @@ public class TelephonyManager { } /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. + * * @deprecated use {@link #isDataEnabled()} instead. * @hide */ @Deprecated @SystemApi + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) public boolean getDataEnabled(int subId) { try { return isDataEnabledForReason(subId, DATA_ENABLED_REASON_USER); @@ -11355,6 +11882,8 @@ public class TelephonyManager { } /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_IMS}. * @deprecated Use {@link android.telephony.ims.ImsMmTelManager#setVtSettingEnabled(boolean)} * instead. * @hide @@ -11362,6 +11891,7 @@ public class TelephonyManager { @Deprecated @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_IMS) public void enableVideoCalling(boolean enable) { try { ITelephony telephony = getITelephony(); @@ -11373,6 +11903,8 @@ public class TelephonyManager { } /** + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_IMS}. * @deprecated Use {@link ImsMmTelManager#isVtSettingEnabled()} instead to check if the user * has enabled the Video Calling setting, {@link ImsMmTelManager#isAvailable(int, int)} to * determine if video calling is available, or {@link ImsMmTelManager#isCapable(int, int)} to @@ -11385,6 +11917,7 @@ public class TelephonyManager { android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE }) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_IMS) public boolean isVideoCallingEnabled() { try { ITelephony telephony = getITelephony(); @@ -11400,6 +11933,9 @@ public class TelephonyManager { * Whether the device supports configuring the DTMF tone length. * * @return {@code true} if the DTMF tone length can be changed, and {@code false} otherwise. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public boolean canChangeDtmfToneLength() { @@ -11421,7 +11957,11 @@ public class TelephonyManager { * Whether the device is a world phone. * * @return {@code true} if the device is a world phone, and {@code false} otherwise. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY}. */ + @RequiresFeature(PackageManager.FEATURE_TELEPHONY) public boolean isWorldPhone() { try { ITelephony telephony = getITelephony(); @@ -11442,8 +11982,11 @@ public class TelephonyManager { * * @return {@code true} if the device supports TTY mode, and {@code false} otherwise. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELECOM}. */ @Deprecated + @RequiresFeature(PackageManager.FEATURE_TELECOM) public boolean isTtyModeSupported() { try { TelecomManager telecomManager = null; @@ -11464,6 +12007,9 @@ public class TelephonyManager { * support for the feature and device firmware support. * * @return {@code true} if the device and carrier both support RTT, {@code false} otherwise. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_IMS}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_IMS) public boolean isRttSupported() { @@ -11484,6 +12030,9 @@ public class TelephonyManager { * * @return {@code true} if the device supports hearing aid compatibility, and {@code false} * otherwise. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public boolean isHearingAidCompatibilitySupported() { @@ -11746,11 +12295,14 @@ public class TelephonyManager { * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * {@hide} **/ @SystemApi @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public void setSimPowerState(int state) { setSimPowerStateForSlot(getSlotIndex(), state); } @@ -11772,11 +12324,14 @@ public class TelephonyManager { * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * {@hide} **/ @SystemApi @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public void setSimPowerStateForSlot(int slotIndex, int state) { try { ITelephony telephony = getITelephony(); @@ -11809,6 +12364,8 @@ public class TelephonyManager { * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * {@hide} **/ @SystemApi @@ -11839,6 +12396,8 @@ public class TelephonyManager { * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * {@hide} **/ @SystemApi @@ -11993,6 +12552,9 @@ public class TelephonyManager { * application currently configured for this user. * @return component name of the app and class to direct Respond Via Message intent to, or * {@code null} if the functionality is not supported. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_MESSAGING}. * @hide */ @SystemApi @@ -12015,6 +12577,9 @@ public class TelephonyManager { * user associated with this subscription. * @return component name of the app and class to direct Respond Via Message intent to, or * {@code null} if the functionality is not supported. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_MESSAGING}. * @hide */ @SystemApi @@ -12151,9 +12716,13 @@ public class TelephonyManager { * @return The {@link PhoneAccountHandle} associated with the TelphonyManager, or {@code null} * if there is no associated {@link PhoneAccountHandle}; this can happen if the subscription is * data-only or an opportunistic subscription. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public @Nullable PhoneAccountHandle getPhoneAccountHandle() { return getPhoneAccountHandleForSubscriptionId(getSubId()); } @@ -12215,10 +12784,14 @@ public class TelephonyManager { * Resets Telephony and IMS settings back to factory defaults only for the subscription * associated with this instance. * @see #createForSubscriptionId(int) + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY}. * @hide */ @SystemApi @RequiresPermission(Manifest.permission.CONNECTIVITY_INTERNAL) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY) public void resetSettings() { try { Log.d(TAG, "resetSettings: subId=" + getSubId()); @@ -12240,6 +12813,8 @@ public class TelephonyManager { * * @see Locale#toLanguageTag() * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -12332,10 +12907,14 @@ public class TelephonyManager { * @param callback A callback object to which the result will be delivered. If there was an * error processing the request, {@link OutcomeReceiver#onError} will be called * with more details about the error. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY}. * @hide */ @SystemApi @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY) public void requestModemActivityInfo(@NonNull @CallbackExecutor Executor executor, @NonNull OutcomeReceiver<ModemActivityInfo, ModemActivityInfoException> callback) { Objects.requireNonNull(executor); @@ -12422,6 +13001,9 @@ public class TelephonyManager { * and {@link android.Manifest.permission#ACCESS_COARSE_LOCATION}. * May return {@code null} when the subscription is inactive or when there was an error * communicating with the phone process. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(allOf = { @@ -12454,12 +13036,16 @@ public class TelephonyManager { * location related information. * May return {@code null} when the subscription is inactive or when there was an error * communicating with the phone process. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(allOf = { Manifest.permission.READ_PHONE_STATE, Manifest.permission.ACCESS_COARSE_LOCATION }) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) public @Nullable ServiceState getServiceState(@IncludeLocationData int includeLocationData) { return getServiceStateForSubscriber(getSubId(), includeLocationData != INCLUDE_LOCATION_DATA_FINE, @@ -12518,6 +13104,9 @@ public class TelephonyManager { * voicemail ringtone. * @return The URI for the ringtone to play when receiving a voicemail from a specific * PhoneAccount. May be {@code null} if no ringtone is set. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public @Nullable Uri getVoicemailRingtoneUri(PhoneAccountHandle accountHandle) { @@ -12544,10 +13133,13 @@ public class TelephonyManager { * @param uri The URI for the ringtone to play when receiving a voicemail from a specific * PhoneAccount. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. * @deprecated Use {@link android.provider.Settings#ACTION_CHANNEL_NOTIFICATION_SETTINGS} * instead. */ @Deprecated + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public void setVoicemailRingtoneUri(PhoneAccountHandle phoneAccountHandle, Uri uri) { try { ITelephony service = getITelephony(); @@ -12565,6 +13157,9 @@ public class TelephonyManager { * @param accountHandle The handle for the {@link PhoneAccount} for which to retrieve the * voicemail vibration setting. * @return {@code true} if the vibration is set for this PhoneAccount, {@code false} otherwise. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public boolean isVoicemailVibrationEnabled(PhoneAccountHandle accountHandle) { @@ -12591,10 +13186,13 @@ public class TelephonyManager { * @param enabled Whether to enable or disable vibration for voicemail notifications from a * specific PhoneAccount. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. * @deprecated Use {@link android.provider.Settings#ACTION_CHANNEL_NOTIFICATION_SETTINGS} * instead. */ @Deprecated + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public void setVoicemailVibrationEnabled(PhoneAccountHandle phoneAccountHandle, boolean enabled) { try { @@ -12620,6 +13218,9 @@ public class TelephonyManager { * * @return Carrier id of the current subscription. Return {@link #UNKNOWN_CARRIER_ID} if the * subscription is unavailable or the carrier cannot be identified. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public int getSimCarrierId() { @@ -12645,6 +13246,9 @@ public class TelephonyManager { * * @return Carrier name of the current subscription. Return {@code null} if the subscription is * unavailable or the carrier cannot be identified. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public @Nullable CharSequence getSimCarrierIdName() { @@ -12683,6 +13287,9 @@ public class TelephonyManager { * @return Returns fine-grained carrier id of the current subscription. * Return {@link #UNKNOWN_CARRIER_ID} if the subscription is unavailable or the carrier cannot * be identified. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public int getSimSpecificCarrierId() { @@ -12709,6 +13316,9 @@ public class TelephonyManager { * * @return user-facing name of the subscription specific carrier id. Return {@code null} if the * subscription is unavailable or the carrier cannot be identified. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public @Nullable CharSequence getSimSpecificCarrierIdName() { @@ -12737,6 +13347,9 @@ public class TelephonyManager { * * @return matching carrier id from sim MCCMNC. Return {@link #UNKNOWN_CARRIER_ID} if the * subscription is unavailable or the carrier cannot be identified. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public int getCarrierIdFromSimMccMnc() { @@ -12812,6 +13425,9 @@ public class TelephonyManager { * * @param appType the uicc app type. * @return Application ID for specified app type or {@code null} if no uicc or error. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @Nullable @@ -12877,6 +13493,9 @@ public class TelephonyManager { * Requires that the calling app has READ_PRIVILEGED_PHONE_STATE permission * * @return PRLVersion or null if error. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CDMA}. * @hide */ @SystemApi @@ -12942,6 +13561,9 @@ public class TelephonyManager { * * @return The number of carriers set successfully. Should be length of * carrierList on success; -1 if carrierList null or on error. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CARRIERLOCK}. * @hide */ @SystemApi @@ -13068,6 +13690,9 @@ public class TelephonyManager { * @return {@link #SET_CARRIER_RESTRICTION_SUCCESS} in case of success. * {@link #SET_CARRIER_RESTRICTION_NOT_SUPPORTED} if the modem does not support the * configuration. {@link #SET_CARRIER_RESTRICTION_ERROR} in all other error cases. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CARRIERLOCK}. * @hide */ @SystemApi @@ -13101,11 +13726,15 @@ public class TelephonyManager { * * @return List of {@link android.telephony.CarrierIdentifier}; empty list * means all carriers are allowed. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CARRIERLOCK}. * @hide */ @Deprecated @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CARRIERLOCK) public List<CarrierIdentifier> getAllowedCarriers(int slotIndex) { if (SubscriptionManager.isValidPhoneId(slotIndex)) { CarrierRestrictionRules carrierRestrictionRule = getCarrierRestrictionRules(); @@ -13127,6 +13756,9 @@ public class TelephonyManager { * @return {@link CarrierRestrictionRules} which contains the allowed carrier list and the * excluded carrier list with the priority between the two lists. Returns {@code null} * in case of error. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CARRIERLOCK}. * @hide */ @SystemApi @@ -13195,6 +13827,8 @@ public class TelephonyManager { * status result fetched from the radio * @throws SecurityException if the caller does not have the required permission/privileges or * if the caller is not pre-registered. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @@ -13261,11 +13895,15 @@ public class TelephonyManager { * @see #resetAllCarrierActions() * @deprecated use {@link #setDataEnabledForReason(int, boolean) with * reason {@link #DATA_ENABLED_REASON_CARRIER}} instead. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. * @hide */ @Deprecated @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) public void setCarrierDataEnabled(boolean enabled) { try { setDataEnabledForReason(DATA_ENABLED_REASON_CARRIER, enabled); @@ -13289,6 +13927,8 @@ public class TelephonyManager { * @deprecated - use the APIs {@link requestRadioPowerOffForReason} and * {@link clearRadioPowerOffForReason}. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @Deprecated @@ -13408,6 +14048,9 @@ public class TelephonyManager { * * @param report control start/stop reporting network status. * @see #resetAllCarrierActions() + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @SystemApi @@ -13434,6 +14077,8 @@ public class TelephonyManager { * * <p>Requires Permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -13556,6 +14201,8 @@ public class TelephonyManager { * has {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} irrespective of * the reason. * @throws IllegalStateException if the Telephony process is not currently available. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) @@ -13599,6 +14246,8 @@ public class TelephonyManager { * {@link android.Manifest.permission#MODIFY_PHONE_STATE} * {@link android.Manifest.permission#READ_BASIC_PHONE_STATE} * @throws IllegalStateException if the Telephony process is not currently available. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. */ @RequiresPermission(anyOf = {android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE, @@ -13655,6 +14304,9 @@ public class TelephonyManager { * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()} * * @return true if phone is in emergency callback mode. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. * @hide */ @SystemApi @@ -13694,6 +14346,9 @@ public class TelephonyManager { * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}. * * @return {@code true} if manual network selection is allowed, otherwise return {@code false}. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @SuppressAutoDoc // No support carrier privileges (b/72967236). @RequiresPermission(anyOf = {android.Manifest.permission.READ_PRECISE_PHONE_STATE, @@ -13717,6 +14372,9 @@ public class TelephonyManager { * Get the most recent SignalStrength information reported by the modem. Due * to power saving this information may not always be current. * @return the most recent cached signal strength info from the modem + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @Nullable @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) @@ -13743,6 +14401,9 @@ public class TelephonyManager { * <LI>And possibly others.</LI> * </UL> * @return {@code true} if the overall data connection is allowed; {@code false} if not. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. */ @RequiresPermission(anyOf = {android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE, @@ -13913,6 +14574,9 @@ public class TelephonyManager { * * @param enable enable(True) or disable(False) * @return returns true if successfully set. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @@ -13942,6 +14606,9 @@ public class TelephonyManager { * <p> * Requires Permission: * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE} + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @@ -14143,6 +14810,8 @@ public class TelephonyManager { * that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). * * @throws SecurityException if the caller does not have the required permission + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) @@ -14178,6 +14847,8 @@ public class TelephonyManager { * <p> Requires permission: * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. * @hide */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @@ -14205,6 +14876,8 @@ public class TelephonyManager { * <p> Requires permission: * {@link android.Manifest.permission#READ_ACTIVE_EMERGENCY_SESSION} * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. * @hide */ @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) @@ -14231,6 +14904,8 @@ public class TelephonyManager { * <p> Requires permission: * {@link android.Manifest.permission#READ_ACTIVE_EMERGENCY_SESSION} * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. * @hide */ @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) @@ -14291,6 +14966,9 @@ public class TelephonyManager { * subscription, the key is {@link SubscriptionManager#getDefaultSubscriptionId}) and the value * as the list of {@link EmergencyNumber}; empty Map if this information is not available; * or throw a SecurityException if the caller does not have the permission. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @NonNull @@ -14347,6 +15025,8 @@ public class TelephonyManager { * as the list of {@link EmergencyNumber}; empty Map if this information is not available; * or throw a SecurityException if the caller does not have the permission. * @throws IllegalStateException if the Telephony process is not currently available. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @NonNull @@ -14415,6 +15095,8 @@ public class TelephonyManager { * @return {@code true} if the given number is an emergency number based on current locale, * SIM card(s), Android database, modem, network or defaults; {@code false} otherwise. * @throws IllegalStateException if the Telephony process is not currently available. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public boolean isEmergencyNumber(@NonNull String number) { @@ -14452,6 +15134,8 @@ public class TelephonyManager { * network; {@code false} if it is not; or throw an SecurityException if the caller does not * have the required permission/privileges * @throws IllegalStateException if the Telephony process is not currently available. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. * * @deprecated Please use {@link TelephonyManager#isEmergencyNumber(String)} instead. * @hide @@ -14481,6 +15165,8 @@ public class TelephonyManager { * <p>Requires Permission: * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE} * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. * @hide */ @SystemApi @@ -14632,6 +15318,9 @@ public class TelephonyManager { * @param callback Callback will be triggered once it succeeds or failed. * See the {@code SET_OPPORTUNISTIC_SUB_*} constants * for more details. Pass null if don't care about the result. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) public void setPreferredOpportunisticDataSubscription(int subId, boolean needValidation, @@ -14692,6 +15381,8 @@ public class TelephonyManager { * {@link SubscriptionManager#DEFAULT_SUBSCRIPTION_ID} if there are no preferred * subscription id * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. */ @RequiresPermission(anyOf = { android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, @@ -14731,6 +15422,8 @@ public class TelephonyManager { * @param executor The executor of where the callback will execute. * @param callback Callback will be triggered once it succeeds or failed. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) @@ -14791,10 +15484,13 @@ public class TelephonyManager { * @param enable whether to enable or disable the modem stack. * @return whether the operation is successful. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY}. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY) public boolean enableModemForSlot(int slotIndex, boolean enable) { boolean ret = false; try { @@ -14817,10 +15513,14 @@ public class TelephonyManager { * {@link #hasCarrierPrivileges()}). * * @param slotIndex which slot it's checking. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(anyOf = {android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE}) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY) public boolean isModemEnabledForSlot(int slotIndex) { try { ITelephony telephony = getITelephony(); @@ -14883,6 +15583,8 @@ public class TelephonyManager { * @param isMultiSimCarrierRestricted true if usage of multiple SIMs is restricted, false * otherwise. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CARRIERLOCK}. * @hide */ @SystemApi @@ -14938,6 +15640,9 @@ public class TelephonyManager { * {@link #MULTISIM_NOT_SUPPORTED_BY_HARDWARE} if the device does not support multiple SIMs. * {@link #MULTISIM_NOT_SUPPORTED_BY_CARRIER} in the device supports multiple SIMs, but the * functionality is restricted by the carrier. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @@ -14969,6 +15674,8 @@ public class TelephonyManager { * * @param numOfSims number of live SIMs we want to switch to * @throws android.os.RemoteException + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @@ -14996,6 +15703,9 @@ public class TelephonyManager { * * @return {@code true} if reboot will be triggered after making changes to modem * configurations, otherwise return {@code false}. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. */ @RequiresPermission(Manifest.permission.READ_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) @@ -15158,6 +15868,8 @@ public class TelephonyManager { * {@link #CARRIER_PRIVILEGE_STATUS_RULES_NOT_LOADED}, or * {@link #CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES} * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -15272,6 +15984,8 @@ public class TelephonyManager { * @param apnType Value indicating the apn type. Apn types are defined in {@link ApnSetting}. * @return whether data is enabled for a apn type. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. * @hide */ @SystemApi @@ -15294,6 +16008,8 @@ public class TelephonyManager { * Whether an APN type is metered or not. It will be evaluated with the subId associated * with the TelephonyManager instance. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. * @hide */ @SystemApi @@ -15323,6 +16039,9 @@ public class TelephonyManager { * @param executor The executor to execute the callback on * @param callback The callback that gets invoked when the radio responds to the request. Called * with {@code true} if the request succeeded, {@code false} otherwise. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @SystemApi @@ -15341,6 +16060,9 @@ public class TelephonyManager { * Same as {@link #setSystemSelectionChannels(List, Executor, Consumer<Boolean>)}, but to be * used when the caller does not need feedback on the results of the operation. * @param specifiers which bands to scan. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @SystemApi @@ -15388,6 +16110,8 @@ public class TelephonyManager { * @return a list of {@link RadioAccessSpecifier}, or an empty list if no bands are specified. * @throws IllegalStateException if the Telephony process is not currently available. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @SystemApi @@ -15416,6 +16140,8 @@ public class TelephonyManager { * @return {@code true} if input mccmnc and mvno matches with data from sim operator. * {@code false} otherwise. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * {@hide} */ @SystemApi @@ -15506,6 +16232,8 @@ public class TelephonyManager { * {@link CallForwardingInfo#REASON_UNCONDITIONAL}, {@link CallForwardingInfo#REASON_BUSY}, * {@link CallForwardingInfo#REASON_NO_REPLY}, {@link CallForwardingInfo#REASON_NOT_REACHABLE}, * {@link CallForwardingInfo#REASON_ALL}, or {@link CallForwardingInfo#REASON_ALL_CONDITIONAL} + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. * * @hide */ @@ -15583,6 +16311,8 @@ public class TelephonyManager { * <li>{@link CallForwardingInfo#getTimeoutSeconds()} returns a non-positive value when * enabling call forwarding</li> * </ul> + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. * @hide */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @@ -15707,6 +16437,9 @@ public class TelephonyManager { * <li>{@link #CALL_WAITING_STATUS_NOT_SUPPORTED}}</li> * <li>{@link #CALL_WAITING_STATUS_FDN_CHECK_FAILURE}}</li> * </ul> + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. * @hide */ @SystemApi @@ -15757,6 +16490,9 @@ public class TelephonyManager { * {@link #CALL_WAITING_STATUS_NOT_SUPPORTED} or * {@link #CALL_WAITING_STATUS_UNKNOWN_ERROR} or * {@link #CALL_WAITING_STATUS_FDN_CHECK_FAILURE} if it failed. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_CALLING}. * @hide */ @SystemApi @@ -15857,6 +16593,9 @@ public class TelephonyManager { * * @param policy The data policy to enable. * @param enabled Whether to enable or disable the policy. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. * @hide */ @SystemApi @@ -15878,6 +16617,9 @@ public class TelephonyManager { * * @param policy The data policy that you want the status for. * @return {@code true} if enabled, {@code false} otherwise. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. * @hide */ @SystemApi @@ -15913,6 +16655,8 @@ public class TelephonyManager { * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE} * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @WorkerThread @@ -15947,6 +16691,8 @@ public class TelephonyManager { * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling * app has carrier privileges (see {@link #hasCarrierPrivileges}). * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -15989,6 +16735,8 @@ public class TelephonyManager { * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling * app has carrier privileges (see {@link #hasCarrierPrivileges}). * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -16137,6 +16885,8 @@ public class TelephonyManager { * </ol> * @return operation result. * @throws IllegalStateException if the Telephony process is not currently available. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @SystemApi @@ -16171,6 +16921,8 @@ public class TelephonyManager { * connectivity is active. It means the device is allowed to connect to both primary and * secondary cell. * @throws IllegalStateException if the Telephony process is not currently available. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @SystemApi @@ -16408,6 +17160,8 @@ public class TelephonyManager { * * @throws IllegalStateException if the Telephony process is not currently available. * @throws SecurityException if the caller doesn't have the permission. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @@ -16524,6 +17278,9 @@ public class TelephonyManager { * * @param capability the name of the capability to check for * @return the availability of the capability + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_RADIO_ACCESS) public boolean isRadioInterfaceCapabilitySupported( @@ -16643,6 +17400,8 @@ public class TelephonyManager { * @throws IllegalArgumentException if the thermalMitigationRequest had invalid parameters or * if the device's modem does not support data throttling. * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. * @hide */ @SystemApi @@ -16975,6 +17734,9 @@ public class TelephonyManager { * contain the GBA Ks_NAF/Ks_ext_NAF when available. If the NAF keys are * available and valid at the time of call and bootstrapping is not requested, * then the callback shall be invoked with the available keys. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @@ -17073,6 +17835,8 @@ public class TelephonyManager { * @param request the SignalStrengthUpdateRequest to be set into the System * * @throws IllegalStateException if a new request is set with same subId from the same caller + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @@ -17103,6 +17867,9 @@ public class TelephonyManager { * @see #setSignalStrengthUpdateRequest(SignalStrengthUpdateRequest) * * @param request the SignalStrengthUpdateRequest to be cleared from the System + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @@ -17126,10 +17893,14 @@ public class TelephonyManager { * @return the PhoneCapability which describes the data connection capability of modem. * It's used to evaluate possible phone config change, for example from single * SIM device to multi-SIM device. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public @NonNull PhoneCapability getPhoneCapability() { try { ITelephony telephony = getITelephony(); @@ -17194,11 +17965,15 @@ public class TelephonyManager { * at least one SIM card for which the user needs to manually enter the PIN * code after the reboot. {@link #PREPARE_UNATTENDED_REBOOT_ERROR} in case * of error. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_SUBSCRIPTION}. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.REBOOT) @PrepareUnattendedRebootResult + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) public int prepareForUnattendedReboot() { try { ITelephony service = getITelephony(); @@ -17301,6 +18076,9 @@ public class TelephonyManager { * * @param executor the executor on which callback will be invoked. * @param callback a callback to receive the current slicing configuration. + * + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. */ @RequiresFeature( enforcement = "android.telephony.TelephonyManager#isRadioInterfaceCapabilitySupported", @@ -17382,8 +18160,11 @@ public class TelephonyManager { * @param capability The premium capability to check. * @return Whether the given premium capability is available to purchase. * @throws SecurityException if the caller does not hold permission READ_BASIC_PHONE_STATE. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. */ @RequiresPermission(android.Manifest.permission.READ_BASIC_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) public boolean isPremiumCapabilityAvailableForPurchase(@PremiumCapability int capability) { try { ITelephony telephony = getITelephony(); @@ -17623,10 +18404,13 @@ public class TelephonyManager { * @param callback The result of the purchase request. * @throws SecurityException if the caller does not hold permissions * READ_BASIC_PHONE_STATE or INTERNET. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_DATA}. * @see #isPremiumCapabilityAvailableForPurchase(int) to check whether the capability is valid. */ @RequiresPermission(allOf = {android.Manifest.permission.READ_BASIC_PHONE_STATE, android.Manifest.permission.INTERNET}) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) public void purchasePremiumCapability(@PremiumCapability int capability, @NonNull @CallbackExecutor Executor executor, @NonNull @PurchasePremiumCapabilityResult Consumer<Integer> callback) { @@ -18080,10 +18864,14 @@ public class TelephonyManager { * Get current cell broadcast message identifier ranges. * * @throws SecurityException if the caller does not have the required permission + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_MESSAGING}. + * * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_CELL_BROADCASTS) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_MESSAGING) @NonNull public List<CellBroadcastIdRange> getCellBroadcastIdRanges() { try { @@ -18237,10 +19025,13 @@ public class TelephonyManager { * the result when the operation completes. * @throws SecurityException if the caller does not have the required permission * @throws IllegalArgumentException when the ranges are invalid. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_MESSAGING}. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_CELL_BROADCASTS) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_MESSAGING) public void setCellBroadcastIdRanges(@NonNull List<CellBroadcastIdRange> ranges, @NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Integer> callback) { @@ -18316,7 +19107,8 @@ public class TelephonyManager { * </ul> * * @return Primary IMEI of type string - * @throws UnsupportedOperationException if the radio doesn't support this feature. + * @throws UnsupportedOperationException If the device does not have + * {@link PackageManager#FEATURE_TELEPHONY_GSM}. * @throws SecurityException if the caller does not have the required permission/privileges */ @NonNull |