Skip to content

Commit

Permalink
- When getting SPL details, don't limit it to just boot.img.
Browse files Browse the repository at this point in the history
  • Loading branch information
badabing2005 committed Apr 30, 2024
1 parent 5edb9c1 commit 0d1db2d
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 17 deletions.
15 changes: 9 additions & 6 deletions Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3986,10 +3986,19 @@ def _on_boot_selected(self, event):
message += f"Stock Boot: False\n"
elif boot.is_stock_boot == 1:
message += f"Stock Boot: True\n"

# get boot image info
boot_img_info = get_boot_image_info(boot.boot_path)
if boot.is_init_boot == 0:
message += f"Init Boot: False\n"
if boot_img_info:
boot.spl = boot_img_info['com.android.build.boot.security_patch']
boot.fingerprint = boot_img_info['com.android.build.boot.fingerprint']
elif boot.is_init_boot == 1:
message += f"Init Boot: True\n"
if boot_img_info:
boot.spl = boot_img_info['com.android.build.init_boot.security_patch']
boot.fingerprint = boot_img_info['com.android.build.init_boot.fingerprint']
message += f"Date: {ts.strftime('%Y-%m-%d %H:%M:%S')}\n"
message += f"Firmware Fingerprint: {boot.package_sig}\n"
message += f"Firmware: {boot.package_path}\n"
Expand All @@ -3999,12 +4008,6 @@ def _on_boot_selected(self, event):
message += f"\nINFO: Multiple PACKAGE_BOOT records found for {boot.boot_hash}."
print(f"{message}")
puml(f"note right\n{message}\nend note\n")

# get boot image info
boot_img_info = get_boot_image_info(boot.boot_path)
if boot_img_info:
boot.spl = boot_img_info['com.android.build.boot.security_patch']
boot.fingerprint = boot_img_info['com.android.build.boot.fingerprint']
else:
self.config.boot_id = None
self.config.selected_boot_md5 = None
Expand Down
2 changes: 1 addition & 1 deletion build-on-mac.spec
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ exe = EXE(pyz,
icon='images/icon-dark-256.icns')
app = BUNDLE(exe,
name='PixelFlasher.app',
version='6.9.3.0',
version='6.9.3.1',
icon='./images/icon-dark-256.icns',
bundle_identifier='com.badabing.pixelflasher')
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
rm -rf build dist
VERSION=6.9.3.0
VERSION=6.9.3.1
NAME="PixelFlasher"
DIST_NAME="PixelFlasher"

Expand Down
2 changes: 1 addition & 1 deletion constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

APPNAME = 'PixelFlasher'
CONFIG_FILE_NAME = 'PixelFlasher.json'
VERSION = '6.9.3.0'
VERSION = '6.9.3.1'
SDKVERSION = '33.0.3'
MAIN_WIDTH = 1400
MAIN_HEIGHT = 1040
Expand Down
16 changes: 13 additions & 3 deletions modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,8 @@ def setup_for_downgrade(self):
Unless you know what you're doing, it is recommended that you take the default suggested selection.
'''
message += f"<pre>Rooted: {device_is_rooted}\n"
message += f"Target boot.security_patch: {target_boot_info['com.android.build.boot.security_patch']}\n"
with contextlib.suppress(Exception):
message += f"Target boot.security_patch: {target_boot_info['com.android.build.boot.security_patch']}\n"
message += f"Recommended Patch option: {option_text}</pre>\n"
clean_message = message.replace("<br/>", "").replace("</pre>", "").replace("<pre>", "")
print(f"\n*** Dialog ***\n{clean_message}\n______________\n")
Expand Down Expand Up @@ -1222,10 +1223,19 @@ def setup_for_downgrade(self):

# Compare the two boot image info objects and do validations to make sure the target is a downgrade and the current matches current OS version
print(f"\nChecking if the target boot.img is a downgrade ...")
current_patch = current_boot_info['com.android.build.boot.security_patch']
target_patch = target_boot_info['com.android.build.boot.security_patch']
current_patch = '1970-01-01'
with contextlib.suppress(Exception):
current_patch = current_boot_info['com.android.build.boot.security_patch']
target_patch = '1970-01-01'
with contextlib.suppress(Exception):
target_patch = target_boot_info['com.android.build.boot.security_patch']
print(f"Current Security Patch: {current_patch}")
print(f"Target Security Patch: {target_patch}")
if current_patch == '1970-01-01' or target_patch == '1970-01-01':
print(f"\n{datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Could not determine the security patch level of the boot images.")
puml("#red:Could not determine the security patch level of the boot images;\n")
print("Aborting ...\n")
return -1
if target_patch >= current_patch and not checkbox_values[1]:
print(f"\n⚠️ {datetime.now():%Y-%m-%d %H:%M:%S} WARNING: The target boot.img is not a downgrade.\nAre you sure want to continue?")
dlg = wx.MessageDialog(None, "WARNING: The target boot.img is not a downgrade.\nAre you sure want to continue?",'Confirm',wx.YES_NO | wx.ICON_EXCLAMATION)
Expand Down
2 changes: 1 addition & 1 deletion windows-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# https://github.com/DudeNr33/pyinstaller-versionfile
# create-version-file windows-metadata.yaml --outfile windows-version-info.txt
Version: 6.9.3.0
Version: 6.9.3.1
FileDescription: PixelFlasher
InternalName: PixelFlasher
OriginalFilename: PixelFlasher.exe
Expand Down
8 changes: 4 additions & 4 deletions windows-version-info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ VSVersionInfo(
ffi=FixedFileInfo(
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
# Set not needed items to zero 0. Must always contain 4 elements.
filevers=(6,9,3,0),
prodvers=(6,9,3,0),
filevers=(6,9,3,1),
prodvers=(6,9,3,1),
# Contains a bitmask that specifies the valid bits 'flags'r
mask=0x3f,
# Contains a bitmask that specifies the Boolean attributes of the file.
Expand All @@ -32,12 +32,12 @@ VSVersionInfo(
u'040904B0',
[StringStruct(u'CompanyName', u''),
StringStruct(u'FileDescription', u'PixelFlasher'),
StringStruct(u'FileVersion', u'6.9.3.0'),
StringStruct(u'FileVersion', u'6.9.3.1'),
StringStruct(u'InternalName', u'PixelFlasher'),
StringStruct(u'LegalCopyright', u''),
StringStruct(u'OriginalFilename', u'PixelFlasher.exe'),
StringStruct(u'ProductName', u'PixelFlasher'),
StringStruct(u'ProductVersion', u'6.9.3.0')])
StringStruct(u'ProductVersion', u'6.9.3.1')])
]),
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
]
Expand Down

0 comments on commit 0d1db2d

Please sign in to comment.