forked from PeterCxy/OpenEUICC
Compare commits
6 commits
360760b78f
...
dc6b3a4810
Author | SHA1 | Date | |
---|---|---|---|
dc6b3a4810 | |||
e08f8beb45 | |||
6b169c505d | |||
33d383a3ce | |||
291869207a | |||
a6286ed097 |
15 changed files with 80 additions and 37 deletions
|
@ -7,6 +7,7 @@
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:enableOnBackInvokedCallback="true"
|
android:enableOnBackInvokedCallback="true"
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.os.Binder
|
import android.os.Binder
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
|
import android.os.PowerManager
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.core.app.NotificationChannelCompat
|
import androidx.core.app.NotificationChannelCompat
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
|
@ -11,6 +12,7 @@ import androidx.core.app.NotificationManagerCompat
|
||||||
import androidx.lifecycle.LifecycleService
|
import androidx.lifecycle.LifecycleService
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import im.angry.openeuicc.common.R
|
import im.angry.openeuicc.common.R
|
||||||
|
import im.angry.openeuicc.core.EuiccChannel
|
||||||
import im.angry.openeuicc.core.EuiccChannelManager
|
import im.angry.openeuicc.core.EuiccChannelManager
|
||||||
import im.angry.openeuicc.util.*
|
import im.angry.openeuicc.util.*
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
@ -91,6 +93,12 @@ class EuiccChannelManagerService : LifecycleService(), OpenEuiccContextMarker {
|
||||||
}
|
}
|
||||||
val euiccChannelManager: EuiccChannelManager by euiccChannelManagerDelegate
|
val euiccChannelManager: EuiccChannelManager by euiccChannelManagerDelegate
|
||||||
|
|
||||||
|
private val wakeLock: PowerManager.WakeLock by lazy {
|
||||||
|
(getSystemService(POWER_SERVICE) as PowerManager).run {
|
||||||
|
newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, this::class.simpleName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The state of a "foreground" task (named so due to the need to startForeground())
|
* The state of a "foreground" task (named so due to the need to startForeground())
|
||||||
*/
|
*/
|
||||||
|
@ -275,6 +283,8 @@ class EuiccChannelManagerService : LifecycleService(), OpenEuiccContextMarker {
|
||||||
|
|
||||||
updateForegroundNotification(title, iconRes)
|
updateForegroundNotification(title, iconRes)
|
||||||
|
|
||||||
|
wakeLock.acquire(10 * 60 * 1000L /*10 minutes*/)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
withContext(Dispatchers.IO + NonCancellable) { // Any LPA-related task must always complete
|
withContext(Dispatchers.IO + NonCancellable) { // Any LPA-related task must always complete
|
||||||
this@EuiccChannelManagerService.task()
|
this@EuiccChannelManagerService.task()
|
||||||
|
@ -290,6 +300,7 @@ class EuiccChannelManagerService : LifecycleService(), OpenEuiccContextMarker {
|
||||||
postForegroundTaskFailureNotification(failureTitle)
|
postForegroundTaskFailureNotification(failureTitle)
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
wakeLock.release()
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
stopSelf()
|
stopSelf()
|
||||||
}
|
}
|
||||||
|
@ -446,30 +457,34 @@ class EuiccChannelManagerService : LifecycleService(), OpenEuiccContextMarker {
|
||||||
iccid: String,
|
iccid: String,
|
||||||
enable: Boolean, // Enable or disable the profile indicated in iccid
|
enable: Boolean, // Enable or disable the profile indicated in iccid
|
||||||
reconnectTimeoutMillis: Long = 0 // 0 = do not wait for reconnect
|
reconnectTimeoutMillis: Long = 0 // 0 = do not wait for reconnect
|
||||||
): ForegroundTaskSubscriberFlow =
|
) =
|
||||||
launchForegroundTask(
|
launchForegroundTask(
|
||||||
getString(R.string.task_profile_switch),
|
getString(R.string.task_profile_switch),
|
||||||
getString(R.string.task_profile_switch_failure),
|
getString(R.string.task_profile_switch_failure),
|
||||||
R.drawable.ic_task_switch
|
R.drawable.ic_task_switch
|
||||||
) {
|
) {
|
||||||
euiccChannelManager.beginTrackedOperation(slotId, portId) {
|
euiccChannelManager.beginTrackedOperation(slotId, portId) {
|
||||||
val (res, refreshed) = euiccChannelManager.withEuiccChannel(
|
val (response, refreshed) =
|
||||||
slotId,
|
euiccChannelManager.withEuiccChannel(slotId, portId) { channel ->
|
||||||
portId
|
val refresh = preferenceRepository.refreshAfterSwitchFlow.first()
|
||||||
) { channel ->
|
val response = channel.lpa.switchProfile(iccid, enable, refresh)
|
||||||
if (!channel.lpa.switchProfile(iccid, enable, refresh = true)) {
|
if (response || !refresh) {
|
||||||
// Sometimes, we *can* enable or disable the profile, but we cannot
|
Pair(response, refresh)
|
||||||
// send the refresh command to the modem because the profile somehow
|
} else {
|
||||||
// makes the modem "busy". In this case, we can still switch by setting
|
// refresh failed, but refresh was requested
|
||||||
// refresh to false, but then the switch cannot take effect until the
|
// Sometimes, we *can* enable or disable the profile, but we cannot
|
||||||
// user resets the modem manually by toggling airplane mode or rebooting.
|
// send the refresh command to the modem because the profile somehow
|
||||||
Pair(channel.lpa.switchProfile(iccid, enable, refresh = false), false)
|
// makes the modem "busy". In this case, we can still switch by setting
|
||||||
} else {
|
// refresh to false, but then the switch cannot take effect until the
|
||||||
Pair(true, true)
|
// user resets the modem manually by toggling airplane mode or rebooting.
|
||||||
|
Pair(
|
||||||
|
channel.lpa.switchProfile(iccid, enable, refresh = false),
|
||||||
|
false
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!res) {
|
if (!response) {
|
||||||
throw RuntimeException("Could not switch profile")
|
throw RuntimeException("Could not switch profile")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,9 @@ open class SettingsFragment: PreferenceFragmentCompat() {
|
||||||
requirePreference<CheckBoxPreference>("pref_developer_ignore_tls_certificate")
|
requirePreference<CheckBoxPreference>("pref_developer_ignore_tls_certificate")
|
||||||
.bindBooleanFlow(preferenceRepository.ignoreTLSCertificateFlow)
|
.bindBooleanFlow(preferenceRepository.ignoreTLSCertificateFlow)
|
||||||
|
|
||||||
|
requirePreference<CheckBoxPreference>("pref_developer_refresh_after_switch")
|
||||||
|
.bindBooleanFlow(preferenceRepository.refreshAfterSwitchFlow)
|
||||||
|
|
||||||
requirePreference<CheckBoxPreference>("pref_developer_euicc_memory_reset")
|
requirePreference<CheckBoxPreference>("pref_developer_euicc_memory_reset")
|
||||||
.bindBooleanFlow(preferenceRepository.euiccMemoryResetFlow)
|
.bindBooleanFlow(preferenceRepository.euiccMemoryResetFlow)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package im.angry.openeuicc.ui.wizard
|
||||||
import android.app.assist.AssistContent
|
import android.app.assist.AssistContent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.WindowManager
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.ProgressBar
|
import android.widget.ProgressBar
|
||||||
|
@ -251,6 +252,14 @@ class DownloadWizardActivity: BaseEuiccAccessActivity() {
|
||||||
supportFragmentManager.beginTransaction().setCustomAnimations(enterAnim, exitAnim)
|
supportFragmentManager.beginTransaction().setCustomAnimations(enterAnim, exitAnim)
|
||||||
.replace(R.id.step_fragment_container, nextFrag)
|
.replace(R.id.step_fragment_container, nextFrag)
|
||||||
.commit()
|
.commit()
|
||||||
|
|
||||||
|
// Sync screen on state
|
||||||
|
if (nextFrag.keepScreenOn) {
|
||||||
|
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
|
} else {
|
||||||
|
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
|
}
|
||||||
|
|
||||||
refreshButtons()
|
refreshButtons()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,6 +289,8 @@ class DownloadWizardActivity: BaseEuiccAccessActivity() {
|
||||||
protected val state: DownloadWizardState
|
protected val state: DownloadWizardState
|
||||||
get() = (requireActivity() as DownloadWizardActivity).state
|
get() = (requireActivity() as DownloadWizardActivity).state
|
||||||
|
|
||||||
|
open val keepScreenOn = false
|
||||||
|
|
||||||
abstract val hasNext: Boolean
|
abstract val hasNext: Boolean
|
||||||
abstract val hasPrev: Boolean
|
abstract val hasPrev: Boolean
|
||||||
abstract fun createNextFragment(): DownloadWizardStepFragment?
|
abstract fun createNextFragment(): DownloadWizardStepFragment?
|
||||||
|
|
|
@ -59,6 +59,9 @@ class DownloadWizardProgressFragment : DownloadWizardActivity.DownloadWizardStep
|
||||||
|
|
||||||
private val adapter = ProgressItemAdapter()
|
private val adapter = ProgressItemAdapter()
|
||||||
|
|
||||||
|
// We don't want to turn off the screen during a download
|
||||||
|
override val keepScreenOn = true
|
||||||
|
|
||||||
private var isDone = false
|
private var isDone = false
|
||||||
|
|
||||||
override val hasNext: Boolean
|
override val hasNext: Boolean
|
||||||
|
|
|
@ -31,6 +31,7 @@ internal object PreferenceKeys {
|
||||||
|
|
||||||
// ---- Developer Options ----
|
// ---- Developer Options ----
|
||||||
val DEVELOPER_OPTIONS_ENABLED = booleanPreferencesKey("developer_options_enabled")
|
val DEVELOPER_OPTIONS_ENABLED = booleanPreferencesKey("developer_options_enabled")
|
||||||
|
val REFRESH_AFTER_SWITCH = booleanPreferencesKey("refresh_after_switch")
|
||||||
val UNFILTERED_PROFILE_LIST = booleanPreferencesKey("unfiltered_profile_list")
|
val UNFILTERED_PROFILE_LIST = booleanPreferencesKey("unfiltered_profile_list")
|
||||||
val IGNORE_TLS_CERTIFICATE = booleanPreferencesKey("ignore_tls_certificate")
|
val IGNORE_TLS_CERTIFICATE = booleanPreferencesKey("ignore_tls_certificate")
|
||||||
val EUICC_MEMORY_RESET = booleanPreferencesKey("euicc_memory_reset")
|
val EUICC_MEMORY_RESET = booleanPreferencesKey("euicc_memory_reset")
|
||||||
|
@ -48,6 +49,7 @@ open class PreferenceRepository(private val context: Context) {
|
||||||
val verboseLoggingFlow = bindFlow(PreferenceKeys.VERBOSE_LOGGING, false)
|
val verboseLoggingFlow = bindFlow(PreferenceKeys.VERBOSE_LOGGING, false)
|
||||||
|
|
||||||
// ---- Developer Options ----
|
// ---- Developer Options ----
|
||||||
|
val refreshAfterSwitchFlow = bindFlow(PreferenceKeys.REFRESH_AFTER_SWITCH, true)
|
||||||
val developerOptionsEnabledFlow = bindFlow(PreferenceKeys.DEVELOPER_OPTIONS_ENABLED, false)
|
val developerOptionsEnabledFlow = bindFlow(PreferenceKeys.DEVELOPER_OPTIONS_ENABLED, false)
|
||||||
val unfilteredProfileListFlow = bindFlow(PreferenceKeys.UNFILTERED_PROFILE_LIST, false)
|
val unfilteredProfileListFlow = bindFlow(PreferenceKeys.UNFILTERED_PROFILE_LIST, false)
|
||||||
val ignoreTLSCertificateFlow = bindFlow(PreferenceKeys.IGNORE_TLS_CERTIFICATE, false)
|
val ignoreTLSCertificateFlow = bindFlow(PreferenceKeys.IGNORE_TLS_CERTIFICATE, false)
|
||||||
|
@ -60,15 +62,12 @@ open class PreferenceRepository(private val context: Context) {
|
||||||
class PreferenceFlowWrapper<T> private constructor(
|
class PreferenceFlowWrapper<T> private constructor(
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
private val key: Preferences.Key<T>,
|
private val key: Preferences.Key<T>,
|
||||||
inner: Flow<T>
|
inner: Flow<T>,
|
||||||
) : Flow<T> by inner {
|
) : Flow<T> by inner {
|
||||||
internal constructor(context: Context, key: Preferences.Key<T>, defaultValue: T) : this(
|
internal constructor(context: Context, key: Preferences.Key<T>, defaultValue: T) :
|
||||||
context,
|
this(context, key, context.dataStore.data.map { it[key] ?: defaultValue })
|
||||||
key,
|
|
||||||
context.dataStore.data.map { it[key] ?: defaultValue }
|
|
||||||
)
|
|
||||||
|
|
||||||
suspend fun updatePreference(value: T) {
|
suspend fun updatePreference(value: T) {
|
||||||
context.dataStore.edit { it[key] = value }
|
context.dataStore.edit { it[key] = value }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,9 @@ interface OpenEuiccContextMarker {
|
||||||
val appContainer: AppContainer
|
val appContainer: AppContainer
|
||||||
get() = openEuiccApplication.appContainer
|
get() = openEuiccApplication.appContainer
|
||||||
|
|
||||||
|
val preferenceRepository: PreferenceRepository
|
||||||
|
get() = appContainer.preferenceRepository
|
||||||
|
|
||||||
val telephonyManager: TelephonyManager
|
val telephonyManager: TelephonyManager
|
||||||
get() = appContainer.telephonyManager
|
get() = appContainer.telephonyManager
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,6 +143,7 @@
|
||||||
<string name="pref_advanced_logs">ログ</string>
|
<string name="pref_advanced_logs">ログ</string>
|
||||||
<string name="pref_advanced_logs_desc">アプリの最新デバッグログを表示します</string>
|
<string name="pref_advanced_logs_desc">アプリの最新デバッグログを表示します</string>
|
||||||
<string name="pref_developer">開発者オプション</string>
|
<string name="pref_developer">開発者オプション</string>
|
||||||
|
<string name="pref_developer_refresh_after_switch_desc">プロファイルを切り替えた後にモデムに更新コマンドを送信するかどうか。クラッシュが発生する場合は、これを無効にしてみてください。</string>
|
||||||
<string name="pref_developer_unfiltered_profile_list">フィルタリングされていないプロファイル一覧を表示</string>
|
<string name="pref_developer_unfiltered_profile_list">フィルタリングされていないプロファイル一覧を表示</string>
|
||||||
<string name="pref_developer_unfiltered_profile_list_desc">非運用のプロファイルも含めます</string>
|
<string name="pref_developer_unfiltered_profile_list_desc">非運用のプロファイルも含めます</string>
|
||||||
<string name="pref_developer_ignore_tls_certificate">SM-DP+ TLS 証明書を無視する</string>
|
<string name="pref_developer_ignore_tls_certificate">SM-DP+ TLS 証明書を無視する</string>
|
||||||
|
@ -162,4 +163,5 @@
|
||||||
<string name="euicc_memory_reset_invoke_button">消去する</string>
|
<string name="euicc_memory_reset_invoke_button">消去する</string>
|
||||||
<string name="pref_developer_euicc_memory_reset">eUICC の消去を可能にする</string>
|
<string name="pref_developer_euicc_memory_reset">eUICC の消去を可能にする</string>
|
||||||
<string name="pref_developer_euicc_memory_reset_desc">この操作は、デフォルトでは非表示になっている危険な操作です。代わりに、すべての構成ファイルを手動で削除することもできます。</string>
|
<string name="pref_developer_euicc_memory_reset_desc">この操作は、デフォルトでは非表示になっている危険な操作です。代わりに、すべての構成ファイルを手動で削除することもできます。</string>
|
||||||
|
<string name="pref_developer_refresh_after_switch">モデムに更新コマンドを送信</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -145,6 +145,7 @@
|
||||||
<string name="pref_advanced_language">语言</string>
|
<string name="pref_advanced_language">语言</string>
|
||||||
<string name="pref_advanced_language_desc">选择 App 语言</string>
|
<string name="pref_advanced_language_desc">选择 App 语言</string>
|
||||||
<string name="pref_developer">开发者选项</string>
|
<string name="pref_developer">开发者选项</string>
|
||||||
|
<string name="pref_developer_refresh_after_switch_desc">切换配置文件后是否向基带发送刷新命令。如果发现崩溃,请尝试禁用此功能。</string>
|
||||||
<string name="pref_developer_unfiltered_profile_list">显示未经过滤的配置文件列表</string>
|
<string name="pref_developer_unfiltered_profile_list">显示未经过滤的配置文件列表</string>
|
||||||
<string name="pref_developer_unfiltered_profile_list_desc">在配置文件列表中包括非生产环境的配置文件</string>
|
<string name="pref_developer_unfiltered_profile_list_desc">在配置文件列表中包括非生产环境的配置文件</string>
|
||||||
<string name="pref_developer_ignore_tls_certificate">无视 SM-DP+ 的 TLS 证书</string>
|
<string name="pref_developer_ignore_tls_certificate">无视 SM-DP+ 的 TLS 证书</string>
|
||||||
|
@ -162,4 +163,5 @@
|
||||||
<string name="euicc_memory_reset_invoke_button">擦除</string>
|
<string name="euicc_memory_reset_invoke_button">擦除</string>
|
||||||
<string name="pref_developer_euicc_memory_reset">允许擦除 eUICC</string>
|
<string name="pref_developer_euicc_memory_reset">允许擦除 eUICC</string>
|
||||||
<string name="pref_developer_euicc_memory_reset_desc">此操作是默认隐藏的危险操作。作为替代方案,您可以手动删除所有配置文件。</string>
|
<string name="pref_developer_euicc_memory_reset_desc">此操作是默认隐藏的危险操作。作为替代方案,您可以手动删除所有配置文件。</string>
|
||||||
|
<string name="pref_developer_refresh_after_switch">向基带发送刷新命令</string>
|
||||||
</resources>
|
</resources>
|
|
@ -145,6 +145,7 @@
|
||||||
<string name="pref_advanced_language">語言</string>
|
<string name="pref_advanced_language">語言</string>
|
||||||
<string name="pref_advanced_language_desc">選擇 App 語言</string>
|
<string name="pref_advanced_language_desc">選擇 App 語言</string>
|
||||||
<string name="pref_developer">開發人員選項</string>
|
<string name="pref_developer">開發人員選項</string>
|
||||||
|
<string name="pref_developer_refresh_after_switch_desc">切換設定檔後是否向基帶發送刷新命令。如果發現崩潰,請嘗試停用此功能。</string>
|
||||||
<string name="pref_developer_unfiltered_profile_list">顯示未經過濾的設定檔列表</string>
|
<string name="pref_developer_unfiltered_profile_list">顯示未經過濾的設定檔列表</string>
|
||||||
<string name="pref_developer_unfiltered_profile_list_desc">在設定檔列表中包括非生產環境的設定檔</string>
|
<string name="pref_developer_unfiltered_profile_list_desc">在設定檔列表中包括非生產環境的設定檔</string>
|
||||||
<string name="pref_developer_ignore_tls_certificate">忽略 SM-DP+ 的 TLS 證書</string>
|
<string name="pref_developer_ignore_tls_certificate">忽略 SM-DP+ 的 TLS 證書</string>
|
||||||
|
@ -162,4 +163,5 @@
|
||||||
<string name="euicc_memory_reset_invoke_button">擦除</string>
|
<string name="euicc_memory_reset_invoke_button">擦除</string>
|
||||||
<string name="pref_developer_euicc_memory_reset">允許擦除 eUICC</string>
|
<string name="pref_developer_euicc_memory_reset">允許擦除 eUICC</string>
|
||||||
<string name="pref_developer_euicc_memory_reset_desc">此操作是預設隱藏的危險操作。作為替代方案,您可以手動刪除所有設定檔。</string>
|
<string name="pref_developer_euicc_memory_reset_desc">此操作是預設隱藏的危險操作。作為替代方案,您可以手動刪除所有設定檔。</string>
|
||||||
|
<string name="pref_developer_refresh_after_switch">向基帶發送刷新命令</string>
|
||||||
</resources>
|
</resources>
|
|
@ -181,6 +181,8 @@
|
||||||
<string name="pref_advanced_logs">Logs</string>
|
<string name="pref_advanced_logs">Logs</string>
|
||||||
<string name="pref_advanced_logs_desc">View recent debug logs of the application</string>
|
<string name="pref_advanced_logs_desc">View recent debug logs of the application</string>
|
||||||
<string name="pref_developer">Developer Options</string>
|
<string name="pref_developer">Developer Options</string>
|
||||||
|
<string name="pref_developer_refresh_after_switch">Send refresh command to modem</string>
|
||||||
|
<string name="pref_developer_refresh_after_switch_desc">Whether to send a refresh command to the modem after switching profiles. Try disabling this if you see crashes.</string>
|
||||||
<string name="pref_developer_unfiltered_profile_list">Show unfiltered profile list</string>
|
<string name="pref_developer_unfiltered_profile_list">Show unfiltered profile list</string>
|
||||||
<string name="pref_developer_unfiltered_profile_list_desc">Include non-production profiles in the list</string>
|
<string name="pref_developer_unfiltered_profile_list_desc">Include non-production profiles in the list</string>
|
||||||
<string name="pref_developer_ignore_tls_certificate">Ignore SM-DP+ TLS certificate</string>
|
<string name="pref_developer_ignore_tls_certificate">Ignore SM-DP+ TLS certificate</string>
|
||||||
|
|
|
@ -57,6 +57,12 @@
|
||||||
app:title="@string/pref_developer"
|
app:title="@string/pref_developer"
|
||||||
app:iconSpaceReserved="false">
|
app:iconSpaceReserved="false">
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
app:iconSpaceReserved="false"
|
||||||
|
app:key="pref_developer_refresh_after_switch"
|
||||||
|
app:summary="@string/pref_developer_refresh_after_switch_desc"
|
||||||
|
app:title="@string/pref_developer_refresh_after_switch" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
app:key="pref_developer_unfiltered_profile_list"
|
app:key="pref_developer_unfiltered_profile_list"
|
||||||
|
|
|
@ -5,12 +5,14 @@
|
||||||
<item>com.android.stk/.StkMainHide</item>
|
<item>com.android.stk/.StkMainHide</item>
|
||||||
<item>com.android.stk/.StkListActivity</item>
|
<item>com.android.stk/.StkListActivity</item>
|
||||||
<item>com.android.stk/.StkLauncherListActivity</item>
|
<item>com.android.stk/.StkLauncherListActivity</item>
|
||||||
|
<item>com.android.stk/.StkSelectionActivity</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="sim_toolkit_slot_1">
|
<string-array name="sim_toolkit_slot_1">
|
||||||
<item>com.android.stk/.StkMain1</item>
|
<item>com.android.stk/.StkMain1</item>
|
||||||
<item>com.android.stk/.PrimaryStkMain</item>
|
<item>com.android.stk/.PrimaryStkMain</item>
|
||||||
<item>com.android.stk/.StkLauncherActivity</item>
|
<item>com.android.stk/.StkLauncherActivity</item>
|
||||||
<item>com.android.stk/.StkLauncherActivity_Chn</item>
|
<item>com.android.stk/.StkLauncherActivity_Chn</item>
|
||||||
|
<item>com.android.stk/.StkLauncherActivity1</item>
|
||||||
<item>com.android.stk/.StkLauncherActivityI</item>
|
<item>com.android.stk/.StkLauncherActivityI</item>
|
||||||
<item>com.android.stk/.OppoStkLauncherActivity1</item>
|
<item>com.android.stk/.OppoStkLauncherActivity1</item>
|
||||||
<item>com.android.stk/.OplusStkLauncherActivity1</item>
|
<item>com.android.stk/.OplusStkLauncherActivity1</item>
|
||||||
|
|
|
@ -10,9 +10,8 @@ import java.lang.IllegalArgumentException
|
||||||
|
|
||||||
class PrivilegedEuiccChannelFactory(context: Context) : DefaultEuiccChannelFactory(context),
|
class PrivilegedEuiccChannelFactory(context: Context) : DefaultEuiccChannelFactory(context),
|
||||||
PrivilegedEuiccContextMarker {
|
PrivilegedEuiccContextMarker {
|
||||||
private val tm by lazy {
|
override val openEuiccMarkerContext: Context
|
||||||
(context.applicationContext as OpenEuiccApplication).appContainer.telephonyManager
|
get() = context
|
||||||
}
|
|
||||||
|
|
||||||
@Suppress("NAME_SHADOWING")
|
@Suppress("NAME_SHADOWING")
|
||||||
override suspend fun tryOpenEuiccChannel(port: UiccPortInfoCompat): EuiccChannel? {
|
override suspend fun tryOpenEuiccChannel(port: UiccPortInfoCompat): EuiccChannel? {
|
||||||
|
@ -35,7 +34,7 @@ class PrivilegedEuiccChannelFactory(context: Context) : DefaultEuiccChannelFacto
|
||||||
intrinsicChannelName = null,
|
intrinsicChannelName = null,
|
||||||
TelephonyManagerApduInterface(
|
TelephonyManagerApduInterface(
|
||||||
port,
|
port,
|
||||||
tm,
|
telephonyManager,
|
||||||
context.preferenceRepository.verboseLoggingFlow
|
context.preferenceRepository.verboseLoggingFlow
|
||||||
),
|
),
|
||||||
context.preferenceRepository.verboseLoggingFlow,
|
context.preferenceRepository.verboseLoggingFlow,
|
||||||
|
|
|
@ -10,16 +10,9 @@ import java.util.concurrent.Executors
|
||||||
import kotlin.coroutines.resume
|
import kotlin.coroutines.resume
|
||||||
import kotlin.coroutines.suspendCoroutine
|
import kotlin.coroutines.suspendCoroutine
|
||||||
|
|
||||||
interface PrivilegedEuiccContextMarker {
|
interface PrivilegedEuiccContextMarker : OpenEuiccContextMarker {
|
||||||
val privilegedEuiccMarkerContext: Context
|
override val preferenceRepository: PrivilegedPreferenceRepository
|
||||||
get() = when (this) {
|
get() = appContainer.preferenceRepository as PrivilegedPreferenceRepository
|
||||||
is Context -> this
|
|
||||||
is Fragment -> requireContext()
|
|
||||||
else -> throw RuntimeException("PrivilegedEuiccContextMarker shall only be used on Fragments or UI types that derive from Context")
|
|
||||||
}
|
|
||||||
|
|
||||||
val preferenceRepository: PrivilegedPreferenceRepository
|
|
||||||
get() = privilegedEuiccMarkerContext.preferenceRepository as PrivilegedPreferenceRepository
|
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun Context.bindServiceSuspended(intent: Intent, flags: Int): Pair<IBinder?, () -> Unit> =
|
suspend fun Context.bindServiceSuspended(intent: Intent, flags: Int): Pair<IBinder?, () -> Unit> =
|
||||||
|
|
Loading…
Add table
Reference in a new issue