From 2bb75d01eeced114fad4a128d95bb71a354a912a Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Mon, 30 Jan 2023 11:35:09 +0000 Subject: [PATCH 01/18] Add an install view and allow to circle back to flash a recovery --- openandroidinstaller/app_state.py | 8 +- .../assets/configs/a5xelte.yaml | 10 +- .../assets/configs/sargo.yaml | 10 +- openandroidinstaller/installer_config.py | 11 +- openandroidinstaller/openandroidinstaller.py | 22 +- openandroidinstaller/views/__init__.py | 1 + openandroidinstaller/views/install_view.py | 201 ++++++++++++++++++ openandroidinstaller/views/start_view.py | 11 +- openandroidinstaller/views/step_view.py | 17 +- pyproject.toml | 2 +- 10 files changed, 235 insertions(+), 58 deletions(-) create mode 100644 openandroidinstaller/views/install_view.py diff --git a/openandroidinstaller/app_state.py b/openandroidinstaller/app_state.py index ed0b8eae..bb19afc8 100644 --- a/openandroidinstaller/app_state.py +++ b/openandroidinstaller/app_state.py @@ -13,6 +13,7 @@ # If not, see .""" # Author: Tobias Sterbak +import copy from pathlib import Path from installer_config import _load_config @@ -37,6 +38,7 @@ def __init__( # placeholders self.advanced = False + self.install_addons = False self.config = None self.image_path = None self.recovery_path = None @@ -48,8 +50,6 @@ def load_config(self, device_code: str): """Load the config from file to state by device code.""" self.config = _load_config(device_code, self.config_path) if self.config: - self.steps = ( - self.config.unlock_bootloader - + self.config.flash_recovery - + self.config.install_os + self.steps = copy.deepcopy(self.config.unlock_bootloader) + copy.deepcopy( + self.config.flash_recovery ) diff --git a/openandroidinstaller/assets/configs/a5xelte.yaml b/openandroidinstaller/assets/configs/a5xelte.yaml index 617b7657..4d4d40bb 100644 --- a/openandroidinstaller/assets/configs/a5xelte.yaml +++ b/openandroidinstaller/assets/configs/a5xelte.yaml @@ -19,12 +19,4 @@ steps: content: > Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for 8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, - hold *Volume Up* + *Home* + *Power button*. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + hold *Volume Up* + *Home* + *Power button*. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/sargo.yaml b/openandroidinstaller/assets/configs/sargo.yaml index ed40f9ac..2e19de38 100644 --- a/openandroidinstaller/assets/configs/sargo.yaml +++ b/openandroidinstaller/assets/configs/sargo.yaml @@ -34,12 +34,4 @@ steps: - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once your phone screen looks like the picture on the left, continue. command: fastboot_flash_recovery - img: twrp-start.jpeg - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + img: twrp-start.jpeg \ No newline at end of file diff --git a/openandroidinstaller/installer_config.py b/openandroidinstaller/installer_config.py index 2eae535d..574864de 100644 --- a/openandroidinstaller/installer_config.py +++ b/openandroidinstaller/installer_config.py @@ -69,13 +69,11 @@ def __init__( self, unlock_bootloader: List[Step], flash_recovery: List[Step], - install_os: List[Step], metadata: dict, requirements: dict, ): self.unlock_bootloader = unlock_bootloader self.flash_recovery = flash_recovery - self.install_os = install_os self.metadata = metadata self.requirements = requirements self.device_code = metadata.get("devicecode") @@ -112,13 +110,7 @@ def from_file(cls, path): Step(**raw_step, title="Flash custom recovery") for raw_step in raw_steps.get("flash_recovery", []) ] - install_os = [ - Step(**raw_step, title="Install OS") - for raw_step in raw_steps.get("install_os", []) - ] - return cls( - unlock_bootloader, flash_recovery, install_os, metadata, requirements - ) + return cls(unlock_bootloader, flash_recovery, metadata, requirements) def _load_config(device_code: str, config_path: Path) -> Optional[InstallerConfig]: @@ -181,7 +173,6 @@ def validate_config(config: str) -> bool: "steps": { "unlock_bootloader": schema.Or(None, [step_schema]), "flash_recovery": [step_schema], - "install_os": [step_schema], }, } ) diff --git a/openandroidinstaller/openandroidinstaller.py b/openandroidinstaller/openandroidinstaller.py index 5920bb3e..f39b59c9 100644 --- a/openandroidinstaller/openandroidinstaller.py +++ b/openandroidinstaller/openandroidinstaller.py @@ -45,6 +45,7 @@ SuccessView, StartView, RequirementsView, + InstallView, WelcomeView, ) from tooling import run_command @@ -93,10 +94,21 @@ def __init__(self, state: AppState): start_view, welcome_view, ] + + # create the install view + self.install_view = InstallView(on_confirm=self.confirm, state=self.state) + # create the final success view self.final_view = SuccessView(state=self.state) + # final default views, ordered to allow to pop + self.final_default_views = [ + self.final_view, + self.install_view, + ] + self.state.default_views = self.default_views + self.state.final_default_views = self.final_default_views self.state.final_view = self.final_view def build(self): @@ -118,9 +130,13 @@ def confirm(self, e): on_confirm=self.confirm, ) ) - else: - # display the final view - self.view.controls.append(self.final_view) + elif self.final_default_views: + # here we expect the install view to populate the step views again if necessary + self.view.controls.append(self.final_default_views.pop()) + + # else: + # # display the final view + # self.view.controls.append(self.final_view) logger.info("Confirmed.") self.view.update() diff --git a/openandroidinstaller/views/__init__.py b/openandroidinstaller/views/__init__.py index 6c564c44..c15247fe 100644 --- a/openandroidinstaller/views/__init__.py +++ b/openandroidinstaller/views/__init__.py @@ -4,4 +4,5 @@ from .requirements_view import RequirementsView # noqa from .select_view import SelectFilesView # noqa from .step_view import StepView # noqa +from .install_view import InstallView # noqa from .success_view import SuccessView # noqa diff --git a/openandroidinstaller/views/install_view.py b/openandroidinstaller/views/install_view.py new file mode 100644 index 00000000..327fa96c --- /dev/null +++ b/openandroidinstaller/views/install_view.py @@ -0,0 +1,201 @@ +"""Contains the install view.""" + +# This file is part of OpenAndroidInstaller. +# OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of +# the GNU General Public License as published by the Free Software Foundation, +# either version 3 of the License, or (at your option) any later version. + +# OpenAndroidInstaller is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along with OpenAndroidInstaller. +# If not, see .""" +# Author: Tobias Sterbak + +from loguru import logger +from time import sleep +from typing import Callable + +from flet import ( + Column, + ElevatedButton, + Row, + Text, + icons, + Switch, + colors, + Markdown, +) + +from views import BaseView +from app_state import AppState +from tooling import adb_twrp_wipe_and_install +from widgets import ( + confirm_button, + get_title, +) +from views.step_view import TerminalBox, ProgressIndicator + + +class InstallView(BaseView): + def __init__( + self, + state: AppState, + on_confirm: Callable, + ): + super().__init__(state=state) + self.on_confirm = on_confirm + + def build(self): + """Create the content of the view.""" + # error text + self.error_text = Text("", color=colors.RED) + + # switch to enable advanced output - here it means show terminal input/output in tool + def check_advanced_switch(e): + """Check the box to enable advanced output.""" + if self.advanced_switch.value: + logger.info("Enable advanced output.") + self.state.advanced = True + self.terminal_box.toggle_visibility() + else: + logger.info("Disable advanced output.") + self.state.advanced = False + self.terminal_box.toggle_visibility() + + self.advanced_switch = Switch( + label="Advanced output", + on_change=check_advanced_switch, + disabled=False, + ) + # switch for installing addons + def check_addons_switch(e): + """Check the switch to enable the addons installation process.""" + if self.install_addons_switch.value: + logger.info("Enable flashing addons.") + self.state.install_addons = True + self.state.steps.extend(self.state.config.flash_recovery) + else: + logger.info("Disable flashing addons.") + self.state.install_addons = False + + self.install_addons_switch = Switch( + label="Install addons", + on_change=check_addons_switch, + disabled=False, + ) + # text box for terminal output + self.terminal_box = TerminalBox(expand=True) + + # container for progress indicators + self.progress_indicator = ProgressIndicator(expand=True) + + # main controls + self.right_view_header.controls = [ + get_title( + "Install OS", + step_indicator_img="steps-header-install.png", + ) + ] + self.right_view.controls = [ + Markdown( + """In the next steps, you finally flash the selected OS image. + +Connect your device with your computer with the USB-Cable. This step will format your phone and wipe all the data. +It will also remove encryption and delete all files stored in the internal storage. +Then the OS image will be installed. Confirm to install. + +#### If you want to install any addons like Google Apps, microg or F-droid, use the toggle below **before** starting the install process! +After the installation you'll be taken trough the process. + +This might take a while. At the end your phone will boot into the new OS. +""" + ) + ] + # basic view + logger.info("Starting installation.") + self.confirm_button = confirm_button(self.on_confirm) + self.confirm_button.disabled = True + # button to run the installation process + self.install_button = ElevatedButton( + "Confirm and install", + on_click=self.run_install, + expand=True, + icon=icons.DIRECTIONS_RUN_OUTLINED, + ) + # build the view + self.right_view.controls.extend( + [ + Row([self.error_text]), + Row([self.progress_indicator]), + Column( + [ + self.install_addons_switch, + self.advanced_switch, + Row([self.install_button, self.confirm_button]), + ] + ), + Row([self.terminal_box]), + ] + ) + + # if skipping is allowed add a button to the view + if self.state.test: + self.right_view.controls.append( + Row( + [ + Text("Do you want to skip?"), + ElevatedButton( + "Skip", + on_click=self.on_confirm, + icon=icons.NEXT_PLAN_OUTLINED, + expand=True, + ), + ] + ) + ) + return self.view + + def run_install(self, e): + """ + Run the installation process trought twrp. + + Some parts of the command are changed by placeholders. + """ + # disable the call button while the command is running + self.install_button.disabled = True + self.install_addons_switch.disabled = True + # reset the progress indicators + self.progress_indicator.clear() + # reset terminal output + if self.state.advanced: + self.terminal_box.clear() + self.right_view.update() + + # run the install script + for line in adb_twrp_wipe_and_install( + target=self.state.image_path, + config_path=self.state.config_path, + bin_path=self.state.bin_path, + ): + # write the line to advanced output terminal + self.terminal_box.write_line(line) + # in case the install command is run, we want to update the progress bar + self.progress_indicator.display_progress_bar(line) + self.progress_indicator.update() + success = line # the last element of the iterable is a boolean encoding success/failure + + # update the view accordingly + if not success: + # enable call button to retry + self.install_button.disabled = False + # also remove the last error text if it happened + self.error_text.value = "Installation failed! Try again or make sure everything is setup correctly." + else: + sleep(5) # wait to make sure everything is fine + logger.success("Installation process was successful. Allow to continue.") + # enable the confirm button and disable the call button + self.confirm_button.disabled = False + self.install_button.disabled = True + self.view.update() diff --git a/openandroidinstaller/views/start_view.py b/openandroidinstaller/views/start_view.py index a4bb0e09..cccace4d 100644 --- a/openandroidinstaller/views/start_view.py +++ b/openandroidinstaller/views/start_view.py @@ -13,6 +13,7 @@ # If not, see .""" # Author: Tobias Sterbak +import copy from loguru import logger from typing import Callable @@ -85,17 +86,13 @@ def check_bootloader_unlocked(e): """Enable skipping unlocking the bootloader if selected.""" if self.bootloader_switch.value: logger.info("Skipping bootloader unlocking.") - self.state.steps = ( - self.state.config.flash_recovery + self.state.config.install_os - ) + self.state.steps = copy.deepcopy(self.state.config.flash_recovery) self.state.num_total_steps = len(self.state.steps) else: logger.info("Enabled unlocking the bootloader again.") - self.state.steps = ( + self.state.steps = copy.deepcopy( self.state.config.unlock_bootloader - + self.state.config.flash_recovery - + self.state.config.install_os - ) + ) + copy.deepcopy(self.state.config.flash_recovery) self.state.num_total_steps = len(self.state.steps) self.bootloader_switch = Switch( diff --git a/openandroidinstaller/views/step_view.py b/openandroidinstaller/views/step_view.py index 03714cfc..ea54874f 100644 --- a/openandroidinstaller/views/step_view.py +++ b/openandroidinstaller/views/step_view.py @@ -43,7 +43,6 @@ adb_reboot_bootloader, adb_reboot_download, adb_sideload, - adb_twrp_wipe_and_install, adb_twrp_copy_partitions, fastboot_flash_recovery, fastboot_oem_unlock, @@ -109,7 +108,6 @@ def check_advanced_switch(e): steps_indictor_img_lookup = { "Unlock the bootloader": "steps-header-unlock.png", "Flash custom recovery": "steps-header-recovery.png", - "Install OS": "steps-header-install.png", } self.right_view_header.controls = [ get_title( @@ -209,11 +207,6 @@ def call_to_phone(self, e, command: str): "adb_reboot_bootloader": adb_reboot_bootloader, "adb_reboot_download": adb_reboot_download, "adb_sideload": partial(adb_sideload, target=self.state.image_path), - "adb_twrp_wipe_and_install": partial( - adb_twrp_wipe_and_install, - target=self.state.image_path, - config_path=self.state.config_path, - ), "adb_twrp_copy_partitions": partial( adb_twrp_copy_partitions, config_path=self.state.config_path ), @@ -237,12 +230,7 @@ def call_to_phone(self, e, command: str): for line in cmd_mapping.get(command)(bin_path=self.state.bin_path): # write the line to advanced output terminal self.terminal_box.write_line(line) - # in case the install command is run, we want to update the progress bar - if command == "adb_twrp_wipe_and_install": - self.progress_indicator.display_progress_bar(line) - self.progress_indicator.update() - else: - self.progress_indicator.display_progress_ring() + self.progress_indicator.display_progress_ring() else: msg = f"Unknown command type: {command}. Stopping." logger.error(msg) @@ -263,8 +251,7 @@ def call_to_phone(self, e, command: str): self.confirm_button.disabled = False self.call_button.disabled = True # reset the progress indicator (let the progressbar stay for the install command) - if command != "adb_twrp_wipe_and_install": - self.progress_indicator.clear() + self.progress_indicator.clear() self.view.update() diff --git a/pyproject.toml b/pyproject.toml index 5b6b3841..16ec7675 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "openandroidinstaller" -version = "0.3.2-alpha" +version = "0.3.3-alpha" description = "Install lineage OS in a nice and easy way." authors = ["Tobias Sterbak "] license = "GPLv3" From 03e50a7bdc4537c79d6f427351e5237bf4786017 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Mon, 30 Jan 2023 11:49:09 +0000 Subject: [PATCH 02/18] WIP --- openandroidinstaller/tooling.py | 30 +++++++++++++++------- openandroidinstaller/views/install_view.py | 6 +++-- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index 9bc0f4b3..aba01fea 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -150,7 +150,7 @@ def adb_twrp_copy_partitions(bin_path: Path, config_path: Path): return True -def adb_twrp_wipe_and_install(bin_path: Path, target: str, config_path: Path) -> bool: +def adb_twrp_wipe_and_install(bin_path: Path, target: str, config_path: Path, install_addons=True) -> bool: """Wipe and format data with twrp, then flash os image with adb. Only works for twrp recovery. @@ -214,15 +214,27 @@ def adb_twrp_wipe_and_install(bin_path: Path, target: str, config_path: Path) -> break # finally reboot into os sleep(7) - logger.info("Reboot into OS.") - for line in run_command("adb", ["reboot"], bin_path): # "shell", "twrp", - yield line - if (type(line) == bool) and not line: - logger.error("Rebooting failed.") - yield False - return + if install_addons: + # TODO: Fix the process for samsung devices + # reboot into the bootloader again + logger.info("Rebooting device into bootloader with adb.") + for line in run_command("adb", ["reboot", "bootloader"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error("Reboot into bootloader failed.") + yield False + return + sleep(7) else: - yield True + logger.info("Reboot into OS.") + for line in run_command("adb", ["reboot"], bin_path): # "shell", "twrp", + yield line + if (type(line) == bool) and not line: + logger.error("Rebooting failed.") + yield False + return + else: + yield True def fastboot_unlock_with_code(bin_path: Path, unlock_code: str) -> bool: diff --git a/openandroidinstaller/views/install_view.py b/openandroidinstaller/views/install_view.py index 327fa96c..8e1f88f8 100644 --- a/openandroidinstaller/views/install_view.py +++ b/openandroidinstaller/views/install_view.py @@ -74,10 +74,11 @@ def check_addons_switch(e): """Check the switch to enable the addons installation process.""" if self.install_addons_switch.value: logger.info("Enable flashing addons.") + # TODO: add the addons step here. self.state.install_addons = True - self.state.steps.extend(self.state.config.flash_recovery) else: logger.info("Disable flashing addons.") + # TODO: empty the steps again self.state.install_addons = False self.install_addons_switch = Switch( @@ -159,7 +160,7 @@ def check_addons_switch(e): def run_install(self, e): """ - Run the installation process trought twrp. + Run the installation process trough twrp. Some parts of the command are changed by placeholders. """ @@ -178,6 +179,7 @@ def run_install(self, e): target=self.state.image_path, config_path=self.state.config_path, bin_path=self.state.bin_path, + install_addons=self.state.install_addons, ): # write the line to advanced output terminal self.terminal_box.write_line(line) From 97fd7be949c0ebf53d916717c96eebf8c84e04d3 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Mon, 30 Jan 2023 11:59:40 +0000 Subject: [PATCH 03/18] Enable selecting addons --- openandroidinstaller/openandroidinstaller.py | 6 + openandroidinstaller/views/__init__.py | 1 + openandroidinstaller/views/addon_view.py | 196 +++++++++++++++++++ openandroidinstaller/views/install_view.py | 5 +- 4 files changed, 206 insertions(+), 2 deletions(-) create mode 100644 openandroidinstaller/views/addon_view.py diff --git a/openandroidinstaller/openandroidinstaller.py b/openandroidinstaller/openandroidinstaller.py index f39b59c9..d7b478e0 100644 --- a/openandroidinstaller/openandroidinstaller.py +++ b/openandroidinstaller/openandroidinstaller.py @@ -47,6 +47,7 @@ RequirementsView, InstallView, WelcomeView, + AddonsView, ) from tooling import run_command @@ -111,6 +112,11 @@ def __init__(self, state: AppState): self.state.final_default_views = self.final_default_views self.state.final_view = self.final_view + # initialize the addon view + self.addon_view = AddonsView(on_confirm=self.confirm, state=self.state) + self.state.addon_view = self.addon_view + + def build(self): self.view.controls.append(self.default_views.pop()) return self.view diff --git a/openandroidinstaller/views/__init__.py b/openandroidinstaller/views/__init__.py index c15247fe..9c32bf47 100644 --- a/openandroidinstaller/views/__init__.py +++ b/openandroidinstaller/views/__init__.py @@ -5,4 +5,5 @@ from .select_view import SelectFilesView # noqa from .step_view import StepView # noqa from .install_view import InstallView # noqa +from .addon_view import AddonsView # noqa from .success_view import SuccessView # noqa diff --git a/openandroidinstaller/views/addon_view.py b/openandroidinstaller/views/addon_view.py new file mode 100644 index 00000000..638b2fb8 --- /dev/null +++ b/openandroidinstaller/views/addon_view.py @@ -0,0 +1,196 @@ +"""Contains the select addons view.""" + +# This file is part of OpenAndroidInstaller. +# OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of +# the GNU General Public License as published by the Free Software Foundation, +# either version 3 of the License, or (at your option) any later version. + +# OpenAndroidInstaller is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along with OpenAndroidInstaller. +# If not, see .""" +# Author: Tobias Sterbak + +import webbrowser +from loguru import logger +from typing import Callable + +from flet import ( + Column, + Divider, + ElevatedButton, + OutlinedButton, + FilledButton, + Markdown, + Row, + Text, + colors, + icons, + TextButton, + AlertDialog, + FilePicker, + FilePickerResultEvent, +) +from flet.buttons import CountinuosRectangleBorder + +from views import BaseView +from app_state import AppState +from widgets import get_title, confirm_button + + +class AddonsView(BaseView): + def __init__( + self, + state: AppState, + on_confirm: Callable, + ): + super().__init__(state=state) + self.on_confirm = on_confirm + + def build(self): + # dialog box to explain OS images and recovery + self.dlg_explain_addons = AlertDialog( + modal=True, + title=Text("What is an OS image and recovery and why do I need it?"), + content=Markdown( + """## OS image or ROM +An operating system (OS) is system software that manages computer hardware, +software resources, and provides common services for computer programs. +Popular, custom operating systems for mobile devices based on Android are +- [LineageOS](https://lineageos.org/) +- [/e/OS](https://e.foundation/e-os/) or +- [LineageOS for microG](https://lineage.microg.org/) +- and many others. + +Often, the related OS images are called 'ROM'. 'ROM' stands for *R*ead-*o*nly *m*emory, +which is a type of non-volatile memory used in computers for storing software that is +rarely changed during the life of the system, also known as firmware. + +## Recovery Image +A custom recovery is used for installing custom software on your device. +This custom software can include smaller modifications like rooting your device or even +replacing the firmware of the device with a completely custom ROM. + +OpenAndroidInstaller works with the [TWRP recovery project](https://twrp.me/about/).""", + on_tap_link=lambda e: self.page.launch_url(e.data), + ), + actions=[ + TextButton("Close", on_click=self.close_close_explain_addons_dlg), + ], + actions_alignment="end", + shape=CountinuosRectangleBorder(radius=0), + ) + + # initialize file pickers + self.pick_addons_dialog = FilePicker(on_result=self.pick_addons_result) + self.selected_addons = Text("Selected addons: ") + + # initialize and manage button state. + self.confirm_button = confirm_button(self.on_confirm) + # self.confirm_button.disabled = True + # self.pick_addons_dialog.on_result = self.enable_button_if_ready + + # attach hidden dialogues + self.right_view.controls.append(self.pick_addons_dialog) + + # create help/info button to show the help dialog + info_button = OutlinedButton( + "What is this?", + on_click=self.open_explain_addons_dlg, + expand=True, + icon=icons.HELP_OUTLINE_OUTLINED, + icon_color=colors.DEEP_ORANGE_500, + tooltip="Get more details on custom operating system images and recoveries.", + ) + + # add title + self.right_view_header.controls.append( + get_title( + "You can select additional addons to install. Otherwise you can safely continue", + info_button=info_button, + step_indicator_img="steps-header-select.png", + ) + ) + + # text row to show infos during the process + self.info_field = Row() + # if there is an available download, show the button to the page + self.right_view.controls.append(Divider()) + self.right_view.controls.append( + Column( + [ + Text("Here you can download the right GApps for your device."), + Row( + [ + ElevatedButton( + "Download LineageOS image", + icon=icons.DOWNLOAD_OUTLINED, + on_click=lambda _: webbrowser.open( + "https://wiki.lineageos.org/gapps" + ), + expand=True, + ), + ] + ), + Divider(), + ] + ) + ) + # attach the controls for uploading addons + self.right_view.controls.extend( + [ + Text("Select addons:", style="titleSmall"), + Markdown( + f""" +The image file should look something like `lineage-19.1-20221101-nightly-{self.state.config.metadata.get('devicecode')}-signed.zip`.""" + ), + Row( + [ + FilledButton( + "Pick the addons you want to install", + icon=icons.UPLOAD_FILE, + on_click=lambda _: self.pick_addons_dialog.pick_files( + allow_multiple=True, + file_type="custom", + allowed_extensions=["zip"], + ), + expand=True, + ), + ] + ), + self.selected_addons, + Divider(), + self.info_field, + Row([self.confirm_button]), + ] + ) + return self.view + + def open_explain_addons_dlg(self, e): + """Open the dialog to explain addons.""" + self.page.dialog = self.dlg_explain_addons + self.dlg_explain_addons.open = True + self.page.update() + + def close_close_explain_addons_dlg(self, e): + """Close the dialog to explain addons.""" + self.dlg_explain_addons.open = False + self.page.update() + + def pick_addons_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 + self.selected_addons.value = ( + self.selected_addons.value.split(":")[0] + f": {path}" + ) + if e.files: + self.addon_paths = [file.path for file in e.files] + self.state.addon_paths = self.addon_paths + logger.info(f"Selected addons: {self.addon_paths}") + else: + logger.info("No addons selected.") + # check if the addons works with the device and show the filename in different colors accordingly + # update + self.selected_addons.update() diff --git a/openandroidinstaller/views/install_view.py b/openandroidinstaller/views/install_view.py index 8e1f88f8..cf7d12dc 100644 --- a/openandroidinstaller/views/install_view.py +++ b/openandroidinstaller/views/install_view.py @@ -74,11 +74,12 @@ def check_addons_switch(e): """Check the switch to enable the addons installation process.""" if self.install_addons_switch.value: logger.info("Enable flashing addons.") - # TODO: add the addons step here. + # add the addons step here. + self.state.default_views.append(self.state.addon_view) self.state.install_addons = True else: logger.info("Disable flashing addons.") - # TODO: empty the steps again + self.state.default_views = [] self.state.install_addons = False self.install_addons_switch = Switch( From 2225d8471bb0100e990e7d0d1cf549c70e8fcd41 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Mon, 30 Jan 2023 12:25:46 +0000 Subject: [PATCH 04/18] MVP for installing addons --- openandroidinstaller/openandroidinstaller.py | 25 ++- openandroidinstaller/tooling.py | 43 ++++- openandroidinstaller/views/__init__.py | 1 + .../views/install_addons_view.py | 180 ++++++++++++++++++ openandroidinstaller/views/install_view.py | 2 +- 5 files changed, 246 insertions(+), 5 deletions(-) create mode 100644 openandroidinstaller/views/install_addons_view.py diff --git a/openandroidinstaller/openandroidinstaller.py b/openandroidinstaller/openandroidinstaller.py index d7b478e0..615691e3 100644 --- a/openandroidinstaller/openandroidinstaller.py +++ b/openandroidinstaller/openandroidinstaller.py @@ -48,8 +48,10 @@ InstallView, WelcomeView, AddonsView, + InstallAddonsView, ) from tooling import run_command +from installer_config import Step # where to write the logs logger.add("openandroidinstaller.log") @@ -113,9 +115,26 @@ def __init__(self, state: AppState): self.state.final_view = self.final_view # initialize the addon view - self.addon_view = AddonsView(on_confirm=self.confirm, state=self.state) - self.state.addon_view = self.addon_view - + self.select_addon_view = AddonsView(on_confirm=self.confirm, state=self.state) + self.flash_recovery_view = StepView( + step=Step( + title="Flash custom recovery", + type="call_button", + content="Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once your phone screen looks like the picture on the left, continue.", + command="fastboot_flash_recovery", + img="twrp-start.jpeg", + ), + state=self.state, + on_confirm=self.confirm, + ) + self.install_addons_view = InstallAddonsView( + on_confirm=self.confirm, state=self.state + ) + self.state.addon_views = [ + self.install_addons_view, + self.flash_recovery_view, + self.select_addon_view, + ] def build(self): self.view.controls.append(self.default_views.pop()) diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index aba01fea..54fea04b 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -150,7 +150,9 @@ def adb_twrp_copy_partitions(bin_path: Path, config_path: Path): return True -def adb_twrp_wipe_and_install(bin_path: Path, target: str, config_path: Path, install_addons=True) -> bool: +def adb_twrp_wipe_and_install( + bin_path: Path, target: str, config_path: Path, install_addons=True +) -> bool: """Wipe and format data with twrp, then flash os image with adb. Only works for twrp recovery. @@ -237,6 +239,45 @@ def adb_twrp_wipe_and_install(bin_path: Path, target: str, config_path: Path, in yield True +def adb_twrp_install_addons(bin_path: Path, addons: List[str]) -> bool: + """Flash addons through adb and twrp. + + Only works for twrp recovery. + """ + logger.info("Install addons with twrp.") + sleep(7) + # activate sideload + logger.info("Activate sideload.") + for line in run_command("adb", ["shell", "twrp", "sideload"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error("Activating sideload failed.") + yield False + return + # now flash os image + sleep(5) + logger.info("Sideload and install addons.") + for addon in addons: + for line in run_command("adb", ["sideload", f"{addon}"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error(f"Sideloading {addon} failed.") + # TODO: this might sometimes think it failed, but actually it's fine. So skip for now. + # yield False + # return + # finally reboot into os + sleep(7) + logger.info("Reboot into OS.") + for line in run_command("adb", ["reboot"], bin_path): # "shell", "twrp", + yield line + if (type(line) == bool) and not line: + logger.error("Rebooting failed.") + yield False + return + else: + yield True + + def fastboot_unlock_with_code(bin_path: Path, unlock_code: str) -> bool: """Unlock the device with fastboot and code given.""" logger.info(f"Unlock the device with fastboot and code: {unlock_code}.") diff --git a/openandroidinstaller/views/__init__.py b/openandroidinstaller/views/__init__.py index 9c32bf47..93d8d460 100644 --- a/openandroidinstaller/views/__init__.py +++ b/openandroidinstaller/views/__init__.py @@ -6,4 +6,5 @@ from .step_view import StepView # noqa from .install_view import InstallView # noqa from .addon_view import AddonsView # noqa +from .install_addons_view import InstallAddonsView # noqa from .success_view import SuccessView # noqa diff --git a/openandroidinstaller/views/install_addons_view.py b/openandroidinstaller/views/install_addons_view.py new file mode 100644 index 00000000..d46b8e85 --- /dev/null +++ b/openandroidinstaller/views/install_addons_view.py @@ -0,0 +1,180 @@ +"""Contains the install addons view.""" + +# This file is part of OpenAndroidInstaller. +# OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of +# the GNU General Public License as published by the Free Software Foundation, +# either version 3 of the License, or (at your option) any later version. + +# OpenAndroidInstaller is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along with OpenAndroidInstaller. +# If not, see .""" +# Author: Tobias Sterbak + +from loguru import logger +from time import sleep +from typing import Callable + +from flet import ( + Column, + ElevatedButton, + Row, + Text, + icons, + Switch, + colors, + Markdown, +) + +from views import BaseView +from app_state import AppState +from tooling import adb_twrp_install_addons +from widgets import ( + confirm_button, + get_title, +) +from views.step_view import TerminalBox, ProgressIndicator + + +class InstallAddonsView(BaseView): + def __init__( + self, + state: AppState, + on_confirm: Callable, + ): + super().__init__(state=state) + self.on_confirm = on_confirm + + def build(self): + """Create the content of the view.""" + # error text + self.error_text = Text("", color=colors.RED) + + # switch to enable advanced output - here it means show terminal input/output in tool + def check_advanced_switch(e): + """Check the box to enable advanced output.""" + if self.advanced_switch.value: + logger.info("Enable advanced output.") + self.state.advanced = True + self.terminal_box.toggle_visibility() + else: + logger.info("Disable advanced output.") + self.state.advanced = False + self.terminal_box.toggle_visibility() + + self.advanced_switch = Switch( + label="Advanced output", + on_change=check_advanced_switch, + disabled=False, + ) + + # text box for terminal output + self.terminal_box = TerminalBox(expand=True) + + # container for progress indicators + self.progress_indicator = ProgressIndicator(expand=True) + + # main controls + self.right_view_header.controls = [ + get_title( + "Install Addons", + step_indicator_img="steps-header-install.png", + ) + ] + self.right_view.controls = [ + Markdown( + """In the next steps, you finally flash the selected Addons. + +Confirm to install. + +This might take a while. At the end your phone will boot into the new OS. +""" + ) + ] + # basic view + logger.info("Starting addon installation.") + self.confirm_button = confirm_button(self.on_confirm) + self.confirm_button.disabled = True + # button to run the installation process + self.install_button = ElevatedButton( + "Confirm and install addons", + on_click=self.run_install_addons, + expand=True, + icon=icons.DIRECTIONS_RUN_OUTLINED, + ) + # build the view + self.right_view.controls.extend( + [ + Row([self.error_text]), + Row([self.progress_indicator]), + Column( + [ + self.advanced_switch, + Row([self.install_button, self.confirm_button]), + ] + ), + Row([self.terminal_box]), + ] + ) + + # if skipping is allowed add a button to the view + if self.state.test: + self.right_view.controls.append( + Row( + [ + Text("Do you want to skip?"), + ElevatedButton( + "Skip", + on_click=self.on_confirm, + icon=icons.NEXT_PLAN_OUTLINED, + expand=True, + ), + ] + ) + ) + return self.view + + def run_install_addons(self, e): + """ + Run the addon installation process trough twrp. + + Some parts of the command are changed by placeholders. + """ + # disable the call button while the command is running + self.install_button.disabled = True + self.install_addons_switch.disabled = True + # reset the progress indicators + self.progress_indicator.clear() + # reset terminal output + if self.state.advanced: + self.terminal_box.clear() + self.right_view.update() + + # run the install script + for line in adb_twrp_install_addons( + addons=self.state.addon_paths, + bin_path=self.state.bin_path, + ): + # write the line to advanced output terminal + self.terminal_box.write_line(line) + # in case the install command is run, we want to update progress ring for now + self.progress_indicator.display_progress_ring() + success = line # the last element of the iterable is a boolean encoding success/failure + + # update the view accordingly + if not success: + # enable call button to retry + self.install_button.disabled = False + # also remove the last error text if it happened + self.error_text.value = "Installation failed! Try again or make sure everything is setup correctly." + else: + sleep(5) # wait to make sure everything is fine + logger.success("Installation process was successful. Allow to continue.") + # enable the confirm button and disable the call button + self.confirm_button.disabled = False + self.install_button.disabled = True + # reset the progress indicator + self.progress_indicator.clear() + self.view.update() diff --git a/openandroidinstaller/views/install_view.py b/openandroidinstaller/views/install_view.py index cf7d12dc..ca766d19 100644 --- a/openandroidinstaller/views/install_view.py +++ b/openandroidinstaller/views/install_view.py @@ -75,7 +75,7 @@ def check_addons_switch(e): if self.install_addons_switch.value: logger.info("Enable flashing addons.") # add the addons step here. - self.state.default_views.append(self.state.addon_view) + self.state.default_views.extend(self.state.addon_views) self.state.install_addons = True else: logger.info("Disable flashing addons.") From f54b51d4dc70e9c23c514b49bf3fbed4f73ed7fa Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Tue, 31 Jan 2023 13:07:51 +0000 Subject: [PATCH 05/18] WIP --- openandroidinstaller/tooling.py | 22 +++++++++++++++++-- .../views/install_addons_view.py | 10 ++++----- openandroidinstaller/views/install_view.py | 1 + openandroidinstaller/views/step_view.py | 2 +- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index 54fea04b..e3d2e8c4 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -239,7 +239,7 @@ def adb_twrp_wipe_and_install( yield True -def adb_twrp_install_addons(bin_path: Path, addons: List[str]) -> bool: +def adb_twrp_install_addons(bin_path: Path, config_path: Path, addons: List[str]) -> bool: """Flash addons through adb and twrp. Only works for twrp recovery. @@ -265,10 +265,28 @@ def adb_twrp_install_addons(bin_path: Path, addons: List[str]) -> bool: # TODO: this might sometimes think it failed, but actually it's fine. So skip for now. # yield False # return + # reboot into fastboot + sleep(5) + logger.info("Boot into fastboot") + for line in run_command("adb", ["reboot", "bootloader"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error("Booting to fastboot failed.") + yield False + return + # switch active boot partition + sleep(7) + logger.info("Switch active boot partition") + for line in run_command("fastboot", ["set_active", "other"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error("Switching boot partition failed.") + yield False + return # finally reboot into os sleep(7) logger.info("Reboot into OS.") - for line in run_command("adb", ["reboot"], bin_path): # "shell", "twrp", + for line in run_command("fastboot", ["reboot"], bin_path): yield line if (type(line) == bool) and not line: logger.error("Rebooting failed.") diff --git a/openandroidinstaller/views/install_addons_view.py b/openandroidinstaller/views/install_addons_view.py index d46b8e85..78ba5b86 100644 --- a/openandroidinstaller/views/install_addons_view.py +++ b/openandroidinstaller/views/install_addons_view.py @@ -144,7 +144,7 @@ def run_install_addons(self, e): """ # disable the call button while the command is running self.install_button.disabled = True - self.install_addons_switch.disabled = True + self.error_text.value = "" # reset the progress indicators self.progress_indicator.clear() # reset terminal output @@ -156,11 +156,13 @@ def run_install_addons(self, e): for line in adb_twrp_install_addons( addons=self.state.addon_paths, bin_path=self.state.bin_path, + config_path=self.state.config_path, ): # write the line to advanced output terminal self.terminal_box.write_line(line) - # in case the install command is run, we want to update progress ring for now - self.progress_indicator.display_progress_ring() + # in case the install command is run, we want to update the progress bar + self.progress_indicator.display_progress_bar(line) + self.progress_indicator.update() success = line # the last element of the iterable is a boolean encoding success/failure # update the view accordingly @@ -175,6 +177,4 @@ def run_install_addons(self, e): # enable the confirm button and disable the call button self.confirm_button.disabled = False self.install_button.disabled = True - # reset the progress indicator - self.progress_indicator.clear() self.view.update() diff --git a/openandroidinstaller/views/install_view.py b/openandroidinstaller/views/install_view.py index ca766d19..6a31a0fa 100644 --- a/openandroidinstaller/views/install_view.py +++ b/openandroidinstaller/views/install_view.py @@ -168,6 +168,7 @@ def run_install(self, e): # disable the call button while the command is running self.install_button.disabled = True self.install_addons_switch.disabled = True + self.error_text.value = "" # reset the progress indicators self.progress_indicator.clear() # reset terminal output diff --git a/openandroidinstaller/views/step_view.py b/openandroidinstaller/views/step_view.py index ea54874f..9f888fc3 100644 --- a/openandroidinstaller/views/step_view.py +++ b/openandroidinstaller/views/step_view.py @@ -323,7 +323,7 @@ def display_progress_bar(self, line: str): result = None # get the progress numbers from the output lines if (type(line) == str) and line.strip(): - result = re.search(r"\(\~(\d{1,3})\%\)|(Total xfer: 1\.00x)", line.strip()) + result = re.search(r"\(\~(\d{1,3})\%\)|(Total xfer: 1\.)", line.strip()) if result: if result.group(1): percentage_done = int(result.group(1)) From 0f6f6f0627a7873983856565e21d6ccf521c8dbb Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 1 Feb 2023 14:10:39 +0000 Subject: [PATCH 06/18] Probably first working version of addons --- openandroidinstaller/tooling.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index e3d2e8c4..7f9dcbfa 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -214,7 +214,7 @@ def adb_twrp_wipe_and_install( yield False return break - # finally reboot into os + # finally reboot into os or to fastboot for flashing addons sleep(7) if install_addons: # TODO: Fix the process for samsung devices @@ -226,7 +226,7 @@ def adb_twrp_wipe_and_install( logger.error("Reboot into bootloader failed.") yield False return - sleep(7) + sleep(3) else: logger.info("Reboot into OS.") for line in run_command("adb", ["reboot"], bin_path): # "shell", "twrp", @@ -265,17 +265,18 @@ def adb_twrp_install_addons(bin_path: Path, config_path: Path, addons: List[str] # TODO: this might sometimes think it failed, but actually it's fine. So skip for now. # yield False # return - # reboot into fastboot - sleep(5) - logger.info("Boot into fastboot") + # finally reboot into os + sleep(7) + # reboot into the bootloader again + logger.info("Rebooting device into bootloader with adb.") for line in run_command("adb", ["reboot", "bootloader"], bin_path): yield line if (type(line) == bool) and not line: - logger.error("Booting to fastboot failed.") + logger.error("Reboot into bootloader failed.") yield False return + sleep(3) # switch active boot partition - sleep(7) logger.info("Switch active boot partition") for line in run_command("fastboot", ["set_active", "other"], bin_path): yield line @@ -283,8 +284,8 @@ def adb_twrp_install_addons(bin_path: Path, config_path: Path, addons: List[str] logger.error("Switching boot partition failed.") yield False return - # finally reboot into os - sleep(7) + sleep(1) + # reboot with fastboot logger.info("Reboot into OS.") for line in run_command("fastboot", ["reboot"], bin_path): yield line From c56d42b01a2dae929a94e9740d8626f5d2f5e054 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 1 Feb 2023 19:11:14 +0000 Subject: [PATCH 07/18] It finally works with sargo --- openandroidinstaller/tooling.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index 7f9dcbfa..1cd058be 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -285,6 +285,13 @@ def adb_twrp_install_addons(bin_path: Path, config_path: Path, addons: List[str] yield False return sleep(1) + for line in run_command("fastboot", ["set_active", "other"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error("Switching boot partition failed.") + yield False + return + sleep(1) # reboot with fastboot logger.info("Reboot into OS.") for line in run_command("fastboot", ["reboot"], bin_path): From 780fcc6950a2663746c9ed6abb95c6cf687fc0a7 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Mon, 6 Feb 2023 11:28:07 +0000 Subject: [PATCH 08/18] WIP - now detect a/b devices and pick different install paths; change recovery commands for sony devices --- openandroidinstaller/app_state.py | 1 + .../assets/configs/akari.yaml | 14 +- .../assets/configs/akatsuki.yaml | 14 +- .../assets/configs/kirin.yaml | 14 +- .../assets/configs/mermaid.yaml | 14 +- .../assets/configs/pioneer.yaml | 14 +- openandroidinstaller/assets/configs/yuga.yaml | 10 +- openandroidinstaller/assets/configs/z3.yaml | 10 +- openandroidinstaller/installer_config.py | 2 +- openandroidinstaller/openandroidinstaller.py | 12 - openandroidinstaller/tooling.py | 221 +++++++++++++----- openandroidinstaller/views/addon_view.py | 2 + .../views/install_addons_view.py | 2 +- openandroidinstaller/views/install_view.py | 2 + openandroidinstaller/views/start_view.py | 9 +- openandroidinstaller/views/step_view.py | 8 +- 16 files changed, 197 insertions(+), 152 deletions(-) diff --git a/openandroidinstaller/app_state.py b/openandroidinstaller/app_state.py index bb19afc8..9687c535 100644 --- a/openandroidinstaller/app_state.py +++ b/openandroidinstaller/app_state.py @@ -42,6 +42,7 @@ def __init__( self.config = None self.image_path = None self.recovery_path = None + self.is_ab = None # is this still needed? self.steps = None diff --git a/openandroidinstaller/assets/configs/akari.yaml b/openandroidinstaller/assets/configs/akari.yaml index cc4ff41b..8e971d37 100644 --- a/openandroidinstaller/assets/configs/akari.yaml +++ b/openandroidinstaller/assets/configs/akari.yaml @@ -42,21 +42,13 @@ steps: command: adb_reboot_bootloader - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. - command: fastboot_flash_recovery + command: fastboot_flash_boot - type: call_button command: adb_twrp_copy_partitions 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. We can ensure none of that will happen by copying the contents of the active slot to the inactive slot. Press 'confirm and run' to to this. Once you are in the bootloader again, continue. - type: call_button - command: fastboot_flash_recovery + command: fastboot_flash_boot content: > - Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/akatsuki.yaml b/openandroidinstaller/assets/configs/akatsuki.yaml index ca23c998..ecafe733 100644 --- a/openandroidinstaller/assets/configs/akatsuki.yaml +++ b/openandroidinstaller/assets/configs/akatsuki.yaml @@ -42,21 +42,13 @@ steps: command: adb_reboot_bootloader - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. - command: fastboot_flash_recovery + command: fastboot_flash_boot - type: call_button command: adb_twrp_copy_partitions 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. We can ensure none of that will happen by copying the contents of the active slot to the inactive slot. Press 'confirm and run' to to this. Once you are in the bootloader again, continue. - type: call_button - command: fastboot_flash_recovery + command: fastboot_flash_boot content: > - Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/kirin.yaml b/openandroidinstaller/assets/configs/kirin.yaml index 60f7db1f..6418fbaf 100644 --- a/openandroidinstaller/assets/configs/kirin.yaml +++ b/openandroidinstaller/assets/configs/kirin.yaml @@ -40,21 +40,13 @@ steps: command: adb_reboot_bootloader - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. - command: fastboot_flash_recovery + command: fastboot_flash_boot - type: call_button command: adb_twrp_copy_partitions 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. We can ensure none of that will happen by copying the contents of the active slot to the inactive slot. Press 'confirm and run' to to this. Once you are in the bootloader again, continue. - type: call_button - command: fastboot_flash_recovery + command: fastboot_flash_boot content: > - Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/mermaid.yaml b/openandroidinstaller/assets/configs/mermaid.yaml index 80fd8a04..8a0861ef 100644 --- a/openandroidinstaller/assets/configs/mermaid.yaml +++ b/openandroidinstaller/assets/configs/mermaid.yaml @@ -40,21 +40,13 @@ steps: command: adb_reboot_bootloader - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. - command: fastboot_flash_recovery + command: fastboot_flash_boot - type: call_button command: adb_twrp_copy_partitions 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. We can ensure none of that will happen by copying the contents of the active slot to the inactive slot. Press 'confirm and run' to to this. Once you are in the bootloader again, continue. - type: call_button - command: fastboot_flash_recovery + command: fastboot_flash_boot content: > - Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/pioneer.yaml b/openandroidinstaller/assets/configs/pioneer.yaml index 85303ed6..4d2afc39 100644 --- a/openandroidinstaller/assets/configs/pioneer.yaml +++ b/openandroidinstaller/assets/configs/pioneer.yaml @@ -44,19 +44,11 @@ steps: content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. command: fastboot_flash_recovery - type: call_button - command: adb_twrp_copy_partitions + command: adb_twrp_copy_boot 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. We can ensure none of that will happen by copying the contents of the active slot to the inactive slot. Press 'confirm and run' to to this. Once you are in the bootloader again, continue. - type: call_button - command: fastboot_flash_recovery - content: > - Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. - install_os: - - type: call_button + command: fastboot_flash_boot content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/yuga.yaml b/openandroidinstaller/assets/configs/yuga.yaml index d7b3a30b..16409933 100644 --- a/openandroidinstaller/assets/configs/yuga.yaml +++ b/openandroidinstaller/assets/configs/yuga.yaml @@ -37,12 +37,4 @@ steps: command: adb_reboot_bootloader - type: call_button content: Next, you need to flash a custom recovery image. Press the button to flash the selected image. Then continue. - command: fastboot_flash_recovery - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + command: fastboot_flash_boot \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/z3.yaml b/openandroidinstaller/assets/configs/z3.yaml index 54eb3553..e9f5c797 100644 --- a/openandroidinstaller/assets/configs/z3.yaml +++ b/openandroidinstaller/assets/configs/z3.yaml @@ -39,12 +39,4 @@ steps: command: adb_reboot_bootloader - type: call_button content: Next, you need to flash a custom recovery image. Press the button to flash the selected image. Then continue. - command: fastboot_flash_recovery - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + command: fastboot_flash_boot \ No newline at end of file diff --git a/openandroidinstaller/installer_config.py b/openandroidinstaller/installer_config.py index 574864de..3efacf47 100644 --- a/openandroidinstaller/installer_config.py +++ b/openandroidinstaller/installer_config.py @@ -152,7 +152,7 @@ def validate_config(config: str) -> bool: ), "content": str, schema.Optional("command"): Regex( - r"adb_reboot|adb_reboot_bootloader|adb_reboot_download|adb_sideload|adb_twrp_wipe_and_install|adb_twrp_copy_partitions|fastboot_flash_recovery|fastboot_unlock_with_code|fastboot_get_unlock_data|fastboot_unlock|fastboot_oem_unlock|fastboot_reboot|heimdall_flash_recovery" + r"adb_reboot|adb_reboot_bootloader|adb_reboot_download|adb_sideload|adb_twrp_wipe_and_install|adb_twrp_copy_partitions|fastboot_flash_recovery|fastboot_flash_boot|fastboot_unlock_with_code|fastboot_get_unlock_data|fastboot_unlock|fastboot_oem_unlock|fastboot_reboot|heimdall_flash_recovery" ), schema.Optional("allow_skip"): bool, schema.Optional("img"): str, diff --git a/openandroidinstaller/openandroidinstaller.py b/openandroidinstaller/openandroidinstaller.py index 06976d21..74119bc1 100644 --- a/openandroidinstaller/openandroidinstaller.py +++ b/openandroidinstaller/openandroidinstaller.py @@ -124,23 +124,11 @@ def __init__(self, state: AppState): # initialize the addon view self.select_addon_view = AddonsView(on_confirm=self.to_next_view, state=self.state) - self.flash_recovery_view = StepView( - step=Step( - title="Flash custom recovery", - type="call_button", - content="Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once your phone screen looks like the picture on the left, continue.", - command="fastboot_flash_recovery", - img="twrp-start.jpeg", - ), - state=self.state, - on_confirm=self.to_next_view, - ) self.install_addons_view = InstallAddonsView( on_confirm=self.to_next_view, state=self.state ) self.state.addon_views = [ self.install_addons_view, - self.flash_recovery_view, self.select_addon_view, ] diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index aa96c810..195e80fa 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -155,7 +155,7 @@ def adb_twrp_copy_partitions(bin_path: Path, config_path: Path): def adb_twrp_wipe_and_install( - bin_path: Path, target: str, config_path: Path, install_addons=True + bin_path: Path, target: str, config_path: Path, is_ab: bool, install_addons=True, recovery: str=None, ) -> bool: """Wipe and format data with twrp, then flash os image with adb. @@ -221,19 +221,31 @@ def adb_twrp_wipe_and_install( # finally reboot into os or to fastboot for flashing addons sleep(7) if install_addons: - # TODO: Fix the process for samsung devices - # reboot into the bootloader again - logger.info("Rebooting device into bootloader with adb.") - for line in run_command("adb", ["reboot", "bootloader"], bin_path): - yield line - if (type(line) == bool) and not line: - logger.error("Reboot into bootloader failed.") - yield False - return - sleep(3) + if is_ab: + # reboot into the bootloader again + logger.info("Rebooting device into bootloader with adb.") + for line in run_command("adb", ["reboot", "bootloader"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error("Reboot into bootloader failed.") + yield False + return + sleep(3) + # boot to TWRP again + logger.info("Boot custom recovery with fastboot.") + for line in run_command("fastboot", ["boot", f"{recovery}"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error("Reboot into bootloader failed.") + yield False + return + sleep(7) + else: + # if not an a/b-device just stay in twrp + pass else: logger.info("Reboot into OS.") - for line in run_command("adb", ["reboot"], bin_path): # "shell", "twrp", + for line in run_command("adb", ["reboot"], bin_path): yield line if (type(line) == bool) and not line: logger.error("Rebooting failed.") @@ -243,21 +255,23 @@ def adb_twrp_wipe_and_install( yield True -def adb_twrp_install_addons(bin_path: Path, config_path: Path, addons: List[str]) -> bool: +def adb_twrp_install_addons(bin_path: Path, addons: List[str], is_ab: bool) -> bool: """Flash addons through adb and twrp. Only works for twrp recovery. """ logger.info("Install addons with twrp.") - sleep(7) - # activate sideload - logger.info("Activate sideload.") - for line in run_command("adb", ["shell", "twrp", "sideload"], bin_path): - yield line - if (type(line) == bool) and not line: - logger.error("Activating sideload failed.") - yield False - return + if is_ab: + sleep(7) + # activate sideload + logger.info("Activate sideload.") + for line in run_command("adb", ["shell", "twrp", "sideload"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error("Activating sideload failed.") + yield False + return + # now flash os image sleep(5) logger.info("Sideload and install addons.") @@ -271,41 +285,53 @@ def adb_twrp_install_addons(bin_path: Path, config_path: Path, addons: List[str] # return # finally reboot into os sleep(7) - # reboot into the bootloader again - logger.info("Rebooting device into bootloader with adb.") - for line in run_command("adb", ["reboot", "bootloader"], bin_path): - yield line - if (type(line) == bool) and not line: - logger.error("Reboot into bootloader failed.") - yield False - return - sleep(3) - # switch active boot partition - logger.info("Switch active boot partition") - for line in run_command("fastboot", ["set_active", "other"], bin_path): - yield line - if (type(line) == bool) and not line: - logger.error("Switching boot partition failed.") - yield False - return - sleep(1) - for line in run_command("fastboot", ["set_active", "other"], bin_path): - yield line - if (type(line) == bool) and not line: - logger.error("Switching boot partition failed.") - yield False - return - sleep(1) - # reboot with fastboot - logger.info("Reboot into OS.") - for line in run_command("fastboot", ["reboot"], bin_path): - yield line - if (type(line) == bool) and not line: - logger.error("Rebooting failed.") - yield False - return + if is_ab: + # reboot into the bootloader again + logger.info("Rebooting device into bootloader with adb.") + for line in run_command("adb", ["reboot", "bootloader"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error("Reboot into bootloader failed.") + yield False + return + sleep(3) + # switch active boot partition + logger.info("Switch active boot partition") + for line in run_command("fastboot", ["set_active", "other"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error("Switching boot partition failed.") + yield False + return + sleep(1) + for line in run_command("fastboot", ["set_active", "other"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error("Switching boot partition failed.") + yield False + return + sleep(1) + # reboot with fastboot + logger.info("Reboot into OS.") + for line in run_command("fastboot", ["reboot"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error("Rebooting failed.") + yield False + return + else: + yield True else: - yield True + # reboot with adb + logger.info("Reboot into OS.") + for line in run_command("adb", ["reboot"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error("Rebooting failed.") + yield False + return + else: + yield True def fastboot_unlock_with_code(bin_path: Path, unlock_code: str) -> bool: @@ -368,17 +394,51 @@ def fastboot_reboot(bin_path: Path) -> bool: yield True -def fastboot_flash_recovery(bin_path: Path, recovery: str) -> bool: +def fastboot_flash_recovery(bin_path: Path, recovery: str, is_ab: bool=True) -> bool: """Temporarily, flash custom recovery with fastboot.""" + if is_ab: + logger.info("Boot custom recovery with fastboot.") + for line in run_command("fastboot", ["boot", f"{recovery}"], bin_path): + yield line + else: + logger.info("Flash custom recovery with fastboot.") + for line in run_command("fastboot", ["flash", "recovery", f"{recovery}"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error("Flashing recovery failed.") + yield False + else: + yield True + # reboot + logger.info("Boot into TWRP with fastboot.") + for line in run_command("fastboot", ["reboot", "recovery"], bin_path): + yield line + + if (type(line) == bool) and not line: + logger.error("Booting recovery failed.") + yield False + else: + yield True + +def fastboot_flash_boot(bin_path: Path, recovery: str) -> bool: + """Temporarily, flash custom recovery with fastboot to boot partition.""" logger.info("Flash custom recovery with fastboot.") - for line in run_command("fastboot", ["boot", f"{recovery}"], bin_path): + for line in run_command("fastboot", ["flash", "boot", f"{recovery}"], bin_path): yield line if (type(line) == bool) and not line: logger.error("Flashing recovery failed.") yield False else: yield True - + # reboot + logger.info("Boot into TWRP with fastboot.") + for line in run_command("fastboot", ["reboot"], bin_path): + yield line + if (type(line) == bool) and not line: + logger.error("Booting recovery failed.") + yield False + else: + yield True def heimdall_flash_recovery(bin_path: Path, recovery: str) -> bool: """Temporarily, flash custom recovery with heimdall.""" @@ -398,7 +458,7 @@ def search_device(platform: str, bin_path: Path) -> Optional[str]: """Search for a connected device.""" logger.info(f"Search devices on {platform} with {bin_path}...") try: - # read device properties + # read device code if platform in ("linux", "darwin"): output = check_output( [ @@ -431,4 +491,43 @@ def search_device(platform: str, bin_path: Path) -> Optional[str]: return device_code except CalledProcessError: logger.error("Failed to detect a device.") - return None + return None + +def check_ab_partition(platform: str, bin_path: Path) -> Optional[str]: + """Figure out, if its an a/b-partitioned device.""" + logger.info(f"Run on {platform} with {bin_path}...") + try: + # check if ab device + if platform in ("linux", "darwin"): + output = check_output( + [ + str(bin_path.joinpath(Path("adb"))), + "shell", + "getprop", + "|", + "grep", + "ro.boot.slot_suffix", + ], + stderr=STDOUT, + ).decode() + elif platform in ("windows", "win32"): + output = check_output( + [ + str(bin_path.joinpath(Path("adb.exe"))), + "shell", + "getprop", + "|", + "findstr", + "ro.boot.slot_suffix", + ], + stderr=STDOUT, + shell=True, + ).decode() + else: + raise Exception(f"Unknown platform {platform}.") + logger.info(output) + logger.info("This is an a/b-partitioned device.") + return True + except CalledProcessError: + logger.info("This is not an a/b-partitioned device.") + return False diff --git a/openandroidinstaller/views/addon_view.py b/openandroidinstaller/views/addon_view.py index 638b2fb8..f9952958 100644 --- a/openandroidinstaller/views/addon_view.py +++ b/openandroidinstaller/views/addon_view.py @@ -88,6 +88,8 @@ def build(self): self.selected_addons = Text("Selected addons: ") # initialize and manage button state. + # wrap the call to the next step in a call to boot fastboot + self.confirm_button = confirm_button(self.on_confirm) # self.confirm_button.disabled = True # self.pick_addons_dialog.on_result = self.enable_button_if_ready diff --git a/openandroidinstaller/views/install_addons_view.py b/openandroidinstaller/views/install_addons_view.py index 78ba5b86..7afd92fd 100644 --- a/openandroidinstaller/views/install_addons_view.py +++ b/openandroidinstaller/views/install_addons_view.py @@ -156,7 +156,7 @@ def run_install_addons(self, e): for line in adb_twrp_install_addons( addons=self.state.addon_paths, bin_path=self.state.bin_path, - config_path=self.state.config_path, + is_ab=self.state.is_ab, ): # write the line to advanced output terminal self.terminal_box.write_line(line) diff --git a/openandroidinstaller/views/install_view.py b/openandroidinstaller/views/install_view.py index 6a31a0fa..67bd1c1d 100644 --- a/openandroidinstaller/views/install_view.py +++ b/openandroidinstaller/views/install_view.py @@ -182,6 +182,8 @@ def run_install(self, e): config_path=self.state.config_path, bin_path=self.state.bin_path, install_addons=self.state.install_addons, + is_ab=self.state.is_ab, + recovery=self.state.recovery_path, ): # write the line to advanced output terminal self.terminal_box.write_line(line) diff --git a/openandroidinstaller/views/start_view.py b/openandroidinstaller/views/start_view.py index de461dfc..622e152c 100644 --- a/openandroidinstaller/views/start_view.py +++ b/openandroidinstaller/views/start_view.py @@ -37,7 +37,7 @@ from views import BaseView from app_state import AppState from widgets import get_title -from tooling import search_device +from tooling import search_device, check_ab_partition from installer_config import InstallerConfig @@ -204,7 +204,7 @@ def search_devices(self, e): # search the device if self.state.test: # this only happens for testing - device_code = self.state.test_config + device_code, is_ab = self.state.test_config, True logger.info( f"Running search in development mode and loading config {device_code}.yaml." ) @@ -212,6 +212,9 @@ def search_devices(self, e): device_code = search_device( platform=self.state.platform, bin_path=self.state.bin_path ) + is_ab = check_ab_partition( + platform=self.state.platform, bin_path=self.state.bin_path + ) if device_code: self.device_name.value = device_code self.device_name.color = colors.BLACK @@ -227,6 +230,8 @@ def search_devices(self, e): self.device_name.value = device_code # load config from file self.state.load_config(device_code) + # write ab-info to state + self.state.is_ab = is_ab if self.state.config: device_name = self.state.config.metadata.get( "devicename", "No device name in config." diff --git a/openandroidinstaller/views/step_view.py b/openandroidinstaller/views/step_view.py index 2c8a8060..adbc7bb2 100644 --- a/openandroidinstaller/views/step_view.py +++ b/openandroidinstaller/views/step_view.py @@ -45,6 +45,7 @@ adb_sideload, adb_twrp_copy_partitions, fastboot_flash_recovery, + fastboot_flash_boot, fastboot_oem_unlock, fastboot_reboot, fastboot_unlock, @@ -220,7 +221,10 @@ def call_to_phone(self, e, command: str): "fastboot_oem_unlock": fastboot_oem_unlock, "fastboot_get_unlock_data": fastboot_get_unlock_data, "fastboot_flash_recovery": partial( - fastboot_flash_recovery, recovery=self.state.recovery_path + fastboot_flash_recovery, recovery=self.state.recovery_path, is_ab=self.state.is_ab, + ), + "fastboot_flash_boot": partial( + fastboot_flash_boot, recovery=self.state.recovery_path, ), "fastboot_reboot": fastboot_reboot, "heimdall_flash_recovery": partial( @@ -328,7 +332,7 @@ def display_progress_bar(self, line: str): result = None # get the progress numbers from the output lines if (type(line) == str) and line.strip(): - result = re.search(r"\(\~(\d{1,3})\%\)|(Total xfer: 1\.)", line.strip()) + result = re.search(r"\(\~(\d{1,3})\%\)|(Total xfer:)", line.strip()) if result: if result.group(1): percentage_done = int(result.group(1)) From 386a927209124085da242ee038b3ae6070d1ad2e Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Mon, 6 Feb 2023 11:42:29 +0000 Subject: [PATCH 09/18] Remove install step from all configs --- openandroidinstaller/assets/configs/FP2.yaml | 10 +------ openandroidinstaller/assets/configs/FP3.yaml | 10 +------ openandroidinstaller/assets/configs/FP4.yaml | 10 +------ .../assets/configs/a3y17lte.yaml | 10 +------ openandroidinstaller/assets/configs/a72q.yaml | 10 +------ .../assets/configs/a7xelte.yaml | 10 +------ .../assets/configs/avicii.yaml | 10 +------ .../assets/configs/barbet.yaml | 10 +------ .../assets/configs/beyond1lte.yaml | 10 +------ .../assets/configs/blueline.yaml | 10 +------ .../assets/configs/bonito.yaml | 10 +------ .../assets/configs/cedric.yaml | 10 +------ .../assets/configs/coral.yaml | 10 +------ .../assets/configs/crosshatch.yaml | 10 +------ .../assets/configs/crownlte.yaml | 10 +------ openandroidinstaller/assets/configs/d1.yaml | 10 +------ openandroidinstaller/assets/configs/dre.yaml | 10 +------ .../assets/configs/enchilada.yaml | 10 +------ .../assets/configs/evert.yaml | 10 +------ .../assets/configs/fajita.yaml | 10 +------ .../assets/configs/flame.yaml | 10 +------ .../assets/configs/guacamole.yaml | 10 +------ .../assets/configs/guacamoleb.yaml | 10 +------ .../assets/configs/hero2lte.yaml | 10 +------ .../assets/configs/herolte.yaml | 10 +------ .../assets/configs/hltetmo.yaml | 10 +------ .../assets/configs/hotdog.yaml | 10 +------ .../assets/configs/hotdogb.yaml | 10 +------ .../assets/configs/j7elte.yaml | 10 +------ openandroidinstaller/assets/configs/kiev.yaml | 10 +------ .../assets/configs/nairo.yaml | 10 +------ .../assets/configs/ocean.yaml | 10 +------ .../assets/configs/pioneer.yaml | 4 +-- .../assets/configs/racer.yaml | 10 +------ .../assets/configs/redfin.yaml | 10 +------ .../assets/configs/starlte.yaml | 10 +------ .../assets/configs/sunfish.yaml | 10 +------ .../assets/configs/taimen.yaml | 10 +------ .../assets/configs/walleye.yaml | 10 +------ .../assets/configs/zerofltexx.yaml | 10 +------ .../assets/configs/zeroltexx.yaml | 10 +------ openandroidinstaller/openandroidinstaller.py | 5 ++-- openandroidinstaller/tooling.py | 26 +++++++++++++------ openandroidinstaller/views/step_view.py | 7 +++-- 44 files changed, 68 insertions(+), 374 deletions(-) diff --git a/openandroidinstaller/assets/configs/FP2.yaml b/openandroidinstaller/assets/configs/FP2.yaml index 19f1ded4..8149c8b4 100644 --- a/openandroidinstaller/assets/configs/FP2.yaml +++ b/openandroidinstaller/assets/configs/FP2.yaml @@ -18,12 +18,4 @@ steps: - type: confirm_button content: > Now reboot into recovery to verify the installation. Do not reboot into the existing OS, since it will overwrite the recovery you just installed! - With the device powered off, hold 'Volume Up + Power'. Release when boot logo appears. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + With the device powered off, hold 'Volume Up + Power'. Release when boot logo appears. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/FP3.yaml b/openandroidinstaller/assets/configs/FP3.yaml index 31810217..5fc45c57 100644 --- a/openandroidinstaller/assets/configs/FP3.yaml +++ b/openandroidinstaller/assets/configs/FP3.yaml @@ -43,12 +43,4 @@ steps: - type: confirm_button content: > Now reboot into recovery to verify the installation. Do not reboot into the existing OS, since it will overwrite the recovery you just installed! - With the device powered off, hold 'Volume Up + Power'. Release when boot logo appears. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + With the device powered off, hold 'Volume Up + Power'. Release when boot logo appears. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/FP4.yaml b/openandroidinstaller/assets/configs/FP4.yaml index 59e5e6ff..a5f5c436 100644 --- a/openandroidinstaller/assets/configs/FP4.yaml +++ b/openandroidinstaller/assets/configs/FP4.yaml @@ -43,12 +43,4 @@ steps: - type: confirm_button content: > Now reboot into recovery to verify the installation. Do not reboot into the existing OS, since it will overwrite the recovery you just installed! - With the device powered off, hold 'Volume Up + Power'. Release when boot logo appears. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + With the device powered off, hold 'Volume Up + Power'. Release when boot logo appears. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/a3y17lte.yaml b/openandroidinstaller/assets/configs/a3y17lte.yaml index d21410b1..940746dc 100644 --- a/openandroidinstaller/assets/configs/a3y17lte.yaml +++ b/openandroidinstaller/assets/configs/a3y17lte.yaml @@ -21,12 +21,4 @@ steps: content: > Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for 8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, - hold *Volume Up* + *Home* + *Power*. Confirm when the recovery screen appears. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + hold *Volume Up* + *Home* + *Power*. Confirm when the recovery screen appears. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/a72q.yaml b/openandroidinstaller/assets/configs/a72q.yaml index ef470a10..3d1290a0 100644 --- a/openandroidinstaller/assets/configs/a72q.yaml +++ b/openandroidinstaller/assets/configs/a72q.yaml @@ -19,12 +19,4 @@ steps: content: > Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power* for 8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, - hold *Volume Up* + *Power button*. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + hold *Volume Up* + *Power button*. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/a7xelte.yaml b/openandroidinstaller/assets/configs/a7xelte.yaml index 6b3e383b..4f680c97 100644 --- a/openandroidinstaller/assets/configs/a7xelte.yaml +++ b/openandroidinstaller/assets/configs/a7xelte.yaml @@ -19,12 +19,4 @@ steps: content: > Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for 8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, - hold *Volume Up* + *Home* + *Power button*. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + hold *Volume Up* + *Home* + *Power button*. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/avicii.yaml b/openandroidinstaller/assets/configs/avicii.yaml index 4f849e07..99cc545f 100644 --- a/openandroidinstaller/assets/configs/avicii.yaml +++ b/openandroidinstaller/assets/configs/avicii.yaml @@ -42,12 +42,4 @@ steps: - type: call_button command: fastboot_flash_recovery content: > - Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. - install_os: - - type: call_button - content: > - In this last step, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/barbet.yaml b/openandroidinstaller/assets/configs/barbet.yaml index 94b4dc9e..8471f0de 100644 --- a/openandroidinstaller/assets/configs/barbet.yaml +++ b/openandroidinstaller/assets/configs/barbet.yaml @@ -41,12 +41,4 @@ steps: content: Select 'Restart bootloader' on your smartphone screen. Then confirm to continue. - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. - command: fastboot_flash_recovery - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + command: fastboot_flash_recovery \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/beyond1lte.yaml b/openandroidinstaller/assets/configs/beyond1lte.yaml index 57d9cb45..6deef617 100644 --- a/openandroidinstaller/assets/configs/beyond1lte.yaml +++ b/openandroidinstaller/assets/configs/beyond1lte.yaml @@ -21,12 +21,4 @@ steps: content: > Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Bixby* for 8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, - hold *Volume Up* + *Bixby* + *Power button*. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + hold *Volume Up* + *Bixby* + *Power button*. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/blueline.yaml b/openandroidinstaller/assets/configs/blueline.yaml index e6570860..680d63c5 100644 --- a/openandroidinstaller/assets/configs/blueline.yaml +++ b/openandroidinstaller/assets/configs/blueline.yaml @@ -34,12 +34,4 @@ steps: - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once your phone screen looks like the picture on the left, continue. command: fastboot_flash_recovery - img: twrp-start.jpeg - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + img: twrp-start.jpeg \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/bonito.yaml b/openandroidinstaller/assets/configs/bonito.yaml index 5c42f26b..694ce1cc 100644 --- a/openandroidinstaller/assets/configs/bonito.yaml +++ b/openandroidinstaller/assets/configs/bonito.yaml @@ -34,12 +34,4 @@ steps: - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once your phone screen looks like the picture on the left, continue. command: fastboot_flash_recovery - img: twrp-start.jpeg - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + img: twrp-start.jpeg \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/cedric.yaml b/openandroidinstaller/assets/configs/cedric.yaml index 2f391028..bb260c21 100644 --- a/openandroidinstaller/assets/configs/cedric.yaml +++ b/openandroidinstaller/assets/configs/cedric.yaml @@ -43,12 +43,4 @@ steps: command: adb_reboot_bootloader - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. - command: fastboot_flash_recovery - install_os: - - type: call_button - content: > - In this last step, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + command: fastboot_flash_recovery \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/coral.yaml b/openandroidinstaller/assets/configs/coral.yaml index ccf2dc03..e9647828 100644 --- a/openandroidinstaller/assets/configs/coral.yaml +++ b/openandroidinstaller/assets/configs/coral.yaml @@ -41,12 +41,4 @@ steps: content: Select 'Restart bootloader' on your smartphone screen. Then confirm to continue. - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. - command: fastboot_flash_recovery - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + command: fastboot_flash_recovery \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/crosshatch.yaml b/openandroidinstaller/assets/configs/crosshatch.yaml index 21176ce1..a4a485a2 100644 --- a/openandroidinstaller/assets/configs/crosshatch.yaml +++ b/openandroidinstaller/assets/configs/crosshatch.yaml @@ -34,12 +34,4 @@ steps: - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once your phone screen looks like the picture on the left, continue. command: fastboot_flash_recovery - img: twrp-start.jpeg - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + img: twrp-start.jpeg \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/crownlte.yaml b/openandroidinstaller/assets/configs/crownlte.yaml index 5084849b..38a922c4 100644 --- a/openandroidinstaller/assets/configs/crownlte.yaml +++ b/openandroidinstaller/assets/configs/crownlte.yaml @@ -21,12 +21,4 @@ steps: content: > Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Bixby* for 8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, - hold *Volume Up* + *Bixby* + *Power button*. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + hold *Volume Up* + *Bixby* + *Power button*. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/d1.yaml b/openandroidinstaller/assets/configs/d1.yaml index 60bde268..431d49a0 100644 --- a/openandroidinstaller/assets/configs/d1.yaml +++ b/openandroidinstaller/assets/configs/d1.yaml @@ -21,12 +21,4 @@ steps: content: > Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Bixby* for 8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, - hold *Volume Up* + *Bixby* + *Power button*. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + hold *Volume Up* + *Bixby* + *Power button*. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/dre.yaml b/openandroidinstaller/assets/configs/dre.yaml index dc4858ab..1b8be02a 100644 --- a/openandroidinstaller/assets/configs/dre.yaml +++ b/openandroidinstaller/assets/configs/dre.yaml @@ -42,12 +42,4 @@ steps: - type: call_button command: fastboot_flash_recovery content: > - Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. - install_os: - - type: call_button - content: > - In this last step, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/enchilada.yaml b/openandroidinstaller/assets/configs/enchilada.yaml index a55bcb32..e1da4282 100644 --- a/openandroidinstaller/assets/configs/enchilada.yaml +++ b/openandroidinstaller/assets/configs/enchilada.yaml @@ -42,12 +42,4 @@ steps: - type: call_button command: fastboot_flash_recovery content: > - Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. - install_os: - - type: call_button - content: > - In this last step, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/evert.yaml b/openandroidinstaller/assets/configs/evert.yaml index 88c9bbf7..790c1e0f 100644 --- a/openandroidinstaller/assets/configs/evert.yaml +++ b/openandroidinstaller/assets/configs/evert.yaml @@ -52,12 +52,4 @@ steps: - type: call_button command: fastboot_flash_recovery content: > - Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. - install_os: - - type: call_button - content: > - In this last step, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/fajita.yaml b/openandroidinstaller/assets/configs/fajita.yaml index 1660ed4f..8ce4c1a2 100644 --- a/openandroidinstaller/assets/configs/fajita.yaml +++ b/openandroidinstaller/assets/configs/fajita.yaml @@ -42,12 +42,4 @@ steps: - type: call_button command: fastboot_flash_recovery content: > - Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. - install_os: - - type: call_button - content: > - In this last step, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/flame.yaml b/openandroidinstaller/assets/configs/flame.yaml index 08437fad..2bbd5d31 100644 --- a/openandroidinstaller/assets/configs/flame.yaml +++ b/openandroidinstaller/assets/configs/flame.yaml @@ -41,12 +41,4 @@ steps: content: Select 'Restart bootloader' on your smartphone screen. Then confirm to continue. - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. - command: fastboot_flash_recovery - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + command: fastboot_flash_recovery \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/guacamole.yaml b/openandroidinstaller/assets/configs/guacamole.yaml index a85c5e6e..129d7b98 100644 --- a/openandroidinstaller/assets/configs/guacamole.yaml +++ b/openandroidinstaller/assets/configs/guacamole.yaml @@ -33,12 +33,4 @@ steps: command: adb_reboot_bootloader - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. - command: fastboot_flash_recovery - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + command: fastboot_flash_recovery \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/guacamoleb.yaml b/openandroidinstaller/assets/configs/guacamoleb.yaml index 8c8f35d0..e39c9378 100644 --- a/openandroidinstaller/assets/configs/guacamoleb.yaml +++ b/openandroidinstaller/assets/configs/guacamoleb.yaml @@ -33,12 +33,4 @@ steps: command: adb_reboot_bootloader - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. - command: fastboot_flash_recovery - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + command: fastboot_flash_recovery \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/hero2lte.yaml b/openandroidinstaller/assets/configs/hero2lte.yaml index 5d411923..4ec35346 100644 --- a/openandroidinstaller/assets/configs/hero2lte.yaml +++ b/openandroidinstaller/assets/configs/hero2lte.yaml @@ -19,12 +19,4 @@ steps: content: > Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for 8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, - hold *Volume Up* + *Home* + *Power button*. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + hold *Volume Up* + *Home* + *Power button*. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/herolte.yaml b/openandroidinstaller/assets/configs/herolte.yaml index a14f2028..4dcf7f8b 100644 --- a/openandroidinstaller/assets/configs/herolte.yaml +++ b/openandroidinstaller/assets/configs/herolte.yaml @@ -19,12 +19,4 @@ steps: content: > Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for 8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, - hold *Volume Up* + *Home* + *Power button*. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + hold *Volume Up* + *Home* + *Power button*. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/hltetmo.yaml b/openandroidinstaller/assets/configs/hltetmo.yaml index fc492ae9..dc5c6eb1 100644 --- a/openandroidinstaller/assets/configs/hltetmo.yaml +++ b/openandroidinstaller/assets/configs/hltetmo.yaml @@ -21,12 +21,4 @@ steps: content: > Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for 8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, - hold *Volume Up* + *Home* + *Power*. Confirm when the recovery screen appears. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + hold *Volume Up* + *Home* + *Power*. Confirm when the recovery screen appears. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/hotdog.yaml b/openandroidinstaller/assets/configs/hotdog.yaml index 763b8bc0..15cc7015 100644 --- a/openandroidinstaller/assets/configs/hotdog.yaml +++ b/openandroidinstaller/assets/configs/hotdog.yaml @@ -33,12 +33,4 @@ steps: command: adb_reboot_bootloader - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. - command: fastboot_flash_recovery - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + command: fastboot_flash_recovery \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/hotdogb.yaml b/openandroidinstaller/assets/configs/hotdogb.yaml index 879e81e1..da1c487a 100644 --- a/openandroidinstaller/assets/configs/hotdogb.yaml +++ b/openandroidinstaller/assets/configs/hotdogb.yaml @@ -33,12 +33,4 @@ steps: command: adb_reboot_bootloader - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. - command: fastboot_flash_recovery - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + command: fastboot_flash_recovery \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/j7elte.yaml b/openandroidinstaller/assets/configs/j7elte.yaml index 8d540b0c..99390c17 100644 --- a/openandroidinstaller/assets/configs/j7elte.yaml +++ b/openandroidinstaller/assets/configs/j7elte.yaml @@ -19,12 +19,4 @@ steps: content: > Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for 8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, - hold *Volume Up* + *Home* + *Power button*. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + hold *Volume Up* + *Home* + *Power button*. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/kiev.yaml b/openandroidinstaller/assets/configs/kiev.yaml index bf306f68..607a16a4 100644 --- a/openandroidinstaller/assets/configs/kiev.yaml +++ b/openandroidinstaller/assets/configs/kiev.yaml @@ -52,12 +52,4 @@ steps: - type: call_button command: fastboot_flash_recovery content: > - Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. - install_os: - - type: call_button - content: > - In this last step, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/nairo.yaml b/openandroidinstaller/assets/configs/nairo.yaml index 8fc46111..968aafef 100644 --- a/openandroidinstaller/assets/configs/nairo.yaml +++ b/openandroidinstaller/assets/configs/nairo.yaml @@ -52,12 +52,4 @@ steps: - type: call_button command: fastboot_flash_recovery content: > - Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. - install_os: - - type: call_button - content: > - In this last step, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/ocean.yaml b/openandroidinstaller/assets/configs/ocean.yaml index ee5df871..0d9dceee 100644 --- a/openandroidinstaller/assets/configs/ocean.yaml +++ b/openandroidinstaller/assets/configs/ocean.yaml @@ -52,12 +52,4 @@ steps: - type: call_button command: fastboot_flash_recovery content: > - Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. - install_os: - - type: call_button - content: > - In this last step, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/pioneer.yaml b/openandroidinstaller/assets/configs/pioneer.yaml index 4d2afc39..a5ea1fbc 100644 --- a/openandroidinstaller/assets/configs/pioneer.yaml +++ b/openandroidinstaller/assets/configs/pioneer.yaml @@ -42,9 +42,9 @@ steps: command: adb_reboot_bootloader - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. - command: fastboot_flash_recovery + command: fastboot_flash_boot - type: call_button - command: adb_twrp_copy_boot + command: adb_twrp_copy_partitions 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. We can ensure none of that will happen by copying the contents of the active slot to the inactive slot. Press 'confirm and run' to to this. Once you are in the bootloader again, continue. diff --git a/openandroidinstaller/assets/configs/racer.yaml b/openandroidinstaller/assets/configs/racer.yaml index 81f98251..50d888d8 100644 --- a/openandroidinstaller/assets/configs/racer.yaml +++ b/openandroidinstaller/assets/configs/racer.yaml @@ -52,12 +52,4 @@ steps: - type: call_button command: fastboot_flash_recovery content: > - Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. - install_os: - - type: call_button - content: > - In this last step, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/redfin.yaml b/openandroidinstaller/assets/configs/redfin.yaml index bbf6807a..df12f3b4 100644 --- a/openandroidinstaller/assets/configs/redfin.yaml +++ b/openandroidinstaller/assets/configs/redfin.yaml @@ -41,12 +41,4 @@ steps: content: Select 'Restart bootloader' on your smartphone screen. Then confirm to continue. - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. - command: fastboot_flash_recovery - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + command: fastboot_flash_recovery \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/starlte.yaml b/openandroidinstaller/assets/configs/starlte.yaml index e3e8b77f..3b09a481 100644 --- a/openandroidinstaller/assets/configs/starlte.yaml +++ b/openandroidinstaller/assets/configs/starlte.yaml @@ -20,12 +20,4 @@ steps: content: > Unplug the USB cable from your device. Then manually reboot into recovery by pressing the Volume Down + Power buttons for 8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, - hold Volume Up + Bixby + Power. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + hold Volume Up + Bixby + Power. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/sunfish.yaml b/openandroidinstaller/assets/configs/sunfish.yaml index 75d7b326..b91a734d 100644 --- a/openandroidinstaller/assets/configs/sunfish.yaml +++ b/openandroidinstaller/assets/configs/sunfish.yaml @@ -41,12 +41,4 @@ steps: content: Select 'Restart bootloader' on your smartphone screen. Then confirm to continue. - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. - command: fastboot_flash_recovery - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + command: fastboot_flash_recovery \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/taimen.yaml b/openandroidinstaller/assets/configs/taimen.yaml index 7c03eca2..64382154 100644 --- a/openandroidinstaller/assets/configs/taimen.yaml +++ b/openandroidinstaller/assets/configs/taimen.yaml @@ -34,12 +34,4 @@ steps: - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once your phone screen looks like the picture on the left, continue. command: fastboot_flash_recovery - img: twrp-start.jpeg - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + img: twrp-start.jpeg \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/walleye.yaml b/openandroidinstaller/assets/configs/walleye.yaml index f32be2a1..7b95c9ba 100644 --- a/openandroidinstaller/assets/configs/walleye.yaml +++ b/openandroidinstaller/assets/configs/walleye.yaml @@ -34,12 +34,4 @@ steps: - type: call_button content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once your phone screen looks like the picture on the left, continue. command: fastboot_flash_recovery - img: twrp-start.jpeg - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Wait until the TWRP screen appears. Then run the command. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + img: twrp-start.jpeg \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/zerofltexx.yaml b/openandroidinstaller/assets/configs/zerofltexx.yaml index 736839d7..ad084e4f 100644 --- a/openandroidinstaller/assets/configs/zerofltexx.yaml +++ b/openandroidinstaller/assets/configs/zerofltexx.yaml @@ -19,12 +19,4 @@ steps: content: > Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for 8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, - hold *Volume Up* + *Home* + *Power button*. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + hold *Volume Up* + *Home* + *Power button*. \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/zeroltexx.yaml b/openandroidinstaller/assets/configs/zeroltexx.yaml index d16d27d4..0830241c 100644 --- a/openandroidinstaller/assets/configs/zeroltexx.yaml +++ b/openandroidinstaller/assets/configs/zeroltexx.yaml @@ -19,12 +19,4 @@ steps: content: > Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for 8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, - hold *Volume Up* + *Home* + *Power button*. - install_os: - - type: call_button - content: > - In the next steps, you finally flash the selected OS image. - Connect your device with your computer with the USB-Cable. - This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored - in the internal storage. Then the OS image will be installed. Confirm to run. This might take a while. At the end your phone will boot into the new OS. - command: adb_twrp_wipe_and_install \ No newline at end of file + hold *Volume Up* + *Home* + *Power button*. \ No newline at end of file diff --git a/openandroidinstaller/openandroidinstaller.py b/openandroidinstaller/openandroidinstaller.py index 74119bc1..cff1b28e 100644 --- a/openandroidinstaller/openandroidinstaller.py +++ b/openandroidinstaller/openandroidinstaller.py @@ -51,7 +51,6 @@ InstallAddonsView, ) from tooling import run_command -from installer_config import Step # where to write the logs logger.add("openandroidinstaller.log") @@ -123,7 +122,9 @@ def __init__(self, state: AppState): self.previous_views = [] # initialize the addon view - self.select_addon_view = AddonsView(on_confirm=self.to_next_view, state=self.state) + self.select_addon_view = AddonsView( + on_confirm=self.to_next_view, state=self.state + ) self.install_addons_view = InstallAddonsView( on_confirm=self.to_next_view, state=self.state ) diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index 195e80fa..2e118ead 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -155,7 +155,12 @@ def adb_twrp_copy_partitions(bin_path: Path, config_path: Path): def adb_twrp_wipe_and_install( - bin_path: Path, target: str, config_path: Path, is_ab: bool, install_addons=True, recovery: str=None, + bin_path: Path, + target: str, + config_path: Path, + is_ab: bool, + install_addons=True, + recovery: str = None, ) -> bool: """Wipe and format data with twrp, then flash os image with adb. @@ -322,7 +327,7 @@ def adb_twrp_install_addons(bin_path: Path, addons: List[str], is_ab: bool) -> b else: yield True else: - # reboot with adb + # reboot with adb logger.info("Reboot into OS.") for line in run_command("adb", ["reboot"], bin_path): yield line @@ -394,7 +399,7 @@ def fastboot_reboot(bin_path: Path) -> bool: yield True -def fastboot_flash_recovery(bin_path: Path, recovery: str, is_ab: bool=True) -> bool: +def fastboot_flash_recovery(bin_path: Path, recovery: str, is_ab: bool = True) -> bool: """Temporarily, flash custom recovery with fastboot.""" if is_ab: logger.info("Boot custom recovery with fastboot.") @@ -402,7 +407,9 @@ def fastboot_flash_recovery(bin_path: Path, recovery: str, is_ab: bool=True) -> yield line else: logger.info("Flash custom recovery with fastboot.") - for line in run_command("fastboot", ["flash", "recovery", f"{recovery}"], bin_path): + for line in run_command( + "fastboot", ["flash", "recovery", f"{recovery}"], bin_path + ): yield line if (type(line) == bool) and not line: logger.error("Flashing recovery failed.") @@ -420,6 +427,7 @@ def fastboot_flash_recovery(bin_path: Path, recovery: str, is_ab: bool=True) -> else: yield True + def fastboot_flash_boot(bin_path: Path, recovery: str) -> bool: """Temporarily, flash custom recovery with fastboot to boot partition.""" logger.info("Flash custom recovery with fastboot.") @@ -440,6 +448,7 @@ def fastboot_flash_boot(bin_path: Path, recovery: str) -> bool: else: yield True + def heimdall_flash_recovery(bin_path: Path, recovery: str) -> bool: """Temporarily, flash custom recovery with heimdall.""" logger.info("Flash custom recovery with heimdall.") @@ -458,7 +467,7 @@ def search_device(platform: str, bin_path: Path) -> Optional[str]: """Search for a connected device.""" logger.info(f"Search devices on {platform} with {bin_path}...") try: - # read device code + # read device code if platform in ("linux", "darwin"): output = check_output( [ @@ -491,7 +500,8 @@ def search_device(platform: str, bin_path: Path) -> Optional[str]: return device_code except CalledProcessError: logger.error("Failed to detect a device.") - return None + return None + def check_ab_partition(platform: str, bin_path: Path) -> Optional[str]: """Figure out, if its an a/b-partitioned device.""" @@ -527,7 +537,7 @@ def check_ab_partition(platform: str, bin_path: Path) -> Optional[str]: raise Exception(f"Unknown platform {platform}.") logger.info(output) logger.info("This is an a/b-partitioned device.") - return True + return True except CalledProcessError: logger.info("This is not an a/b-partitioned device.") - return False + return False diff --git a/openandroidinstaller/views/step_view.py b/openandroidinstaller/views/step_view.py index adbc7bb2..53e08672 100644 --- a/openandroidinstaller/views/step_view.py +++ b/openandroidinstaller/views/step_view.py @@ -221,10 +221,13 @@ def call_to_phone(self, e, command: str): "fastboot_oem_unlock": fastboot_oem_unlock, "fastboot_get_unlock_data": fastboot_get_unlock_data, "fastboot_flash_recovery": partial( - fastboot_flash_recovery, recovery=self.state.recovery_path, is_ab=self.state.is_ab, + fastboot_flash_recovery, + recovery=self.state.recovery_path, + is_ab=self.state.is_ab, ), "fastboot_flash_boot": partial( - fastboot_flash_boot, recovery=self.state.recovery_path, + fastboot_flash_boot, + recovery=self.state.recovery_path, ), "fastboot_reboot": fastboot_reboot, "heimdall_flash_recovery": partial( From 69b35c0ab819a1bf4655d2ceb11f2c0ee3639f67 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Mon, 6 Feb 2023 12:04:25 +0000 Subject: [PATCH 10/18] Fix some issues with flashing addons --- .../assets/configs/heroltexx.yaml | 22 +++++++++++++++++++ openandroidinstaller/tooling.py | 14 +++++------- 2 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 openandroidinstaller/assets/configs/heroltexx.yaml diff --git a/openandroidinstaller/assets/configs/heroltexx.yaml b/openandroidinstaller/assets/configs/heroltexx.yaml new file mode 100644 index 00000000..4dcf7f8b --- /dev/null +++ b/openandroidinstaller/assets/configs/heroltexx.yaml @@ -0,0 +1,22 @@ +metadata: + maintainer: Tobias Sterbak (tsterbak) + devicename: Samsung Galaxy S7 + devicecode: herolte +steps: + unlock_bootloader: + flash_recovery: + - type: call_button + content: > + As a first step, you need to boot into the bootloader. A bootloader is the piece of software, + that tells your phone who to start and run an operating system (like Android). Your device should be turned on. + Then press 'Confirm and run' to reboot into the bootloader. Continue once it's done. + command: adb_reboot_download + - type: call_button + content: In this step, you need to flash a custom recovery on your device. Press 'Confirm and run' to start the process. Confirm afterwards to continue. + command: heimdall_flash_recovery + - type: confirm_button + img: samsung-buttons.png + content: > + Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for 8~10 seconds + until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, + hold *Volume Up* + *Home* + *Power button*. \ No newline at end of file diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index 2e118ead..bca22a96 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -266,8 +266,9 @@ def adb_twrp_install_addons(bin_path: Path, addons: List[str], is_ab: bool) -> b Only works for twrp recovery. """ logger.info("Install addons with twrp.") - if is_ab: - sleep(7) + sleep(5) + logger.info("Sideload and install addons.") + for addon in addons: # activate sideload logger.info("Activate sideload.") for line in run_command("adb", ["shell", "twrp", "sideload"], bin_path): @@ -276,11 +277,8 @@ def adb_twrp_install_addons(bin_path: Path, addons: List[str], is_ab: bool) -> b logger.error("Activating sideload failed.") yield False return - - # now flash os image - sleep(5) - logger.info("Sideload and install addons.") - for addon in addons: + sleep(2) + # now flash os image for line in run_command("adb", ["sideload", f"{addon}"], bin_path): yield line if (type(line) == bool) and not line: @@ -288,8 +286,8 @@ def adb_twrp_install_addons(bin_path: Path, addons: List[str], is_ab: bool) -> b # TODO: this might sometimes think it failed, but actually it's fine. So skip for now. # yield False # return + sleep(7) # finally reboot into os - sleep(7) if is_ab: # reboot into the bootloader again logger.info("Rebooting device into bootloader with adb.") From 721d15df729acafa928ff7d0cbb20da4710b69b9 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Mon, 6 Feb 2023 12:26:16 +0000 Subject: [PATCH 11/18] Fix for sideloading addons --- openandroidinstaller/tooling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index bca22a96..a52f5284 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -277,7 +277,7 @@ def adb_twrp_install_addons(bin_path: Path, addons: List[str], is_ab: bool) -> b logger.error("Activating sideload failed.") yield False return - sleep(2) + sleep(5) # now flash os image for line in run_command("adb", ["sideload", f"{addon}"], bin_path): yield line From 3734cd0e13edcc5560a16c348a3c36fa4ef98286 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Mon, 6 Feb 2023 16:07:37 +0000 Subject: [PATCH 12/18] Update texts for isntalling addons --- openandroidinstaller/views/addon_view.py | 52 ++++++++----------- .../views/install_addons_view.py | 2 +- openandroidinstaller/views/install_view.py | 6 ++- 3 files changed, 27 insertions(+), 33 deletions(-) diff --git a/openandroidinstaller/views/addon_view.py b/openandroidinstaller/views/addon_view.py index f9952958..2752fbd8 100644 --- a/openandroidinstaller/views/addon_view.py +++ b/openandroidinstaller/views/addon_view.py @@ -53,27 +53,19 @@ def build(self): # dialog box to explain OS images and recovery self.dlg_explain_addons = AlertDialog( modal=True, - title=Text("What is an OS image and recovery and why do I need it?"), + title=Text("What kind of addons are supported?"), content=Markdown( - """## OS image or ROM -An operating system (OS) is system software that manages computer hardware, -software resources, and provides common services for computer programs. -Popular, custom operating systems for mobile devices based on Android are -- [LineageOS](https://lineageos.org/) -- [/e/OS](https://e.foundation/e-os/) or -- [LineageOS for microG](https://lineage.microg.org/) -- and many others. - -Often, the related OS images are called 'ROM'. 'ROM' stands for *R*ead-*o*nly *m*emory, -which is a type of non-volatile memory used in computers for storing software that is -rarely changed during the life of the system, also known as firmware. - -## Recovery Image -A custom recovery is used for installing custom software on your device. -This custom software can include smaller modifications like rooting your device or even -replacing the firmware of the device with a completely custom ROM. - -OpenAndroidInstaller works with the [TWRP recovery project](https://twrp.me/about/).""", + """## Google Apps: +There are different packages of Google Apps available. Most notable +- [MindTheGapps](https://wiki.lineageos.org/gapps#downloads) and +- [NikGApps](https://nikgapps.com/). + +These packages are only dependent on your OS version and processor architecture, which can be found on each device specific info page. +Filenames on MindTheGApps are of the format `MindTheGapps---_