Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions openandroidinstaller/app_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def __init__(
self.dtbo_path = None
self.vbmeta_path = None
self.super_empty_path = None
self.vendor_boot_path = None

# store views
self.default_views: List = []
Expand Down
2 changes: 1 addition & 1 deletion openandroidinstaller/assets/configs/Mi439.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ steps:
content: >
Install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue.

Note : If you have not selected this partition, it will do nothing.
Note : If you have not selected additional partitions it will do nothing and is save to continue.
Comment thread
tsterbak marked this conversation as resolved.
Outdated
command: fastboot_flash_additional_partitions
- type: call_button
content: >
Expand Down
9 changes: 9 additions & 0 deletions openandroidinstaller/assets/configs/avicii.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
supported_device_codes:
- avicii
- Nord
additional_steps:
- dtbo
- vbmeta
requirements:
android: 12
steps:
Expand All @@ -31,6 +34,12 @@ steps:
adapting and repairing of the operating system.
Make sure your device is turned on. You need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue.
command: adb_reboot_bootloader
- type: call_button
content: >
Install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue.

Note : If you have not selected additional partitions it will do nothing and is save to continue.
Comment thread
tsterbak marked this conversation as resolved.
command: fastboot_flash_additional_partitions
- type: call_button
img: twrp-start.jpeg
content: >
Expand Down
8 changes: 8 additions & 0 deletions openandroidinstaller/assets/configs/coral.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
device_code: coral
supported_device_codes:
- coral
additional_steps:
- dtbo
requirements:
android: 13
steps:
Expand Down Expand Up @@ -48,6 +50,12 @@ steps:
- type: confirm_button
content: >
Select 'Restart bootloader' on your smartphone screen. Then confirm to continue.
- type: call_button
content: >
When you are in the bootloder, install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue.

Note : If you have not selected additional partitions it will do nothing and is save to continue.
command: fastboot_flash_additional_partitions
- type: call_button
img: twrp-start.jpeg
content: >
Expand Down
10 changes: 10 additions & 0 deletions openandroidinstaller/assets/configs/dre.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ metadata:
supported_device_codes:
- dre
- NordN200
additional_steps:
- dtbo
- vbmeta
- vendor_boot
requirements:
android: 11
steps:
Expand Down Expand Up @@ -36,6 +40,12 @@ steps:
content: >
Boot a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue.
command: fastboot_boot_recovery
- type: call_button
content: >
Install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue.

Note : If you have not selected additional partitions it will do nothing and is save to continue.
command: fastboot_flash_additional_partitions
- type: call_button
content: >
In some cases, the inactive slot can be unpopulated or contain much older firmware than the active slot, leading to various issues including a potential hard-brick.
Expand Down
8 changes: 8 additions & 0 deletions openandroidinstaller/assets/configs/flame.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
device_code: flame
supported_device_codes:
- flame
additional_steps:
- dtbo
requirements:
android: 13
steps:
Expand Down Expand Up @@ -48,6 +50,12 @@ steps:
- type: confirm_button
content: >
Select 'Restart bootloader' on your smartphone screen. Then confirm to continue.
- type: call_button
content: >
When you are in the bootloder, install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue.

Note : If you have not selected additional partitions it will do nothing and is save to continue.
command: fastboot_flash_additional_partitions
- type: call_button
img: twrp-start.jpeg
content: >
Expand Down
9 changes: 9 additions & 0 deletions openandroidinstaller/assets/configs/guacamole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
supported_device_codes:
- guacamole
- OnePlus7Pro
additional_steps:
- dtbo
- vbmeta
requirements:
android: 12
steps:
Expand All @@ -31,6 +34,12 @@ steps:
adapting and repairing of the operating system.
Make sure your device is turned on. You need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue.
command: adb_reboot_bootloader
- type: call_button
content: >
Install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue.

Note : If you have not selected additional partitions it will do nothing and is save to continue.
command: fastboot_flash_additional_partitions
- type: call_button
img: twrp-start.jpeg
content: >
Expand Down
3 changes: 3 additions & 0 deletions openandroidinstaller/assets/configs/guacamoleb.yaml
Comment thread
tsterbak marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
supported_device_codes:
- guacamoleb
- OnePlus7
additional_steps:
- dtbo
- vbmeta
requirements:
android: 12
steps:
Expand Down
9 changes: 9 additions & 0 deletions openandroidinstaller/assets/configs/hotdog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
supported_device_codes:
- hotdog
- OnePlus7TPro
additional_steps:
- dtbo
- vbmeta
requirements:
android: 12
steps:
Expand All @@ -31,6 +34,12 @@ steps:
adapting and repairing of the operating system.
Make sure your device is turned on. You need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue.
command: adb_reboot_bootloader
- type: call_button
content: >
Install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue.

Note : If you have not selected additional partitions it will do nothing and is save to continue.
command: fastboot_flash_additional_partitions
- type: call_button
img: twrp-start.jpeg
content: >
Expand Down
9 changes: 9 additions & 0 deletions openandroidinstaller/assets/configs/hotdogb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
supported_device_codes:
- hotdogb
- OnePlus7T
additional_steps:
- dtbo
- vbmeta
requirements:
android: 12
steps:
Expand All @@ -31,6 +34,12 @@ steps:
adapting and repairing of the operating system.
Make sure your device is turned on. You need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue.
command: adb_reboot_bootloader
- type: call_button
content: >
Install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue.

Note : If you have not selected additional partitions it will do nothing and is save to continue.
command: fastboot_flash_additional_partitions
- type: call_button
img: twrp-start.jpeg
content: >
Expand Down
8 changes: 8 additions & 0 deletions openandroidinstaller/assets/configs/sunfish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ metadata:
device_code: sunfish
supported_device_codes:
- sunfish
additional_steps:
- dtbo
requirements:
android: 12.1.0
steps:
Expand Down Expand Up @@ -48,6 +50,12 @@ steps:
- type: confirm_button
content: >
Select 'Restart bootloader' on your smartphone screen. Then confirm to continue.
- type: call_button
content: >
When you are in the bootloder, install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue.

Note : If you have not selected additional partitions it will do nothing and is save to continue.
command: fastboot_flash_additional_partitions
- type: call_button
img: twrp-start.jpeg
content: >
Expand Down
16 changes: 15 additions & 1 deletion openandroidinstaller/tooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ def fastboot_flash_additional_partitions(
dtbo: Optional[str],
vbmeta: Optional[str],
super_empty: Optional[str],
vendor_boot: Optional[str],
is_ab: bool = True,
) -> TerminalResponse:
"""Flash additional partitions (dtbo, vbmeta, super_empty) with fastboot."""
Expand All @@ -504,7 +505,7 @@ def fastboot_flash_additional_partitions(
if vbmeta:
logger.info("vbmeta selected. Flashing vbmeta partition.")
for line in run_command(
"fastboot flash vbmeta ", target=f"{vbmeta}", bin_path=bin_path
"fastboot --disable-verity --disable-verification flash vbmeta ", target=f"{vbmeta}", bin_path=bin_path
):
yield line
if not is_ab:
Expand All @@ -527,6 +528,19 @@ def fastboot_flash_additional_partitions(
else:
yield True

if vendor_boot:
logger.info("vendor_boot selected. Flashing vendor_boot partition.")
for line in run_command(
"fastboot flash vendor_boot ", target=f"{vendor_boot}", bin_path=bin_path
):
yield line
if not is_ab:
if (type(line) == bool) and not line:
logger.error("Flashing vendor_boot failed.")
yield False
else:
yield True


def heimdall_wait_for_download_available(bin_path: Path) -> bool:
"""Use heimdall detect to wait for download mode to become available on the device."""
Expand Down
52 changes: 51 additions & 1 deletion openandroidinstaller/views/select_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ def init_visuals(
self.pick_super_empty_dialog = FilePicker(
on_result=self.pick_super_empty_result
)
self.pick_vendor_boot_dialog = FilePicker(
on_result=self.pick_vendor_boot_result
)

self.selected_image = Text("Selected image: ")
self.selected_recovery = Text("Selected recovery: ")
Expand All @@ -118,6 +121,9 @@ def init_visuals(
self.selected_super_empty = Checkbox(
fill_color=colors.RED, value=None, disabled=True, tristate=True
)
self.selected_vendor_boot = Checkbox(
fill_color=colors.RED, value=None, disabled=True, tristate=True
)

# initialize and manage button state.
self.confirm_button = confirm_button(self.on_confirm)
Expand All @@ -131,6 +137,7 @@ def init_visuals(
self.pick_dtbo_dialog.on_result = self.enable_button_if_ready
self.pick_vbmeta_dialog.on_result = self.enable_button_if_ready
self.pick_super_empty_dialog.on_result = self.enable_button_if_ready
self.pick_vendor_boot_dialog.on_result = self.enable_button_if_ready
# back button
self.back_button = ElevatedButton(
"Back",
Expand All @@ -155,6 +162,7 @@ def build(self):
self.pick_dtbo_dialog,
self.pick_vbmeta_dialog,
self.pick_super_empty_dialog,
self.pick_vendor_boot_dialog,
]
)

Expand Down Expand Up @@ -462,6 +470,27 @@ def toggle_additional_image_selection(self):
self.selected_super_empty,
]
),
]
)
if "vendor_boot" in self.state.config.additional_steps:
self.selected_vendor_boot.value = False
additional_image_selection.extend(
[
Row(
[
FilledButton(
"Pick `vendor_boot.img` image",
icon=icons.UPLOAD_FILE,
on_click=lambda _: self.pick_vendor_boot_dialog.pick_files(
allow_multiple=False,
file_type="custom",
allowed_extensions=["img"],
),
expand=True,
),
self.selected_vendor_boot,
]
),
Divider(),
]
)
Expand Down Expand Up @@ -600,6 +629,26 @@ def pick_super_empty_result(self, e: FilePickerResultEvent):
# update
self.selected_super_empty.update()

def pick_vendor_boot_result(self, e: FilePickerResultEvent):
path = ", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!"
# update the textfield with the name of the file
if e.files:
# check if the super_empty works with the device and show the filename in different colors accordingly
if path == "vendor_boot.img":
self.selected_vendor_boot.fill_color = colors.GREEN
self.selected_vendor_boot.value = True
self.state.vendor_boot_path = e.files[0].path
logger.info(
f"Selected vendor_boot.img from {self.state.vendor_boot_path}"
)
else:
self.selected_vendor_boot.fill_color = colors.RED
self.selected_vendor_boot.value = False
else:
logger.info("No image selected.")
# update
self.selected_vendor_boot.update()

def enable_button_if_ready(self, e):
"""Enable the confirm button if both files have been selected."""
if (".zip" in self.selected_image.value) and (
Expand Down Expand Up @@ -642,6 +691,8 @@ def enable_button_if_ready(self, e):
or "vbmeta" not in self.state.config.additional_steps,
self.selected_super_empty.value
or "super_empty" not in self.state.config.additional_steps,
self.selected_vendor_boot.value
or "vendor_boot" not in self.state.config.additional_steps,
]
):
logger.error(
Expand Down Expand Up @@ -693,4 +744,3 @@ def enable_button_if_ready(self, e):
self.right_view.update()
else:
self.confirm_button.disabled = True
# self.continue_eitherway_button.disabled = True
1 change: 1 addition & 0 deletions openandroidinstaller/views/step_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ def call_to_phone(self, e, command: str):
dtbo=self.state.dtbo_path,
vbmeta=self.state.vbmeta_path,
super_empty=self.state.super_empty_path,
vendor_boot=self.state.vendor_boot_path,
is_ab=self.state.config.is_ab,
),
"fastboot_reboot": fastboot_reboot,
Expand Down