From 5b8abf82dc38e84903102a239307c13f65ae3a12 Mon Sep 17 00:00:00 2001 From: SolDev <40839581+SolDev69@users.noreply.github.com> Date: Thu, 2 May 2024 12:19:43 -0400 Subject: [PATCH] Revert "Feat[Unpack]: Auto Unpack Jre21" --- .github/workflows/android.yml | 146 +++++++++--------- .../{JRE21Util.java => JRE17Util.java} | 54 ++++--- .../net/kdt/pojavlaunch/PojavApplication.java | 1 - .../pojavlaunch/tasks/AsyncAssetManager.java | 48 ++---- .../tasks/MinecraftDownloader.java | 4 +- .../src/main/res/layout/activity_basemain.xml | 1 - .../src/main/res/layout/fragment_launcher.xml | 95 ++++++------ dataremoval.md | 15 -- 8 files changed, 159 insertions(+), 205 deletions(-) rename app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/{JRE21Util.java => JRE17Util.java} (53%) delete mode 100644 dataremoval.md diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 66a8be1a28..8f7a302211 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -1,112 +1,118 @@ name: Android CI + on: - push: pull_request: + branches-ignore: + - 'l10n_v3_openjdk2' + types: [ opened, reopened ] + push: + branches-ignore: + - 'l10n_v3_openjdk2' workflow_dispatch: jobs: build: runs-on: ubuntu-22.04 env: + GPLAY_KEYSTORE_PASSWORD: ${{ secrets.GPLAY_KEYSTORE_PASSWORD }} CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }} steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v3 + + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '8' - name: Get JRE 8 - uses: dawidd6/action-download-artifact@v3 + uses: dawidd6/action-download-artifact@v2 with: - workflow: buildjre8.yml - path: app_pojavlauncher/src/main/assets/components/jre-8 + workflow: build.yml + path: app_pojavlauncher/src/main/assets/components/jre workflow_conclusion: success - repo: Vera-Firefly/android-openjdk-autobuild - branch: main + repo: PojavLauncherTeam/android-openjdk-build-multiarch + branch: buildjre8 name: jre8-pojav - - name: Get JRE 17 - uses: dawidd6/action-download-artifact@v3 + - name: Get JRE17 + uses: dawidd6/action-download-artifact@v2 with: - workflow: buildjre17.yml - path: app_pojavlauncher/src/main/assets/components/jre-17 + workflow: build.yml + path: app_pojavlauncher/src/main/assets/components/jre-new workflow_conclusion: success - repo: Vera-Firefly/android-openjdk-autobuild - branch: main + repo: PojavLauncherTeam/android-openjdk-build-multiarch + branch: buildjre17 name: jre17-pojav - - name: Get JRE 21 - uses: dawidd6/action-download-artifact@v3 + - uses: gradle/gradle-build-action@v2 with: - workflow: buildjre21.yml - path: app_pojavlauncher/src/main/assets/components/jre-21 - workflow_conclusion: success - repo: Vera-Firefly/android-openjdk-autobuild - branch: main - name: jre21-pojav + gradle-version: 7.6.1 - - name: Get LWJGL3 - uses: dawidd6/action-download-artifact@v3 - with: - workflow: main.yml - path: app_pojavlauncher/src/main/assets/components/lwjgl3 - workflow_conclusion: success - repo: Vera-Firefly/lwjgl3-build - branch: official - name: lwjgl + - name: Build JRE JAR files + run: | + ./scripts/languagelist_updater.sh - - uses: gradle/actions/setup-gradle@v3 - with: - gradle-version: 7.6.1 + mkdir out + # Build JRE JAR files (security manager, etc...) + gradle :jre_lwjgl3glfw:build --no-daemon - name: Set up JDK 17 - uses: actions/setup-java@v4 + uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: '17' - - name: Build Debug + - name: Build Google Play .aab + if: github.repository_owner == 'PojavLauncherTeam' && github.ref_name == 'v3_openjdk' run: | + gradle :app_pojavlauncher:bundleGplay + mv app_pojavlauncher/build/outputs/bundle/gplay/app_pojavlauncher-gplay.aab out/app-gplay.aab + + - name: Build Debug .apk + run: | + # Build the launcher gradle :app_pojavlauncher:assembleDebug + mv app_pojavlauncher/build/outputs/apk/debug/app_pojavlauncher-debug.apk out/app-debug.apk - - name: Upload Debug - uses: actions/upload-artifact@v4 + - name: Build APK without runtime + run: | + rm -r app_pojavlauncher/src/main/assets/components/jre + rm -r app_pojavlauncher/src/main/assets/components/jre-new + gradle assembleDebug + mv app_pojavlauncher/build/outputs/apk/debug/app_pojavlauncher-debug.apk out/app-debug-noruntime.apk + - name: Gen md5sums + run: | + md5sum out/app-debug.apk > out/app-debug.md5 + md5sum out/app-debug-noruntime.apk > out/app-debug-noruntime.md5 + + - name: Upload APK + uses: actions/upload-artifact@v3 with: name: app-debug - path: app_pojavlauncher/build/outputs/apk/debug/* - - buildnoruntime: - runs-on: ubuntu-22.04 - env: - CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Get LWJGL3 - uses: dawidd6/action-download-artifact@v3 + path: out/app-debug.* + + - name: Upload AAB + uses: actions/upload-artifact@v3 with: - workflow: main.yml - path: app_pojavlauncher/src/main/assets/components/lwjgl3 - workflow_conclusion: success - repo: Vera-Firefly/lwjgl3-build - branch: official - name: lwjgl + name: app-release-aab + path: out/app-gplay.aab - - uses: gradle/actions/setup-gradle@v3 + - name: Upload onto the Google Play testing track + continue-on-error: true + if: github.repository_owner == 'PojavLauncherTeam' && github.ref_name == 'v3_openjdk' + uses: r0adkll/upload-google-play@v1.1.2 with: - gradle-version: 7.6.1 + serviceAccountJsonPlainText: ${{ secrets.GPLAY_SERVICE_JSON }} + packageName: net.kdt.pojavlaunch + releaseFiles: out/app-gplay.aab + track: internal + inAppUpdatePriority: 5 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - - - name: Build Debug-noruntime - run: | - gradle :app_pojavlauncher:assembleDebug - - - name: Upload Debug-noruntime - uses: actions/upload-artifact@v4 + - name: Upload APK (without runtime) + uses: actions/upload-artifact@v3 with: name: app-debug-noruntime - path: app_pojavlauncher/build/outputs/apk/debug/* + path: out/app-debug-noruntime.* + diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JRE21Util.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JRE17Util.java similarity index 53% rename from app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JRE21Util.java rename to app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JRE17Util.java index 27b6070237..fcc3dcd32d 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JRE21Util.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JRE17Util.java @@ -5,6 +5,7 @@ import android.app.Activity; import android.content.res.AssetManager; import android.util.Log; + import net.kdt.pojavlaunch.multirt.MultiRTUtils; import net.kdt.pojavlaunch.multirt.Runtime; import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles; @@ -12,42 +13,45 @@ import java.io.IOException; -public class JRE21Util { - public static final String JRE_21_NAME = "Internal-21"; - public static boolean checkInternalJre21(AssetManager assetManager) { - String launcher_jre21_version; - String installed_jre21_version = MultiRTUtils.__internal__readBinpackVersion(JRE_21_NAME); +public class JRE17Util { + public static final String NEW_JRE_NAME = "Internal-17"; + public static boolean checkInternalNewJre(AssetManager assetManager) { + String launcher_jre17_version; + String installed_jre17_version = MultiRTUtils.__internal__readBinpackVersion(NEW_JRE_NAME); try { - launcher_jre21_version = Tools.read(assetManager.open("components/jre-21/version")); - } catch (IOException exc) { - return installed_jre21_version != null; + launcher_jre17_version = Tools.read(assetManager.open("components/jre-new/version")); + }catch (IOException exc) { + //we don't have a runtime included! + return installed_jre17_version != null; //if we have one installed -> return true -> proceed (no updates but the current one should be functional) + //if we don't -> return false -> Cannot find compatible Java runtime } - if(!launcher_jre21_version.equals(installed_jre21_version)) - return unpackJre21(assetManager, launcher_jre21_version); + if(!launcher_jre17_version.equals(installed_jre17_version)) // this implicitly checks for null, so it will unpack the runtime even if we don't have one installed + return unpackJre17(assetManager, launcher_jre17_version); else return true; } - private static boolean unpackJre21(AssetManager assetManager, String rt_version) { + private static boolean unpackJre17(AssetManager assetManager, String rt_version) { try { MultiRTUtils.installRuntimeNamedBinpack( - assetManager.open("components/jre-21/universal.tar.xz"), - assetManager.open("components/jre-21/bin-" + archAsString(Tools.DEVICE_ARCHITECTURE) + ".tar.xz"), - "Internal-21", rt_version); - MultiRTUtils.postPrepare("Internal-21"); + assetManager.open("components/jre-new/universal.tar.xz"), + assetManager.open("components/jre-new/bin-" + archAsString(Tools.DEVICE_ARCHITECTURE) + ".tar.xz"), + "Internal-17", rt_version); + MultiRTUtils.postPrepare("Internal-17"); return true; }catch (IOException e) { - Log.e("JRE21Auto", "Internal JRE unpack failed", e); + Log.e("JRE17Auto", "Internal JRE unpack failed", e); return false; } } - public static boolean isInternalJRE21(String s_runtime) { + public static boolean isInternalNewJRE(String s_runtime) { Runtime runtime = MultiRTUtils.read(s_runtime); if(runtime == null) return false; - return JRE_21_NAME.equals(runtime.name); + return NEW_JRE_NAME.equals(runtime.name); } /** @return true if everything is good, false otherwise. */ - public static boolean installJre21IfNeeded(Activity activity, JMinecraftVersionList.Version versionInfo) { + public static boolean installNewJreIfNeeded(Activity activity, JMinecraftVersionList.Version versionInfo) { + //Now we have the reliable information to check if our runtime settings are good enough if (versionInfo.javaVersion == null || versionInfo.javaVersion.component.equalsIgnoreCase("jre-legacy")) return true; @@ -63,18 +67,18 @@ public static boolean installJre21IfNeeded(Activity activity, JMinecraftVersionL String appropriateRuntime = MultiRTUtils.getNearestJreName(versionInfo.javaVersion.majorVersion); if (appropriateRuntime != null) { - if (JRE21Util.isInternalJRE21(appropriateRuntime)) { - JRE21Util.checkInternalJre21(activity.getAssets()); + if (JRE17Util.isInternalNewJRE(appropriateRuntime)) { + JRE17Util.checkInternalNewJre(activity.getAssets()); } minecraftProfile.javaDir = Tools.LAUNCHERPROFILES_RTPREFIX + appropriateRuntime; LauncherProfiles.load(); } else { - if (versionInfo.javaVersion.majorVersion <= 17) { - if (!JRE21Util.checkInternalJre21(activity.getAssets())){ + if (versionInfo.javaVersion.majorVersion <= 17) { // there's a chance we have an internal one for this case + if (!JRE17Util.checkInternalNewJre(activity.getAssets())){ showRuntimeFail(activity, versionInfo); return false; } else { - minecraftProfile.javaDir = Tools.LAUNCHERPROFILES_RTPREFIX + JRE21Util.JRE_21_NAME; + minecraftProfile.javaDir = Tools.LAUNCHERPROFILES_RTPREFIX + JRE17Util.NEW_JRE_NAME; LauncherProfiles.load(); } } else { @@ -91,4 +95,4 @@ private static void showRuntimeFail(Activity activity, JMinecraftVersionList.Ver activity.getString(R.string.multirt_nocompatiblert, verInfo.javaVersion.majorVersion)); } -} +} \ No newline at end of file diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavApplication.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavApplication.java index 3ef060ebfb..581183654b 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavApplication.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavApplication.java @@ -70,7 +70,6 @@ public void onCreate() { .concat("/x86"); } AsyncAssetManager.unpackRuntime(getAssets()); - AsyncAssetManager.unpackRuntime17(getAssets()); } catch (Throwable throwable) { Intent ferrorIntent = new Intent(this, FatalErrorActivity.class); ferrorIntent.putExtra("throwable", throwable); diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/AsyncAssetManager.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/AsyncAssetManager.java index ce3b8e9877..0b13f357d7 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/AsyncAssetManager.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/AsyncAssetManager.java @@ -1,7 +1,7 @@ package net.kdt.pojavlaunch.tasks; + import static net.kdt.pojavlaunch.Architecture.archAsString; -import static net.kdt.pojavlaunch.JRE21Util.checkInternalJre21; import static net.kdt.pojavlaunch.PojavApplication.sExecutorService; import android.content.Context; @@ -31,14 +31,14 @@ private AsyncAssetManager(){} public static void unpackRuntime(AssetManager am) { /* Check if JRE is included */ String rt_version = null; - String current_rt_version = MultiRTUtils.__internal__readBinpackVersion("Internal-8"); + String current_rt_version = MultiRTUtils.__internal__readBinpackVersion("Internal"); try { - rt_version = Tools.read(am.open("components/jre-8/version")); + rt_version = Tools.read(am.open("components/jre/version")); } catch (IOException e) { Log.e("JREAuto", "JRE was not included on this APK.", e); } String exactJREName = MultiRTUtils.getExactJreName(8); - if(current_rt_version == null && exactJREName != null && !exactJREName.equals("Internal-8")/*this clause is for when the internal runtime is goofed*/) return; + if(current_rt_version == null && exactJREName != null && !exactJREName.equals("Internal")/*this clause is for when the internal runtime is goofed*/) return; if(rt_version == null) return; if(rt_version.equals(current_rt_version)) return; @@ -48,43 +48,13 @@ public static void unpackRuntime(AssetManager am) { try { MultiRTUtils.installRuntimeNamedBinpack( - am.open("components/jre-8/universal.tar.xz"), - am.open("components/jre-8/bin-" + archAsString(Tools.DEVICE_ARCHITECTURE) + ".tar.xz"), - "Internal-8", finalRt_version); - MultiRTUtils.postPrepare("Internal-8"); - }catch (IOException e) { - Log.e("JREAuto", "Internal-8 JRE unpack failed", e); - } - }); - } - - public static void unpackRuntime17(AssetManager am) { - String rt_version = null; - String current_rt_version = MultiRTUtils.__internal__readBinpackVersion("Internal-17"); - try { - rt_version = Tools.read(am.open("components/jre-17/version")); - } catch (IOException e) { - Log.e("JREAuto", "JRE was not included on this APK.", e); - } - String exactJREName = MultiRTUtils.getExactJreName(17); - if(current_rt_version == null && exactJREName != null && !exactJREName.equals("Internal-17")) return; - if(rt_version == null) return; - if(rt_version.equals(current_rt_version)) return; - - String finalRt_version = rt_version; - sExecutorService.execute(() -> { - - try { - MultiRTUtils.installRuntimeNamedBinpack( - am.open("components/jre-17/universal.tar.xz"), - am.open("components/jre-17/bin-" + archAsString(Tools.DEVICE_ARCHITECTURE) + ".tar.xz"), - "Internal-17", finalRt_version); - MultiRTUtils.postPrepare("Internal-17"); + am.open("components/jre/universal.tar.xz"), + am.open("components/jre/bin-" + archAsString(Tools.DEVICE_ARCHITECTURE) + ".tar.xz"), + "Internal", finalRt_version); + MultiRTUtils.postPrepare("Internal"); }catch (IOException e) { - Log.e("JREAuto", "Internal-17 JRE unpack failed", e); + Log.e("JREAuto", "Internal JRE unpack failed", e); } - - checkInternalJre21(am); }); } diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/MinecraftDownloader.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/MinecraftDownloader.java index de20fb6cf8..167c165382 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/MinecraftDownloader.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/MinecraftDownloader.java @@ -13,7 +13,7 @@ import net.kdt.pojavlaunch.JAssetInfo; import net.kdt.pojavlaunch.JAssets; import net.kdt.pojavlaunch.JMinecraftVersionList; -import net.kdt.pojavlaunch.JRE21Util; +import net.kdt.pojavlaunch.JRE17Util; import net.kdt.pojavlaunch.R; import net.kdt.pojavlaunch.Tools; import net.kdt.pojavlaunch.mirrors.DownloadMirror; @@ -203,7 +203,7 @@ private boolean downloadAndProcessMetadata(Activity activity, JMinecraftVersionL throw new IOException("Unable to read Version JSON for version " + versionName); } - if(activity != null && !JRE21Util.installJre21IfNeeded(activity, verInfo)){ + if(activity != null && !JRE17Util.installNewJreIfNeeded(activity, verInfo)){ return false; } diff --git a/app_pojavlauncher/src/main/res/layout/activity_basemain.xml b/app_pojavlauncher/src/main/res/layout/activity_basemain.xml index 7558399ef3..4e55f27c08 100644 --- a/app_pojavlauncher/src/main/res/layout/activity_basemain.xml +++ b/app_pojavlauncher/src/main/res/layout/activity_basemain.xml @@ -32,7 +32,6 @@ android:orientation="vertical" android:id="@+id/main_touchpad" android:focusable="false" - android:translationZ="1dp" android:visibility="gone"/> diff --git a/app_pojavlauncher/src/main/res/layout/fragment_launcher.xml b/app_pojavlauncher/src/main/res/layout/fragment_launcher.xml index c68eecd712..6cb31bd994 100644 --- a/app_pojavlauncher/src/main/res/layout/fragment_launcher.xml +++ b/app_pojavlauncher/src/main/res/layout/fragment_launcher.xml @@ -10,60 +10,51 @@ android:orientation="vertical" android:background="@color/background_app" > - - - - - - - - - - - + /> + + + + + + + - -If you wish to remove a local account or a Microsoft account from the launcher:
-1. Select the account that you wish to remove in the account selector -2. Press the trash bin button -3. All account data stored in the launcher will be removed immediately. -
- -Your account data is not shared with any third parties (except Microsoft, of course)
-If you need to remove all of your Microsoft account data, go to:
-https://aka.ms/CloseAccount