Skip to content

Commit a1454c7

Browse files
committed
Merge branch 'master' of github.com:guardianproject/haven into room_experiments
- update gradle wrapper and dependencies
2 parents 6a930cb + 917ff84 commit a1454c7

34 files changed

+1781
-839
lines changed

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ The following sensors are monitored for a measurable change, and then recorded t
4545

4646
## Building
4747

48-
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.
48+
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.
4949

5050
## Install
5151

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

6969
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.
7070

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

7373
## Usage
7474

75-
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.
75+
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.)
7676

7777
### Main view
7878

79-
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.
79+
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.
8080

8181
### Notifications
8282

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

88-
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.
88+
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.
8989

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

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

build.gradle

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
buildscript {
2-
ext.kotlin_version = '1.2.41'
2+
ext.kotlin_version = '1.2.60'
33
repositories {
4-
jcenter()
54
google()
5+
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:3.2.0-alpha13'
98
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
9+
classpath 'com.android.tools.build:gradle:3.3.0-alpha07'
1010

1111
}
1212

@@ -33,8 +33,8 @@ apply plugin: 'kotlin-android-extensions'
3333
apply plugin: 'kotlin-kapt'
3434

3535
repositories {
36-
jcenter()
3736
google()
37+
jcenter()
3838
maven { url 'https://github.com/FireZenk/maven-repo/raw/master/' }
3939
maven { url 'https://jitpack.io' }
4040
}
@@ -49,7 +49,7 @@ allprojects {
4949
compileSdkVersion = 27
5050
minSdkVersion = 16
5151
targetSdkVersion = 27
52-
appcompat = 'com.android.support:appcompat-v7:27.1.0'
52+
appcompat = 'com.android.support:appcompat-v7:27.1.1'
5353
}
5454

5555
}
@@ -77,7 +77,7 @@ android {
7777

7878
defaultConfig {
7979
applicationId "org.havenapp.main"
80-
versionCode 113
80+
versionCode 117
8181
versionName getVersionName()
8282
archivesBaseName = "Haven-$versionName"
8383
minSdkVersion 16
@@ -88,8 +88,15 @@ android {
8888
}
8989
multiDexEnabled true
9090
vectorDrawables.useSupportLibrary = true
91+
renderscriptTargetApi 16
92+
renderscriptSupportModeEnabled true
93+
94+
ndk {
95+
abiFilters "armeabi", "armeabi-v7a", "x86"
96+
}
9197
}
9298

99+
93100
buildTypes {
94101
release {
95102
minifyEnabled false
@@ -108,32 +115,37 @@ android {
108115
}
109116

110117
dependencies {
111-
implementation 'com.android.support:support-v13:27.1.0'
112-
implementation 'com.android.support:appcompat-v7:27.1.0'
113-
implementation 'com.android.support:design:27.1.0'
114-
implementation 'com.android.support:cardview-v7:27.1.0'
115-
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
116-
implementation 'com.github.guardianproject:signal-cli-android:-SNAPSHOT'
117-
implementation 'com.squareup.picasso:picasso:2.5.2'
118+
implementation 'com.android.support:support-v4:27.1.1'
119+
implementation 'com.android.support:appcompat-v7:27.1.1'
120+
implementation 'com.android.support:design:27.1.1'
121+
implementation 'com.android.support:cardview-v7:27.1.1'
122+
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
123+
implementation 'com.github.guardianproject:signal-cli-android:v0.6.0-android-beta-1'
124+
implementation 'com.github.satyan:sugar:1.5'
118125
implementation 'net.the4thdimension:audio-wife:1.0.3'
119126
implementation 'com.github.apl-devs:appintro:v4.2.3'
120127
implementation 'info.guardianproject.netcipher:netcipher:2.0.0-alpha1'
121128
implementation 'com.nanohttpd:nanohttpd-webserver:2.2.0'
122129
implementation 'me.angrybyte.picker:picker:1.3.1'
123130
implementation 'com.github.stfalcon:frescoimageviewer:0.5.0'
124-
implementation 'com.facebook.fresco:fresco:1.8.0'
125-
implementation 'com.github.derlio.waveform:library:1.0.1'
131+
implementation 'com.facebook.fresco:fresco:1.9.0'
132+
implementation 'com.github.derlio.waveform:library:1.0.3@aar'
126133
implementation 'org.firezenk:audiowaves:1.1@aar'
127134
implementation 'com.maxproj.simplewaveform:app:1.0.0'
128135
implementation 'com.takisoft.fix:preference-v7:27.1.0.0'
129136
implementation 'com.wdullaer:materialdatetimepicker:3.5.2'
130-
implementation 'com.googlecode.libphonenumber:libphonenumber:8.7.0'
137+
implementation 'com.googlecode.libphonenumber:libphonenumber:8.8.10'
131138
implementation('com.mikepenz:aboutlibraries:6.0.2@aar') {
132139
transitive = true
133140
}
141+
implementation 'com.asksira.android:cameraviewplus:0.9.4'
142+
implementation 'com.github.halilozercan:BetterVideoPlayer:1.1.0'
143+
implementation 'io.github.silvaren:easyrs:0.5.3'
144+
implementation 'org.jcodec:jcodec:0.2.3'
145+
implementation 'org.jcodec:jcodec-android:0.2.3'
134146
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
135147

136148
// Room
137-
implementation "android.arch.persistence.room:runtime:1.1.0"
138-
kapt "android.arch.persistence.room:compiler:1.1.0"
149+
implementation "android.arch.persistence.room:runtime:1.1.1"
150+
kapt "android.arch.persistence.room:compiler:1.1.1"
139151
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#Fri Oct 27 16:43:50 EDT 2017
1+
#Tue Aug 28 12:14:00 IST 2018
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
7-
android.enableD8=true
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
7+
android.enableD8=true

src/main/AndroidManifest.xml

Lines changed: 77 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,51 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
34
package="org.havenapp.main">
45

56
<uses-permission android:name="android.permission.INTERNET" />
6-
<uses-permission android:name="android.permission.CAMERA"/>
7+
<uses-permission android:name="android.permission.CAMERA" />
78
<uses-permission android:name="android.permission.RECORD_AUDIO" />
89
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
9-
<uses-permission android:name="android.permission.SEND_SMS"/>
10+
<uses-permission android:name="android.permission.SEND_SMS" />
1011

11-
<uses-feature android:name="android.hardware.camera" android:required="false" />
12-
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
13-
<uses-feature android:name="android.hardware.telephony" android:required="false" />
14-
<uses-feature android:name="android.hardware.microphone" android:required="false" />
15-
<!-- Some Chromebooks don't support touch. Although not essential,
16-
it's a good idea to explicitly include this declaration. -->
17-
<uses-feature android:name="android.hardware.touchscreen"
12+
<uses-feature
13+
android:name="android.hardware.camera"
14+
android:required="false" />
15+
<uses-feature
16+
android:name="android.hardware.camera.autofocus"
17+
android:required="false" />
18+
<uses-feature
19+
android:name="android.hardware.telephony"
20+
android:required="false" />
21+
<uses-feature
22+
android:name="android.hardware.microphone"
23+
android:required="false" />
24+
<!--
25+
Some Chromebooks don't support touch. Although not essential,
26+
it's a good idea to explicitly include this declaration.
27+
-->
28+
<uses-feature
29+
android:name="android.hardware.touchscreen"
1830
android:required="false" />
1931

20-
<uses-permission android:name="android.permission.WAKE_LOCK"/>
21-
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
32+
<uses-permission android:name="android.permission.WAKE_LOCK" />
33+
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
2234
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
35+
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
2336

24-
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
25-
26-
<application xmlns:tools="http://schemas.android.com/tools"
27-
android:name="org.havenapp.main.HavenApp"
37+
<application xmlns:tools="http://schemas.android.com/tools"
38+
android:name=".HavenApp"
39+
android:allowBackup="false"
2840
android:icon="@mipmap/ic_launcher"
2941
android:label="@string/app_name"
30-
tools:replace="android:allowBackup"
31-
android:allowBackup="false"
3242
android:largeHeap="true"
33-
android:theme="@style/AppTheme">
43+
android:theme="@style/AppTheme"
44+
tools:replace="android:allowBackup">
3445
<activity
35-
android:name="org.havenapp.main.ListActivity"
36-
android:label="@string/title_activity_start"
46+
android:name=".ListActivity"
3747
android:configChanges="orientation|screenSize"
48+
android:label="@string/title_activity_start"
3849
android:windowSoftInputMode="stateHidden">
3950
<intent-filter>
4051
<action android:name="android.intent.action.MAIN" />
@@ -43,21 +54,32 @@
4354
</intent-filter>
4455
</activity>
4556
<activity
46-
android:name="org.havenapp.main.SettingsActivity"
57+
android:name=".SettingsActivity"
58+
android:configChanges="orientation|screenSize"
4759
android:label="@string/settings"
4860
android:theme="@style/SettingsTheme"
49-
android:configChanges="orientation|screenSize"
5061
android:windowSoftInputMode="stateHidden" />
51-
<activity android:name="org.havenapp.main.ui.PPAppIntro"
62+
<activity
63+
android:name=".ui.PPAppIntro"
64+
android:screenOrientation="portrait" />
65+
<activity
66+
android:name=".MonitorActivity"
67+
android:label="@string/app_name"
5268
android:screenOrientation="portrait"
69+
android:launchMode="singleTop"
70+
android:resizeableActivity="true"
71+
android:supportsPictureInPicture="true"
72+
android:configChanges=
73+
"screenSize|smallestScreenSize|screenLayout|orientation"
5374
/>
5475
<activity
55-
android:name="org.havenapp.main.MonitorActivity"
56-
android:label="@string/app_name"
57-
android:configChanges="orientation|screenSize"
58-
android:launchMode="singleTop" />
76+
android:name=".ui.VideoPlayerActivity"
77+
android:configChanges="orientation|keyboardHidden|screenLayout|screenSize"
78+
android:label="@string/title_activity_video_player"
79+
android:theme="@style/AppTheme" />
5980

60-
<service android:name="org.havenapp.main.service.MonitorService"
81+
<service
82+
android:name=".service.MonitorService"
6183
android:exported="false" />
6284

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

7698
<activity
77-
android:name="org.havenapp.main.ui.EventActivity"
78-
android:label="@string/title_activity_event"
99+
android:name=".ui.EventActivity"
79100
android:configChanges="orientation|screenSize"
101+
android:label="@string/title_activity_event"
80102
android:theme="@style/AppTheme" />
81-
<activity android:name="org.havenapp.main.ui.MicrophoneConfigureActivity"
82-
android:configChanges="orientation|screenSize|keyboardHidden"/>
83-
<activity android:name="org.havenapp.main.ui.AccelConfigureActivity"
84-
android:configChanges="orientation|screenSize|keyboardHidden"/>
85-
<activity android:name="org.havenapp.main.ui.CameraConfigureActivity"
86-
android:configChanges="orientation|screenSize|keyboardHidden"/>
103+
<activity
104+
android:name=".ui.MicrophoneConfigureActivity"
105+
android:configChanges="orientation|screenSize|keyboardHidden" />
106+
<activity
107+
android:name=".ui.AccelConfigureActivity"
108+
android:configChanges="orientation|screenSize|keyboardHidden" />
109+
<activity
110+
android:name=".ui.CameraConfigureActivity"
111+
android:screenOrientation="portrait"
112+
android:configChanges="orientation|screenSize|keyboardHidden" />
87113

88-
<receiver android:name="org.havenapp.main.sensors.PowerConnectionReceiver">
114+
<receiver android:name=".sensors.PowerConnectionReceiver">
89115
<intent-filter>
90-
<action android:name="android.intent.action.ACTION_POWER_CONNECTED"/>
91-
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
116+
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
117+
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
92118
</intent-filter>
93119
</receiver>
120+
121+
<provider
122+
android:name="android.support.v4.content.FileProvider"
123+
android:authorities="org.havenapp.main.fileprovider"
124+
android:grantUriPermissions="true"
125+
android:exported="false">
126+
<meta-data
127+
android:name="android.support.FILE_PROVIDER_PATHS"
128+
android:resource="@xml/file_provider_paths" />
129+
</provider>
130+
94131
</application>
95132

96-
</manifest>
133+
</manifest>

src/main/java/org/havenapp/main/HavenApp.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import android.util.Log;
2323

2424
import com.facebook.drawee.backends.pipeline.Fresco;
25+
import com.facebook.imagepipeline.core.ImagePipelineConfig;
26+
import com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig;
2527

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

4749
mPrefs = new PreferenceManager(this);
4850

51+
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
52+
.setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
53+
.setResizeAndRotateEnabledForNetwork(true)
54+
.setDownsampleEnabled(true)
55+
.build();
56+
57+
Fresco.initialize(this,config);
58+
59+
mPrefs = new PreferenceManager(this);
60+
4961
Fresco.initialize(this);
5062
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
5163

@@ -60,10 +72,12 @@ public void startServer ()
6072
{
6173
if (mOnionServer == null || (!mOnionServer.isAlive()))
6274
{
63-
try {
64-
mOnionServer = new WebServer(this, mPrefs.getRemoteAccessCredential());
65-
} catch (IOException ioe) {
66-
Log.e("OnioNServer", "unable to start onion server", ioe);
75+
if ( mPrefs.getRemoteAccessCredential() != null) {
76+
try {
77+
mOnionServer = new WebServer(this, mPrefs.getRemoteAccessCredential());
78+
} catch (IOException ioe) {
79+
Log.e("OnioNServer", "unable to start onion server", ioe);
80+
}
6781
}
6882
}
6983
}

0 commit comments

Comments
 (0)