diff options
| author | 2021-04-12 15:14:26 +0000 | |
|---|---|---|
| committer | 2021-04-12 15:14:26 +0000 | |
| commit | f4c2db001f48bc4781663b0a2ef8489f31a1307d (patch) | |
| tree | e84874761528aa504b0b828c7c0c51acbf1d23f8 | |
| parent | 3ce4d69811b46da9e5e6ee47189a120ca0cdb387 (diff) | |
| parent | 9a9e7b1bab74c0e22d8194ef3245a7191ad183bb (diff) | |
Merge "Rename APIs in NetworkAgentConfig.Builder" am: a0445d3546 am: 1de3108a3f am: 9a9e7b1bab
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1669047
Change-Id: I1988750dd4b65a3d74c33c8fc120bb3bcb705320
3 files changed, 14 insertions, 12 deletions
diff --git a/packages/Connectivity/framework/api/system-current.txt b/packages/Connectivity/framework/api/system-current.txt index 2ac019d7b8ec..63e0fe945abb 100644 --- a/packages/Connectivity/framework/api/system-current.txt +++ b/packages/Connectivity/framework/api/system-current.txt @@ -260,15 +260,15 @@ package android.net { public static final class NetworkAgentConfig.Builder { ctor public NetworkAgentConfig.Builder(); method @NonNull public android.net.NetworkAgentConfig build(); - method @NonNull public android.net.NetworkAgentConfig.Builder disableNat64Detection(); - method @NonNull public android.net.NetworkAgentConfig.Builder disableProvisioningNotification(); method @NonNull public android.net.NetworkAgentConfig.Builder setExplicitlySelected(boolean); method @NonNull public android.net.NetworkAgentConfig.Builder setLegacyExtraInfo(@NonNull String); method @NonNull public android.net.NetworkAgentConfig.Builder setLegacySubType(int); method @NonNull public android.net.NetworkAgentConfig.Builder setLegacySubTypeName(@NonNull String); method @NonNull public android.net.NetworkAgentConfig.Builder setLegacyType(int); method @NonNull public android.net.NetworkAgentConfig.Builder setLegacyTypeName(@NonNull String); + method @NonNull public android.net.NetworkAgentConfig.Builder setNat64DetectionEnabled(boolean); method @NonNull public android.net.NetworkAgentConfig.Builder setPartialConnectivityAcceptable(boolean); + method @NonNull public android.net.NetworkAgentConfig.Builder setProvisioningNotificationEnabled(boolean); method @NonNull public android.net.NetworkAgentConfig.Builder setUnvalidatedConnectivityAcceptable(boolean); } diff --git a/packages/Connectivity/framework/src/android/net/NetworkAgentConfig.java b/packages/Connectivity/framework/src/android/net/NetworkAgentConfig.java index 3f058d8cbf12..ad8396b06ddf 100644 --- a/packages/Connectivity/framework/src/android/net/NetworkAgentConfig.java +++ b/packages/Connectivity/framework/src/android/net/NetworkAgentConfig.java @@ -311,26 +311,28 @@ public final class NetworkAgentConfig implements Parcelable { } /** - * Disables active detection of NAT64 (e.g., via RFC 7050 DNS lookups). Used to save power - * and reduce idle traffic on networks that are known to be IPv6-only without a NAT64. + * Enables or disables active detection of NAT64 (e.g., via RFC 7050 DNS lookups). Used to + * save power and reduce idle traffic on networks that are known to be IPv6-only without a + * NAT64. By default, NAT64 detection is enabled. * * @return this builder, to facilitate chaining. */ @NonNull - public Builder disableNat64Detection() { - mConfig.skip464xlat = true; + public Builder setNat64DetectionEnabled(boolean enabled) { + mConfig.skip464xlat = !enabled; return this; } /** - * Disables the "Sign in to network" notification. Used if the network transport will - * perform its own carrier-specific provisioning procedure. + * Enables or disables the "Sign in to network" notification. Used if the network transport + * will perform its own carrier-specific provisioning procedure. By default, the + * notification is enabled. * * @return this builder, to facilitate chaining. */ @NonNull - public Builder disableProvisioningNotification() { - mConfig.provisioningNotificationDisabled = true; + public Builder setProvisioningNotificationEnabled(boolean enabled) { + mConfig.provisioningNotificationDisabled = !enabled; return this; } diff --git a/tests/net/common/java/android/net/NetworkAgentConfigTest.kt b/tests/net/common/java/android/net/NetworkAgentConfigTest.kt index 1e54093bf111..db939f907ce8 100644 --- a/tests/net/common/java/android/net/NetworkAgentConfigTest.kt +++ b/tests/net/common/java/android/net/NetworkAgentConfigTest.kt @@ -63,8 +63,8 @@ class NetworkAgentConfigTest { setPartialConnectivityAcceptable(false) setUnvalidatedConnectivityAcceptable(true) setLegacyTypeName("TEST_NETWORK") - disableNat64Detection() - disableProvisioningNotification() + setNat64DetectionEnabled(false) + setProvisioningNotificationEnabled(false) }.build() assertTrue(config.isExplicitlySelected()) |