-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Base: add support for Build.VERSION.DEVICE_INITIAL_SDK_INT to profile…
… manager
- Loading branch information
Showing
2 changed files
with
11 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,6 +202,7 @@ object ProfileManager { | |
return serial | ||
} | ||
|
||
@SuppressLint("BlockedPrivateApi") | ||
private fun getRealData(): Map<String, String> = mutableMapOf( | ||
"Build.BOARD" to android.os.Build.BOARD, | ||
"Build.BOOTLOADER" to android.os.Build.BOOTLOADER, | ||
|
@@ -235,6 +236,12 @@ object ProfileManager { | |
if (android.os.Build.VERSION.SDK_INT >= 23) { | ||
put("Build.VERSION.SECURITY_PATCH", android.os.Build.VERSION.SECURITY_PATCH) | ||
} | ||
try { | ||
val field = android.os.Build.VERSION::class.java.getDeclaredField("DEVICE_INITIAL_SDK_INT") | ||
field.isAccessible = true | ||
put("Build.VERSION.DEVICE_INITIAL_SDK_INT", field.getInt(null).toString()) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mar-v-in
Author
Member
|
||
} catch (ignored: Exception) { | ||
} | ||
} | ||
|
||
private fun applyProfileData(profileData: Map<String, String>) { | ||
|
@@ -267,6 +274,7 @@ object ProfileManager { | |
applyStringField("Build.VERSION.RELEASE") { Build.VERSION.RELEASE = it } | ||
applyStringField("Build.VERSION.SDK") { Build.VERSION.SDK = it } | ||
applyIntField("Build.VERSION.SDK_INT") { Build.VERSION.SDK_INT = it } | ||
applyIntField("Build.VERSION.DEVICE_INITIAL_SDK_INT") { Build.VERSION.DEVICE_INITIAL_SDK_INT = it } | ||
if (android.os.Build.VERSION.SDK_INT >= 21) { | ||
Build.SUPPORTED_ABIS = profileData["Build.SUPPORTED_ABIS"]?.split(",")?.toTypedArray() ?: emptyArray() | ||
} else { | ||
|
@mar-v-in
It is named
Build.VERSION.DEVICE_INITIAL_SDK_INT
only in new Android versions => https://android.googlesource.com/platform/frameworks/base/+/main/core/java/android/os/Build.java#412On Android <= 11 it is named
Build.VERSION.FIRST_SDK_INT
=> https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-11.0.0_r48/core/java/android/os/Build.java#303