Introduce stub module and initial Gradle project setup

This commit establishes the foundational Gradle project structure and introduces a dedicated 'stub' module. This module provides skeletal implementations of internal Android framework interfaces and classes, which are critical for compiling the TEESimulator project.

Stub classes are minimal implementations of existing interfaces or classes, typically mirroring those found within the Android framework, particularly for internal or hidden APIs. Their methods usually contain no operational logic and instead throw RuntimeException or UnsupportedOperationException.

The primary reasons for using stub classes are:

1. Compilation Against Internal APIs: Android applications and libraries typically use public APIs exposed by the Android SDK. However, in scenarios requiring deeper system integration or emulation, interaction with internal or hidden Android framework APIs might be necessary. Directly linking against the full Android framework JAR can lead to bootclasspath conflicts or other build issues. Stub classes provide the necessary API signatures for compilation without including the actual implementations, allowing the build system to resolve references while deferring the actual functionality to the runtime environment (the Android OS itself).

2. API Consistency and Simulation: For TEESimulator, which aims to provide a software simulation for Android's hardware-backed key pairs (KeyMint/Keystore2), stub classes define the required API contract. They ensure that the simulator's components compile against the exact interface definitions of the Android system services, making the simulation functionally consistent with the expected system behavior without needing to bundle or depend on the entire Android framework at compile time. This ensures that the simulator correctly interacts with the defined KeyMint and Keystore2 API shapes.
This commit is contained in:
JingMatrix
2025-11-22 15:24:43 +01:00
parent 2ac2518216
commit ad4e772eb4
26 changed files with 989 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import com.ncorti.ktfmt.gradle.tasks.KtfmtFormatTask
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.ktfmt) apply true
}
tasks.register<KtfmtFormatTask>("format") {
source = project.fileTree(rootDir)
include("*.gradle.kts", "*/*.gradle.kts")
dependsOn(":stub:ktfmtFormat")
}
ktfmt { kotlinLangStyle() }