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

Commit a49d290e authored by Hunsuk Choi's avatar Hunsuk Choi Committed by Android (Google) Code Review
Browse files

Merge "Add apis to notify the IMS traffic activities to modem"

parents 96c74289 d74f2e57
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ import android.os.Bundle;
import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.aidl.IImsCallSessionListener;
import android.telephony.ims.aidl.IImsTrafficSessionCallback;

import com.android.ims.internal.IImsCallSession;

/**
@@ -36,4 +38,8 @@ interface IImsMmTelListener {
    oneway void onVoiceMessageCountUpdate(int count);
    oneway void onAudioModeIsVoipChanged(int imsAudioHandler);
    oneway void onTriggerEpsFallback(int reason);
    oneway void onStartImsTrafficSession(int token, int trafficType, int accessNetworkType,
            int trafficDirection, in IImsTrafficSessionCallback callback);
    oneway void onModifyImsTrafficSession(int token, int accessNetworkType);
    oneway void onStopImsTrafficSession(int token);
}
+27 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.telephony.ims.aidl;

import android.telephony.ims.feature.ConnectionFailureInfo;

/**
 * {@hide}
 */
oneway interface IImsTrafficSessionCallback {
    void onReady();
    void onError(in ConnectionFailureInfo info);
}
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2022 The Android Open Source Project
 2
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.telephony.ims.feature;

parcelable ConnectionFailureInfo;
+185 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.telephony.ims.feature;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.SparseArray;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Provides details on why transmitting IMS traffic failed.
 *
 * @hide
 */
public final class ConnectionFailureInfo implements Parcelable {

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(
        prefix = "REASON_",
        value = {
            REASON_NONE,
            REASON_ACCESS_DENIED,
            REASON_NAS_FAILURE,
            REASON_RACH_FAILURE,
            REASON_RLC_FAILURE,
            REASON_RRC_REJECT,
            REASON_RRC_TIMEOUT,
            REASON_NO_SERVICE,
            REASON_PDN_NOT_AVAILABLE,
            REASON_RF_BUSY,
            REASON_UNSPECIFIED
        })
    public @interface FailureReason {}

    /** Default value */
    public static final int REASON_NONE = 0;
    /** Access class check failed */
    public static final int REASON_ACCESS_DENIED = 1;
    /** 3GPP Non-access stratum failure */
    public static final int REASON_NAS_FAILURE = 2;
    /** Random access failure */
    public static final int REASON_RACH_FAILURE = 3;
    /** Radio link failure */
    public static final int REASON_RLC_FAILURE = 4;
    /** Radio connection establishment rejected by network */
    public static final int REASON_RRC_REJECT = 5;
    /** Radio connection establishment timed out */
    public static final int REASON_RRC_TIMEOUT = 6;
    /** Device currently not in service */
    public static final int REASON_NO_SERVICE = 7;
    /** The PDN is no more active */
    public static final int REASON_PDN_NOT_AVAILABLE = 8;
    /** Radio resource is busy with another subscription */
    public static final int REASON_RF_BUSY = 9;
    /** Unspecified reason */
    public static final int REASON_UNSPECIFIED = 0xFFFF;

    private static final SparseArray<String> sReasonMap;
    static {
        sReasonMap = new SparseArray<>();
        sReasonMap.set(REASON_NONE, "NONE");
        sReasonMap.set(REASON_ACCESS_DENIED, "ACCESS_DENIED");
        sReasonMap.set(REASON_NAS_FAILURE, "NAS_FAILURE");
        sReasonMap.set(REASON_RACH_FAILURE, "RACH_FAILURE");
        sReasonMap.set(REASON_RLC_FAILURE, "RLC_FAILURE");
        sReasonMap.set(REASON_RRC_REJECT, "RRC_REJECT");
        sReasonMap.set(REASON_RRC_TIMEOUT, "RRC_TIMEOUT");
        sReasonMap.set(REASON_NO_SERVICE, "NO_SERVICE");
        sReasonMap.set(REASON_PDN_NOT_AVAILABLE, "PDN_NOT_AVAILABLE");
        sReasonMap.set(REASON_RF_BUSY, "RF_BUSY");
        sReasonMap.set(REASON_UNSPECIFIED, "UNSPECIFIED");
    }

    /** The reason of failure */
    private final @FailureReason int mReason;

    /**
     * Failure cause code from network or modem specific to the failure
     *
     * Reference: 3GPP TS 24.401 Annex A (Cause values for EPS mobility management)
     * Reference: 3GPP TS 24.501 Annex A (Cause values for 5GS mobility management)
     */
    private final int mCauseCode;

    /** Retry wait time provided by network in milliseconds */
    private final int mWaitTimeMillis;

    private ConnectionFailureInfo(Parcel in) {
        mReason = in.readInt();
        mCauseCode = in.readInt();
        mWaitTimeMillis = in.readInt();
    }

    /**
     * Constructor.
     *
     * @param reason The reason of failure.
     * @param causeCode Failure cause code from network or modem specific to the failure.
     *        See 3GPP TS 24.401 Annex A (Cause values for EPS mobility management) and
     *        3GPP TS 24.501 Annex A (Cause values for 5GS mobility management).
     * @param waitTimeMillis Retry wait time provided by network in milliseconds.
     * @hide
     */
    public ConnectionFailureInfo(@FailureReason int reason, int causeCode, int waitTimeMillis) {
        mReason = reason;
        mCauseCode = causeCode;
        mWaitTimeMillis = waitTimeMillis;
    }

    /**
     * @return the reason for the failure.
     */
    public @FailureReason int getReason() {
        return mReason;
    }

    /**
     * @return the cause code from the network or modem specific to the failure.
     */
    public int getCauseCode() {
        return mCauseCode;
    }

    /**
     * @return the retry wait time provided by the network in milliseconds.
     */
    public int getWaitTimeMillis() {
        return mWaitTimeMillis;
    }

    /**
     * @return the string format of {@link ConnectionFailureInfo}
     */
    @NonNull
    @Override
    public String toString() {
        String reason = sReasonMap.get(mReason, "UNKNOWN");
        return "ConnectionFailureInfo :: {" + mReason + " : " + reason + ", "
                + mCauseCode + ", " + mWaitTimeMillis + "}";
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(@NonNull Parcel out, int flags) {
        out.writeInt(mReason);
        out.writeInt(mCauseCode);
        out.writeInt(mWaitTimeMillis);
    }

    public static final @NonNull Creator<ConnectionFailureInfo> CREATOR =
            new Creator<ConnectionFailureInfo>() {
        @Override
        public ConnectionFailureInfo createFromParcel(Parcel in) {
            return new ConnectionFailureInfo(in);
        }

        @Override
        public ConnectionFailureInfo[] newArray(int size) {
            return new ConnectionFailureInfo[size];
        }
    };
}
+38 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.telephony.ims.feature;

import android.annotation.NonNull;

/**
 * A callback class used to receive the result of {@link MmTelFeature#startImsTrafficSession}.
 * @hide
 */
public interface ImsTrafficSessionCallback {

    /** The modem is ready to process the IMS traffic. */
    void onReady();

    /**
     * Notifies that any IMS traffic is not sent to network due to any failure
     * on cellular networks. IMS service shall call {@link MmTelFeature#stopImsTrafficSession()}
     * when receiving this callback.
     *
     * @param info The information of the failure.
     */
    void onError(@NonNull ConnectionFailureInfo info);
}
Loading