Compare commits
4 commits
703bcb9cd6
...
3acc46f3ab
Author | SHA1 | Date | |
---|---|---|---|
3acc46f3ab | |||
7f21ac9075 | |||
b3bdc1b99f | |||
3f37a66435 |
9 changed files with 36 additions and 7 deletions
4
.idea/deploymentTargetSelector.xml
generated
4
.idea/deploymentTargetSelector.xml
generated
|
@ -2,10 +2,10 @@
|
|||
<project version="4">
|
||||
<component name="deploymentTargetSelector">
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app-unpriv">
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
</SelectionState>
|
||||
<SelectionState runConfigName="app">
|
||||
<SelectionState runConfigName="app-unpriv">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
|
|
2
.idea/kotlinc.xml
generated
2
.idea/kotlinc.xml
generated
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.9.20" />
|
||||
<option name="version" value="1.9.23" />
|
||||
</component>
|
||||
</project>
|
|
@ -122,7 +122,7 @@ open class SettingsFragment: PreferenceFragmentCompat() {
|
|||
return true
|
||||
}
|
||||
|
||||
private fun CheckBoxPreference.bindBooleanFlow(flow: PreferenceFlowWrapper<Boolean>) {
|
||||
protected fun CheckBoxPreference.bindBooleanFlow(flow: PreferenceFlowWrapper<Boolean>) {
|
||||
lifecycleScope.launch {
|
||||
flow.collect { isChecked = it }
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ internal object PreferenceKeys {
|
|||
|
||||
// ---- Developer Options ----
|
||||
val DEVELOPER_OPTIONS_ENABLED = booleanPreferencesKey("developer_options_enabled")
|
||||
val REMOVABLE_TMAPI = booleanPreferencesKey("removable_tmapi")
|
||||
val UNFILTERED_PROFILE_LIST = booleanPreferencesKey("unfiltered_profile_list")
|
||||
val IGNORE_TLS_CERTIFICATE = booleanPreferencesKey("ignore_tls_certificate")
|
||||
}
|
||||
|
@ -48,6 +49,7 @@ class PreferenceRepository(private val context: Context) {
|
|||
|
||||
// ---- Developer Options ----
|
||||
val developerOptionsEnabledFlow = bindFlow(PreferenceKeys.DEVELOPER_OPTIONS_ENABLED, false)
|
||||
val removableTMAPIFlow = bindFlow(PreferenceKeys.REMOVABLE_TMAPI, false)
|
||||
val unfilteredProfileListFlow = bindFlow(PreferenceKeys.UNFILTERED_PROFILE_LIST, false)
|
||||
val ignoreTLSCertificateFlow = bindFlow(PreferenceKeys.IGNORE_TLS_CERTIFICATE, false)
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
<im.angry.openeuicc.ui.preference.LongSummaryPreferenceCategory
|
||||
app:key="pref_developer"
|
||||
app:title="@string/pref_developer"
|
||||
app:iconSpaceReserved="false">
|
||||
|
@ -69,7 +69,7 @@
|
|||
app:summary="@string/pref_developer_ignore_tls_certificate_desc"
|
||||
app:title="@string/pref_developer_ignore_tls_certificate" />
|
||||
|
||||
</PreferenceCategory>
|
||||
</im.angry.openeuicc.ui.preference.LongSummaryPreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
app:key="pref_info"
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.util.Log
|
|||
import im.angry.openeuicc.OpenEuiccApplication
|
||||
import im.angry.openeuicc.R
|
||||
import im.angry.openeuicc.util.*
|
||||
import kotlinx.coroutines.flow.first
|
||||
import java.lang.IllegalArgumentException
|
||||
|
||||
class PrivilegedEuiccChannelFactory(context: Context) : DefaultEuiccChannelFactory(context) {
|
||||
|
@ -21,7 +22,7 @@ class PrivilegedEuiccChannelFactory(context: Context) : DefaultEuiccChannelFacto
|
|||
super.tryOpenEuiccChannel(port)?.let { return it }
|
||||
}
|
||||
|
||||
if (port.card.isEuicc) {
|
||||
if (port.card.isEuicc || context.preferenceRepository.removableTMAPIFlow.first()) {
|
||||
Log.i(
|
||||
DefaultEuiccChannelManager.TAG,
|
||||
"Trying TelephonyManager for slot ${port.card.physicalSlotIndex} port ${port.portIndex}"
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
package im.angry.openeuicc.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.preference.CheckBoxPreference
|
||||
import androidx.preference.Preference
|
||||
import im.angry.openeuicc.R
|
||||
import im.angry.openeuicc.util.preferenceRepository
|
||||
|
||||
class PrivilegedSettingsFragment : SettingsFragment() {
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
super.onCreatePreferences(savedInstanceState, rootKey)
|
||||
addPreferencesFromResource(R.xml.pref_privileged_settings)
|
||||
mergePreferenceOverlay("pref_developer_overlay", "pref_developer")
|
||||
|
||||
// It's stupid to _disable_ things for privileged, but for now, the per-app locale picker
|
||||
// is not usable for apps signed with the platform key.
|
||||
// ref: <https://android.googlesource.com/platform/packages/apps/Settings/+/refs/tags/android-15.0.0_r6/src/com/android/settings/applications/AppLocaleUtil.java#60>
|
||||
|
@ -13,5 +19,9 @@ class PrivilegedSettingsFragment : SettingsFragment() {
|
|||
// eventually work for platform-signed apps. Or, at some point we might introduce our own
|
||||
// locale picker, which hopefully works whether privileged or not.
|
||||
requirePreference<Preference>("pref_advanced_language").isVisible = false
|
||||
|
||||
// Force use TelephonyManager API
|
||||
requirePreference<CheckBoxPreference>("pref_developer_tmapi_removable")
|
||||
.bindBooleanFlow(preferenceRepository.removableTMAPIFlow)
|
||||
}
|
||||
}
|
|
@ -22,4 +22,8 @@
|
|||
<string name="lui_desc">Your device supports eSIMs. To connect to mobile network, download your eSIM issued by a carrier, or insert a physical SIM.</string>
|
||||
<string name="lui_skip">Skip</string>
|
||||
<string name="lui_download">Download eSIM</string>
|
||||
|
||||
<!-- Preference -->
|
||||
<string name="pref_developer_tmapi_removable">Using TMAPI for removable</string>
|
||||
<string name="pref_developer_tmapi_removable_desc">TMAPI (TelephonyManager API) will not be enabled in non-euicc mode and some removable eSIM cards may not work.\nEnable this option to skip detection and force TMAPI to be enabled.</string>
|
||||
</resources>
|
12
app/src/main/res/xml/pref_privileged_settings.xml
Normal file
12
app/src/main/res/xml/pref_privileged_settings.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceCategory
|
||||
app:isPreferenceVisible="false"
|
||||
app:key="pref_developer_overlay">
|
||||
<CheckBoxPreference
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="pref_developer_tmapi_removable"
|
||||
app:summary="@string/pref_developer_tmapi_removable_desc"
|
||||
app:title="@string/pref_developer_tmapi_removable" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
Loading…
Add table
Reference in a new issue