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

Commit 1165265a authored by Yomna Nasser's avatar Yomna Nasser
Browse files

Revert "Revert "Add RIL interface for setNullCipherAndIntegrityEnabled""

This reverts commit 011b2b41.
A few small fixes are included with this revert commit, namely
switching to use HAL_SERVICE_NETWORK in NetworkResponse.java and
RIL.java, and mHalVersion in RIL.java.

Bug: b/237529943
Test: m
Change-Id: If48c55cb4a13b39e0d30d4cdbd9a23b88cb0de45
parent e295555b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2941,4 +2941,14 @@ public interface CommandsInterface {
     * @param bitsPerSecond The bit rate requested by the opponent UE.
     */
    default void sendAnbrQuery(int mediaType, int direction, int bitsPerSecond, Message result) {}

    /**
     * Set the UE's ability to accept/reject null ciphered and/or null integrity-protected
     * connections.
     *
     * @param result Callback message containing the success or failure status.
     * @param enabled true to allow null ciphered and/or null integrity-protected connections,
     * false to disallow.
     */
    default void setNullCipherAndIntegrityEnabled(Message result, boolean enabled) {}
}
+8 −0
Original line number Diff line number Diff line
@@ -486,4 +486,12 @@ public class NetworkResponse extends IRadioNetworkResponse.Stub {
    public int getInterfaceVersion() {
        return IRadioNetworkResponse.VERSION;
    }

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

}
+12 −0
Original line number Diff line number Diff line
@@ -4983,6 +4983,18 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        mCi.unregisterForEmergencyNetworkScan(h);
    }

    /**
     * Set the UE's ability to accept/reject null ciphered and/or null integrity-protected
     * connections.
     *
     * @param result Callback message.
     * @param enabled true to allow null ciphered and/or null integrity-protected connections,
     * false to disallow.
     */
    public void setNullCipherAndIntegrityEnabled(@Nullable Message result, boolean enabled) {
        mCi.setNullCipherAndIntegrityEnabled(result, enabled);
    }

    /**
     * @return Telephony tester instance.
     */
+36 −0
Original line number Diff line number Diff line
@@ -5544,6 +5544,42 @@ public class RIL extends BaseCommands implements CommandsInterface {
        }
    }

    /**
     * Set if null ciphering / null integrity modes are permitted.
     *
     * @param result Callback message containing the success or failure status.
     * @param enabled true if null ciphering / null integrity modes are permitted, false otherwise
     */
    @Override
    public void setNullCipherAndIntegrityEnabled(Message result, boolean enabled) {
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
        if (networkProxy.isEmpty()) return;
        if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_2_1)) {
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_NULL_CIPHER_AND_INTEGRITY_ENABLED, result,
                    mRILDefaultWorkSource);

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

            try {
                networkProxy.setNullCipherAndIntegrityEnabled(rr.mSerial, enabled);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(
                        HAL_SERVICE_NETWORK, "setNullCipherAndIntegrityEnabled", e);
            }
        } else {
            if (RILJ_LOGD) {
                Rlog.d(RILJ_LOG_TAG, "setNullCipherAndIntegrityEnabled: REQUEST_NOT_SUPPORTED");
            }
            if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                result.sendToTarget();
            }
        }
    }

    //***** Private Methods
    /**
     * This is a helper function to be called when an indication callback is called for any radio
+3 −0
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_LOGICA
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_MUTE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_NULL_CIPHER_AND_INTEGRITY_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_PREFERRED_DATA_MODEM;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_RADIO_CAPABILITY;
@@ -5177,6 +5178,8 @@ public class RILUtils {
                return "SEND_ANBR_QUERY";
            case RIL_REQUEST_TRIGGER_EPS_FALLBACK:
                return "TRIGGER_EPS_FALLBACK";
            case RIL_REQUEST_SET_NULL_CIPHER_AND_INTEGRITY_ENABLED:
                return "SET_NULL_CIPHER_AND_INTEGRITY_ENABLED";
            default:
                return "<unknown request " + request + ">";
        }
Loading