Do not allow L2CAP specifier with ROLE_SERVER and remote address set
This is an invalid combination that never seems useful. Note that this still allows ROLE_ANY in combination with a remote address. This still doesn't seem particularly useful, but there is no good reason to disallow it. Test: TH Change-Id: Ib0b7284cb99ee92f14113f8184af978eeb2318e7
This commit is contained in:
parent
7faa0b486c
commit
5e61925e51
1 changed files with 6 additions and 4 deletions
|
|
@ -240,7 +240,10 @@ public final class L2capNetworkSpecifier extends NetworkSpecifier implements Par
|
|||
/** Create the L2capNetworkSpecifier object. */
|
||||
@NonNull
|
||||
public L2capNetworkSpecifier build() {
|
||||
// TODO: throw an exception for combinations that cannot be supported.
|
||||
if (mRole == ROLE_SERVER && mRemoteAddress != null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Specifying a remote address is not valid for server role.");
|
||||
}
|
||||
return new L2capNetworkSpecifier(mRole, mHeaderCompression, mRemoteAddress, mPsm);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue