Skip to content

Commit

Permalink
- Bugfix: #192 - Failed to process Android 15 beta firmware.
Browse files Browse the repository at this point in the history
  • Loading branch information
badabing2005 committed Apr 15, 2024
1 parent fe34916 commit 3458aa0
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 17 deletions.
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.2.0',
version='6.9.2.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.2.0
VERSION=6.9.2.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.2.0'
VERSION = '6.9.2.1'
SDKVERSION = '33.0.3'
MAIN_WIDTH = 1400
MAIN_HEIGHT = 1040
Expand Down
7 changes: 6 additions & 1 deletion modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -2448,6 +2448,11 @@ def patch_apatch_script(patch_method="app"):
print(f"With APatch patching, the boot.img will be used, instead of init_boot.img, however we need ramdisk from init_boot.img")
init_boot_path = boot_path
boot_path = boot_path.replace("init_boot.img", "boot.img")
if not os.path.exists(boot_path):
print(f"\n{datetime.now():%Y-%m-%d %H:%M:%S} ERROR: boot.img file [{boot_path}] is not found.")
puml("#red:ERROR: boot.img file [{boot_path}] is not found;\n")
print("Aborting ...\n}\n")
return -1
stock_init_sha1 = sha1(init_boot_path)[:8]
stock_sha1 = sha1(boot_path)[:8]
print(f"Using boot.img for APatch patching with SHA1 of {stock_sha1}")
Expand Down Expand Up @@ -4090,7 +4095,7 @@ def flash_phone(self):
os.chdir(package_dir_full)
theCmd = f"\"{theCmd}\""
debug(theCmd)
res = run_shell2(theCmd)
res = run_shell2(theCmd, env=get_env_variables())
if res.returncode != 0:
print(f"\n{datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Encountered an error while running flash script.")
print(f"theCmd: {theCmd}")
Expand Down
20 changes: 12 additions & 8 deletions runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -3515,37 +3515,41 @@ def run_shell2(cmd, timeout=None, detached=False, directory=None, encoding='ISO-
"stderr": subprocess.STDOUT,
"encoding": encoding,
"errors": "replace",
"cwd": directory,
"start_new_session": detached,
"creationflags": creationflags
}
if env is not None:
proc_args["env"] = env
if creationflags is not None:
proc_args["creationflags"] = creationflags
if directory is not None:
proc_args["cwd"] = directory

proc = subprocess.Popen(**proc_args)

def read_output():
print
start_time = time.time()
output = []
while True:
line = proc.stdout.readline()
wx.YieldIfNeeded()
if line.strip() != "":
print(line.strip())
output.append(line.strip())
if not line:
break
if timeout is not None and time.time() - start_time > timeout:
proc.terminate()
print(f"\n{datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Command {cmd} timed out after {timeout} seconds")
puml("#red:Command timed out;\n", True)
puml(f"note right\nCommand {cmd} timed out after {timeout} seconds\nend note\n")
return subprocess.CompletedProcess(args=cmd, returncode=-1, stdout='', stderr='')

if detached:
threading.Thread(target=read_output, daemon=True).start()
else:
read_output()
return subprocess.CompletedProcess(args=cmd, returncode=-1, stdout='\n'.join(output), stderr='')

threading.Thread(target=read_output, daemon=True).start()
if not detached:
proc.wait()
return proc

except Exception as e:
print(f"\n{datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Encountered an error while executing run_shell2 {cmd}")
traceback.print_exc()
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.2.0
Version: 6.9.2.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,2,0),
prodvers=(6,9,2,0),
filevers=(6,9,2,1),
prodvers=(6,9,2,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.2.0'),
StringStruct(u'FileVersion', u'6.9.2.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.2.0')])
StringStruct(u'ProductVersion', u'6.9.2.1')])
]),
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
]
Expand Down

0 comments on commit 3458aa0

Please sign in to comment.