Parcourir la source

use cancelContactBackupJobForAccount to disable all backup jobs
switched if branches, according to findBugs

Signed-off-by: tobiaskaminsky <tobias@kaminsky.me>

tobiaskaminsky il y a 7 ans
Parent
commit
2b0dd3209c

+ 4 - 4
src/main/java/com/owncloud/android/jobs/AccountRemovalJob.java

@@ -68,11 +68,9 @@ public class AccountRemovalJob extends Job implements AccountManagerCallback<Boo
         Account account = AccountUtils.getOwnCloudAccountByName(context, bundle.getString(ACCOUNT, ""));
         AccountManager am = (AccountManager) context.getSystemService(ACCOUNT_SERVICE);
 
-        if (account == null || am == null) {
-            return Result.FAILURE;
-        } else {
+        if (account != null && am != null) {
             // disable contact backup job
-            ContactsPreferenceActivity.cancelPreviousContactBackupJobForAccount(context, account);
+            ContactsPreferenceActivity.cancelContactBackupJobForAccount(context, account);
 
             am.removeAccount(account, this, null);
 
@@ -118,6 +116,8 @@ public class AccountRemovalJob extends Job implements AccountManagerCallback<Boo
             }
 
             return Result.SUCCESS;
+        } else {
+            return Result.FAILURE;
         }
     }