Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add security patch level and vbmeta digest to main UI #113

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/src/main/java/com/chiller3/custota/Preferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class Preferences(private val context: Context) {
const val PREF_BATTERY_NOT_LOW = "battery_not_low"
const val PREF_SKIP_POSTINSTALL = "skip_postinstall"
const val PREF_ANDROID_VERSION = "android_version"
const val PREF_SECURITY_PATCH_LEVEL = "security_patch_level"
const val PREF_FINGERPRINT = "fingerprint"
const val PREF_VBMETA_DIGEST = "vbmeta_digest"
const val PREF_BOOT_SLOT = "boot_slot"
const val PREF_BOOTLOADER_STATUS = "bootloader_status"
const val PREF_NO_CERTIFICATES = "no_certificates"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClic
private lateinit var prefCheckForUpdates: Preference
private lateinit var prefOtaSource: LongClickablePreference
private lateinit var prefAndroidVersion: Preference
private lateinit var prefSecurityPatchLevel: Preference
private lateinit var prefFingerprint: Preference
private lateinit var prefVbmetaDigest: Preference
private lateinit var prefBootSlot: Preference
private lateinit var prefBootloaderStatus: Preference
private lateinit var prefNoCertificates: Preference
Expand Down Expand Up @@ -137,9 +139,15 @@ class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClic
prefAndroidVersion = findPreference(Preferences.PREF_ANDROID_VERSION)!!
prefAndroidVersion.summary = Build.VERSION.RELEASE

prefSecurityPatchLevel = findPreference(Preferences.PREF_SECURITY_PATCH_LEVEL)!!
prefSecurityPatchLevel.summary = SystemPropertiesProxy.get(UpdaterThread.PROP_SECURITY_PATCH)

prefFingerprint = findPreference(Preferences.PREF_FINGERPRINT)!!
prefFingerprint.summary = Build.FINGERPRINT

prefVbmetaDigest = findPreference(Preferences.PREF_VBMETA_DIGEST)!!
prefVbmetaDigest.summary = SystemPropertiesProxy.get(UpdaterThread.PROP_VBMETA_DIGEST)

prefBootSlot = findPreference(Preferences.PREF_BOOT_SLOT)!!
prefBootSlot.summary = SystemPropertiesProxy.get("ro.boot.slot_suffix")
.removePrefix("_").uppercase()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -907,8 +907,8 @@ class UpdaterThread(

private const val TIMEOUT_MS = 30_000

private const val PROP_SECURITY_PATCH = "ro.build.version.security_patch"
private const val PROP_VBMETA_DIGEST = "ro.boot.vbmeta.digest"
const val PROP_SECURITY_PATCH = "ro.build.version.security_patch"
const val PROP_VBMETA_DIGEST = "ro.boot.vbmeta.digest"

private val jsonFormat = Json { ignoreUnknownKeys = true }

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@

<!-- OS information preferences -->
<string name="pref_android_version_name">Android version</string>
<string name="pref_security_patch_level_name">Security patch level</string>
<string name="pref_fingerprint_name">Fingerprint</string>
<string name="pref_vbmeta_digest_name">vbmeta digest</string>
<string name="pref_boot_slot_name">Boot slot</string>
<string name="pref_bootloader_status_name">Bootloader status</string>
<string name="pref_bootloader_status_unknown">Unknown</string>
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/res/xml/preferences_root.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,24 @@
app:title="@string/pref_android_version_name"
app:iconSpaceReserved="false" />

<Preference
app:key="security_patch_level"
app:persistent="false"
app:title="@string/pref_security_patch_level_name"
app:iconSpaceReserved="false" />

<Preference
app:key="fingerprint"
app:persistent="false"
app:title="@string/pref_fingerprint_name"
app:iconSpaceReserved="false" />

<Preference
app:key="vbmeta_digest"
app:persistent="false"
app:title="@string/pref_vbmeta_digest_name"
app:iconSpaceReserved="false" />

<Preference
app:key="boot_slot"
app:persistent="false"
Expand Down
Loading