fix osFamily name for sentry, update android-all

This commit is contained in:
Anthony Calosa
2025-08-21 08:00:29 +08:00
parent ba8a30ebdd
commit e5a0d335af
4 changed files with 61 additions and 17 deletions

View File

@@ -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>

View File

@@ -208,9 +208,10 @@ public class Main extends AndroidApplication {
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 +872,49 @@ 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 getDeviceName() {
String manufacturer = Build.MANUFACTURER;
String model = Build.BRAND + " - " + Build.MODEL;

View File

@@ -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) {

View File

@@ -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() + ")" +
"\nDEV: " + info.device().getName() +
"\nCPU: " + info.device().getCpuDescription() +
"\nRAM: " + GuiBase.getDeviceRAM() + " MB" +
"\nOS: " + info.os().getName() +
"\n---------------------------------------"
);
}
});
HWInfo info = GuiBase.getHWInfo();
if (info != null) {
System.out.println(
"##########################################\n" +
"APP: Forge v." + GuiBase.getInterface().getCurrentVersion() +
"\nDEV: " + info.device().getName() +
"\nCPU: " + info.device().getCpuDescription() +
"\nRAM: " + GuiBase.getDeviceRAM() + " MB" +
"\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();