diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-06-10 19:47:29 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-06-10 19:47:29 +0200 |
commit | aa31abd93f568045d601df2507b228ec71e97926 (patch) | |
tree | e22b3b3c24c267196bc422b3f3d0d19950eade39 | |
parent | e6ea98fabc03f98055aaede3f456f43b294990f9 (diff) | |
download | open-keychain-aa31abd93f568045d601df2507b228ec71e97926.tar.gz open-keychain-aa31abd93f568045d601df2507b228ec71e97926.tar.bz2 open-keychain-aa31abd93f568045d601df2507b228ec71e97926.zip |
Allow debug build besides release build
13 files changed, 41 insertions, 15 deletions
diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index a4caa1fe7..88480966e 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -111,6 +111,30 @@ android { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + + // Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE. + buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.account\"" + buildConfigField "String", "PROVIDER_AUTHORITY", "\"org.sufficientlysecure.keychain.provider\"" + buildConfigField "String", "TEMPSTORAGE_AUTHORITY", "\"org.sufficientlysecure.keychain.tempstorage\"" + + // Reference them in .xml files. + resValue "string", "account_type", "org.sufficientlysecure.keychain.account" + resValue "string", "provider_authority", "org.sufficientlysecure.keychain.provider" + resValue "string", "tempstorage_authority", "org.sufficientlysecure.keychain.tempstorage" + } + + debug { + applicationIdSuffix ".debug" + + // Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE. + buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.debug.account\"" + buildConfigField "String", "PROVIDER_AUTHORITY", "\"org.sufficientlysecure.keychain.debug.provider\"" + buildConfigField "String", "TEMPSTORAGE_AUTHORITY", "\"org.sufficientlysecure.keychain.debug.tempstorage\"" + + // Reference them in .xml files. + resValue "string", "account_type", "org.sufficientlysecure.keychain.debug.account" + resValue "string", "provider_authority", "org.sufficientlysecure.keychain.debug.provider" + resValue "string", "tempstorage_authority", "org.sufficientlysecure.keychain.debug.tempstorage" } } diff --git a/OpenKeychain/src/debug/res/drawable-hdpi/ic_launcher.png b/OpenKeychain/src/debug/res/drawable-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 000000000..bb5104aec --- /dev/null +++ b/OpenKeychain/src/debug/res/drawable-hdpi/ic_launcher.png diff --git a/OpenKeychain/src/debug/res/drawable-mdpi/ic_launcher.png b/OpenKeychain/src/debug/res/drawable-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 000000000..e709f735d --- /dev/null +++ b/OpenKeychain/src/debug/res/drawable-mdpi/ic_launcher.png diff --git a/OpenKeychain/src/debug/res/drawable-xhdpi/ic_launcher.png b/OpenKeychain/src/debug/res/drawable-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 000000000..fb4f2737a --- /dev/null +++ b/OpenKeychain/src/debug/res/drawable-xhdpi/ic_launcher.png diff --git a/OpenKeychain/src/debug/res/drawable-xxhdpi/ic_launcher.png b/OpenKeychain/src/debug/res/drawable-xxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 000000000..37d0958ff --- /dev/null +++ b/OpenKeychain/src/debug/res/drawable-xxhdpi/ic_launcher.png diff --git a/OpenKeychain/src/debug/res/drawable-xxxhdpi/ic_launcher.png b/OpenKeychain/src/debug/res/drawable-xxxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 000000000..e5183fb05 --- /dev/null +++ b/OpenKeychain/src/debug/res/drawable-xxxhdpi/ic_launcher.png diff --git a/OpenKeychain/src/main/AndroidManifest.xml b/OpenKeychain/src/main/AndroidManifest.xml index 7b74a5b20..81a692e2e 100644 --- a/OpenKeychain/src/main/AndroidManifest.xml +++ b/OpenKeychain/src/main/AndroidManifest.xml @@ -50,9 +50,9 @@ android:name="android.hardware.screen.portrait" android:required="false" /> - <permission android:name="org.sufficientlysecure.keychain.WRITE_TEMPORARY_STORAGE" /> + <permission android:name="${applicationId}.WRITE_TEMPORARY_STORAGE" /> - <uses-permission android:name="org.sufficientlysecure.keychain.WRITE_TEMPORARY_STORAGE" /> + <uses-permission android:name="${applicationId}.WRITE_TEMPORARY_STORAGE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> @@ -727,7 +727,7 @@ <provider android:name=".provider.KeychainProvider" - android:authorities="org.sufficientlysecure.keychain.provider" + android:authorities="${applicationId}.provider" android:exported="false" /> <!-- Internal classes of the remote APIs (not exported) --> @@ -805,9 +805,9 @@ <!-- Storage Provider for temporary decrypted files --> <provider android:name=".provider.TemporaryStorageProvider" - android:authorities="org.sufficientlysecure.keychain.tempstorage" + android:authorities="${applicationId}.tempstorage" android:exported="true" - android:writePermission="org.sufficientlysecure.keychain.WRITE_TEMPORARY_STORAGE" /> + android:writePermission="${applicationId}.WRITE_TEMPORARY_STORAGE" /> </application> diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java index 3aa58d024..f0e922a2f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java @@ -31,14 +31,17 @@ public final class Constants { public static final boolean DEBUG_LOG_DB_QUERIES = false; public static final boolean DEBUG_SYNC_REMOVE_CONTACTS = false; - public static final String TAG = "Keychain"; + public static final String TAG = DEBUG ? "Keychain D" : "Keychain"; 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"; + public static final String ACCOUNT_NAME = DEBUG ? "OpenKeychain D" : "OpenKeychain"; + public static final String ACCOUNT_TYPE = BuildConfig.ACCOUNT_TYPE; public static final String CUSTOM_CONTACT_DATA_MIME_TYPE = "vnd.android.cursor.item/vnd.org.sufficientlysecure.keychain.key"; + public static final String PROVIDER_AUTHORITY = BuildConfig.PROVIDER_AUTHORITY; + public static final String TEMPSTORAGE_AUTHORITY = BuildConfig.TEMPSTORAGE_AUTHORITY; + // 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 710dbf8aa..98f19e98f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java @@ -128,8 +128,6 @@ public class KeychainApplication extends Application { /** * Add OpenKeychain account to Android to link contacts with keys - * - * @param context */ public static void setupAccountAsNeeded(Context context) { try { @@ -165,7 +163,7 @@ public class KeychainApplication extends Application { int edgeDrawableId = context.getResources().getIdentifier("overscroll_edge", "drawable", "android"); Drawable androidEdge = context.getResources().getDrawable(edgeDrawableId); androidEdge.setColorFilter(brandColor, PorterDuff.Mode.SRC_IN); - } catch (Resources.NotFoundException e) { + } catch (Exception ignored) { } } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainContract.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainContract.java index d5283f01f..0d9a4ac16 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainContract.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainContract.java @@ -90,7 +90,7 @@ public class KeychainContract { String PACKAGE_NAME = "package_name"; // foreign key to api_apps.package_name } - public static final String CONTENT_AUTHORITY = Constants.PACKAGE_NAME + ".provider"; + public static final String CONTENT_AUTHORITY = Constants.PROVIDER_AUTHORITY; private static final Uri BASE_CONTENT_URI_INTERNAL = Uri .parse("content://" + CONTENT_AUTHORITY); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/TemporaryStorageProvider.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/TemporaryStorageProvider.java index 45f806960..2000a6525 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/TemporaryStorageProvider.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/TemporaryStorageProvider.java @@ -45,7 +45,8 @@ public class TemporaryStorageProvider extends ContentProvider { private static final String COLUMN_ID = "id"; private static final String COLUMN_NAME = "name"; private static final String COLUMN_TIME = "time"; - private static final Uri BASE_URI = Uri.parse("content://org.sufficientlysecure.keychain.tempstorage/"); + public static final String CONTENT_AUTHORITY = Constants.TEMPSTORAGE_AUTHORITY; + private static final Uri BASE_URI = Uri.parse("content://" + CONTENT_AUTHORITY); private static final int DB_VERSION = 2; private static File cacheDir; diff --git a/OpenKeychain/src/main/res/xml/account_desc.xml b/OpenKeychain/src/main/res/xml/account_desc.xml index d29395202..6d8d76b02 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.account" + android:accountType="@string/account_type" 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 6871e1a5d..a134fdebe 100644 --- a/OpenKeychain/src/main/res/xml/sync_adapter_desc.xml +++ b/OpenKeychain/src/main/res/xml/sync_adapter_desc.xml @@ -1,7 +1,7 @@ <?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.account" + android:accountType="@string/account_type" android:supportsUploading="false" android:userVisible="true" android:allowParallelSyncs="false" |