Bug:
7367956
Change-Id: I82fd8d2694dda89332497d9eded5445a0262e12b
Signed-off-by: Mike Lockwood <lockwood@google.com>
public ParcelFileDescriptor openSerialPort(String path) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.SERIAL_PORT, null);
- return native_open(path);
+ for (int i = 0; i < mSerialPorts.length; i++) {
+ if (mSerialPorts[i].equals(path)) {
+ return native_open(path);
+ }
+ }
+ throw new IllegalArgumentException("Invalid serial port " + path);
}
private native ParcelFileDescriptor native_open(String path);