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 XMediaRecorder extends XHook {
    private Methods mMethod;

    private XMediaRecorder(Methods method, String restrictionName) {
        super(restrictionName, method.name(), "MediaRecorder." + method.name());
        mMethod = method;
    }

    public String getClassName() {
        return "android.media.MediaRecorder";
    }

    // void setOutputFile(FileDescriptor fd)
    // void setOutputFile(String path)
    // public prepare()
    // public native void start()
    // void stop()
    // frameworks/base/media/java/android/media/MediaRecorder.java
    // http://developer.android.com/reference/android/media/MediaRecorder.html

    private enum Methods {
        setOutputFile, prepare, start, stop
    }

    ;

    public static List<XHook> getInstances() {
        List<XHook> listHook = new ArrayList<XHook>();
        listHook.add(new XMediaRecorder(Methods.setOutputFile, PrivacyManager.cMedia));
        listHook.add(new XMediaRecorder(Methods.prepare, null));
        listHook.add(new XMediaRecorder(Methods.start, PrivacyManager.cMedia));
        listHook.add(new XMediaRecorder(Methods.stop, null));
        return listHook;
    }

    @Override
    protected void before(XParam param) throws Throwable {
        switch (mMethod) {
            case setOutputFile:
            case start:


            case prepare:
            case stop:

                break;
        }
    }

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