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

Commit 6098a061 authored by Gil Cukierman's avatar Gil Cukierman Committed by Android (Google) Code Review
Browse files

Merge "Internal Telephony Support For Cellular Identifier Disclosure HALs" into main

parents 35797204 def7b011
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -2897,4 +2897,19 @@ public interface CommandsInterface {
     * @param result Callback message to receive the result.
     */
    default void isN1ModeEnabled(Message result) {}

    /**
     * Enables or disables cellular identifier disclosure transparency.
     *
     * @param enable {@code true} to enable, {@code false} to disable.
     * @param result Callback message to receive the result.
     */
    default void setCellularIdentifierTransparencyEnabled(boolean enable, Message result) {}

    /**
     * Check whether cellular identifier transparency.
     *
     * @param result Callback message to receive the result.
     */
    default void isCellularIdentifierTransparencyEnabled(Message result) {}
}
 No newline at end of file
+17 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESTRICTED_S
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SIGNAL_STRENGTH;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SUPP_SVC_NOTIFICATION;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_VOICE_RADIO_TECH_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CELLULAR_IDENTIFIER_DISCLOSED;

import android.annotation.ElapsedRealtimeLong;
import android.hardware.radio.network.IRadioNetworkIndication;
@@ -421,6 +422,22 @@ public class NetworkIndication extends IRadioNetworkIndication.Stub {
                new AsyncResult(null, response, null));
    }

    /**
     * Cellular identifier disclosure events
     * @param indicationType Type of radio indication
     * @param identifierDisclsoure the result of the Emergency Network Scan
     */
    public void cellularIdentifierDisclosed(int indicationType,
            android.hardware.radio.network.CellularIdentifierDisclosure identifierDisclsoure) {
        mRil.processIndication(HAL_SERVICE_NETWORK, indicationType);

        if (mRil.isLogOrTrace()) {
            mRil.unsljLogRet(RIL_UNSOL_CELLULAR_IDENTIFIER_DISCLOSED, identifierDisclsoure);
        }

        // TODO (b/276752426) notify registrants of identifier disclosure
    }

    @Override
    public String getInterfaceHash() {
        return IRadioNetworkIndication.HASH;
+24 −0
Original line number Diff line number Diff line
@@ -504,6 +504,30 @@ public class NetworkResponse extends IRadioNetworkResponse.Stub {
        RadioResponse.responseVoid(HAL_SERVICE_NETWORK, mRil, responseInfo);
    }

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

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error.
     * @param isEnabled Indicates whether cellular identifier disclosure transparency from the modem
     *                  is enabled.
     */
    public void isCellularIdentifierTransparencyEnabledResponse(RadioResponseInfo responseInfo,
                                                        boolean isEnabled) {
        RILRequest rr = mRil.processResponse(HAL_SERVICE_NETWORK, responseInfo);

        if (rr != null) {
            if (responseInfo.error == RadioError.NONE) {
                RadioResponse.sendMessageResponse(rr.mResult, isEnabled);
            }
            mRil.processResponseDone(rr, responseInfo, isEnabled);
        }
    }

    @Override
    public String getInterfaceHash() {
        return IRadioNetworkResponse.HASH;
+54 −1
Original line number Diff line number Diff line
@@ -5079,6 +5079,59 @@ public class RIL extends BaseCommands implements CommandsInterface {
        });
    }

    /**
     * {@inheritDoc}
     */
    public void setCellularIdentifierTransparencyEnabled(boolean enable, Message result) {
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
        if (!canMakeRequest(
                "setCellularIdentifierDisclosedEnabled",
                networkProxy,
                result,
                RADIO_HAL_VERSION_2_2)) {
            return;
        }

        RILRequest rr = obtainRequest(RIL_REQUEST_SET_CELLULAR_IDENTIFIER_DISCLOSED_ENABLED, result,
                mRILDefaultWorkSource);

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

        radioServiceInvokeHelper(
            HAL_SERVICE_NETWORK, rr, "setCellularIdentifierDisclosedEnabled", () -> {
              networkProxy.setCellularIdentifierTransparencyEnabled(rr.mSerial, enable);
        });
    }

    /**
     * {@inheritDoc}
     */
    public void isCellularIdentifierTransparencyEnabled(Message result) {
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
        if (!canMakeRequest(
                "isCellularIdentifierDisclosedEnabled",
                networkProxy,
                result,
                RADIO_HAL_VERSION_2_2)) {
            return;
        }

        RILRequest rr = obtainRequest(RIL_REQUEST_IS_CELLULAR_IDENTIFIER_DISCLOSED_ENABLED, result,
                mRILDefaultWorkSource);

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

        radioServiceInvokeHelper(
            HAL_SERVICE_NETWORK, rr, "isCellularIdentifierDisclosedEnabled", () -> {
              networkProxy.isCellularIdentifierTransparencyEnabled(rr.mSerial);
        });
    }

    //***** Private Methods
    /**
     * This is a helper function to be called when an indication callback is called for any radio
@@ -5256,7 +5309,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
     * @param responseInfo RadioResponseInfo received in the callback
     * @param ret object to be returned to request sender
     */
    @VisibleForTesting
    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PROTECTED)
    public void processResponseDone(RILRequest rr, RadioResponseInfo responseInfo, Object ret) {
        processResponseDoneInternal(rr, responseInfo.error, responseInfo.type, ret);
    }
+28 −0
Original line number Diff line number Diff line
@@ -921,4 +921,32 @@ public class RadioNetworkProxy extends RadioServiceProxy {
        }
        // Only supported on AIDL.
    }

    /**
     * Enables or disables cellular identifier disclosure transparency.
     *
     * @param serial Serial number of request.
     * @param enable Indicates whether to enable disclosure transparency or not.
     */
    public void setCellularIdentifierTransparencyEnabled(int serial, boolean enable)
            throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            mNetworkProxy.setCellularIdentifierTransparencyEnabled(serial, enable);
        }
        // Only supported on AIDL.
    }

    /**
     * Checks whether cellular identifier transparency disclosure is enabled.
     *
     * @param serial Serial number of request.
     */
    public void isCellularIdentifierTransparencyEnabled(int serial) throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            mNetworkProxy.isCellularIdentifierTransparencyEnabled(serial);
        }
        // Only supported on AIDL.
    }
}