diff --git a/app/src/main/java/foundation/e/drive/EdriveApplication.java b/app/src/main/java/foundation/e/drive/EdriveApplication.java index 0ba4332015df5519bc7cefe176af79481a9bf521..5346c46872e02b0f647944fee40f96a57fc3ea9c 100644 --- a/app/src/main/java/foundation/e/drive/EdriveApplication.java +++ b/app/src/main/java/foundation/e/drive/EdriveApplication.java @@ -98,6 +98,6 @@ public class EdriveApplication extends Application { @Override public void onLowMemory() { super.onLowMemory(); - Timber.w("System is low on memory. Application might get killed by the system."); + Timber.i("System is low on memory. Application might get killed by the system."); } } diff --git a/app/src/main/java/foundation/e/drive/FileObservers/FileEventListener.java b/app/src/main/java/foundation/e/drive/FileObservers/FileEventListener.java index 57c342c86c4eb6c08a1538774b2632be49a11b78..77c55b3629804685ae3ba467bbbcb7b0f2991104 100644 --- a/app/src/main/java/foundation/e/drive/FileObservers/FileEventListener.java +++ b/app/src/main/java/foundation/e/drive/FileObservers/FileEventListener.java @@ -184,7 +184,7 @@ public class FileEventListener { final String parentPath = CommonUtils.getLocalPath(file.getParentFile()); SyncedFolder parentFolder = DbHelper.getSyncedFolderByLocalPath(parentPath, appContext); if (parentFolder == null || !parentFolder.isEnabled()) { - Timber.w("Won't send sync request: no parent are known for new file: %s", file.getName()); + Timber.d("Won't send sync request: no parent are known for new file: %s", file.getName()); return; } int scannableValue = 0; diff --git a/app/src/main/java/foundation/e/drive/services/InitializerService.java b/app/src/main/java/foundation/e/drive/services/InitializerService.java index 6b310f4952aa426ac535b5984b4ebb146e1f860b..7c0e0738130e610a2fb3f10741ac39ee416cb239 100644 --- a/app/src/main/java/foundation/e/drive/services/InitializerService.java +++ b/app/src/main/java/foundation/e/drive/services/InitializerService.java @@ -63,7 +63,7 @@ public class InitializerService extends Service { SharedPreferences prefs = this.getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE); if (prefs.getBoolean(AppConstants.INITIALIZATION_HAS_BEEN_DONE, false)) { - Timber.w("Initializer has already been done"); + Timber.i("Initializer has already been done"); } else { String accountName = prefs.getString(AccountManager.KEY_ACCOUNT_NAME, ""); String accountType = prefs.getString(AccountManager.KEY_ACCOUNT_TYPE, ""); @@ -79,16 +79,15 @@ public class InitializerService extends Service { } if (accountName.isEmpty()) { - Timber.w("Account's name not found"); + Timber.d("Account's name not found"); stopSelf(); } else { this.account = CommonUtils.getAccount(accountName, accountType, AccountManager.get(this)); - //Get OwnCloudlient if (this.account != null) { this.cloudClient = DavClientProvider.getInstance().getClientInstance(account, getApplicationContext()); start(); } else { - Timber.w("Got account is invalid"); + Timber.i("Got account is invalid"); stopSelf(); } } diff --git a/app/src/main/java/foundation/e/drive/services/ObserverService.java b/app/src/main/java/foundation/e/drive/services/ObserverService.java index 46b351bfa09913c8ba9fc950e6aa3401faa39cd2..5664eb1cbc6d680339fe9f284debee2192e85103 100644 --- a/app/src/main/java/foundation/e/drive/services/ObserverService.java +++ b/app/src/main/java/foundation/e/drive/services/ObserverService.java @@ -103,7 +103,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene @Override public int onStartCommand(Intent intent, int flags, int startId) { - Timber.i("onStartCommand(%s)", startId); + Timber.v("onStartCommand(%s)", startId); CommonUtils.setServiceUnCaughtExceptionHandler(this); @@ -134,27 +134,27 @@ public class ObserverService extends Service implements OnRemoteOperationListene * @return false if at least one condition is false */ private boolean checkStartCondition(final SharedPreferences prefs, final boolean forcedSync) { - Timber.d("checkStartCondition()"); + Timber.v("checkStartCondition()"); if (mAccount == null) { - Timber.w("No account registered"); + Timber.d("No account registered"); return false; } if (!CommonUtils.isMediaSyncEnabled(mAccount) && !CommonUtils.isSettingsSyncEnabled(mAccount)) { - Timber.w("Synchronization has been disabled in account's settings"); + Timber.d("Synchronization has been disabled in account's settings"); return false; } if (!prefs.getBoolean(INITIALIZATION_HAS_BEEN_DONE, false)) { - Timber.w("Initialization hasn't been done"); + Timber.d("Initialization hasn't been done"); Intent initializerIntent = new Intent(this, InitializerService.class); startService(initializerIntent); return false; } if (isWorking) { - Timber.w("ObserverService is already working"); + Timber.d("ObserverService is already working"); return false; } @@ -164,14 +164,14 @@ public class ObserverService extends Service implements OnRemoteOperationListene final long lastSyncTime = prefs.getLong(AppConstants.KEY_LAST_SYNC_TIME, 0L); final long currentTime = System.currentTimeMillis(); if (!forcedSync && (currentTime - lastSyncTime ) < INTERSYNC_MINIMUM_DELAY ) { - Timber.w("Delay between now and last call is too short"); + Timber.d("Delay between now and last call is too short"); return false; } final boolean meteredNetworkAllowed = CommonUtils.isMeteredNetworkAllowed(mAccount); //check for the case where intent has been launched by initializerService if (!CommonUtils.haveNetworkConnection(this, meteredNetworkAllowed)) { - Timber.w("There is no allowed internet connexion."); + Timber.d("There is no allowed internet connexion."); return false; } @@ -201,13 +201,13 @@ public class ObserverService extends Service implements OnRemoteOperationListene Timber.i("deleteOldestCrashLogs()"); final File externalFilesDir = getExternalFilesDir(ServiceExceptionHandler.CRASH_LOG_FOLDER); if (externalFilesDir == null) { - Timber.e("getExternalFilesDir() returned null. Preventing a NPE"); + Timber.d("getExternalFilesDir() returned null. Preventing a NPE"); return; } final File[] fileToRemove = externalFilesDir.listFiles(new CrashlogsFileFilter()); if (fileToRemove == null) { - Timber.e("getExternalFilesDir() returned null. Preventing a NPE"); + Timber.d("getExternalFilesDir() returned null. Preventing a NPE"); return; } @@ -249,7 +249,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene this.mSyncedFolders = loadSyncedFolders(); if (mSyncedFolders.isEmpty()) { - Timber.w("List of synced folders is empty"); + Timber.d("List of synced folders is empty"); this.stopSelf(); return; } @@ -257,7 +257,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene if (remote) { final OwnCloudClient client = DavClientProvider.getInstance().getClientInstance(mAccount, getApplicationContext()); if (client == null) { - Timber.w("OwnCloudClient is null"); + Timber.d("OwnCloudClient is null"); return; } @@ -305,7 +305,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene if (!(operation instanceof ListFileRemoteOperation)) return; if (!result.isSuccess()) { - Timber.w("ListRemoteFileOperation failed. Http code: %s", result.getHttpCode()); + Timber.d("ListRemoteFileOperation failed. Http code: %s", result.getHttpCode()); } final List remoteFiles = ((RemoteOperationResult>)result).getResultData(); @@ -333,7 +333,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene Timber.d("syncRequests contains %s", syncRequests.size()); passSyncRequestsToSynchronizationService(); } else { - Timber.w("There is no file to sync."); + Timber.i("There is no file to sync."); getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE) .edit() .putLong(AppConstants.KEY_LAST_SYNC_TIME, System.currentTimeMillis()) diff --git a/app/src/main/java/foundation/e/drive/services/SynchronizationService.java b/app/src/main/java/foundation/e/drive/services/SynchronizationService.java index 0eaa40ffa49487a86f45b50551470589d8647b8d..2ff8733bb19134a2e66a50c02041ffa38d9335bc 100644 --- a/app/src/main/java/foundation/e/drive/services/SynchronizationService.java +++ b/app/src/main/java/foundation/e/drive/services/SynchronizationService.java @@ -82,7 +82,7 @@ public class SynchronizationService extends Service implements OnRemoteOperation account = CommonUtils.getAccount(accountName, accountType, AccountManager.get(this)); if (account == null) { - Timber.w("No account available"); + Timber.d("No account available"); stopSelf(); return START_NOT_STICKY; } @@ -113,12 +113,6 @@ public class SynchronizationService extends Service implements OnRemoteOperation return binder; } - @Override - public void onLowMemory() { - Timber.w("System is low on memory. Service might get killed."); - } - - /** * Try to pause synchronization. * Can only be paused if no sync is already running and no request queue is started @@ -297,38 +291,38 @@ public class SynchronizationService extends Service implements OnRemoteOperation break; case SYNC_CONFLICT: //Case specific to UploadFileOperation - Timber.e("%s : Sync_conflict : File is already up to date", operationClassName); + Timber.d("%s : Sync_conflict : File is already up to date", operationClassName); break; case INVALID_OVERWRITE: - Timber.e("%s => invalid_overwrite :\n remote file and local file doesn't have the same size", operationClassName); + Timber.d("%s => invalid_overwrite :\n remote file and local file doesn't have the same size", operationClassName); break; case UNKNOWN_ERROR: if (callerOperation instanceof UploadFileOperation) { final int rowAffected = DbHelper.forceFoldertoBeRescan(((UploadFileOperation) callerOperation).getSyncedState().getId(), getApplicationContext()); - Timber.e("Upload failed for unknown reason.\n Force folder to be rescan next time (row affected) : %s", rowAffected); + Timber.d("Upload failed for unknown reason.\n Force folder to be rescan next time (row affected) : %s", rowAffected); } else if (callerOperation instanceof DownloadFileOperation) { - Timber.e("Download: Unknown_error : failed"); + Timber.d("Download: Unknown_error : failed"); } break; case FORBIDDEN: if (callerOperation instanceof UploadFileOperation) { final int rowAffected = DbHelper.forceFoldertoBeRescan(((UploadFileOperation) callerOperation).getSyncedState().getId(), getApplicationContext()); - Timber.e("Upload: Forbidden : Can't get syncedFileState, no remote path defined. Force folder to be rescan next time (row affected) : %s", rowAffected); + Timber.d("Upload: Forbidden : Can't get syncedFileState, no remote path defined. Force folder to be rescan next time (row affected) : %s", rowAffected); } else if (callerOperation instanceof DownloadFileOperation) { - Timber.e("Download : Forbidden: Can't get syncedFileState, no local path defined"); + Timber.d("Download : Forbidden: Can't get syncedFileState, no local path defined"); } break; case QUOTA_EXCEEDED: //Case specific to UploadFileOperation - Timber.w("Quota_EXCEEDED"); + Timber.d("Quota_EXCEEDED"); break; case FILE_NOT_FOUND: //Case specific to DownloadFileOperation - Timber.e("%s : File_not_found: File not found after download", operationClassName); + Timber.d("%s : File_not_found: File not found after download", operationClassName); break; case ETAG_UNCHANGED: //Case specific to DownloadFileOperation - Timber.e("%s : Sync_conflict: File is already up to date", operationClassName); + Timber.d("%s : Sync_conflict: File is already up to date", operationClassName); break; } } diff --git a/app/src/main/java/foundation/e/drive/work/CreateRemoteFolderWorker.java b/app/src/main/java/foundation/e/drive/work/CreateRemoteFolderWorker.java index 280051993622c5107fd709dda9ee0aa6df216366..e112c0f393c270ebb8e1fcff685fbce925039eac 100644 --- a/app/src/main/java/foundation/e/drive/work/CreateRemoteFolderWorker.java +++ b/app/src/main/java/foundation/e/drive/work/CreateRemoteFolderWorker.java @@ -60,7 +60,7 @@ public class CreateRemoteFolderWorker extends Worker { final Context context = getApplicationContext(); final Account account = getAccount(); if (account == null) { - Timber.e("doWork(): Can't get valid account"); + Timber.d("doWork(): Can't get valid account"); return Result.failure(); } diff --git a/app/src/main/java/foundation/e/drive/work/LocalFileDeleter.java b/app/src/main/java/foundation/e/drive/work/LocalFileDeleter.java index f617855185af86fe939b22f5975b8080f5fbb2c1..df8e0ad818ee42be0701ec4262e553d7ee8678d9 100644 --- a/app/src/main/java/foundation/e/drive/work/LocalFileDeleter.java +++ b/app/src/main/java/foundation/e/drive/work/LocalFileDeleter.java @@ -47,7 +47,7 @@ public class LocalFileDeleter { if (file.exists()) { try { if (!file.delete()) { - Timber.w("local file ( %s ) removal failed", file.getName()); + Timber.d("local file ( %s ) removal failed", file.getName()); return false; } } catch (SecurityException exception) { @@ -62,7 +62,7 @@ public class LocalFileDeleter { if (DbHelper.manageSyncedFileStateDB(fileState, "DELETE", context) <= 0) { - Timber.e("Failed to remove %s from DB", file.getName()); + Timber.d("Failed to remove %s from DB", file.getName()); } return true; }