diff --git a/api/current.txt b/api/current.txt index aaacd684d48e4..b7cef9e903909 100755 --- a/api/current.txt +++ b/api/current.txt @@ -43380,6 +43380,7 @@ package android.telephony.emergency { method public int compareTo(android.telephony.emergency.EmergencyNumber); method public int describeContents(); method public java.lang.String getCountryIso(); + method public int getEmergencyCallRouting(); method public int getEmergencyNumberSourceBitmask(); method public java.util.List getEmergencyNumberSources(); method public java.util.List getEmergencyServiceCategories(); @@ -43390,6 +43391,9 @@ package android.telephony.emergency { method public boolean isInEmergencyServiceCategories(int); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; + field public static final int EMERGENCY_CALL_ROUTING_EMERGENCY = 1; // 0x1 + field public static final int EMERGENCY_CALL_ROUTING_NORMAL = 2; // 0x2 + field public static final int EMERGENCY_CALL_ROUTING_UNKNOWN = 0; // 0x0 field public static final int EMERGENCY_NUMBER_SOURCE_DATABASE = 16; // 0x10 field public static final int EMERGENCY_NUMBER_SOURCE_DEFAULT = 8; // 0x8 field public static final int EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG = 4; // 0x4 diff --git a/api/system-current.txt b/api/system-current.txt index 1bf6cf995ebab..9cdc68284b14f 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -6040,6 +6040,7 @@ package android.telephony.ims { method public android.os.Bundle getCallExtras(); method public int getCallType(); method public static int getCallTypeFromVideoState(int); + method public int getEmergencyCallRouting(); method public int getEmergencyServiceCategories(); method public android.telephony.ims.ImsStreamMediaProfile getMediaProfile(); method public int getRestrictCause(); @@ -6053,6 +6054,7 @@ package android.telephony.ims { method public void setCallExtraBoolean(java.lang.String, boolean); method public void setCallExtraInt(java.lang.String, int); method public void setCallRestrictCause(int); + method public void setEmergencyCallRouting(int); method public void setEmergencyServiceCategories(int); method public void updateCallExtras(android.telephony.ims.ImsCallProfile); method public void updateCallType(android.telephony.ims.ImsCallProfile); diff --git a/telephony/java/android/telephony/emergency/EmergencyNumber.java b/telephony/java/android/telephony/emergency/EmergencyNumber.java index fe062d5d974ae..a94b163ffd757 100644 --- a/telephony/java/android/telephony/emergency/EmergencyNumber.java +++ b/telephony/java/android/telephony/emergency/EmergencyNumber.java @@ -29,6 +29,7 @@ import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import java.util.Objects; import java.util.Set; /** @@ -198,21 +199,53 @@ public final class EmergencyNumber implements Parcelable, Comparable CREATOR = + new Parcelable.Creator() { + @Override + public EmergencyNumber createFromParcel(Parcel in) { + return new EmergencyNumber(in); + } + + @Override + public EmergencyNumber[] newArray(int size) { + return new EmergencyNumber[size]; + } + }; + /** * Get the dialing number of the emergency number. * @@ -352,14 +410,17 @@ public final class EmergencyNumber implements Parcelable, ComparableSome regions require some emergency numbers which are not routed using typical emergency + * call processing, but are instead placed as regular phone calls. The emergency call routing + * field provides information about how an emergency call will be routed when it is placed. + * + * @return the emergency call routing requirement + */ + public @EmergencyCallRouting int getEmergencyCallRouting() { + return mEmergencyCallRouting; } @Override @@ -373,7 +434,8 @@ public final class EmergencyNumber implements Parcelable, Comparable CREATOR = - new Parcelable.Creator() { - @Override - public EmergencyNumber createFromParcel(Parcel in) { - return new EmergencyNumber(in); - } - - @Override - public EmergencyNumber[] newArray(int size) { - return new EmergencyNumber[size]; - } - }; } diff --git a/telephony/java/android/telephony/ims/ImsCallProfile.java b/telephony/java/android/telephony/ims/ImsCallProfile.java index cb6fcd7b62c2b..9c8d078a579b3 100644 --- a/telephony/java/android/telephony/ims/ImsCallProfile.java +++ b/telephony/java/android/telephony/ims/ImsCallProfile.java @@ -24,9 +24,11 @@ import android.os.Parcel; import android.os.Parcelable; import android.telecom.VideoProfile; import android.telephony.emergency.EmergencyNumber; +import android.telephony.emergency.EmergencyNumber.EmergencyCallRouting; import android.telephony.emergency.EmergencyNumber.EmergencyServiceCategories; import android.util.Log; +import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.PhoneConstants; import java.lang.annotation.Retention; @@ -320,6 +322,20 @@ public final class ImsCallProfile implements Parcelable { private @EmergencyServiceCategories int mEmergencyServiceCategories = EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED; + /** + * The emergency call routing, only valid if {@link #getServiceType} returns + * {@link #SERVICE_TYPE_EMERGENCY} + * + * If valid, the value is any of the following constants: + *
    + *
  1. {@link EmergencyNumber#EMERGENCY_CALL_ROUTING_UNKNOWN}
  2. + *
  3. {@link EmergencyNumber#EMERGENCY_CALL_ROUTING_NORMAL}
  4. + *
  5. {@link EmergencyNumber#EMERGENCY_CALL_ROUTING_EMERGENCY}
  6. + *
+ */ + private @EmergencyCallRouting int mEmergencyCallRouting = + EmergencyNumber.EMERGENCY_CALL_ROUTING_UNKNOWN; + /** * Extras associated with this {@link ImsCallProfile}. *

@@ -503,10 +519,12 @@ public final class ImsCallProfile implements Parcelable { @Override public String toString() { - return "{ serviceType=" + mServiceType + - ", callType=" + mCallType + - ", restrictCause=" + mRestrictCause + - ", mediaProfile=" + mMediaProfile.toString() + " }"; + return "{ serviceType=" + mServiceType + + ", callType=" + mCallType + + ", restrictCause=" + mRestrictCause + + ", mediaProfile=" + mMediaProfile.toString() + + ", emergencyServiceCategories=" + mEmergencyCallRouting + + ", emergencyCallRouting=" + mEmergencyCallRouting + " }"; } @Override @@ -522,6 +540,7 @@ public final class ImsCallProfile implements Parcelable { out.writeBundle(filteredExtras); out.writeParcelable(mMediaProfile, 0); out.writeInt(mEmergencyServiceCategories); + out.writeInt(mEmergencyCallRouting); } private void readFromParcel(Parcel in) { @@ -530,6 +549,7 @@ public final class ImsCallProfile implements Parcelable { mCallExtras = in.readBundle(); mMediaProfile = in.readParcelable(ImsStreamMediaProfile.class.getClassLoader()); mEmergencyServiceCategories = in.readInt(); + mEmergencyCallRouting = in.readInt(); } public static final Creator CREATOR = new Creator() { @@ -739,6 +759,21 @@ public final class ImsCallProfile implements Parcelable { return (videoState & videoStateToCheck) == videoStateToCheck; } + /** + * Set the emergency service categories and emergency call routing. The set value is valid + * only if {@link #getServiceType} returns {@link #SERVICE_TYPE_EMERGENCY} + * + * Reference: 3gpp 23.167, Section 6 - Functional description; + * 3gpp 22.101, Section 10 - Emergency Calls. + * + * @hide + */ + public void setEmergencyCallInfo(EmergencyNumber num) { + setEmergencyServiceCategories(num.getEmergencyServiceCategoryBitmask()); + setEmergencyCallRouting(num.getEmergencyCallRouting()); + } + + /** * Set the emergency service categories. The set value is valid only if * {@link #getServiceType} returns {@link #SERVICE_TYPE_EMERGENCY} @@ -758,11 +793,28 @@ public final class ImsCallProfile implements Parcelable { * Reference: 3gpp 23.167, Section 6 - Functional description; * 3gpp 22.101, Section 10 - Emergency Calls. */ + @VisibleForTesting public void setEmergencyServiceCategories( @EmergencyServiceCategories int emergencyServiceCategories) { mEmergencyServiceCategories = emergencyServiceCategories; } + /** + * Set the emergency call routing, only valid if {@link #getServiceType} returns + * {@link #SERVICE_TYPE_EMERGENCY} + * + * If valid, the value is any of the following constants: + *

    + *
  1. {@link EmergencyNumber#EMERGENCY_CALL_ROUTING_UNKNOWN}
  2. + *
  3. {@link EmergencyNumber#EMERGENCY_CALL_ROUTING_NORMAL}
  4. + *
  5. {@link EmergencyNumber#EMERGENCY_CALL_ROUTING_EMERGENCY}
  6. + *
+ */ + @VisibleForTesting + public void setEmergencyCallRouting(@EmergencyCallRouting int emergencyCallRouting) { + mEmergencyCallRouting = emergencyCallRouting; + } + /** * Get the emergency service categories, only valid if {@link #getServiceType} returns * {@link #SERVICE_TYPE_EMERGENCY} @@ -787,4 +839,19 @@ public final class ImsCallProfile implements Parcelable { public @EmergencyServiceCategories int getEmergencyServiceCategories() { return mEmergencyServiceCategories; } + + /** + * Get the emergency call routing, only valid if {@link #getServiceType} returns + * {@link #SERVICE_TYPE_EMERGENCY} + * + * If valid, the value is any of the following constants: + *
    + *
  1. {@link EmergencyNumber#EMERGENCY_CALL_ROUTING_UNKNOWN}
  2. + *
  3. {@link EmergencyNumber#EMERGENCY_CALL_ROUTING_NORMAL}
  4. + *
  5. {@link EmergencyNumber#EMERGENCY_CALL_ROUTING_EMERGENCY}
  6. + *
+ */ + public @EmergencyCallRouting int getEmergencyCallRouting() { + return mEmergencyCallRouting; + } }