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

Commit fa4edb62 authored by Yan Yan's avatar Yan Yan Committed by Automerger Merge Worker
Browse files

Merge "VCN: Remove Telephony hidden API usages" into main am: b68c7f0e am: e7c1963a

parents 1de2521f e7c1963a
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -489,7 +489,10 @@ public class VcnManagementService extends IVcnManagementService.Stub {

            // Check subscription is active first; much cheaper/faster check, and an app (currently)
            // cannot be carrier privileged for inactive subscriptions.
            if (subMgr.isValidSlotIndex(info.getSimSlotIndex())
            final int simSlotIndex = info.getSimSlotIndex();
            final boolean isValidSlotIndex =
                    simSlotIndex >= 0 && simSlotIndex < telMgr.getActiveModemCount();
            if (isValidSlotIndex
                    && telMgr.checkCarrierPrivilegesForPackage(pkgName)
                            == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
                // TODO (b/173717728): Allow configuration for inactive, but manageable
+5 −3
Original line number Diff line number Diff line
@@ -177,6 +177,10 @@ public class VcnGatewayConnection extends StateMachine {
    /** Default number of parallel SAs requested */
    static final int TUNNEL_AGGREGATION_SA_COUNT_MAX_DEFAULT = 1;

    // The returned string of
    // TelephonyManager#getNetworkTypeName(TelephonyManager.NETWORK_TYPE_UNKNOWN)
    private static final String NETWORK_TYPE_STRING_UNKNOWN = "UNKNOWN";

    // Matches DataConnection.NETWORK_TYPE private constant, and magic string from
    // ConnectivityManager#getNetworkTypeName()
    @VisibleForTesting(visibility = Visibility.PRIVATE)
@@ -1815,9 +1819,7 @@ public class VcnGatewayConnection extends StateMachine {
                            .setLegacyType(ConnectivityManager.TYPE_MOBILE)
                            .setLegacyTypeName(NETWORK_INFO_NETWORK_TYPE_STRING)
                            .setLegacySubType(TelephonyManager.NETWORK_TYPE_UNKNOWN)
                            .setLegacySubTypeName(
                                    TelephonyManager.getNetworkTypeName(
                                            TelephonyManager.NETWORK_TYPE_UNKNOWN))
                            .setLegacySubTypeName(NETWORK_TYPE_STRING_UNKNOWN)
                            .setLegacyExtraInfo(NETWORK_INFO_EXTRA_INFO)
                            .build();

+4 −1
Original line number Diff line number Diff line
@@ -360,7 +360,10 @@ public class UnderlyingNetworkController {
        final NetworkRequest.Builder nrBuilder =
                getBaseNetworkRequestBuilder()
                        .addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)
                        .setNetworkSpecifier(new TelephonyNetworkSpecifier(subId));
                        .setNetworkSpecifier(
                                new TelephonyNetworkSpecifier.Builder()
                                        .setSubscriptionId(subId)
                                        .build());

        for (CapabilityMatchCriteria capMatchCriteria : capsMatchCriteria) {
            final int cap = capMatchCriteria.capability;
+3 −0
Original line number Diff line number Diff line
@@ -146,6 +146,8 @@ public class VcnManagementServiceTest {
    private static final LinkProperties TEST_LP_1 = new LinkProperties();
    private static final LinkProperties TEST_LP_2 = new LinkProperties();

    private static final int ACTIVE_MODEM_COUNT = 2;

    static {
        TEST_LP_1.setInterfaceName(TEST_IFACE_NAME);
        TEST_LP_2.setInterfaceName(TEST_IFACE_NAME_2);
@@ -233,6 +235,7 @@ public class VcnManagementServiceTest {
        setupSystemService(mMockContext, mUserManager, Context.USER_SERVICE, UserManager.class);

        doReturn(TEST_USER_HANDLE).when(mUserManager).getMainUser();
        doReturn(ACTIVE_MODEM_COUNT).when(mTelMgr).getActiveModemCount();

        doReturn(TEST_PACKAGE_NAME).when(mMockContext).getOpPackageName();