Show keys with android contacts

This means to sync userid + keyid into contact storage. Android will merge them to normal contacts based on primary userid.
This commit is contained in:
mar-v-in
2014-06-05 23:22:21 +02:00
parent dc1e26f39c
commit 80e9998640
8 changed files with 119 additions and 11 deletions

View File

@@ -26,6 +26,7 @@ import android.graphics.drawable.Drawable;
import android.os.Environment;
import org.spongycastle.jce.provider.BouncyCastleProvider;
import org.sufficientlysecure.keychain.helper.ContactHelper;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.PRNGFixes;
@@ -79,14 +80,14 @@ public class KeychainApplication extends Application {
brandGlowEffect(getApplicationContext(),
getApplicationContext().getResources().getColor(R.color.emphasis));
setupAccountAsNeeded();
setupAccountAsNeeded(this);
}
private void setupAccountAsNeeded() {
AccountManager manager = AccountManager.get(this);
Account[] accounts = manager.getAccountsByType(getPackageName());
public static void setupAccountAsNeeded(Context context) {
AccountManager manager = AccountManager.get(context);
Account[] accounts = manager.getAccountsByType(Constants.PACKAGE_NAME);
if (accounts == null || accounts.length == 0) {
Account dummy = new Account(getString(R.string.app_name), getPackageName());
Account dummy = new Account(context.getString(R.string.app_name), Constants.PACKAGE_NAME);
manager.addAccountExplicitly(dummy, null, null);
}
}