Have setRemoteAddress accept a Nullable remoteAddress
Per API council feedback.
Bug: 388438641
Test: TH
Change-Id: Iba71c4944ebbd91df5fdbb3605fc9edcc2139af5
diff --git a/framework/api/current.txt b/framework/api/current.txt
index a9d1569..a080149 100644
--- a/framework/api/current.txt
+++ b/framework/api/current.txt
@@ -255,7 +255,7 @@
method @NonNull public android.net.L2capNetworkSpecifier build();
method @NonNull public android.net.L2capNetworkSpecifier.Builder setHeaderCompression(int);
method @NonNull public android.net.L2capNetworkSpecifier.Builder setPsm(int);
- method @NonNull public android.net.L2capNetworkSpecifier.Builder setRemoteAddress(@NonNull android.net.MacAddress);
+ method @NonNull public android.net.L2capNetworkSpecifier.Builder setRemoteAddress(@Nullable android.net.MacAddress);
method @NonNull public android.net.L2capNetworkSpecifier.Builder setRole(int);
}
diff --git a/framework/src/android/net/L2capNetworkSpecifier.java b/framework/src/android/net/L2capNetworkSpecifier.java
index c7067f6..82ad05d 100644
--- a/framework/src/android/net/L2capNetworkSpecifier.java
+++ b/framework/src/android/net/L2capNetworkSpecifier.java
@@ -178,11 +178,10 @@
*
* Only valid for client networks. A null MacAddress matches *any* MacAddress.
*
- * @param remoteAddress the MAC address to connect to.
+ * @param remoteAddress the MAC address to connect to, or null to match any MAC address.
*/
@NonNull
- public Builder setRemoteAddress(@NonNull MacAddress remoteAddress) {
- Objects.requireNonNull(remoteAddress);
+ public Builder setRemoteAddress(@Nullable MacAddress remoteAddress) {
mRemoteAddress = remoteAddress;
return this;
}