Fix checkstyle errors unrelated to naming scheme

This commit is contained in:
Luiz Henrique Laurini 2021-02-20 13:27:22 -03:00
commit b5e450ce0c
3 changed files with 35 additions and 35 deletions

View file

@ -151,7 +151,7 @@ public final class CleanUp {
} }
private static void unlinkNativeLibs() { private static void unlinkNativeLibs() {
for (String lib : Server.NATIVE_LIBRARIES){ for (String lib : Server.NATIVE_LIBRARIES) {
try { try {
new File(Server.SERVER_DIR + "/" + lib).delete(); new File(Server.SERVER_DIR + "/" + lib).delete();
} catch (Exception e) { } catch (Exception e) {

View file

@ -152,8 +152,7 @@ public class Controller {
int id = msg.getGameControllerId(); int id = msg.getGameControllerId();
int axis = msg.getGameControllerAxis(); int axis = msg.getGameControllerAxis();
int value = msg.getGameControllerAxisValue(); int value = msg.getGameControllerAxisValue();
if (!gameControllers.contains(id)) if (!gameControllers.contains(id)) {
{
Ln.w("Received data for non-existant controller."); Ln.w("Received data for non-existant controller.");
break; break;
} }
@ -165,8 +164,7 @@ public class Controller {
int id = msg.getGameControllerId(); int id = msg.getGameControllerId();
int button = msg.getGameControllerButton(); int button = msg.getGameControllerButton();
int state = msg.getGameControllerButtonState(); int state = msg.getGameControllerButtonState();
if (!gameControllers.contains(id)) if (!gameControllers.contains(id)) {
{
Ln.w("Received data for non-existant controller."); Ln.w("Received data for non-existant controller.");
break; break;
} }
@ -184,14 +182,16 @@ public class Controller {
break; break;
case GameController.DEVICE_REMOVED: case GameController.DEVICE_REMOVED:
if (!gameControllers.contains(id)) if (!gameControllers.contains(id)) {
{
Ln.w("Non-existant game controller removed."); Ln.w("Non-existant game controller removed.");
break; break;
} }
gameControllers.get(id).close(); gameControllers.get(id).close();
gameControllers.delete(id); gameControllers.delete(id);
break; break;
default:
Ln.w("Unknown game controller event received.");
} }
} }
break; break;

View file

@ -1,18 +1,19 @@
package com.genymobile.scrcpy; package com.genymobile.scrcpy;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Platform;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.sun.jna.Library;
import com.sun.jna.Platform;
import com.sun.jna.Native;
import com.sun.jna.Structure;
import com.sun.jna.Pointer;
public final class GameController { public final class GameController {
public static final int DEVICE_ADDED = 0; public static final int DEVICE_ADDED = 0;
public static final int DEVICE_REMOVED = 1; public static final int DEVICE_REMOVED = 1;
private static int UINPUT_MAX_NAME_SIZE = 80; private static final int UINPUT_MAX_NAME_SIZE = 80;
public static class input_id extends Structure { public static class input_id extends Structure {
public short bustype = 0; public short bustype = 0;
@ -56,8 +57,7 @@ public final class GameController {
public input_absinfo absinfo; public input_absinfo absinfo;
@Override @Override
protected List<String> getFieldOrder() protected List<String> getFieldOrder() {
{
return Arrays.asList("code", "absinfo"); return Arrays.asList("code", "absinfo");
} }
}; };
@ -87,19 +87,19 @@ public final class GameController {
} }
} }
private static int _IOC_NONE = 0; private static final int _IOC_NONE = 0;
private static int _IOC_WRITE = 1; private static final int _IOC_WRITE = 1;
private static int _IOC_DIRSHIFT = 30; private static final int _IOC_DIRSHIFT = 30;
private static int _IOC_TYPESHIFT = 8; private static final int _IOC_TYPESHIFT = 8;
private static int _IOC_NRSHIFT = 0; private static final int _IOC_NRSHIFT = 0;
private static int _IOC_SIZESHIFT = 16; private static final int _IOC_SIZESHIFT = 16;
private static int _IOC(int dir, int type, int nr, int size) { private static int _IOC(int dir, int type, int nr, int size) {
return (dir << _IOC_DIRSHIFT) | return (dir << _IOC_DIRSHIFT)
(type << _IOC_TYPESHIFT) | | (type << _IOC_TYPESHIFT)
(nr << _IOC_NRSHIFT) | | (nr << _IOC_NRSHIFT)
(size << _IOC_SIZESHIFT); | (size << _IOC_SIZESHIFT);
} }
private static int _IO(int type, int nr, int size) { private static int _IO(int type, int nr, int size) {
@ -200,7 +200,7 @@ public final class GameController {
private int fd; private int fd;
public interface LibC extends Library { public interface LibC extends Library {
LibC fn = (LibC)Native.load("c", LibC.class); LibC fn = (LibC) Native.load("c", LibC.class);
int open(String pathname, int flags); int open(String pathname, int flags);
int ioctl(int fd, long request, Object... args); int ioctl(int fd, long request, Object... args);
@ -208,7 +208,7 @@ public final class GameController {
int close(int fd); int close(int fd);
} }
static public void load_native_libraries() { public static void load_native_libraries() {
GameController.LibC.fn.write(1, null, 0); GameController.LibC.fn.write(1, null, 0);
} }