From aa2d7f5355942c7c9da7df5089bdbae66d0908cd Mon Sep 17 00:00:00 2001 From: junyulai Date: Wed, 21 Apr 2021 18:47:37 +0800 Subject: [PATCH] Do not deduce VCN capability if Builder is derived from request If the caller constructed the builder from a request, it means the user might explicitly want the capabilities from the request. Thus, the NOT_VCN_MANAGED capabilities should not be touched later. Test: TH Fix: 185876442 Change-Id: I92037cc8547fb72de12d6b6402f060f6c98e1853 --- .../framework/src/android/net/NetworkRequest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/Connectivity/framework/src/android/net/NetworkRequest.java b/packages/Connectivity/framework/src/android/net/NetworkRequest.java index 3a8a07a55ad44..07b6c7d5be6bf 100644 --- a/packages/Connectivity/framework/src/android/net/NetworkRequest.java +++ b/packages/Connectivity/framework/src/android/net/NetworkRequest.java @@ -220,6 +220,10 @@ public class NetworkRequest implements Parcelable { public Builder(@NonNull final NetworkRequest request) { Objects.requireNonNull(request); mNetworkCapabilities = request.networkCapabilities; + // If the caller constructed the builder from a request, it means the user + // might explicitly want the capabilities from the request. Thus, the NOT_VCN_MANAGED + // capabilities should not be touched later. + mModifiedNotVcnManaged = true; } /**