Allow debug build besides release build

This commit is contained in:
Dominik Schürmann 2015-06-10 19:47:29 +02:00
parent e6ea98fabc
commit aa31abd93f
13 changed files with 41 additions and 15 deletions

View File

@ -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"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -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>

View File

@ -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";

View File

@ -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) {
}
}
}

View File

@ -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);

View File

@ -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;

View File

@ -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" />

View File

@ -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"