summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Benjamin Löhner <bloehner@google.com> 2024-02-21 12:11:54 +0000
committer Benjamin Löhner <bloehner@google.com> 2024-02-21 16:45:56 +0000
commit84425314e51b71648c65b7d27df15d807020218c (patch)
tree24598e9c91813c75509f54b558d50345dbbe7fe3
parent7e1188270bc67e677a933dae218c94e63117eae8 (diff)
Add voiceCapable condition to getEmergencyAssistancePackage.
This follows EmergencyRoleBehavior.java, which indicates that voiceCapable is a condition for holding the emergency role. Bug: 325931354 Test: presubmit Change-Id: I1bc7e1a93886f57c48e21a0aadb51ad5ada97df1
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index fd9aae9ff835..626a2e574881 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -15014,7 +15014,8 @@ public class TelephonyManager {
* Get the emergency assistance package name.
*
* @return the package name of the emergency assistance app.
- * @throws IllegalStateException if emergency assistance is not enabled.
+ * @throws IllegalStateException if emergency assistance is not enabled or the device is
+ * not voice capable.
*
* @hide
*/
@@ -15023,8 +15024,9 @@ public class TelephonyManager {
@NonNull
@SystemApi
public String getEmergencyAssistancePackage() {
- if (!isEmergencyAssistanceEnabled()) {
- throw new IllegalStateException("isEmergencyAssistanceEnabled() is false.");
+ if (!isEmergencyAssistanceEnabled() || !isVoiceCapable()) {
+ throw new IllegalStateException("isEmergencyAssistanceEnabled() is false or device"
+ + " not voice capable.");
}
String emergencyRole = mContext.getSystemService(RoleManager.class)
.getEmergencyRoleHolder(mContext.getUserId());