From 1113cb8248d8156b545bc06364a5e1611568424e Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 26 Jul 2023 11:31:51 +0200 Subject: [PATCH 1/2] Update the unlocking instructions for FP3/4 and add fastboot_unlock_critical command --- openandroidinstaller/assets/configs/FP3.yaml | 16 ++++++++++++---- openandroidinstaller/assets/configs/FP4.yaml | 18 +++++++++++++----- openandroidinstaller/tooling.py | 5 +++++ 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/openandroidinstaller/assets/configs/FP3.yaml b/openandroidinstaller/assets/configs/FP3.yaml index 32b0e23c..1b25061c 100644 --- a/openandroidinstaller/assets/configs/FP3.yaml +++ b/openandroidinstaller/assets/configs/FP3.yaml @@ -18,10 +18,6 @@ steps: content: > Press 'Confirm and run' to reboot into the bootloader. command: adb_reboot_bootloader - - type: confirm_button - content: > - Select 'Restart bootloader' on your smartphone screen by pressing the volume button and the confirm by pushing the power button. - Then press 'Confirm and continue' here. - type: call_button content: > In this step you actually unlock the bootloader. Just press 'Confirm and run' here. Once it's done, press continue here. @@ -29,6 +25,18 @@ steps: - type: confirm_button content: > Follow the instructions on the Fairphone screen. This command will wipe all the personal data on your phone. + - type: call_button + content: > + After the phone reboots, boot into the fastboot mode once again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + When you are in fastboot mode again, you need to run another unlock step here. + Just press 'Confirm and run' here. Once it's done, press continue here. + command: fastboot_unlock_critical + - type: confirm_button + content: > + Follow the instructions on the Fairphone screen. This command will wipe all the personal data on your phone. - type: call_button content: > To finish the unlocking, the phone needs to reboot. Just press 'Confirm and run' here to reboot. Then continue. diff --git a/openandroidinstaller/assets/configs/FP4.yaml b/openandroidinstaller/assets/configs/FP4.yaml index af164fe8..d23501a3 100644 --- a/openandroidinstaller/assets/configs/FP4.yaml +++ b/openandroidinstaller/assets/configs/FP4.yaml @@ -13,15 +13,11 @@ steps: how to start and run an operating system (like Android). Your device should be turned on. Click on the button to open the instructions on the Fairphone Support official unlocking website to generate an unlock code for your device. Once you've done that, continue. - link: https://support.fairphone.com/hc/en-us/articles/4405858258961-FP4-Manage-the-bootloader + link: https://www.fairphone.com/en/bootloader-unlocking-code-for-fairphone-3/ - type: call_button content: > Press 'Confirm and run' to reboot into the bootloader. command: adb_reboot_bootloader - - type: confirm_button - content: > - Select 'Restart bootloader' on your smartphone screen by pressing the volume button and the confirm by pushing the power button. - Then press 'Confirm and continue' here. - type: call_button content: > In this step you actually unlock the bootloader. Just press 'Confirm and run' here. Once it's done, press continue here. @@ -29,6 +25,18 @@ steps: - type: confirm_button content: > Follow the instructions on the Fairphone screen. This command will wipe all the personal data on your phone. + - type: call_button + content: > + After the phone reboots, boot into the fastboot mode once again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + When you are in fastboot mode again, you need to run another unlock step here. + Just press 'Confirm and run' here. Once it's done, press continue here. + command: fastboot_unlock_critical + - type: confirm_button + content: > + Follow the instructions on the Fairphone screen. This command will wipe all the personal data on your phone. - type: call_button content: > To finish the unlocking, the phone needs to reboot. Just press 'Confirm and run' here to reboot. Then continue. diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index f7943ebe..c0640f83 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -368,6 +368,11 @@ def fastboot_unlock(bin_path: Path) -> TerminalResponse: for line in run_command("fastboot flashing unlock", bin_path): yield line +@add_logging("Critically unlocking the device with fastboot without code.") +def fastboot_unlock_critical(bin_path: Path) -> TerminalResponse: + """Unlock critical the device with fastboot and without code.""" + for line in run_command("fastboot flashing unlock_critical", bin_path): + yield line @add_logging("OEM unlocking the device with fastboot.") def fastboot_oem_unlock(bin_path: Path) -> TerminalResponse: From 6b895c49e3cfd0ae4e72ceff01e84b2a48ff60b8 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 26 Jul 2023 11:55:47 +0200 Subject: [PATCH 2/2] Update tests and fix formating --- openandroidinstaller/openandroidinstaller.py | 8 ++++---- openandroidinstaller/tooling.py | 2 ++ tests/test_app.py | 14 ++++++++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/openandroidinstaller/openandroidinstaller.py b/openandroidinstaller/openandroidinstaller.py index db668a96..8c5e83b4 100644 --- a/openandroidinstaller/openandroidinstaller.py +++ b/openandroidinstaller/openandroidinstaller.py @@ -230,13 +230,13 @@ def main(page: Page, test: bool = False, test_config: str = "sargo"): # header page.appbar = AppBar( - leading=Image( - src="/logo-192x192.png", height=40, width=40, border_radius=40 - ), + leading=Image(src="/logo-192x192.png", height=40, width=40, border_radius=40), leading_width=56, toolbar_height=72, elevation=0, - title=Text(f"OpenAndroidInstaller version {VERSION}"), #, style="displaySmall"), + title=Text( + f"OpenAndroidInstaller version {VERSION}" + ), # , style="displaySmall"), center_title=False, bgcolor="#00d886", actions=[ diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index c0640f83..d3a551be 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -368,12 +368,14 @@ def fastboot_unlock(bin_path: Path) -> TerminalResponse: for line in run_command("fastboot flashing unlock", bin_path): yield line + @add_logging("Critically unlocking the device with fastboot without code.") def fastboot_unlock_critical(bin_path: Path) -> TerminalResponse: """Unlock critical the device with fastboot and without code.""" for line in run_command("fastboot flashing unlock_critical", bin_path): yield line + @add_logging("OEM unlocking the device with fastboot.") def fastboot_oem_unlock(bin_path: Path) -> TerminalResponse: """OEM unlock the device with fastboot and without code.""" diff --git a/tests/test_app.py b/tests/test_app.py index cb11a16e..52d60979 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -46,7 +46,12 @@ def test_app_sargo(): number_of_steps = 14 for _ in range(number_of_steps): page.controls[0].to_next_view(None) - assert "SuccessView" in str(page.controls[0].view.controls[0]) + assert "Installation completed successfully!" in str( + page.controls[0] + .view.controls[0] + .right_view_header.controls[0] + .content.controls[0] + ) def test_app_beyond2lte(): @@ -61,4 +66,9 @@ def test_app_beyond2lte(): number_of_steps = 14 for _ in range(number_of_steps): page.controls[0].to_next_view(None) - assert "SuccessView" in str(page.controls[0].view.controls[0]) + assert "Installation completed successfully!" in str( + page.controls[0] + .view.controls[0] + .right_view_header.controls[0] + .content.controls[0] + )