Improve check for invalid connection request
The check currently relies on the default value of 0 returned if the Bundle doesn't define a pid. But in some cases, like Robolectric unit tests, 0 is a possible pid. The check can be improved by directly asserting that the value is defined. PiperOrigin-RevId: 521414649
This commit is contained in:
parent
0bfe43866a
commit
694d690bc0
@ -89,8 +89,8 @@ import androidx.media3.common.util.Util;
|
||||
int controllerInterfaceVersion =
|
||||
bundle.getInt(FIELD_CONTROLLER_INTERFACE_VERSION, /* defaultValue= */ 0);
|
||||
String packageName = checkNotNull(bundle.getString(FIELD_PACKAGE_NAME));
|
||||
int pid = bundle.getInt(FIELD_PID, /* defaultValue= */ 0);
|
||||
checkArgument(pid != 0);
|
||||
checkArgument(bundle.containsKey(FIELD_PID));
|
||||
int pid = bundle.getInt(FIELD_PID);
|
||||
@Nullable Bundle connectionHints = bundle.getBundle(FIELD_CONNECTION_HINTS);
|
||||
return new ConnectionRequest(
|
||||
libraryVersion,
|
||||
|
Loading…
x
Reference in New Issue
Block a user