From b3a93528cbcec9e8ad9deb9d7ab593a7e7649ee7 Mon Sep 17 00:00:00 2001
From: SolDev <40839581+SolDev69@users.noreply.github.com>
Date: Thu, 2 May 2024 12:41:47 -0400
Subject: [PATCH] Revert "Revert "Feat[Unpack]: Auto Unpack Jre21""
---
.github/workflows/android.yml | 146 +++++++++---------
.../{JRE17Util.java => JRE21Util.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, 205 insertions(+), 159 deletions(-)
rename app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/{JRE17Util.java => JRE21Util.java} (53%)
create mode 100644 dataremoval.md
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index 8f7a302211..66a8be1a28 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -1,118 +1,112 @@
name: Android CI
-
on:
- pull_request:
- branches-ignore:
- - 'l10n_v3_openjdk2'
- types: [ opened, reopened ]
push:
- branches-ignore:
- - 'l10n_v3_openjdk2'
+ pull_request:
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@v3
-
- - name: Set up JDK 8
- uses: actions/setup-java@v3
- with:
- distribution: 'temurin'
- java-version: '8'
+ uses: actions/checkout@v4
- name: Get JRE 8
- uses: dawidd6/action-download-artifact@v2
+ uses: dawidd6/action-download-artifact@v3
with:
- workflow: build.yml
- path: app_pojavlauncher/src/main/assets/components/jre
+ workflow: buildjre8.yml
+ path: app_pojavlauncher/src/main/assets/components/jre-8
workflow_conclusion: success
- repo: PojavLauncherTeam/android-openjdk-build-multiarch
- branch: buildjre8
+ repo: Vera-Firefly/android-openjdk-autobuild
+ branch: main
name: jre8-pojav
- - name: Get JRE17
- uses: dawidd6/action-download-artifact@v2
+ - name: Get JRE 17
+ uses: dawidd6/action-download-artifact@v3
with:
- workflow: build.yml
- path: app_pojavlauncher/src/main/assets/components/jre-new
+ workflow: buildjre17.yml
+ path: app_pojavlauncher/src/main/assets/components/jre-17
workflow_conclusion: success
- repo: PojavLauncherTeam/android-openjdk-build-multiarch
- branch: buildjre17
+ repo: Vera-Firefly/android-openjdk-autobuild
+ branch: main
name: jre17-pojav
- - uses: gradle/gradle-build-action@v2
+ - name: Get JRE 21
+ uses: dawidd6/action-download-artifact@v3
with:
- gradle-version: 7.6.1
+ 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
- - name: Build JRE JAR files
- run: |
- ./scripts/languagelist_updater.sh
+ - 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
- mkdir out
- # Build JRE JAR files (security manager, etc...)
- gradle :jre_lwjgl3glfw:build --no-daemon
+ - uses: gradle/actions/setup-gradle@v3
+ with:
+ gradle-version: 7.6.1
- name: Set up JDK 17
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- - name: Build Google Play .aab
- if: github.repository_owner == 'PojavLauncherTeam' && github.ref_name == 'v3_openjdk'
+ - name: Build Debug
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: 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
+ - name: Upload Debug
+ uses: actions/upload-artifact@v4
with:
name: app-debug
- path: out/app-debug.*
-
- - name: Upload AAB
- uses: actions/upload-artifact@v3
+ 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
with:
- name: app-release-aab
- path: out/app-gplay.aab
+ workflow: main.yml
+ path: app_pojavlauncher/src/main/assets/components/lwjgl3
+ workflow_conclusion: success
+ repo: Vera-Firefly/lwjgl3-build
+ branch: official
+ name: lwjgl
- - 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
+ - uses: gradle/actions/setup-gradle@v3
with:
- serviceAccountJsonPlainText: ${{ secrets.GPLAY_SERVICE_JSON }}
- packageName: net.kdt.pojavlaunch
- releaseFiles: out/app-gplay.aab
- track: internal
- inAppUpdatePriority: 5
+ gradle-version: 7.6.1
- - name: Upload APK (without runtime)
- uses: actions/upload-artifact@v3
+ - name: Set up JDK 17
+ uses: actions/setup-java@v4
with:
- name: app-debug-noruntime
- path: out/app-debug-noruntime.*
+ distribution: 'temurin'
+ java-version: '17'
+
+ - name: Build Debug-noruntime
+ run: |
+ gradle :app_pojavlauncher:assembleDebug
+ - name: Upload Debug-noruntime
+ uses: actions/upload-artifact@v4
+ with:
+ name: app-debug-noruntime
+ path: app_pojavlauncher/build/outputs/apk/debug/*
diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JRE17Util.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JRE21Util.java
similarity index 53%
rename from app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JRE17Util.java
rename to app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JRE21Util.java
index fcc3dcd32d..27b6070237 100644
--- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JRE17Util.java
+++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JRE21Util.java
@@ -5,7 +5,6 @@
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;
@@ -13,45 +12,42 @@
import java.io.IOException;
-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);
+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);
try {
- 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
+ launcher_jre21_version = Tools.read(assetManager.open("components/jre-21/version"));
+ } catch (IOException exc) {
+ return installed_jre21_version != null;
}
- 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);
+ if(!launcher_jre21_version.equals(installed_jre21_version))
+ return unpackJre21(assetManager, launcher_jre21_version);
else return true;
}
- private static boolean unpackJre17(AssetManager assetManager, String rt_version) {
+ private static boolean unpackJre21(AssetManager assetManager, String rt_version) {
try {
MultiRTUtils.installRuntimeNamedBinpack(
- 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");
+ 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");
return true;
}catch (IOException e) {
- Log.e("JRE17Auto", "Internal JRE unpack failed", e);
+ Log.e("JRE21Auto", "Internal JRE unpack failed", e);
return false;
}
}
- public static boolean isInternalNewJRE(String s_runtime) {
+ public static boolean isInternalJRE21(String s_runtime) {
Runtime runtime = MultiRTUtils.read(s_runtime);
if(runtime == null) return false;
- return NEW_JRE_NAME.equals(runtime.name);
+ return JRE_21_NAME.equals(runtime.name);
}
/** @return true if everything is good, false otherwise. */
- public static boolean installNewJreIfNeeded(Activity activity, JMinecraftVersionList.Version versionInfo) {
- //Now we have the reliable information to check if our runtime settings are good enough
+ public static boolean installJre21IfNeeded(Activity activity, JMinecraftVersionList.Version versionInfo) {
if (versionInfo.javaVersion == null || versionInfo.javaVersion.component.equalsIgnoreCase("jre-legacy"))
return true;
@@ -67,18 +63,18 @@ public static boolean installNewJreIfNeeded(Activity activity, JMinecraftVersion
String appropriateRuntime = MultiRTUtils.getNearestJreName(versionInfo.javaVersion.majorVersion);
if (appropriateRuntime != null) {
- if (JRE17Util.isInternalNewJRE(appropriateRuntime)) {
- JRE17Util.checkInternalNewJre(activity.getAssets());
+ if (JRE21Util.isInternalJRE21(appropriateRuntime)) {
+ JRE21Util.checkInternalJre21(activity.getAssets());
}
minecraftProfile.javaDir = Tools.LAUNCHERPROFILES_RTPREFIX + appropriateRuntime;
LauncherProfiles.load();
} else {
- if (versionInfo.javaVersion.majorVersion <= 17) { // there's a chance we have an internal one for this case
- if (!JRE17Util.checkInternalNewJre(activity.getAssets())){
+ if (versionInfo.javaVersion.majorVersion <= 17) {
+ if (!JRE21Util.checkInternalJre21(activity.getAssets())){
showRuntimeFail(activity, versionInfo);
return false;
} else {
- minecraftProfile.javaDir = Tools.LAUNCHERPROFILES_RTPREFIX + JRE17Util.NEW_JRE_NAME;
+ minecraftProfile.javaDir = Tools.LAUNCHERPROFILES_RTPREFIX + JRE21Util.JRE_21_NAME;
LauncherProfiles.load();
}
} else {
@@ -95,4 +91,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 581183654b..3ef060ebfb 100644
--- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavApplication.java
+++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavApplication.java
@@ -70,6 +70,7 @@ 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 0b13f357d7..ce3b8e9877 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");
+ String current_rt_version = MultiRTUtils.__internal__readBinpackVersion("Internal-8");
try {
- rt_version = Tools.read(am.open("components/jre/version"));
+ rt_version = Tools.read(am.open("components/jre-8/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")/*this clause is for when the internal runtime is goofed*/) return;
+ if(current_rt_version == null && exactJREName != null && !exactJREName.equals("Internal-8")/*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,13 +48,43 @@ public static void unpackRuntime(AssetManager am) {
try {
MultiRTUtils.installRuntimeNamedBinpack(
- am.open("components/jre/universal.tar.xz"),
- am.open("components/jre/bin-" + archAsString(Tools.DEVICE_ARCHITECTURE) + ".tar.xz"),
- "Internal", finalRt_version);
- MultiRTUtils.postPrepare("Internal");
+ 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");
}catch (IOException e) {
- Log.e("JREAuto", "Internal JRE unpack failed", e);
+ Log.e("JREAuto", "Internal-17 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 167c165382..de20fb6cf8 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.JRE17Util;
+import net.kdt.pojavlaunch.JRE21Util;
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 && !JRE17Util.installNewJreIfNeeded(activity, verInfo)){
+ if(activity != null && !JRE21Util.installJre21IfNeeded(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 4e55f27c08..7558399ef3 100644
--- a/app_pojavlauncher/src/main/res/layout/activity_basemain.xml
+++ b/app_pojavlauncher/src/main/res/layout/activity_basemain.xml
@@ -32,6 +32,7 @@
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 6cb31bd994..c68eecd712 100644
--- a/app_pojavlauncher/src/main/res/layout/fragment_launcher.xml
+++ b/app_pojavlauncher/src/main/res/layout/fragment_launcher.xml
@@ -10,51 +10,60 @@
android:orientation="vertical"
android:background="@color/background_app"
>
-
-
-
-
-
-
-
-
-
+ app:layout_constraintBottom_toTopOf="@id/mc_version_spinner">
+
+
+
+
+
+
+
+
+
+
+
+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