mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-18 00:59:35 -04:00
JRE lib path improvement
This commit is contained in:
parent
96491e143f
commit
9b4d43d72d
@ -18,7 +18,7 @@ public class JREUtils
|
||||
|
||||
private static String nativeLibDir;
|
||||
|
||||
private static String findInLdLibPath(String libName) {
|
||||
public static String findInLdLibPath(String libName) {
|
||||
for (String libPath : Os.getenv("LD_LIBRARY_PATH").split(":")) {
|
||||
File f = new File(libPath, libName);
|
||||
if (f.exists() && f.isFile()) {
|
||||
@ -121,10 +121,10 @@ public class JREUtils
|
||||
|
||||
public static void setJavaEnvironment(Context ctx, int launchType) throws Throwable {
|
||||
nativeLibDir = ctx.getApplicationInfo().nativeLibraryDir;
|
||||
String libName = System.getProperty("os.arch").contains("64") ? "lib64" : "lib";
|
||||
String libName = Tools.currentArch.contains("64") ? "lib64" : "lib";
|
||||
|
||||
StringBuilder ldLibraryPath = new StringBuilder();
|
||||
|
||||
/*
|
||||
for (String arch : Tools.currentArch.split("/")) {
|
||||
File f = new File(Tools.homeJreDir + "/lib/" + arch);
|
||||
if (f.exists() && f.isDirectory()) {
|
||||
@ -133,15 +133,14 @@ public class JREUtils
|
||||
ldLibraryPath.append(Tools.homeJreDir + "/lib/" + arch + ":");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (ldLibraryPath.length() == 0) {
|
||||
ldLibraryPath.append(
|
||||
// To make libjli.so ignore re-execute
|
||||
Tools.homeJreDir + "/lib/server:" +
|
||||
Tools.homeJreDir + "/lib/jli:" +
|
||||
Tools.homeJreDir + "/lib:"
|
||||
Tools.homeJreDir + "/" + Tools.homeJreLib + "/server:" +
|
||||
Tools.homeJreDir + "/" + Tools.homeJreLib + "/lib/jli:" +
|
||||
Tools.homeJreDir + "/" + Tools.homeJreLib + ":"
|
||||
);
|
||||
}
|
||||
|
||||
ldLibraryPath.append(
|
||||
"/system/" + libName + ":" +
|
||||
|
@ -83,70 +83,8 @@ public class PojavLoginActivity extends AppCompatActivity
|
||||
|
||||
private void init() {
|
||||
firstLaunchPrefs = getSharedPreferences("pojav_extract", MODE_PRIVATE);
|
||||
|
||||
// Remove vmos warning???
|
||||
/*
|
||||
if (isAndroid7() && !firstLaunchPrefs.getBoolean(PREF_IS_DONOTSHOWAGAIN_WARN, false)) {
|
||||
AlertDialog.Builder startDlg = new AlertDialog.Builder(PojavLoginActivity.this);
|
||||
startDlg.setTitle(R.string.warning_title);
|
||||
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
|
||||
|
||||
LinearLayout conLay = new LinearLayout(this);
|
||||
conLay.setLayoutParams(params);
|
||||
conLay.setOrientation(LinearLayout.VERTICAL);
|
||||
TextView conText = new TextView(this);
|
||||
conText.setText(R.string.warning_msg);
|
||||
conText.setLayoutParams(params);
|
||||
final CheckBox conCheck = new CheckBox(this);
|
||||
conCheck.setText(R.string.warning_noshowagain);
|
||||
conCheck.setLayoutParams(params);
|
||||
conLay.addView(conCheck);
|
||||
|
||||
conLay.addView(conText);
|
||||
|
||||
startDlg.setView(conLay);
|
||||
startDlg.setCancelable(false);
|
||||
startDlg.setPositiveButton(R.string.warning_action_install, new DialogInterface.OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface p1, int p2)
|
||||
{
|
||||
setPref(PREF_IS_DONOTSHOWAGAIN_WARN, conCheck.isChecked());
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse("market://details?id=com.vmos.glb"));
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
startDlg.setNegativeButton(R.string.warning_action_tryanyway, new DialogInterface.OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface p1, int p2)
|
||||
{
|
||||
setPref(PREF_IS_DONOTSHOWAGAIN_WARN, conCheck.isChecked());
|
||||
|
||||
new InitTask().execute();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
startDlg.setNeutralButton(R.string.warning_action_exit, new DialogInterface.OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface p1, int p2)
|
||||
{
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
startDlg.show();
|
||||
} else {
|
||||
*/
|
||||
new InitTask().execute();
|
||||
// }
|
||||
}
|
||||
|
||||
private class InitTask extends AsyncTask<Void, String, Integer>{
|
||||
private AlertDialog startAle;
|
||||
@ -348,17 +286,23 @@ public class PojavLoginActivity extends AppCompatActivity
|
||||
File jreTarFile = selectJreTarFile();
|
||||
uncompressTarXZ(jreTarFile, new File(Tools.homeJreDir));
|
||||
|
||||
File ftIn = new File(Tools.homeJreDir, "lib/libfreetype.so.6");
|
||||
File ftOut = new File(Tools.homeJreDir, "lib/libfreetype.so");
|
||||
if (ftIn.exists() && (!ftOut.exists() || ftIn.length() != ftOut.length())) {
|
||||
IOUtils.copy(
|
||||
new FileInputStream(ftIn),
|
||||
new FileOutputStream(ftOut)
|
||||
);
|
||||
}
|
||||
setPref(PREF_IS_INSTALLED_JAVARUNTIME, true);
|
||||
}
|
||||
|
||||
for (String arch : Tools.currentArch.split("/")) {
|
||||
File f = new File(Tools.homeJreDir + "/lib/" + arch);
|
||||
if (f.exists() && f.isDirectory()) {
|
||||
Tools.homeJreLib = "lib/" + arch;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
File ftIn = new File(Tools.homeJreDir, Tools.homeJreLib + "/libfreetype.so.6");
|
||||
File ftOut = new File(Tools.homeJreDir, Tools.homeJreLib + "/libfreetype.so");
|
||||
if (ftIn.exists() && (!ftOut.exists() || ftIn.length() != ftOut.length())) {
|
||||
ftIn.renameTo(ftOut);
|
||||
}
|
||||
|
||||
// Refresh libraries
|
||||
copyDummyNativeLib("libawt_xawt.so");
|
||||
copyDummyNativeLib("libfontconfig.so");
|
||||
@ -369,7 +313,7 @@ public class PojavLoginActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
private void copyDummyNativeLib(String name) throws Throwable {
|
||||
File fileLib = new File(Tools.homeJreDir, "lib/" + name);
|
||||
File fileLib = new File(Tools.homeJreDir, Tools.homeJreLib + "/" + name);
|
||||
fileLib.delete();
|
||||
IOUtils.copy(
|
||||
new FileInputStream(new File(getApplicationInfo().nativeLibraryDir, name)),
|
||||
|
@ -38,6 +38,7 @@ public final class Tools
|
||||
|
||||
// New since 3.0.0
|
||||
public static String homeJreDir = datapath + "/jre_runtime";
|
||||
public static String homeJreLib = "lib";
|
||||
|
||||
// New since 2.4.2
|
||||
public static String versnDir = MAIN_PATH + "/versions";
|
||||
|
Loading…
x
Reference in New Issue
Block a user