diff --git a/src/main/aidl/com/github/shadowsocks/aidl/Config.aidl b/src/main/aidl/com/github/shadowsocks/aidl/Config.aidl new file mode 100644 index 00000000..667e8d16 --- /dev/null +++ b/src/main/aidl/com/github/shadowsocks/aidl/Config.aidl @@ -0,0 +1,3 @@ +package com.github.shadowsocks.aidl; + +parcelable Config; \ No newline at end of file diff --git a/src/main/aidl/com/github/shadowsocks/aidl/Config.java b/src/main/aidl/com/github/shadowsocks/aidl/Config.java new file mode 100644 index 00000000..f0afc982 --- /dev/null +++ b/src/main/aidl/com/github/shadowsocks/aidl/Config.java @@ -0,0 +1,88 @@ +package com.github.shadowsocks.aidl; + +import android.os.Parcel; +import android.os.Parcelable; + +public class Config implements Parcelable { + + public boolean isGlobalProxy = true; + public boolean isGFWList = true; + public boolean isBypassApps = false; + public boolean isTrafficStat = false; + public boolean isUdpDns = false; + + public String profileName = "Untitled"; + public String proxy = "127.0.0.1"; + public String sitekey = "null"; + + public String encMethod = "rc4"; + public String proxiedAppString = ""; + + public int remotePort = 1984; + public int localPort = 1080; + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public Config createFromParcel(Parcel in) { + return new Config(in); + } + + public Config[] newArray(int size) { + return new Config[size]; + } + }; + + public Config(boolean isGlobalProxy, boolean isGFWList, boolean isBypassApps, + boolean isTrafficStat, boolean isUdpDns, String profileName, String proxy, String sitekey, + String encMethod, String proxiedAppString, int remotePort, int localPort) { + this.isGlobalProxy = isGlobalProxy; + this.isGFWList = isGFWList; + this.isBypassApps = isBypassApps; + this.isTrafficStat = isTrafficStat; + this.isUdpDns = isUdpDns; + this.profileName = profileName; + this.proxy = proxy; + this.sitekey = sitekey; + this.encMethod = encMethod; + this.proxiedAppString = proxiedAppString; + this.remotePort = remotePort; + this.localPort = localPort; + } + + private Config(Parcel in) { + readFromParcel(in); + } + + public void readFromParcel(Parcel in) { + isGlobalProxy = in.readInt() == 1; + isGFWList = in.readInt() == 1; + isBypassApps = in.readInt() == 1; + isTrafficStat = in.readInt() == 1; + isUdpDns = in.readInt() == 1; + profileName = in.readString(); + proxy = in.readString(); + sitekey = in.readString(); + encMethod = in.readString(); + proxiedAppString = in.readString(); + remotePort = in.readInt(); + localPort = in.readInt(); + } + + @Override public int describeContents() { + return 0; + } + + @Override public void writeToParcel(Parcel out, int flags) { + out.writeInt(isGlobalProxy ? 1 : 0); + out.writeInt(isGFWList ? 1 : 0); + out.writeInt(isBypassApps ? 1 : 0); + out.writeInt(isTrafficStat ? 1 : 0); + out.writeInt(isUdpDns ? 1 : 0); + out.writeString(profileName); + out.writeString(proxy); + out.writeString(sitekey); + out.writeString(encMethod); + out.writeString(proxiedAppString); + out.writeInt(remotePort); + out.writeInt(localPort); + } +} diff --git a/src/main/aidl/com/github/shadowsocks/aidl/IShadowsocksService.aidl b/src/main/aidl/com/github/shadowsocks/aidl/IShadowsocksService.aidl new file mode 100644 index 00000000..70667310 --- /dev/null +++ b/src/main/aidl/com/github/shadowsocks/aidl/IShadowsocksService.aidl @@ -0,0 +1,15 @@ +package com.github.shadowsocks.aidl; + +import com.github.shadowsocks.aidl.Config; +import com.github.shadowsocks.aidl.IShadowsocksServiceCallback; + +interface IShadowsocksService { + int getMode(); + int getState(); + + oneway void registerCallback(IShadowsocksServiceCallback cb); + oneway void unregisterCallback(IShadowsocksServiceCallback cb); + + oneway void start(in Config config); + oneway void stop(); +} diff --git a/src/main/aidl/com/github/shadowsocks/aidl/IShadowsocksServiceCallback.aidl b/src/main/aidl/com/github/shadowsocks/aidl/IShadowsocksServiceCallback.aidl new file mode 100644 index 00000000..d079a20c --- /dev/null +++ b/src/main/aidl/com/github/shadowsocks/aidl/IShadowsocksServiceCallback.aidl @@ -0,0 +1,5 @@ +package com.github.shadowsocks.aidl; + +interface IShadowsocksServiceCallback { + oneway void stateChanged(int state, String msg); +} diff --git a/src/main/res/xml/pref_all.xml b/src/main/res/xml/pref_all.xml new file mode 100644 index 00000000..031f9550 --- /dev/null +++ b/src/main/res/xml/pref_all.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +