- Switched back to java 17
Tracking-Bug: A-4762 (F-Droid builds failing)
So far, we don't depend on any JVM 19 features. This may change in the future and a different solution may be req'd
- Properly fixed race condition
Previously, we tried to unreliably check class name which doesn't work for minified builds
- Migrate a couple things to kotlin
- Refactor http class
- fix chinese traditional

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/27/head
androidacy-user 2 years ago
parent 0c1a3ce8d0
commit 860036014c

@ -28,10 +28,10 @@ jobs:
with:
submodules: true
- name: Set up Java 19
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: 19
java-version: 17
distribution: 'temurin'
- name: Setup Android SDK

@ -287,8 +287,8 @@ android {
compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_19
targetCompatibility = JavaVersion.VERSION_19
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
lint {
@ -393,12 +393,12 @@ dependencies {
implementation("androidx.recyclerview:recyclerview:1.3.0")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
implementation("androidx.webkit:webkit:1.6.1")
implementation("com.google.android.material:material:1.8.0")
implementation("com.google.android.material:material:1.9.0")
implementation("dev.rikka.rikkax.layoutinflater:layoutinflater:1.3.0")
implementation("dev.rikka.rikkax.insets:insets:1.3.0")
implementation("com.github.KieronQuinn:MonetCompat:0.4.1")
implementation("com.github.Fox2Code:FoxCompat:0.2.0")
implementation("com.mikepenz:aboutlibraries:10.6.2")
implementation("com.mikepenz:aboutlibraries:10.6.3")
// Utils
implementation("androidx.work:work-runtime:2.8.1")
@ -427,7 +427,7 @@ dependencies {
implementation("com.github.topjohnwu.libsu:io:${libsuVersion}")
implementation("com.github.Fox2Code:RosettaX:1.0.9")
implementation("com.github.Fox2Code:AndroidANSI:1.0.1")
implementation("com.github.Fox2Code:AndroidANSI:1.2.1")
// sentry
implementation("io.sentry:sentry-android:6.18.1")
@ -492,6 +492,6 @@ android {
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(19))
languageVersion.set(JavaLanguageVersion.of(17))
}
}

@ -32,6 +32,7 @@ import com.fox2code.foxcompat.app.internal.FoxProcessExt;
import com.fox2code.foxcompat.view.FoxThemeWrapper;
import com.fox2code.mmm.installer.InstallerInitializer;
import com.fox2code.mmm.utils.TimberUtils;
import com.fox2code.mmm.utils.io.FileUtils;
import com.fox2code.mmm.utils.io.GMSProviderInstaller;
import com.fox2code.mmm.utils.io.net.Http;
import com.fox2code.mmm.utils.sentry.SentryMain;
@ -392,17 +393,12 @@ public class MainApplication extends FoxApplication implements androidx.work.Con
Timber.i("Starting FoxMMM version %s (%d) - commit %s", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE, BuildConfig.COMMIT_HASH);
// Update SSL Ciphers if update is possible
GMSProviderInstaller.installIfNeeded(this);
// detect if we're launching the crashhandler
// get intent that started the crashhandler
Intent intent = getIntent();
if (intent != null) {
if (intent.getClass().getName().equals("com.fox2code.mmm.CrashHandler")) {
isCrashHandler = true;
}
}
// get intent. if isCrashing is not present or false, call FileUtils.ensureCacheDirs and FileUtils.ensureURLHandler
isCrashHandler = getIntent().getBooleanExtra("isCrashing", false);
if (!isCrashHandler) {
Http.ensureCacheDirs();
Http.ensureURLHandler(getApplicationContext());
FileUtils fileUtils = new FileUtils();
fileUtils.ensureCacheDirs();
fileUtils.ensureURLHandler(this);
}
Timber.d("Initializing FoxMMM");
Timber.d("Started from background: %s", !isInForeground());

@ -590,7 +590,7 @@ public class InstallerActivity extends FoxActivity {
this.useExt = true;
return;
}
s = AnsiParser.patchEscapeSequence(s);
s = AnsiParser.patchEscapeSequences(s);
if (this.useExt && s.startsWith("#!")) {
this.processCommand(s.substring(2));
} else if (this.useRecovery && s.startsWith("progress ")) {

@ -0,0 +1,35 @@
package com.fox2code.mmm.utils.io
import android.content.Context
import com.fox2code.mmm.MainApplication
import org.apache.commons.io.FileUtils
import org.chromium.net.CronetEngine
import timber.log.Timber
import java.io.File
import java.io.IOException
import java.net.URL
class FileUtils {
private var urlFactoryInstalled = false
fun ensureCacheDirs() {
try {
FileUtils.forceMkdir(File((MainApplication.getINSTANCE().dataDir.toString() + "/cache/WebView/Default/HTTP Cache/Code Cache/wasm").replace("//".toRegex(), "/")))
FileUtils.forceMkdir(File((MainApplication.getINSTANCE().dataDir.toString() + "/cache/WebView/Default/HTTP Cache/Code Cache/js").replace("//".toRegex(), "/")))
FileUtils.forceMkdir(File((MainApplication.getINSTANCE().dataDir.toString() + "/cache/cronet").replace("//".toRegex(), "/")))
} catch (e: IOException) {
Timber.e("Could not create cache dirs")
}
}
fun ensureURLHandler(context: Context?) {
if (!urlFactoryInstalled) {
try {
URL.setURLStreamHandlerFactory(CronetEngine.Builder(context).build().createURLStreamHandlerFactory())
urlFactoryInstalled = true
} catch (ignored: Error) {
// Ignore
}
}
}
}

@ -29,7 +29,6 @@ import com.fox2code.mmm.utils.io.Files;
import com.google.android.material.snackbar.Snackbar;
import com.google.net.cronet.okhttptransport.CronetInterceptor;
import org.apache.commons.io.FileUtils;
import org.chromium.net.CronetEngine;
import java.io.ByteArrayOutputStream;
@ -38,7 +37,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.Proxy;
import java.net.URL;
import java.net.UnknownHostException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@ -78,7 +76,6 @@ public enum Http {
private static final boolean hasWebView;
private static String needCaptchaAndroidacyHost;
private static boolean doh;
private static boolean urlFactoryInstalled;
static {
MainApplication mainApplication = MainApplication.getINSTANCE();
@ -396,27 +393,6 @@ public enum Http {
return hasWebView;
}
public static void ensureCacheDirs() {
try {
FileUtils.forceMkdir(new File((MainApplication.getINSTANCE().getDataDir() + "/cache/WebView/Default/HTTP Cache/Code Cache/wasm").replaceAll("//", "/")));
FileUtils.forceMkdir(new File((MainApplication.getINSTANCE().getDataDir() + "/cache/WebView/Default/HTTP Cache/Code Cache/js").replaceAll("//", "/")));
FileUtils.forceMkdir(new File((MainApplication.getINSTANCE().getDataDir() + "/cache/cronet").replaceAll("//", "/")));
} catch (IOException e) {
Timber.e("Could not create cache dirs");
}
}
public static void ensureURLHandler(Context context) {
if (!urlFactoryInstalled) {
try {
URL.setURLStreamHandlerFactory(new CronetEngine.Builder(context).build().createURLStreamHandlerFactory());
urlFactoryInstalled = true;
} catch (Error ignored) {
// Ignore
}
}
}
public static boolean hasConnectivity() {
// Check if we have internet connection
Timber.d("Checking internet connection...");

@ -53,6 +53,8 @@ public class SentryMain {
intent.putExtra("sentryException", throwable);
// pass crashReportingEnabled to crash handler
intent.putExtra("crashReportingEnabled", isSentryEnabled());
// add isCrashing to intent
intent.putExtra("isCrashing", isCrashing);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
Timber.e("Starting crash handler");
mainApplication.startActivity(intent);

@ -14,7 +14,7 @@ buildscript {
set("sentryVersion", "6.18.1")
}
dependencies {
classpath("com.android.tools.build:gradle:8.0.0")
classpath("com.android.tools.build:gradle:8.0.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21")
classpath("com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:10.6.2")

Loading…
Cancel
Save