mirror of
https://github.com/xoureldeen/Vectras-VM-Android.git
synced 2026-05-05 09:46:33 +00:00
3dfx debug version
This commit is contained in:
parent
2e1f4e9256
commit
e93c1b361e
4861 changed files with 108 additions and 868337 deletions
|
|
@ -625,7 +625,7 @@ public class MainSettingsManager extends AppCompatActivity
|
|||
|
||||
public static int getCpuNum(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
int cpuNum = Integer.parseInt(prefs.getString("cpuNum", "1"));
|
||||
int cpuNum = Integer.parseInt(prefs.getString("cpuNum", "2"));
|
||||
return cpuNum;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -312,6 +312,10 @@ public class MainVNCActivity extends VncCanvasActivity {
|
|||
started = false;
|
||||
// Stop the service
|
||||
MainService.stopService();
|
||||
|
||||
Terminal vterm = new Terminal(activity);
|
||||
vterm.executeShellCommand("killall qemu-system-x86_64");
|
||||
|
||||
// Finish the activity
|
||||
activity.finish();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import static android.content.Intent.ACTION_OPEN_DOCUMENT;
|
|||
|
||||
import static com.vectras.vm.utils.UIUtils.UIAlert;
|
||||
|
||||
import com.iiordanov.bVNC.RemoteCanvasActivity;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.vectras.qemu.*;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
|
|
@ -31,6 +31,7 @@ import android.view.View;
|
|||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
|
|
@ -41,6 +42,7 @@ import androidx.core.view.GravityCompat;
|
|||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
|
|
@ -57,8 +59,6 @@ import com.google.android.material.elevation.SurfaceColors;
|
|||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
import com.undatech.opaque.AdvancedSettingsActivity;
|
||||
import com.undatech.opaque.ConnectionSettings;
|
||||
import com.vectras.qemu.Config;
|
||||
import com.vectras.qemu.MainSettingsManager;
|
||||
import com.vectras.qemu.utils.RamInfo;
|
||||
|
|
@ -69,20 +69,25 @@ import com.vectras.vm.utils.AppUpdater;
|
|||
import com.vectras.vm.utils.FileUtils;
|
||||
import com.vectras.vm.utils.UIUtils;
|
||||
import com.vectras.vterm.Terminal;
|
||||
import com.vectras.vm.adapter.LogsAdapter;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
public static String curRomName;
|
||||
|
|
@ -354,9 +359,58 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
startActivityForResult(intent, 1006);
|
||||
}
|
||||
} else if (id == R.id.navigation_terminal) {
|
||||
} else if (id == R.id.navigation_item_terminal) {
|
||||
com.vectras.vterm.TerminalBottomSheetDialog VTERM = new com.vectras.vterm.TerminalBottomSheetDialog(activity);
|
||||
VTERM.showVterm();
|
||||
} else if (id == R.id.navigation_item_view_logs) {
|
||||
BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(activity);
|
||||
View view = activity.getLayoutInflater().inflate(R.layout.bottomsheetdialog_logger, null);
|
||||
bottomSheetDialog.setContentView(view);
|
||||
bottomSheetDialog.show();
|
||||
|
||||
final String CREDENTIAL_SHARED_PREF = "settings_prefs";
|
||||
Timer _timer = new Timer();
|
||||
TimerTask t;
|
||||
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(VectrasApp.getApp());
|
||||
LogsAdapter mLogAdapter = new LogsAdapter(layoutManager, VectrasApp.getApp());
|
||||
RecyclerView logList = (RecyclerView) view.findViewById(R.id.recyclerLog);
|
||||
logList.setAdapter(mLogAdapter);
|
||||
logList.setLayoutManager(layoutManager);
|
||||
mLogAdapter.scrollToLastPosition();
|
||||
try {
|
||||
Process process = Runtime.getRuntime().exec("logcat -e");
|
||||
BufferedReader bufferedReader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream()));
|
||||
Process process2 = Runtime.getRuntime().exec("logcat -w");
|
||||
BufferedReader bufferedReader2 = new BufferedReader(
|
||||
new InputStreamReader(process2.getInputStream()));
|
||||
|
||||
t = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (bufferedReader.readLine() != null || bufferedReader2.readLine() != null) {
|
||||
String logLine = bufferedReader.readLine();
|
||||
String logLine2 = bufferedReader2.readLine();
|
||||
VectrasStatus.logError("<font color='red'>[E] "+logLine+"</font>");
|
||||
VectrasStatus.logError("<font color='yellow'>[W] "+logLine2+"</font>");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
_timer.scheduleAtFixedRate(t, (int) (0), (int) (100));
|
||||
} catch (IOException e) {
|
||||
Toast.makeText(activity, "There was an error: " + Log.getStackTraceString(e), Toast.LENGTH_LONG).show();
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (id == R.id.navigation_item_settings) {
|
||||
startActivity(new Intent(activity, MainSettingsManager.class));
|
||||
} else if (id == R.id.navigation_item_store) {
|
||||
|
|
@ -587,7 +641,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
if (MainSettingsManager.getVmUi(activity).equals("VNC")) {
|
||||
activity.startActivity(new Intent(activity, MainVNCActivity.class));
|
||||
} else if (MainSettingsManager.getVmUi(activity).equals("SPICE")) {
|
||||
activity.startActivity(new Intent(activity, RemoteCanvasActivity.class));
|
||||
//activity.startActivity(new Intent(activity, RemoteCanvasActivity.class));
|
||||
}
|
||||
String[] params = env.split("\\s+");
|
||||
VectrasStatus.logInfo("Params:");
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
import com.iiordanov.bVNC.RemoteCanvasActivity;
|
||||
import com.vectras.qemu.MainSettingsManager;
|
||||
import com.vectras.qemu.MainVNCActivity;
|
||||
import com.vectras.vm.AppConfig;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
// Update the text
|
||||
vterm.append(textToAdd);
|
||||
|
||||
if (textToAdd.contains("installation successful! xssFjnj58Id")) {
|
||||
if (textToAdd.contains("xssFjnj58Id")) {
|
||||
//finish();
|
||||
startActivity(new Intent(this, SplashActivity.class));
|
||||
}
|
||||
|
|
@ -303,10 +303,13 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
cmd += "echo \"http://dl-cdn.alpinelinux.org/alpine/edge/testing\" >> /etc/apk/repositories;";
|
||||
executeShellCommand(cmd);
|
||||
executeShellCommand("set -e;" +
|
||||
" echo 'Starting setup...';" +
|
||||
" apk update;" +
|
||||
" apk add libslirp libslirp-dev pulseaudio-dev glib-dev pixman-dev zlib-dev spice-dev libusbredirparser usbredir-dev libiscsi-dev sdl2 sdl2-dev libepoxy-dev virglrenderer-dev tar;" +
|
||||
" clear;" +
|
||||
" tar -xvzf " + tarPath + " -C " + filesDir + "/distro;" +
|
||||
" rm " + tarPath + ";" +
|
||||
" clear;" +
|
||||
" echo \"installation successful! xssFjnj58Id\"");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,13 +25,8 @@ import android.widget.ScrollView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.multidex.MultiDex;
|
||||
import androidx.multidex.MultiDexApplication;
|
||||
|
||||
import com.google.android.material.color.DynamicColors;
|
||||
import com.iiordanov.bVNC.Constants;
|
||||
import com.iiordanov.bVNC.Database;
|
||||
import com.iiordanov.bVNC.Utils;
|
||||
import com.vectras.qemu.MainSettingsManager;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
|
@ -52,22 +47,15 @@ import java.util.Date;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class VectrasApp extends MultiDexApplication {
|
||||
public class VectrasApp extends Application {
|
||||
public static VectrasApp vectrasapp;
|
||||
public static boolean debugLog = false;
|
||||
private static WeakReference<Context> context;
|
||||
private Database database;
|
||||
|
||||
public static Context getContext() {
|
||||
return context.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
MultiDex.install(getBaseContext());
|
||||
}
|
||||
|
||||
private static Handler MAIN_HANDLER = new Handler(Looper.getMainLooper());
|
||||
|
||||
@Override
|
||||
|
|
@ -83,23 +71,6 @@ public class VectrasApp extends MultiDexApplication {
|
|||
}
|
||||
setModeNight(this);
|
||||
DynamicColors.applyToActivitiesIfAvailable(this);
|
||||
|
||||
//spice
|
||||
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
|
||||
Constants.DEFAULT_PROTOCOL_PORT = Utils.getDefaultPort(this);
|
||||
database = new Database(this);
|
||||
context = new WeakReference<Context>(this);
|
||||
debugLog = Utils.querySharedPreferenceBoolean(getApplicationContext(), "moreDebugLoggingTag");
|
||||
|
||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||
@Override
|
||||
public void uncaughtException(Thread t, Throwable e) {
|
||||
Log.e("TAG", "An uncaught exception was encountered in thread: " + t.getName(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
public Database getDatabase() {
|
||||
return database;
|
||||
}
|
||||
|
||||
private void setModeNight(Context context) {
|
||||
|
|
|
|||
|
|
@ -122,11 +122,13 @@ public class Terminal {
|
|||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
Log.d(TAG, line);
|
||||
com.vectras.vm.logger.VectrasStatus.logError("<font color='red'>Vterm ERROR: >"+ line+"</font>");
|
||||
}
|
||||
|
||||
// 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>");
|
||||
}
|
||||
|
||||
// Clean up
|
||||
|
|
@ -140,6 +142,7 @@ public class Terminal {
|
|||
// Handle exceptions by printing the stack trace in the terminal output
|
||||
final String errorMessage = e.getMessage();
|
||||
Log.e("Vterm ERROR:", errorMessage);
|
||||
com.vectras.vm.logger.VectrasStatus.logError("<font color='red'>Vterm ERROR: >"+ errorMessage+"</font>");
|
||||
}
|
||||
}).start(); // Execute the command in a separate thread to prevent blocking the UI thread
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue