2.9.1 Update

This commit is contained in:
epicstudios856 2024-05-13 22:20:11 +03:00
parent 11f8c482fa
commit a6f2b67adf
16 changed files with 88 additions and 951 deletions

View file

@ -268,33 +268,13 @@ public class MainSettingsManager extends AppCompatActivity
});
}
Preference pref2 = findPreference("kvm");
if (pref2 != null) {
pref2.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(@NonNull Preference preference,
Object newValue) {
onKvm();
return true;
}
Preference prefAVX = findPreference("AVX");
if (!getArch(activity).equals("X86_64"))
if (prefAVX != null) {
prefAVX.setVisible(false);
}
private void onKvm() {
if (getKvm(activity))
setMTTCG(activity, true);
else
setMTTCG(activity, false);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
activity.finish();
startActivity(new Intent(activity, SplashActivity.class));
}
}, 300);
}
});
}
if (Objects.equals(getArch(activity), "I386")) { // I386 DOES NOT SUPPORT SHARED FOLDER
SwitchPreferenceCompat sharedPref = findPreference("sharedFolder");
sharedPref.setEnabled(false);
@ -302,104 +282,6 @@ public class MainSettingsManager extends AppCompatActivity
setSharedFolder(activity, false);
}
SwitchPreferenceCompat pref3 = findPreference("MTTCG");
if (pref3 != null) {
pref3.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(@NonNull Preference preference,
Object newValue) {
onMttcg();
return true;
}
private void onMttcg() {
if (getMTTCG(activity))
setKvm(activity, true);
else
setKvm(activity, false);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
activity.finish();
startActivity(new Intent(activity, SplashActivity.class));
}
}, 300);
}
});
String ABI = Build.SUPPORTED_ABIS[0];
if (ABI.contains("x86") && (Objects.equals(getArch(activity), "X86_64") || Objects.equals(getArch(activity), "I386"))) {
assert pref2 != null;
pref2.setVisible(true);
} else if (Objects.equals(ABI, "arm64-v8a") && Objects.equals(getArch(activity), "ARM64")) {
assert pref2 != null;
pref2.setVisible(true);
} else {
assert pref2 != null;
pref2.setVisible(false);
pref3.setEnabled(false);
pref3.setChecked(true);
setMTTCG(activity, true);
}
}
ListPreference cpuListPreference = (ListPreference) findPreference("cpu");
if (cpuListPreference != null) {
String arch = getArch(activity);
String[] cpuValues_i386 = getResources().getStringArray(R.array.cpuValues_i386);
List<String> cpuValuesList_i386 = Arrays.asList(cpuValues_i386);
String[] cpuLabels_i386 = getResources().getStringArray(R.array.cpuLabels_i386);
List<String> cpuLabels_list_i386 = Arrays.asList(cpuLabels_i386);
String[] cpuValues_x86_64 = getResources().getStringArray(R.array.cpuValues_x86_64);
List<String> cpuValuesList_x86_64 = Arrays.asList(cpuValues_x86_64);
String[] cpuLabels_x86_64 = getResources().getStringArray(R.array.cpuLabels_x86_64);
List<String> cpuLabels_list_x86_64 = Arrays.asList(cpuLabels_x86_64);
String[] cpuValues_arm64 = getResources().getStringArray(R.array.cpuValues_arm64);
List<String> cpuValuesList_arm64 = Arrays.asList(cpuValues_arm64);
String[] cpuLabels_arm64 = getResources().getStringArray(R.array.cpuLabels_arm64);
List<String> cpuLabels_list_arm64 = Arrays.asList(cpuLabels_arm64);
String[] cpuValues_ppc = getResources().getStringArray(R.array.cpuValues_ppc);
List<String> cpuValuesList_ppc = Arrays.asList(cpuValues_ppc);
String[] cpuLabels_ppc = getResources().getStringArray(R.array.cpuLabels_ppc);
List<String> cpuLabels_list_ppc = Arrays.asList(cpuLabels_ppc);
if (Objects.equals(arch, "I386")) {
cpuListPreference.setEntries(R.array.cpuLabels_i386);
cpuListPreference.setEntryValues(R.array.cpuValues_i386);
// Optionally, if you want to set a default value programmatically
cpuListPreference.setValue("qemu32"); // You can set this to whatever default you need
cpuListPreference.setSummaryProvider(ListPreference.SimpleSummaryProvider.getInstance());
} else if (Objects.equals(arch, "X86_64")) {
cpuListPreference.setEntries(R.array.cpuLabels_x86_64);
cpuListPreference.setEntryValues(R.array.cpuValues_x86_64);
// Optionally, if you want to set a default value programmatically
cpuListPreference.setValue("qemu64"); // You can set this to whatever default you need
cpuListPreference.setSummaryProvider(ListPreference.SimpleSummaryProvider.getInstance());
} else if (Objects.equals(arch, "ARM64")) {
cpuListPreference.setEntries(R.array.cpuLabels_arm64);
cpuListPreference.setEntryValues(R.array.cpuValues_arm64);
// Optionally, if you want to set a default value programmatically
cpuListPreference.setValue("arm926"); // You can set this to whatever default you need
cpuListPreference.setSummaryProvider(ListPreference.SimpleSummaryProvider.getInstance());
} else if (Objects.equals(arch, "POWERPC")) {
cpuListPreference.setEntries(R.array.cpuLabels_ppc);
cpuListPreference.setEntryValues(R.array.cpuValues_ppc);
// Optionally, if you want to set a default value programmatically
cpuListPreference.setValue("601_v1"); // You can set this to whatever default you need
cpuListPreference.setSummaryProvider(ListPreference.SimpleSummaryProvider.getInstance());
}
}
}
private void onMemory() {
@ -628,33 +510,6 @@ public class MainSettingsManager extends AppCompatActivity
// UIUtils.log("Setting First time: ");
}
public static Boolean getMTTCG(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
Boolean MTTCG = prefs.getBoolean("MTTCG", true);
return MTTCG;
}
public static void setMTTCG(Context context, Boolean MTTCG) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor edit = prefs.edit();
edit.putBoolean("MTTCG", MTTCG);
edit.commit();
}
public static int getCpuCores(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
int cpuCores = prefs.getInt("cpuCores", 1);
return cpuCores;
}
public static void setCpuCores(Context context, int cpuCores) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor edit = prefs.edit();
edit.putInt("cpuCores", cpuCores);
edit.commit();
}
public static int getExitCode(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
int exitCode = prefs.getInt("exitCode", 1);
@ -668,19 +523,6 @@ public class MainSettingsManager extends AppCompatActivity
edit.commit();
}
public static int getCpuNum(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
int cpuNum = Integer.parseInt(prefs.getString("cpuNum", "2"));
return cpuNum;
}
public static void setCpuNum(Context context, String cpuNum) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor edit = prefs.edit();
edit.putString("cpuNum", cpuNum);
edit.commit();
}
public static String getControlMode(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String controlMode = prefs.getString("controlMode", "D");
@ -731,54 +573,6 @@ public class MainSettingsManager extends AppCompatActivity
return prefs.getString("ifType", "ide");
}
public static void setMouse(Activity activity, String type) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor edit = prefs.edit();
edit.putString("mouse", type);
edit.apply();
}
public static String getMouse(Activity activity) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
return prefs.getString("mouse", "ps2-mouse");
}
public static void setKeyboard(Activity activity, String type) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor edit = prefs.edit();
edit.putString("keyboard", type);
edit.apply();
}
public static String getKeyboard(Activity activity) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
return prefs.getString("keyboard", "ps2-kbd");
}
public static void setAvx(Activity activity, boolean AVX) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor edit = prefs.edit();
edit.putBoolean("AVX", AVX);
edit.apply();
}
public static boolean getAvx(Activity activity) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
return prefs.getBoolean("AVX", false);
}
public static void setTbSize(Activity activity, String TbSize) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor edit = prefs.edit();
edit.putString("TbSize", TbSize);
edit.apply();
}
public static String getTbSize(Activity activity) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
return prefs.getString("TbSize", "2048");
}
public static void setBoot(Activity activity, String boot) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor edit = prefs.edit();
@ -791,20 +585,6 @@ public class MainSettingsManager extends AppCompatActivity
return prefs.getString("boot", "c");
}
public static void setCpu(Activity activity, String cpu) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor edit = prefs.edit();
edit.putString("cpu", cpu);
edit.apply();
}
public static String getCpu(Activity activity) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
return prefs.getString("cpu", "qemu64");
}
public static void setVmUi(Activity activity, String vmUi) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor edit = prefs.edit();
@ -853,18 +633,6 @@ public class MainSettingsManager extends AppCompatActivity
return prefs.getBoolean("UsbTablet", false);
}
public static void setCustomParams(Activity activity, String customParams) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor edit = prefs.edit();
edit.putString("customParams", customParams);
edit.apply();
}
public static String getCustomParams(Activity activity) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
return prefs.getString("customParams", "");
}
public static void setSharedFolder(Activity activity, boolean enable) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor edit = prefs.edit();
@ -889,18 +657,6 @@ public class MainSettingsManager extends AppCompatActivity
return prefs.getString("vmArch", "X86_64");
}
public static void setKvm(Activity activity, boolean kvm) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor edit = prefs.edit();
edit.putBoolean("kvm", kvm);
edit.apply();
}
public static boolean getKvm(Activity activity) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
return prefs.getBoolean("kvm", false);
}
public static boolean isFirstLaunch(Activity activity) {
PackageInfo pInfo = null;

View file

@ -312,12 +312,7 @@ public class MainVNCActivity extends VncCanvasActivity {
started = false;
// Stop the service
MainService.stopService();
Terminal vterm = new Terminal(activity);
vterm.executeShellCommand("killall qemu-system-*", false, activity);
// Finish the activity
activity.finish();
Terminal.killQemuProcess();
}
})

View file

@ -16,9 +16,6 @@ import com.vectras.vm.SplashActivity;
public class SettingsFragment extends PreferenceFragmentCompat {
private Handler mHandler;
public SharedPreferences mPref;
@Override
public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) {
setPreferencesFromResource(R.xml.settings, rootKey);
@ -27,54 +24,5 @@ public class SettingsFragment extends PreferenceFragmentCompat {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mHandler = new Handler();
SharedPreferences.OnSharedPreferenceChangeListener listener;
listener = new SharedPreferences.OnSharedPreferenceChangeListener() {
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
switch (key) {
case "modeNight":
getActivity().finish();
startActivity(new Intent(getActivity(), SplashActivity.class));
break;
case "customMemory":
if (prefs.getBoolean("customMemory", false))
findPreference("memory").setEnabled(true);
else
findPreference("memory").setEnabled(false);
break;
case "MTTCG":
if (prefs.getBoolean("MTTCG", false)) {
findPreference("cpuNum").setEnabled(false);
MainSettingsManager.setCpuCores(getContext(), 1);
} else {
findPreference("cpuNum").setEnabled(true);
}
break;
}
}
};
mPref = getPreferenceManager().getDefaultSharedPreferences(getContext());
if (mPref != null) {
mPref.registerOnSharedPreferenceChangeListener(listener);
}
}
@Override
public void onResume() {
super.onResume();
if (mPref.getBoolean("customMemory", false))
findPreference("memory").setEnabled(true);
else
findPreference("memory").setEnabled(false);
if (mPref.getBoolean("MTTCG", false)) {
findPreference("cpuNum").setEnabled(false);
} else {
findPreference("cpuNum").setEnabled(true);
}
}
}

View file

@ -20,6 +20,9 @@ import android.text.TextWatcher;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
@ -243,7 +246,7 @@ public class CustomRomActivity extends AppCompatActivity {
ad.setMessage("there is iso imported you want to replace it?");
ad.setButton(Dialog.BUTTON_POSITIVE, "REPLACE", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
Intent intent = new Intent(ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
@ -280,7 +283,7 @@ public class CustomRomActivity extends AppCompatActivity {
});
ad.show();
} else {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
Intent intent = new Intent(ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
@ -441,9 +444,20 @@ public class CustomRomActivity extends AppCompatActivity {
qemu.addTextChangedListener(afterTextChangedListener);
TextInputLayout tIQemu = findViewById(R.id.qemuField);
tIQemu.setEndIconOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String qcc = "https://play.google.com/store/apps/details?id=com.anbui.cqcm.app";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(qcc));
startActivity(i);
}
});
modify = getIntent().getBooleanExtra("MODIFY", false);
if (modify) {
addRomBtn.setText("SAVE CHANGES");
addRomBtn.setText(R.string.save_changes);
title.setText(current.itemName);
icon.setText(current.itemIcon);
drive.setText(current.itemPath);
@ -467,6 +481,23 @@ public class CustomRomActivity extends AppCompatActivity {
ivIcon.setImageBitmap(myBitmap);
}
} else {
String defQemuParams;
switch (MainSettingsManager.getArch(MainActivity.activity)) {
case "ARM64":
defQemuParams = "-M virt -cpu cortex-a57 -smp 4 -netdev user,id=usernet -device virtio-net,netdev=usernet -nographic";
break;
case "PPC":
defQemuParams = "-M mac99 -cpu g3 -smp 4 -net nic -net user";
break;
case "I386":
defQemuParams = "-M pc -cpu qemu32 -smp 4 -vga std -netdev user,id=usernet -device e1000,netdev=usernet";
break;
default:
defQemuParams = "-M pc -cpu qemu64 -smp 4 -vga std -netdev user,id=usernet -device e1000,netdev=usernet";
break;
}
qemu.setText(defQemuParams);
}
}

View file

@ -1,8 +1,10 @@
package com.vectras.vm.Fragment;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkInfo;

View file

@ -117,9 +117,6 @@ public class MainActivity extends AppCompatActivity {
RamInfo.activity = this;
setContentView(R.layout.activity_main);
if (!MainSettingsManager.getVncExternal(activity))
clearNotifications();
setupFolders();
NotificationManager notificationManager = (NotificationManager) activity.getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
@ -796,6 +793,8 @@ public class MainActivity extends AppCompatActivity {
//activity.startActivity(new Intent(activity, X11Activity.class));
}
progressDialog.dismiss();
} else {
progressDialog.dismiss();
}
}
@ -848,6 +847,8 @@ public class MainActivity extends AppCompatActivity {
public void onStart() {
super.onStart();
Log.d(TAG, "onStart");
if (!MainSettingsManager.getVncExternal(activity))
clearNotifications();
loadDataVbi();
Config.ui = MainSettingsManager.getVmUi(activity);

View file

@ -39,6 +39,7 @@ import com.google.android.material.textfield.TextInputLayout;
import com.vectras.qemu.MainSettingsManager;
import com.vectras.qemu.MainVNCActivity;
import com.vectras.vm.AppConfig;
import com.vectras.vm.CustomRomActivity;
import com.vectras.vm.MainActivity;
import com.vectras.vm.MainService;
import com.vectras.vm.R;
@ -110,7 +111,7 @@ public class AdapterMainRoms extends RecyclerView.Adapter<RecyclerView.ViewHolde
@Override
public void onClick(View v) {
com.vectras.vm.CustomRomActivity.current = data.get(position);
MainActivity.activity.startActivity(new Intent(MainActivity.activity, com.vectras.vm.CustomRomActivity.class).putExtra("POS", position).putExtra("MODIFY", true));
MainActivity.activity.startActivity(new Intent(MainActivity.activity, CustomRomActivity.class).putExtra("POS", position).putExtra("MODIFY", true));
bottomSheetDialog.cancel();
}
});
@ -205,7 +206,7 @@ public class AdapterMainRoms extends RecyclerView.Adapter<RecyclerView.ViewHolde
myHolder.cdRoms.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
String env = StartVM.env(MainActivity.activity, current.itemExtra, current.itemPath);
String env = StartVM.env(MainActivity.activity, current.itemExtra, current.itemPath, current.itemCpu);
MainActivity.startVM(current.itemName, env);
}
});

View file

@ -3,6 +3,7 @@ public class DataMainRoms {
public String itemIcon;
public String itemName;
public String itemArch;
public String itemCpu;
public String itemPath;
public String itemDrv1;
public String itemExtra;

View file

@ -12,6 +12,7 @@ import android.util.Log;
import androidx.core.app.NotificationCompat;
import com.vectras.qemu.MainVNCActivity;
import com.vectras.vterm.Terminal;
import java.io.File;
@ -30,10 +31,10 @@ public class MainService extends Service {
super.onCreate();
service = this;
createNotificationChannel();
Intent stopSelf = new Intent(this, MainActivity.class);
Intent stopSelf = new Intent(this, MainService.class);
stopSelf.setAction("STOP");
PendingIntent pStopSelf = PendingIntent.getService(
this, 0, stopSelf, PendingIntent.FLAG_IMMUTABLE
this, 0, stopSelf, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT
);
Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID)
@ -82,6 +83,7 @@ public class MainService extends Service {
//TODO: Not Work
Terminal.killQemuProcess();
return START_NOT_STICKY;
}
return START_NOT_STICKY;

View file

@ -16,7 +16,7 @@ import java.util.Objects;
public class StartVM {
public static String cache;
public static String env(Activity activity, String extras, String img) {
public static String env(Activity activity, String extras, String img, String cpu) {
String filesDir = activity.getFilesDir().getAbsolutePath();
@ -77,26 +77,9 @@ public class StartVM {
params.add(driveParams);
}
boolean kvm = MainSettingsManager.getKvm(activity);
boolean avx = MainSettingsManager.getAvx(activity);
String cpuStr = "-cpu " + MainSettingsManager.getCpu(activity);
if (avx)
cpuStr += ",+avx";
String smpCores = "-smp ";
smpCores += MainSettingsManager.getCpuCores(activity);
String memoryStr = "-m ";
memoryStr += RamInfo.vectrasMemory();
String acclerationStr;
if (kvm)
acclerationStr = "-accel kvm";
else
acclerationStr = "-accel tcg,thread=multi";
acclerationStr += ",tb-size=" + MainSettingsManager.getTbSize(activity);
String boot = "-boot ";
boot += MainSettingsManager.getBoot(activity);
@ -132,14 +115,6 @@ public class StartVM {
params.add(memoryStr);
params.add(cpuStr);
params.add(smpCores);
params.add(acclerationStr);
params.add(MainSettingsManager.getCustomParams(activity));
if (MainSettingsManager.getVmUi(activity).equals("VNC")) {
String vncStr = "-vnc ";
params.add(vncStr);
@ -153,7 +128,10 @@ public class StartVM {
}
params.add("-monitor");
params.add("vc");
if (MainSettingsManager.getArch(activity).equals("X86_64"))
params.add("vc");
else if (MainSettingsManager.getArch(activity).equals("ARM64"))
params.add("stdio");
} else if (MainSettingsManager.getVmUi(activity).equals("SPICE")) {
String spiceStr = "-spice ";
spiceStr += "port=6999,disable-ticketing=on";
@ -161,25 +139,9 @@ public class StartVM {
} else if (MainSettingsManager.getVmUi(activity).equals("X11")) {
}
params.add("-k");
params.add("en-us");
params.add("-usb");
if (!MainSettingsManager.getMouse(activity).equals("ps2-mouse")) {
params.add("-device");
params.add(MainSettingsManager.getMouse(activity));
}
if (!MainSettingsManager.getKeyboard(activity).equals("ps2-kbd")) {
params.add("-device");
params.add(MainSettingsManager.getKeyboard(activity));
}
params.add(extras);
params.add(MainSettingsManager.getCustomParams(activity));
return String.join(" ", params);
}

View file

@ -2,6 +2,7 @@ package com.vectras.vterm;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
@ -19,6 +20,7 @@ import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import com.vectras.qemu.MainVNCActivity;
import com.vectras.vm.MainActivity;
import com.vectras.vm.R;
@ -67,7 +69,7 @@ public class Terminal {
StringBuilder output = new StringBuilder();
StringBuilder errors = new StringBuilder();
Log.d(TAG, userCommand);
com.vectras.vm.logger.VectrasStatus.logError("<font color='yellow'>VTERM: >"+ userCommand+"</font>");
com.vectras.vm.logger.VectrasStatus.logError("<font color='yellow'>VTERM: >" + userCommand + "</font>");
new Thread(() -> {
try {
// Setup the qemuProcess builder to start PRoot with environmental variables and commands
@ -130,14 +132,14 @@ public class Terminal {
String line;
while ((line = reader.readLine()) != null) {
Log.d(TAG, line);
com.vectras.vm.logger.VectrasStatus.logError("<font color='yellow'>VTERM: >"+ line+"</font>");
com.vectras.vm.logger.VectrasStatus.logError("<font color='yellow'>VTERM: >" + line + "</font>");
output.append(line).append("\n");
}
// Read any errors from the error stream
while ((line = errorReader.readLine()) != null) {
Log.w(TAG, line);
com.vectras.vm.logger.VectrasStatus.logError("<font color='red'>VTERM ERROR: >"+ line+"</font>");
com.vectras.vm.logger.VectrasStatus.logError("<font color='red'>VTERM ERROR: >" + line + "</font>");
output.append(line).append("\n");
}
@ -166,7 +168,8 @@ public class Terminal {
if (showResultDialog) {
String finalOutput = output.toString();
String finalErrors = errors.toString();
showDialog(finalOutput.isEmpty() ? finalErrors : finalOutput, dialogActivity);
// bcuz there is dumb users bruh
showDialog(finalOutput.isEmpty() ? finalErrors : finalOutput.replace("read interrupted", "Done!"), dialogActivity);
}
});
}
@ -181,8 +184,16 @@ public class Terminal {
public static void killQemuProcess() {
if (qemuProcess != null) {
qemuProcess.destroy();
qemuProcess = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
qemuProcess.destroyForcibly();
else
qemuProcess.destroy();
MainVNCActivity.activity.finish();
MainVNCActivity.started = false;
qemuProcess = null; // Set it to null after destroying it
Log.d(TAG, "QEMU process destroyed.");
} else {
Log.d(TAG, "QEMU process was null.");
}
}
}