Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47eb930d authored by Shuo Qian's avatar Shuo Qian Committed by android-build-merger
Browse files

Merge "Add Emergency service categories in ImsCallProfile" am: cfc6518c

am: 128f4219

Change-Id: Ifa177a7348108dc3bd19fc37826c684b60b38898
parents 94518073 128f4219
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5849,6 +5849,7 @@ package android.telephony.ims {
    method public android.os.Bundle getCallExtras();
    method public int getCallType();
    method public static int getCallTypeFromVideoState(int);
    method public int getEmergencyServiceCategories();
    method public android.telephony.ims.ImsStreamMediaProfile getMediaProfile();
    method public int getRestrictCause();
    method public int getServiceType();
@@ -5861,6 +5862,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 setEmergencyServiceCategories(int);
    method public void updateCallExtras(android.telephony.ims.ImsCallProfile);
    method public void updateCallType(android.telephony.ims.ImsCallProfile);
    method public void updateMediaProfile(android.telephony.ims.ImsCallProfile);
+3 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.telephony.emergency;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.hardware.radio.V1_4.EmergencyNumberSource;
import android.hardware.radio.V1_4.EmergencyServiceCategory;
import android.os.Parcel;
@@ -196,7 +197,7 @@ public final class EmergencyNumber implements Parcelable, Comparable<EmergencyNu
    private final int mEmergencyNumberSourceBitmask;

    /** @hide */
    public EmergencyNumber(String number, String countryIso,
    public EmergencyNumber(@NonNull String number, @NonNull String countryIso,
                           int emergencyServiceCategories,
                           int emergencyNumberSources) {
        this.mNumber = number;
@@ -403,7 +404,7 @@ public final class EmergencyNumber implements Parcelable, Comparable<EmergencyNu
     *         0 if both have equal display priority.
     */
    @Override
    public int compareTo(EmergencyNumber emergencyNumber) {
    public int compareTo(@NonNull EmergencyNumber emergencyNumber) {
        if (this.getDisplayPriorityScore()
                > emergencyNumber.getDisplayPriorityScore()) {
            return -1;
+75 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.telecom.VideoProfile;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.emergency.EmergencyNumber.EmergencyServiceCategories;
import android.util.Log;

import com.android.internal.telephony.PhoneConstants;
@@ -294,6 +296,28 @@ public final class ImsCallProfile implements Parcelable {
    @UnsupportedAppUsage
    public @CallRestrictCause int mRestrictCause = CALL_RESTRICT_CAUSE_NONE;

    /**
     * The emergency service categories, only valid if {@link #getServiceType} returns
     * {@link #SERVICE_TYPE_EMERGENCY}
     *
     * If valid, the value is the bitwise-OR combination of the following constants:
     * <ol>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_POLICE} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_AMBULANCE} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_MARINE_GUARD} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_MOUNTAIN_RESCUE} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_MIEC} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_AIEC} </li>
     * </ol>
     *
     * Reference: 3gpp 23.167, Section 6 - Functional description;
     *            3gpp 22.101, Section 10 - Emergency Calls.
     */
    private @EmergencyServiceCategories int mEmergencyServiceCategories =
            EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED;

    /**
     * Extras associated with this {@link ImsCallProfile}.
     * <p>
@@ -495,6 +519,7 @@ public final class ImsCallProfile implements Parcelable {
        out.writeInt(mCallType);
        out.writeBundle(filteredExtras);
        out.writeParcelable(mMediaProfile, 0);
        out.writeInt(mEmergencyServiceCategories);
    }

    private void readFromParcel(Parcel in) {
@@ -502,6 +527,7 @@ public final class ImsCallProfile implements Parcelable {
        mCallType = in.readInt();
        mCallExtras = in.readBundle();
        mMediaProfile = in.readParcelable(ImsStreamMediaProfile.class.getClassLoader());
        mEmergencyServiceCategories = in.readInt();
    }

    public static final Creator<ImsCallProfile> CREATOR = new Creator<ImsCallProfile>() {
@@ -710,4 +736,53 @@ public final class ImsCallProfile implements Parcelable {
    private static boolean isVideoStateSet(int videoState, int videoStateToCheck) {
        return (videoState & videoStateToCheck) == videoStateToCheck;
    }

    /**
     * Set the emergency service categories. The set value is valid only if
     * {@link #getServiceType} returns {@link #SERVICE_TYPE_EMERGENCY}
     *
     * If valid, the value is the bitwise-OR combination of the following constants:
     * <ol>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_POLICE} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_AMBULANCE} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_MARINE_GUARD} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_MOUNTAIN_RESCUE} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_MIEC} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_AIEC} </li>
     * </ol>
     *
     * Reference: 3gpp 23.167, Section 6 - Functional description;
     *            3gpp 22.101, Section 10 - Emergency Calls.
     */
    public void setEmergencyServiceCategories(
            @EmergencyServiceCategories int emergencyServiceCategories) {
        mEmergencyServiceCategories = emergencyServiceCategories;
    }

    /**
     * Get the emergency service categories, only valid if {@link #getServiceType} returns
     * {@link #SERVICE_TYPE_EMERGENCY}
     *
     * @return the emergency service categories,
     *
     * If valid, the value is the bitwise-OR combination of the following constants:
     * <ol>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_POLICE} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_AMBULANCE} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_MARINE_GUARD} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_MOUNTAIN_RESCUE} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_MIEC} </li>
     * <li>{@link EmergencyNumber#EMERGENCY_SERVICE_CATEGORY_AIEC} </li>
     * </ol>
     *
     * Reference: 3gpp 23.167, Section 6 - Functional description;
     *            3gpp 22.101, Section 10 - Emergency Calls.
     */
    public @EmergencyServiceCategories int getEmergencyServiceCategories() {
        return mEmergencyServiceCategories;
    }
}