diff --git a/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpDevicePacket.java b/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpDevicePacket.java index 9a2f71a..d350f60 100644 --- a/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpDevicePacket.java +++ b/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpDevicePacket.java @@ -70,13 +70,12 @@ public static UsbIpDevicePacket read(InputStream in) throws IOException { @Override public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(String.format("Command: 0x%x\n", command)); - sb.append(String.format("Seq: %d\n", seqNum)); - sb.append(String.format("Dev ID: 0x%x\n", devId)); - sb.append(String.format("Direction: %d\n", direction)); - sb.append(String.format("Endpoint: %d\n", ep)); - return sb.toString(); + String sb = String.format("Command: 0x%x\n", command) + + String.format("Seq: %d\n", seqNum) + + String.format("Dev ID: 0x%x\n", devId) + + String.format("Direction: %d\n", direction) + + String.format("Endpoint: %d\n", ep); + return sb; } public byte[] serialize() { diff --git a/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpSubmitUrb.java b/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpSubmitUrb.java index a9d307b..9f65a0f 100644 --- a/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpSubmitUrb.java +++ b/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpSubmitUrb.java @@ -56,14 +56,13 @@ public static UsbIpSubmitUrb read(byte[] header, InputStream in) throws IOExcept @Override public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(super.toString()); - sb.append(String.format("Xfer flags: 0x%x\n", transferFlags)); - sb.append(String.format("Xfer length: %d\n", transferBufferLength)); - sb.append(String.format("Start frame: %d\n", startFrame)); - sb.append(String.format("Number Of Packets: %d\n", numberOfPackets)); - sb.append(String.format("Interval: %d\n", interval)); - return sb.toString(); + String sb = super.toString() + + String.format("Xfer flags: 0x%x\n", transferFlags) + + String.format("Xfer length: %d\n", transferBufferLength) + + String.format("Start frame: %d\n", startFrame) + + String.format("Number Of Packets: %d\n", numberOfPackets) + + String.format("Interval: %d\n", interval); + return sb; } @Override diff --git a/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpSubmitUrbReply.java b/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpSubmitUrbReply.java index 25621ca..7c57bae 100644 --- a/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpSubmitUrbReply.java +++ b/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpSubmitUrbReply.java @@ -38,13 +38,12 @@ protected byte[] serializeInternal() { @Override public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(super.toString()); - sb.append(String.format("Status: 0x%x\n", status)); - sb.append(String.format("Actual length: %d\n", actualLength)); - sb.append(String.format("Start frame: %d\n", startFrame)); - sb.append(String.format("Number Of Packets: %d\n", numberOfPackets)); - sb.append(String.format("Error Count: %d\n", errorCount)); - return sb.toString(); + String sb = super.toString() + + String.format("Status: 0x%x\n", status) + + String.format("Actual length: %d\n", actualLength) + + String.format("Start frame: %d\n", startFrame) + + String.format("Number Of Packets: %d\n", numberOfPackets) + + String.format("Error Count: %d\n", errorCount); + return sb; } } diff --git a/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpUnlinkUrb.java b/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpUnlinkUrb.java index cfa61ef..5e82b8a 100644 --- a/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpUnlinkUrb.java +++ b/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpUnlinkUrb.java @@ -35,10 +35,9 @@ public static UsbIpUnlinkUrb read(byte[] header, InputStream in) throws IOExcept @Override public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(super.toString()); - sb.append(String.format("Sequence number to unlink: %d\n", seqNumToUnlink)); - return sb.toString(); + String sb = super.toString() + + String.format("Sequence number to unlink: %d\n", seqNumToUnlink); + return sb; } @Override diff --git a/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpUnlinkUrbReply.java b/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpUnlinkUrbReply.java index adc3bd7..cf57c4f 100644 --- a/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpUnlinkUrbReply.java +++ b/app/src/main/java/org/cgutman/usbip/server/protocol/dev/UsbIpUnlinkUrbReply.java @@ -20,9 +20,8 @@ protected byte[] serializeInternal() { @Override public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(super.toString()); - sb.append(String.format("Status: 0x%x\n", status)); - return sb.toString(); + String sb = super.toString() + + String.format("Status: 0x%x\n", status); + return sb; } } diff --git a/app/src/main/java/org/cgutman/usbip/service/UsbIpService.java b/app/src/main/java/org/cgutman/usbip/service/UsbIpService.java index 8de8764..99f4b71 100644 --- a/app/src/main/java/org/cgutman/usbip/service/UsbIpService.java +++ b/app/src/main/java/org/cgutman/usbip/service/UsbIpService.java @@ -30,7 +30,6 @@ import org.cgutman.usbipserverforandroid.R; import android.annotation.SuppressLint; -import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; @@ -819,7 +818,7 @@ public void abortUrbRequest(Socket s, UsbIpUnlinkUrb msg) { -22); // EINVAL } - class AttachedDeviceContext { + static class AttachedDeviceContext { public UsbDevice device; public UsbDeviceConnection devConn; public ThreadPoolExecutor requestPool; diff --git a/app/src/main/res/layout/activity_usbip_config.xml b/app/src/main/res/layout/activity_usbip_config.xml index fb7e800..92eea4a 100644 --- a/app/src/main/res/layout/activity_usbip_config.xml +++ b/app/src/main/res/layout/activity_usbip_config.xml @@ -1,11 +1,10 @@ + android:paddingTop="@dimen/activity_vertical_margin"> - +