fix: replace printStackTrace with Log.e for better error logging #156
8 changed files with 13 additions and 11 deletions
|
@ -258,7 +258,7 @@ open class DefaultEuiccChannelManager(
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
// Ignored -- skip forward
|
// Ignored -- skip forward
|
||||||
e.printStackTrace()
|
Log.e(TAG, "Failed to open eUICC channel on USB device ${device.deviceId}:${device.vendorId}", e)
|
||||||
}
|
}
|
||||||
Log.i(TAG, "No valid eUICC channel found on USB device ${device.deviceId}:${device.vendorId}")
|
Log.i(TAG, "No valid eUICC channel found on USB device ${device.deviceId}:${device.vendorId}")
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,7 @@ class OmapiApduInterface(
|
||||||
|
|
||||||
throw RuntimeException("Retransmit attempts exhausted; this was likely caused by checksum errors")
|
throw RuntimeException("Retransmit attempts exhausted; this was likely caused by checksum errors")
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e(TAG, "OMAPI APDU exception")
|
Log.e(TAG, "OMAPI APDU exception", e)
|
||||||
e.printStackTrace()
|
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ class UsbApduInterface(
|
||||||
// https://www.usb.org/sites/default/files/DWG_Smart-Card_USB-ICC_ICCD_rev10.pdf
|
// https://www.usb.org/sites/default/files/DWG_Smart-Card_USB-ICC_ICCD_rev10.pdf
|
||||||
atr = transceiver.iccPowerOn().data
|
atr = transceiver.iccPowerOn().data
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
Log.e(TAG, "Failed to power on ICC", e)
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ class UsbApduInterface(
|
||||||
val resp = try {
|
val resp = try {
|
||||||
transmitApduByChannel(req, 0)
|
transmitApduByChannel(req, 0)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
Log.e(TAG, "OPEN LOGICAL CHANNEL failed", e)
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ suspend inline fun EuiccChannelManager.beginTrackedOperation(
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
// Ignore any error during notification handling
|
// Ignore any error during notification handling
|
||||||
e.printStackTrace()
|
Log.e(TAG, "Error during notification handling", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.d(TAG, "Operation complete")
|
Log.d(TAG, "Operation complete")
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package im.angry.openeuicc
|
package im.angry.openeuicc
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.util.Log
|
||||||
import im.angry.openeuicc.di.UnprivilegedAppContainer
|
import im.angry.openeuicc.di.UnprivilegedAppContainer
|
||||||
import im.angry.openeuicc.ui.LogsActivity
|
import im.angry.openeuicc.ui.LogsActivity
|
||||||
import im.angry.openeuicc.util.*
|
import im.angry.openeuicc.util.*
|
||||||
|
@ -16,7 +17,7 @@ class UnprivilegedOpenEuiccApplication : OpenEuiccApplication() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
|
|
||||||
Thread.setDefaultUncaughtExceptionHandler { _, e ->
|
Thread.setDefaultUncaughtExceptionHandler { _, e ->
|
||||||
e.printStackTrace()
|
Log.e(TAG, "Uncaught exception", e)
|
||||||
Intent(this, LogsActivity::class.java).apply {
|
Intent(this, LogsActivity::class.java).apply {
|
||||||
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
|
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
|
||||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.content.pm.PackageManager
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.se.omapi.Reader
|
import android.se.omapi.Reader
|
||||||
import android.telephony.TelephonyManager
|
import android.telephony.TelephonyManager
|
||||||
|
import android.util.Log
|
||||||
import im.angry.easyeuicc.R
|
import im.angry.easyeuicc.R
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
|
@ -155,7 +156,7 @@ internal class IsdrChannelAccessCheck(private val context: Context): Compatibili
|
||||||
// SecurityException is only thrown when Channel is constructed, which means everything else needs to succeed
|
// SecurityException is only thrown when Channel is constructed, which means everything else needs to succeed
|
||||||
Pair(it.slotIndex, State.SUCCESS)
|
Pair(it.slotIndex, State.SUCCESS)
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
e.printStackTrace()
|
Log.e(TAG, "Failed to open logical channel", e)
|
||||||
if (e.message?.contains("Secure Element is not present") == true) {
|
if (e.message?.contains("Secure Element is not present") == true) {
|
||||||
failureDescription = context.getString(R.string.compatibility_check_isdr_channel_desc_unknown)
|
failureDescription = context.getString(R.string.compatibility_check_isdr_channel_desc_unknown)
|
||||||
Pair(it.slotIndex, State.FAILURE_UNKNOWN)
|
Pair(it.slotIndex, State.FAILURE_UNKNOWN)
|
||||||
|
@ -163,7 +164,7 @@ internal class IsdrChannelAccessCheck(private val context: Context): Compatibili
|
||||||
Pair(it.slotIndex, State.FAILURE)
|
Pair(it.slotIndex, State.FAILURE)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
Log.e(TAG, "Failed to open logical channel", e)
|
||||||
Pair(it.slotIndex, State.FAILURE)
|
Pair(it.slotIndex, State.FAILURE)
|
||||||
}
|
}
|
||||||
}.fold(Pair(mutableListOf<Int>(), State.SUCCESS)) { (ids, result), (id, ok) ->
|
}.fold(Pair(mutableListOf<Int>(), State.SUCCESS)) { (ids, result), (id, ok) ->
|
||||||
|
|
|
@ -3,6 +3,7 @@ package im.angry.openeuicc.util
|
||||||
import android.telephony.SubscriptionManager
|
import android.telephony.SubscriptionManager
|
||||||
import android.telephony.TelephonyManager
|
import android.telephony.TelephonyManager
|
||||||
import android.telephony.UiccSlotMapping
|
import android.telephony.UiccSlotMapping
|
||||||
|
import android.util.Log
|
||||||
import im.angry.openeuicc.core.EuiccChannel
|
import im.angry.openeuicc.core.EuiccChannel
|
||||||
import im.angry.openeuicc.core.EuiccChannelManager
|
import im.angry.openeuicc.core.EuiccChannelManager
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
|
@ -68,7 +69,7 @@ suspend fun TelephonyManager.updateSimSlotMapping(
|
||||||
try {
|
try {
|
||||||
simSlotMapping = newMapping
|
simSlotMapping = newMapping
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
Log.e(TAG, "Failed to update sim slot mapping", e)
|
||||||
undo.forEach { it() } // Undo what we just did
|
undo.forEach { it() } // Undo what we just did
|
||||||
throw e // Rethrow for caller to handle
|
throw e // Rethrow for caller to handle
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ class HttpInterfaceImpl(
|
||||||
|
|
||||||
return HttpInterface.HttpResponse(conn.responseCode, bytes)
|
return HttpInterface.HttpResponse(conn.responseCode, bytes)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
Log.e(TAG, "Failed to transmit", e)
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue