mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 19:22:14 -05:00
Change account type
This commit is contained in:
parent
7adf07a9f9
commit
2930f83b2a
@ -35,6 +35,9 @@ public final class Constants {
|
||||
|
||||
public static final String PACKAGE_NAME = "org.sufficientlysecure.keychain";
|
||||
|
||||
public static final String ACCOUNT_NAME = "OpenKeychain";
|
||||
public static final String ACCOUNT_TYPE = PACKAGE_NAME + ".account";
|
||||
|
||||
// as defined in http://tools.ietf.org/html/rfc3156, section 7
|
||||
public static final String NFC_MIME = "application/pgp-keys";
|
||||
|
||||
|
@ -112,9 +112,9 @@ public class KeychainApplication extends Application {
|
||||
|
||||
public static void setupAccountAsNeeded(Context context) {
|
||||
AccountManager manager = AccountManager.get(context);
|
||||
Account[] accounts = manager.getAccountsByType(Constants.PACKAGE_NAME);
|
||||
Account[] accounts = manager.getAccountsByType(Constants.ACCOUNT_TYPE);
|
||||
if (accounts == null || accounts.length == 0) {
|
||||
Account account = new Account(context.getString(R.string.app_name), Constants.PACKAGE_NAME);
|
||||
Account account = new Account(Constants.ACCOUNT_NAME, Constants.ACCOUNT_TYPE);
|
||||
manager.addAccountExplicitly(account, null, null);
|
||||
ContentResolver.setIsSyncable(account, ContactsContract.AUTHORITY, 1);
|
||||
ContentResolver.setSyncAutomatically(account, ContactsContract.AUTHORITY, true);
|
||||
|
@ -98,12 +98,12 @@ public class ContactSyncAdapterService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
public static void requestSync(Context context) {
|
||||
public static void requestSync() {
|
||||
Bundle extras = new Bundle();
|
||||
// no need to wait for internet connection!
|
||||
extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
|
||||
ContentResolver.requestSync(
|
||||
new Account(context.getString(R.string.app_name), Constants.PACKAGE_NAME),
|
||||
new Account(Constants.ACCOUNT_NAME, Constants.ACCOUNT_TYPE),
|
||||
ContactsContract.AUTHORITY,
|
||||
extras);
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ public class KeychainIntentService extends IntentService
|
||||
setProgress(R.string.progress_done, 100, 100);
|
||||
|
||||
// make sure new data is synced into contacts
|
||||
ContactSyncAdapterService.requestSync(this);
|
||||
ContactSyncAdapterService.requestSync();
|
||||
|
||||
/* Output */
|
||||
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY, saveResult);
|
||||
@ -506,7 +506,7 @@ public class KeychainIntentService extends IntentService
|
||||
providerHelper.consolidateDatabaseStep1(this);
|
||||
}
|
||||
// make sure new data is synced into contacts
|
||||
ContactSyncAdapterService.requestSync(this);
|
||||
ContactSyncAdapterService.requestSync();
|
||||
|
||||
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY, result);
|
||||
} catch (Exception e) {
|
||||
@ -715,7 +715,7 @@ public class KeychainIntentService extends IntentService
|
||||
|
||||
if (success) {
|
||||
// make sure new data is synced into contacts
|
||||
ContactSyncAdapterService.requestSync(this);
|
||||
ContactSyncAdapterService.requestSync();
|
||||
|
||||
sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:accountType="org.sufficientlysecure.keychain"
|
||||
android:accountType="org.sufficientlysecure.keychain.account"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name" />
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:contentAuthority="com.android.contacts"
|
||||
android:accountType="org.sufficientlysecure.keychain"
|
||||
android:accountType="org.sufficientlysecure.keychain.account"
|
||||
android:supportsUploading="false"
|
||||
android:userVisible="true" />
|
Loading…
Reference in New Issue
Block a user