(Bundle savedInstanceState)
| 179 | } |
| 180 | |
| 181 | @Override |
| 182 | protected void onCreate(Bundle savedInstanceState) { |
| 183 | // Capture uncaught exceptions before the JVM dies — without this, the stack trace would only reach Android logcat, not the network log users share |
| 184 | final Thread.UncaughtExceptionHandler prior = Thread.getDefaultUncaughtExceptionHandler(); |
| 185 | Thread.setDefaultUncaughtExceptionHandler((t, e) -> { |
| 186 | try { |
| 187 | netLog.error(e, "[uncaught] thread={}", t.getName()); |
| 188 | } catch (Throwable ignore) {} |
| 189 | if (prior != null) prior.uncaughtException(t, e); |
| 190 | }); |
| 191 | |
| 192 | netLog.info("[lifecycle] onCreate"); |
| 193 | heapHeartbeatHandler = new Handler(Looper.getMainLooper()); |
| 194 | heapHeartbeatHandler.postDelayed(heapHeartbeat, HEAP_HEARTBEAT_MS); |
| 195 | |
| 196 | super.onCreate(savedInstanceState); |
| 197 | try { |
| 198 | PackageInfo pInfo = getContext().getPackageManager().getPackageInfo(getContext().getPackageName(), 0); |
| 199 | versionString = pInfo.versionName; |
| 200 | } catch (Exception e) { |
| 201 | versionString = "0.0"; |
| 202 | } |
| 203 | setContentView(resId("layout", "main")); |
| 204 | mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime); |
| 205 | sharedPreferences = getPreferences(Context.MODE_PRIVATE); |
| 206 | progressBar = findViewById(resId("id", "pBar")); |
| 207 | progressBar.setIndeterminate(true); |
| 208 | progressBar.setVisibility(View.GONE); |
| 209 | progressText = findViewById(resId("id", "pText")); |
| 210 | progressText.setVisibility(View.GONE); |
| 211 | |
| 212 | isMIUI = isMiUi(); |
| 213 | if (isMIUI) |
| 214 | preventSleep(true); |
| 215 | |
| 216 | gamepads = getGameControllers(); |
| 217 | |
| 218 | //get total device RAM in mb |
| 219 | ActivityManager actManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); |
| 220 | ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); |
| 221 | actManager.getMemoryInfo(memInfo); |
| 222 | |
| 223 | boolean permissiongranted = checkPermission(); |
| 224 | Gadapter = new AndroidAdapter(getContext()); |
| 225 | String cpu = ""; |
| 226 | String soc = ""; |
| 227 | boolean getChipset = false; |
| 228 | // database.json source: https://github.com/xTheEc0/Android-Device-Hardware-Specs-Database |
| 229 | try { |
| 230 | InputStream is = getAssets().open("database.json"); |
| 231 | int size = is.available(); |
| 232 | byte[] buffer = new byte[size]; |
| 233 | is.read(buffer); |
| 234 | is.close(); |
| 235 | JSONObject db = new JSONObject(new String(buffer, StandardCharsets.UTF_8)); |
| 236 | JSONObject board = db.getJSONObject(Build.BOARD); |
| 237 | cpu = board.get("CPU").toString(); |
| 238 | soc = board.get("SoC").toString(); |
nothing calls this directly
no test coverage detected