ui: Fix frame drops by calling isMEP in the IO context
All checks were successful
/ build-debug (push) Successful in 4m10s

For whatever reason, UiccCardInfo.isMultipleEnabledProfilesSupported()
can be slow only on some SIM slots.
This commit is contained in:
Peter Cai 2024-07-01 20:08:05 -04:00
parent 960fa6743a
commit 9c7cf2c797

View file

@ -6,6 +6,8 @@ import android.widget.Button
import android.widget.PopupMenu
import im.angry.openeuicc.R
import im.angry.openeuicc.util.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import net.typeblog.lpac_jni.LocalProfileInfo
class PrivilegedEuiccManagementFragment: EuiccManagementFragment() {
@ -15,7 +17,9 @@ class PrivilegedEuiccManagementFragment: EuiccManagementFragment() {
override suspend fun onCreateFooterViews(parent: ViewGroup): List<View> =
if (channel.isMEP) {
// isMEP can map to a slow operation (UiccCardInfo.isMultipleEnabledProfilesSupported())
// so let's do it in the IO context
if (withContext(Dispatchers.IO) { channel.isMEP }) {
val view = layoutInflater.inflate(R.layout.footer_mep, parent, false)
view.requireViewById<Button>(R.id.footer_mep_slot_mapping).setOnClickListener {
(requireActivity() as PrivilegedMainActivity).showSlotMappingFragment()