replace DatabaseReadWriteInteractor with DatabaseInteractor where possible

This commit is contained in:
Vincent Breitmoser
2017-02-20 17:21:16 +01:00
parent aef6e6614e
commit 0277ba1afa
24 changed files with 123 additions and 124 deletions

View File

@@ -1,5 +1,12 @@
package org.sufficientlysecure.keychain.service;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import android.accounts.Account;
import android.app.AlarmManager;
import android.app.Notification;
@@ -32,25 +39,19 @@ import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.KeychainApplication;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing;
import org.sufficientlysecure.keychain.network.NetworkReceiver;
import org.sufficientlysecure.keychain.network.orbot.OrbotHelper;
import org.sufficientlysecure.keychain.operations.ImportOperation;
import org.sufficientlysecure.keychain.operations.results.ImportKeyResult;
import org.sufficientlysecure.keychain.operations.results.OperationResult;
import org.sufficientlysecure.keychain.provider.DatabaseReadWriteInteractor;
import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.network.NetworkReceiver;
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.ui.OrbotRequiredDialogActivity;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ParcelableProxy;
import org.sufficientlysecure.keychain.util.Preferences;
import org.sufficientlysecure.keychain.network.orbot.OrbotHelper;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
public class KeyserverSyncAdapterService extends Service {

View File

@@ -41,7 +41,7 @@ import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType;
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
import org.sufficientlysecure.keychain.provider.DatabaseReadWriteInteractor;
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase;
import org.sufficientlysecure.keychain.util.Preferences;
@@ -224,7 +224,7 @@ public class PassphraseCacheService extends Service {
/**
* Internal implementation to get cached passphrase.
*/
private Passphrase getCachedPassphraseImpl(long masterKeyId, long subKeyId) throws DatabaseReadWriteInteractor.NotFoundException {
private Passphrase getCachedPassphraseImpl(long masterKeyId, long subKeyId) throws DatabaseInteractor.NotFoundException {
// on "none" key, just do nothing
if (masterKeyId == Constants.key.none) {
return null;
@@ -245,16 +245,16 @@ public class PassphraseCacheService extends Service {
+ masterKeyId + ", subKeyId " + subKeyId);
// get the type of key (from the database)
CachedPublicKeyRing keyRing = new DatabaseReadWriteInteractor(this).getCachedPublicKeyRing(masterKeyId);
CachedPublicKeyRing keyRing = new DatabaseInteractor(getContentResolver()).getCachedPublicKeyRing(masterKeyId);
SecretKeyType keyType = keyRing.getSecretKeyType(subKeyId);
switch (keyType) {
case PASSPHRASE_EMPTY:
return new Passphrase("");
case UNAVAILABLE:
throw new DatabaseReadWriteInteractor.NotFoundException("secret key for this subkey is not available");
throw new DatabaseInteractor.NotFoundException("secret key for this subkey is not available");
case GNU_DUMMY:
throw new DatabaseReadWriteInteractor.NotFoundException("secret key for stripped subkey is not available");
throw new DatabaseInteractor.NotFoundException("secret key for stripped subkey is not available");
}
// get cached passphrase
@@ -398,7 +398,7 @@ public class PassphraseCacheService extends Service {
bundle.putParcelable(EXTRA_PASSPHRASE, passphrase);
msg.setData(bundle);
}
} catch (DatabaseReadWriteInteractor.NotFoundException e) {
} catch (DatabaseInteractor.NotFoundException e) {
Log.e(Constants.TAG, "PassphraseCacheService: Passphrase for unknown key was requested!");
msg.what = MSG_PASSPHRASE_CACHE_GET_KEY_NOT_FOUND;
}