summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-06-13 17:37:37 +0200
committerParménides GV <parmegv@sdf.org>2013-06-13 17:37:37 +0200
commit30c7bab5d8618df665e602fdd08bafa010a15497 (patch)
tree2c6c55568e73c06e10f475425e21365fd8961ce2
parent2f69eb6eb9aa3993354e8de295df68558ab7b71e (diff)
bitmask json files are downloaded.
There was a problem on the assets file "bitmask.url". It had an error in the eip-service url. We should use this file only for main url, and proceed as if it were a new provider but with a preseeded main url.
-rw-r--r--[l---------]README66
-rw-r--r--assets/urls/bitmask.url3
-rw-r--r--src/se/leap/leapclient/ConfigHelper.java1
-rw-r--r--src/se/leap/leapclient/ConfigurationWizard.java4
-rw-r--r--src/se/leap/leapclient/ProviderAPI.java18
-rw-r--r--src/se/leap/leapclient/ProviderListContent.java17
6 files changed, 79 insertions, 30 deletions
diff --git a/README b/README
index c3ca0746..7d57a6e3 120000..100644
--- a/README
+++ b/README
@@ -1 +1,65 @@
-README.txt \ No newline at end of file
+Compiling
+=========
+
+Preconditions
+----------------
+
+1. Android SDK installed (follow instructions from http://developer.android.com/sdk/index.html)
+2. API version 16 or version installed.
+2. Ant 1.6 or greater
+
+Instructions to compile
+-----------------------
+
+1. cd $PROJECT_LOCATION/leap_android
+2. ./compile.sh
+
+Postconditions
+--------------
+
+1. $PROJECT_LOCATION/leap_android/bin/LEAP Android-debug.apk exists
+
+Running on the emulator
+=========================
+
+Preconditions
+-----------------
+
+1. Android SDK is installed, and its tools are in the PATH.
+2. leap_android has been compiled.
+3. An avd exists in ~/.android/avd/ (if you do not have one, follow instructions from http://developer.android.com/tools/devices/managing-avds-cmdline.html)
+
+Instructions to run on the emulator
+-----------------------------------
+
+1. cd $PROJECT_LOCATION/leap_android
+1. Run script: ./run.sh @AVD-NAME . (avd names are the names of the files in ~/.android/avd with extension .avd).
+
+Postconditions
+--------------
+
+1. LEAP Android is running.
+
+Debugging from console
+======================
+
+Preconditions
+-----------------
+
+1. Android SDK is installed, and its tools are in the PATH.
+2. leap_android has been compiled.
+3. An avd exists in ~/.android/avd/ (if you do not have one, follow instructions from http://developer.android.com/tools/devices/managing-avds-cmdline.html).
+4. jdb is installed (this program is part of OpenJDK 7)
+
+Instructions to debug from the console
+-----------------------------------
+
+1. cd $PROJECT_LOCATION/leap_android
+2. Run script: ./debug.sh @AVD-NAME . (avd names are the names of the files in ~/.android/avd with extension .avd).
+
+Postconditions
+--------------
+
+1. LEAP Android is running.
+2. LEAP Android does not show the message "Application LEAP for Android (process se.leap.leapclient) is waiting for the debugger to attach".
+3. You are in a jdb debuggin session.
diff --git a/assets/urls/bitmask.url b/assets/urls/bitmask.url
index bc4d59db..910f0400 100644
--- a/assets/urls/bitmask.url
+++ b/assets/urls/bitmask.url
@@ -3,6 +3,5 @@
"assets_json_provider" : "providers/bitmask.net_provider.json",
"json_provider" : "https://bitmask.net/provider.json",
"cert" : "https://bitmask.net/ca.crt",
- "json_eip_service_antiguo" : "https://api.bitmask.net:4430/1/config/eip-service.json",
- "json_eip_service" : "https://api.bitmask.net:4430/config/eip-service.json"
+ "json_eip_service" : "https://api.bitmask.net:4430/1/config/eip-service.json"
} \ No newline at end of file
diff --git a/src/se/leap/leapclient/ConfigHelper.java b/src/se/leap/leapclient/ConfigHelper.java
index 11f95041..0e50c7dd 100644
--- a/src/se/leap/leapclient/ConfigHelper.java
+++ b/src/se/leap/leapclient/ConfigHelper.java
@@ -192,7 +192,6 @@ public class ConfigHelper {
public static void addTrustedCertificate(String provider, String certificate) {
String filename_to_save = provider + "_certificate.cer";
- saveFile(filename_to_save, certificate);
CertificateFactory cf;
try {
cf = CertificateFactory.getInstance("X.509");
diff --git a/src/se/leap/leapclient/ConfigurationWizard.java b/src/se/leap/leapclient/ConfigurationWizard.java
index 2a9b93b2..1dc00938 100644
--- a/src/se/leap/leapclient/ConfigurationWizard.java
+++ b/src/se/leap/leapclient/ConfigurationWizard.java
@@ -80,8 +80,8 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
boolean danger_on = resultData.getBoolean(ConfigHelper.DANGER_ON);
ConfigHelper.saveSharedPref(ConfigHelper.PROVIDER_KEY, provider_json);
ConfigHelper.saveSharedPref(ConfigHelper.DANGER_ON, danger_on);
- ConfigHelper.saveSharedPref(ConfigHelper.ALLOWED_ANON, provider_json.getBoolean(ConfigHelper.ALLOWED_ANON));
-
+ ConfigHelper.saveSharedPref(ConfigHelper.ALLOWED_ANON, provider_json.getJSONObject(ConfigHelper.SERVICE_KEY).getBoolean(ConfigHelper.ALLOWED_ANON));
+
mConfigState.setAction(PROVIDER_SET);
mProgressDialog.setMessage(getResources().getString(R.string.config_downloading_services));
diff --git a/src/se/leap/leapclient/ProviderAPI.java b/src/se/leap/leapclient/ProviderAPI.java
index 10f04c5d..471eb6cf 100644
--- a/src/se/leap/leapclient/ProviderAPI.java
+++ b/src/se/leap/leapclient/ProviderAPI.java
@@ -216,9 +216,7 @@ public class ProviderAPI extends IntentService {
} else {
ConfigHelper.saveSharedPref(ConfigHelper.ALLOWED_ANON, provider_json.getJSONObject(ConfigHelper.SERVICE_KEY).getBoolean(ConfigHelper.ALLOWED_ANON));
- String filename = provider_name + "_provider.json".replaceFirst("__", "_");
-
- ProviderListContent.addItem(new ProviderItem(provider_name, provider_json_url, filename, custom, danger_on));
+ ProviderListContent.addItem(new ProviderItem(provider_name, provider_json_url, provider_json, custom, danger_on));
result.putBoolean(ConfigHelper.RESULT_KEY, true);
result.putString(ConfigHelper.PROVIDER_KEY, provider_json.toString());
result.putBoolean(ConfigHelper.DANGER_ON, danger_on);
@@ -237,17 +235,17 @@ public class ProviderAPI extends IntentService {
String provider_main_url = (String) task.get(ConfigHelper.PROVIDER_MAIN_URL);
String provider_name = provider_main_url.replaceFirst("http[s]?://", "").replaceFirst("\\/", "_");
String provider_json_url = guessURL(provider_main_url);
- JSONObject provider_json = null;
+
+ JSONObject provider_json;
try {
provider_json = getJSONFromProvider(provider_json_url, danger_on);
-
- String filename = provider_name + "_provider.json".replaceFirst("__", "_");
-
- ProviderListContent.addItem(new ProviderItem(provider_name, provider_json_url, filename, custom, danger_on));
- return true;
+ ProviderListContent.addItem(new ProviderItem(provider_name, provider_json_url, provider_json, custom, danger_on));
} catch (JSONException e) {
- return false;
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
+
+ return true;
}
private String getStringFromProviderWithoutValidate(
diff --git a/src/se/leap/leapclient/ProviderListContent.java b/src/se/leap/leapclient/ProviderListContent.java
index b83bbd8e..10dce578 100644
--- a/src/se/leap/leapclient/ProviderListContent.java
+++ b/src/se/leap/leapclient/ProviderListContent.java
@@ -1,6 +1,5 @@
package se.leap.leapclient;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@@ -78,21 +77,14 @@ public class ProviderListContent {
}
}
- public ProviderItem(String name, String provider_json_url, String provider_json_filename, boolean custom, boolean danger_on) {
+ public ProviderItem(String name, String provider_json_url, JSONObject provider_json, boolean custom, boolean danger_on) {
-
- FileInputStream provider_json = ConfigHelper.openFileInputStream(provider_json_filename);
try {
- byte[] urls_file_bytes = new byte[provider_json.available()];
- provider_json.read(urls_file_bytes);
- String urls_file_content = new String(urls_file_bytes);
- JSONObject file_contents = new JSONObject(urls_file_content);
id = name;
this.name = name;
this.provider_json_url = provider_json_url;
- this.provider_json_filename = provider_json_filename;
- eip_service_json_url = file_contents.getString("api_uri") + "/" + file_contents.getString("api_version") + "/" + ConfigHelper.EIP_SERVICE_API_PATH;
- cert_json_url = (String) file_contents.get("ca_cert_uri");
+ eip_service_json_url = provider_json.getString("api_uri") + "/" + provider_json.getString("api_version") + "/" + ConfigHelper.EIP_SERVICE_API_PATH;
+ cert_json_url = (String) provider_json.get("ca_cert_uri");
this.custom = custom;
this.danger_on = danger_on;
if(custom)
@@ -100,9 +92,6 @@ public class ProviderListContent {
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
}
}