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

Commit 78ae6f81 authored by Yomna Nasser's avatar Yomna Nasser Committed by Android (Google) Code Review
Browse files

Merge "Implement ciphering transparency APIs in Telephony" into main

parents 019800df d32dc629
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -2912,4 +2912,19 @@ public interface CommandsInterface {
     * @param result Callback message to receive the result.
     */
    default void isCellularIdentifierTransparencyEnabled(Message result) {}

    /**
     * Enables or disables security algorithm update reports.
     *
     * @param enable {@code true} to enable, {@code false} to disable.
     * @param result Callback message to receive the result.
     */
    default void setSecurityAlgorithmsUpdatedEnabled(boolean enable, Message result) {}

    /**
     * Check whether security algorithm update reports are enabled.
     *
     * @param result Callback message to receive the result.
     */
    default void isSecurityAlgorithmsUpdatedEnabled(Message result) {}
}
+15 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import static com.android.internal.telephony.RILConstants.RIL_UNSOL_REGISTRATION
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESTRICTED_STATE_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SECURITY_ALGORITHMS_UPDATED;
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;
@@ -438,6 +439,20 @@ public class NetworkIndication extends IRadioNetworkIndication.Stub {
        // TODO (b/276752426) notify registrants of identifier disclosure
    }

    /**
     * Security algorithm update events
     * @param indicationType Type of radio indication
     * @param securityAlgorithmUpdate details of what changed
     */
    public void securityAlgorithmsUpdated(int indicationType,
            android.hardware.radio.network.SecurityAlgorithmUpdate securityAlgorithmUpdate) {
        mRil.processIndication(HAL_SERVICE_NETWORK, indicationType);

        if (mRil.isLogOrTrace()) {
            mRil.unsljLogRet(RIL_UNSOL_SECURITY_ALGORITHMS_UPDATED, securityAlgorithmUpdate);
        }
    }

    @Override
    public String getInterfaceHash() {
        return IRadioNetworkIndication.HASH;
+23 −0
Original line number Diff line number Diff line
@@ -528,6 +528,29 @@ public class NetworkResponse extends IRadioNetworkResponse.Stub {
        }
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
    public void setSecurityAlgorithmsUpdatedEnabledResponse(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 security algorithm updates from the modem are enabled.
     */
    public void isSecurityAlgorithmsUpdatedEnabledResponse(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;
+56 −1
Original line number Diff line number Diff line
@@ -5134,6 +5134,61 @@ public class RIL extends BaseCommands implements CommandsInterface {
        });
    }

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

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

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

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

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

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

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

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

    //***** Private Methods
    /**
     * This is a helper function to be called when an indication callback is called for any radio
+30 −0
Original line number Diff line number Diff line
@@ -949,4 +949,34 @@ public class RadioNetworkProxy extends RadioServiceProxy {
        }
        // Only supported on AIDL.
    }

    /**
     * Checks security algorithm update reports are enabled.
     *
     * @param serial Serial number of the request.
     * @throws RemoteException
     */
    public void isSecurityAlgorithmsUpdatedEnabled(int serial) throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            mNetworkProxy.isSecurityAlgorithmsUpdatedEnabled(serial);
        }
        // Only supported on AIDL.
    }

    /**
     * Enables or disables security algorithm update reports.
     *
     * @param serial Serial number of request.
     * @param enable Indicates whether to enable or disable security algorithm update reports.
     * @throws RemoteException
     */
    public void setSecurityAlgorithmsUpdatedEnabled(int serial,
            boolean enable) throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            mNetworkProxy.setSecurityAlgorithmsUpdatedEnabled(serial, enable);
        }
        // Only supported on AIDL.
    }
}