diff --git a/src/androidTest/java/com/owncloud/android/UploadIT.java b/src/androidTest/java/com/owncloud/android/UploadIT.java index 3513dbd903..b4866b2ab2 100644 --- a/src/androidTest/java/com/owncloud/android/UploadIT.java +++ b/src/androidTest/java/com/owncloud/android/UploadIT.java @@ -34,7 +34,7 @@ public class UploadIT extends AbstractIT { public void setUp() { final ContentResolver contentResolver = targetContext.getContentResolver(); final CurrentAccountProvider currentAccountProvider = () -> AccountUtils.getCurrentOwnCloudAccount(targetContext); - storageManager = new UploadsStorageManager(currentAccountProvider, contentResolver, targetContext); + storageManager = new UploadsStorageManager(currentAccountProvider, contentResolver); } @Test diff --git a/src/androidTest/java/com/owncloud/android/datamodel/UploadStorageManagerTest.java b/src/androidTest/java/com/owncloud/android/datamodel/UploadStorageManagerTest.java index 100a650b94..235a6c0893 100644 --- a/src/androidTest/java/com/owncloud/android/datamodel/UploadStorageManagerTest.java +++ b/src/androidTest/java/com/owncloud/android/datamodel/UploadStorageManagerTest.java @@ -15,7 +15,6 @@ import org.junit.runner.RunWith; import java.io.File; -import androidx.annotation.Nullable; import androidx.test.InstrumentationRegistry; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; @@ -36,7 +35,7 @@ public class UploadStorageManagerTest { public void setUp() { Context instrumentationCtx = InstrumentationRegistry.getTargetContext(); ContentResolver contentResolver = instrumentationCtx.getContentResolver(); - uploadsStorageManager = new UploadsStorageManager(currentAccountProvider, contentResolver, instrumentationCtx); + uploadsStorageManager = new UploadsStorageManager(currentAccountProvider, contentResolver); Accounts = new Account[]{new Account("A", "A"), new Account("B", "B")}; } diff --git a/src/main/java/com/nextcloud/client/account/UserAccountManagerImpl.java b/src/main/java/com/nextcloud/client/account/UserAccountManagerImpl.java index d4cc84d65a..c74148a5a6 100644 --- a/src/main/java/com/nextcloud/client/account/UserAccountManagerImpl.java +++ b/src/main/java/com/nextcloud/client/account/UserAccountManagerImpl.java @@ -44,7 +44,6 @@ import androidx.annotation.Nullable; public class UserAccountManagerImpl implements UserAccountManager { private static final String TAG = AccountUtils.class.getSimpleName(); - private static final String PREF_SELECT_OC_ACCOUNT = "select_oc_account"; private Context context; private AccountManager accountManager; diff --git a/src/main/java/com/nextcloud/client/di/AppModule.java b/src/main/java/com/nextcloud/client/di/AppModule.java index e1cd2abf6c..7e72a1be03 100644 --- a/src/main/java/com/nextcloud/client/di/AppModule.java +++ b/src/main/java/com/nextcloud/client/di/AppModule.java @@ -90,8 +90,10 @@ class AppModule { return new RemoteFilesRepository(new FilesServiceApiImpl(accountManager)); } - @Provides UploadsStorageManager uploadsStorageManager(Context context, CurrentAccountProvider currentAccountProvider) { - return new UploadsStorageManager(currentAccountProvider, context.getContentResolver(), context); + @Provides + UploadsStorageManager uploadsStorageManager(Context context, + CurrentAccountProvider currentAccountProvider) { + return new UploadsStorageManager(currentAccountProvider, context.getContentResolver()); } @Provides CurrentAccountProvider currentAccountProvider(UserAccountManager accountManager) { diff --git a/src/main/java/com/owncloud/android/MainApp.java b/src/main/java/com/owncloud/android/MainApp.java index c54db07e16..a470a768ad 100644 --- a/src/main/java/com/owncloud/android/MainApp.java +++ b/src/main/java/com/owncloud/android/MainApp.java @@ -120,13 +120,6 @@ public class MainApp extends MultiDexApplication implements private static final String TAG = MainApp.class.getSimpleName(); - private static final String AUTH_ON = "on"; - - @SuppressWarnings("unused") - private static final String POLICY_SINGLE_SESSION_PER_ACCOUNT = "single session per account"; - @SuppressWarnings("unused") - private static final String POLICY_ALWAYS_NEW_CLIENT = "always new client"; - private static Context mContext; private static String storagePath; diff --git a/src/main/java/com/owncloud/android/authentication/AccountUtils.java b/src/main/java/com/owncloud/android/authentication/AccountUtils.java index 893157f51b..d01a81595b 100644 --- a/src/main/java/com/owncloud/android/authentication/AccountUtils.java +++ b/src/main/java/com/owncloud/android/authentication/AccountUtils.java @@ -23,22 +23,14 @@ import android.accounts.Account; import android.accounts.AccountManager; import android.content.Context; import android.content.SharedPreferences; -import android.net.Uri; import android.preference.PreferenceManager; import android.text.TextUtils; import com.owncloud.android.MainApp; import com.owncloud.android.datamodel.ArbitraryDataProvider; import com.owncloud.android.datamodel.OCFile; -import com.owncloud.android.lib.common.OwnCloudAccount; -import com.owncloud.android.lib.common.OwnCloudClient; -import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; -import com.owncloud.android.lib.common.UserInfo; import com.owncloud.android.lib.common.accounts.AccountUtils.Constants; -import com.owncloud.android.lib.common.operations.RemoteOperationResult; -import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.resources.status.OwnCloudVersion; -import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation; import com.owncloud.android.ui.activity.ManageAccountsActivity; import androidx.annotation.NonNull; @@ -48,7 +40,6 @@ import androidx.annotation.Nullable; * Helper class for dealing with accounts. */ public final class AccountUtils { - private static final String TAG = AccountUtils.class.getSimpleName(); private static final String PREF_SELECT_OC_ACCOUNT = "select_oc_account"; public static final int ACCOUNT_VERSION = 1; diff --git a/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java index d59181c29b..658040abe4 100644 --- a/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -1859,19 +1859,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity public abstract boolean onDrawableTouch(final MotionEvent event); } - - private void getRemoteUserNameOperation(String sessionCookie) { - - Intent getUserNameIntent = new Intent(); - getUserNameIntent.setAction(OperationsService.ACTION_GET_USER_NAME); - getUserNameIntent.putExtra(OperationsService.EXTRA_SERVER_URL, mServerInfo.mBaseUrl); - getUserNameIntent.putExtra(OperationsService.EXTRA_COOKIE, sessionCookie); - - if (mOperationsServiceBinder != null) { - mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getUserNameIntent); - } - } - /** * Show untrusted cert dialog */ diff --git a/src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java b/src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java index e0ac1a26d2..d31313f378 100644 --- a/src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java +++ b/src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java @@ -26,7 +26,6 @@ package com.owncloud.android.datamodel; import android.accounts.Account; import android.content.ContentResolver; import android.content.ContentValues; -import android.content.Context; import android.database.Cursor; import android.net.Uri; @@ -55,19 +54,16 @@ public class UploadsStorageManager extends Observable { private static final int SINGLE_RESULT = 1; private ContentResolver mContentResolver; - private Context mContext; private CurrentAccountProvider currentAccountProvider; public UploadsStorageManager( CurrentAccountProvider currentAccountProvider, - ContentResolver contentResolver, - Context context + ContentResolver contentResolver ) { if (contentResolver == null) { throw new IllegalArgumentException("Cannot create an instance with a NULL contentResolver"); } mContentResolver = contentResolver; - mContext = context; this.currentAccountProvider = currentAccountProvider; } diff --git a/src/main/java/com/owncloud/android/jobs/OfflineSyncJob.java b/src/main/java/com/owncloud/android/jobs/OfflineSyncJob.java index 2e4487e4c1..c1a29b7108 100644 --- a/src/main/java/com/owncloud/android/jobs/OfflineSyncJob.java +++ b/src/main/java/com/owncloud/android/jobs/OfflineSyncJob.java @@ -32,7 +32,6 @@ import com.evernote.android.job.JobRequest; import com.evernote.android.job.util.Device; import com.nextcloud.client.account.UserAccountManager; import com.owncloud.android.MainApp; -import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.lib.common.operations.RemoteOperationResult; diff --git a/src/main/java/com/owncloud/android/providers/DiskLruImageCacheFileProvider.java b/src/main/java/com/owncloud/android/providers/DiskLruImageCacheFileProvider.java index 05456da254..0c17aeb4df 100644 --- a/src/main/java/com/owncloud/android/providers/DiskLruImageCacheFileProvider.java +++ b/src/main/java/com/owncloud/android/providers/DiskLruImageCacheFileProvider.java @@ -33,7 +33,6 @@ import android.provider.OpenableColumns; import com.nextcloud.client.account.UserAccountManager; import com.owncloud.android.MainApp; -import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.datamodel.ThumbnailsCacheManager; diff --git a/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java b/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java index d0f8296ef1..c9b2e03b92 100644 --- a/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java +++ b/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java @@ -50,7 +50,6 @@ import com.nextcloud.client.preferences.AppPreferences; import com.nextcloud.client.preferences.AppPreferencesImpl; import com.owncloud.android.MainApp; import com.owncloud.android.R; -import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.datamodel.ThumbnailsCacheManager; diff --git a/src/main/java/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java b/src/main/java/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java index e6570cc270..bdd535f4a1 100644 --- a/src/main/java/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java +++ b/src/main/java/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java @@ -36,7 +36,6 @@ import android.widget.Toast; import com.nextcloud.client.account.UserAccountManager; import com.owncloud.android.R; -import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.utils.Log_OC; diff --git a/src/main/java/com/owncloud/android/ui/TextDrawable.java b/src/main/java/com/owncloud/android/ui/TextDrawable.java index 792ef0ed6d..7d9c4ba2bb 100644 --- a/src/main/java/com/owncloud/android/ui/TextDrawable.java +++ b/src/main/java/com/owncloud/android/ui/TextDrawable.java @@ -32,7 +32,6 @@ import android.graphics.PixelFormat; import android.graphics.drawable.Drawable; import com.nextcloud.client.account.UserAccountManager; -import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.utils.BitmapUtils; import com.owncloud.android.utils.NextcloudServer; diff --git a/src/main/java/com/owncloud/android/ui/activity/FileActivity.java b/src/main/java/com/owncloud/android/ui/activity/FileActivity.java index 0f48f84edc..228706a9c9 100644 --- a/src/main/java/com/owncloud/android/ui/activity/FileActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/FileActivity.java @@ -42,7 +42,6 @@ import com.google.android.material.snackbar.Snackbar; import com.nextcloud.client.account.UserAccountManager; import com.owncloud.android.MainApp; import com.owncloud.android.R; -import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.authentication.AuthenticatorActivity; import com.owncloud.android.datamodel.ArbitraryDataProvider; import com.owncloud.android.datamodel.OCFile; diff --git a/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java b/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java index 001fe8297d..515ee618a5 100644 --- a/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java @@ -51,12 +51,6 @@ import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.webkit.URLUtil; -import androidx.annotation.LayoutRes; -import androidx.annotation.NonNull; -import androidx.appcompat.app.ActionBar; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.res.ResourcesCompat; import com.nextcloud.client.account.UserAccountManager; import com.nextcloud.client.di.Injectable; @@ -65,7 +59,6 @@ import com.nextcloud.client.preferences.AppPreferencesImpl; import com.owncloud.android.BuildConfig; import com.owncloud.android.MainApp; import com.owncloud.android.R; -import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.authentication.PassCodeManager; import com.owncloud.android.datamodel.ArbitraryDataProvider; import com.owncloud.android.datamodel.ExternalLinksProvider; @@ -87,6 +80,13 @@ import java.util.ArrayList; import javax.inject.Inject; +import androidx.annotation.LayoutRes; +import androidx.annotation.NonNull; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.res.ResourcesCompat; + /** * An Activity that allows the user to change the application's settings. * diff --git a/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java b/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java index e24d317f77..d128be6cd3 100644 --- a/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java @@ -53,11 +53,9 @@ import com.bumptech.glide.Glide; import com.bumptech.glide.request.animation.GlideAnimation; import com.bumptech.glide.request.target.SimpleTarget; import com.google.gson.Gson; -import com.nextcloud.client.account.UserAccountManager; import com.nextcloud.client.di.Injectable; import com.nextcloud.client.preferences.AppPreferences; import com.owncloud.android.R; -import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.datamodel.ArbitraryDataProvider; import com.owncloud.android.datamodel.PushConfigurationState; import com.owncloud.android.lib.common.UserInfo; diff --git a/src/main/java/com/owncloud/android/ui/adapter/TrashbinListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/TrashbinListAdapter.java index ffce386cda..9dafcbe7b3 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/TrashbinListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/TrashbinListAdapter.java @@ -33,7 +33,6 @@ import android.widget.TextView; import com.nextcloud.client.preferences.AppPreferences; import com.owncloud.android.R; -import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.ThumbnailsCacheManager; import com.owncloud.android.lib.common.utils.Log_OC; diff --git a/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java b/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java index 0460b394de..308d37eb7a 100644 --- a/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java +++ b/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java @@ -1,4 +1,4 @@ -/** +/* * ownCloud Android client application * * @author David A. Velasco @@ -40,7 +40,6 @@ import com.nextcloud.client.di.Injectable; import com.nextcloud.client.preferences.AppPreferences; import com.owncloud.android.MainApp; import com.owncloud.android.R; -import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.datamodel.VirtualFolderType; diff --git a/src/main/java/com/owncloud/android/utils/glide/HttpStreamFetcher.java b/src/main/java/com/owncloud/android/utils/glide/HttpStreamFetcher.java index 47a72fae30..3af6e41838 100644 --- a/src/main/java/com/owncloud/android/utils/glide/HttpStreamFetcher.java +++ b/src/main/java/com/owncloud/android/utils/glide/HttpStreamFetcher.java @@ -1,4 +1,4 @@ -/** +/* * Nextcloud Android client application * * @author Alejandro Bautista @@ -28,7 +28,6 @@ import com.bumptech.glide.Priority; import com.bumptech.glide.load.data.DataFetcher; import com.nextcloud.client.account.CurrentAccountProvider; import com.owncloud.android.MainApp; -import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.lib.common.OwnCloudAccount; import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;