Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiles and Works on Ubuntu 14.04 with compiler 4.6.4 #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions haggle/.ndkconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NDK_PATH=
6 changes: 6 additions & 0 deletions haggle/android (copy)/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
gen
obj
project.properties
proguard-project.txt
extlibs/zlib

9 changes: 9 additions & 0 deletions haggle/android (copy)/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
LOCAL_PATH:= $(call my-dir)

subdirs := $(addprefix $(LOCAL_PATH)/../../,$(addsuffix /Android.mk, \
Haggle \
PhotoShare \
LuckyMe \
))

include $(call first-makefiles-under, $(subdirs))
16 changes: 16 additions & 0 deletions haggle/android (copy)/Haggle/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

# Build all java files in the src subdirectory
LOCAL_SRC_FILES := $(call all-java-files-under,src)

LOCAL_JNI_SHARED_LIBRARIES += libhagglekernel_jni

# Name of the APK to build
LOCAL_PACKAGE_NAME := Haggle

LOCAL_PROGUARD_FLAGS := -include $(LOCAL_PATH)/proguard.cfg

# Tell it to build an APK
include $(BUILD_PACKAGE)

26 changes: 26 additions & 0 deletions haggle/android (copy)/Haggle/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.haggle.kernel"
android:versionCode="1"
android:versionName="0.4">
<application android:label="Haggle"
android:icon="@drawable/haggle_launch_icon" >
<service android:enabled="true"
android:exported="true"
android:name=".Haggle"
android:icon="@drawable/ic_stat_notify_haggle"/>
<activity android:name="StatusView"
android:label="@string/app_name">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="7"></uses-sdk>
</manifest>
1 change: 1 addition & 0 deletions haggle/android (copy)/Haggle/assets/python_27.zip
85 changes: 85 additions & 0 deletions haggle/android (copy)/Haggle/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Haggle" 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" />

<!-- 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 an env var"
unless="sdk.dir"
/>


<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<!--
<target name="-pre-build">
</target>
<target name="-pre-compile">
</target>

/* 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} */
<target name="-post-compile">
</target>
-->

<!-- 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>
18 changes: 18 additions & 0 deletions haggle/android (copy)/Haggle/jni/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
LOCAL_PATH := $(call my-dir)

subdirs := $(addprefix $(APP_PROJECT_PATH)/../../,$(addsuffix /Android.mk, \
extlibs/libxml2-2.9.0 \
src/libhaggle \
src/libcpphaggle \
src/hagglekernel \
src/clitool \
src/haggletest \
src/haggleobserver \
src/arphelper \
src/repltest \
))

EXTRA_LIBS_PATH := $(APP_PROJECT_PATH)/../extlibs/external
EXTRA_DEFINES=

include $(subdirs)
9 changes: 9 additions & 0 deletions haggle/android (copy)/Haggle/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
APP_PROJECT_PATH := $(shell pwd)
APP_ABI := armeabi armeabi-v7a
APP_MODULES := \
libhagglekernel_jni

APP_OPTIM=release
APP_BUILD_SCRIPT=jni/Android.mk
APP_STL := gnustl_static
# APP_STL := stlport_static
10 changes: 10 additions & 0 deletions haggle/android (copy)/Haggle/local.properties.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked in Version Control Systems,
# as it contains information specific to your local configuration.

# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=@ANDROID_SDK_PATH@
40 changes: 40 additions & 0 deletions haggle/android (copy)/Haggle/proguard.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
native <methods>;
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}

-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions haggle/android (copy)/Haggle/res/layout/main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_gravity="center" android:gravity="center">

<Button android:layout_height="wrap_content" android:gravity="center" android:id="@+id/stop_button" android:layout_width="wrap_content" android:text="@string/stop_button"></Button>

</LinearLayout>
8 changes: 8 additions & 0 deletions haggle/android (copy)/Haggle/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Haggle</string>
<string name="remote_service_started">Haggle started</string>
<string name="remote_service_stopped">Haggle stopped</string>
<string name="remote_service_label">Haggle</string>
<string name="stop_button">Stop Haggle</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/* Copyright (c) 2014 SRI International
* Developed under DARPA contract N66001-11-C-4022.
* Authors:
* Mark-Oliver Stehr (MOS)
*/

package org.haggle.kernel;

import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.util.Log;

public class BluetoothConnectivity extends BroadcastReceiver {
Context mContext;
String mBluetoothAdapterName, mBluetoothAdapterAddr;

private native void onBluetoothTurnedOn(String addr, String name);
private native void onBluetoothTurnedOff(String addr, String name);

public BluetoothConnectivity(Context c) {
super();
mContext = c;
}

public int initialize() {
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

if (mBluetoothAdapter != null) {
Log.d("Haggle", "Registering Bluetooth receiver");

// Register for Bluetooth adapter state events
IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
filter.addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);
mContext.registerReceiver(this, filter);

if (mBluetoothAdapter.isEnabled()) {
mBluetoothAdapterAddr = mBluetoothAdapter.getAddress();
mBluetoothAdapterName = mBluetoothAdapter.getName();
}
Log.d("Haggle", "Adapter info: " + mBluetoothAdapterAddr + " " + mBluetoothAdapterName);
}

return 0;
}

public void finalize() {
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

if (mBluetoothAdapter != null) {
mContext.unregisterReceiver(this);
}
}

@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();

if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action) ||
BluetoothAdapter.ACTION_SCAN_MODE_CHANGED.equals(action)) {
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

int mode = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
BluetoothAdapter.ERROR);

switch (mode){
case BluetoothAdapter.SCAN_MODE_CONNECTABLE:
Log.d("Haggle", "Bluetooth scan mode connectable");
break;
case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE:
Log.d("Haggle", "Bluetooth scan mode connectable discoverable");
break;
case BluetoothAdapter.SCAN_MODE_NONE:
Log.d("Haggle", "Bluetooth scan mode none");
break;
case BluetoothAdapter.STATE_OFF:
Log.d("Haggle", "Bluetooth off");
break;
case BluetoothAdapter.STATE_ON:
mBluetoothAdapterAddr = mBluetoothAdapter.getAddress();
mBluetoothAdapterName = mBluetoothAdapter.getName();
Log.d("Haggle", "Bluetooth on " +
mBluetoothAdapterAddr + " " + mBluetoothAdapterName);
onBluetoothTurnedOn(mBluetoothAdapterAddr, mBluetoothAdapterName);
break;
case BluetoothAdapter.STATE_TURNING_OFF:
Log.d("Haggle", "Bluetooth turning off " +
mBluetoothAdapterAddr + " " + mBluetoothAdapterName);
onBluetoothTurnedOff(mBluetoothAdapterAddr, mBluetoothAdapterName);
break;
case BluetoothAdapter.STATE_TURNING_ON:
Log.d("Haggle", "Bluetooth turning on");
break;
}
}
}
}
Loading