Skip to content

Commit

Permalink
New fairphone unlocking instructions (#187)
Browse files Browse the repository at this point in the history
- Update the unlocking instructions for FP3/4 and add
fastboot_unlock_critical command.
- Update tests and fix formatting.
  • Loading branch information
tsterbak committed Jul 26, 2023
2 parents 35d0d2d + 6b895c4 commit 710223b
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 15 deletions.
16 changes: 12 additions & 4 deletions openandroidinstaller/assets/configs/FP3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,25 @@ 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.
command: fastboot_unlock
- 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.
Expand Down
18 changes: 13 additions & 5 deletions openandroidinstaller/assets/configs/FP4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,30 @@ 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.
command: fastboot_unlock
- 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.
Expand Down
8 changes: 4 additions & 4 deletions openandroidinstaller/openandroidinstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=[
Expand Down
7 changes: 7 additions & 0 deletions openandroidinstaller/tooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,13 @@ def fastboot_unlock(bin_path: Path) -> TerminalResponse:
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."""
Expand Down
14 changes: 12 additions & 2 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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]
)

0 comments on commit 710223b

Please sign in to comment.