Skip to content

Commit

Permalink
Fix a bunch more Lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman committed Oct 28, 2023
1 parent 7ba29ec commit 1daf88f
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/activity_usbip_config.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
android:paddingTop="@dimen/activity_vertical_margin">

<TextView
android:id="@+id/serviceStatus"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme"></style>
<style name="AppBaseTheme" parent="android:Theme" />

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
Expand Down

0 comments on commit 1daf88f

Please sign in to comment.