瀏覽代碼

Handle "ghost" SIM slots gracefully

On devices like the Japanese versions of Sony Xperia 5 II, the telephony
HAL can end up reporting a "ghost" SIM slot that does not actually exist
and (thus) has no IMEI assigned to it. In this case, our code would
crash since we assumed every SIM slot reported to the telephony
framework should be valid. The fix is simple -- abort when we realize
that the SIM slot has no IMEI.
Peter Cai 3 年之前
父節點
當前提交
a461ef9208
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      app/src/main/java/im/angry/openeuicc/core/EuiccChannelManager.kt

+ 1 - 1
app/src/main/java/im/angry/openeuicc/core/EuiccChannelManager.kt

@@ -66,7 +66,7 @@ class EuiccChannelManager(private val context: Context) {
                 uiccInfo.slotIndex,
                 uiccInfo.cardId,
                 "SIM ${uiccInfo.slotIndex}",
-                tm.getImei(uiccInfo.slotIndex),
+                tm.getImei(uiccInfo.slotIndex) ?: return null,
                 uiccInfo.isRemovable
             )