commit | b96b07febed26c41725c72825f392e4c925dc5f3 | [log] [tgz] |
---|---|---|
author | Lucas Lin <lucaslin@google.com> | Thu Jan 28 04:28:10 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Jan 28 04:28:10 2021 +0000 |
tree | 6d52a96ac41b976053f54f2ea4481c7ece7d273d | |
parent | 2b6868d243d44380e4072df79070104a8a69c72e [diff] | |
parent | d15fcc3048e955d7f8a6e4f8d0ee8738c16fb1aa [diff] |
Merge "Check if NetworkSpecifier is an instance of MatchAllNetworkSpecifier" am: d15fcc3048 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556546 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ibd01df52928e13717eae903c49e201f7bf39940e
diff --git a/core/java/android/net/NetworkRequest.java b/core/java/android/net/NetworkRequest.java index f0c637c..04011fc 100644 --- a/core/java/android/net/NetworkRequest.java +++ b/core/java/android/net/NetworkRequest.java
@@ -353,7 +353,9 @@ * NetworkSpecifier. */ public Builder setNetworkSpecifier(NetworkSpecifier networkSpecifier) { - MatchAllNetworkSpecifier.checkNotMatchAllNetworkSpecifier(networkSpecifier); + if (networkSpecifier instanceof MatchAllNetworkSpecifier) { + throw new IllegalArgumentException("A MatchAllNetworkSpecifier is not permitted"); + } mNetworkCapabilities.setNetworkSpecifier(networkSpecifier); return this; }
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 74a6e07..410ec1d 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -5658,7 +5658,9 @@ if (ns == null) { return; } - MatchAllNetworkSpecifier.checkNotMatchAllNetworkSpecifier(ns); + if (ns instanceof MatchAllNetworkSpecifier) { + throw new IllegalArgumentException("A MatchAllNetworkSpecifier is not permitted"); + } } private void ensureValid(NetworkCapabilities nc) {