From f5324d7d03fba3ad9a17e09b00b3c3dcae515fd5 Mon Sep 17 00:00:00 2001 From: Chiachang Wang Date: Thu, 8 Apr 2021 12:56:51 +0800 Subject: [PATCH] Rename APIs in NetworkAgentConfig.Builder As API review feedback, rename disableProvisioningNotification() to setEnabledProvisioningNotification and disableNat64Detection() to setEnabledNat64Detection. Also, update code in caller side accordingly. Bug: 184735772 Test: make update-api ; atest FrameworksNetTests Change-Id: If7305634863d1503c967e5593ebd0c8af2174bea --- framework/api/system-current.txt | 4 ++-- .../src/android/net/NetworkAgentConfig.java | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/framework/api/system-current.txt b/framework/api/system-current.txt index d6d38889e9..de673ee971 100644 --- a/framework/api/system-current.txt +++ b/framework/api/system-current.txt @@ -259,15 +259,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/framework/src/android/net/NetworkAgentConfig.java b/framework/src/android/net/NetworkAgentConfig.java index 3f058d8cbf..ad8396b06d 100644 --- a/framework/src/android/net/NetworkAgentConfig.java +++ b/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; }