mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-20 04:41:52 -05:00
Disable key import in sync adapter
This commit is contained in:
parent
e8bc9083f2
commit
0b07c5258f
@ -42,7 +42,7 @@ public class ContactSyncAdapterService extends Service {
|
|||||||
|
|
||||||
private class ContactSyncAdapter extends AbstractThreadedSyncAdapter {
|
private class ContactSyncAdapter extends AbstractThreadedSyncAdapter {
|
||||||
|
|
||||||
private final AtomicBoolean importDone = new AtomicBoolean(false);
|
// private final AtomicBoolean importDone = new AtomicBoolean(false);
|
||||||
|
|
||||||
public ContactSyncAdapter() {
|
public ContactSyncAdapter() {
|
||||||
super(ContactSyncAdapterService.this, true);
|
super(ContactSyncAdapterService.this, true);
|
||||||
@ -51,43 +51,44 @@ public class ContactSyncAdapterService extends Service {
|
|||||||
@Override
|
@Override
|
||||||
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider,
|
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider,
|
||||||
final SyncResult syncResult) {
|
final SyncResult syncResult) {
|
||||||
importDone.set(false);
|
// TODO: Import is currently disabled for 2.8, until we implement proper origin management
|
||||||
KeychainApplication.setupAccountAsNeeded(ContactSyncAdapterService.this);
|
// importDone.set(false);
|
||||||
EmailKeyHelper.importContacts(getContext(), new Messenger(new Handler(Looper.getMainLooper(),
|
// KeychainApplication.setupAccountAsNeeded(ContactSyncAdapterService.this);
|
||||||
new Handler.Callback() {
|
// EmailKeyHelper.importContacts(getContext(), new Messenger(new Handler(Looper.getMainLooper(),
|
||||||
@Override
|
// new Handler.Callback() {
|
||||||
public boolean handleMessage(Message msg) {
|
// @Override
|
||||||
Bundle data = msg.getData();
|
// public boolean handleMessage(Message msg) {
|
||||||
switch (msg.arg1) {
|
// Bundle data = msg.getData();
|
||||||
case KeychainIntentServiceHandler.MESSAGE_OKAY:
|
// switch (msg.arg1) {
|
||||||
Log.d(Constants.TAG, "Syncing... Done.");
|
// case KeychainIntentServiceHandler.MESSAGE_OKAY:
|
||||||
synchronized (importDone) {
|
// Log.d(Constants.TAG, "Syncing... Done.");
|
||||||
importDone.set(true);
|
// synchronized (importDone) {
|
||||||
importDone.notifyAll();
|
// importDone.set(true);
|
||||||
}
|
// importDone.notifyAll();
|
||||||
return true;
|
// }
|
||||||
case KeychainIntentServiceHandler.MESSAGE_UPDATE_PROGRESS:
|
// return true;
|
||||||
if (data.containsKey(KeychainIntentServiceHandler.DATA_PROGRESS) &&
|
// case KeychainIntentServiceHandler.MESSAGE_UPDATE_PROGRESS:
|
||||||
data.containsKey(KeychainIntentServiceHandler.DATA_PROGRESS_MAX)) {
|
// if (data.containsKey(KeychainIntentServiceHandler.DATA_PROGRESS) &&
|
||||||
Log.d(Constants.TAG, "Syncing... Progress: " +
|
// data.containsKey(KeychainIntentServiceHandler.DATA_PROGRESS_MAX)) {
|
||||||
data.getInt(KeychainIntentServiceHandler.DATA_PROGRESS) + "/" +
|
// Log.d(Constants.TAG, "Syncing... Progress: " +
|
||||||
data.getInt(KeychainIntentServiceHandler.DATA_PROGRESS_MAX));
|
// data.getInt(KeychainIntentServiceHandler.DATA_PROGRESS) + "/" +
|
||||||
return false;
|
// data.getInt(KeychainIntentServiceHandler.DATA_PROGRESS_MAX));
|
||||||
}
|
// return false;
|
||||||
default:
|
// }
|
||||||
Log.d(Constants.TAG, "Syncing... " + msg.toString());
|
// default:
|
||||||
return false;
|
// Log.d(Constants.TAG, "Syncing... " + msg.toString());
|
||||||
}
|
// return false;
|
||||||
}
|
// }
|
||||||
})));
|
// }
|
||||||
synchronized (importDone) {
|
// })));
|
||||||
try {
|
// synchronized (importDone) {
|
||||||
if (!importDone.get()) importDone.wait();
|
// try {
|
||||||
} catch (InterruptedException e) {
|
// if (!importDone.get()) importDone.wait();
|
||||||
Log.w(Constants.TAG, e);
|
// } catch (InterruptedException e) {
|
||||||
return;
|
// Log.w(Constants.TAG, e);
|
||||||
}
|
// return;
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
ContactHelper.writeKeysToContacts(ContactSyncAdapterService.this);
|
ContactHelper.writeKeysToContacts(ContactSyncAdapterService.this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user