Added large heap build variant

pull/212/head
M66B 2 years ago
parent 698af0b31e
commit 6449273f0d

@ -55,6 +55,9 @@ android {
github { github {
java.srcDirs = ['src/main/java', 'src/play/java', 'src/extra/java'] java.srcDirs = ['src/main/java', 'src/play/java', 'src/extra/java']
} }
large {
java.srcDirs = ['src/main/java', 'src/play/java', 'src/extra/java']
}
fdroid { fdroid {
java.srcDirs = ['src/main/java', 'src/fdroid/java', 'src/extra/java'] java.srcDirs = ['src/main/java', 'src/fdroid/java', 'src/extra/java']
} }
@ -158,6 +161,30 @@ android {
productFlavors { productFlavors {
github { github {
dimension "all" dimension "all"
manifestPlaceholders.largeHeap = false
buildConfigField "boolean", "TEST_RELEASE", "false"
buildConfigField "boolean", "BETA_RELEASE", "true"
buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
buildConfigField "boolean", "FDROID_RELEASE", "false"
buildConfigField "boolean", "AMAZON_RELEASE", "false"
buildConfigField "String", "PRO_FEATURES_URI", "\"https://email.faircode.eu/donate/\""
buildConfigField "String", "CHANGELOG", "\"https://github.com/M66B/FairEmail/releases/\""
buildConfigField "String", "GITHUB_LATEST_API", "\"https://api.github.com/repos/M66B/FairEmail/releases/latest\""
buildConfigField "String", "GITHUB_LATEST_URI", "\"https://github.com/M66B/FairEmail/releases\""
buildConfigField "String", "BITBUCKET_DOWNLOADS_API", "\"https://api.bitbucket.org/2.0/repositories/M66B/fairemail-test/downloads\""
buildConfigField "String", "BITBUCKET_DOWNLOADS_URI", "\"https://bitbucket.org/M66B/fairemail-test/downloads/\""
buildConfigField "String", "ANNOUNCEMENT_URI", "\"https://gist.githubusercontent.com/M66B/d544192ca56224839d6ba0f2f6314c1f/raw/\""
buildConfigField "String", "CLOUD_URI", "\"https://api.fairemail.net/sync\""
buildConfigField "String", "CLOUD_EMAIL", "\"cloud@in.faircode.eu\""
buildConfigField "String", "TX_URI", localProperties.getProperty("paypal.uri", "\"\"")
buildConfigField "String", "GPA_URI", localProperties.getProperty("gpa.uri", "\"\"")
buildConfigField "String", "INFO_URI", localProperties.getProperty("info.uri", "\"\"")
buildConfigField "String", "DEV_DOMAIN", localProperties.getProperty("dev.domain", "\"\"")
buildConfigField "String", "FDROID", "\"https://f-droid.org/packages/%s/\""
}
large {
dimension "all"
manifestPlaceholders.largeHeap = true
buildConfigField "boolean", "TEST_RELEASE", "false" buildConfigField "boolean", "TEST_RELEASE", "false"
buildConfigField "boolean", "BETA_RELEASE", "true" buildConfigField "boolean", "BETA_RELEASE", "true"
buildConfigField "boolean", "PLAY_STORE_RELEASE", "false" buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
@ -180,6 +207,7 @@ android {
} }
fdroid { fdroid {
dimension "all" dimension "all"
manifestPlaceholders.largeHeap = false
buildConfigField "boolean", "TEST_RELEASE", "false" buildConfigField "boolean", "TEST_RELEASE", "false"
buildConfigField "boolean", "BETA_RELEASE", "true" buildConfigField "boolean", "BETA_RELEASE", "true"
buildConfigField "boolean", "PLAY_STORE_RELEASE", "false" buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
@ -203,6 +231,7 @@ android {
play { play {
dimension "all" dimension "all"
//minSdkVersion 23 //minSdkVersion 23
manifestPlaceholders.largeHeap = false
buildConfigField "boolean", "TEST_RELEASE", "false" buildConfigField "boolean", "TEST_RELEASE", "false"
buildConfigField "boolean", "BETA_RELEASE", "true" buildConfigField "boolean", "BETA_RELEASE", "true"
buildConfigField "boolean", "PLAY_STORE_RELEASE", "true" buildConfigField "boolean", "PLAY_STORE_RELEASE", "true"
@ -226,6 +255,7 @@ android {
amazon { amazon {
dimension "all" dimension "all"
minSdkVersion 23 minSdkVersion 23
manifestPlaceholders.largeHeap = false
buildConfigField "boolean", "TEST_RELEASE", "false" buildConfigField "boolean", "TEST_RELEASE", "false"
buildConfigField "boolean", "BETA_RELEASE", "true" buildConfigField "boolean", "BETA_RELEASE", "true"
buildConfigField "boolean", "PLAY_STORE_RELEASE", "false" buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
@ -251,7 +281,7 @@ android {
variantFilter { variant -> variantFilter { variant ->
def flavors = variant.flavors*.name def flavors = variant.flavors*.name
// Builds: release, debug // Builds: release, debug
// Flavors: github, fdroid, play // Flavors: github, large, fdroid, play
if (variant.buildType.name == "debug" && if (variant.buildType.name == "debug" &&
(flavors.contains("fdroid") || flavors.contains("play") || flavors.contains("_amazon"))) { (flavors.contains("fdroid") || flavors.contains("play") || flavors.contains("_amazon"))) {
setIgnore(true) setIgnore(true)
@ -523,6 +553,7 @@ dependencies {
// https://developer.android.com/google/play/billing/billing_library_releases_notes // https://developer.android.com/google/play/billing/billing_library_releases_notes
// https://android-developers.googleblog.com/2020/06/meet-google-play-billing-library.html // https://android-developers.googleblog.com/2020/06/meet-google-play-billing-library.html
githubImplementation "com.android.billingclient:billing:$billingclient_version" githubImplementation "com.android.billingclient:billing:$billingclient_version"
largeImplementation "com.android.billingclient:billing:$billingclient_version"
playImplementation "com.android.billingclient:billing:$billingclient_version" playImplementation "com.android.billingclient:billing:$billingclient_version"
// https://developer.amazon.com/docs/in-app-purchasing/iap-get-started.html // https://developer.amazon.com/docs/in-app-purchasing/iap-get-started.html

@ -111,6 +111,7 @@
android:fullBackupContent="false" android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:largeHeap="${largeHeap}"
android:networkSecurityConfig="@xml/network_security_config" android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true" android:requestLegacyExternalStorage="true"
android:resizeableActivity="true" android:resizeableActivity="true"

@ -118,6 +118,7 @@
android:fullBackupContent="false" android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:largeHeap="${largeHeap}"
android:networkSecurityConfig="@xml/network_security_config" android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true" android:requestLegacyExternalStorage="true"
android:resizeableActivity="true" android:resizeableActivity="true"

@ -118,6 +118,7 @@
android:fullBackupContent="false" android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:largeHeap="${largeHeap}"
android:networkSecurityConfig="@xml/network_security_config" android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true" android:requestLegacyExternalStorage="true"
android:resizeableActivity="true" android:resizeableActivity="true"

@ -111,6 +111,7 @@
android:fullBackupContent="false" android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:largeHeap="${largeHeap}"
android:networkSecurityConfig="@xml/network_security_config" android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true" android:requestLegacyExternalStorage="true"
android:resizeableActivity="true" android:resizeableActivity="true"

@ -2068,11 +2068,21 @@ public class Log {
Helper.formatDuration(running), Helper.formatDuration(cpu), util)); Helper.formatDuration(running), Helper.formatDuration(cpu), util));
} }
Boolean largeHeap;
try {
ApplicationInfo info = pm.getApplicationInfo(context.getPackageName(), 0);
largeHeap = (info.flags & ApplicationInfo.FLAG_LARGE_HEAP) != 0;
} catch (Throwable ex) {
largeHeap = null;
}
ActivityManager am = Helper.getSystemService(context, ActivityManager.class); ActivityManager am = Helper.getSystemService(context, ActivityManager.class);
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
am.getMemoryInfo(mi); am.getMemoryInfo(mi);
sb.append(String.format("Memory class: %d/%d MB Total: %s\r\n", sb.append(String.format("Memory class: %d/%d Large: %s MB Total: %s\r\n",
am.getMemoryClass(), am.getLargeMemoryClass(), Helper.humanReadableByteCount(mi.totalMem))); am.getMemoryClass(), am.getLargeMemoryClass(),
largeHeap == null ? "?" : Boolean.toString(largeHeap),
Helper.humanReadableByteCount(mi.totalMem)));
long storage_available = Helper.getAvailableStorageSpace(); long storage_available = Helper.getAvailableStorageSpace();
long storage_total = Helper.getTotalStorageSpace(); long storage_total = Helper.getTotalStorageSpace();

@ -111,6 +111,7 @@
android:fullBackupContent="false" android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:largeHeap="${largeHeap}"
android:networkSecurityConfig="@xml/network_security_config" android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true" android:requestLegacyExternalStorage="true"
android:resizeableActivity="true" android:resizeableActivity="true"

Loading…
Cancel
Save