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

Commit 0386717a authored by Amit Mahajan's avatar Amit Mahajan Committed by Android (Google) Code Review
Browse files

Merge "Change osAppId from String to byte[] to match specs." into sc-dev

parents 9b7d07ad 5708709e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1965,7 +1965,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        OptionalOsAppId optionalOsAppId = new OptionalOsAppId();
        if (trafficDescriptor.getOsAppId() != null) {
            android.hardware.radio.V1_6.OsAppId osAppId = new android.hardware.radio.V1_6.OsAppId();
            osAppId.osAppId = primitiveArrayToArrayList(trafficDescriptor.getOsAppId().getBytes());
            osAppId.osAppId = primitiveArrayToArrayList(trafficDescriptor.getOsAppId());
            optionalOsAppId.value(osAppId);
        }
        td.osAppId = optionalOsAppId;
@@ -7707,8 +7707,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
            android.hardware.radio.V1_6.TrafficDescriptor td) {
        String dnn = td.dnn.getDiscriminator() == OptionalDnn.hidl_discriminator.noinit
                ? null : td.dnn.value();
        String osAppId = td.osAppId.getDiscriminator() == OptionalOsAppId.hidl_discriminator.noinit
                ? null : new String(arrayListToPrimitiveArray(td.osAppId.value().osAppId));
        byte[] osAppId = td.osAppId.getDiscriminator() == OptionalOsAppId.hidl_discriminator.noinit
                ? null : arrayListToPrimitiveArray(td.osAppId.value().osAppId);
        TrafficDescriptor.Builder builder = new TrafficDescriptor.Builder();
        if (dnn != null) {
            builder.setDataNetworkName(dnn);
+14 −6
Original line number Diff line number Diff line
@@ -824,6 +824,16 @@ public class DataConnection extends StateMachine {
                : AccessNetworkConstants.TRANSPORT_TYPE_WWAN;
    }

    /**
     * API to generate the OSAppId for enterprise traffic category.
     * @return byte[] representing OSId + OSAppId
     */
    @VisibleForTesting
    public static byte[] getEnterpriseOsAppId() {
        return NetworkCapabilities.getCapabilityCarrierName(
                NetworkCapabilities.NET_CAPABILITY_ENTERPRISE).getBytes();
    }

    /**
     * Begin setting up a data connection, calls setupDataCall
     * and the ConnectionParams will be returned with the
@@ -888,10 +898,9 @@ public class DataConnection extends StateMachine {
                || isUnmeteredApnType));

        String dnn = null;
        String osAppId = null;
        byte[] osAppId = null;
        if (cp.mApnContext.getApnTypeBitmask() == ApnSetting.TYPE_ENTERPRISE) {
            osAppId = NetworkCapabilities.getCapabilityCarrierName(
                    NetworkCapabilities.NET_CAPABILITY_ENTERPRISE);
            osAppId = getEnterpriseOsAppId();
        } else {
            dnn = mApnSetting.getApnName();
        }
@@ -1771,9 +1780,8 @@ public class DataConnection extends StateMachine {
    private boolean isEnterpriseUse() {
        boolean enterpriseTrafficDescriptor = mTrafficDescriptors
                .stream()
                .anyMatch(td -> td.getOsAppId() != null && td.getOsAppId().equals(
                        NetworkCapabilities.getCapabilityCarrierName(
                                NetworkCapabilities.NET_CAPABILITY_ENTERPRISE)));
                .anyMatch(td -> td.getOsAppId() != null && Arrays.equals(td.getOsAppId(),
                        getEnterpriseOsAppId()));
        boolean enterpriseApnContext = mApnContexts.keySet()
                .stream()
                .anyMatch(ac -> ac.getApnTypeBitmask() == ApnSetting.TYPE_ENTERPRISE);
+3 −2
Original line number Diff line number Diff line
@@ -2350,7 +2350,8 @@ public class RILTest extends TelephonyTest {
        android.hardware.radio.V1_6.OptionalOsAppId halOsAppId =
                new android.hardware.radio.V1_6.OptionalOsAppId();
        android.hardware.radio.V1_6.OsAppId osAppId = new android.hardware.radio.V1_6.OsAppId();
        osAppId.osAppId = mRILUnderTest.primitiveArrayToArrayList("OS_APP_ID".getBytes());
        byte[] osAppIdArray = {1, 2, 3, 4};
        osAppId.osAppId = mRILUnderTest.primitiveArrayToArrayList(osAppIdArray);
        halOsAppId.value(osAppId);

        halTrafficDescriptor.dnn = halDnn;
@@ -2358,7 +2359,7 @@ public class RILTest extends TelephonyTest {
        result16.trafficDescriptors = new ArrayList<>(Arrays.asList(halTrafficDescriptor));

        List<TrafficDescriptor> trafficDescriptors = Arrays.asList(
                new TrafficDescriptor("DNN", "OS_APP_ID"));
                new TrafficDescriptor("DNN", osAppIdArray));

        response = new DataCallResponse.Builder()
                .setCause(0)
+3 −2
Original line number Diff line number Diff line
@@ -37,7 +37,8 @@ import java.util.Arrays;

public class DataCallResponseTest extends AndroidTestCase {
    public static final String FAKE_DNN = "FAKE_DNN";
    public static final String FAKE_OS_APP_ID = "FAKE_OS_APP_ID";
    public static final byte[] FAKE_OS_APP_ID = {1, 2, 3, 4};
    public static final byte[] FAKE_OS_APP_ID_2 = {5, 6, 8, 9};

    @SmallTest
    public void testParcel() {
@@ -131,7 +132,7 @@ public class DataCallResponseTest extends AndroidTestCase {
                .setMtuV4(1441)
                .setMtuV6(1440)
                .setTrafficDescriptors(
                        Arrays.asList(new TrafficDescriptor("FAKE_DNN_2", "FAKE_OS_APP_ID_2")))
                        Arrays.asList(new TrafficDescriptor("FAKE_DNN_2", FAKE_OS_APP_ID_2)))
                .build();

        assertNotSame(response1, response2);
+2 −2
Original line number Diff line number Diff line
@@ -420,8 +420,8 @@ public class DataConnectionTest extends TelephonyTest {
        if (tdCaptor.getValue() != null) {
            if (mApnContext.getApnTypeBitmask() == ApnSetting.TYPE_ENTERPRISE) {
                assertEquals(null, tdCaptor.getValue().getDataNetworkName());
                assertTrue(tdCaptor.getValue().getOsAppId()
                        .contains(ApnSetting.TYPE_ENTERPRISE_STRING));
                assertTrue(Arrays.equals(DataConnection.getEnterpriseOsAppId(),
                        tdCaptor.getValue().getOsAppId()));
            } else {
                assertEquals("spmode.ne.jp", tdCaptor.getValue().getDataNetworkName());
                assertEquals(null, tdCaptor.getValue().getOsAppId());
Loading