aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain/src')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java3
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java4
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java4
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java6
-rw-r--r--OpenKeychain/src/main/res/xml/account_desc.xml2
-rw-r--r--OpenKeychain/src/main/res/xml/sync_adapter_desc.xml2
6 files changed, 12 insertions, 9 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java
index 78b66464b..9f84da815 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java
@@ -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";
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java
index ca9af8a9d..964342c60 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java
@@ -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);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java
index 909c3031c..fbe914b78 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java
@@ -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);
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
index 246804383..021e6bc07 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
@@ -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);
}
diff --git a/OpenKeychain/src/main/res/xml/account_desc.xml b/OpenKeychain/src/main/res/xml/account_desc.xml
index 41ce8fe48..d29395202 100644
--- a/OpenKeychain/src/main/res/xml/account_desc.xml
+++ b/OpenKeychain/src/main/res/xml/account_desc.xml
@@ -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" />
diff --git a/OpenKeychain/src/main/res/xml/sync_adapter_desc.xml b/OpenKeychain/src/main/res/xml/sync_adapter_desc.xml
index bbfd41842..d05dc6918 100644
--- a/OpenKeychain/src/main/res/xml/sync_adapter_desc.xml
+++ b/OpenKeychain/src/main/res/xml/sync_adapter_desc.xml
@@ -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" /> \ No newline at end of file