Compare commits
1 commit
92a85771a2
...
85636bcbb8
Author | SHA1 | Date | |
---|---|---|---|
85636bcbb8 |
2 changed files with 14 additions and 13 deletions
|
@ -380,16 +380,6 @@ class EuiccChannelManagerService : LifecycleService(), OpenEuiccContextMarker {
|
||||||
getString(R.string.task_profile_download_failure),
|
getString(R.string.task_profile_download_failure),
|
||||||
R.drawable.ic_task_sim_card_download
|
R.drawable.ic_task_sim_card_download
|
||||||
) {
|
) {
|
||||||
val callback = object : ProfileDownloadCallback {
|
|
||||||
override fun onStateUpdate(state: ProfileDownloadCallback.DownloadState) {
|
|
||||||
if (state.progress == 0) return
|
|
||||||
foregroundTaskState.value = ForegroundTaskState.InProgress(state.progress)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onProfileMetadata(metadata: ProfileDownloadCallback.ProfileMetadata) {
|
|
||||||
Log.d(TAG, "Received profile metadata: $metadata")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
euiccChannelManager.beginTrackedOperation(slotId, portId) {
|
euiccChannelManager.beginTrackedOperation(slotId, portId) {
|
||||||
euiccChannelManager.withEuiccChannel(slotId, portId) { channel ->
|
euiccChannelManager.withEuiccChannel(slotId, portId) { channel ->
|
||||||
channel.lpa.downloadProfile(
|
channel.lpa.downloadProfile(
|
||||||
|
@ -397,8 +387,13 @@ class EuiccChannelManagerService : LifecycleService(), OpenEuiccContextMarker {
|
||||||
matchingId,
|
matchingId,
|
||||||
imei,
|
imei,
|
||||||
confirmationCode,
|
confirmationCode,
|
||||||
callback
|
object : ProfileDownloadCallback {
|
||||||
)
|
override fun onStateUpdate(state: ProfileDownloadCallback.DownloadState) {
|
||||||
|
if (state.progress == 0) return
|
||||||
|
foregroundTaskState.value =
|
||||||
|
ForegroundTaskState.InProgress(state.progress)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
preferenceRepository.notificationDownloadFlow.first()
|
preferenceRepository.notificationDownloadFlow.first()
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package net.typeblog.lpac_jni
|
package net.typeblog.lpac_jni
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
|
|
||||||
interface ProfileDownloadCallback {
|
interface ProfileDownloadCallback {
|
||||||
companion object {
|
companion object {
|
||||||
|
private const val TAG = "ProfileDownloadCallback"
|
||||||
|
|
||||||
fun lookupStateFromProgress(progress: Int): DownloadState = when (progress) {
|
fun lookupStateFromProgress(progress: Int): DownloadState = when (progress) {
|
||||||
0 -> DownloadState.Preparing
|
0 -> DownloadState.Preparing
|
||||||
20 -> DownloadState.Connecting
|
20 -> DownloadState.Connecting
|
||||||
|
@ -31,5 +35,7 @@ interface ProfileDownloadCallback {
|
||||||
|
|
||||||
fun onStateUpdate(state: DownloadState)
|
fun onStateUpdate(state: DownloadState)
|
||||||
|
|
||||||
fun onProfileMetadata(metadata: ProfileMetadata)
|
fun onProfileMetadata(metadata: ProfileMetadata) {
|
||||||
|
Log.d(TAG, "Received profile metadata: $metadata")
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue