diff --git a/framework/src/android/net/OemNetworkPreferences.java b/framework/src/android/net/OemNetworkPreferences.java index 5a76cd6d6b..2bb006df82 100644 --- a/framework/src/android/net/OemNetworkPreferences.java +++ b/framework/src/android/net/OemNetworkPreferences.java @@ -40,6 +40,23 @@ import java.util.Objects; */ @SystemApi public final class OemNetworkPreferences implements Parcelable { + // Valid production preferences must be > 0, negative values reserved for testing + /** + * This preference is only to be used for testing and nothing else. + * Use only TRANSPORT_TEST transport networks. + * @hide + */ + public static final int OEM_NETWORK_PREFERENCE_TEST_ONLY = -2; + + /** + * This preference is only to be used for testing and nothing else. + * If an unmetered network is available, use it. + * Otherwise, if a network with the TRANSPORT_TEST transport is available, use it. + * Otherwise, use the general default network. + * @hide + */ + public static final int OEM_NETWORK_PREFERENCE_TEST = -1; + /** * Default in case this value is not set. Using it will result in an error. */ @@ -69,6 +86,12 @@ public final class OemNetworkPreferences implements Parcelable { */ public static final int OEM_NETWORK_PREFERENCE_OEM_PRIVATE_ONLY = 4; + /** + * The max allowed value for an OEM network preference. + * @hide + */ + public static final int OEM_NETWORK_PREFERENCE_MAX = OEM_NETWORK_PREFERENCE_OEM_PRIVATE_ONLY; + @NonNull private final Bundle mNetworkMappings; @@ -96,7 +119,7 @@ public final class OemNetworkPreferences implements Parcelable { @Override public String toString() { - return "OemNetworkPreferences{" + "mNetworkMappings=" + mNetworkMappings + '}'; + return "OemNetworkPreferences{" + "mNetworkMappings=" + getNetworkPreferences() + '}'; } @Override @@ -185,6 +208,8 @@ public final class OemNetworkPreferences implements Parcelable { /** @hide */ @IntDef(prefix = "OEM_NETWORK_PREFERENCE_", value = { + OEM_NETWORK_PREFERENCE_TEST_ONLY, + OEM_NETWORK_PREFERENCE_TEST, OEM_NETWORK_PREFERENCE_UNINITIALIZED, OEM_NETWORK_PREFERENCE_OEM_PAID, OEM_NETWORK_PREFERENCE_OEM_PAID_NO_FALLBACK, @@ -205,6 +230,10 @@ public final class OemNetworkPreferences implements Parcelable { @NonNull public static String oemNetworkPreferenceToString(@OemNetworkPreference int value) { switch (value) { + case OEM_NETWORK_PREFERENCE_TEST_ONLY: + return "OEM_NETWORK_PREFERENCE_TEST_ONLY"; + case OEM_NETWORK_PREFERENCE_TEST: + return "OEM_NETWORK_PREFERENCE_TEST"; case OEM_NETWORK_PREFERENCE_UNINITIALIZED: return "OEM_NETWORK_PREFERENCE_UNINITIALIZED"; case OEM_NETWORK_PREFERENCE_OEM_PAID: