|
@@ -6,8 +6,6 @@ import android.widget.Button
|
|
|
import android.widget.PopupMenu
|
|
import android.widget.PopupMenu
|
|
|
import im.angry.openeuicc.R
|
|
import im.angry.openeuicc.R
|
|
|
import im.angry.openeuicc.util.*
|
|
import im.angry.openeuicc.util.*
|
|
|
-import kotlinx.coroutines.Dispatchers
|
|
|
|
|
-import kotlinx.coroutines.withContext
|
|
|
|
|
import net.typeblog.lpac_jni.LocalProfileInfo
|
|
import net.typeblog.lpac_jni.LocalProfileInfo
|
|
|
|
|
|
|
|
class PrivilegedEuiccManagementFragment: EuiccManagementFragment() {
|
|
class PrivilegedEuiccManagementFragment: EuiccManagementFragment() {
|
|
@@ -16,14 +14,23 @@ class PrivilegedEuiccManagementFragment: EuiccManagementFragment() {
|
|
|
newInstanceEuicc(PrivilegedEuiccManagementFragment::class.java, slotId, portId)
|
|
newInstanceEuicc(PrivilegedEuiccManagementFragment::class.java, slotId, portId)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private var isMEP = false
|
|
|
|
|
+ private var isRemovable = false
|
|
|
|
|
+
|
|
|
|
|
+ override suspend fun doRefresh() {
|
|
|
|
|
+ super.doRefresh()
|
|
|
|
|
+ withEuiccChannel { channel ->
|
|
|
|
|
+ isMEP = channel.isMEP
|
|
|
|
|
+ isRemovable = channel.removable
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
override suspend fun onCreateFooterViews(
|
|
override suspend fun onCreateFooterViews(
|
|
|
parent: ViewGroup,
|
|
parent: ViewGroup,
|
|
|
profiles: List<LocalProfileInfo>
|
|
profiles: List<LocalProfileInfo>
|
|
|
): List<View> =
|
|
): List<View> =
|
|
|
super.onCreateFooterViews(parent, profiles).let { footers ->
|
|
super.onCreateFooterViews(parent, profiles).let { footers ->
|
|
|
- // isMEP can map to a slow operation (UiccCardInfo.isMultipleEnabledProfilesSupported())
|
|
|
|
|
- // so let's do it in the IO context
|
|
|
|
|
- if (withContext(Dispatchers.IO) { channel.isMEP }) {
|
|
|
|
|
|
|
+ if (isMEP) {
|
|
|
val view = layoutInflater.inflate(R.layout.footer_mep, parent, false)
|
|
val view = layoutInflater.inflate(R.layout.footer_mep, parent, false)
|
|
|
view.requireViewById<Button>(R.id.footer_mep_slot_mapping).setOnClickListener {
|
|
view.requireViewById<Button>(R.id.footer_mep_slot_mapping).setOnClickListener {
|
|
|
(requireActivity() as PrivilegedMainActivity).showSlotMappingFragment()
|
|
(requireActivity() as PrivilegedMainActivity).showSlotMappingFragment()
|
|
@@ -36,7 +43,7 @@ class PrivilegedEuiccManagementFragment: EuiccManagementFragment() {
|
|
|
|
|
|
|
|
override fun populatePopupWithProfileActions(popup: PopupMenu, profile: LocalProfileInfo) {
|
|
override fun populatePopupWithProfileActions(popup: PopupMenu, profile: LocalProfileInfo) {
|
|
|
super.populatePopupWithProfileActions(popup, profile)
|
|
super.populatePopupWithProfileActions(popup, profile)
|
|
|
- if (profile.isEnabled && !channel.removable) {
|
|
|
|
|
|
|
+ if (profile.isEnabled && !isRemovable) {
|
|
|
// Only show the disable option for non-removable eUICCs
|
|
// Only show the disable option for non-removable eUICCs
|
|
|
// Some devices without internal eUICCs have the "optimization" of ignoring SIM
|
|
// Some devices without internal eUICCs have the "optimization" of ignoring SIM
|
|
|
// slots without a valid profile. This can lead to "bricking" of external eUICCs
|
|
// slots without a valid profile. This can lead to "bricking" of external eUICCs
|