@NonNull public static synchronized RomInformation[] getRoms(Context context) { RomInformation[] roms = new RomInformation[0]; try { roms = MbtoolSocket.getInstance().getInstalledRoms(context); for (RomInformation rom : roms) { rom.setThumbnailPath( Environment.getExternalStorageDirectory() + "/MultiBoot/" + rom.getId() + "/thumbnail.webp"); rom.setWallpaperPath( Environment.getExternalStorageDirectory() + "/MultiBoot/" + rom.getId() + "/wallpaper.webp"); rom.setConfigPath( Environment.getExternalStorageDirectory() + "/MultiBoot/" + rom.getId() + "/config.json"); rom.setImageResId(R.drawable.rom_android); rom.setDefaultName(getDefaultName(context, rom)); loadConfig(rom); } } catch (IOException e) { Log.e(TAG, "mbtool communication error", e); } return roms; }
@NonNull public static synchronized RomInformation[] getBuiltinRoms(Context context) { if (mBuiltinRoms == null) { String[] ids = new String[] {"primary", "dual", "multi-slot-1", "multi-slot-2", "multi-slot-3"}; mBuiltinRoms = new RomInformation[ids.length]; for (int i = 0; i < ids.length; i++) { RomInformation rom = new RomInformation(); rom.setId(ids[i]); rom.setDefaultName(getDefaultName(context, rom)); mBuiltinRoms[i] = rom; } } return mBuiltinRoms; }