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

Commit 28c37928 authored by Sarah Chin's avatar Sarah Chin Committed by Gerrit Code Review
Browse files

Merge "Support getSlicingConfig() API for 5G Slicing Configuration"

parents 5ca0261d 9cf555ad
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2704,4 +2704,12 @@ public interface CommandsInterface {
     * @param h Handler to be removed from the registrant list.
     */
     public void unregisterForSimPhonebookRecordsReceived(Handler h);

    /**
     * Request to get the current slicing configuration including URSP rules and
     * NSSAIs (configured, allowed and rejected).
     *
     * @param result Message that will be sent back to handler.
     */
    default void getSlicingConfig(Message result) {};
}
+8 −0
Original line number Diff line number Diff line
@@ -4767,6 +4767,14 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        return Collections.emptyList();
    }

    /**
     * Request to get the current slicing configuration including URSP rules and
     * NSSAIs (configured, allowed and rejected).
     */
    public void getSlicingConfig(Message response) {
        mCi.getSlicingConfig(response);
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("Phone: subId=" + getSubId());
        pw.println(" mPhoneId=" + mPhoneId);
+41 −6
Original line number Diff line number Diff line
@@ -1957,8 +1957,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
                new android.hardware.radio.V1_6.TrafficDescriptor();

        OptionalDnn optionalDnn = new OptionalDnn();
        if (trafficDescriptor.getDnn() != null) {
            optionalDnn.value(trafficDescriptor.getDnn());
        if (trafficDescriptor.getDataNetworkName() != null) {
            optionalDnn.value(trafficDescriptor.getDataNetworkName());
        }
        td.dnn = optionalDnn;

@@ -6073,6 +6073,32 @@ public class RIL extends BaseCommands implements CommandsInterface {
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void getSlicingConfig(Message result) {
        android.hardware.radio.V1_6.IRadio radioProxy16 = getRadioV16(result);

        if (radioProxy16 != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_GET_SLICING_CONFIG, result,
                    mRILDefaultWorkSource);

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

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

    //***** Private Methods
    /** Helper that gets V1.6 of the radio interface OR sends back REQUEST_NOT_SUPPORTED */
    @Nullable private android.hardware.radio.V1_6.IRadio getRadioV16(Message msg) {
@@ -7069,6 +7095,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
                return "SET_ALLOWED_NETWORK_TYPES_BITMAP";
            case RIL_REQUEST_GET_ALLOWED_NETWORK_TYPES_BITMAP:
                return "GET_ALLOWED_NETWORK_TYPES_BITMAP";
            case RIL_REQUEST_GET_SLICING_CONFIG:
                return "GET_SLICING_CONFIG";
            default: return "<unknown request>";
        }
    }
@@ -7804,7 +7832,14 @@ public class RIL extends BaseCommands implements CommandsInterface {
                ? null : td.dnn.value();
        String osAppId = td.osAppId.getDiscriminator() == OptionalOsAppId.hidl_discriminator.noinit
                ? null : new String(arrayListToPrimitiveArray(td.osAppId.value().osAppId));
        return new TrafficDescriptor(dnn, osAppId);
        TrafficDescriptor.Builder builder = new TrafficDescriptor.Builder();
        if (dnn != null) {
            builder.setDataNetworkName(dnn);
        }
        if (osAppId != null) {
            builder.setOsAppId(osAppId);
        }
        return builder.build();
    }

    /**
+4 −2
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ import android.telephony.SignalStrength;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.data.DataCallResponse;
import android.telephony.data.SlicingConfig;
import android.text.TextUtils;

import com.android.internal.telephony.dataconnection.KeepaliveStatus;
@@ -3176,10 +3177,11 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse_1_6(info);

        if (rr != null) {
            SlicingConfig ret = new SlicingConfig(slicingConfig);
            if (info.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, slicingConfig);
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone_1_6(rr, info, slicingConfig);
            mRil.processResponseDone_1_6(rr, info, ret);
        }
    }
}
+15 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_HARDWA
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_IMSI;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_RADIO_CAPABILITY;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SIM_STATUS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SLICING_CONFIG;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SMSC_ADDRESS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_HANGUP;
@@ -2820,4 +2821,18 @@ public class RILTest extends TelephonyTest {
        mRILUnderTest.setCompatVersion(testRequest, RIL.RADIO_HAL_VERSION_1_5);
        assertEquals(RIL.RADIO_HAL_VERSION_1_3, mRILUnderTest.getCompatVersion(testRequest));
    }

    @FlakyTest
    @Test
    public void testGetSlicingConfig() throws Exception {
        // Use Radio HAL v1.6
        try {
            replaceInstance(RIL.class, "mRadioVersion", mRILUnderTest, mRadioVersionV16);
        } catch (Exception e) {
        }
        mRILUnderTest.getSlicingConfig(obtainMessage());
        verify(mRadioProxy).getSlicingConfig(mSerialNumberCaptor.capture());
        verifyRILResponse_1_6(
                mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_GET_SLICING_CONFIG);
    }
}
Loading