Browse Source
[android] Add detailed system information dialog (#2995)
[android] Add detailed system information dialog (#2995)
Thanks to https://github.com/RPCSX/rpcsx for their CPU information detecting code which was used as reference here. Co-authored-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2995 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: kleidis <kleidis1@protonmail.com> Co-committed-by: kleidis <kleidis1@protonmail.com>pull/3044/head
committed by
crueter
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
7 changed files with 609 additions and 1 deletions
-
12src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt
-
11src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt
-
108src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SystemInfoDialogFragment.kt
-
13src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/Log.kt
-
410src/android/app/src/main/jni/native.cpp
-
35src/android/app/src/main/res/layout/dialog_system_info.xml
-
21src/android/app/src/main/res/values/strings.xml
@ -0,0 +1,108 @@ |
|||||
|
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project |
||||
|
// SPDX-License-Identifier: GPL-3.0-or-later |
||||
|
|
||||
|
package org.yuzu.yuzu_emu.fragments |
||||
|
|
||||
|
import android.app.ActivityManager |
||||
|
import android.app.Dialog |
||||
|
import android.content.Context |
||||
|
import android.os.Build |
||||
|
import android.os.Bundle |
||||
|
import androidx.fragment.app.DialogFragment |
||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder |
||||
|
import org.yuzu.yuzu_emu.NativeLibrary |
||||
|
import org.yuzu.yuzu_emu.R |
||||
|
import org.yuzu.yuzu_emu.databinding.DialogSystemInfoBinding |
||||
|
|
||||
|
class SystemInfoDialogFragment : DialogFragment() { |
||||
|
private var _binding: DialogSystemInfoBinding? = null |
||||
|
private val binding get() = _binding!! |
||||
|
|
||||
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
||||
|
_binding = DialogSystemInfoBinding.inflate(layoutInflater) |
||||
|
|
||||
|
populateSystemInfo() |
||||
|
|
||||
|
val dialog = MaterialAlertDialogBuilder(requireContext()) |
||||
|
.setTitle(R.string.system_information) |
||||
|
.setPositiveButton(android.R.string.ok, null) |
||||
|
.create() |
||||
|
|
||||
|
dialog.setView(binding.root) |
||||
|
|
||||
|
return dialog |
||||
|
} |
||||
|
|
||||
|
private fun populateSystemInfo() { |
||||
|
val systemInfo = buildString { |
||||
|
// General Device Info |
||||
|
appendLine("=== ${getString(R.string.general_information)} ===") |
||||
|
appendLine("${getString(R.string.device_manufacturer)}: ${Build.MANUFACTURER}") |
||||
|
appendLine("${getString(R.string.device_model)}: ${Build.MODEL}") |
||||
|
appendLine("${getString(R.string.device_name)}: ${Build.DEVICE}") |
||||
|
appendLine("${getString(R.string.product)}: ${Build.PRODUCT}") |
||||
|
appendLine("${getString(R.string.hardware)}: ${Build.HARDWARE}") |
||||
|
appendLine("${getString(R.string.supported_abis)}: ${Build.SUPPORTED_ABIS.joinToString(", ")}") |
||||
|
appendLine("${getString(R.string.android_version)}: ${Build.VERSION.RELEASE} (API ${Build.VERSION.SDK_INT})") |
||||
|
appendLine("${getString(R.string.android_security_patch)}: ${Build.VERSION.SECURITY_PATCH}") |
||||
|
appendLine("${getString(R.string.build_id)}: ${Build.ID}") |
||||
|
|
||||
|
appendLine() |
||||
|
appendLine("=== ${getString(R.string.cpu_info)} ===") |
||||
|
|
||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && Build.SOC_MODEL.isNotBlank()) { |
||||
|
appendLine("${getString(R.string.soc)} ${Build.SOC_MODEL}") |
||||
|
} |
||||
|
|
||||
|
val cpuSummary = NativeLibrary.getCpuSummary() |
||||
|
if (cpuSummary.isNotEmpty() && cpuSummary != "Unknown") { |
||||
|
appendLine(cpuSummary) |
||||
|
} |
||||
|
|
||||
|
appendLine() |
||||
|
|
||||
|
// GPU Info |
||||
|
appendLine("=== ${getString(R.string.gpu_information)} ===") |
||||
|
try { |
||||
|
val gpuModel = NativeLibrary.getGpuModel() |
||||
|
appendLine("${getString(R.string.gpu_model)}: $gpuModel") |
||||
|
|
||||
|
val vulkanApi = NativeLibrary.getVulkanApiVersion() |
||||
|
appendLine("Vulkan API: $vulkanApi") |
||||
|
|
||||
|
val vulkanDriver = NativeLibrary.getVulkanDriverVersion() |
||||
|
appendLine("${getString(R.string.vulkan_driver_version)}: $vulkanDriver") |
||||
|
} catch (e: Exception) { |
||||
|
appendLine("${getString(R.string.error_getting_emulator_info)}: ${e.message}") |
||||
|
} |
||||
|
appendLine() |
||||
|
|
||||
|
// Memory Info |
||||
|
appendLine("=== ${getString(R.string.memory_info)} ===") |
||||
|
|
||||
|
val activityManager = |
||||
|
requireContext().getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager |
||||
|
val memInfo = ActivityManager.MemoryInfo() |
||||
|
activityManager.getMemoryInfo(memInfo) |
||||
|
val totalDeviceRam = memInfo.totalMem / (1024 * 1024) |
||||
|
|
||||
|
appendLine("${getString(R.string.total_memory)}: $totalDeviceRam MB") |
||||
|
} |
||||
|
|
||||
|
binding.textSystemInfo.text = systemInfo |
||||
|
} |
||||
|
|
||||
|
|
||||
|
override fun onDestroyView() { |
||||
|
super.onDestroyView() |
||||
|
_binding = null |
||||
|
} |
||||
|
|
||||
|
companion object { |
||||
|
const val TAG = "SystemInfoDialogFragment" |
||||
|
|
||||
|
fun newInstance(): SystemInfoDialogFragment { |
||||
|
return SystemInfoDialogFragment() |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:orientation="vertical" |
||||
|
android:padding="16dp"> |
||||
|
|
||||
|
<com.google.android.material.card.MaterialCardView |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginBottom="8dp" |
||||
|
app:cardElevation="0dp" |
||||
|
app:cardBackgroundColor="?attr/colorSurfaceVariant"> |
||||
|
|
||||
|
<ScrollView |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:maxHeight="400dp" |
||||
|
android:padding="12dp"> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/text_system_info" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:fontFamily="monospace" |
||||
|
android:textAppearance="?attr/textAppearanceBodySmall" |
||||
|
android:textColor="?attr/colorOnSurfaceVariant" |
||||
|
android:textIsSelectable="true" /> |
||||
|
|
||||
|
</ScrollView> |
||||
|
|
||||
|
</com.google.android.material.card.MaterialCardView> |
||||
|
|
||||
|
</LinearLayout> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue