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

Commit 7073da3c authored by Hongbo Zeng's avatar Hongbo Zeng
Browse files

Support getSlicingConfig() API for 5G Slicing Configuration

- add getSlicingConfig() and add getSlicingConfigResponse() to handle
  the response
- add test case for getSlicingConfig() in RILTest

Bug: 178075247
Test: .
(1) run "atest TelephonyManagerTest#testGetSlicingConfig" for CTS result
[22/121] android.telephony.cts.TelephonyManagerTest#testGetSlicingConfig: PASSED (956ms)
(2) run "atest RILTest#testGetSlicingConfig" for RILTest result
[17/111] com.android.internal.telephony.RILTest#testGetSlicingConfig: PASSED (1ms)

Change-Id: Iee3c3b95957e56f0f4c58c5faa3a4a117e9615b8
parent 0ba6fcb7
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2649,4 +2649,12 @@ public interface CommandsInterface {
     */
    default void setDataThrottling(Message result, WorkSource workSource,
            int dataThrottlingAction, long completionWindowMillis) {};

    /**
     * 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
@@ -4763,6 +4763,14 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        return mLinkBandwidthEstimator;
    }

    /**
     * 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);
+38 −3
Original line number Diff line number Diff line
@@ -1935,8 +1935,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;

@@ -5955,6 +5955,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) {
@@ -6932,6 +6958,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
                return "RIL_REQUEST_SET_ALLOWED_NETWORK_TYPE_BITMAP";
            case RIL_REQUEST_GET_ALLOWED_NETWORK_TYPES_BITMAP:
                return "RIL_REQUEST_GET_ALLOWED_NETWORK_TYPE_BITMAP";
            case RIL_REQUEST_GET_SLICING_CONFIG:
                return "RIL_REQUEST_GET_SLICING_CONFIG";
            default: return "<unknown request>";
        }
    }
@@ -7659,7 +7687,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
@@ -56,6 +56,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;
@@ -3077,10 +3078,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;
@@ -2821,4 +2822,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