Index: adblock-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineUpdaterTest.java
diff --git a/adblock-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineUpdaterTest.java b/adblock-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineUpdaterTest.java
deleted file mode 100644
index fe7657a7e32bdc66ec810f3f787dfdc3de7610b6..0000000000000000000000000000000000000000
--- a/adblock-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineUpdaterTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * This file is part of Adblock Plus ,
- * Copyright (C) 2006-present eyeo GmbH
- *
- * Adblock Plus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * Adblock Plus is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Adblock Plus. If not, see .
- */
-
-package org.adblockplus.libadblockplus.tests;
-
-import org.adblockplus.libadblockplus.MockUpdateAvailableCallback;
-import org.adblockplus.libadblockplus.NoOpUpdaterCallback;
-import org.adblockplus.libadblockplus.ServerResponse;
-
-import org.junit.Test;
-
-public class FilterEngineUpdaterTest extends UpdaterTest
-{
- @Test
- public void testSetRemoveUpdateAvailableCallback() throws InterruptedException
- {
- mockWebRequest.response.setStatus(ServerResponse.NsStatus.OK);
- mockWebRequest.response.setResponseStatus(200);
- mockWebRequest.response.setResponse(
- "{\n" +
- " \"test\": {\n" +
- " \"version\": \"1.0.2\",\n" +
- " \"url\": \"https://downloads.adblockplus.org/test-1.0.2.tar.gz?update\"\n" +
- " }\n" +
- "}");
-
- MockUpdateAvailableCallback mockUpdateAvailableCallback =
- new MockUpdateAvailableCallback(0);
- filterEngine.setUpdateAvailableCallback(mockUpdateAvailableCallback);
- filterEngine.forceUpdateCheck(new NoOpUpdaterCallback());
- Thread.sleep(1000);
- assertEquals(1, mockUpdateAvailableCallback.getTimesCalled());
-
- filterEngine.removeUpdateAvailableCallback();
- filterEngine.forceUpdateCheck(new NoOpUpdaterCallback());
- Thread.sleep(1000);
- assertEquals(1, mockUpdateAvailableCallback.getTimesCalled());
- }
-}
Index: adblock-android-tests/src/org/adblockplus/libadblockplus/tests/UpdateCheckTest.java
diff --git a/adblock-android-tests/src/org/adblockplus/libadblockplus/tests/UpdateCheckTest.java b/adblock-android-tests/src/org/adblockplus/libadblockplus/tests/UpdateCheckTest.java
deleted file mode 100644
index 2aa5c139002e268952c385f8fbd9cac51cb0ed2a..0000000000000000000000000000000000000000
--- a/adblock-android-tests/src/org/adblockplus/libadblockplus/tests/UpdateCheckTest.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * This file is part of Adblock Plus ,
- * Copyright (C) 2006-present eyeo GmbH
- *
- * Adblock Plus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * Adblock Plus is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Adblock Plus. If not, see .
- */
-
-package org.adblockplus.libadblockplus.tests;
-
-import org.adblockplus.libadblockplus.AppInfo;
-import org.adblockplus.libadblockplus.EventCallback;
-import org.adblockplus.libadblockplus.HeaderEntry;
-import org.adblockplus.libadblockplus.JsValue;
-import org.adblockplus.libadblockplus.LazyLogSystem;
-import org.adblockplus.libadblockplus.LazyWebRequest;
-import org.adblockplus.libadblockplus.Platform;
-import org.adblockplus.libadblockplus.ServerResponse;
-import org.adblockplus.libadblockplus.UpdateCheckDoneCallback;
-
-import org.junit.Test;
-
-import java.util.List;
-
-public class UpdateCheckTest extends BaseFilterEngineTest
-{
- protected String previousRequestUrl;
-
- public class TestWebRequest extends LazyWebRequest
- {
- public ServerResponse response = new ServerResponse();
-
- @Override
- public ServerResponse httpGET(String url, List headers)
- {
- if (url.indexOf("easylist") >= 0)
- {
- return super.httpGET(url, headers);
- }
-
- previousRequestUrl = url;
- return response;
- }
- }
-
- protected AppInfo appInfo;
- protected TestWebRequest webRequest;
-
- protected boolean eventCallbackCalled;
- protected List eventCallbackParams;
- protected boolean updateCallbackCalled;
- protected String updateError;
-
- private EventCallback eventCallback = new EventCallback()
- {
- @Override
- public void eventCallback(List params)
- {
- eventCallbackCalled = true;
- eventCallbackParams = params;
- }
- };
-
- private UpdateCheckDoneCallback updateCallback = new UpdateCheckDoneCallback()
- {
- @Override
- public void updateCheckDoneCallback(String error)
- {
- updateCallbackCalled = true;
- updateError = error;
- }
- };
-
- public void reset() throws InterruptedException
- {
- disposeFilterEngine();
- if (platform != null)
- {
- platform.dispose();
- }
- platform = new Platform(new LazyLogSystem(), webRequest,
- getContext().getFilesDir().getAbsolutePath());
- platform.setUpJsEngine(appInfo);
- platform.getJsEngine().setEventCallback("updateAvailable", eventCallback);
- filterEngine = platform.getFilterEngine();
- }
-
- @Override
- protected void setUp() throws Exception
- {
- appInfo = AppInfo.builder().build();
- webRequest = new TestWebRequest();
- eventCallbackCalled = false;
- updateCallbackCalled = false;
- reset();
- }
-
- public void forceUpdateCheck()
- {
- filterEngine.forceUpdateCheck(updateCallback);
- }
-
- @Test
- public void testRequestFailure() throws InterruptedException
- {
- webRequest.response.setStatus(ServerResponse.NsStatus.ERROR_FAILURE);
-
- appInfo = AppInfo
- .builder()
- .setName("1")
- .setVersion("3")
- .setApplication("4")
- .setApplicationVersion("2")
- .setDevelopmentBuild(false)
- .build();
-
- reset();
- forceUpdateCheck();
-
- Thread.sleep(100);
-
- assertFalse(eventCallbackCalled);
- assertTrue(updateCallbackCalled);
- assertNotNull(updateError);
-
- String expectedUrl = filterEngine.getPref("update_url_release").asString();
- String platform = "libadblockplus";
- String platformVersion = "1.0";
-
- expectedUrl = expectedUrl
- .replaceAll("%NAME%", appInfo.name)
- .replaceAll("%TYPE%", "1"); // manual update
-
- expectedUrl +=
- "&addonName=" + appInfo.name +
- "&addonVersion=" + appInfo.version +
- "&application=" + appInfo.application +
- "&applicationVersion=" + appInfo.applicationVersion +
- "&platform=" + platform +
- "&platformVersion=" + platformVersion +
- "&lastVersion=0&downloadCount=0";
-
- assertEquals(expectedUrl, previousRequestUrl);
- }
-
- @Test
- public void testApplicationUpdateAvailable() throws InterruptedException
- {
- webRequest.response.setStatus(ServerResponse.NsStatus.OK);
- webRequest.response.setResponseStatus(200);
- webRequest.response.setResponse(
- "{\"1/4\": {\"version\":\"3.1\",\"url\":\"https://foo.bar/\"}}");
-
- appInfo = AppInfo
- .builder()
- .setName("1")
- .setVersion("3")
- .setApplication("4")
- .setApplicationVersion("2")
- .setDevelopmentBuild(true)
- .build();
-
- reset();
- forceUpdateCheck();
-
- Thread.sleep(1000);
-
- assertTrue(eventCallbackCalled);
- assertNotNull(eventCallbackParams);
- assertEquals(1l, eventCallbackParams.size());
- assertEquals("https://foo.bar/", eventCallbackParams.get(0).asString());
- assertTrue(updateCallbackCalled);
- assertEquals("", updateError);
- }
-
- @Test
- public void testWrongApplication() throws InterruptedException
- {
- webRequest.response.setStatus(ServerResponse.NsStatus.OK);
- webRequest.response.setResponseStatus(200);
- webRequest.response.setResponse(
- "{\"1/3\": {\"version\":\"3.1\",\"url\":\"https://foo.bar/\"}}");
-
- appInfo = AppInfo
- .builder()
- .setName("1")
- .setVersion("3")
- .setApplication("4")
- .setApplicationVersion("2")
- .setDevelopmentBuild(true)
- .build();
-
- reset();
- forceUpdateCheck();
-
- Thread.sleep(1000);
-
- assertFalse(eventCallbackCalled);
- assertTrue(updateCallbackCalled);
- assertEquals("", updateError);
- }
-
- @Test
- public void testWrongVersion() throws InterruptedException
- {
- webRequest.response.setStatus(ServerResponse.NsStatus.OK);
- webRequest.response.setResponseStatus(200);
- webRequest.response.setResponse(
- "{\"1\": {\"version\":\"3\",\"url\":\"https://foo.bar/\"}}");
-
- appInfo = AppInfo
- .builder()
- .setName("1")
- .setVersion("3")
- .setApplication("4")
- .setApplicationVersion("2")
- .setDevelopmentBuild(true)
- .build();
-
- reset();
- forceUpdateCheck();
-
- Thread.sleep(1000);
-
- assertFalse(eventCallbackCalled);
- assertTrue(updateCallbackCalled);
- assertEquals("", updateError);
- }
-
- @Test
- public void testWrongURL() throws InterruptedException
- {
- webRequest.response.setStatus(ServerResponse.NsStatus.OK);
- webRequest.response.setResponseStatus(200);
- webRequest.response.setResponse(
- "{\"1\": {\"version\":\"3.1\",\"url\":\"http://insecure/\"}}");
-
- appInfo = AppInfo
- .builder()
- .setName("1")
- .setVersion("3")
- .setApplication("4")
- .setApplicationVersion("2")
- .setDevelopmentBuild(true)
- .build();
-
- reset();
- forceUpdateCheck();
-
- Thread.sleep(1000);
-
- assertFalse(eventCallbackCalled);
- assertTrue(updateCallbackCalled);
- assertTrue(updateError.length() > 0);
- }
-}
Index: adblock-android-tests/src/org/adblockplus/libadblockplus/tests/UpdaterTest.java
diff --git a/adblock-android-tests/src/org/adblockplus/libadblockplus/tests/UpdaterTest.java b/adblock-android-tests/src/org/adblockplus/libadblockplus/tests/UpdaterTest.java
deleted file mode 100644
index d27df60e7d9cf6e7a042ad4464d1b3732bfb6678..0000000000000000000000000000000000000000
--- a/adblock-android-tests/src/org/adblockplus/libadblockplus/tests/UpdaterTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is part of Adblock Plus ,
- * Copyright (C) 2006-present eyeo GmbH
- *
- * Adblock Plus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * Adblock Plus is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Adblock Plus. If not, see .
- */
-
-package org.adblockplus.libadblockplus.tests;
-
-import org.adblockplus.libadblockplus.AppInfo;
-import org.adblockplus.libadblockplus.MockWebRequest;
-import org.adblockplus.libadblockplus.Platform;
-
-public class UpdaterTest extends BaseFilterEngineTest
-{
- protected MockWebRequest mockWebRequest;
-
- @Override
- protected void setUp() throws Exception
- {
- AppInfo appInfo = AppInfo
- .builder()
- .setName("test")
- .setVersion("1.0.1")
- .build();
- mockWebRequest = new MockWebRequest();
- platform = new Platform(null, mockWebRequest,
- getContext().getFilesDir().getAbsolutePath());
- platform.setUpJsEngine(appInfo);
- filterEngine = platform.getFilterEngine();
- }
-}
Index: adblock-android/jni/JniUpdateAvailableCallback.cpp
diff --git a/adblock-android/jni/JniUpdateAvailableCallback.cpp b/adblock-android/jni/JniUpdateAvailableCallback.cpp
deleted file mode 100644
index 25c84a5800f18562c6ce38b912f2da747cc1ed6f..0000000000000000000000000000000000000000
--- a/adblock-android/jni/JniUpdateAvailableCallback.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * This file is part of Adblock Plus ,
- * Copyright (C) 2006-present eyeo GmbH
- *
- * Adblock Plus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * Adblock Plus is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Adblock Plus. If not, see .
- */
-
-#include "JniCallbacks.h"
-
-static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject callbackObject)
-{
- try
- {
- return JniPtrToLong(new JniUpdateAvailableCallback(env, callbackObject));
- }
- CATCH_THROW_AND_RETURN(env, 0)
-}
-
-static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr)
-{
- delete JniLongToTypePtr(ptr);
-}
-
-JniUpdateAvailableCallback::JniUpdateAvailableCallback(
- JNIEnv* env, jobject callbackObject)
- : JniCallbackBase(env, callbackObject)
-{
-}
-
-void JniUpdateAvailableCallback::Callback(const std::string& arg)
-{
- JNIEnvAcquire env(GetJavaVM());
-
- jmethodID method = env->GetMethodID(
- *JniLocalReference(*env,
- env->GetObjectClass(GetCallbackObject())),
- "updateAvailableCallback",
- "(Ljava/lang/String;)V");
-
- if (method)
- {
- JniLocalReference jArg(*env, env->NewStringUTF(arg.c_str()));
- env->CallVoidMethod(GetCallbackObject(), method, *jArg);
- }
-
- CheckAndLogJavaException(*env);
-}
-
-static JNINativeMethod methods[] =
-{
- { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor },
- { (char*)"dtor", (char*)"(J)V", (void*)JniDtor }
-};
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_adblockplus_libadblockplus_UpdateAvailableCallback_registerNatives(
- JNIEnv *env, jclass clazz)
-{
- env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0]));
-}
Index: adblock-android/jni/JniUpdateCheckDoneCallback.cpp
diff --git a/adblock-android/jni/JniUpdateCheckDoneCallback.cpp b/adblock-android/jni/JniUpdateCheckDoneCallback.cpp
deleted file mode 100644
index 6224630cd96b7c27170e5a1908060205dcaf54fa..0000000000000000000000000000000000000000
--- a/adblock-android/jni/JniUpdateCheckDoneCallback.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * This file is part of Adblock Plus ,
- * Copyright (C) 2006-present eyeo GmbH
- *
- * Adblock Plus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * Adblock Plus is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Adblock Plus. If not, see .
- */
-
-#include "JniCallbacks.h"
-
-static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject callbackObject)
-{
- try
- {
- return JniPtrToLong(new JniUpdateCheckDoneCallback(env, callbackObject));
- }
- CATCH_THROW_AND_RETURN(env, 0)
-}
-
-static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr)
-{
- delete JniLongToTypePtr(ptr);
-}
-
-JniUpdateCheckDoneCallback::JniUpdateCheckDoneCallback(
- JNIEnv* env, jobject callbackObject)
- : JniCallbackBase(env, callbackObject)
-{
-}
-
-void JniUpdateCheckDoneCallback::Callback(const std::string& arg)
-{
- JNIEnvAcquire env(GetJavaVM());
-
- jmethodID method = env->GetMethodID(
- *JniLocalReference(*env,
- env->GetObjectClass(GetCallbackObject())),
- "updateCheckDoneCallback",
- "(Ljava/lang/String;)V");
-
- if (method)
- {
- JniLocalReference jArg(*env, env->NewStringUTF(arg.c_str()));
- env->CallVoidMethod(GetCallbackObject(), method, *jArg);
- }
-
- CheckAndLogJavaException(*env);
-}
-
-static JNINativeMethod methods[] =
-{
- { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor },
- { (char*)"dtor", (char*)"(J)V", (void*)JniDtor }
-};
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_adblockplus_libadblockplus_UpdateCheckDoneCallback_registerNatives(
- JNIEnv *env, jclass clazz)
-{
- env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0]));
-}
Index: adblock-android/src/org/adblockplus/libadblockplus/UpdateAvailableCallback.java
diff --git a/adblock-android/src/org/adblockplus/libadblockplus/UpdateAvailableCallback.java b/adblock-android/src/org/adblockplus/libadblockplus/UpdateAvailableCallback.java
deleted file mode 100644
index 0ab694b4ac9cea663add0b0d1686c055e7a99134..0000000000000000000000000000000000000000
--- a/adblock-android/src/org/adblockplus/libadblockplus/UpdateAvailableCallback.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * This file is part of Adblock Plus ,
- * Copyright (C) 2006-present eyeo GmbH
- *
- * Adblock Plus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * Adblock Plus is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Adblock Plus. If not, see .
- */
-
-package org.adblockplus.libadblockplus;
-
-public abstract class UpdateAvailableCallback implements Disposable
-{
- private final Disposer disposer;
- protected final long ptr;
-
- static
- {
- System.loadLibrary("adblockplus-jni");
- registerNatives();
- }
-
- public UpdateAvailableCallback()
- {
- this.ptr = ctor(this);
- this.disposer = new Disposer(this, new DisposeWrapper(this.ptr));
- }
-
- public abstract void updateAvailableCallback(String url);
-
- @Override
- public void dispose()
- {
- this.disposer.dispose();
- }
-
- private final static class DisposeWrapper implements Disposable
- {
- private final long ptr;
-
- public DisposeWrapper(final long ptr)
- {
- this.ptr = ptr;
- }
-
- @Override
- public void dispose()
- {
- dtor(this.ptr);
- }
- }
-
- private final static native void registerNatives();
-
- private final static native long ctor(Object callbackObject);
-
- private final static native void dtor(long ptr);
-}
Index: adblock-android/src/org/adblockplus/libadblockplus/UpdateCheckDoneCallback.java
diff --git a/adblock-android/src/org/adblockplus/libadblockplus/UpdateCheckDoneCallback.java b/adblock-android/src/org/adblockplus/libadblockplus/UpdateCheckDoneCallback.java
deleted file mode 100644
index dfb04ecd7900b1881a175d1fb6a335f8658e3fd0..0000000000000000000000000000000000000000
--- a/adblock-android/src/org/adblockplus/libadblockplus/UpdateCheckDoneCallback.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * This file is part of Adblock Plus ,
- * Copyright (C) 2006-present eyeo GmbH
- *
- * Adblock Plus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * Adblock Plus is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Adblock Plus. If not, see .
- */
-
-package org.adblockplus.libadblockplus;
-
-public abstract class UpdateCheckDoneCallback implements Disposable
-{
- private final Disposer disposer;
- protected final long ptr;
-
- static
- {
- System.loadLibrary("adblockplus-jni");
- registerNatives();
- }
-
- public UpdateCheckDoneCallback()
- {
- this.ptr = ctor(this);
- this.disposer = new Disposer(this, new DisposeWrapper(this.ptr));
- }
-
- public abstract void updateCheckDoneCallback(String error);
-
- @Override
- public void dispose()
- {
- this.disposer.dispose();
- }
-
- private final static class DisposeWrapper implements Disposable
- {
- private final long ptr;
-
- public DisposeWrapper(final long ptr)
- {
- this.ptr = ptr;
- }
-
- @Override
- public void dispose()
- {
- dtor(this.ptr);
- }
- }
-
- private final static native void registerNatives();
-
- private final static native long ctor(Object callbackObject);
-
- private final static native void dtor(long ptr);
-}
Index: adblock-android/jni/Android.mk
diff --git a/adblock-android/jni/Android.mk b/adblock-android/jni/Android.mk
index f40b5b11ac8f7d5e686c7be35604bdea9ce71ca8..7fcdaf24bdbf60254239697aec560082dd746434 100755
--- a/adblock-android/jni/Android.mk
+++ b/adblock-android/jni/Android.mk
@@ -103,7 +103,6 @@ LOCAL_SRC_FILES += JniPlatform.cpp
LOCAL_SRC_FILES += JniJsEngine.cpp JniFilterEngine.cpp JniJsValue.cpp
LOCAL_SRC_FILES += JniFilter.cpp JniSubscription.cpp JniEventCallback.cpp
LOCAL_SRC_FILES += JniLogSystem.cpp JniWebRequest.cpp
-LOCAL_SRC_FILES += JniUpdateAvailableCallback.cpp JniUpdateCheckDoneCallback.cpp
LOCAL_SRC_FILES += JniFilterChangeCallback.cpp JniCallbacks.cpp Utils.cpp
LOCAL_SRC_FILES += JniNotification.cpp JniShowNotificationCallback.cpp
LOCAL_SRC_FILES += JniIsAllowedConnectionTypeCallback.cpp
Index: adblock-android/jni/JniFilterEngine.cpp
diff --git a/adblock-android/jni/JniFilterEngine.cpp b/adblock-android/jni/JniFilterEngine.cpp
index 25134f429cc65efe97f2b100390df51bb1f6737e..491e2a1ff237c8955d8ad85c5170a239971fc765 100644
--- a/adblock-android/jni/JniFilterEngine.cpp
+++ b/adblock-android/jni/JniFilterEngine.cpp
@@ -174,34 +174,6 @@ static jobject JNICALL JniFetchAvailableSubscriptions(JNIEnv* env, jclass clazz,
CATCH_THROW_AND_RETURN(env, 0);
}
-static void JNICALL JniRemoveUpdateAvailableCallback(JNIEnv* env, jclass clazz,
- jlong ptr)
-{
- AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr);
- try
- {
- engine.RemoveUpdateAvailableCallback();
- }
- CATCH_AND_THROW(env)
-}
-
-static void JNICALL JniSetUpdateAvailableCallback(JNIEnv* env, jclass clazz,
- jlong ptr, jlong callbackPtr)
-{
- AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr);
- JniUpdateAvailableCallback* const callback =
- JniLongToTypePtr(callbackPtr);
-
- const AdblockPlus::FilterEngine::UpdateAvailableCallback updateAvailableCallback =
- std::bind(&JniUpdateAvailableCallback::Callback, callback,
- std::placeholders::_1);
- try
- {
- engine.SetUpdateAvailableCallback(updateAvailableCallback);
- }
- CATCH_AND_THROW(env)
-}
-
static void JNICALL JniRemoveFilterChangeCallback(JNIEnv* env, jclass clazz, jlong ptr)
{
AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr);
@@ -232,29 +204,6 @@ static void JNICALL JniSetFilterChangeCallback(JNIEnv* env, jclass clazz,
CATCH_AND_THROW(env)
}
-static void JNICALL JniForceUpdateCheck(JNIEnv* env, jclass clazz, jlong ptr, jlong updaterPtr)
-{
- AdblockPlus::FilterEngine& engine = GetFilterEngineRef(ptr);
- JniUpdateCheckDoneCallback* callback =
- JniLongToTypePtr(updaterPtr);
-
- AdblockPlus::FilterEngine::UpdateCheckDoneCallback
- updateCheckDoneCallback = 0;
-
- if (updaterPtr)
- {
- updateCheckDoneCallback =
- std::bind(&JniUpdateCheckDoneCallback::Callback, callback,
- std::placeholders::_1);
- }
-
- try
- {
- engine.ForceUpdateCheck(updateCheckDoneCallback);
- }
- CATCH_AND_THROW(env)
-}
-
static jobject JNICALL JniGetElementHidingSelectors(JNIEnv* env, jclass clazz,
jlong ptr, jstring jDomain)
{
@@ -520,11 +469,8 @@ static JNINativeMethod methods[] =
{ (char*)"removeShowNotificationCallback", (char*)"(J)V", (void*)JniRemoveShowNotificationCallback },
{ (char*)"getListedSubscriptions", (char*)"(J)Ljava/util/List;", (void*)JniGetListedSubscriptions },
{ (char*)"fetchAvailableSubscriptions", (char*)"(J)Ljava/util/List;", (void*)JniFetchAvailableSubscriptions },
- { (char*)"setUpdateAvailableCallback", (char*)"(JJ)V", (void*)JniSetUpdateAvailableCallback },
- { (char*)"removeUpdateAvailableCallback", (char*)"(J)V", (void*)JniRemoveUpdateAvailableCallback },
{ (char*)"setFilterChangeCallback", (char*)"(JJ)V", (void*)JniSetFilterChangeCallback },
{ (char*)"removeFilterChangeCallback", (char*)"(J)V", (void*)JniRemoveFilterChangeCallback },
- { (char*)"forceUpdateCheck", (char*)"(JJ)V", (void*)JniForceUpdateCheck },
{ (char*)"getElementHidingSelectors", (char*)"(JLjava/lang/String;)Ljava/util/List;", (void*)JniGetElementHidingSelectors },
{ (char*)"matches", (char*)"(JLjava/lang/String;" TYP("FilterEngine$ContentType") "Ljava/lang/String;)" TYP("Filter"), (void*)JniMatches },
{ (char*)"matches", (char*)"(JLjava/lang/String;" TYP("FilterEngine$ContentType") "[Ljava/lang/String;)" TYP("Filter"), (void*)JniMatchesMany },
Index: adblock-android/src/org/adblockplus/libadblockplus/FilterEngine.java
diff --git a/adblock-android/src/org/adblockplus/libadblockplus/FilterEngine.java b/adblock-android/src/org/adblockplus/libadblockplus/FilterEngine.java
index 182ef7499b190366617a73496af6ba2bda33e15c..a6fa9017141f99886467949206afe885e93c0284 100644
--- a/adblock-android/src/org/adblockplus/libadblockplus/FilterEngine.java
+++ b/adblock-android/src/org/adblockplus/libadblockplus/FilterEngine.java
@@ -71,16 +71,6 @@ public final class FilterEngine
return fetchAvailableSubscriptions(this.ptr);
}
- public void removeUpdateAvailableCallback()
- {
- removeUpdateAvailableCallback(this.ptr);
- }
-
- public void setUpdateAvailableCallback(final UpdateAvailableCallback callback)
- {
- setUpdateAvailableCallback(this.ptr, callback.ptr);
- }
-
public void removeFilterChangeCallback()
{
removeFilterChangeCallback(this.ptr);
@@ -91,16 +81,6 @@ public final class FilterEngine
setFilterChangeCallback(this.ptr, callback.ptr);
}
- public void forceUpdateCheck()
- {
- forceUpdateCheck(this.ptr, 0);
- }
-
- public void forceUpdateCheck(final UpdateCheckDoneCallback callback)
- {
- forceUpdateCheck(this.ptr, callback != null ? callback.ptr : 0);
- }
-
public List getElementHidingSelectors(final String domain)
{
return getElementHidingSelectors(this.ptr, domain);
@@ -218,16 +198,10 @@ public final class FilterEngine
private final static native List fetchAvailableSubscriptions(long ptr);
- private final static native void removeUpdateAvailableCallback(long ptr);
-
- private final static native void setUpdateAvailableCallback(long ptr, long filterPtr);
-
private final static native void removeFilterChangeCallback(long ptr);
private final static native void setFilterChangeCallback(long ptr, long filterPtr);
- private final static native void forceUpdateCheck(long ptr, long updatePtr);
-
private final static native List getElementHidingSelectors(long ptr, String domain);
private final static native void showNextNotification(long ptr, String url);
Index: adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java
diff --git a/adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java b/adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java
index 8cf6ab829fd3c032965aab4fe0e9792be8ece934..76dbddad9099662719bf7a988740d4b51369a280 100644
--- a/adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java
+++ b/adblock-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java
@@ -37,8 +37,6 @@ import org.adblockplus.libadblockplus.LogSystem;
import org.adblockplus.libadblockplus.Platform;
import org.adblockplus.libadblockplus.ShowNotificationCallback;
import org.adblockplus.libadblockplus.Subscription;
-import org.adblockplus.libadblockplus.UpdateAvailableCallback;
-import org.adblockplus.libadblockplus.UpdateCheckDoneCallback;
import org.adblockplus.libadblockplus.WebRequest;
import android.content.Context;
@@ -69,8 +67,6 @@ public final class AdblockEngine
private volatile FilterEngine filterEngine;
private volatile LogSystem logSystem;
private volatile WebRequest webRequest;
- private volatile UpdateAvailableCallback updateAvailableCallback;
- private volatile UpdateCheckDoneCallback updateCheckDoneCallback;
private volatile FilterChangeCallback filterChangeCallback;
private volatile ShowNotificationCallback showNotificationCallback;
private volatile boolean elemhideEnabled;
@@ -178,18 +174,6 @@ public final class AdblockEngine
return this;
}
- public Builder setUpdateAvailableCallback(UpdateAvailableCallback callback)
- {
- engine.updateAvailableCallback = callback;
- return this;
- }
-
- public Builder setUpdateCheckDoneCallback(UpdateCheckDoneCallback callback)
- {
- engine.updateCheckDoneCallback = callback;
- return this;
- }
-
public Builder setShowNotificationCallback(ShowNotificationCallback callback)
{
engine.showNotificationCallback = callback;
@@ -230,11 +214,6 @@ public final class AdblockEngine
private void initCallbacks()
{
- if (engine.updateAvailableCallback != null)
- {
- engine.filterEngine.setUpdateAvailableCallback(engine.updateAvailableCallback);
- }
-
if (engine.showNotificationCallback != null)
{
engine.filterEngine.setShowNotificationCallback(engine.showNotificationCallback);
@@ -292,10 +271,6 @@ public final class AdblockEngine
// engines first
if (this.filterEngine != null)
{
- if (this.updateAvailableCallback != null)
- {
- this.filterEngine.removeUpdateAvailableCallback();
- }
if (this.filterChangeCallback != null)
{
@@ -312,12 +287,6 @@ public final class AdblockEngine
}
// callbacks then
- if (this.updateAvailableCallback != null)
- {
- this.updateAvailableCallback.dispose();
- this.updateAvailableCallback = null;
- }
-
if (this.filterChangeCallback != null)
{
this.filterChangeCallback.dispose();
@@ -626,11 +595,6 @@ public final class AdblockEngine
return this.filterEngine.getElementHidingSelectors(domain);
}
- public void checkForUpdates()
- {
- this.filterEngine.forceUpdateCheck(this.updateCheckDoneCallback);
- }
-
public FilterEngine getFilterEngine()
{
return this.filterEngine;
Index: dependencies
diff --git a/dependencies b/dependencies
index ec13f1355e9fdee0a6753a8352d391ef26560371..c5d2cfaf37d05082a46ba7c46c00b84ae7938bde 100644
--- a/dependencies
+++ b/dependencies
@@ -1,4 +1,4 @@
_root = hg:https://hg.adblockplus.org/ git:https://github.com/adblockplus/
_self = buildtools/ensure_dependencies.py
buildtools = buildtools hg:2f744887c675 git:96b22c9
-libadblockplus = libadblockplus hg:4f6413dbcf2e git:40f5d4d2d00abe3f94ce69210267bcce908cd748
+libadblockplus = libadblockplus git:f2df538b1d66b982fba18a0bc36cf27c1b3bc716