diff --git a/briar-android/build.gradle b/briar-android/build.gradle index 81228e91863e36d784813798f1c84c57615a3254..ac935511755db9e4f0a1f7828f72961fdb03a84c 100644 --- a/briar-android/build.gradle +++ b/briar-android/build.gradle @@ -97,4 +97,7 @@ android { lintOptions { abortOnError false } +} +dependencies { + compile 'cglib:cglib-nodep:3.1' } \ No newline at end of file diff --git a/briar-android/src/org/briarproject/android/AndroidComponent.java b/briar-android/src/org/briarproject/android/AndroidComponent.java index 27f156e9156d49da3c5d903f3be995669bd05588..e182b9a47f8abcdeab4777a508ebc91e8695c9eb 100644 --- a/briar-android/src/org/briarproject/android/AndroidComponent.java +++ b/briar-android/src/org/briarproject/android/AndroidComponent.java @@ -1,6 +1,7 @@ package org.briarproject.android; -import org.briarproject.CoreComponent; +import org.briarproject.CoreEagerSingletons; +import org.briarproject.CoreModule; import org.briarproject.android.contact.ContactListFragment; import org.briarproject.android.contact.ConversationActivity; import org.briarproject.android.forum.AvailableForumsActivity; @@ -15,33 +16,59 @@ import org.briarproject.android.identity.CreateIdentityActivity; import org.briarproject.android.invitation.AddContactActivity; import org.briarproject.android.panic.PanicPreferencesActivity; import org.briarproject.android.panic.PanicResponderActivity; +import org.briarproject.plugins.AndroidPluginsModule; +import org.briarproject.system.AndroidSystemModule; + +import javax.inject.Singleton; import dagger.Component; -@ApplicationScope + +@Singleton @Component( - dependencies = {CoreComponent.class}, - modules = {AppModule.class, AndroidModule.class}) -public interface AndroidComponent { + modules = {CoreModule.class, AppModule.class, AndroidModule.class, + AndroidPluginsModule.class, AndroidSystemModule.class}) +public interface AndroidComponent extends CoreEagerSingletons { + void inject(SplashScreenActivity activity); + void inject(SetupActivity activity); + void inject(NavDrawerActivity activity); + void inject(PasswordActivity activity); + void inject(BriarService activity); + void inject(PanicResponderActivity activity); + void inject(PanicPreferencesActivity activity); + void inject(AddContactActivity activity); + void inject(ConversationActivity activity); + void inject(CreateIdentityActivity activity); + void inject(TestingActivity activity); + void inject(AvailableForumsActivity activity); + void inject(WriteForumPostActivity activity); + void inject(CreateForumActivity activity); + void inject(ShareForumActivity activity); + void inject(ReadForumPostActivity activity); + void inject(ForumActivity activity); + void inject(ContactListFragment fragment); + void inject(SettingsFragment fragment); + void inject(ForumListFragment fragment); + // Eager singleton load void inject(AndroidModule.EagerSingletons init); diff --git a/briar-android/src/org/briarproject/android/AndroidModule.java b/briar-android/src/org/briarproject/android/AndroidModule.java index 53ea73f15ba22322e31391eef9ea3f3366aa5ad4..d3a7d8a4d53d10897cf3b2b61c64c948e71f6318 100644 --- a/briar-android/src/org/briarproject/android/AndroidModule.java +++ b/briar-android/src/org/briarproject/android/AndroidModule.java @@ -1,11 +1,20 @@ package org.briarproject.android; -import org.briarproject.api.android.AndroidNotificationManager; -import org.briarproject.api.android.ReferenceManager; +import android.app.Application; +import android.content.Context; + +import org.briarproject.android.api.AndroidNotificationManager; +import org.briarproject.android.api.ReferenceManager; +import org.briarproject.api.crypto.SecretKey; +import org.briarproject.api.db.DatabaseConfig; import org.briarproject.api.event.EventBus; import org.briarproject.api.lifecycle.LifecycleManager; +import org.briarproject.api.ui.UiCallback; + +import java.io.File; import javax.inject.Inject; +import javax.inject.Singleton; import dagger.Module; import dagger.Provides; @@ -18,14 +27,69 @@ public class AndroidModule { AndroidNotificationManager androidNotificationManager; } + private final UiCallback uiCallback; + + public AndroidModule() { + // Use a dummy UI callback + uiCallback = new UiCallback() { + + public int showChoice(String[] options, String... message) { + throw new UnsupportedOperationException(); + } + + public boolean showConfirmationMessage(String... message) { + throw new UnsupportedOperationException(); + } + + public void showMessage(String... message) { + throw new UnsupportedOperationException(); + } + }; + } + + @Provides + public UiCallback provideUICallback() { + return uiCallback; + } + + @Provides + @Singleton + public DatabaseConfig provideDatabaseConfig(Application app) { + final File dir = app.getApplicationContext().getDir("db", Context.MODE_PRIVATE); + return new DatabaseConfig() { + + private volatile SecretKey key = null; + + public boolean databaseExists() { + return dir.isDirectory() && dir.listFiles().length > 0; + } + + public File getDatabaseDirectory() { + return dir; + } + + public void setEncryptionKey(SecretKey key) { + this.key = key; + } + + public SecretKey getEncryptionKey() { + return key; + } + + public long getMaxSize() { + return Long.MAX_VALUE; + } + }; + } + @Provides - @ApplicationScope + @Singleton ReferenceManager provideReferenceManager() { return new ReferenceManagerImpl(); } @Provides - @ApplicationScope + @Singleton AndroidNotificationManager provideAndroidNotificationManager( LifecycleManager lifecycleManager, EventBus eventBus, AndroidNotificationManagerImpl notificationManager) { diff --git a/briar-android/src/org/briarproject/android/AndroidNotificationManagerImpl.java b/briar-android/src/org/briarproject/android/AndroidNotificationManagerImpl.java index 64ae4e90e3fad024ff2c4dcfda1a011879b2aa64..172c998d10467e80ccf1bf5ffd2c2f7928911b58 100644 --- a/briar-android/src/org/briarproject/android/AndroidNotificationManagerImpl.java +++ b/briar-android/src/org/briarproject/android/AndroidNotificationManagerImpl.java @@ -12,8 +12,8 @@ import android.support.v4.app.TaskStackBuilder; import org.briarproject.R; import org.briarproject.android.contact.ConversationActivity; import org.briarproject.android.forum.ForumActivity; -import org.briarproject.api.android.PlatformExecutor; -import org.briarproject.api.android.AndroidNotificationManager; +import org.briarproject.android.api.AndroidExecutor; +import org.briarproject.android.api.AndroidNotificationManager; import org.briarproject.api.db.DatabaseExecutor; import org.briarproject.api.db.DbException; import org.briarproject.api.event.Event; @@ -65,7 +65,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, private final SettingsManager settingsManager; private final MessagingManager messagingManager; private final ForumManager forumManager; - private final PlatformExecutor platformExecutor; + private final AndroidExecutor androidExecutor; private final Context appContext; // The following must only be accessed on the main UI thread @@ -82,13 +82,13 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, @Inject public AndroidNotificationManagerImpl(@DatabaseExecutor Executor dbExecutor, SettingsManager settingsManager, MessagingManager messagingManager, - ForumManager forumManager, PlatformExecutor platformExecutor, + ForumManager forumManager, AndroidExecutor androidExecutor, Application app) { this.dbExecutor = dbExecutor; this.settingsManager = settingsManager; this.messagingManager = messagingManager; this.forumManager = forumManager; - this.platformExecutor = platformExecutor; + this.androidExecutor = androidExecutor; appContext = app.getApplicationContext(); } @@ -118,7 +118,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, } private void clearNotifications() { - platformExecutor.execute(new Runnable() { + androidExecutor.execute(new Runnable() { public void run() { clearPrivateMessageNotification(); clearForumPostNotification(); @@ -155,7 +155,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, } public void showPrivateMessageNotification(final GroupId g) { - platformExecutor.execute(new Runnable() { + androidExecutor.execute(new Runnable() { public void run() { Integer count = contactCounts.get(g); if (count == null) contactCounts.put(g, 1); @@ -168,7 +168,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, } public void clearPrivateMessageNotification(final GroupId g) { - platformExecutor.execute(new Runnable() { + androidExecutor.execute(new Runnable() { public void run() { Integer count = contactCounts.remove(g); if (count == null) return; // Already cleared @@ -239,7 +239,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, } public void showForumPostNotification(final GroupId g) { - platformExecutor.execute(new Runnable() { + androidExecutor.execute(new Runnable() { public void run() { Integer count = forumCounts.get(g); if (count == null) forumCounts.put(g, 1); @@ -252,7 +252,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, } public void clearForumPostNotification(final GroupId g) { - platformExecutor.execute(new Runnable() { + androidExecutor.execute(new Runnable() { public void run() { Integer count = forumCounts.remove(g); if (count == null) return; // Already cleared @@ -311,7 +311,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, } public void blockNotification(final GroupId g) { - platformExecutor.execute(new Runnable() { + androidExecutor.execute(new Runnable() { public void run() { visibleGroup = g; } @@ -319,7 +319,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, } public void unblockNotification(final GroupId g) { - platformExecutor.execute(new Runnable() { + androidExecutor.execute(new Runnable() { public void run() { if (g.equals(visibleGroup)) visibleGroup = null; } diff --git a/briar-android/src/org/briarproject/android/AppModule.java b/briar-android/src/org/briarproject/android/AppModule.java index b48d752e3497c589f802a091c0980e50de4fd02b..53631803d5d86e7bf6c0203eaf2749afcf7c6bfb 100644 --- a/briar-android/src/org/briarproject/android/AppModule.java +++ b/briar-android/src/org/briarproject/android/AppModule.java @@ -2,6 +2,8 @@ package org.briarproject.android; import android.app.Application; +import javax.inject.Singleton; + import dagger.Module; import dagger.Provides; @@ -15,7 +17,7 @@ public class AppModule { } @Provides - @ApplicationScope + @Singleton Application providesApplication() { return application; } diff --git a/briar-android/src/org/briarproject/android/ApplicationScope.java b/briar-android/src/org/briarproject/android/ApplicationScope.java deleted file mode 100644 index ad1fb2a4aa65911e19087fcf2550bd52b468d187..0000000000000000000000000000000000000000 --- a/briar-android/src/org/briarproject/android/ApplicationScope.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.briarproject.android; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -import javax.inject.Scope; - -@Scope -@Retention(RetentionPolicy.RUNTIME) -public @interface ApplicationScope { -} diff --git a/briar-android/src/org/briarproject/android/BriarApplication.java b/briar-android/src/org/briarproject/android/BriarApplication.java index 6a01e57fb8bffb31ebabb4f71f2cf0eaa50c26a7..a4a34720dbf52910df3c7f3392b710c5c4c6dc95 100644 --- a/briar-android/src/org/briarproject/android/BriarApplication.java +++ b/briar-android/src/org/briarproject/android/BriarApplication.java @@ -6,12 +6,7 @@ import java.util.logging.Logger; import android.app.Application; import android.content.Context; -import org.briarproject.CoreComponent; -import org.briarproject.CoreEagerSingletons; -import org.briarproject.DaggerCoreComponent; -import org.briarproject.plugins.PluginsModuleExtension; -import org.briarproject.system.PlatformModuleExtension; -import org.briarproject.system.SystemModuleExtension; +import org.briarproject.CoreModule; public class BriarApplication extends Application { @@ -30,20 +25,14 @@ public class BriarApplication extends Application { CrashHandler newHandler = new CrashHandler(ctx, oldHandler); Thread.setDefaultUncaughtExceptionHandler(newHandler); - CoreComponent coreComponent = DaggerCoreComponent.builder() - .systemModule(new SystemModuleExtension(this)) - .platformModule(new PlatformModuleExtension(this)) - .pluginsModule(new PluginsModuleExtension(this)) - .build(); - applicationComponent = DaggerAndroidComponent.builder() .appModule(new AppModule(this)) - .coreComponent(coreComponent) + .androidModule(new AndroidModule()) .build(); // We need to load the eager singletons directly after making the // dependency graphs - CoreEagerSingletons.initEagerSingletons(coreComponent); + CoreModule.initEagerSingletons(applicationComponent); AndroidEagerSingletons.initEagerSingletons(applicationComponent); } diff --git a/briar-android/src/org/briarproject/android/BriarService.java b/briar-android/src/org/briarproject/android/BriarService.java index 2a2bd6522fda283a4d2d230c599c656a0d53eab9..06a09cce19cc23e621467203c3bc5c2947028e4f 100644 --- a/briar-android/src/org/briarproject/android/BriarService.java +++ b/briar-android/src/org/briarproject/android/BriarService.java @@ -12,7 +12,7 @@ import android.os.IBinder; import android.support.v4.app.NotificationCompat; import org.briarproject.R; -import org.briarproject.api.android.PlatformExecutor; +import org.briarproject.android.api.AndroidExecutor; import org.briarproject.api.db.DatabaseConfig; import org.briarproject.api.lifecycle.LifecycleManager; import org.briarproject.api.lifecycle.LifecycleManager.StartResult; @@ -48,7 +48,7 @@ public class BriarService extends Service { // Fields that are accessed from background threads must be volatile @Inject protected volatile LifecycleManager lifecycleManager; - @Inject protected volatile PlatformExecutor platformExecutor; + @Inject protected volatile AndroidExecutor androidExecutor; private volatile boolean started = false; @Override @@ -106,7 +106,7 @@ public class BriarService extends Service { } private void showStartupFailureNotification(final StartResult result) { - platformExecutor.execute(new Runnable() { + androidExecutor.execute(new Runnable() { public void run() { NotificationCompat.Builder b = new NotificationCompat.Builder(BriarService.this); diff --git a/briar-android/src/org/briarproject/android/NavDrawerActivity.java b/briar-android/src/org/briarproject/android/NavDrawerActivity.java index 8342c58379fa82d199390e0837a13b23a3e7e090..d3d45e61ed4ef14b6a9f2e9695a81ddacc2f0f90 100644 --- a/briar-android/src/org/briarproject/android/NavDrawerActivity.java +++ b/briar-android/src/org/briarproject/android/NavDrawerActivity.java @@ -8,7 +8,6 @@ import android.os.Bundle; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; -import android.support.v7.widget.AppCompatButton; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.View; @@ -25,7 +24,7 @@ import org.briarproject.android.forum.ForumListFragment; import org.briarproject.android.fragment.BaseFragment; import org.briarproject.android.util.CustomAnimations; import org.briarproject.api.TransportId; -import org.briarproject.api.android.ReferenceManager; +import org.briarproject.android.api.ReferenceManager; import org.briarproject.api.db.DbException; import org.briarproject.api.event.Event; import org.briarproject.api.event.EventBus; diff --git a/briar-android/src/org/briarproject/android/ReferenceManagerImpl.java b/briar-android/src/org/briarproject/android/ReferenceManagerImpl.java index 7b1b96c2b1842e53f67c3edfc6904a9c033f8502..d5959a622e2988bf951643d3308e82b7e6a6d1ef 100644 --- a/briar-android/src/org/briarproject/android/ReferenceManagerImpl.java +++ b/briar-android/src/org/briarproject/android/ReferenceManagerImpl.java @@ -8,7 +8,7 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Logger; -import org.briarproject.api.android.ReferenceManager; +import org.briarproject.android.api.ReferenceManager; class ReferenceManagerImpl implements ReferenceManager { diff --git a/briar-android/src/org/briarproject/android/SetupActivity.java b/briar-android/src/org/briarproject/android/SetupActivity.java index 4aba12d0566c43ac94ba2564d9a03207e849b293..6caf20e5acbaf686aed94603143eb980750689df 100644 --- a/briar-android/src/org/briarproject/android/SetupActivity.java +++ b/briar-android/src/org/briarproject/android/SetupActivity.java @@ -17,7 +17,7 @@ import android.widget.TextView.OnEditorActionListener; import org.briarproject.R; import org.briarproject.android.util.AndroidUtils; import org.briarproject.android.util.StrengthMeter; -import org.briarproject.api.android.ReferenceManager; +import org.briarproject.android.api.ReferenceManager; import org.briarproject.api.crypto.CryptoComponent; import org.briarproject.api.crypto.CryptoExecutor; import org.briarproject.api.crypto.KeyPair; diff --git a/briar-android/src/org/briarproject/android/SplashScreenActivity.java b/briar-android/src/org/briarproject/android/SplashScreenActivity.java index acc0652af68e218b0ebca6895a59d05a1031ce48..b79e605e1f38f6e4f6c8a1c091048677e70e9426 100644 --- a/briar-android/src/org/briarproject/android/SplashScreenActivity.java +++ b/briar-android/src/org/briarproject/android/SplashScreenActivity.java @@ -8,11 +8,11 @@ import android.os.StrictMode; import android.os.StrictMode.ThreadPolicy; import android.os.StrictMode.VmPolicy; import android.support.v7.preference.PreferenceManager; -import android.util.Log; import android.widget.ImageView; import android.widget.LinearLayout; import org.briarproject.R; +import org.briarproject.android.util.AndroidUtils; import org.briarproject.android.util.LayoutUtils; import org.briarproject.api.db.DatabaseConfig; import org.briarproject.util.FileUtils; @@ -91,6 +91,7 @@ public class SplashScreenActivity extends BaseActivity { startActivity(new Intent(this, NavDrawerActivity.class)); } else { clearSharedPrefs(); + AndroidUtils.deleteAppData(this); FileUtils.deleteFileOrDir( dbConfig.getDatabaseDirectory()); startActivity(new Intent(this, SetupActivity.class)); diff --git a/briar-api/src/org/briarproject/api/android/PlatformExecutor.java b/briar-android/src/org/briarproject/android/api/AndroidExecutor.java similarity index 85% rename from briar-api/src/org/briarproject/api/android/PlatformExecutor.java rename to briar-android/src/org/briarproject/android/api/AndroidExecutor.java index 4cd309374f6dbe3724c05eb939cde7044ea246fb..5ed8ef0f89e9d19ce60bd932e4e91bc3cac91157 100644 --- a/briar-api/src/org/briarproject/api/android/PlatformExecutor.java +++ b/briar-android/src/org/briarproject/android/api/AndroidExecutor.java @@ -1,4 +1,4 @@ -package org.briarproject.api.android; +package org.briarproject.android.api; import java.util.concurrent.Callable; import java.util.concurrent.Future; @@ -7,7 +7,7 @@ import java.util.concurrent.Future; * Enables background threads to make Android API calls that must be made from * a thread with a message queue. */ -public interface PlatformExecutor { +public interface AndroidExecutor { /** * Runs the given task on the main UI thread and returns a Future for diff --git a/briar-api/src/org/briarproject/api/android/AndroidNotificationManager.java b/briar-android/src/org/briarproject/android/api/AndroidNotificationManager.java similarity index 91% rename from briar-api/src/org/briarproject/api/android/AndroidNotificationManager.java rename to briar-android/src/org/briarproject/android/api/AndroidNotificationManager.java index 3aad189dc32c3b404fa8cf1ba695c8e55e2acebd..33177e1b8c42aee32ca58196a75a175cbed64c46 100644 --- a/briar-api/src/org/briarproject/api/android/AndroidNotificationManager.java +++ b/briar-android/src/org/briarproject/android/api/AndroidNotificationManager.java @@ -1,4 +1,4 @@ -package org.briarproject.api.android; +package org.briarproject.android.api; import org.briarproject.api.sync.GroupId; diff --git a/briar-api/src/org/briarproject/api/android/ReferenceManager.java b/briar-android/src/org/briarproject/android/api/ReferenceManager.java similarity index 95% rename from briar-api/src/org/briarproject/api/android/ReferenceManager.java rename to briar-android/src/org/briarproject/android/api/ReferenceManager.java index 2366d9e1cdafebae0967b3bc7ffedfd8413c76fd..8f1cd93b017b07363c530b2de7be5e6b4ff2f35f 100644 --- a/briar-api/src/org/briarproject/api/android/ReferenceManager.java +++ b/briar-android/src/org/briarproject/android/api/ReferenceManager.java @@ -1,4 +1,4 @@ -package org.briarproject.api.android; +package org.briarproject.android.api; /** * Manages mappings between object references and serialisable handles. This diff --git a/briar-android/src/org/briarproject/android/contact/ConversationActivity.java b/briar-android/src/org/briarproject/android/contact/ConversationActivity.java index 4555d8c9d1af22aca69ecac90153804c6f09c35e..45ebe6eab9dbbe9bf053731d975763393f8f7658 100644 --- a/briar-android/src/org/briarproject/android/contact/ConversationActivity.java +++ b/briar-android/src/org/briarproject/android/contact/ConversationActivity.java @@ -21,11 +21,10 @@ import org.briarproject.android.AndroidComponent; import org.briarproject.android.BriarActivity; import org.briarproject.android.util.BriarRecyclerView; import org.briarproject.api.FormatException; -import org.briarproject.api.android.AndroidNotificationManager; +import org.briarproject.android.api.AndroidNotificationManager; import org.briarproject.api.contact.Contact; import org.briarproject.api.contact.ContactId; import org.briarproject.api.contact.ContactManager; -import org.briarproject.api.crypto.CryptoComponent; import org.briarproject.api.crypto.CryptoExecutor; import org.briarproject.api.db.DbException; import org.briarproject.api.db.NoSuchContactException; diff --git a/briar-android/src/org/briarproject/android/forum/ForumActivity.java b/briar-android/src/org/briarproject/android/forum/ForumActivity.java index 96add7ce47acf2c6fe44206298579eaecabd545d..6b6fcea0496c1f9859a289cbbb3e96490cdd42f6 100644 --- a/briar-android/src/org/briarproject/android/forum/ForumActivity.java +++ b/briar-android/src/org/briarproject/android/forum/ForumActivity.java @@ -18,7 +18,7 @@ import org.briarproject.android.BriarActivity; import org.briarproject.android.util.ElasticHorizontalSpace; import org.briarproject.android.util.HorizontalBorder; import org.briarproject.android.util.ListLoadingProgressBar; -import org.briarproject.api.android.AndroidNotificationManager; +import org.briarproject.android.api.AndroidNotificationManager; import org.briarproject.api.db.DbException; import org.briarproject.api.db.NoSuchGroupException; import org.briarproject.api.db.NoSuchMessageException; diff --git a/briar-android/src/org/briarproject/android/invitation/AddContactActivity.java b/briar-android/src/org/briarproject/android/invitation/AddContactActivity.java index 39f2b578ebef2f12134d7b5e0d07a44c39f01eb8..1d8b12fe0ac12217cae7d09a7eaafa7b90d5bf0a 100644 --- a/briar-android/src/org/briarproject/android/invitation/AddContactActivity.java +++ b/briar-android/src/org/briarproject/android/invitation/AddContactActivity.java @@ -7,7 +7,7 @@ import android.widget.Toast; import org.briarproject.R; import org.briarproject.android.AndroidComponent; import org.briarproject.android.BriarActivity; -import org.briarproject.api.android.ReferenceManager; +import org.briarproject.android.api.ReferenceManager; import org.briarproject.api.crypto.CryptoComponent; import org.briarproject.api.db.DbException; import org.briarproject.api.identity.AuthorId; diff --git a/briar-android/src/org/briarproject/android/panic/PanicResponderActivity.java b/briar-android/src/org/briarproject/android/panic/PanicResponderActivity.java index 5e71c113fe187e24604878d259fc90010fead9e2..29f271f0e4113f82d950aea02b0e63aed166b247 100644 --- a/briar-android/src/org/briarproject/android/panic/PanicResponderActivity.java +++ b/briar-android/src/org/briarproject/android/panic/PanicResponderActivity.java @@ -9,6 +9,7 @@ import android.support.v7.preference.PreferenceManager; import org.briarproject.android.AndroidComponent; import org.briarproject.android.BriarActivity; +import org.briarproject.android.util.AndroidUtils; import org.briarproject.api.db.DatabaseConfig; import org.briarproject.util.FileUtils; import org.iilab.IilabEngineeringRSA2048Pin; @@ -111,9 +112,7 @@ public class PanicResponderActivity extends BriarActivity { public void run() { clearSharedPrefs(); // TODO somehow delete/shred the database more thoroughly - FileUtils - .deleteFileOrDir( - databaseConfig.getDatabaseDirectory()); + AndroidUtils.deleteAppData(PanicResponderActivity.this); PanicResponder.deleteAllAppData(PanicResponderActivity.this); // nothing left to do after everything is deleted, diff --git a/briar-android/src/org/briarproject/plugins/AndroidPluginsModule.java b/briar-android/src/org/briarproject/plugins/AndroidPluginsModule.java new file mode 100644 index 0000000000000000000000000000000000000000..7718122f011489613a21bba5d61a3717aace09f7 --- /dev/null +++ b/briar-android/src/org/briarproject/plugins/AndroidPluginsModule.java @@ -0,0 +1,61 @@ +package org.briarproject.plugins; + +import android.app.Application; +import android.content.Context; + +import org.briarproject.android.api.AndroidExecutor; +import org.briarproject.api.event.EventBus; +import org.briarproject.api.lifecycle.IoExecutor; +import org.briarproject.api.plugins.BackoffFactory; +import org.briarproject.api.plugins.duplex.DuplexPluginConfig; +import org.briarproject.api.plugins.duplex.DuplexPluginFactory; +import org.briarproject.api.plugins.simplex.SimplexPluginConfig; +import org.briarproject.api.plugins.simplex.SimplexPluginFactory; +import org.briarproject.api.system.LocationUtils; +import org.briarproject.plugins.droidtooth.DroidtoothPluginFactory; +import org.briarproject.plugins.tcp.AndroidLanTcpPluginFactory; +import org.briarproject.plugins.tor.TorPluginFactory; + +import java.security.SecureRandom; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.concurrent.Executor; + +import dagger.Module; +import dagger.Provides; + +@Module +public class AndroidPluginsModule { + + @Provides + SimplexPluginConfig provideSimplexPluginConfig() { + return new SimplexPluginConfig() { + public Collection<SimplexPluginFactory> getFactories() { + return Collections.emptyList(); + } + }; + } + + @Provides + public DuplexPluginConfig provideDuplexPluginConfig( + @IoExecutor Executor ioExecutor, AndroidExecutor androidExecutor, + SecureRandom random, BackoffFactory backoffFactory, Application app, + LocationUtils locationUtils, EventBus eventBus) { + Context appContext = app.getApplicationContext(); + DuplexPluginFactory bluetooth = new DroidtoothPluginFactory(ioExecutor, + androidExecutor, appContext, random, backoffFactory); + DuplexPluginFactory tor = new TorPluginFactory(ioExecutor, appContext, + locationUtils, eventBus); + DuplexPluginFactory lan = new AndroidLanTcpPluginFactory(ioExecutor, + backoffFactory, appContext); + final Collection<DuplexPluginFactory> factories = + Arrays.asList(bluetooth, tor, lan); + return new DuplexPluginConfig() { + public Collection<DuplexPluginFactory> getFactories() { + return factories; + } + }; + } + +} diff --git a/briar-android/src/org/briarproject/plugins/PluginsModuleExtension.java b/briar-android/src/org/briarproject/plugins/PluginsModuleExtension.java index b2b408f8d6f44c1f0c43200511b8e3f872051280..14a55180c8fc63ca6f8340ed52bef3c44ef36caf 100644 --- a/briar-android/src/org/briarproject/plugins/PluginsModuleExtension.java +++ b/briar-android/src/org/briarproject/plugins/PluginsModuleExtension.java @@ -1,50 +1,33 @@ package org.briarproject.plugins; -import android.app.Application; -import android.content.Context; - -import org.briarproject.api.android.PlatformExecutor; -import org.briarproject.api.event.EventBus; -import org.briarproject.api.lifecycle.IoExecutor; -import org.briarproject.api.plugins.BackoffFactory; -import org.briarproject.api.plugins.duplex.DuplexPluginConfig; -import org.briarproject.api.plugins.duplex.DuplexPluginFactory; -import org.briarproject.api.system.LocationUtils; -import org.briarproject.plugins.droidtooth.DroidtoothPluginFactory; -import org.briarproject.plugins.tcp.AndroidLanTcpPluginFactory; -import org.briarproject.plugins.tor.TorPluginFactory; - -import java.security.SecureRandom; -import java.util.Arrays; -import java.util.Collection; -import java.util.concurrent.Executor; - public class PluginsModuleExtension extends PluginsModule { - private final Application app; +// @Inject @Named("AndroidDuplexPluginConfig") +// DuplexPluginConfig duplexPluginConfig; + + public PluginsModuleExtension() { - public PluginsModuleExtension(Application app) { - this.app = app; } +// @Override +// SimplexPluginConfig provideSimplexPluginConfig() { +// return new SimplexPluginConfig() { +// public Collection<SimplexPluginFactory> getFactories() { +// return Collections.emptyList(); +// } +// }; +// } + +/* @Override public DuplexPluginConfig provideDuplexPluginConfig( - @IoExecutor Executor ioExecutor, PlatformExecutor platformExecutor, + @IoExecutor Executor ioExecutor, AndroidExecutor androidExecutor, SecureRandom random, BackoffFactory backoffFactory, LocationUtils locationUtils, EventBus eventBus) { - Context appContext = app.getApplicationContext(); - DuplexPluginFactory bluetooth = new DroidtoothPluginFactory(ioExecutor, - platformExecutor, appContext, random, backoffFactory); - DuplexPluginFactory tor = new TorPluginFactory(ioExecutor, appContext, - locationUtils, eventBus); - DuplexPluginFactory lan = new AndroidLanTcpPluginFactory(ioExecutor, - backoffFactory, appContext); - final Collection<DuplexPluginFactory> factories = - Arrays.asList(bluetooth, tor, lan); - return new DuplexPluginConfig() { - public Collection<DuplexPluginFactory> getFactories() { - return factories; - } - }; - } +// return duplexPluginConfig; +// @Inject @Named("AndroidDuplexPluginConfig") +// DuplexPluginConfig andoridDuplexPlugin; +// return andoridDuplexPlugin; +// } +*/ } diff --git a/briar-android/src/org/briarproject/plugins/droidtooth/DroidtoothPlugin.java b/briar-android/src/org/briarproject/plugins/droidtooth/DroidtoothPlugin.java index 325a49d74f430d28cb733742b27525b38372fdf5..2bc7dbe702d2ddbeba33e540373dd5345a46d398 100644 --- a/briar-android/src/org/briarproject/plugins/droidtooth/DroidtoothPlugin.java +++ b/briar-android/src/org/briarproject/plugins/droidtooth/DroidtoothPlugin.java @@ -11,7 +11,7 @@ import android.content.IntentFilter; import org.briarproject.android.util.AndroidUtils; import org.briarproject.api.TransportId; -import org.briarproject.api.android.AndroidExecutor; +import org.briarproject.android.api.AndroidExecutor; import org.briarproject.api.contact.ContactId; import org.briarproject.api.crypto.PseudoRandom; import org.briarproject.api.plugins.Backoff; diff --git a/briar-android/src/org/briarproject/plugins/droidtooth/DroidtoothPluginFactory.java b/briar-android/src/org/briarproject/plugins/droidtooth/DroidtoothPluginFactory.java index db89929a2282a62e493f0872218c8e9df4ee5143..229aba22722481cbb67b91e49a1aa6fcd3c66d39 100644 --- a/briar-android/src/org/briarproject/plugins/droidtooth/DroidtoothPluginFactory.java +++ b/briar-android/src/org/briarproject/plugins/droidtooth/DroidtoothPluginFactory.java @@ -3,7 +3,7 @@ package org.briarproject.plugins.droidtooth; import android.content.Context; import org.briarproject.api.TransportId; -import org.briarproject.api.android.AndroidExecutor; +import org.briarproject.android.api.AndroidExecutor; import org.briarproject.api.plugins.Backoff; import org.briarproject.api.plugins.BackoffFactory; import org.briarproject.api.plugins.duplex.DuplexPlugin; diff --git a/briar-android/src/org/briarproject/system/AndroidExecutorImpl.java b/briar-android/src/org/briarproject/system/AndroidExecutorImpl.java index b119fb8c7babd63ab09f258517486b7988836775..0b9674c25274f1f7341f00b8d683374522ebf949 100644 --- a/briar-android/src/org/briarproject/system/AndroidExecutorImpl.java +++ b/briar-android/src/org/briarproject/system/AndroidExecutorImpl.java @@ -6,15 +6,13 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; -import org.briarproject.api.android.PlatformExecutor; +import org.briarproject.android.api.AndroidExecutor; import java.util.concurrent.Callable; import java.util.concurrent.Future; import java.util.concurrent.FutureTask; -import javax.inject.Inject; - -class AndroidExecutorImpl implements PlatformExecutor { +class AndroidExecutorImpl implements AndroidExecutor { private final Handler handler; diff --git a/briar-android/src/org/briarproject/system/AndroidSystemModule.java b/briar-android/src/org/briarproject/system/AndroidSystemModule.java new file mode 100644 index 0000000000000000000000000000000000000000..74e39e06af0bd375d43098fbedc3c5bf295711b5 --- /dev/null +++ b/briar-android/src/org/briarproject/system/AndroidSystemModule.java @@ -0,0 +1,29 @@ +package org.briarproject.system; + +import android.app.Application; + +import org.briarproject.android.api.AndroidExecutor; +import org.briarproject.api.system.LocationUtils; +import org.briarproject.api.system.SeedProvider; + +import dagger.Module; +import dagger.Provides; + +@Module +public class AndroidSystemModule { + + @Provides + public SeedProvider provideSeedProvider(Application app) { + return new AndroidSeedProvider(app); + } + + @Provides + public LocationUtils provideLocationUtils(Application app) { + return new AndroidLocationUtils(app); + } + + @Provides + public AndroidExecutor providePlatformExecutor(Application app) { + return new AndroidExecutorImpl(app); + } +} diff --git a/briar-android/src/org/briarproject/system/PlatformModuleExtension.java b/briar-android/src/org/briarproject/system/PlatformModuleExtension.java deleted file mode 100644 index dc2ae6a4ac61fc66c24ba56af98e1daed614865c..0000000000000000000000000000000000000000 --- a/briar-android/src/org/briarproject/system/PlatformModuleExtension.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.briarproject.system; - -import android.app.Application; -import android.content.Context; - -import org.briarproject.PlatformModule; -import org.briarproject.android.ApplicationScope; -import org.briarproject.api.android.PlatformExecutor; -import org.briarproject.api.crypto.SecretKey; -import org.briarproject.api.db.DatabaseConfig; -import org.briarproject.api.ui.UiCallback; - -import java.io.File; - -public class PlatformModuleExtension extends PlatformModule { - - private final UiCallback uiCallback; - private final Application app; - - public PlatformModuleExtension(Application app) { - this.app = app; - // Use a dummy UI callback - uiCallback = new UiCallback() { - - public int showChoice(String[] options, String... message) { - throw new UnsupportedOperationException(); - } - - public boolean showConfirmationMessage(String... message) { - throw new UnsupportedOperationException(); - } - - public void showMessage(String... message) { - throw new UnsupportedOperationException(); - } - }; - } - - @Override - public UiCallback provideUICallback() { - return uiCallback; - } - - @Override - @ApplicationScope - public DatabaseConfig provideDatabaseConfig() { - final File dir = app.getApplicationContext().getDir("db", Context.MODE_PRIVATE); - return new DatabaseConfig() { - - private volatile SecretKey key = null; - - public boolean databaseExists() { - return dir.isDirectory() && dir.listFiles().length > 0; - } - - public File getDatabaseDirectory() { - return dir; - } - - public void setEncryptionKey(SecretKey key) { - this.key = key; - } - - public SecretKey getEncryptionKey() { - return key; - } - - public long getMaxSize() { - return Long.MAX_VALUE; - } - }; - } - - @Override - public PlatformExecutor providePlatformExecutor() { - return new AndroidExecutorImpl(app); - } -} diff --git a/briar-android/src/org/briarproject/system/SystemModuleExtension.java b/briar-android/src/org/briarproject/system/SystemModuleExtension.java deleted file mode 100644 index 72ea338b4442a44f0327bc1e943aaa6e42c6e39e..0000000000000000000000000000000000000000 --- a/briar-android/src/org/briarproject/system/SystemModuleExtension.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.briarproject.system; - - -import android.app.Application; - -import org.briarproject.api.system.Clock; -import org.briarproject.api.system.LocationUtils; -import org.briarproject.api.system.SeedProvider; -import org.briarproject.api.system.Timer; - -import dagger.Module; -import dagger.Provides; - -public class SystemModuleExtension extends SystemModule { - - private final Application app; - - public SystemModuleExtension(final Application app) { - this.app = app; - } - - @Override - public SeedProvider provideSeedProvider() { - return new AndroidSeedProvider(app); - } - - @Override - public LocationUtils provideLocationUtils() { - return new AndroidLocationUtils(app); - } - -} diff --git a/briar-core/src/org/briarproject/CoreComponent.java b/briar-core/src/org/briarproject/CoreComponent.java deleted file mode 100644 index 9f7c41df040b7f9a0303f469f4c9262e7c072dac..0000000000000000000000000000000000000000 --- a/briar-core/src/org/briarproject/CoreComponent.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.briarproject; - -import org.briarproject.api.android.PlatformExecutor; -import org.briarproject.api.android.ReferenceManager; -import org.briarproject.api.contact.ContactManager; -import org.briarproject.api.crypto.CryptoComponent; -import org.briarproject.api.crypto.CryptoExecutor; -import org.briarproject.api.crypto.PasswordStrengthEstimator; -import org.briarproject.api.db.DatabaseConfig; -import org.briarproject.api.db.DatabaseExecutor; -import org.briarproject.api.event.EventBus; -import org.briarproject.api.forum.ForumManager; -import org.briarproject.api.forum.ForumPostFactory; -import org.briarproject.api.forum.ForumSharingManager; -import org.briarproject.api.identity.AuthorFactory; -import org.briarproject.api.identity.IdentityManager; -import org.briarproject.api.invitation.InvitationTaskFactory; -import org.briarproject.api.lifecycle.IoExecutor; -import org.briarproject.api.lifecycle.LifecycleManager; -import org.briarproject.api.messaging.MessagingManager; -import org.briarproject.api.messaging.PrivateMessageFactory; -import org.briarproject.api.plugins.ConnectionRegistry; -import org.briarproject.api.plugins.PluginManager; -import org.briarproject.api.properties.TransportPropertyManager; -import org.briarproject.api.settings.SettingsManager; -import org.briarproject.api.sync.ValidationManager; -import org.briarproject.api.transport.KeyManager; -import org.briarproject.clients.ClientsModule; -import org.briarproject.contact.ContactModule; -import org.briarproject.crypto.CryptoModule; -import org.briarproject.data.DataModule; -import org.briarproject.db.DatabaseModule; -import org.briarproject.event.EventModule; -import org.briarproject.forum.ForumModule; -import org.briarproject.identity.IdentityModule; -import org.briarproject.invitation.InvitationModule; -import org.briarproject.lifecycle.LifecycleModule; -import org.briarproject.messaging.MessagingModule; -import org.briarproject.messaging.PrivateMessageValidator; -import org.briarproject.plugins.PluginsModule; -import org.briarproject.properties.PropertiesModule; -import org.briarproject.properties.TransportPropertyValidator; -import org.briarproject.reliability.ReliabilityModule; -import org.briarproject.settings.SettingsModule; -import org.briarproject.sync.SyncModule; -import org.briarproject.system.SystemModule; -import org.briarproject.transport.TransportModule; - -import java.util.concurrent.Executor; - -import javax.inject.Singleton; - -import dagger.Component; - -@Singleton -@Component(modules = {DatabaseModule.class, - CryptoModule.class, LifecycleModule.class, PlatformModule.class, - ReliabilityModule.class, MessagingModule.class, - InvitationModule.class, ForumModule.class, IdentityModule.class, - EventModule.class, DataModule.class, ContactModule.class, - PropertiesModule.class, TransportModule.class, SyncModule.class, - SettingsModule.class, ClientsModule.class, SystemModule.class, - PluginsModule.class}) -public interface CoreComponent { - @IoExecutor - Executor ioExecutor(); - ContactManager contactManager(); - @CryptoExecutor Executor cryptoExecutor(); - DatabaseConfig databaseConfig(); - PasswordStrengthEstimator passwordStrengthEstimator(); - CryptoComponent cryptoComponent(); - @DatabaseExecutor Executor dbExecutor(); - LifecycleManager lifecycleManager(); - AuthorFactory authFactory(); - EventBus eventBus(); - KeyManager keyManager(); - ValidationManager validationManager(); - ForumManager forumManager(); - IdentityManager identityManager(); - PluginManager pluginManager(); - SettingsManager settingsManater(); - InvitationTaskFactory invitationTaskFactory(); - MessagingManager messagingManager(); - TransportPropertyManager transportPropertyManager(); - ConnectionRegistry connectionRegistry(); - ForumSharingManager forumSharingManager(); - PrivateMessageFactory privateMessageFactory(); - ForumPostFactory forumPostFactory(); - PrivateMessageValidator privateMessageValidator(); - TransportPropertyValidator transportPropertyValidator(); - PlatformExecutor platformExecutor(); - // Eager singletons - void inject(ContactModule.EagerSingletons init); - void inject(CryptoModule.EagerSingletons init); - void inject(DatabaseModule.EagerSingletons init); - void inject(ForumModule.EagerSingletons init); - void inject(LifecycleModule.EagerSingletons init); - void inject(MessagingModule.EagerSingletons init); - void inject(PluginsModule.EagerSingletons init); - void inject(PropertiesModule.EagerSingletons init); - void inject(SyncModule.EagerSingletons init); - void inject(TransportModule.EagerSingletons init); -} diff --git a/briar-core/src/org/briarproject/CoreEagerSingletons.java b/briar-core/src/org/briarproject/CoreEagerSingletons.java index 8637f710651054d6abb9dd1683d06f7fd8da584a..00d46b1da768305a8b0cf484befdb60015a1bf58 100644 --- a/briar-core/src/org/briarproject/CoreEagerSingletons.java +++ b/briar-core/src/org/briarproject/CoreEagerSingletons.java @@ -11,18 +11,16 @@ import org.briarproject.properties.PropertiesModule; import org.briarproject.sync.SyncModule; import org.briarproject.transport.TransportModule; -public class CoreEagerSingletons { +public interface CoreEagerSingletons { + void inject(ContactModule.EagerSingletons init); + void inject(CryptoModule.EagerSingletons init); + void inject(DatabaseModule.EagerSingletons init); + void inject(ForumModule.EagerSingletons init); + void inject(LifecycleModule.EagerSingletons init); + void inject(MessagingModule.EagerSingletons init); + void inject(PluginsModule.EagerSingletons init); + void inject(PropertiesModule.EagerSingletons init); + void inject(SyncModule.EagerSingletons init); + void inject(TransportModule.EagerSingletons init); - public static void initEagerSingletons(CoreComponent c) { - c.inject(new ContactModule.EagerSingletons()); - c.inject(new CryptoModule.EagerSingletons()); - c.inject(new DatabaseModule.EagerSingletons()); - c.inject(new ForumModule.EagerSingletons()); - c.inject(new LifecycleModule.EagerSingletons()); - c.inject(new MessagingModule.EagerSingletons()); - c.inject(new PluginsModule.EagerSingletons()); - c.inject(new PropertiesModule.EagerSingletons()); - c.inject(new SyncModule.EagerSingletons()); - c.inject(new TransportModule.EagerSingletons()); - } } diff --git a/briar-core/src/org/briarproject/CoreModule.java b/briar-core/src/org/briarproject/CoreModule.java new file mode 100644 index 0000000000000000000000000000000000000000..11d6c87b0ac55d85e9a16c3e2de12a872c8b41d4 --- /dev/null +++ b/briar-core/src/org/briarproject/CoreModule.java @@ -0,0 +1,45 @@ +package org.briarproject; + +import org.briarproject.clients.ClientsModule; +import org.briarproject.contact.ContactModule; +import org.briarproject.crypto.CryptoModule; +import org.briarproject.data.DataModule; +import org.briarproject.db.DatabaseModule; +import org.briarproject.event.EventModule; +import org.briarproject.forum.ForumModule; +import org.briarproject.identity.IdentityModule; +import org.briarproject.invitation.InvitationModule; +import org.briarproject.lifecycle.LifecycleModule; +import org.briarproject.messaging.MessagingModule; +import org.briarproject.plugins.PluginsModule; +import org.briarproject.properties.PropertiesModule; +import org.briarproject.reliability.ReliabilityModule; +import org.briarproject.settings.SettingsModule; +import org.briarproject.sync.SyncModule; +import org.briarproject.system.SystemModule; +import org.briarproject.transport.TransportModule; + +import dagger.Module; + +@Module(includes = {DatabaseModule.class, + CryptoModule.class, LifecycleModule.class, ReliabilityModule.class, + MessagingModule.class, InvitationModule.class, ForumModule.class, + IdentityModule.class, EventModule.class, DataModule.class, + ContactModule.class, PropertiesModule.class, TransportModule.class, + SyncModule.class, SettingsModule.class, ClientsModule.class, + SystemModule.class, PluginsModule.class}) +public class CoreModule { + + public static void initEagerSingletons(CoreEagerSingletons c) { + c.inject(new ContactModule.EagerSingletons()); + c.inject(new CryptoModule.EagerSingletons()); + c.inject(new DatabaseModule.EagerSingletons()); + c.inject(new ForumModule.EagerSingletons()); + c.inject(new LifecycleModule.EagerSingletons()); + c.inject(new MessagingModule.EagerSingletons()); + c.inject(new PluginsModule.EagerSingletons()); + c.inject(new PropertiesModule.EagerSingletons()); + c.inject(new SyncModule.EagerSingletons()); + c.inject(new TransportModule.EagerSingletons()); + } +} diff --git a/briar-core/src/org/briarproject/PlatformModule.java b/briar-core/src/org/briarproject/PlatformModule.java deleted file mode 100644 index c4242048a57a09ad477b3f0fc628e2e7d1419e58..0000000000000000000000000000000000000000 --- a/briar-core/src/org/briarproject/PlatformModule.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.briarproject; - -import org.briarproject.api.android.PlatformExecutor; -import org.briarproject.api.db.DatabaseConfig; -import org.briarproject.api.ui.UiCallback; - -import javax.inject.Singleton; - -import dagger.Module; -import dagger.Provides; - -/** - * This class contains methods that MUST(!) be overridden in platform specific - * modules that use the core. - */ -@Module -public class PlatformModule { - - @Provides - @Singleton - public DatabaseConfig provideDatabaseConfig() { - return null; - } - - @Provides - public UiCallback provideUICallback() { - return null; - } - - - @Provides - public PlatformExecutor providePlatformExecutor() { - return null; - } - -} diff --git a/briar-core/src/org/briarproject/plugins/PluginsModule.java b/briar-core/src/org/briarproject/plugins/PluginsModule.java index 0d523c34895ec2ccc1a08cfd8561fb9fea0f8fc3..afdb970df2402e2c76777b9644a23cf8b439c80d 100644 --- a/briar-core/src/org/briarproject/plugins/PluginsModule.java +++ b/briar-core/src/org/briarproject/plugins/PluginsModule.java @@ -3,7 +3,6 @@ package org.briarproject.plugins; import javax.inject.Inject; import javax.inject.Singleton; -import org.briarproject.api.android.PlatformExecutor; import org.briarproject.api.event.EventBus; import org.briarproject.api.lifecycle.IoExecutor; import org.briarproject.api.lifecycle.LifecycleManager; @@ -11,19 +10,13 @@ import org.briarproject.api.plugins.BackoffFactory; import org.briarproject.api.plugins.ConnectionManager; import org.briarproject.api.plugins.ConnectionRegistry; import org.briarproject.api.plugins.PluginManager; -import org.briarproject.api.plugins.duplex.DuplexPluginConfig; -import org.briarproject.api.plugins.simplex.SimplexPluginConfig; -import org.briarproject.api.plugins.simplex.SimplexPluginFactory; import org.briarproject.api.sync.SyncSessionFactory; -import org.briarproject.api.system.LocationUtils; import org.briarproject.api.system.Timer; import org.briarproject.api.transport.KeyManager; import org.briarproject.api.transport.StreamReaderFactory; import org.briarproject.api.transport.StreamWriterFactory; import java.security.SecureRandom; -import java.util.Collection; -import java.util.Collections; import java.util.concurrent.Executor; import dagger.Module; @@ -68,6 +61,7 @@ public class PluginsModule { return new ConnectionRegistryImpl(eventBus); } + @Provides @Singleton PluginManager getPluginManager(LifecycleManager lifecycleManager, @@ -75,21 +69,15 @@ public class PluginsModule { lifecycleManager.register(pluginManager); return pluginManager; } - +/* @Provides SimplexPluginConfig provideSimplexPluginConfig() { - return new SimplexPluginConfig() { - public Collection<SimplexPluginFactory> getFactories() { - return Collections.emptyList(); - } - }; + return null; } @Provides - public DuplexPluginConfig provideDuplexPluginConfig(@IoExecutor Executor ioExecutor, - PlatformExecutor platformExecutor, /*Application app,*/ - SecureRandom random, BackoffFactory backoffFactory, - LocationUtils locationUtils, EventBus eventBus) { + public DuplexPluginConfig provideDuplexPluginConfig() { return null; } + */ } diff --git a/briar-core/src/org/briarproject/system/SystemModule.java b/briar-core/src/org/briarproject/system/SystemModule.java index 8a2304e2eacada63cb616384a89caab3f43c5c88..eb2a0d88d28e3bb95608b0bf8794ba74e40d8b2f 100644 --- a/briar-core/src/org/briarproject/system/SystemModule.java +++ b/briar-core/src/org/briarproject/system/SystemModule.java @@ -20,13 +20,4 @@ public class SystemModule { return new SystemTimer(); } - @Provides - public SeedProvider provideSeedProvider() { - return null; - } - - @Provides - public LocationUtils provideLocationUtils() { - return null; - } }