forked from PeterCxy/OpenEUICC
Compare commits
No commits in common. "915a05634b552e06cc30b48cda2da264fe5f75e4" and "a8b7482afb98236c591912dc24524da7543bbf59" have entirely different histories.
915a05634b
...
a8b7482afb
15 changed files with 120 additions and 294 deletions
|
@ -33,23 +33,14 @@ jobs:
|
||||||
uses: https://gitea.angry.im/actions/setup-android@v3
|
uses: https://gitea.angry.im/actions/setup-android@v3
|
||||||
|
|
||||||
- name: Build Debug APKs
|
- name: Build Debug APKs
|
||||||
run: ./gradlew --no-daemon assembleDebug :app:assembleDebugMagiskModuleDir
|
run: ./gradlew --no-daemon assembleDebug
|
||||||
|
|
||||||
- name: Copy Artifacts
|
- name: Copy Artifacts
|
||||||
run: |
|
run: find . -name 'app*-debug.apk' -exec cp {} . \;
|
||||||
find . -name 'app*-debug.apk' -exec cp {} . \;
|
|
||||||
cp -r app/build/magisk/debug ./magisk-debug
|
|
||||||
|
|
||||||
- name: Upload APK Artifacts
|
- name: Upload Artifacts
|
||||||
uses: https://gitea.angry.im/actions/upload-artifact@v3
|
uses: https://gitea.angry.im/actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: Debug APKs
|
name: Debug APKs
|
||||||
compression-level: 0
|
compression-level: 0
|
||||||
path: app*-debug.apk
|
path: app*-debug.apk
|
||||||
|
|
||||||
- name: Upload Magisk Artifacts
|
|
||||||
uses: https://gitea.angry.im/actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: magisk-debug
|
|
||||||
compression-level: 0
|
|
||||||
path: magisk-debug
|
|
||||||
|
|
2
.idea/.gitignore
generated
vendored
2
.idea/.gitignore
generated
vendored
|
@ -2,7 +2,7 @@
|
||||||
/caches
|
/caches
|
||||||
/libraries
|
/libraries
|
||||||
/assetWizardSettings.xml
|
/assetWizardSettings.xml
|
||||||
/deploymentTarget*.xml
|
/deploymentTargetDropDown.xml
|
||||||
/gradle.xml
|
/gradle.xml
|
||||||
/misc.xml
|
/misc.xml
|
||||||
/modules.xml
|
/modules.xml
|
||||||
|
|
37
.idea/deploymentTargetSelector.xml
generated
Normal file
37
.idea/deploymentTargetSelector.xml
generated
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="deploymentTargetSelector">
|
||||||
|
<selectionStates>
|
||||||
|
<SelectionState runConfigName="app-unpriv">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
</SelectionState>
|
||||||
|
<SelectionState runConfigName="app">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
</SelectionState>
|
||||||
|
<SelectionState runConfigName="app-unpriv.androidTest">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
</SelectionState>
|
||||||
|
<SelectionState runConfigName="app-unpriv.main">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
</SelectionState>
|
||||||
|
<SelectionState runConfigName="app-unpriv.unitTest">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
</SelectionState>
|
||||||
|
<SelectionState runConfigName="app.unitTest">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
</SelectionState>
|
||||||
|
<SelectionState runConfigName="app.androidTest">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
</SelectionState>
|
||||||
|
<SelectionState runConfigName="app.main">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
</SelectionState>
|
||||||
|
<SelectionState runConfigName="workspace.OpenEUICC.app-unpriv">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
</SelectionState>
|
||||||
|
<SelectionState runConfigName="workspace.OpenEUICC.app">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
</SelectionState>
|
||||||
|
</selectionStates>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -21,7 +21,7 @@ open class DefaultEuiccChannelFactory(protected val context: Context) : EuiccCha
|
||||||
override suspend fun tryOpenEuiccChannel(
|
override suspend fun tryOpenEuiccChannel(
|
||||||
port: UiccPortInfoCompat,
|
port: UiccPortInfoCompat,
|
||||||
isdrAid: ByteArray
|
isdrAid: ByteArray
|
||||||
): EuiccChannel? = try {
|
): EuiccChannel? {
|
||||||
if (port.portIndex != 0) {
|
if (port.portIndex != 0) {
|
||||||
Log.w(
|
Log.w(
|
||||||
DefaultEuiccChannelManager.TAG,
|
DefaultEuiccChannelManager.TAG,
|
||||||
|
@ -35,7 +35,8 @@ open class DefaultEuiccChannelFactory(protected val context: Context) : EuiccCha
|
||||||
DefaultEuiccChannelManager.TAG,
|
DefaultEuiccChannelManager.TAG,
|
||||||
"Trying OMAPI for physical slot ${port.card.physicalSlotIndex}"
|
"Trying OMAPI for physical slot ${port.card.physicalSlotIndex}"
|
||||||
)
|
)
|
||||||
EuiccChannelImpl(
|
try {
|
||||||
|
return EuiccChannelImpl(
|
||||||
context.getString(R.string.channel_type_omapi),
|
context.getString(R.string.channel_type_omapi),
|
||||||
port,
|
port,
|
||||||
intrinsicChannelName = null,
|
intrinsicChannelName = null,
|
||||||
|
@ -47,22 +48,27 @@ open class DefaultEuiccChannelFactory(protected val context: Context) : EuiccCha
|
||||||
isdrAid,
|
isdrAid,
|
||||||
context.preferenceRepository.verboseLoggingFlow,
|
context.preferenceRepository.verboseLoggingFlow,
|
||||||
context.preferenceRepository.ignoreTLSCertificateFlow,
|
context.preferenceRepository.ignoreTLSCertificateFlow,
|
||||||
context.preferenceRepository.es10xMssFlow,
|
).also {
|
||||||
)
|
Log.i(DefaultEuiccChannelManager.TAG, "Is OMAPI channel, setting MSS to 60")
|
||||||
|
it.lpa.setEs10xMss(60)
|
||||||
|
}
|
||||||
} catch (_: IllegalArgumentException) {
|
} catch (_: IllegalArgumentException) {
|
||||||
// Failed
|
// Failed
|
||||||
Log.w(
|
Log.w(
|
||||||
DefaultEuiccChannelManager.TAG,
|
DefaultEuiccChannelManager.TAG,
|
||||||
"OMAPI APDU interface unavailable for physical slot ${port.card.physicalSlotIndex} with ISD-R AID: ${isdrAid.encodeHex()}."
|
"OMAPI APDU interface unavailable for physical slot ${port.card.physicalSlotIndex} with ISD-R AID: ${isdrAid.encodeHex()}."
|
||||||
)
|
)
|
||||||
null
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun tryOpenUsbEuiccChannel(
|
override fun tryOpenUsbEuiccChannel(
|
||||||
ccidCtx: UsbCcidContext,
|
ccidCtx: UsbCcidContext,
|
||||||
isdrAid: ByteArray
|
isdrAid: ByteArray
|
||||||
): EuiccChannel? = try {
|
): EuiccChannel? {
|
||||||
EuiccChannelImpl(
|
try {
|
||||||
|
return EuiccChannelImpl(
|
||||||
context.getString(R.string.channel_type_usb),
|
context.getString(R.string.channel_type_usb),
|
||||||
FakeUiccPortInfoCompat(FakeUiccCardInfoCompat(EuiccChannelManager.USB_CHANNEL_ID)),
|
FakeUiccPortInfoCompat(FakeUiccCardInfoCompat(EuiccChannelManager.USB_CHANNEL_ID)),
|
||||||
intrinsicChannelName = ccidCtx.productName,
|
intrinsicChannelName = ccidCtx.productName,
|
||||||
|
@ -72,7 +78,6 @@ open class DefaultEuiccChannelFactory(protected val context: Context) : EuiccCha
|
||||||
isdrAid,
|
isdrAid,
|
||||||
context.preferenceRepository.verboseLoggingFlow,
|
context.preferenceRepository.verboseLoggingFlow,
|
||||||
context.preferenceRepository.ignoreTLSCertificateFlow,
|
context.preferenceRepository.ignoreTLSCertificateFlow,
|
||||||
context.preferenceRepository.es10xMssFlow,
|
|
||||||
)
|
)
|
||||||
} catch (_: IllegalArgumentException) {
|
} catch (_: IllegalArgumentException) {
|
||||||
// Failed
|
// Failed
|
||||||
|
@ -80,7 +85,8 @@ open class DefaultEuiccChannelFactory(protected val context: Context) : EuiccCha
|
||||||
DefaultEuiccChannelManager.TAG,
|
DefaultEuiccChannelManager.TAG,
|
||||||
"USB APDU interface unavailable for ISD-R AID: ${isdrAid.encodeHex()}."
|
"USB APDU interface unavailable for ISD-R AID: ${isdrAid.encodeHex()}."
|
||||||
)
|
)
|
||||||
null
|
}
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun cleanup() {
|
override fun cleanup() {
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
package im.angry.openeuicc.core
|
package im.angry.openeuicc.core
|
||||||
|
|
||||||
import im.angry.openeuicc.util.UiccPortInfoCompat
|
import im.angry.openeuicc.util.UiccPortInfoCompat
|
||||||
|
import im.angry.openeuicc.util.decodeHex
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.first
|
|
||||||
import kotlinx.coroutines.runBlocking
|
|
||||||
import net.typeblog.lpac_jni.ApduInterface
|
import net.typeblog.lpac_jni.ApduInterface
|
||||||
import net.typeblog.lpac_jni.LocalProfileAssistant
|
import net.typeblog.lpac_jni.LocalProfileAssistant
|
||||||
import net.typeblog.lpac_jni.impl.HttpInterfaceImpl
|
import net.typeblog.lpac_jni.impl.HttpInterfaceImpl
|
||||||
|
@ -16,8 +15,7 @@ class EuiccChannelImpl(
|
||||||
override val apduInterface: ApduInterface,
|
override val apduInterface: ApduInterface,
|
||||||
override val isdrAid: ByteArray,
|
override val isdrAid: ByteArray,
|
||||||
verboseLoggingFlow: Flow<Boolean>,
|
verboseLoggingFlow: Flow<Boolean>,
|
||||||
ignoreTLSCertificateFlow: Flow<Boolean>,
|
ignoreTLSCertificateFlow: Flow<Boolean>
|
||||||
es10xMssFlow: Flow<Int>,
|
|
||||||
) : EuiccChannel {
|
) : EuiccChannel {
|
||||||
override val slotId = port.card.physicalSlotIndex
|
override val slotId = port.card.physicalSlotIndex
|
||||||
override val logicalSlotId = port.logicalSlotIndex
|
override val logicalSlotId = port.logicalSlotIndex
|
||||||
|
@ -27,10 +25,8 @@ class EuiccChannelImpl(
|
||||||
LocalProfileAssistantImpl(
|
LocalProfileAssistantImpl(
|
||||||
isdrAid,
|
isdrAid,
|
||||||
apduInterface,
|
apduInterface,
|
||||||
HttpInterfaceImpl(verboseLoggingFlow, ignoreTLSCertificateFlow),
|
HttpInterfaceImpl(verboseLoggingFlow, ignoreTLSCertificateFlow)
|
||||||
).also {
|
)
|
||||||
it.setEs10xMss(runBlocking { es10xMssFlow.first().toByte() })
|
|
||||||
}
|
|
||||||
|
|
||||||
override val atr: ByteArray?
|
override val atr: ByteArray?
|
||||||
get() = (apduInterface as? ApduInterfaceAtrProvider)?.atr
|
get() = (apduInterface as? ApduInterfaceAtrProvider)?.atr
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.provider.Settings
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.preference.CheckBoxPreference
|
import androidx.preference.CheckBoxPreference
|
||||||
import androidx.preference.ListPreference
|
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceCategory
|
import androidx.preference.PreferenceCategory
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
|
@ -17,6 +16,7 @@ import im.angry.openeuicc.util.*
|
||||||
import kotlinx.coroutines.flow.collect
|
import kotlinx.coroutines.flow.collect
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
|
|
||||||
open class SettingsFragment: PreferenceFragmentCompat() {
|
open class SettingsFragment: PreferenceFragmentCompat() {
|
||||||
private lateinit var developerPref: PreferenceCategory
|
private lateinit var developerPref: PreferenceCategory
|
||||||
|
@ -34,7 +34,7 @@ open class SettingsFragment: PreferenceFragmentCompat() {
|
||||||
// Show / hide developer preference based on whether it is enabled
|
// Show / hide developer preference based on whether it is enabled
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
preferenceRepository.developerOptionsEnabledFlow
|
preferenceRepository.developerOptionsEnabledFlow
|
||||||
.onEach(developerPref::setVisible)
|
.onEach { developerPref.isVisible = it }
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,9 +84,6 @@ open class SettingsFragment: PreferenceFragmentCompat() {
|
||||||
requirePreference<CheckBoxPreference>("pref_developer_euicc_memory_reset")
|
requirePreference<CheckBoxPreference>("pref_developer_euicc_memory_reset")
|
||||||
.bindBooleanFlow(preferenceRepository.euiccMemoryResetFlow)
|
.bindBooleanFlow(preferenceRepository.euiccMemoryResetFlow)
|
||||||
|
|
||||||
requirePreference<ListPreference>("pref_developer_es10x_mss")
|
|
||||||
.bindIntFlow(preferenceRepository.es10xMssFlow, 63)
|
|
||||||
|
|
||||||
requirePreference<Preference>("pref_developer_isdr_aid_list").apply {
|
requirePreference<Preference>("pref_developer_isdr_aid_list").apply {
|
||||||
intent = Intent(requireContext(), IsdrAidListActivity::class.java)
|
intent = Intent(requireContext(), IsdrAidListActivity::class.java)
|
||||||
}
|
}
|
||||||
|
@ -103,53 +100,51 @@ open class SettingsFragment: PreferenceFragmentCompat() {
|
||||||
@Suppress("UNUSED_PARAMETER")
|
@Suppress("UNUSED_PARAMETER")
|
||||||
private fun onAppVersionClicked(pref: Preference): Boolean {
|
private fun onAppVersionClicked(pref: Preference): Boolean {
|
||||||
if (developerPref.isVisible) return false
|
if (developerPref.isVisible) return false
|
||||||
|
|
||||||
val now = System.currentTimeMillis()
|
val now = System.currentTimeMillis()
|
||||||
numClicks = if (now - lastClickTimestamp >= 1000) 1 else numClicks + 1
|
if (now - lastClickTimestamp >= 1000) {
|
||||||
|
numClicks = 1
|
||||||
|
} else {
|
||||||
|
numClicks++
|
||||||
|
}
|
||||||
lastClickTimestamp = now
|
lastClickTimestamp = now
|
||||||
|
|
||||||
|
if (numClicks == 7) {
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
preferenceRepository.developerOptionsEnabledFlow.updatePreference(numClicks >= 7)
|
preferenceRepository.developerOptionsEnabledFlow.updatePreference(true)
|
||||||
}
|
|
||||||
|
|
||||||
val toastText = when {
|
|
||||||
numClicks == 7 -> getString(R.string.developer_options_enabled)
|
|
||||||
numClicks > 1 -> getString(R.string.developer_options_steps, 7 - numClicks)
|
|
||||||
else -> return true
|
|
||||||
}
|
|
||||||
|
|
||||||
lastToast?.cancel()
|
lastToast?.cancel()
|
||||||
lastToast = Toast.makeText(requireContext(), toastText, Toast.LENGTH_SHORT)
|
Toast.makeText(
|
||||||
|
requireContext(),
|
||||||
|
R.string.developer_options_enabled,
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
}
|
||||||
|
} else if (numClicks > 1) {
|
||||||
|
lastToast?.cancel()
|
||||||
|
lastToast = Toast.makeText(
|
||||||
|
requireContext(),
|
||||||
|
getString(R.string.developer_options_steps, 7 - numClicks),
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
)
|
||||||
lastToast!!.show()
|
lastToast!!.show()
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun CheckBoxPreference.bindBooleanFlow(flow: PreferenceFlowWrapper<Boolean>) {
|
protected fun CheckBoxPreference.bindBooleanFlow(flow: PreferenceFlowWrapper<Boolean>) {
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
flow.collect(::setChecked)
|
flow.collect { isChecked = it }
|
||||||
}
|
}
|
||||||
|
|
||||||
setOnPreferenceChangeListener { _, newValue ->
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
lifecycleScope.launch {
|
runBlocking {
|
||||||
flow.updatePreference(newValue as Boolean)
|
flow.updatePreference(newValue as Boolean)
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ListPreference.bindIntFlow(flow: PreferenceFlowWrapper<Int>, defaultValue: Int) {
|
|
||||||
lifecycleScope.launch {
|
|
||||||
flow.collect { value = it.toString() }
|
|
||||||
}
|
|
||||||
|
|
||||||
setOnPreferenceChangeListener { _, newValue ->
|
|
||||||
lifecycleScope.launch {
|
|
||||||
flow.updatePreference((newValue as String).toIntOrNull() ?: defaultValue)
|
|
||||||
}
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected fun mergePreferenceOverlay(overlayKey: String, targetKey: String) {
|
protected fun mergePreferenceOverlay(overlayKey: String, targetKey: String) {
|
||||||
val overlayCat = requirePreference<PreferenceCategory>(overlayKey)
|
val overlayCat = requirePreference<PreferenceCategory>(overlayKey)
|
||||||
val targetCat = requirePreference<PreferenceCategory>(targetKey)
|
val targetCat = requirePreference<PreferenceCategory>(targetKey)
|
||||||
|
|
|
@ -5,7 +5,6 @@ import androidx.datastore.core.DataStore
|
||||||
import androidx.datastore.preferences.core.Preferences
|
import androidx.datastore.preferences.core.Preferences
|
||||||
import androidx.datastore.preferences.core.booleanPreferencesKey
|
import androidx.datastore.preferences.core.booleanPreferencesKey
|
||||||
import androidx.datastore.preferences.core.edit
|
import androidx.datastore.preferences.core.edit
|
||||||
import androidx.datastore.preferences.core.intPreferencesKey
|
|
||||||
import androidx.datastore.preferences.core.stringPreferencesKey
|
import androidx.datastore.preferences.core.stringPreferencesKey
|
||||||
import androidx.datastore.preferences.preferencesDataStore
|
import androidx.datastore.preferences.preferencesDataStore
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
@ -39,7 +38,6 @@ internal object PreferenceKeys {
|
||||||
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")
|
||||||
val ISDR_AID_LIST = stringPreferencesKey("isdr_aid_list")
|
val ISDR_AID_LIST = stringPreferencesKey("isdr_aid_list")
|
||||||
val ES10X_MSS = intPreferencesKey("es10x_mss")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const val EUICC_DEFAULT_ISDR_AID = "A0000005591010FFFFFFFF8900000100"
|
const val EUICC_DEFAULT_ISDR_AID = "A0000005591010FFFFFFFF8900000100"
|
||||||
|
@ -91,7 +89,6 @@ open class PreferenceRepository(private val context: Context) {
|
||||||
PreferenceConstants.DEFAULT_AID_LIST,
|
PreferenceConstants.DEFAULT_AID_LIST,
|
||||||
{ Base64.getEncoder().encodeToString(it.encodeToByteArray()) },
|
{ Base64.getEncoder().encodeToString(it.encodeToByteArray()) },
|
||||||
{ Base64.getDecoder().decode(it).decodeToString() })
|
{ Base64.getDecoder().decode(it).decodeToString() })
|
||||||
val es10xMssFlow = bindFlow(PreferenceKeys.ES10X_MSS, 63)
|
|
||||||
|
|
||||||
protected fun <T> bindFlow(
|
protected fun <T> bindFlow(
|
||||||
key: Preferences.Key<T>,
|
key: Preferences.Key<T>,
|
||||||
|
|
|
@ -200,16 +200,6 @@
|
||||||
<string name="pref_developer_ignore_tls_certificate_desc">Accept any TLS certificate used by the RSP server</string>
|
<string name="pref_developer_ignore_tls_certificate_desc">Accept any TLS certificate used by the RSP server</string>
|
||||||
<string name="pref_developer_euicc_memory_reset">Allow erasing eUICC</string>
|
<string name="pref_developer_euicc_memory_reset">Allow erasing eUICC</string>
|
||||||
<string name="pref_developer_euicc_memory_reset_desc">This is a dangerous operation and hidden by default. As an alternative, you can delete all profiles manually.</string>
|
<string name="pref_developer_euicc_memory_reset_desc">This is a dangerous operation and hidden by default. As an alternative, you can delete all profiles manually.</string>
|
||||||
<string name="pref_developer_es10x_mss">ES10x MSS</string>
|
|
||||||
<string name="pref_developer_es10x_mss_desc">Global ES10x MSS</string>
|
|
||||||
<string-array name="pref_developer_es10x_entry_keys">
|
|
||||||
<item>High Speed</item>
|
|
||||||
<item>Compatibility Mode</item>
|
|
||||||
</string-array>
|
|
||||||
<string-array name="pref_developer_es10x_entry_values" translatable="false">
|
|
||||||
<item>255</item>
|
|
||||||
<item>63</item>
|
|
||||||
</string-array>
|
|
||||||
<string name="pref_developer_isdr_aid_list">Customize ISD-R AID list</string>
|
<string name="pref_developer_isdr_aid_list">Customize ISD-R AID list</string>
|
||||||
<string name="pref_developer_isdr_aid_list_desc">Some brands of removable eUICCs may use their own non-standard ISD-R AID, rendering them inaccessible to third-party apps. We can attempt to use non-standard AIDs added in this list, but there is no guarantee that they will work.</string>
|
<string name="pref_developer_isdr_aid_list_desc">Some brands of removable eUICCs may use their own non-standard ISD-R AID, rendering them inaccessible to third-party apps. We can attempt to use non-standard AIDs added in this list, but there is no guarantee that they will work.</string>
|
||||||
<string name="pref_info">Info</string>
|
<string name="pref_info">Info</string>
|
||||||
|
|
|
@ -81,14 +81,6 @@
|
||||||
app:summary="@string/pref_developer_euicc_memory_reset_desc"
|
app:summary="@string/pref_developer_euicc_memory_reset_desc"
|
||||||
app:title="@string/pref_developer_euicc_memory_reset" />
|
app:title="@string/pref_developer_euicc_memory_reset" />
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
app:iconSpaceReserved="false"
|
|
||||||
app:key="pref_developer_es10x_mss"
|
|
||||||
app:summary="@string/pref_developer_es10x_mss_desc"
|
|
||||||
app:title="@string/pref_developer_es10x_mss"
|
|
||||||
app:entries="@array/pref_developer_es10x_entry_keys"
|
|
||||||
app:entryValues="@array/pref_developer_es10x_entry_values" />
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
app:key="pref_developer_isdr_aid_list"
|
app:key="pref_developer_isdr_aid_list"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import com.android.build.gradle.internal.api.ApkVariantOutputImpl
|
|
||||||
import im.angry.openeuicc.build.*
|
import im.angry.openeuicc.build.*
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
|
@ -50,62 +49,3 @@ dependencies {
|
||||||
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
||||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
val modulePropsTemplate = mutableMapOf(
|
|
||||||
"id" to android.defaultConfig.applicationId!!,
|
|
||||||
"name" to "OpenEUICC",
|
|
||||||
"version" to android.defaultConfig.versionName!!,
|
|
||||||
"versionCode" to "${android.defaultConfig.versionCode}",
|
|
||||||
"author" to "OpenEUICC authors",
|
|
||||||
"description" to "OpenEUICC is an open-source app that provides system-level eSIM integration."
|
|
||||||
)
|
|
||||||
|
|
||||||
val moduleCustomizeScript = project.file("magisk/customize.sh").readText()
|
|
||||||
.replace("{APK_NAME}", "OpenEUICC")
|
|
||||||
.replace("{PKG_NAME}", android.defaultConfig.applicationId!!)
|
|
||||||
|
|
||||||
val moduleUninstallScript = project.file("magisk/uninstall.sh").readText()
|
|
||||||
.replace("{PKG_NAME}", android.defaultConfig.applicationId!!)
|
|
||||||
|
|
||||||
tasks.register<MagiskModuleDirTask>("assembleDebugMagiskModuleDir") {
|
|
||||||
variant = "debug"
|
|
||||||
appName = "OpenEUICC"
|
|
||||||
permsFile = project.rootProject.file("privapp_whitelist_im.angry.openeuicc.xml")
|
|
||||||
moduleInstaller = project.file("magisk/module_installer.sh")
|
|
||||||
moduleCustomizeScriptText = moduleCustomizeScript
|
|
||||||
moduleUninstallScriptText = moduleUninstallScript
|
|
||||||
moduleProp = modulePropsTemplate.let {
|
|
||||||
it["description"] = "(debug build) ${it["description"]}"
|
|
||||||
it["versionCode"] = "${(android.applicationVariants.find { it.name == "debug" }!!.outputs.first() as ApkVariantOutputImpl).versionCodeOverride}"
|
|
||||||
it["updateJson"] = "https://openeuicc.com/magisk/magisk-debug.json"
|
|
||||||
it
|
|
||||||
}
|
|
||||||
dependsOn("assembleDebug")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register<Zip>("assembleDebugMagiskModule") {
|
|
||||||
dependsOn("assembleDebugMagiskModuleDir")
|
|
||||||
from((tasks.getByName("assembleDebugMagiskModuleDir") as MagiskModuleDirTask).outputDir)
|
|
||||||
archiveFileName = "magisk-debug.zip"
|
|
||||||
destinationDirectory = project.layout.buildDirectory.dir("magisk")
|
|
||||||
entryCompression = ZipEntryCompression.STORED
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register<MagiskModuleDirTask>("assembleReleaseMagiskModuleDir") {
|
|
||||||
variant = "release"
|
|
||||||
appName = "OpenEUICC"
|
|
||||||
permsFile = project.rootProject.file("privapp_whitelist_im.angry.openeuicc.xml")
|
|
||||||
moduleInstaller = project.file("magisk/module_installer.sh")
|
|
||||||
moduleCustomizeScriptText = moduleCustomizeScript
|
|
||||||
moduleUninstallScriptText = moduleUninstallScript
|
|
||||||
moduleProp = modulePropsTemplate
|
|
||||||
dependsOn("assembleRelease")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register<Zip>("assembleReleaseMagiskModule") {
|
|
||||||
dependsOn("assembleReleaseMagiskModuleDir")
|
|
||||||
from((tasks.getByName("assembleReleaseMagiskModuleDir") as MagiskModuleDirTask).outputDir)
|
|
||||||
archiveFileName = "magisk-release.zip"
|
|
||||||
destinationDirectory = project.layout.buildDirectory.dir("magisk")
|
|
||||||
entryCompression = ZipEntryCompression.STORED
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
TMP_FILE="$TMPDIR/{APK_NAME}"
|
|
||||||
|
|
||||||
chmod u+x "$MODPATH/uninstall.sh"
|
|
||||||
cp "$MODPATH/system/system_ext/{APK_NAME}/{APK_NAME}.apk" "$TMP_FILE"
|
|
||||||
|
|
||||||
pm install -r "$TMP_FILE"
|
|
||||||
rm -f "$TMP_FILE"
|
|
||||||
|
|
||||||
pm grant "{PKG_NAME}" android.permission.READ_PHONE_STATE
|
|
|
@ -1,33 +0,0 @@
|
||||||
#!/sbin/sh
|
|
||||||
|
|
||||||
#################
|
|
||||||
# Initialization
|
|
||||||
#################
|
|
||||||
|
|
||||||
umask 022
|
|
||||||
|
|
||||||
# echo before loading util_functions
|
|
||||||
ui_print() { echo "$1"; }
|
|
||||||
|
|
||||||
require_new_magisk() {
|
|
||||||
ui_print "*******************************"
|
|
||||||
ui_print " Please install Magisk v20.4+! "
|
|
||||||
ui_print "*******************************"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
#########################
|
|
||||||
# Load util_functions.sh
|
|
||||||
#########################
|
|
||||||
|
|
||||||
OUTFD=$2
|
|
||||||
ZIPFILE=$3
|
|
||||||
|
|
||||||
mount /data 2>/dev/null
|
|
||||||
|
|
||||||
[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
|
|
||||||
. /data/adb/magisk/util_functions.sh
|
|
||||||
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk
|
|
||||||
|
|
||||||
install_module
|
|
||||||
exit 0
|
|
|
@ -1 +0,0 @@
|
||||||
pm uninstall "{PKG_NAME}"
|
|
|
@ -42,7 +42,6 @@ class PrivilegedEuiccChannelFactory(context: Context) : DefaultEuiccChannelFacto
|
||||||
isdrAid,
|
isdrAid,
|
||||||
context.preferenceRepository.verboseLoggingFlow,
|
context.preferenceRepository.verboseLoggingFlow,
|
||||||
context.preferenceRepository.ignoreTLSCertificateFlow,
|
context.preferenceRepository.ignoreTLSCertificateFlow,
|
||||||
context.preferenceRepository.es10xMssFlow,
|
|
||||||
)
|
)
|
||||||
} catch (_: IllegalArgumentException) {
|
} catch (_: IllegalArgumentException) {
|
||||||
// Failed
|
// Failed
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
package im.angry.openeuicc.build
|
|
||||||
|
|
||||||
import org.gradle.api.DefaultTask
|
|
||||||
import org.gradle.api.provider.MapProperty
|
|
||||||
import org.gradle.api.provider.Property
|
|
||||||
import org.gradle.api.tasks.Input
|
|
||||||
import org.gradle.api.tasks.InputDirectory
|
|
||||||
import org.gradle.api.tasks.InputFile
|
|
||||||
import org.gradle.api.tasks.OutputDirectory
|
|
||||||
import org.gradle.api.tasks.TaskAction
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
abstract class MagiskModuleDirTask : DefaultTask() {
|
|
||||||
@get:Input
|
|
||||||
abstract val variant : Property<String>
|
|
||||||
|
|
||||||
@get:Input
|
|
||||||
abstract val appName : Property<String>
|
|
||||||
|
|
||||||
@get:InputFile
|
|
||||||
abstract val permsFile : Property<File>
|
|
||||||
|
|
||||||
@get:InputFile
|
|
||||||
abstract val moduleInstaller : Property<File>
|
|
||||||
|
|
||||||
@get:Input
|
|
||||||
abstract val moduleCustomizeScriptText : Property<String>
|
|
||||||
|
|
||||||
@get:Input
|
|
||||||
abstract val moduleUninstallScriptText : Property<String>
|
|
||||||
|
|
||||||
@get:Input
|
|
||||||
abstract val moduleProp : MapProperty<String, String>
|
|
||||||
|
|
||||||
@InputDirectory
|
|
||||||
val inputDir = variant.map { project.layout.buildDirectory.dir("outputs/apk/${it}") }
|
|
||||||
|
|
||||||
@OutputDirectory
|
|
||||||
val outputDir = variant.map { project.layout.buildDirectory.dir("magisk/${it}") }
|
|
||||||
|
|
||||||
@TaskAction
|
|
||||||
fun build() {
|
|
||||||
val dir = outputDir.get().get()
|
|
||||||
project.mkdir(dir)
|
|
||||||
val systemExtDir = dir.dir("system/system_ext")
|
|
||||||
val permDir = dir.dir("system/system_ext/etc/permissions")
|
|
||||||
val appDir = systemExtDir.dir("priv-app/${appName.get()}")
|
|
||||||
val metaInfDir = dir.dir("META-INF/com/google/android")
|
|
||||||
project.mkdir(systemExtDir)
|
|
||||||
project.mkdir(metaInfDir)
|
|
||||||
project.mkdir(appDir)
|
|
||||||
project.mkdir(permDir)
|
|
||||||
project.copy {
|
|
||||||
into(appDir)
|
|
||||||
from(inputDir) {
|
|
||||||
include("app-${variant.get()}.apk")
|
|
||||||
rename("app-${variant.get()}.apk", "${appName.get()}.apk")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
project.copy {
|
|
||||||
from(permsFile)
|
|
||||||
into(permDir)
|
|
||||||
}
|
|
||||||
project.copy {
|
|
||||||
from(moduleInstaller)
|
|
||||||
into(metaInfDir)
|
|
||||||
rename(".*", "update-binary")
|
|
||||||
}
|
|
||||||
dir.file("customize.sh").asFile.writeText(moduleCustomizeScriptText.get())
|
|
||||||
dir.file("uninstall.sh").asFile.writeText(moduleUninstallScriptText.get())
|
|
||||||
metaInfDir.file("updater-script").asFile.writeText("# MAGISK")
|
|
||||||
dir.file("module.prop").asFile.writeText(moduleProp.get().map { (k, v) -> "$k=$v" }.joinToString("\n"))
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue