package guard.api.sensitive.ui.sapiguard.hookedapis;

import java.util.ArrayList;
import java.util.List;

import guard.api.sensitive.ui.sapiguard.utils.PrivacyManager;
import guard.api.sensitive.ui.sapiguard.XHook;
import guard.api.sensitive.ui.sapiguard.utils.XParam;

public class XProcessBuilder extends XHook {

	private String mCommand;

	private XProcessBuilder(String methodName, String restrictionName, String command) {
		super(restrictionName, methodName, command);
		mCommand = command;
	}

	public String getClassName() {
		return "java.lang.ProcessBuilder";
	}

	// public Process start()
	// libcore/luni/src/main/java/java/lang/ProcessBuilder.java
	// http://developer.android.com/reference/java/lang/ProcessBuilder.html

	public static List<XHook> getInstances() {
		List<XHook> listHook = new ArrayList<XHook>();
		listHook.add(new XProcessBuilder("start", PrivacyManager.cShell, "sh"));
		listHook.add(new XProcessBuilder("start", PrivacyManager.cShell, "su"));
		listHook.add(new XProcessBuilder("start", PrivacyManager.cShell, null));
		return listHook;
	}

	@Override
	protected void before(XParam param) throws Throwable {
		String methodName = param.method.getName();
		if (methodName.equals("start")) {

		} else{}
	}

	@Override
	protected void after(XParam param) throws Throwable {
		// Do nothing
	}
}
