Skip to content

Commit

Permalink
Add --tcpip flag to server
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtr126 committed Jan 28, 2024
1 parent ad37a6d commit ae993dd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
12 changes: 9 additions & 3 deletions app/src/main/java/xtr/keymapper/server/RemoteService.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,19 @@ public RemoteService(String[] args) {
super();
Log.i("XtMapper", "starting server...");
try {
ServiceManager.addService("xtmapper", this);
System.out.println("Waiting for overlay...");
for (String arg: args) {
if (arg.equals("--wayland-client")) {
isWaylandClient = true;
System.out.println("using wayland client");
}
if (arg.equals("--tcpip")) {
start_getevent();
System.out.println("using tcpip");
new RemoteServiceSocketServer(this);
}
}
ServiceManager.addService("xtmapper", this);
start_getevent();
} catch (Exception e) {
e.printStackTrace(System.out);
Expand Down Expand Up @@ -177,7 +182,8 @@ public static void loadLibraries() {
}

public static IRemoteService getInstance(){
return IRemoteService.Stub.asInterface(ServiceManager.getService("xtmapper"));
// return IRemoteService.Stub.asInterface(ServiceManager.getService("xtmapper"));
return new RemoteServiceSocketClient();
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@

public class RemoteServiceSocketClient implements IRemoteService {

private LocalSocket socket;
private final LocalSocket socket;

public RemoteServiceSocketClient() {
socket = new LocalSocket();
try {
socket.connect(new LocalSocketAddress("xtmapper-a3e11694"));
} catch (IOException e) {
throw new RuntimeException(e);
}
}

static private <T extends android.os.Parcelable> void writeTypedObject(
android.os.Parcel parcel, T value, int parcelableFlags) {
Expand Down Expand Up @@ -47,10 +56,6 @@ private boolean transactRemote(int code, Parcel data, Parcel reply, int flags) {
}
return true;
}
public void init() throws IOException {
socket = new LocalSocket();
socket.connect(new LocalSocketAddress("xtmapper-a3e11694"));
}

@Override public boolean isRoot()
{
Expand Down

0 comments on commit ae993dd

Please sign in to comment.