mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-04-18 16:46:58 -04:00
Fix install OpenJDK error, fix Cườm controls crash
This commit is contained in:
@@ -8,8 +8,8 @@ android {
|
||||
applicationId "net.kdt.pojavlaunch"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 25
|
||||
versionCode 3
|
||||
versionName "3.0.1_preview1_b4_20200108"
|
||||
versionCode 5
|
||||
versionName "3.0.1_preview1_b5_20200509"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
||||
@@ -135,7 +135,7 @@ public class PojavLoginActivity extends MineActivity
|
||||
startAle.getWindow().setGravity(Gravity.CENTER);
|
||||
}
|
||||
|
||||
private int revokeCount = -1;
|
||||
private int deniedCount = -1;
|
||||
private File oldOpenjdkFolder, newOpenjdkFolder;
|
||||
@Override
|
||||
protected Integer doInBackground(Void[] p1)
|
||||
@@ -150,8 +150,8 @@ public class PojavLoginActivity extends MineActivity
|
||||
|
||||
while (Build.VERSION.SDK_INT >= 23 && !isStorageAllowed()){
|
||||
try {
|
||||
revokeCount++;
|
||||
if (revokeCount >= 3) {
|
||||
deniedCount++;
|
||||
if (deniedCount >= 3) {
|
||||
Toast.makeText(PojavLoginActivity.this, R.string.toast_permission_denied, Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
}
|
||||
@@ -168,6 +168,7 @@ public class PojavLoginActivity extends MineActivity
|
||||
|
||||
oldOpenjdkFolder = new File(Tools.datapath, "jre_old");
|
||||
newOpenjdkFolder = new File(Tools.datapath, "jre");
|
||||
newOpenjdkFolder.mkdir();
|
||||
|
||||
final StringBuilder shellLog = new StringBuilder();
|
||||
|
||||
@@ -216,7 +217,7 @@ public class PojavLoginActivity extends MineActivity
|
||||
}
|
||||
// END download openjdk
|
||||
|
||||
publishProgress(null, getString(R.string.openjdk_install_unpack_main));
|
||||
publishProgress("i1", getString(R.string.openjdk_install_unpack_main));
|
||||
shellLog.setLength(0);
|
||||
|
||||
unpackOpenJDK(shellLog, shell, openjdkTar, false);
|
||||
@@ -257,7 +258,7 @@ public class PojavLoginActivity extends MineActivity
|
||||
}
|
||||
|
||||
// Grant execute permission
|
||||
Runtime.getRuntime().exec("chmod -R 700 " + newOpenjdkFolder.getAbsolutePath());
|
||||
shell.writeToProcess("chmod -R 700 " + newOpenjdkFolder.getAbsolutePath());
|
||||
} catch (final Throwable th) {
|
||||
// Tools.showError(PojavLoginActivity.this, th);
|
||||
runOnUiThread(new Runnable(){
|
||||
@@ -292,7 +293,7 @@ public class PojavLoginActivity extends MineActivity
|
||||
shellLog.append(text);
|
||||
}
|
||||
// `Tools.datapath` instead of `Tools.homeJreDir` because tar.gz contains `jre` as root folder.
|
||||
}, "sh -c \"" + Tools.worksDir + "/busybox tar xvzf " + openjdkTar.getAbsolutePath() + " -C " + Tools.datapath + "\"");
|
||||
}, /* "/system/bin/sh -c " + */ Tools.worksDir + "/busybox tar xvzf " + openjdkTar.getAbsolutePath() + " -C " + Tools.datapath + "");
|
||||
extractShell.initInputStream(PojavLoginActivity.this);
|
||||
|
||||
int exitCode = extractShell.waitFor();
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ControlsLayout extends FrameLayout
|
||||
}
|
||||
|
||||
public void hideAllHandleViews() {
|
||||
for (final ControlView view : mControlViewList) {
|
||||
for (ControlView view : getControlViewArray()) {
|
||||
view.getHandleView().hide();
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class ControlsLayout extends FrameLayout
|
||||
mLayout = controlLayout;
|
||||
|
||||
// Safety remove only ControlView views
|
||||
for (ControlView view : mControlViewList) {
|
||||
for (ControlView view : getControlViewArray()) {
|
||||
removeView(view);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class ControlsLayout extends FrameLayout
|
||||
}
|
||||
|
||||
public void setControlVisible(boolean visible) {
|
||||
for (final ControlView ctrlView : mControlViewList) {
|
||||
for (ControlView ctrlView : getControlViewArray()) {
|
||||
if (ctrlView.getProperties().keycode == ControlButton.SPECIALBTN_TOGGLECTRL) continue;
|
||||
ctrlView.setVisibility(visible ? (
|
||||
(ctrlView.getProperties().hidden && !mCanModify) ?
|
||||
@@ -95,7 +95,7 @@ public class ControlsLayout extends FrameLayout
|
||||
}
|
||||
|
||||
public void setupKeyEvent(final ControlListener listener) {
|
||||
for (final ControlView ctrlView : mControlViewList) {
|
||||
for (final ControlView ctrlView : getControlViewArray()) {
|
||||
if (ctrlView.getProperties().keycode < 0) continue;
|
||||
ctrlView.setOnTouchListener(new View.OnTouchListener(){
|
||||
|
||||
@@ -149,7 +149,7 @@ public class ControlsLayout extends FrameLayout
|
||||
|
||||
public void setModifiable(boolean z) {
|
||||
mCanModify = z;
|
||||
for (final ControlView view : mControlViewList) {
|
||||
for (final ControlView view : getControlViewArray()) {
|
||||
view.setModifiable(z);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user