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

Commit 035f4c4b authored by Geoffrey Boullanger's avatar Geoffrey Boullanger
Browse files

Expose a way to create a test network cell in MobileCountries

In addition to exposing a static creator for a MobileCountries entity,
this adds equals/hashcode implementations to allow comparisons.

Bug: 393349646
Flag: EXEMPT will be used behind flag com.android.internal.telephony.flags.allow_multi_country_mcc
Change-Id: I6ae491450bd2f63429e9a7b2c7c83cfe6d0fdac0
parent 73d957e3
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -32,6 +32,12 @@ public final class MobileCountries {
    @NonNull
    private final com.android.i18n.timezone.MobileCountries mDelegate;

    /** Create a {@link MobileCountries} entity. This can be used for test networks. */
    public static MobileCountries createTestCell(String mcc) {
        return new MobileCountries(
                com.android.i18n.timezone.MobileCountries.create(mcc, Set.of(""), ""));
    }

    MobileCountries(@NonNull com.android.i18n.timezone.MobileCountries delegate) {
        mDelegate = Objects.requireNonNull(delegate);
    }
@@ -74,4 +80,20 @@ public final class MobileCountries {
                + "mDelegate=" + mDelegate
                + '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o instanceof MobileCountries that) {
            return mDelegate.equals(that.mDelegate);
        }
        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(mDelegate);
    }
}