forked from PeterCxy/OpenEUICC
Move hidden API shims via reflection to a standalone package
This way we can skip them in AOSP builds
This commit is contained in:
parent
ec064f3410
commit
dce8fa2708
|
@ -3,6 +3,7 @@
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<bytecodeTargetLevel target="1.7">
|
<bytecodeTargetLevel target="1.7">
|
||||||
<module name="OpenEUICC.app" target="11" />
|
<module name="OpenEUICC.app" target="11" />
|
||||||
|
<module name="OpenEUICC.libs.hidden-apis-shim" target="11" />
|
||||||
<module name="OpenEUICC.libs.lpad-sm-dp-plus-connector" target="1.8" />
|
<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.main" target="1.8" />
|
||||||
<module name="OpenEUICC.libs.lpad-sm-dp-plus-connector.test" target="1.8" />
|
<module name="OpenEUICC.libs.lpad-sm-dp-plus-connector.test" target="1.8" />
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
<option value="$PROJECT_DIR$/libs" />
|
<option value="$PROJECT_DIR$/libs" />
|
||||||
|
<option value="$PROJECT_DIR$/libs/hidden-apis-shim" />
|
||||||
<option value="$PROJECT_DIR$/libs/hidden-apis-stub" />
|
<option value="$PROJECT_DIR$/libs/hidden-apis-stub" />
|
||||||
<option value="$PROJECT_DIR$/libs/lpad-sm-dp-plus-connector" />
|
<option value="$PROJECT_DIR$/libs/lpad-sm-dp-plus-connector" />
|
||||||
</set>
|
</set>
|
||||||
|
|
|
@ -33,6 +33,7 @@ android {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly project(':libs:hidden-apis-stub')
|
compileOnly project(':libs:hidden-apis-stub')
|
||||||
|
implementation project(':libs:hidden-apis-shim')
|
||||||
implementation project(":libs:lpad-sm-dp-plus-connector")
|
implementation project(":libs:lpad-sm-dp-plus-connector")
|
||||||
implementation 'androidx.core:core-ktx:1.7.0'
|
implementation 'androidx.core:core-ktx:1.7.0'
|
||||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||||
|
|
1
libs/hidden-apis-shim/.gitignore
vendored
Normal file
1
libs/hidden-apis-shim/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/build
|
40
libs/hidden-apis-shim/build.gradle
Normal file
40
libs/hidden-apis-shim/build.gradle
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
plugins {
|
||||||
|
id 'com.android.library'
|
||||||
|
id 'org.jetbrains.kotlin.android'
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdk 32
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdk 30
|
||||||
|
targetSdk 32
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = '1.8'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
implementation 'androidx.core:core-ktx:1.7.0'
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.4.2'
|
||||||
|
implementation 'com.google.android.material:material:1.6.1'
|
||||||
|
testImplementation 'junit:junit:4.13.2'
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
|
}
|
0
libs/hidden-apis-shim/consumer-rules.pro
Normal file
0
libs/hidden-apis-shim/consumer-rules.pro
Normal file
21
libs/hidden-apis-shim/proguard-rules.pro
vendored
Normal file
21
libs/hidden-apis-shim/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
|
@ -0,0 +1,24 @@
|
||||||
|
package im.angry.openeuicc.hidden_apis_shim
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4::class)
|
||||||
|
class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
fun useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
assertEquals("im.angry.openeuicc.hidden_apis_shim.test", appContext.packageName)
|
||||||
|
}
|
||||||
|
}
|
5
libs/hidden-apis-shim/src/main/AndroidManifest.xml
Normal file
5
libs/hidden-apis-shim/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="im.angry.openeuicc.hidden_apis_shim">
|
||||||
|
|
||||||
|
</manifest>
|
|
@ -0,0 +1,17 @@
|
||||||
|
package im.angry.openeuicc.hidden_apis_shim
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
fun addition_isCorrect() {
|
||||||
|
assertEquals(4, 2 + 2)
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,3 +15,4 @@ dependencyResolutionManagement {
|
||||||
rootProject.name = "OpenEUICC"
|
rootProject.name = "OpenEUICC"
|
||||||
include ':app', ':libs:lpad-sm-dp-plus-connector'
|
include ':app', ':libs:lpad-sm-dp-plus-connector'
|
||||||
include ':libs:hidden-apis-stub'
|
include ':libs:hidden-apis-stub'
|
||||||
|
include ':libs:hidden-apis-shim'
|
||||||
|
|
Loading…
Reference in a new issue