Skip to content

Commit

Permalink
Merge pull request #61 from TheTorProject/release/1.1.2
Browse files Browse the repository at this point in the history
Release/1.1.2
  • Loading branch information
bassosimone authored Feb 13, 2017
2 parents 351f63c + 7267284 commit 97a0759
Show file tree
Hide file tree
Showing 16 changed files with 249 additions and 245 deletions.
16 changes: 16 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# ooniprobe-android 1.1.2 [2017-02-13]

Bugfixes:

* JSON file iterator

* Done action in keyboard

* Fixing crash on tap of ooni logo

* Fix crash when running very long input lists

measurement-kit version: 0.4.0-beta.4

ooniprobe-wui version: 2.2.0-rc.0

# ooniprobe-android 1.1.1 [2017-02-09]

Bugfixes:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ REPO = measurement-kit/measurement-kit
BASEURL = https://github.com/$(REPO)/releases/download
PACKAGE = org/openobservatory/measurement_kit
SRCDIR = app/src/main
TAG = -1
VERSION = v0.4.0-beta.3
TAG = -4
VERSION = v0.4.0-beta.4

INPUT = measurement_kit_android-$(VERSION)$(TAG).tar.bz2

Expand Down
20 changes: 8 additions & 12 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
Expand All @@ -83,6 +75,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
Expand All @@ -106,7 +106,6 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/io.fabric.sdk.android/fabric/1.3.15/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/me.panavtec/wizard/1.2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/uk.co.chrisjenx/calligraphy/2.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/us.feras.mdv/markdownview/1.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
Expand All @@ -116,7 +115,6 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
Expand All @@ -134,7 +132,6 @@
<orderEntry type="library" exported="" name="crashlytics-2.6.6" level="project" />
<orderEntry type="library" exported="" name="beta-1.2.3" level="project" />
<orderEntry type="library" exported="" name="wizard-1.2" level="project" />
<orderEntry type="library" exported="" name="markdownj-core-0.4" level="project" />
<orderEntry type="library" exported="" name="support-v4-25.1.1" level="project" />
<orderEntry type="library" exported="" name="answers-1.3.11" level="project" />
<orderEntry type="library" exported="" name="support-compat-25.1.1" level="project" />
Expand All @@ -143,7 +140,6 @@
<orderEntry type="library" exported="" name="support-media-compat-25.1.1" level="project" />
<orderEntry type="library" exported="" name="support-core-ui-25.1.1" level="project" />
<orderEntry type="library" exported="" name="calligraphy-2.2.0" level="project" />
<orderEntry type="library" exported="" name="markdownview-1.1.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-25.1.1" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-25.1.1" level="project" />
Expand Down
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId "org.openobservatory.ooniprobe"
minSdkVersion 9
targetSdkVersion 25
versionCode 3
versionName "1.1.1"
versionCode 4
versionName "1.1.2"
}
buildTypes {
release {
Expand All @@ -33,7 +33,6 @@ dependencies {
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.google.code.gson:gson:2.4'
compile 'me.panavtec:wizard:1.2'
compile 'us.feras.mdv:markdownview:1.1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
transitive = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ protected void onCreate(Bundle savedInstanceState) {
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());

ImageView _imgView = new ImageView(this);
_imgView.setEnabled(false);
_imgView.setImageResource(R.drawable.ooni_logo);
mDrawerList.addFooterView(_imgView);

Expand Down Expand Up @@ -150,10 +151,11 @@ private void selectItem(int position) {
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, new AboutFragment(), "about").commit();
break;
}

mDrawerList.setItemChecked(position, true);
setTitle(mMenuItemsTitles[position]);
mDrawerLayout.closeDrawer(mDrawerList);
if (position < mMenuItemsTitles.length){
mDrawerList.setItemChecked(position, true);
setTitle(mMenuItemsTitles[position]);
mDrawerLayout.closeDrawer(mDrawerList);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected Boolean doInBackground(String... params)
Log.v(TAG, "running http_invalid_request_line test...");
new HttpInvalidRequestLineTest()
.use_logcat()
.set_options("backend", "http://213.138.109.232/")
.set_options("backend", OONITests.HIRL_BACKEND)
.set_output_filepath(outputPath)
.set_error_filepath(logPath)
.set_verbosity(LogSeverity.INFO)
Expand Down Expand Up @@ -186,7 +186,7 @@ else if (testName.compareTo(OONITests.WEB_CONNECTIVITY) == 0) {
.set_output_filepath(outputPath)
.set_error_filepath(logPath)
.set_verbosity(LogSeverity.INFO)
.set_options("backend", "https://b.web-connectivity.th.ooni.io")
.set_options("backend", OONITests.WC_BACKEND)
/*
* XXX nameserver is the nameserver to be used for
* the DNS phase of web-connectivity only while
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@
import org.openobservatory.ooniprobe.R;
import org.openobservatory.ooniprobe.activity.ResultActivity;
import org.openobservatory.ooniprobe.utils.Alert;
import org.openobservatory.ooniprobe.utils.JSONUtils;
import org.openobservatory.ooniprobe.utils.LogUtils;
import org.openobservatory.ooniprobe.utils.OoniWebViewClient;

import java.io.File;
import java.io.IOException;

public class ResultFragment extends Fragment {
private ResultActivity mActivity;
private ProgressBar mPbar = null;
Expand Down Expand Up @@ -52,16 +56,22 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
setHasOptionsMenu(true);

int position = this.getArguments().getInt("position");
String json_file = getActivity().getIntent().getExtras().getString("json_file");
final String parts = LogUtils.getLogParts(getActivity(), json_file, position);
String jsonFilename = getActivity().getIntent().getExtras().getString("json_file");
mPbar = (ProgressBar) v.findViewById(R.id.web_view_progress);

WebView wv = (WebView) v.findViewById(R.id.webview);
wv.setWebViewClient(new OoniWebViewClient(mPbar));
wv.getSettings().setJavaScriptEnabled(true);
wv.addJavascriptInterface(new Alert.InjectedJSON(parts), "MeasurementJSON");
wv.loadUrl("file:///android_asset/webui/index.html");

File jsonFile = new File(mActivity.getFilesDir(), jsonFilename);
try {
JSONUtils.JSONL jsonl = new JSONUtils.JSONL(jsonFile);
final String jsonLine = jsonl.getLineN(position);
WebView wv = (WebView) v.findViewById(R.id.webview);
wv.setWebViewClient(new OoniWebViewClient(mPbar));
wv.getSettings().setJavaScriptEnabled(true);
wv.addJavascriptInterface(new JSONUtils.InjectedJSON(jsonLine), "MeasurementJSON");
wv.loadUrl("file:///android_asset/webui/index.html");
} catch (IOException e) {
// XXX log the IO exception in some way
} catch (RuntimeException e) {
// XXX log the runtime exception in some way
}
return v;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.os.Bundle;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -17,14 +18,18 @@
import org.json.JSONObject;
import org.openobservatory.ooniprobe.R;
import org.openobservatory.ooniprobe.model.TestResult;
import org.openobservatory.ooniprobe.utils.JSONUtils;
import org.openobservatory.ooniprobe.utils.LogUtils;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

public class ResultListFragment extends Fragment {
private RecyclerView testResultList;
private TestResultListAdapter mResultTestsListAdapter;
private ResultActivity mActivity;
private static final String DEBUG_TAG = "ResultListFragment";

@Override
public void onAttach(Activity activity) {
Expand All @@ -47,25 +52,32 @@ public void onDetach() {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v =inflater.inflate(R.layout.fragment_result_list, container, false);
String json_file = getActivity().getIntent().getExtras().getString("json_file");
final String[] parts = LogUtils.getLogParts(getActivity(), json_file);
String jsonFilename = getActivity().getIntent().getExtras().getString("json_file");
ArrayList<TestResult> listItems = new ArrayList<>();
try {
for(String str:parts) {
JSONObject jsonObj = new JSONObject(str);
int anomaly = 0;
JSONObject blocking = jsonObj.getJSONObject("test_keys");
Object object = blocking.get("blocking");
if(object instanceof String)
anomaly = 2;
else if(object instanceof Boolean)
anomaly = 0;
else
anomaly = 1;
TestResult result = new TestResult(jsonObj.getString("input"), anomaly);
listItems.add(result);
File jsonFile = new File(mActivity.getFilesDir(), jsonFilename);
JSONUtils.JSONL jsonl = new JSONUtils.JSONL(jsonFile);
for (JSONObject jsonObj:jsonl){
try {
int anomaly;
JSONObject blocking = jsonObj.getJSONObject("test_keys");
Object object = blocking.get("blocking");
if(object instanceof String)
anomaly = 2;
else if(object instanceof Boolean)
anomaly = 0;
else
anomaly = 1;
TestResult result = new TestResult(jsonObj.getString("input"), anomaly);
listItems.add(result);
}
catch (JSONException e) {
Log.e(DEBUG_TAG, "Failed to open json object " + jsonFilename);
}
}
} catch (JSONException e) {
} catch (IOException e) {
//TODO show to user
Log.e(DEBUG_TAG, "Failed to open file " + jsonFilename);
}
testResultList = (RecyclerView) v.findViewById(R.id.resultList);
mResultTestsListAdapter = new TestResultListAdapter(getActivity(), listItems);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.CompoundButton;
import android.widget.EditText;
Expand Down Expand Up @@ -140,6 +141,7 @@ public void onClick(View v) {
});
TextView max_runtime = (TextView) v.findViewById(R.id.max_runtimeEditText);
max_runtime.setText(preferences.getString("max_runtime", OONITests.MAX_RUNTIME));
max_runtime.setImeOptions(EditorInfo.IME_ACTION_DONE);
max_runtime.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ public class OONITests {
public static final String NDT_TEST = "ndt_test";
public static final String COLLECTOR_ADDRESS = "https://b.collector.ooni.io";
public static final String MAX_RUNTIME = "90";
public static final String WC_BACKEND = "https://b.web-connectivity.th.ooni.io";
public static final String HIRL_BACKEND = "http://a.echo.th.ooni.io";
}
Loading

0 comments on commit 97a0759

Please sign in to comment.