mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Merge pull request #8481 from kevlahnota/master3
fix osFamily name for sentry, update android-all
This commit is contained in:
@@ -96,7 +96,8 @@
|
||||
<dependency>
|
||||
<groupId>org.robolectric</groupId>
|
||||
<artifactId>android-all</artifactId>
|
||||
<version>15-robolectric-12468137</version>
|
||||
<!-- update version: 16-robolectric-13921718 but needs to fix Android 16 Edge to edge enforcement -->
|
||||
<version>15-robolectric-12650502</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -70,12 +70,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.jupnp.DefaultUpnpServiceConfiguration;
|
||||
import org.jupnp.android.AndroidUpnpServiceConfiguration;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.*;
|
||||
import java.text.Normalizer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -203,14 +198,14 @@ public class Main extends AndroidApplication {
|
||||
device.setBrand(Build.BRAND);
|
||||
device.setManufacturer(Build.MANUFACTURER);
|
||||
device.setMemorySize(memInfo.totalMem);
|
||||
String cpuDesc = Build.VERSION.SDK_INT > Build.VERSION_CODES.R ? Build.SOC_MANUFACTURER + " " + Build.SOC_MODEL : Build.UNKNOWN;
|
||||
device.setCpuDescription(cpuDesc);
|
||||
device.setCpuDescription(getCpuName());
|
||||
device.setChipset(Build.HARDWARE + " " + Build.BOARD);
|
||||
// OS Info
|
||||
OperatingSystem os = new OperatingSystem();
|
||||
os.setName("Android " + Build.VERSION.RELEASE);
|
||||
os.setName("Android");
|
||||
os.setVersion(Build.VERSION.RELEASE);
|
||||
os.setBuild(Build.DISPLAY);
|
||||
os.setRawDescription(getAndroidOSName());
|
||||
|
||||
initForge(Gadapter, new HWInfo(device, os), permissiongranted, totalMemory, isTabletDevice(getContext()));
|
||||
}
|
||||
@@ -871,6 +866,75 @@ public class Main extends AndroidApplication {
|
||||
return gameControllerDeviceIds;
|
||||
}
|
||||
|
||||
public final String getAndroidOSName() {
|
||||
final String codename;
|
||||
switch (Build.VERSION.SDK_INT) {
|
||||
case Build.VERSION_CODES.O:
|
||||
codename = "Android 8 (Oreo)";
|
||||
break;
|
||||
case Build.VERSION_CODES.O_MR1:
|
||||
codename = "Android 8.1 (Oreo)";
|
||||
break;
|
||||
case Build.VERSION_CODES.P:
|
||||
codename = "Android 9 (Pie)";
|
||||
break;
|
||||
case Build.VERSION_CODES.Q:
|
||||
codename = "Android 10 (Quince Tart)";
|
||||
break;
|
||||
case Build.VERSION_CODES.R:
|
||||
codename = "Android 11 (Red Velvet)";
|
||||
break;
|
||||
case Build.VERSION_CODES.S:
|
||||
codename = "Android 12 (Snow Cone)";
|
||||
break;
|
||||
case Build.VERSION_CODES.S_V2:
|
||||
codename = "Android 12L (Snow Cone V2)";
|
||||
break;
|
||||
case Build.VERSION_CODES.TIRAMISU:
|
||||
codename = "Android 13 (Tiramisu)";
|
||||
break;
|
||||
case Build.VERSION_CODES.UPSIDE_DOWN_CAKE:
|
||||
codename = "Android 14 (Upside Down Cake)";
|
||||
break;
|
||||
case Build.VERSION_CODES.VANILLA_ICE_CREAM:
|
||||
codename = "Android 15 (Vanilla Ice Cream)";
|
||||
break;
|
||||
case 36:
|
||||
codename = "Android 16 (Baklava)";
|
||||
break;
|
||||
default:
|
||||
codename = "Android " + Build.VERSION.SDK_INT;
|
||||
break;
|
||||
}
|
||||
return codename;
|
||||
}
|
||||
|
||||
public String getCpuName() {
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R)
|
||||
return Build.SOC_MANUFACTURER + " " + Build.SOC_MODEL;
|
||||
try {
|
||||
FileReader fr = new FileReader("/proc/cpuinfo");
|
||||
BufferedReader br = new BufferedReader(fr);
|
||||
String line;
|
||||
String cpuName = null;
|
||||
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (line.contains("Processor") || line.contains("model name")) {
|
||||
// Extract the part after the colon and trim whitespace
|
||||
String[] parts = line.split(":", 2);
|
||||
if (parts.length > 1) {
|
||||
cpuName = parts[1].trim();
|
||||
break; // Found the CPU name, no need to read further
|
||||
}
|
||||
}
|
||||
}
|
||||
br.close();
|
||||
return capitalize(cpuName);
|
||||
} catch (IOException e) {
|
||||
return Build.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
public String getDeviceName() {
|
||||
String manufacturer = Build.MANUFACTURER;
|
||||
String model = Build.BRAND + " - " + Build.MODEL;
|
||||
|
||||
@@ -46,9 +46,10 @@ public class GameLauncher {
|
||||
device.setCpuDescription(si.getHardware().getProcessor().getProcessorIdentifier().getName());
|
||||
// OS Info
|
||||
OperatingSystem os = new OperatingSystem();
|
||||
os.setName(si.getOperatingSystem() + " x" + si.getOperatingSystem().getBitness());
|
||||
os.setName(si.getOperatingSystem().getFamily());
|
||||
os.setVersion(si.getOperatingSystem().getVersionInfo().getVersion());
|
||||
os.setBuild(si.getOperatingSystem().getVersionInfo().getBuildNumber());
|
||||
os.setRawDescription(si.getOperatingSystem() + " x" + si.getOperatingSystem().getBitness());
|
||||
totalRAM = Math.round(si.getHardware().getMemory().getTotal() / 1024f / 1024f);
|
||||
hw = new HWInfo(device, os);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -170,20 +170,18 @@ public class Forge implements ApplicationListener {
|
||||
//install our error handler
|
||||
ExceptionHandler.registerErrorHandling();
|
||||
//init hwInfo to log
|
||||
Gdx.app.postRunnable(() -> {
|
||||
HWInfo info = GuiBase.getHWInfo();
|
||||
if (info != null) {
|
||||
System.out.println(
|
||||
"---------------------------------------\n" +
|
||||
"APP: Forge v." + GuiBase.getInterface().getCurrentVersion() + " (" + GuiBase.getInterface() + ")" +
|
||||
"##########################################\n" +
|
||||
"APP: Forge v." + GuiBase.getInterface().getCurrentVersion() +
|
||||
"\nDEV: " + info.device().getName() +
|
||||
"\nCPU: " + info.device().getCpuDescription() +
|
||||
"\nRAM: " + GuiBase.getDeviceRAM() + " MB" +
|
||||
"\nOS: " + info.os().getName() +
|
||||
"\n---------------------------------------"
|
||||
"\nOS: " + info.os().getRawDescription() +
|
||||
"\n##########################################"
|
||||
);
|
||||
}
|
||||
});
|
||||
// closeSplashScreen() is called early on non-Windows OS so it will not crash, LWJGL3 bug on AWT Splash.
|
||||
if (OperatingSystem.isWindows())
|
||||
getDeviceAdapter().closeSplashScreen();
|
||||
|
||||
Reference in New Issue
Block a user