Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13d9d4ff authored by Mike Lockwood's avatar Mike Lockwood Committed by Android (Google) Code Review
Browse files

Merge "SerialManager: Only allow opening files that are whitelisted serial port devices"

parents 7b172a49 80248d44
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -51,8 +51,13 @@ public class SerialService extends ISerialManager.Stub {

    public ParcelFileDescriptor openSerialPort(String path) {
        mContext.enforceCallingOrSelfPermission(android.Manifest.permission.SERIAL_PORT, null);
        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);
}