Compare commits

..

No commits in common. "16b6aceedf90fecdca944de85ceafda566eef448" and "84dd16c16923f5cad93d4ec7bb38b9f3d0ff2337" have entirely different histories.

2 changed files with 12 additions and 24 deletions

View file

@ -50,20 +50,21 @@ class NotificationsActivity: BaseEuiccAccessActivity(), OpenEuiccContextMarker {
} }
override fun onInit() { override fun onInit() {
euiccChannel = euiccChannelManager
.findEuiccChannelBySlotBlocking(intent.getIntExtra("logicalSlotId", 0))!!
notificationList.layoutManager = notificationList.layoutManager =
LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false) LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
notificationList.addItemDecoration(DividerItemDecoration(this, LinearLayoutManager.VERTICAL)) notificationList.addItemDecoration(DividerItemDecoration(this, LinearLayoutManager.VERTICAL))
notificationList.adapter = notificationAdapter notificationList.adapter = notificationAdapter
registerForContextMenu(notificationList) registerForContextMenu(notificationList)
val logicalSlotId = intent.getIntExtra("logicalSlotId", 0)
// This is slightly different from the MainActivity logic // This is slightly different from the MainActivity logic
// due to the length (we don't want to display the full USB product name) // due to the length (we don't want to display the full USB product name)
val channelTitle = if (logicalSlotId == EuiccChannelManager.USB_CHANNEL_ID) { val channelTitle = if (euiccChannel.logicalSlotId == EuiccChannelManager.USB_CHANNEL_ID) {
getString(R.string.usb) getString(R.string.usb)
} else { } else {
getString(R.string.channel_name_format, logicalSlotId) getString(R.string.channel_name_format, euiccChannel.logicalSlotId)
} }
title = getString(R.string.profile_notifications_detailed_format, channelTitle) title = getString(R.string.profile_notifications_detailed_format, channelTitle)
@ -104,18 +105,6 @@ class NotificationsActivity: BaseEuiccAccessActivity(), OpenEuiccContextMarker {
swipeRefresh.isRefreshing = true swipeRefresh.isRefreshing = true
lifecycleScope.launch { lifecycleScope.launch {
if (!this@NotificationsActivity::euiccChannel.isInitialized) {
withContext(Dispatchers.IO) {
euiccChannelManagerLoaded.await()
euiccChannel = euiccChannelManager.findEuiccChannelBySlotBlocking(
intent.getIntExtra(
"logicalSlotId",
0
)
)!!
}
}
task() task()
swipeRefresh.isRefreshing = false swipeRefresh.isRefreshing = false

View file

@ -149,6 +149,13 @@ class ProfileDownloadFragment : BaseMaterialDialogFragment(),
@SuppressLint("MissingPermission") @SuppressLint("MissingPermission")
override fun onStart() { override fun onStart() {
super.onStart() super.onStart()
profileDownloadIMEI.editText!!.text = Editable.Factory.getInstance().newEditable(
try {
telephonyManager.getImei(channel.logicalSlotId) ?: ""
} catch (e: Exception) {
""
}
)
lifecycleScope.launch(Dispatchers.IO) { lifecycleScope.launch(Dispatchers.IO) {
ensureEuiccChannelManager() ensureEuiccChannelManager()
@ -159,12 +166,6 @@ class ProfileDownloadFragment : BaseMaterialDialogFragment(),
return@launch return@launch
} }
val imei = try {
telephonyManager.getImei(channel.logicalSlotId) ?: ""
} catch (e: Exception) {
""
}
// Fetch remaining NVRAM // Fetch remaining NVRAM
val str = channel.lpa.euiccInfo2?.freeNvram?.also { val str = channel.lpa.euiccInfo2?.freeNvram?.also {
freeNvram = it freeNvram = it
@ -173,8 +174,6 @@ class ProfileDownloadFragment : BaseMaterialDialogFragment(),
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
profileDownloadFreeSpace.text = getString(R.string.profile_download_free_space, profileDownloadFreeSpace.text = getString(R.string.profile_download_free_space,
str ?: getText(R.string.unknown)) str ?: getText(R.string.unknown))
profileDownloadIMEI.editText!!.text =
Editable.Factory.getInstance().newEditable(imei)
} }
} }
} }