Skip to content

Commit

Permalink
First commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
clintidau committed Sep 9, 2016
1 parent d0b2ab7 commit 4d1050b
Show file tree
Hide file tree
Showing 59 changed files with 1,858 additions and 1 deletion.
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion README.md
@@ -1 +1,3 @@
# LifeBoxApp
# LifeBoxApp

LifeBoxApp is a lifelogging and sousveillance app that captures audio 24/7 on your Android device and uploads it to your personal Dropbox account.
32 changes: 32 additions & 0 deletions app/build.gradle
@@ -0,0 +1,32 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 16
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "com.lifebox.lifeboxapp"
minSdkVersion 16
targetSdkVersion 16
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_5
targetCompatibility JavaVersion.VERSION_1_5
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile files('libs/dropbox-android-sdk-1.5.1.jar')
compile files('libs/httpclient-4.0.3.jar')
compile files('libs/httpcore-4.0.1.jar')
compile files('libs/httpmime-4.0.3.jar')
compile files('libs/json_simple-1.1.jar')
}
Binary file added app/libs/commons-codec-1.10.jar
Binary file not shown.
Binary file added app/libs/commons-logging-1.1.1.jar
Binary file not shown.
Binary file added app/libs/dropbox-android-sdk-1.5.1.jar
Binary file not shown.
Binary file added app/libs/httpclient-4.0.3.jar
Binary file not shown.
Binary file added app/libs/httpcore-4.0.1.jar
Binary file not shown.
Binary file added app/libs/httpmime-4.0.3.jar
Binary file not shown.
Binary file added app/libs/json_simple-1.1.jar
Binary file not shown.
Binary file added app/libs/libGoogleAnalytics.jar
Binary file not shown.
3 changes: 3 additions & 0 deletions app/lint.xml
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<lint>
</lint>
80 changes: 80 additions & 0 deletions app/src/main/AndroidManifest.xml
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lifebox.lifeboxapp"
android:versionCode="6"
android:versionName="0.1.5"
android:allowBackup="false" >

<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="16" />

<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"/>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<uses-feature android:name="android.hardware.wifi" />

<application
android:icon="@drawable/icon"
android:label="@string/app_name" >
<activity
android:name="com.lifebox.lifeboxapp.LifeBoxAppMain"
android:alwaysRetainTaskState="false"
android:label="LifeBox"
android:launchMode="standard"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.lifebox.lifeboxapp.Settings"
android:alwaysRetainTaskState="false"
android:label="Settings"
android:launchMode="standard"
android:exported="false" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name="com.dropbox.client2.android.AuthActivity"
android:configChanges="orientation|keyboard"
android:launchMode="singleTask" >
<intent-filter>
<data android:scheme="db-INSERT_APP_KEY" />

<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

<service android:name=".RecordingService" >
</service>

<receiver
android:name=".RecordingServiceBroadcastReceiver"
android:enabled="true"
android:exported="false"
android:label="LifeBoxRecordingServiceBroadcastReciever" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application>

</manifest>
Binary file added app/src/main/assets/icon.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/logo.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions app/src/main/java/com/lifebox/lifeboxapp/Crypto.java
@@ -0,0 +1,50 @@
package com.lifebox.lifeboxapp;

import android.util.Base64;

import javax.crypto.Cipher;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;

public class Crypto {
private byte[] keyBytes;

public Crypto(String key) throws Exception {
keyBytes = Base64ToByte(key);
}

public byte[] encrypt(byte[] plainText) throws Exception {
Cipher cipher = getCipher(Cipher.ENCRYPT_MODE);
return cipher.doFinal(plainText);
}

public byte[] decrypt(byte[] encrypted) throws Exception {
Cipher cipher = getCipher(Cipher.DECRYPT_MODE);
return cipher.doFinal(encrypted);
}

private Cipher getCipher(int cipherMode) throws Exception {
String encryptionAlgorithm = "AES";
SecretKeySpec keySpecification = new SecretKeySpec(keyBytes, encryptionAlgorithm);
Cipher cipher = Cipher.getInstance(encryptionAlgorithm);
cipher.init(cipherMode, keySpecification);
return cipher;
}

public static String makeKey(String password, String salt) throws Exception {
PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt.getBytes("UTF-8"), 1000, 128);
SecretKeyFactory skf;
skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
byte[] key = skf.generateSecret(spec).getEncoded();
return ByteToBase64(key);
}

public static String ByteToBase64(byte[] input) {
return Base64.encodeToString(input, Base64.DEFAULT);
}

public static byte[] Base64ToByte(String input) {
return Base64.decode(input, Base64.DEFAULT);
}
}
45 changes: 45 additions & 0 deletions app/src/main/java/com/lifebox/lifeboxapp/Installation.java
@@ -0,0 +1,45 @@
// http://android-developers.blogspot.com.au/2011/03/identifying-app-installations.html

package com.lifebox.lifeboxapp;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.UUID;

import android.content.Context;

public class Installation {
private static String sID = null;
private static final String INSTALLATION = "INSTALLATION";

public synchronized static String id(Context context) {
if (sID == null) {
File installation = new File(context.getFilesDir(), INSTALLATION);
try {
if (!installation.exists())
writeInstallationFile(installation);
sID = readInstallationFile(installation);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return sID;
}

private static String readInstallationFile(File installation) throws IOException {
RandomAccessFile f = new RandomAccessFile(installation, "r");
byte[] bytes = new byte[(int) f.length()];
f.readFully(bytes);
f.close();
return new String(bytes);
}

private static void writeInstallationFile(File installation) throws IOException {
FileOutputStream out = new FileOutputStream(installation);
String id = UUID.randomUUID().toString();
out.write(id.getBytes());
out.close();
}
}

0 comments on commit 4d1050b

Please sign in to comment.