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

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

Merge "Update #hashCode & #equals with mUnderlyingNetworkPriorities" am: 9df3f48c

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1914192

Change-Id: I03475260c5dfa8f3e6f947f8939c0e75ca4459a6
parents fffe4f68 9df3f48c
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -151,7 +151,7 @@ public final class VcnCellUnderlyingNetworkPriority extends VcnUnderlyingNetwork


    /** Retrieve the allowed PLMN IDs, or an empty set if any PLMN ID is acceptable. */
    /** Retrieve the allowed PLMN IDs, or an empty set if any PLMN ID is acceptable. */
    @NonNull
    @NonNull
    public Set<String> getAllowedPlmnIds() {
    public Set<String> getAllowedOperatorPlmnIds() {
        return Collections.unmodifiableSet(mAllowedNetworkPlmnIds);
        return Collections.unmodifiableSet(mAllowedNetworkPlmnIds);
    }
    }


@@ -211,7 +211,7 @@ public final class VcnCellUnderlyingNetworkPriority extends VcnUnderlyingNetwork
    }
    }


    /** This class is used to incrementally build WifiNetworkPriority objects. */
    /** This class is used to incrementally build WifiNetworkPriority objects. */
    public static class Builder extends VcnUnderlyingNetworkPriority.Builder<Builder> {
    public static final class Builder extends VcnUnderlyingNetworkPriority.Builder<Builder> {
        @NonNull private final Set<String> mAllowedNetworkPlmnIds = new ArraySet<>();
        @NonNull private final Set<String> mAllowedNetworkPlmnIds = new ArraySet<>();
        @NonNull private final Set<Integer> mAllowedSpecificCarrierIds = new ArraySet<>();
        @NonNull private final Set<Integer> mAllowedSpecificCarrierIds = new ArraySet<>();


@@ -233,7 +233,7 @@ public final class VcnCellUnderlyingNetworkPriority extends VcnUnderlyingNetwork
         *     and {@link SubscriptionInfo#getMncString()}.
         *     and {@link SubscriptionInfo#getMncString()}.
         */
         */
        @NonNull
        @NonNull
        public Builder setAllowedPlmnIds(@NonNull Set<String> allowedNetworkPlmnIds) {
        public Builder setAllowedOperatorPlmnIds(@NonNull Set<String> allowedNetworkPlmnIds) {
            validatePlmnIds(allowedNetworkPlmnIds);
            validatePlmnIds(allowedNetworkPlmnIds);


            mAllowedNetworkPlmnIds.clear();
            mAllowedNetworkPlmnIds.clear();
+2 −0
Original line number Original line Diff line number Diff line
@@ -420,6 +420,7 @@ public final class VcnGatewayConnectionConfig {
                mGatewayConnectionName,
                mGatewayConnectionName,
                mTunnelConnectionParams,
                mTunnelConnectionParams,
                mExposedCapabilities,
                mExposedCapabilities,
                mUnderlyingNetworkPriorities,
                Arrays.hashCode(mRetryIntervalsMs),
                Arrays.hashCode(mRetryIntervalsMs),
                mMaxMtu);
                mMaxMtu);
    }
    }
@@ -434,6 +435,7 @@ public final class VcnGatewayConnectionConfig {
        return mGatewayConnectionName.equals(rhs.mGatewayConnectionName)
        return mGatewayConnectionName.equals(rhs.mGatewayConnectionName)
                && mTunnelConnectionParams.equals(rhs.mTunnelConnectionParams)
                && mTunnelConnectionParams.equals(rhs.mTunnelConnectionParams)
                && mExposedCapabilities.equals(rhs.mExposedCapabilities)
                && mExposedCapabilities.equals(rhs.mExposedCapabilities)
                && mUnderlyingNetworkPriorities.equals(rhs.mUnderlyingNetworkPriorities)
                && Arrays.equals(mRetryIntervalsMs, rhs.mRetryIntervalsMs)
                && Arrays.equals(mRetryIntervalsMs, rhs.mRetryIntervalsMs)
                && mMaxMtu == rhs.mMaxMtu;
                && mMaxMtu == rhs.mMaxMtu;
    }
    }
+1 −1
Original line number Original line Diff line number Diff line
@@ -79,7 +79,7 @@ public final class VcnWifiUnderlyingNetworkPriority extends VcnUnderlyingNetwork
        }
        }


        final VcnWifiUnderlyingNetworkPriority rhs = (VcnWifiUnderlyingNetworkPriority) other;
        final VcnWifiUnderlyingNetworkPriority rhs = (VcnWifiUnderlyingNetworkPriority) other;
        return mSsid == rhs.mSsid;
        return mSsid.equals(rhs.mSsid);
    }
    }


    /** @hide */
    /** @hide */
+2 −2
Original line number Original line Diff line number Diff line
@@ -226,9 +226,9 @@ class NetworkPriorityClassifier {
                        .getSystemService(TelephonyManager.class)
                        .getSystemService(TelephonyManager.class)
                        .createForSubscriptionId(subId);
                        .createForSubscriptionId(subId);


        if (!networkPriority.getAllowedPlmnIds().isEmpty()) {
        if (!networkPriority.getAllowedOperatorPlmnIds().isEmpty()) {
            final String plmnId = subIdSpecificTelephonyMgr.getNetworkOperator();
            final String plmnId = subIdSpecificTelephonyMgr.getNetworkOperator();
            if (!networkPriority.getAllowedPlmnIds().contains(plmnId)) {
            if (!networkPriority.getAllowedOperatorPlmnIds().contains(plmnId)) {
                return false;
                return false;
            }
            }
        }
        }
+3 −3
Original line number Original line Diff line number Diff line
@@ -36,7 +36,7 @@ public class VcnCellUnderlyingNetworkPriorityTest {
        return new VcnCellUnderlyingNetworkPriority.Builder()
        return new VcnCellUnderlyingNetworkPriority.Builder()
                .setNetworkQuality(NETWORK_QUALITY_OK)
                .setNetworkQuality(NETWORK_QUALITY_OK)
                .setAllowMetered(true /* allowMetered */)
                .setAllowMetered(true /* allowMetered */)
                .setAllowedPlmnIds(ALLOWED_PLMN_IDS)
                .setAllowedOperatorPlmnIds(ALLOWED_PLMN_IDS)
                .setAllowedSpecificCarrierIds(ALLOWED_CARRIER_IDS)
                .setAllowedSpecificCarrierIds(ALLOWED_CARRIER_IDS)
                .setAllowRoaming(true /* allowRoaming */)
                .setAllowRoaming(true /* allowRoaming */)
                .setRequireOpportunistic(true /* requireOpportunistic */)
                .setRequireOpportunistic(true /* requireOpportunistic */)
@@ -48,7 +48,7 @@ public class VcnCellUnderlyingNetworkPriorityTest {
        final VcnCellUnderlyingNetworkPriority networkPriority = getTestNetworkPriority();
        final VcnCellUnderlyingNetworkPriority networkPriority = getTestNetworkPriority();
        assertEquals(NETWORK_QUALITY_OK, networkPriority.getNetworkQuality());
        assertEquals(NETWORK_QUALITY_OK, networkPriority.getNetworkQuality());
        assertTrue(networkPriority.allowMetered());
        assertTrue(networkPriority.allowMetered());
        assertEquals(ALLOWED_PLMN_IDS, networkPriority.getAllowedPlmnIds());
        assertEquals(ALLOWED_PLMN_IDS, networkPriority.getAllowedOperatorPlmnIds());
        assertEquals(ALLOWED_CARRIER_IDS, networkPriority.getAllowedSpecificCarrierIds());
        assertEquals(ALLOWED_CARRIER_IDS, networkPriority.getAllowedSpecificCarrierIds());
        assertTrue(networkPriority.allowRoaming());
        assertTrue(networkPriority.allowRoaming());
        assertTrue(networkPriority.requireOpportunistic());
        assertTrue(networkPriority.requireOpportunistic());
@@ -60,7 +60,7 @@ public class VcnCellUnderlyingNetworkPriorityTest {
                new VcnCellUnderlyingNetworkPriority.Builder().build();
                new VcnCellUnderlyingNetworkPriority.Builder().build();
        assertEquals(NETWORK_QUALITY_ANY, networkPriority.getNetworkQuality());
        assertEquals(NETWORK_QUALITY_ANY, networkPriority.getNetworkQuality());
        assertFalse(networkPriority.allowMetered());
        assertFalse(networkPriority.allowMetered());
        assertEquals(new HashSet<String>(), networkPriority.getAllowedPlmnIds());
        assertEquals(new HashSet<String>(), networkPriority.getAllowedOperatorPlmnIds());
        assertEquals(new HashSet<Integer>(), networkPriority.getAllowedSpecificCarrierIds());
        assertEquals(new HashSet<Integer>(), networkPriority.getAllowedSpecificCarrierIds());
        assertFalse(networkPriority.allowRoaming());
        assertFalse(networkPriority.allowRoaming());
        assertFalse(networkPriority.requireOpportunistic());
        assertFalse(networkPriority.requireOpportunistic());
Loading