Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: jni/abpEngine.cpp

Issue 5336189238247424: Populate AppInfo properly (Closed)
Patch Set: Renamed applicationVersion variable Created Nov. 18, 2013, 3:41 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/org/adblockplus/android/ABPEngine.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: jni/abpEngine.cpp
===================================================================
--- a/jni/abpEngine.cpp
+++ b/jni/abpEngine.cpp
@@ -29,7 +29,9 @@
extern "C"
{
- JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_initialize(JNIEnv *pEnv, jobject, jstring basepath);
+ JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_initialize(
+ JNIEnv *pEnv, jobject object, jstring basePath, jstring version,
+ jstring sdkVersion, jstring locale, jboolean developmentBuild);
JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_release(JNIEnv *pEnv, jobject);
JNIEXPORT jboolean JNICALL Java_org_adblockplus_android_ABPEngine_isFirstRun(JNIEnv *pEnv, jobject);
JNIEXPORT jobjectArray JNICALL Java_org_adblockplus_android_ABPEngine_getListedSubscriptions(JNIEnv *pEnv, jobject);
@@ -192,20 +194,27 @@
{
}
-JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_initialize(JNIEnv *pEnv, jobject pObject, jstring basepath)
+JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_initialize(
+ JNIEnv *pEnv, jobject pObject, jstring basePath, jstring version,
+ jstring sdkVersion, jstring locale, jboolean developmentBuild)
{
D(D_WARN, "nativeInitialize()");
int status = pEnv->GetJavaVM(&globalJvm);
jniObject = pEnv->NewGlobalRef(pObject);
- const std::string path = GetString(pEnv, basepath);
+ AdblockPlus::AppInfo appInfo;
+ appInfo.name = "adblockplusandroid";
+ appInfo.version = GetString(pEnv, version);
+ appInfo.application = "android";
+ appInfo.applicationVersion = GetString(pEnv, sdkVersion);
+ appInfo.locale = GetString(pEnv, locale);
+ appInfo.developmentBuild = developmentBuild;
- AdblockPlus::AppInfo appInfo;
- // TODO Should be extracted from the manifest
- appInfo.version = "1.1.2";
- appInfo.name = "adblockplusandroid";
- appInfo.application = "android";
+ D(D_INFO, "AppInfo: name=%s, version=%s, application=%s, applicationVersion=%s, locale=%s, developmentBuild=%s",
+ appInfo.name.c_str(), appInfo.version.c_str(), appInfo.application.c_str(),
+ appInfo.applicationVersion.c_str(), appInfo.locale.c_str(),
+ appInfo.developmentBuild ? "true" : "false");
AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New(appInfo));
@@ -213,7 +222,7 @@
AndroidLogSystem* androidLogSystem = new AndroidLogSystem();
AndroidWebRequest* androidWebRequest = new AndroidWebRequest(globalJvm);
- defaultFileSystem->SetBasePath(path);
+ defaultFileSystem->SetBasePath(GetString(pEnv, basePath));
jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(androidLogSystem));
jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(defaultFileSystem));
jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(androidWebRequest));
« no previous file with comments | « no previous file | src/org/adblockplus/android/ABPEngine.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld