This commit is contained in:
Max Lv
2014-02-09 15:55:30 +08:00
parent abf050a43a
commit c4833ddbca
14 changed files with 698 additions and 674 deletions
@@ -0,0 +1,3 @@
package com.github.shadowsocks.aidl;
parcelable Config;
@@ -0,0 +1,86 @@
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 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<Config> CREATOR = new
Parcelable.Creator<Config>() {
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, 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.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;
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.writeString(profileName);
out.writeString(proxy);
out.writeString(sitekey);
out.writeString(encMethod);
out.writeString(proxiedAppString);
out.writeInt(remotePort);
out.writeInt(localPort);
}
}
@@ -0,0 +1,13 @@
package com.github.shadowsocks.aidl;
import com.github.shadowsocks.aidl.Config;
import com.github.shadowsocks.aidl.IShadowsocksServiceCallback;
interface IShadowsocksService {
int getMode();
int getState();
void start(in Config config);
void stop();
void registerCallback(IShadowsocksServiceCallback cb);
void unregisterCallback(IShadowsocksServiceCallback cb);
}
@@ -0,0 +1,5 @@
package com.github.shadowsocks.aidl;
interface IShadowsocksServiceCallback {
void stateChanged(int state, String msg);
}