diff options
-rw-r--r-- | .classpath | 3 | ||||
-rw-r--r-- | README.txt | 81 | ||||
-rw-r--r-- | README_icsopenvpn.txt | 43 | ||||
-rw-r--r-- | build.xml | 92 | ||||
-rwxr-xr-x | debug.sh | 19 | ||||
-rw-r--r-- | lint.xml | 3 |
6 files changed, 214 insertions, 27 deletions
@@ -1,8 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> + <classpathentry kind="src" path="gen"/> <classpathentry kind="src" path="src"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> - <classpathentry kind="src" path="gen"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> + <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> <classpathentry kind="output" path="bin/classes"/> </classpath> @@ -1,43 +1,72 @@ -This is my first Android project, so some things may be done in a completely stupid way. +Compiling +========= -See the file todo.txt for ideas/not yet implemented features (and the bug tracker). +Preconditions +---------------- -Build instraction: +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 -Checkout google breakcode: +Instructions to compile +----------------------- -svn co http://google-breakpad.googlecode.com/svn/trunk/ google-breakpad +1. cd $PROJECT_LOCATION/leap_android +2. android update project --path $PROJECT_LOCATION/leap_android/ +3. ant debug -- Install sdk -- Install ndk +Postconditions +-------------- -Do ./build-native.sh in the root directory of the project. +1. $PROJECT_LOCATION/leap_android/bin/LEAP Android-debug.apk exists -Use eclipse with android plugins to build the project. +Running on the emulator +========================= -Optional: Copy minivpn from lib/ to assets (if you want your own compiled version) +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. Run emulator: emulator @AVD-NAME (avd names are the names of the files in ~/.android/avd with extension .avd). + - If you want to test the app from scratch, run emulator -wipe-data @AVD-NAME +2. Run app: adb shell am start se.leap.leapclient/.Dashboard -Starting a VPN by name from an external app: +Postconditions +-------------- -public class StartOpenVPNActivity extends Activity { - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - - final String EXTRA_NAME = "se.leap.openvpn.shortcutProfileName"; +1. LEAP Android is running. - Intent shortcutIntent = new Intent(Intent.ACTION_MAIN); - shortcutIntent.setClassName("se.leap.openvpn", "se.leap.openvpn.LaunchVPN"); - shortcutIntent.putExtra(EXTRA_NAME,"upb ssl"); - startActivity(shortcutIntent); - } -} +Debugging from console +====================== -or from the shell: +Preconditions +----------------- -am start -a android.intent.action.VPNLEGACY -n se.leap.openvpn/.LaunchVPN -e se.leap.openvpn.shortcutProfileName Home +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. emulator @AVD-NAME # (avd names are the names of the files in ~/.android/avd with extension .avd). + - emulator -wipe-data @AVD-NAME # If you want to test the app from scratch +2. adb install -r $PROJECT_LOCATION/leap_android/bin/LEAP\ Android-debug.apk # Install the new version of the application +3. adb shell am start -D se.leap.leapclient/.Dashboard # Run app +4. pid=`adb shell ps | grep leap | awk '{print $2}'` # Identify the process id (pid) of the current leapclient process instance +5. localport=`expr $RANDOM % 65536` +6. adb forward tcp:$localport jdwp:$pid +7. jdb -sourcepath $PROJECT_LOCATION/leap_android/src/ -attach localhost:$localport + +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". diff --git a/README_icsopenvpn.txt b/README_icsopenvpn.txt new file mode 100644 index 00000000..f6690f5a --- /dev/null +++ b/README_icsopenvpn.txt @@ -0,0 +1,43 @@ +This is my first Android project, so some things may be done in a completely stupid way. + +See the file todo.txt for ideas/not yet implemented features (and the bug tracker). + +Build instraction: + +Checkout google breakcode: + +svn co http://google-breakpad.googlecode.com/svn/trunk/ google-breakpad + +- Install sdk +- Install ndk + +Do ./build-native.sh in the root directory of the project. + +Use eclipse with android plugins to build the project. + +Optional: Copy minivpn from lib/ to assets (if you want your own compiled version) + + + + +Starting a VPN by name from an external app: + +public class StartOpenVPNActivity extends Activity { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + + final String EXTRA_NAME = "se.leap.openvpn.shortcutProfileName"; + + Intent shortcutIntent = new Intent(Intent.ACTION_MAIN); + shortcutIntent.setClassName("se.leap.openvpn", "se.leap.openvpn.LaunchVPN"); + shortcutIntent.putExtra(EXTRA_NAME,"upb ssl"); + startActivity(shortcutIntent); + } +} + +or from the shell: + +am start -a android.intent.action.VPNLEGACY -n se.leap.openvpn/.LaunchVPN -e se.leap.openvpn.shortcutProfileName Home + diff --git a/build.xml b/build.xml new file mode 100644 index 00000000..538f2eee --- /dev/null +++ b/build.xml @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="LEAP Android" default="help"> + + <!-- The local.properties file is created and updated by the 'android' tool. + It contains the path to the SDK. It should *NOT* be checked into + Version Control Systems. --> + <property file="local.properties" /> + + <!-- The ant.properties file can be created by you. It is only edited by the + 'android' tool to add properties to it. + This is the place to change some Ant specific build properties. + Here are some properties you may want to change/update: + + source.dir + The name of the source directory. Default is 'src'. + out.dir + The name of the output directory. Default is 'bin'. + + For other overridable properties, look at the beginning of the rules + files in the SDK, at tools/ant/build.xml + + Properties related to the SDK location or the project target should + be updated using the 'android' tool with the 'update' action. + + This file is an integral part of the build system for your + application and should be checked into Version Control Systems. + + --> + <property file="ant.properties" /> + + <!-- if sdk.dir was not set from one of the property file, then + get it from the ANDROID_HOME env var. + This must be done before we load project.properties since + the proguard config can use sdk.dir --> + <property environment="env" /> + <condition property="sdk.dir" value="${env.ANDROID_HOME}"> + <isset property="env.ANDROID_HOME" /> + </condition> + + <!-- The project.properties file is created and updated by the 'android' + tool, as well as ADT. + + This contains project specific properties such as project target, and library + dependencies. Lower level build properties are stored in ant.properties + (or in .classpath for Eclipse projects). + + This file is an integral part of the build system for your + application and should be checked into Version Control Systems. --> + <loadproperties srcFile="project.properties" /> + + <!-- quick check on sdk.dir --> + <fail + message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable." + unless="sdk.dir" + /> + + <!-- + Import per project custom build rules if present at the root of the project. + This is the place to put custom intermediary targets such as: + -pre-build + -pre-compile + -post-compile (This is typically used for code obfuscation. + Compiled code location: ${out.classes.absolute.dir} + If this is not done in place, override ${out.dex.input.absolute.dir}) + -post-package + -post-build + -pre-clean + --> + <import file="custom_rules.xml" optional="true" /> + + <!-- Import the actual build file. + + To customize existing targets, there are two options: + - Customize only one target: + - copy/paste the target into this file, *before* the + <import> task. + - customize it to your needs. + - Customize the whole content of build.xml + - copy/paste the content of the rules files (minus the top node) + into this file, replacing the <import> task. + - customize to your needs. + + *********************** + ****** IMPORTANT ****** + *********************** + In all cases you must update the value of version-tag below to read 'custom' instead of an integer, + in order to avoid having your file be overridden by tools such as "android update project" + --> + <!-- version-tag: 1 --> + <import file="${sdk.dir}/tools/ant/build.xml" /> + +</project> diff --git a/debug.sh b/debug.sh new file mode 100755 index 00000000..c3f96ba0 --- /dev/null +++ b/debug.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +if [ -z "$2" ] +then + echo Usage: debug.sh \"avd name\" \"project folder\" + exit 0; +fi +avd_name=$1 +PROJECT_FOLDER=$2 +localport=`expr $RANDOM % 65536` + +emulator -wipe-data @$avd_name & # If you want to test the app from scratch +sleep 70 +adb install -r $PROJECT_FOLDER/bin/LEAP\ Android-debug.apk # Install the new version of the application +adb shell am start -D se.leap.leapclient/.Dashboard # Run app +pid=`adb shell ps | grep leap | awk '{print $2}'` # Identify the process id (pid) of the current leapclient process instance +adb forward tcp:$localport jdwp:$pid +sleep 3 +jdb -sourcepath $PROJECT_FOLDER/src/ -attach localhost:$localport diff --git a/lint.xml b/lint.xml new file mode 100644 index 00000000..ee0eead5 --- /dev/null +++ b/lint.xml @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="UTF-8"?> +<lint> +</lint>
\ No newline at end of file |