mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 08:35:37 -04:00
Use Android 5.0 APIs
This commit is contained in:
parent
62533deb39
commit
27c2cbc2b1
@ -101,7 +101,7 @@ public class JREUtils
|
||||
setEnvironment(launchType, "LIBGL_MIPMAP", "3");
|
||||
setEnvironment(launchType, "MESA_GLSL_CACHE_DIR", ctx.getCacheDir().getAbsolutePath());
|
||||
setEnvironment(launchType, "LD_LIBRARY_PATH", ldLibraryPath);
|
||||
setEnvironment(launchType, "PATH", Tools.homeJreDir + "/bin:" + getBridgeOs("getenv", "PATH"));
|
||||
setEnvironment(launchType, "PATH", Tools.homeJreDir + "/bin:" + Os.getenv("PATH"));
|
||||
|
||||
setEnvironment(launchType, "REGAL_GL_VENDOR", "Android");
|
||||
setEnvironment(launchType, "REGAL_GL_RENDERER", "Regal");
|
||||
@ -121,38 +121,10 @@ public class JREUtils
|
||||
if (launchType == Tools.LTYPE_PROCESS) {
|
||||
Tools.mLaunchShell.writeToProcess("export " + name + "=" + value);
|
||||
} else {
|
||||
// Libcore one support all Android versions
|
||||
getBridgeOs("setenv", name, value, true);
|
||||
// Class.forName("libcore.io.Os").getMethod("setenv", String.class, String.class, boolean.class).invoke(null, name, value, true);
|
||||
/*
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
Class.forName("libcore.io.Os").getMethod("setenv").invoke(null, name, value, true);
|
||||
} else {
|
||||
Class.forName("android.system.Os").getMethod("setenv").invoke(null, name, value, true);
|
||||
}
|
||||
*/
|
||||
Os.setenv(name, value, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static Object getBridgeOs(String methodName, Object... objs) throws Throwable {
|
||||
Class[] classes = new Class[objs.length];
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
if (objs[i] instanceof Boolean) {
|
||||
classes[i] = boolean.class;
|
||||
} else {
|
||||
classes[i] = objs[i].getClass();
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
Class libcoreClass = Class.forName("libcore.io.Libcore");
|
||||
Object libcoreOs = libcoreClass.getField("os").get(null);
|
||||
return Class.forName("libcore.io.Os").getMethod(methodName, classes).invoke(libcoreOs, objs);
|
||||
} else {
|
||||
// Avoid Android < 5 get ClassNotFoundException
|
||||
return Class.forName("android.system.Os").getMethod(methodName, classes).invoke(null, objs);
|
||||
}
|
||||
}
|
||||
|
||||
public static native int chdir(String path);
|
||||
public static native boolean dlopen(String libPath);
|
||||
public static native void redirectLogcat();
|
||||
|
@ -23,6 +23,7 @@ import org.apache.commons.compress.compressors.xz.*;
|
||||
import org.apache.commons.io.*;
|
||||
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.system.*;
|
||||
|
||||
public class PojavLoginActivity extends AppCompatActivity
|
||||
// MineActivity
|
||||
@ -441,7 +442,7 @@ public class PojavLoginActivity extends AppCompatActivity
|
||||
try {
|
||||
// android.system.Os
|
||||
// Libcore one support all Android versions
|
||||
JREUtils.getBridgeOs("symlink", tarEntry.getName(), tarEntry.getLinkName());
|
||||
Os.symlink(tarEntry.getName(), tarEntry.getLinkName());
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
package net.kdt.pojavlaunch;
|
||||
|
||||
import android.support.v7.app.*;
|
||||
import android.os.*;
|
||||
|
||||
public class V3LauncherActivity extends AppCompatActivity
|
||||
{
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user