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

Commit d12d6b9b authored by Xiangyu/Malcolm Chen's avatar Xiangyu/Malcolm Chen Committed by android-build-merger
Browse files

Merge "Add System API to enable / disable a logical modem." am: b26409a3

am: 58f3964c

Change-Id: Ib21b8d297df34ead9f447c4cb956c8f4aa1c2b62
parents eb0689a0 58f3964c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2258,6 +2258,14 @@ public interface CommandsInterface {
     */
    void stopNattKeepalive(int sessionHandle, Message result);

    /**
     * Enable or disable the logical modem.
     *
     * @param enable whether to enable or disable the modem
     * @param result a Message to return to the requester
     */
    default void enableModem(boolean enable, Message result) {};

    default List<ClientRequestStats> getClientRequestStats() {
        return null;
    }
+9 −15
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.internal.telephony;

import android.content.Context;
import android.os.Message;
import android.telephony.PhoneCapability;
import android.telephony.Rlog;
import android.telephony.TelephonyManager;
@@ -82,23 +83,16 @@ public class PhoneConfigurationManager {
    /**
     * Enable or disable phone
     *
     * @param phoneId which phone to operate on
     * @param phone which phone to operate on
     * @param enable true or false
     *
     * @param result the message to sent back when it's done.
     */
    public void enablePhone(int phoneId, boolean enable) {
        // TODO: send command to modem once interface is ready.
    public void enablePhone(Phone phone, boolean enable, Message result) {
        if (phone == null) {
            log("enablePhone failed phone is null");
            return;
        }

    /**
     * Enable or disable phone
     *
     * @param phoneId which phone to operate on
     * @param enable true or false
     *
     */
    public void enablePhone(int[] phoneId, boolean[] enable) {
        // TODO: send command to modem once interface is ready.
        phone.mCi.enableModem(enable, result);
    }

    /**
+34 −0
Original line number Diff line number Diff line
@@ -869,6 +869,38 @@ public class RIL extends BaseCommands implements CommandsInterface {
        dial(address, isEmergencyCall, emergencyNumberInfo, clirMode, null, result);
    }

    @Override
    public void enableModem(boolean enable, Message result) {
        IRadio radioProxy = getRadioProxy(result);
        if (mRadioVersion.less(RADIO_HAL_VERSION_1_3)) {
            if (RILJ_LOGV) riljLog("enableModem: not supported.");
            if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                result.sendToTarget();
            }
            return;
        }

        android.hardware.radio.V1_3.IRadio radioProxy13 =
                (android.hardware.radio.V1_3.IRadio) radioProxy;
        if (radioProxy13 != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_ENABLE_MODEM, result,
                    mRILDefaultWorkSource);

            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " enable = "
                        + enable);
            }

            try {
                radioProxy13.enableModem(rr.mSerial, enable);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "enableModem", e);
            }
        }
    }

    @Override
    public void dial(String address, boolean isEmergencyCall, EmergencyNumber emergencyNumberInfo,
                     int clirMode, UUSInfo uusInfo, Message result) {
@@ -5244,6 +5276,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
                return "RIL_REQUEST_SET_SIGNAL_STRENGTH_REPORTING_CRITERIA";
            case RIL_REQUEST_SET_LINK_CAPACITY_REPORTING_CRITERIA:
                return "RIL_REQUEST_SET_LINK_CAPACITY_REPORTING_CRITERIA";
            case RIL_REQUEST_ENABLE_MODEM:
                return "RIL_REQUEST_ENABLE_MODEM";
            default: return "<unknown request>";
        }
    }
+7 −0
Original line number Diff line number Diff line
@@ -2292,4 +2292,11 @@ public class RadioResponse extends IRadioResponse.Stub {
        }
        mRil.processResponseDone(rr, responseInfo, ret);
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
    public void enableModemResponse(RadioResponseInfo responseInfo) {
        responseVoid(responseInfo);
    }
}