Skip to content

Commit

Permalink
Merge branch 'master' of github.com:guardianproject/haven into room_e…
Browse files Browse the repository at this point in the history
…xperiments

- update gradle wrapper and dependencies
  • Loading branch information
archie94 committed Aug 28, 2018
2 parents 6a930cb + 917ff84 commit a1454c7
Show file tree
Hide file tree
Showing 34 changed files with 1,781 additions and 839 deletions.
12 changes: 5 additions & 7 deletions README.md
Expand Up @@ -45,7 +45,7 @@ The following sensors are monitored for a measurable change, and then recorded t

## Building

The application can be built using Android Studio and Gradle. It relies on a number of third-party dependencies, all which are free, open-source and listed at the end of this document.
The application can be built using Android Studio and Gradle. It relies on a number of third-party dependencies, all of which are free, open-source, and listed at the end of this document.

## Install

Expand All @@ -68,15 +68,15 @@ If you are an Android developer, you can learn more about how you can make use o

While we hope to support a version of Haven that runs directly on iOS devices in the future, iPhone users can still benefit from Haven today. You can purchase an inexpensive Android phone for less than $100, and use that as your "Haven Device", that you leave behind, while you keep your iPhone with you. If you run Signal on your iPhone, you can configure Haven on Android to send encrypted notifications, with photos and audio, directly to you. If you enable the "Tor Onion Service" feature in Haven (requires installing "Orbot" app as well), you can remotely access all Haven log data from your iPhone, using the Onion Browser app.

So, no, iPhone users we didn't forget about you, and hope you'll pick up an Android burner today for a few bucks!
So, no, iPhone users, we didn't forget about you, and we hope you'll pick up an inexpensive Android burner today!

## Usage

Haven is meant to provide an easy onboarding experience, that walks users through configuring the sensors on their device to best detect intrusions into their environment. The current implementation has some of this implemented, but we are looking to improve this user experience dramatically.
Haven is meant to provide an easy onboarding experience, that walks users through configuring the sensors on their device to best detect intrusions into their environment. (The current implementation has some of this implemented, but we are looking to improve this user experience dramatically.)

### Main view

Application's main view allows the user to set which sensors to use and the corresponding level of sensitivity. A security code must be provided, needed to disable monitoring. A phone number can be set, if any of the sensors is triggered a message is sent to the specified number.
Application's main view allows the user to select which sensors to use along with their corresponding levels of sensitivity. A security code must be provided, which will be needed later to disable monitoring. A phone number can be set, to which a message will be sent if any of the sensors is triggered.

### Notifications

Expand All @@ -85,7 +85,7 @@ When one of the sensors is triggered (reaches the configured sensitivity thresho
- SMS: a message is sent to the number specified when monitoring started
- Signal: if configured, can send end-to-end encryption notifications via Signal

Note that it's not necessary to install the Signal app on the device that runs Haven. Doing so may invalidate the app's previous Signal registration and safety numbers. Haven uses APIs to communicate via Signal.
Note that it's not necessary to install the Signal app on the device that runs Haven. Doing so may invalidate the app's previous Signal registration and safety numbers. Haven uses normal APIs to communicate via Signal.

Notifications are sent through a service running in the background that is defined in class `MonitorService`.

Expand All @@ -112,5 +112,3 @@ This project contains source code or library dependencies from the following pro
* Audio Waveform Viewer: https://github.com/derlio/audio-waveform (Apache 2)
* FireZenk's AudioWaves: https://github.com/FireZenk/AudioWaves (MIT)
* MaxYou's SimpleWaveform: https://github.com/maxyou/SimpleWaveform (MIT)


48 changes: 30 additions & 18 deletions build.gradle
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.2.41'
ext.kotlin_version = '1.2.60'
repositories {
jcenter()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha13'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:3.3.0-alpha07'

}

Expand All @@ -33,8 +33,8 @@ apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

repositories {
jcenter()
google()
jcenter()
maven { url 'https://github.com/FireZenk/maven-repo/raw/master/' }
maven { url 'https://jitpack.io' }
}
Expand All @@ -49,7 +49,7 @@ allprojects {
compileSdkVersion = 27
minSdkVersion = 16
targetSdkVersion = 27
appcompat = 'com.android.support:appcompat-v7:27.1.0'
appcompat = 'com.android.support:appcompat-v7:27.1.1'
}

}
Expand Down Expand Up @@ -77,7 +77,7 @@ android {

defaultConfig {
applicationId "org.havenapp.main"
versionCode 113
versionCode 117
versionName getVersionName()
archivesBaseName = "Haven-$versionName"
minSdkVersion 16
Expand All @@ -88,8 +88,15 @@ android {
}
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
renderscriptTargetApi 16
renderscriptSupportModeEnabled true

ndk {
abiFilters "armeabi", "armeabi-v7a", "x86"
}
}


buildTypes {
release {
minifyEnabled false
Expand All @@ -108,32 +115,37 @@ android {
}

dependencies {
implementation 'com.android.support:support-v13:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.github.guardianproject:signal-cli-android:-SNAPSHOT'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.github.guardianproject:signal-cli-android:v0.6.0-android-beta-1'
implementation 'com.github.satyan:sugar:1.5'
implementation 'net.the4thdimension:audio-wife:1.0.3'
implementation 'com.github.apl-devs:appintro:v4.2.3'
implementation 'info.guardianproject.netcipher:netcipher:2.0.0-alpha1'
implementation 'com.nanohttpd:nanohttpd-webserver:2.2.0'
implementation 'me.angrybyte.picker:picker:1.3.1'
implementation 'com.github.stfalcon:frescoimageviewer:0.5.0'
implementation 'com.facebook.fresco:fresco:1.8.0'
implementation 'com.github.derlio.waveform:library:1.0.1'
implementation 'com.facebook.fresco:fresco:1.9.0'
implementation 'com.github.derlio.waveform:library:1.0.3@aar'
implementation 'org.firezenk:audiowaves:1.1@aar'
implementation 'com.maxproj.simplewaveform:app:1.0.0'
implementation 'com.takisoft.fix:preference-v7:27.1.0.0'
implementation 'com.wdullaer:materialdatetimepicker:3.5.2'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.7.0'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.8.10'
implementation('com.mikepenz:aboutlibraries:6.0.2@aar') {
transitive = true
}
implementation 'com.asksira.android:cameraviewplus:0.9.4'
implementation 'com.github.halilozercan:BetterVideoPlayer:1.1.0'
implementation 'io.github.silvaren:easyrs:0.5.3'
implementation 'org.jcodec:jcodec:0.2.3'
implementation 'org.jcodec:jcodec-android:0.2.3'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

// Room
implementation "android.arch.persistence.room:runtime:1.1.0"
kapt "android.arch.persistence.room:compiler:1.1.0"
implementation "android.arch.persistence.room:runtime:1.1.1"
kapt "android.arch.persistence.room:compiler:1.1.1"
}
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,7 +1,7 @@
#Fri Oct 27 16:43:50 EDT 2017
#Tue Aug 28 12:14:00 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
android.enableD8=true
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
android.enableD8=true
117 changes: 77 additions & 40 deletions src/main/AndroidManifest.xml
@@ -1,40 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.havenapp.main">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.SEND_SMS" />

<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-feature android:name="android.hardware.microphone" android:required="false" />
<!-- Some Chromebooks don't support touch. Although not essential,
it's a good idea to explicitly include this declaration. -->
<uses-feature android:name="android.hardware.touchscreen"
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-feature
android:name="android.hardware.telephony"
android:required="false" />
<uses-feature
android:name="android.hardware.microphone"
android:required="false" />
<!--
Some Chromebooks don't support touch. Although not essential,
it's a good idea to explicitly include this declaration.
-->
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />

<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />

<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>

<application xmlns:tools="http://schemas.android.com/tools"
android:name="org.havenapp.main.HavenApp"
<application xmlns:tools="http://schemas.android.com/tools"
android:name=".HavenApp"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
tools:replace="android:allowBackup"
android:allowBackup="false"
android:largeHeap="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:replace="android:allowBackup">
<activity
android:name="org.havenapp.main.ListActivity"
android:label="@string/title_activity_start"
android:name=".ListActivity"
android:configChanges="orientation|screenSize"
android:label="@string/title_activity_start"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -43,21 +54,32 @@
</intent-filter>
</activity>
<activity
android:name="org.havenapp.main.SettingsActivity"
android:name=".SettingsActivity"
android:configChanges="orientation|screenSize"
android:label="@string/settings"
android:theme="@style/SettingsTheme"
android:configChanges="orientation|screenSize"
android:windowSoftInputMode="stateHidden" />
<activity android:name="org.havenapp.main.ui.PPAppIntro"
<activity
android:name=".ui.PPAppIntro"
android:screenOrientation="portrait" />
<activity
android:name=".MonitorActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:launchMode="singleTop"
android:resizeableActivity="true"
android:supportsPictureInPicture="true"
android:configChanges=
"screenSize|smallestScreenSize|screenLayout|orientation"
/>
<activity
android:name="org.havenapp.main.MonitorActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize"
android:launchMode="singleTop" />
android:name=".ui.VideoPlayerActivity"
android:configChanges="orientation|keyboardHidden|screenLayout|screenSize"
android:label="@string/title_activity_video_player"
android:theme="@style/AppTheme" />

<service android:name="org.havenapp.main.service.MonitorService"
<service
android:name=".service.MonitorService"
android:exported="false" />

<meta-data
Expand All @@ -74,23 +96,38 @@
android:value="org.havenapp.main.model" />

<activity
android:name="org.havenapp.main.ui.EventActivity"
android:label="@string/title_activity_event"
android:name=".ui.EventActivity"
android:configChanges="orientation|screenSize"
android:label="@string/title_activity_event"
android:theme="@style/AppTheme" />
<activity android:name="org.havenapp.main.ui.MicrophoneConfigureActivity"
android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name="org.havenapp.main.ui.AccelConfigureActivity"
android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name="org.havenapp.main.ui.CameraConfigureActivity"
android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity
android:name=".ui.MicrophoneConfigureActivity"
android:configChanges="orientation|screenSize|keyboardHidden" />
<activity
android:name=".ui.AccelConfigureActivity"
android:configChanges="orientation|screenSize|keyboardHidden" />
<activity
android:name=".ui.CameraConfigureActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|screenSize|keyboardHidden" />

<receiver android:name="org.havenapp.main.sensors.PowerConnectionReceiver">
<receiver android:name=".sensors.PowerConnectionReceiver">
<intent-filter>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED"/>
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter>
</receiver>

<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="org.havenapp.main.fileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_paths" />
</provider>

</application>

</manifest>
</manifest>
22 changes: 18 additions & 4 deletions src/main/java/org/havenapp/main/HavenApp.java
Expand Up @@ -22,6 +22,8 @@
import android.util.Log;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.core.ImagePipelineConfig;
import com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig;

import org.havenapp.main.database.HavenEventDB;
import org.havenapp.main.service.WebServer;
Expand All @@ -46,6 +48,16 @@ public void onCreate() {

mPrefs = new PreferenceManager(this);

ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
.setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
.setResizeAndRotateEnabledForNetwork(true)
.setDownsampleEnabled(true)
.build();

Fresco.initialize(this,config);

mPrefs = new PreferenceManager(this);

Fresco.initialize(this);
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);

Expand All @@ -60,10 +72,12 @@ public void startServer ()
{
if (mOnionServer == null || (!mOnionServer.isAlive()))
{
try {
mOnionServer = new WebServer(this, mPrefs.getRemoteAccessCredential());
} catch (IOException ioe) {
Log.e("OnioNServer", "unable to start onion server", ioe);
if ( mPrefs.getRemoteAccessCredential() != null) {
try {
mOnionServer = new WebServer(this, mPrefs.getRemoteAccessCredential());
} catch (IOException ioe) {
Log.e("OnioNServer", "unable to start onion server", ioe);
}
}
}
}
Expand Down

0 comments on commit a1454c7

Please sign in to comment.