package com.cliqz.jsengine;

import android.util.Log;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.concurrent.ExecutionException;

/**
 * Created by sammacbeth on 21/10/2016.
 */

public class AntiTracking {

    private final Engine engine;

    public AntiTracking(Engine engine) {
        this.engine = engine;
    }

    public JSONObject getTabBlockingInfo(final int tabId) {
        try {
            final Object blockingInfo = engine.system.callFunctionOnModuleDefault("antitracking/attrack", "getTabBlockingInfo", tabId);
            return new JSONObject(blockingInfo.toString());
        } catch (ExecutionException e) {
            Log.e("attrack", "getTabBlockingInfo error", e);
        } catch (JSONException e) {
            // shouldn't happen - the parsed json comes directly from JSON.stringify in JS
            throw new RuntimeException(e);
        }
        // on failure return empty object
        return new JSONObject();
    }
}

@@ -257,93 +257,762 @@
 nal 
-Engine engine;%0A%0A    public AntiTracking(Engine engine) %7B%0A        this.engine = engine
+static String ENABLE_PREF = %22antiTrackTest%22;%0A    private final static String QSBLOCKING_PREF = %22attrackRemoveQueryStringTracking%22;%0A    private final static String BLOOM_FILTER_PREF = %22attrackBloomFilter%22;%0A    private final static String FORCE_BLOCK_PREF = %22attrackForceBlock%22;%0A%0A    private final Engine engine;%0A%0A    public AntiTracking(Engine engine) %7B%0A        this.engine = engine;%0A    %7D%0A%0A    public void setEnabled(final boolean enabled) throws ExecutionException %7B%0A        engine.setPref(BLOOM_FILTER_PREF, true);%0A        engine.setPref(ENABLE_PREF, enabled);%0A        engine.setPref(QSBLOCKING_PREF, true);%0A    %7D%0A%0A    public void setForceBlockEnabled(final boolean enabled) throws ExecutionException %7B%0A        engine.setPref(FORCE_BLOCK_PREF, enabled)
 ;%0A  

Add utility functions to AntiTracking