From c93e78f178321c8ce8ebff0f9e72a273a8eaa254 Mon Sep 17 00:00:00 2001
From: Ernir Erlingsson <ernir@ymirmobile.com>
Date: Wed, 11 May 2016 11:40:49 +0200
Subject: [PATCH] modifications based on Akwizgran's comments

---
 briar-android/AndroidManifest.xml             |  2 +-
 briar-android/build.gradle                    |  4 ---
 briar-android/proguard-rules.txt              | 14 ----------
 .../briarproject/android/ActivityModule.java  | 28 +++++++++----------
 .../briarproject/android/BriarActivity.java   | 10 ++-----
 ...tionImp.java => BriarApplicationImpl.java} |  4 +--
 .../android/NavDrawerActivity.java            | 20 +++++--------
 .../android/SplashScreenActivity.java         |  1 +
 .../android/controller/BriarController.java   |  2 +-
 ...ollerImp.java => BriarControllerImpl.java} |  8 +++---
 ...llerImp.java => ConfigControllerImpl.java} |  4 +--
 .../controller/NavDrawerController.java       |  7 ++---
 ...rImp.java => NavDrawerControllerImpl.java} | 16 +++++------
 ...erImp.java => PasswordControllerImpl.java} |  8 ++++--
 ...ollerImp.java => SetupControllerImpl.java} |  8 +++---
 .../android/panic/PanicResponderActivity.java |  1 +
 .../util/BriarReportSenderFactory.java        |  1 -
 .../system/AndroidSeedProvider.java           |  2 +-
 .../activity/SetupActivityTest.java           |  4 +--
 19 files changed, 57 insertions(+), 87 deletions(-)
 rename briar-android/src/org/briarproject/android/{BriarApplicationImp.java => BriarApplicationImpl.java} (91%)
 rename briar-android/src/org/briarproject/android/controller/{BriarControllerImp.java => BriarControllerImpl.java} (93%)
 rename briar-android/src/org/briarproject/android/controller/{ConfigControllerImp.java => ConfigControllerImpl.java} (88%)
 rename briar-android/src/org/briarproject/android/controller/{NavDrawerControllerImp.java => NavDrawerControllerImpl.java} (88%)
 rename briar-android/src/org/briarproject/android/controller/{PasswordControllerImp.java => PasswordControllerImpl.java} (83%)
 rename briar-android/src/org/briarproject/android/controller/{SetupControllerImp.java => SetupControllerImpl.java} (93%)

diff --git a/briar-android/AndroidManifest.xml b/briar-android/AndroidManifest.xml
index 92ae565c56..6901075a35 100644
--- a/briar-android/AndroidManifest.xml
+++ b/briar-android/AndroidManifest.xml
@@ -29,7 +29,7 @@
 	<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
 
 	<application
-		android:name=".android.BriarApplicationImp"
+		android:name=".android.BriarApplicationImpl"
 		android:allowBackup="false"
 		android:icon="@drawable/ic_launcher"
 		android:label="@string/app_name"
diff --git a/briar-android/build.gradle b/briar-android/build.gradle
index e32b70902a..7b8deefc37 100644
--- a/briar-android/build.gradle
+++ b/briar-android/build.gradle
@@ -93,10 +93,6 @@ android {
 			assets.srcDirs = ['assets']
 		}
 
-		// Move the tests to tests/java, tests/res, etc...
-		//instrumentTest.setRoot('tests')
-//		unitTest.setRoot('tests')
-
 		androidTest.setRoot('androidTest')
 		androidTest {
 			java.srcDirs = ['androidTest/java']
diff --git a/briar-android/proguard-rules.txt b/briar-android/proguard-rules.txt
index 8ff4600e0c..3f11de5e3b 100644
--- a/briar-android/proguard-rules.txt
+++ b/briar-android/proguard-rules.txt
@@ -50,20 +50,6 @@
 -keep class dagger.** { *; }
 -keep class com.google.** { *; }
 
--dontwarn org.hamcrest.**
--dontwarn com.squareup.**
--dontwarn com.google.android.**
-
--keep class com.google.android.** {
-   *;
-}
--keep class com.google.common.** {
-   *;
-}
--keep class org.hamcrest.** {
-   *;
-}
-
 -dontwarn org.h2.**
 -dontnote org.h2.**
 -dontwarn net.sf.cglib.**
diff --git a/briar-android/src/org/briarproject/android/ActivityModule.java b/briar-android/src/org/briarproject/android/ActivityModule.java
index 36c31ef981..0b8b20298c 100644
--- a/briar-android/src/org/briarproject/android/ActivityModule.java
+++ b/briar-android/src/org/briarproject/android/ActivityModule.java
@@ -7,18 +7,18 @@ import android.os.Bundle;
 
 import org.briarproject.android.contact.ContactListFragment;
 import org.briarproject.android.controller.BriarController;
-import org.briarproject.android.controller.BriarControllerImp;
+import org.briarproject.android.controller.BriarControllerImpl;
 import org.briarproject.android.controller.NavDrawerController;
-import org.briarproject.android.controller.NavDrawerControllerImp;
+import org.briarproject.android.controller.NavDrawerControllerImpl;
+import org.briarproject.android.controller.PasswordControllerImpl;
+import org.briarproject.android.controller.SetupControllerImpl;
 import org.briarproject.android.controller.TransportStateListener;
 import org.briarproject.android.forum.ForumListFragment;
 import org.briarproject.android.fragment.BaseFragment;
 import org.briarproject.android.controller.PasswordController;
-import org.briarproject.android.controller.PasswordControllerImp;
 import org.briarproject.android.controller.SetupController;
-import org.briarproject.android.controller.SetupControllerImp;
 import org.briarproject.android.controller.ConfigController;
-import org.briarproject.android.controller.ConfigControllerImp;
+import org.briarproject.android.controller.ConfigControllerImpl;
 import org.briarproject.android.introduction.ContactChooserFragment;
 import org.briarproject.android.introduction.IntroductionMessageFragment;
 import org.briarproject.android.keyagreement.ChooseIdentityFragment;
@@ -55,15 +55,15 @@ public class ActivityModule {
 	@ActivityScope
 	@Provides
 	protected SetupController provideSetupController(
-			SetupControllerImp setupControllerImp) {
-		return setupControllerImp;
+			SetupControllerImpl setupControllerImpl) {
+		return setupControllerImpl;
 	}
 
 	@ActivityScope
 	@Provides
 	protected ConfigController provideConfigController(
-			ConfigControllerImp configControllerImp) {
-		return configControllerImp;
+			ConfigControllerImpl configControllerImpl) {
+		return configControllerImpl;
 	}
 
 	@ActivityScope
@@ -75,22 +75,22 @@ public class ActivityModule {
 	@ActivityScope
 	@Provides
 	protected PasswordController providePasswordController(
-			PasswordControllerImp passwordControllerImp) {
+			PasswordControllerImpl passwordControllerImp) {
 		return passwordControllerImp;
 	}
 
 	@ActivityScope
 	@Provides
 	protected BriarController provideBriarController(
-			BriarControllerImp briarControllerImp) {
-		activity.addLifecycleController(briarControllerImp);
-		return briarControllerImp;
+			BriarControllerImpl briarControllerImpl) {
+		activity.addLifecycleController(briarControllerImpl);
+		return briarControllerImpl;
 	}
 
 	@ActivityScope
 	@Provides
 	protected NavDrawerController provideNavDrawerController(
-			NavDrawerControllerImp navDrawerControllerImp) {
+			NavDrawerControllerImpl navDrawerControllerImp) {
 		activity.addLifecycleController(navDrawerControllerImp);
 		if (activity instanceof TransportStateListener) {
 			navDrawerControllerImp
diff --git a/briar-android/src/org/briarproject/android/BriarActivity.java b/briar-android/src/org/briarproject/android/BriarActivity.java
index 901a04e42e..0da52cf2be 100644
--- a/briar-android/src/org/briarproject/android/BriarActivity.java
+++ b/briar-android/src/org/briarproject/android/BriarActivity.java
@@ -3,7 +3,6 @@ package org.briarproject.android;
 import android.annotation.SuppressLint;
 import android.content.Intent;
 import android.os.Build;
-import android.os.Bundle;
 
 import org.briarproject.android.controller.BriarController;
 import org.briarproject.android.controller.handler.UiResultHandler;
@@ -35,11 +34,6 @@ public abstract class BriarActivity extends BaseActivity {
 	@Inject
 	protected BriarController briarController;
 
-	@Override
-	public void onCreate(Bundle state) {
-		super.onCreate(state);
-	}
-
 	@Override
 	protected void onActivityResult(int request, int result, Intent data) {
 		super.onActivityResult(request, result, data);
@@ -52,7 +46,7 @@ public abstract class BriarActivity extends BaseActivity {
 	@Override
 	public void onResume() {
 		super.onResume();
-		if (!briarController.encryptionKey() && !isFinishing()) {
+		if (!briarController.hasEncryptionKey() && !isFinishing()) {
 			Intent i = new Intent(this, PasswordActivity.class);
 			i.setFlags(FLAG_ACTIVITY_NO_ANIMATION | FLAG_ACTIVITY_SINGLE_TOP);
 			startActivityForResult(i, REQUEST_PASSWORD);
@@ -93,7 +87,7 @@ public abstract class BriarActivity extends BaseActivity {
 	}
 
 	@Deprecated
-	public void runOnDbThread(final Runnable task) {
+	public void runOnDbThread(Runnable task) {
 		briarController.runOnDbThread(task);
 	}
 
diff --git a/briar-android/src/org/briarproject/android/BriarApplicationImp.java b/briar-android/src/org/briarproject/android/BriarApplicationImpl.java
similarity index 91%
rename from briar-android/src/org/briarproject/android/BriarApplicationImp.java
rename to briar-android/src/org/briarproject/android/BriarApplicationImpl.java
index 4281c778f4..5abe5dff2d 100644
--- a/briar-android/src/org/briarproject/android/BriarApplicationImp.java
+++ b/briar-android/src/org/briarproject/android/BriarApplicationImpl.java
@@ -22,10 +22,10 @@ import java.util.logging.Logger;
 		resDialogOkToast = R.string.dev_report_saved,
 		deleteOldUnsentReportsOnApplicationStart = false
 )
-public class BriarApplicationImp extends Application implements BriarApplication {
+public class BriarApplicationImpl extends Application implements BriarApplication {
 
 	private static final Logger LOG =
-			Logger.getLogger(BriarApplicationImp.class.getName());
+			Logger.getLogger(BriarApplicationImpl.class.getName());
 
 	private AndroidComponent applicationComponent;
 
diff --git a/briar-android/src/org/briarproject/android/NavDrawerActivity.java b/briar-android/src/org/briarproject/android/NavDrawerActivity.java
index 49fb824c2f..4d18cd6ec5 100644
--- a/briar-android/src/org/briarproject/android/NavDrawerActivity.java
+++ b/briar-android/src/org/briarproject/android/NavDrawerActivity.java
@@ -21,11 +21,10 @@ import android.widget.TextView;
 import org.briarproject.R;
 import org.briarproject.android.controller.NavDrawerController;
 import org.briarproject.android.controller.TransportStateListener;
-import org.briarproject.android.controller.handler.UiResultExceptionHandler;
+import org.briarproject.android.controller.handler.UiResultHandler;
 import org.briarproject.android.fragment.BaseFragment;
 import org.briarproject.android.util.CustomAnimations;
 import org.briarproject.api.TransportId;
-import org.briarproject.api.db.DbException;
 import org.briarproject.api.identity.LocalAuthor;
 
 import java.util.ArrayList;
@@ -48,7 +47,7 @@ public class NavDrawerActivity extends BriarFragmentActivity implements
 	private ActionBarDrawerToggle drawerToggle;
 
 	@Inject
-	NavDrawerController controller;
+	protected NavDrawerController controller;
 
 	private Toolbar toolbar;
 	private DrawerLayout drawerLayout;
@@ -159,16 +158,11 @@ public class NavDrawerActivity extends BriarFragmentActivity implements
 
 	private void storeLocalAuthor(final LocalAuthor a) {
 		controller.storeLocalAuthor(a,
-				new UiResultExceptionHandler<Void, DbException>(this) {
+				new UiResultHandler<Void>(this) {
 					@Override
 					public void onResultUi(Void result) {
 						hideLoadingScreen();
 					}
-
-					@Override
-					public void onExceptionUi(DbException exception) {
-
-					}
 				});
 	}
 
@@ -245,21 +239,21 @@ public class NavDrawerActivity extends BriarFragmentActivity implements
 
 		Transport tor = new Transport();
 		tor.id = new TransportId("tor");
-		tor.enabled = controller.transportRunning(tor.id);
+		tor.enabled = controller.isTransportRunning(tor.id);
 		tor.iconId = R.drawable.transport_tor;
 		tor.textId = R.string.transport_tor;
 		transports.add(tor);
 
 		Transport bt = new Transport();
 		bt.id = new TransportId("bt");
-		bt.enabled = controller.transportRunning(bt.id);
+		bt.enabled = controller.isTransportRunning(bt.id);
 		bt.iconId = R.drawable.transport_bt;
 		bt.textId = R.string.transport_bt;
 		transports.add(bt);
 
 		Transport lan = new Transport();
 		lan.id = new TransportId("lan");
-		lan.enabled = controller.transportRunning(lan.id);
+		lan.enabled = controller.isTransportRunning(lan.id);
 		lan.iconId = R.drawable.transport_lan;
 		lan.textId = R.string.transport_lan;
 		transports.add(lan);
@@ -326,7 +320,7 @@ public class NavDrawerActivity extends BriarFragmentActivity implements
 	private void updateTransports() {
 		if (transports == null || transportsAdapter == null) return;
 		for (Transport t : transports) {
-			t.enabled = controller.transportRunning(t.id);
+			t.enabled = controller.isTransportRunning(t.id);
 		}
 		transportsAdapter.notifyDataSetChanged();
 	}
diff --git a/briar-android/src/org/briarproject/android/SplashScreenActivity.java b/briar-android/src/org/briarproject/android/SplashScreenActivity.java
index e2b8dcc8b0..e4ff0b9418 100644
--- a/briar-android/src/org/briarproject/android/SplashScreenActivity.java
+++ b/briar-android/src/org/briarproject/android/SplashScreenActivity.java
@@ -69,6 +69,7 @@ public class SplashScreenActivity extends BaseActivity {
 				startActivity(new Intent(this, NavDrawerActivity.class));
 			} else {
 				configController.clearPrefs();
+				// TODO replace this static call with a controller method
 				AndroidUtils.deleteAppData(this);
 				startActivity(new Intent(this, SetupActivity.class));
 			}
diff --git a/briar-android/src/org/briarproject/android/controller/BriarController.java b/briar-android/src/org/briarproject/android/controller/BriarController.java
index 2ed024ee99..4be89b1085 100644
--- a/briar-android/src/org/briarproject/android/controller/BriarController.java
+++ b/briar-android/src/org/briarproject/android/controller/BriarController.java
@@ -8,7 +8,7 @@ public interface BriarController extends ActivityLifecycleController {
 
 	void startAndBindService();
 
-	boolean encryptionKey();
+	boolean hasEncryptionKey();
 
 	void signOut(ResultHandler<Void> eventHandler);
 }
diff --git a/briar-android/src/org/briarproject/android/controller/BriarControllerImp.java b/briar-android/src/org/briarproject/android/controller/BriarControllerImpl.java
similarity index 93%
rename from briar-android/src/org/briarproject/android/controller/BriarControllerImp.java
rename to briar-android/src/org/briarproject/android/controller/BriarControllerImpl.java
index 9e7cadeaec..fd24291c78 100644
--- a/briar-android/src/org/briarproject/android/controller/BriarControllerImp.java
+++ b/briar-android/src/org/briarproject/android/controller/BriarControllerImpl.java
@@ -17,10 +17,10 @@ import java.util.logging.Logger;
 
 import javax.inject.Inject;
 
-public class BriarControllerImp implements BriarController {
+public class BriarControllerImpl implements BriarController {
 
 	private static final Logger LOG =
-			Logger.getLogger(BriarControllerImp.class.getName());
+			Logger.getLogger(BriarControllerImpl.class.getName());
 
 	@Inject
 	protected BriarServiceConnection serviceConnection;
@@ -38,7 +38,7 @@ public class BriarControllerImp implements BriarController {
 	private boolean bound = false;
 
 	@Inject
-	public BriarControllerImp() {
+	public BriarControllerImpl() {
 
 	}
 
@@ -71,7 +71,7 @@ public class BriarControllerImp implements BriarController {
 	}
 
 	@Override
-	public boolean encryptionKey() {
+	public boolean hasEncryptionKey() {
 		return databaseConfig.getEncryptionKey() != null;
 	}
 
diff --git a/briar-android/src/org/briarproject/android/controller/ConfigControllerImp.java b/briar-android/src/org/briarproject/android/controller/ConfigControllerImpl.java
similarity index 88%
rename from briar-android/src/org/briarproject/android/controller/ConfigControllerImp.java
rename to briar-android/src/org/briarproject/android/controller/ConfigControllerImpl.java
index d37ab8f1b2..b823b98e2c 100644
--- a/briar-android/src/org/briarproject/android/controller/ConfigControllerImp.java
+++ b/briar-android/src/org/briarproject/android/controller/ConfigControllerImpl.java
@@ -6,7 +6,7 @@ import org.briarproject.api.db.DatabaseConfig;
 
 import javax.inject.Inject;
 
-public class ConfigControllerImp implements ConfigController {
+public class ConfigControllerImpl implements ConfigController {
 
 	private final static String PREF_DB_KEY = "key";
 
@@ -16,7 +16,7 @@ public class ConfigControllerImp implements ConfigController {
 	protected volatile DatabaseConfig databaseConfig;
 
 	@Inject
-	public ConfigControllerImp() {
+	public ConfigControllerImpl() {
 
 	}
 
diff --git a/briar-android/src/org/briarproject/android/controller/NavDrawerController.java b/briar-android/src/org/briarproject/android/controller/NavDrawerController.java
index 2669cc4551..56d48b1ca1 100644
--- a/briar-android/src/org/briarproject/android/controller/NavDrawerController.java
+++ b/briar-android/src/org/briarproject/android/controller/NavDrawerController.java
@@ -1,17 +1,16 @@
 package org.briarproject.android.controller;
 
-import org.briarproject.android.controller.handler.ResultExceptionHandler;
+import org.briarproject.android.controller.handler.UiResultHandler;
 import org.briarproject.api.TransportId;
-import org.briarproject.api.db.DbException;
 import org.briarproject.api.identity.LocalAuthor;
 
 public interface NavDrawerController extends BriarController {
 	void setTransportListener(TransportStateListener transportListener);
 
-	boolean transportRunning(TransportId transportId);
+	boolean isTransportRunning(TransportId transportId);
 
 	void storeLocalAuthor(LocalAuthor author,
-			ResultExceptionHandler<Void, DbException> resultHandler);
+			UiResultHandler<Void> resultHandler);
 
 	LocalAuthor removeAuthorHandle(long handle);
 }
diff --git a/briar-android/src/org/briarproject/android/controller/NavDrawerControllerImp.java b/briar-android/src/org/briarproject/android/controller/NavDrawerControllerImpl.java
similarity index 88%
rename from briar-android/src/org/briarproject/android/controller/NavDrawerControllerImp.java
rename to briar-android/src/org/briarproject/android/controller/NavDrawerControllerImpl.java
index 0a5d2c8655..4be03f9499 100644
--- a/briar-android/src/org/briarproject/android/controller/NavDrawerControllerImp.java
+++ b/briar-android/src/org/briarproject/android/controller/NavDrawerControllerImpl.java
@@ -3,7 +3,7 @@ package org.briarproject.android.controller;
 import android.app.Activity;
 
 import org.briarproject.android.api.ReferenceManager;
-import org.briarproject.android.controller.handler.ResultExceptionHandler;
+import org.briarproject.android.controller.handler.UiResultHandler;
 import org.briarproject.api.TransportId;
 import org.briarproject.api.db.DbException;
 import org.briarproject.api.event.Event;
@@ -25,11 +25,11 @@ import javax.inject.Inject;
 import static java.util.logging.Level.INFO;
 import static java.util.logging.Level.WARNING;
 
-public class NavDrawerControllerImp extends BriarControllerImp
+public class NavDrawerControllerImpl extends BriarControllerImpl
 		implements NavDrawerController, EventListener {
 
 	private static final Logger LOG =
-			Logger.getLogger(NavDrawerControllerImp.class.getName());
+			Logger.getLogger(NavDrawerControllerImpl.class.getName());
 
 	@Inject
 	protected ReferenceManager referenceManager;
@@ -38,7 +38,7 @@ public class NavDrawerControllerImp extends BriarControllerImp
 	@Inject
 	protected PluginManager pluginManager;
 	@Inject
-	protected volatile EventBus eventBus;
+	protected EventBus eventBus;
 	@Inject
 	protected Activity activity;
 
@@ -47,7 +47,7 @@ public class NavDrawerControllerImp extends BriarControllerImp
 	private TransportStateListener transportStateListener;
 
 	@Inject
-	public NavDrawerControllerImp() {
+	public NavDrawerControllerImpl() {
 
 	}
 
@@ -103,15 +103,14 @@ public class NavDrawerControllerImp extends BriarControllerImp
 	}
 
 	@Override
-	public boolean transportRunning(TransportId transportId) {
+	public boolean isTransportRunning(TransportId transportId) {
 		Plugin plugin = pluginManager.getPlugin(transportId);
 		return plugin != null && plugin.isRunning();
 	}
 
 	@Override
 	public void storeLocalAuthor(final LocalAuthor author,
-			final ResultExceptionHandler<Void, DbException> resultHandler) {
-
+			final UiResultHandler<Void> resultHandler) {
 		runOnDbThread(new Runnable() {
 			public void run() {
 				try {
@@ -124,7 +123,6 @@ public class NavDrawerControllerImp extends BriarControllerImp
 				} catch (final DbException e) {
 					if (LOG.isLoggable(WARNING))
 						LOG.log(WARNING, e.toString(), e);
-					resultHandler.onException(e);
 				}
 			}
 		});
diff --git a/briar-android/src/org/briarproject/android/controller/PasswordControllerImp.java b/briar-android/src/org/briarproject/android/controller/PasswordControllerImpl.java
similarity index 83%
rename from briar-android/src/org/briarproject/android/controller/PasswordControllerImp.java
rename to briar-android/src/org/briarproject/android/controller/PasswordControllerImpl.java
index 8a85fc51be..12f7e42407 100644
--- a/briar-android/src/org/briarproject/android/controller/PasswordControllerImp.java
+++ b/briar-android/src/org/briarproject/android/controller/PasswordControllerImpl.java
@@ -12,7 +12,7 @@ import java.util.concurrent.Executor;
 
 import javax.inject.Inject;
 
-public class PasswordControllerImp extends ConfigControllerImp
+public class PasswordControllerImpl extends ConfigControllerImpl
 		implements PasswordController {
 
 	@Inject
@@ -24,7 +24,7 @@ public class PasswordControllerImp extends ConfigControllerImp
 	protected Activity activity;
 
 	@Inject
-	public PasswordControllerImp() {
+	public PasswordControllerImpl() {
 
 	}
 
@@ -47,6 +47,8 @@ public class PasswordControllerImp extends ConfigControllerImp
 
 	private byte[] getEncryptedKey() {
 		String hex = getEncryptedDatabaseKey();
-		return hex == null ? null : StringUtils.fromHexString(hex);
+		if (hex == null)
+			throw new IllegalStateException("Encrypted database key is null.");
+		return StringUtils.fromHexString(hex);
 	}
 }
diff --git a/briar-android/src/org/briarproject/android/controller/SetupControllerImp.java b/briar-android/src/org/briarproject/android/controller/SetupControllerImpl.java
similarity index 93%
rename from briar-android/src/org/briarproject/android/controller/SetupControllerImp.java
rename to briar-android/src/org/briarproject/android/controller/SetupControllerImpl.java
index 61a933e677..29bed6d194 100644
--- a/briar-android/src/org/briarproject/android/controller/SetupControllerImp.java
+++ b/briar-android/src/org/briarproject/android/controller/SetupControllerImpl.java
@@ -22,10 +22,10 @@ import javax.inject.Inject;
 
 import static java.util.logging.Level.INFO;
 
-public class SetupControllerImp implements SetupController {
+public class SetupControllerImpl implements SetupController {
 
 	private static final Logger LOG =
-			Logger.getLogger(SetupControllerImp.class.getName());
+			Logger.getLogger(SetupControllerImpl.class.getName());
 
 	private final static String PREF_DB_KEY = "key";
 
@@ -50,7 +50,7 @@ public class SetupControllerImp implements SetupController {
 	protected SharedPreferences briarPrefs;
 
 	@Inject
-	public SetupControllerImp() {
+	public SetupControllerImpl() {
 
 	}
 
@@ -90,7 +90,7 @@ public class SetupControllerImp implements SetupController {
 				databaseConfig.setEncryptionKey(key);
 				String hex = encryptDatabaseKey(key, password);
 				storeEncryptedDatabaseKey(hex);
-				final LocalAuthor localAuthor = createLocalAuthor(nickname);
+				LocalAuthor localAuthor = createLocalAuthor(nickname);
 				long handle = referenceManager.putReference(localAuthor,
 						LocalAuthor.class);
 				resultHandler.onResult(handle);
diff --git a/briar-android/src/org/briarproject/android/panic/PanicResponderActivity.java b/briar-android/src/org/briarproject/android/panic/PanicResponderActivity.java
index 0b08f7f5a4..fbe549e6ee 100644
--- a/briar-android/src/org/briarproject/android/panic/PanicResponderActivity.java
+++ b/briar-android/src/org/briarproject/android/panic/PanicResponderActivity.java
@@ -112,6 +112,7 @@ public class PanicResponderActivity extends BriarActivity {
 			public void run() {
 				configController.clearPrefs();
 				// TODO somehow delete/shred the database more thoroughly
+				// TODO replace this static call with a controller method
 				AndroidUtils.deleteAppData(PanicResponderActivity.this);
 				PanicResponder.deleteAllAppData(PanicResponderActivity.this);
 
diff --git a/briar-android/src/org/briarproject/android/util/BriarReportSenderFactory.java b/briar-android/src/org/briarproject/android/util/BriarReportSenderFactory.java
index 73108ae4ae..6dc106f743 100644
--- a/briar-android/src/org/briarproject/android/util/BriarReportSenderFactory.java
+++ b/briar-android/src/org/briarproject/android/util/BriarReportSenderFactory.java
@@ -7,7 +7,6 @@ import org.acra.config.ACRAConfiguration;
 import org.acra.sender.ReportSender;
 import org.acra.sender.ReportSenderFactory;
 import org.briarproject.android.BriarApplication;
-import org.briarproject.android.BriarApplicationImp;
 
 public class BriarReportSenderFactory implements ReportSenderFactory {
 	@NonNull
diff --git a/briar-android/src/org/briarproject/system/AndroidSeedProvider.java b/briar-android/src/org/briarproject/system/AndroidSeedProvider.java
index 1b51be767d..59c7a6e3a5 100644
--- a/briar-android/src/org/briarproject/system/AndroidSeedProvider.java
+++ b/briar-android/src/org/briarproject/system/AndroidSeedProvider.java
@@ -37,7 +37,7 @@ class AndroidSeedProvider extends LinuxSeedProvider {
 		String str = Settings.Secure.getString(contentResolver, ANDROID_ID);
 		if (str != null) {
 			out.writeUTF(str);
-			super.writeToEntropyPool(out);
 		}
+		super.writeToEntropyPool(out);
 	}
 }
diff --git a/briar-android/test/java/briarproject/activity/SetupActivityTest.java b/briar-android/test/java/briarproject/activity/SetupActivityTest.java
index 5adf7483d0..b58d033b25 100644
--- a/briar-android/test/java/briarproject/activity/SetupActivityTest.java
+++ b/briar-android/test/java/briarproject/activity/SetupActivityTest.java
@@ -144,13 +144,13 @@ public class SetupActivityTest {
 	}
 
 	@Test
-	public void testNickUI() {
+	public void testNicknameUI() {
 		Assert.assertNotNull(setupActivity);
 		String longNick =
 				Strings.padEnd("*", AuthorConstants.MAX_AUTHOR_NAME_LENGTH + 1,
 						'*');
 		nicknameEntry.setText(longNick);
-		// Password should be too long
+		// Nickname should be too long
 		assertEquals(nicknameEntryWrapper.getError(),
 				setupActivity.getString(R.string.name_too_long));
 	}
-- 
GitLab