From 073dfc4c887f93be0abc588e6584d421994825aa Mon Sep 17 00:00:00 2001 From: lifr Date: Mon, 1 Feb 2021 16:52:18 +0800 Subject: [PATCH] [CS01]Remove hidden API usage of NetworkCapabilities The connection service will become the mainline module. The mutable NetworkCapabilities is deprecated, and the NetworkCapabilities should be built through their Builder instead. Bug: 170598012 Test: atest FrameworksNetTests Test: atest IpConnectivityMetricsTest Change-Id: I73a4d3a7c118b9cef037ed52efb96ed123da2fa5 --- framework/src/android/net/NetworkCapabilities.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/framework/src/android/net/NetworkCapabilities.java b/framework/src/android/net/NetworkCapabilities.java index 9d67f0b843..26d14cbfaa 100644 --- a/framework/src/android/net/NetworkCapabilities.java +++ b/framework/src/android/net/NetworkCapabilities.java @@ -2085,9 +2085,10 @@ public final class NetworkCapabilities implements Parcelable { /** * Check if private dns is broken. * - * @return {@code true} if {@code mPrivateDnsBroken} is set when private DNS is broken. + * @return {@code true} if private DNS is broken on this network. * @hide */ + @SystemApi public boolean isPrivateDnsBroken() { return mPrivateDnsBroken; } @@ -2329,6 +2330,17 @@ public final class NetworkCapabilities implements Parcelable { return this; } + /** + * Completely clears the contents of this object, removing even the capabilities that are + * set by default when the object is constructed. + * @return this builder + */ + @NonNull + public Builder clearAll() { + mCaps.clearAll(); + return this; + } + /** * Sets the owner UID. *