drop ContactSync feature

This commit is contained in:
Vincent Breitmoser
2020-09-05 14:32:59 +02:00
parent aa6ff03545
commit 2d9edf3832
39 changed files with 23 additions and 624 deletions

View File

@@ -30,6 +30,8 @@ import android.app.Application;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.widget.Toast;
import androidx.annotation.Nullable;
@@ -37,7 +39,6 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.sufficientlysecure.keychain.keysync.KeyserverSyncManager;
import org.sufficientlysecure.keychain.network.TlsCertificatePinning;
import org.sufficientlysecure.keychain.provider.TemporaryFileProvider;
import org.sufficientlysecure.keychain.service.ContactSyncAdapterService;
import org.sufficientlysecure.keychain.util.PRNGFixes;
import org.sufficientlysecure.keychain.util.Preferences;
import timber.log.Timber;
@@ -85,15 +86,9 @@ public class KeychainApplication extends Application {
}
*/
// Add OpenKeychain account to Android to link contacts with keys and keyserver sync
createAccountIfNecessary(this);
Preferences preferences = Preferences.getPreferences(this);
if (preferences.isAppExecutedFirstTime()) {
preferences.setAppExecutedFirstTime(false);
ContactSyncAdapterService.enableContactsSync(this);
preferences.setPrefVersionToCurrentVersion();
}
@@ -115,33 +110,6 @@ public class KeychainApplication extends Application {
TemporaryFileProvider.scheduleCleanupImmediately(getApplicationContext());
}
/**
* @return the OpenKeychain contact/keyserver sync account if it exists or was successfully
* created, null otherwise
*/
public static @Nullable Account createAccountIfNecessary(Context context) {
try {
AccountManager manager = AccountManager.get(context);
Account[] accounts = manager.getAccountsByType(Constants.ACCOUNT_TYPE);
Account account = new Account(Constants.ACCOUNT_NAME, Constants.ACCOUNT_TYPE);
if (accounts.length == 0) {
if (!manager.addAccountExplicitly(account, null, null)) {
Timber.d("error when adding account via addAccountExplicitly");
return null;
} else {
return account;
}
} else {
return accounts[0];
}
} catch (SecurityException e) {
Timber.e(e, "SecurityException when adding the account");
Toast.makeText(context, R.string.reinstall_openkeychain, Toast.LENGTH_LONG).show();
return null;
}
}
public static HashMap<String,Bitmap> qrCodeCache = new HashMap<>();
@Override