[ASUS ZenFone 8] bnsmb:
Sometimes it is useful to check the security patch level that was used to create a ROM image ZIP file for an Android phone (e.g. to decide whether an OS update is required).

To check the security patch level used in an ZIP file with a ROM image for an Android phone check the contents of the file META-INF/com/android/metadata in the ZIP file, the security patch level is the value for the key post-security-patch-level.

Example:

# ASUS Android 13 for the ASUS Zenfone 8
#
[ OmniRom 14 Dev - xtrnaw7@t15g /data/backup/ASUS_ZENFONE8/ASUS_firmware/Android_13 ] $ unzip -p UL-ASUS_I006D-ASUS-33.0210.0210.269-1.1.26-2303-user.zip META-INF/com/android/metadata
ota-property-files=payload_metadata.bin:3634:227939,payload.bin:3634:3395083562,payload_properties.txt:3395087254:156,apex_info.pb:2030:839,care_map.pb:2916:671,metadata:69:689,metadata.pb:826:1156
ota-required-cache=0
ota-streaming-property-files=payload.bin:3634:3395083562,payload_properties.txt:3395087254:156,apex_info.pb:2030:839,care_map.pb:2916:671,metadata:69:689,metadata.pb:826:1156
ota-type=AB
post-build=asus/WW_I006D/ASUS_I006D:13/TKQ1.220807.001/33.0210.0210.269:user/release-keys
post-build-incremental=33.0210.0210.269
post-sdk-level=33
post-security-patch-level=2023-03-05
post-timestamp=1678292389
pre-device=ASUS_I006D
[ OmniRom 14 Dev - xtrnaw7@t15g /data/backup/ASUS_ZENFONE8/ASUS_firmware/Android_13 ] $

# or to print only the security patch level

[ OmniRom 14 Dev - xtrnaw7@t15g /data/backup/ASUS_ZENFONE8/omnirom/omni-14 ] $ unzip -p omni-14-202404041405-zenfone8-MICROG.zip META-INF/com/android/metadata | grep "^post-security-patch-level=" | cut -f2 -d "="
2024-03-05
[ OmniRom 14 Dev - xtrnaw7@t15g /data/backup/ASUS_ZENFONE8/omnirom/omni-14 ] $

Other examples:

Spoiler content hidden.

Spoiler content hidden.

(see also How to print the security patch level used in repositories or ROM image zip files)

To print the security patch level of an installed and running Android OS check the value of the property ro.build.version.security_patch, e.g.:

ASUS_I006D:/ $ getprop ro.build.version.security_patch
2024-04-05
ASUS_I006D:/ $

Another important info in the file META-INF/com/android/metadata in the ZIP file is the value for the key post-timestamp .

In the example above, this is this line

post-timestamp=1712239453

To print the timestamps used to create the Android OS installed and running on the phone check the values of these properties:

ASUS_I006D:/ $ getprop | grep build.date | sed -e "/utc/ s/$/\n/g"
[ro.bootimage.build.date]: [Thu Apr 4 07:49:54 CEST 2024]
[ro.bootimage.build.date.utc]: [1712209794]

[ro.build.date]: [Thu Apr 4 07:49:54 CEST 2024]
[ro.build.date.utc]: [1712209794]

[ro.odm.build.date]: [Thu Apr 4 07:49:54 CEST 2024]
[ro.odm.build.date.utc]: [1712209794]

[ro.product.build.date]: [Thu Apr 4 07:49:54 CEST 2024]
[ro.product.build.date.utc]: [1712209794]

[ro.system.build.date]: [Thu Apr 4 07:49:54 CEST 2024]
[ro.system.build.date.utc]: [1712209794]

[ro.system_ext.build.date]: [Thu Apr 4 07:49:54 CEST 2024]
[ro.system_ext.build.date.utc]: [1712209794]

[ro.vendor.build.date]: [Thu Apr 4 07:49:54 CEST 2024]
[ro.vendor.build.date.utc]: [1712209794]

[ro.vendor_dlkm.build.date]: [Thu Apr 4 07:49:54 CEST 2024]
[ro.vendor_dlkm.build.date.utc]: [1712209794]

Since some time now the updater from Android refuses to downgrade the installed OS -- the attempt to install an operating system image with an older timestamp than the timestamp of the installed operating system fails with this error:

Updated failed with error 51

and a message like this will appear in the logcat:

ASUS_I006D:/ $ logcat | grep timestamp
04-07 18:24:29.600 4348 4365 D OmniOta : latestDeviceBuild = BuildImage(filename=omni-14-202404041405-zenfone8-MICROG.zip, timestamp=1712243815, size=1368238540)
04-07 18:24:40.796 1467 1467 E update_engine: [ERROR:delta_performer.cc(1161)] The current OS build timestamp (1712209794) is newer than the maximum timestamp in the manifest (1711954765)
^C

Note:

1712209794 is the number of seconds since 1.1.1970. To convert the date into an human readable date string use this command:

[ OmniRom 14 Dev - xtrnaw7@t15g / ] $ date --date='@1711954765'
Mon Apr 1 08:59:25 AM CEST 2024
[ OmniRom 14 Dev - xtrnaw7@t15g / ] $

or, to print the date in UTC:

[ OmniRom 14 Dev - xtrnaw7@t15g / ] $ date -u --date='@1711954765'
Mon Apr 1 06:59:25 AM UTC 2024
[ OmniRom 14 Dev - xtrnaw7@t15g / ] $

Be aware that the value for the timestamp in the ZIP file is independent from the timestamp of the ZIP file; it is also not related to the time the image was created.