manager: Add kpmmgr to build workflows and optimize device model retrieval logic

This commit is contained in:
ShirkNeko
2025-03-29 16:03:56 +08:00
parent e6baa7fe56
commit 11ec41aadb
2 changed files with 31 additions and 12 deletions

View File

@@ -9,6 +9,7 @@ on:
- 'kernel/**'
- 'userspace/ksud/**'
- 'userspace/zakomksd/**'
- 'userspace/kpmmgr/**'
pull_request:
branches: [ "main" ]
paths:
@@ -95,6 +96,19 @@ jobs:
target: ${{ matrix.target }}
os: ${{ matrix.os }}
build-kpmmgr:
if: ${{ always() }}
needs: [ check-build-lkm, build-lkm ]
strategy:
matrix:
include:
- target: aarch64-linux-android
os: ubuntu-latest
uses: ./.github/workflows/kpmmgr.yml
with:
target: ${{ matrix.target }}
os: ${{ matrix.os }}
build-ksud:
if: ${{ always() }}
needs: [ check-build-lkm, build-lkm ]
@@ -185,6 +199,13 @@ jobs:
cp -f ../aarch64-linux-android/release/zakomk ../manager/app/src/main/jniLibs/arm64-v8a/libzakomk.so
cp -f ../x86_64-linux-android/release/zakomk ../manager/app/src/main/jniLibs/x86_64/libzakomk.so
- name: Copy kpmmgr to app jniLibs
run: |
mkdir -p app/src/main/jniLibs/arm64-v8a
mkdir -p app/src/main/jniLibs/x86_64
cp -f ../arm64-v8a/kpmmgr ../manager/app/src/main/jniLibs/arm64-v8a/kpmmgr.so
cp -f ../x86_64/kpmmgr ../manager/app/src/main/jniLibs/x86_64/kpmmgr.so
- name: Copy zakomksd to app jniLibs
run: |
mkdir -p app/src/main/jniLibs/arm64-v8a

View File

@@ -581,20 +581,18 @@ private fun getDeviceModel(context: Context): String {
return try {
val systemProperties = Class.forName("android.os.SystemProperties")
val getMethod = systemProperties.getMethod("get", String::class.java, String::class.java)
val marketName = context.getSystemService(Context.APP_OPS_SERVICE)?.let { appOps ->
getMethod.invoke(null, "ro.product.marketname", "") as String
} ?: ""
if (marketName.isNotEmpty()) {
marketName
} else {
val MarketName = getMethod.invoke(null, "ro.vendor.oplus.market.name", "") as String
if (MarketName.isNotEmpty()) {
MarketName
} else {
Build.DEVICE
val marketNameKeys = listOf(
"ro.product.marketname",
"ro.vendor.oplus.market.name",
"ro.vivo.market.name"
)
for (key in marketNameKeys) {
val marketName = getMethod.invoke(null, key, "") as String
if (marketName.isNotEmpty()) {
return marketName
}
}
Build.DEVICE
} catch (e: Exception) {
Build.DEVICE
}