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

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

Merge changes from topic "ims-hal-fw"

* changes:
  Replace ImsFailureReason with SuggestedAction
  Fix the way to detect the Radio Aidl HAL version
  Update triggerImsDeregistration to specify the reason
  Add triggerEpsFallback to RadioImsProxy
  Update ANBR apis
  Support IRadio Ims module interface in the mock modem
  Add getInterfaceHash and getInterfaceVersion for IRadioIms
  Add triggerImsDeregistration to ImsIndication
  Fix NPE with startImsTrafficResponse
  Update RIL for IRadioIms HAL
  Add RadioImaProxy, ImsResponse, and ImsIndication for IRadioIms
  Add RadioImaProxy, ImsResponse, and ImsIndication for IRadioIms
parents cb4d2fb2 0e65b727
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ java_library {
        "android.hardware.radio-V1.6-java",
        "android.hardware.radio.config-V1-java",
        "android.hardware.radio.data-V1-java",
        "android.hardware.radio.ims-V1-java",
        "android.hardware.radio.messaging-V1-java",
        "android.hardware.radio.modem-V1-java",
        "android.hardware.radio.network-V2-java",
+33 −0
Original line number Diff line number Diff line
@@ -115,6 +115,9 @@ public abstract class BaseCommands implements CommandsInterface {
    protected RegistrantList mSimPhonebookChangedRegistrants = new RegistrantList();
    protected RegistrantList mSimPhonebookRecordsReceivedRegistrants = new RegistrantList();
    protected RegistrantList mEmergencyNetworkScanRegistrants = new RegistrantList();
    protected RegistrantList mConnectionSetupFailureRegistrants = new RegistrantList();
    protected RegistrantList mNotifyAnbrRegistrants = new RegistrantList();
    protected RegistrantList mTriggerImsDeregistrationRegistrants = new RegistrantList();

    @UnsupportedAppUsage
    protected Registrant mGsmSmsRegistrant;
@@ -1155,4 +1158,34 @@ public abstract class BaseCommands implements CommandsInterface {
    public void unregisterForEmergencyNetworkScan(Handler h) {
        mEmergencyNetworkScanRegistrants.remove(h);
    }

    @Override
    public void registerForConnectionSetupFailure(Handler h, int what, Object obj) {
        mConnectionSetupFailureRegistrants.addUnique(h, what, obj);
    }

    @Override
    public void unregisterForConnectionSetupFailure(Handler h) {
        mConnectionSetupFailureRegistrants.remove(h);
    }

    @Override
    public void registerForNotifyAnbr(Handler h, int what, Object obj) {
        mNotifyAnbrRegistrants.addUnique(h, what, obj);
    }

    @Override
    public void unregisterForNotifyAnbr(Handler h) {
        mNotifyAnbrRegistrants.remove(h);
    }

    @Override
    public void registerForTriggerImsDeregistration(Handler h, int what, Object obj) {
        mTriggerImsDeregistrationRegistrants.add(h, what, obj);
    }

    @Override
    public void unregisterForTriggerImsDeregistration(Handler h) {
        mTriggerImsDeregistrationRegistrants.remove(h);
    }
}
+111 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.os.WorkSource;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.CarrierRestrictionRules;
import android.telephony.ClientRequestStats;
@@ -124,6 +125,15 @@ public interface CommandsInterface {
    static final int CDMA_SMS_FAIL_CAUSE_OTHER_TERMINAL_PROBLEM     = 39;
    static final int CDMA_SMS_FAIL_CAUSE_ENCODING_PROBLEM           = 96;

    /** IMS voice capability */
    int IMS_MMTEL_CAPABILITY_VOICE = 1 << 0;
    /** IMS video capability */
    int IMS_MMTEL_CAPABILITY_VIDEO = 1 << 1;
    /** IMS SMS capability */
    int IMS_MMTEL_CAPABILITY_SMS = 1 << 2;
    /** IMS RCS capabilities */
    int IMS_RCS_CAPABILITIES = 1 << 3;

    //***** Methods

    /**
@@ -2746,6 +2756,54 @@ public interface CommandsInterface {
     */
     public void unregisterForSimPhonebookRecordsReceived(Handler h);

    /**
     * Registers for notifications when connection setup fails.
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    default void registerForConnectionSetupFailure(Handler h, int what, Object obj) {}

    /**
     * Unregisters for notifications when connection setup fails.
     *
     * @param h Handler to be removed from the registrant list.
     */
    default void unregisterForConnectionSetupFailure(Handler h) {}

    /**
     * Registers for notifications when ANBR is received form the network.
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    default void registerForNotifyAnbr(Handler h, int what, Object obj) {}

    /**
     * Unregisters for notifications when ANBR is received form the network.
     *
     * @param h Handler to be removed from the registrant list.
     */
    default void unregisterForNotifyAnbr(Handler h) {}

    /**
     * Registers for IMS deregistration trigger from modem.
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    default void registerForTriggerImsDeregistration(Handler h, int what, Object obj) {}

    /**
     * Unregisters for IMS deregistration trigger from modem.
     *
     * @param h Handler to be removed from the registrant list.
     */
    default void unregisterForTriggerImsDeregistration(Handler h) {}

    /**
     * Set the UE's usage setting.
     *
@@ -2777,4 +2835,57 @@ public interface CommandsInterface {
     * @param h Handler to be removed from the registrant list.
     */
    default void unregisterForEmergencyNetworkScan(Handler h) {}

    /**
     * Provides a list of SRVCC call information to radio
     *
     * @param srvccConnections the list of connections.
     */
    default void setSrvccCallInfo(SrvccConnection[] srvccConnections, Message result) {}

    /**
     * Updates the IMS registration information to the radio.
     *
     * @param state The current IMS registration state.
     * @param accessNetworkType The type of underlying radio access network used.
     * @param suggestedAction The expected action that modem should perform.
     * @param capabilities IMS capabilities such as VOICE, VIDEO and SMS.
     */
    default void updateImsRegistrationInfo(int state,
            @AccessNetworkConstants.RadioAccessNetworkType int accessNetworkType,
            int suggestedAction, int capabilities, Message result) {}

    /**
     * Notifies the NAS and RRC layers of the radio the type of upcoming IMS traffic.
     *
     * @param token A nonce to identify the request.
     * @param trafficType IMS traffic type like registration, voice, video, SMS, emergency, and etc.
     * @param accessNetworkType The type of underlying radio access network used.
     */
    default void startImsTraffic(String token, int trafficType,
            @AccessNetworkConstants.RadioAccessNetworkType int accessNetworkType,
            Message result) {}

    /**
     * Notifies IMS traffic has been stopped.
     *
     * @param token The token assigned by startImsTraffic.
     */
    default void stopImsTraffic(String token, Message result) {}

    /**
     * Triggers the UE initiated EPS fallback procedure.
     *
     * @param reason Specifies the reason for EPS fallback.
     */
    default void triggerEpsFallback(int reason, Message result) {}

    /**
     * Triggers radio to send ANBRQ message to the network.
     *
     * @param mediaType Media type is used to identify media stream such as audio or video.
     * @param direction Direction of this packet stream (e.g. uplink or downlink).
     * @param bitsPerSecond The bit rate requested by the opponent UE.
     */
    default void sendAnbrQuery(int mediaType, int direction, int bitsPerSecond, Message result) {}
}
+117 −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 com.android.internal.telephony;

import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CONNECTION_SETUP_FAILURE;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NOTIFY_ANBR;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_TRIGGER_IMS_DEREGISTRATION;

import android.hardware.radio.ims.IRadioImsIndication;
import android.os.AsyncResult;

/**
 * Interface declaring unsolicited radio indications for IMS APIs.
 */
public class ImsIndication extends IRadioImsIndication.Stub {
    private final RIL mRil;

    public ImsIndication(RIL ril) {
        mRil = ril;
    }

    @Override
    public String getInterfaceHash() {
        return IRadioImsIndication.HASH;
    }

    @Override
    public int getInterfaceVersion() {
        return IRadioImsIndication.VERSION;
    }

    /**
     * Fired by radio when any IMS traffic is not sent to network due to any failure
     * on cellular networks.
     *
     * @param indicationType Type of radio indication.
     * @param token The token provided by {@link #startImsTraffic}.
     * @param failureInfo Connection failure information.
     */
    public void onConnectionSetupFailure(int indicationType, String token,
            android.hardware.radio.ims.ConnectionFailureInfo failureInfo) {
        mRil.processIndication(RIL.IMS_SERVICE, indicationType);

        int[] info = new int[3];
        info[0] = failureInfo.failureReason;
        info[1] = failureInfo.causeCode;
        info[2] = failureInfo.waitTimeMillis;

        Object[] response = new Object[2];
        response[0] = token;
        response[1] = info;

        if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CONNECTION_SETUP_FAILURE, response);

        mRil.mConnectionSetupFailureRegistrants.notifyRegistrants(
                new AsyncResult(null, response, null));
    }

    /**
     * Fired by radio when ANBR is received form the network.
     *
     * @param indicationType Type of radio indication.
     * @param qosSessionId QoS session ID is used to identify media stream such as audio or video.
     * @param imsdirection Direction of this packet stream (e.g. uplink or downlink).
     * @param bitsPerSecond The recommended bit rate for the UE
     *        for a specific logical channel and a specific direction by the network.
     */
    public void notifyAnbr(int indicationType, int qosSessionId, int imsdirection,
            int bitsPerSecond) {
        mRil.processIndication(RIL.IMS_SERVICE, indicationType);

        int[] response = new int[3];
        response[0] = qosSessionId;
        response[1] = imsdirection;
        response[2] = bitsPerSecond;

        if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_NOTIFY_ANBR, response);

        mRil.mNotifyAnbrRegistrants.notifyRegistrants(new AsyncResult(null, response, null));
    }

    /**
     * Requests IMS stack to perform graceful IMS deregistration before radio performing
     * network detach in the events of SIM remove, refresh or and so on. The radio waits for
     * the IMS deregistration, which will be notified by telephony via
     * {@link IRadioIms#updateImsRegistrationInfo()}, or a certain timeout interval to start
     * the network detach procedure.
     *
     * @param indicationType Type of radio indication.
     * @param reason the reason why the deregistration is triggered.
     */
    public void triggerImsDeregistration(int indicationType, int reason) {
        mRil.processIndication(RIL.IMS_SERVICE, indicationType);

        if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_TRIGGER_IMS_DEREGISTRATION, reason);

        int[] response = new int[1];
        response[0] = reason;

        mRil.mTriggerImsDeregistrationRegistrants.notifyRegistrants(
                new AsyncResult(null, response, null));
    }
}
+103 −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 com.android.internal.telephony;

import android.hardware.radio.RadioError;
import android.hardware.radio.RadioResponseInfo;
import android.hardware.radio.ims.IRadioImsResponse;

/**
 * Interface declaring response functions to solicited radio requests for IMS APIs.
 */
public class ImsResponse extends IRadioImsResponse.Stub {
    private final RIL mRil;

    public ImsResponse(RIL ril) {
        mRil = ril;
    }

    @Override
    public String getInterfaceHash() {
        return IRadioImsResponse.HASH;
    }

    @Override
    public int getInterfaceVersion() {
        return IRadioImsResponse.VERSION;
    }

    /**
     * @param info Response info struct containing response type, serial no. and error.
     */
    public void setSrvccCallInfoResponse(RadioResponseInfo info) {
        RadioResponse.responseVoid(RIL.IMS_SERVICE, mRil, info);
    }

    /**
     * @param info Response info struct containing response type, serial no. and error.
     */
    public void updateImsRegistrationInfoResponse(RadioResponseInfo info) {
        RadioResponse.responseVoid(RIL.IMS_SERVICE, mRil, info);
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error.
     * @param failureInfo Failure information.
     */
    public void startImsTrafficResponse(RadioResponseInfo responseInfo,
            android.hardware.radio.ims.ConnectionFailureInfo failureInfo) {
        RILRequest rr = mRil.processResponse(RIL.IMS_SERVICE, responseInfo);

        if (rr != null) {
            Object[] response = { "", null };

            if (responseInfo.error == RadioError.NONE) {
                if (failureInfo != null) {
                    int[] info = new int[3];
                    info[0] = failureInfo.failureReason;
                    info[1] = failureInfo.causeCode;
                    info[2] = failureInfo.waitTimeMillis;
                    response[1] = info;
                }

                RadioResponse.sendMessageResponse(rr.mResult, response);
            }
            mRil.processResponseDone(rr, responseInfo, response);
        }
    }

    /**
     * @param info Response info struct containing response type, serial no. and error.
     */
    public void stopImsTrafficResponse(RadioResponseInfo info) {
        RadioResponse.responseVoid(RIL.IMS_SERVICE, mRil, info);
    }

    /**
     * @param info Response info struct containing response type, serial no. and error.
     */
    public void triggerEpsFallbackResponse(RadioResponseInfo info) {
        RadioResponse.responseVoid(RIL.IMS_SERVICE, mRil, info);
    }

    /**
     * @param info Response info struct containing response type, serial no. and error.
     */
    public void sendAnbrQueryResponse(RadioResponseInfo info) {
        RadioResponse.responseVoid(RIL.IMS_SERVICE, mRil, info);
    }
}
Loading