Compare commits

..

No commits in common. "125ebde95417341a7232769c9d20de0d485e05b3" and "f822b989a94ae29994e49bc7a659fcc06c6a081d" have entirely different histories.

16 changed files with 51 additions and 58 deletions

2
.idea/compiler.xml generated
View file

@ -4,8 +4,6 @@
<bytecodeTargetLevel target="1.7">
<module name="OpenEUICC.app" target="11" />
<module name="OpenEUICC.libs.lpad-sm-dp-plus-connector" target="1.8" />
<module name="OpenEUICC.libs.lpad-sm-dp-plus-connector.main" target="1.8" />
<module name="OpenEUICC.libs.lpad-sm-dp-plus-connector.test" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

3
.idea/gradle.xml generated
View file

@ -13,10 +13,11 @@
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/libs" />
<option value="$PROJECT_DIR$/libs/hidden-apis-stub" />
<option value="$PROJECT_DIR$/libs/hidden-apis" />
<option value="$PROJECT_DIR$/libs/lpad-sm-dp-plus-connector" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>

View file

@ -36,7 +36,7 @@ android {
}
dependencies {
compileOnly project(':libs:hidden-apis-stub')
compileOnly project(":libs:hidden-apis")
implementation project(":libs:lpad-sm-dp-plus-connector")
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'

View file

@ -1,53 +0,0 @@
package im.angry.openeuicc.util
import android.telephony.IccOpenLogicalChannelResponse
import android.telephony.SubscriptionManager
import android.telephony.TelephonyManager
import java.lang.reflect.Method
// Hidden APIs via reflection to enable building without AOSP source tree
// When building against AOSP, this file can be simply excluded to resolve
// calls to AOSP hidden APIs
private val iccOpenLogicalChannelBySlot: Method by lazy {
TelephonyManager::class.java.getMethod(
"iccOpenLogicalChannelBySlot",
Int::class.java, String::class.java, Int::class.java
)
}
private val iccCloseLogicalChannelBySlot: Method by lazy {
TelephonyManager::class.java.getMethod(
"iccCloseLogicalChannelBySlot",
Int::class.java, Int::class.java
)
}
private val iccTransmitApduLogicalChannelBySlot: Method by lazy {
TelephonyManager::class.java.getMethod(
"iccTransmitApduLogicalChannelBySlot",
Int::class.java, Int::class.java, Int::class.java, Int::class.java,
Int::class.java, Int::class.java, Int::class.java, String::class.java
)
}
fun TelephonyManager.iccOpenLogicalChannelBySlot(
slotId: Int, appletId: String, p2: Int
): IccOpenLogicalChannelResponse =
iccOpenLogicalChannelBySlot.invoke(this, slotId, appletId, p2) as IccOpenLogicalChannelResponse
fun TelephonyManager.iccCloseLogicalChannelBySlot(slotId: Int, channel: Int): Boolean =
iccCloseLogicalChannelBySlot.invoke(this, slotId, channel) as Boolean
fun TelephonyManager.iccTransmitApduLogicalChannelBySlot(
slotId: Int, channel: Int, cla: Int, instruction: Int,
p1: Int, p2: Int, p3: Int, data: String?
): String? =
iccTransmitApduLogicalChannelBySlot.invoke(
this, slotId, channel, cla, instruction, p1, p2, p3, data
) as String?
private val requestEmbeddedSubscriptionInfoListRefresh: Method by lazy {
SubscriptionManager::class.java.getMethod("requestEmbeddedSubscriptionInfoListRefresh", Int::class.java)
}
fun SubscriptionManager.requestEmbeddedSubscriptionInfoListRefresh(cardId: Int): Unit {
requestEmbeddedSubscriptionInfoListRefresh.invoke(this, cardId)
}

View file

@ -1,8 +1,10 @@
package im.angry.openeuicc.util
import android.telephony.IccOpenLogicalChannelResponse
import android.telephony.SubscriptionManager
import android.telephony.TelephonyManager
import java.lang.Exception
import java.lang.reflect.Method
val TelephonyManager.supportsDSDS: Boolean
get() = supportedModemCount == 2
@ -21,4 +23,49 @@ fun SubscriptionManager.tryRefreshCachedEuiccInfo(cardId: Int) {
// Ignore
}
}
}
// Hidden APIs via reflection to enable building without AOSP source tree
private val iccOpenLogicalChannelBySlot: Method by lazy {
TelephonyManager::class.java.getMethod(
"iccOpenLogicalChannelBySlot",
Int::class.java, String::class.java, Int::class.java
)
}
private val iccCloseLogicalChannelBySlot: Method by lazy {
TelephonyManager::class.java.getMethod(
"iccCloseLogicalChannelBySlot",
Int::class.java, Int::class.java
)
}
private val iccTransmitApduLogicalChannelBySlot: Method by lazy {
TelephonyManager::class.java.getMethod(
"iccTransmitApduLogicalChannelBySlot",
Int::class.java, Int::class.java, Int::class.java, Int::class.java,
Int::class.java, Int::class.java, Int::class.java, String::class.java
)
}
fun TelephonyManager.iccOpenLogicalChannelBySlot(
slotId: Int, appletId: String, p2: Int
): IccOpenLogicalChannelResponse =
iccOpenLogicalChannelBySlot.invoke(this, slotId, appletId, p2) as IccOpenLogicalChannelResponse
fun TelephonyManager.iccCloseLogicalChannelBySlot(slotId: Int, channel: Int): Boolean =
iccCloseLogicalChannelBySlot.invoke(this, slotId, channel) as Boolean
fun TelephonyManager.iccTransmitApduLogicalChannelBySlot(
slotId: Int, channel: Int, cla: Int, instruction: Int,
p1: Int, p2: Int, p3: Int, data: String?
): String? =
iccTransmitApduLogicalChannelBySlot.invoke(
this, slotId, channel, cla, instruction, p1, p2, p3, data
) as String?
private val requestEmbeddedSubscriptionInfoListRefresh: Method by lazy {
SubscriptionManager::class.java.getMethod("requestEmbeddedSubscriptionInfoListRefresh", Int::class.java)
}
fun SubscriptionManager.requestEmbeddedSubscriptionInfoListRefresh(cardId: Int): Unit {
requestEmbeddedSubscriptionInfoListRefresh.invoke(this, cardId)
}

View file

@ -14,4 +14,4 @@ dependencyResolutionManagement {
}
rootProject.name = "OpenEUICC"
include ':app', ':libs:lpad-sm-dp-plus-connector'
include ':libs:hidden-apis-stub'
include ':libs:hidden-apis'