Skip to content

Commit

Permalink
Release Alpha v.0.3.0 (#37)
Browse files Browse the repository at this point in the history
This PR adds:

Fixes:
- Fairphone3 now uses flashing unlock to unlock the bootloader
- fix bootloader unlock issue with fastboot

Features:
- Disable callbutton while command is running; clean error text at retry
- another steptype for requirements and get them from config.
- restructure welcome page to make it better
- a bit more default pictures for steps 
- let advanced view toggle in every step independently
- Enable copy_partitions sideloading

Chores:
- Major refactoring of views
- test search device function in tooling
- refactor call_to_phone method
- refactored terminal box
- test for TerminalBox

11 New devices:
- Motorola moto g7 power (ocean)
- Motorola moto g5 (cedric)
- Samsung Galaxy Note 9 (crownlte)
- Samsung Galaxy Note 10 (d1)
- oneplus 6
- oneplus 6T
- oneplus 7
- oneplus 7 Pro
- oneplus 7T
- oneplus 7T Pro
- OnePlus Nord N200
  • Loading branch information
tsterbak authored Nov 30, 2022
2 parents 1202bb1 + 7d6e722 commit 3790585
Show file tree
Hide file tree
Showing 48 changed files with 2,081 additions and 757 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ install:
export:
poetry export -f requirements.txt --output requirements.txt

lint:
poetry run ruff openandroidinstaller/ --ignore E501

test:
poetry run pytest tests/
poetry run black .
poetry run ruff openandroidinstaller/ --ignore E501
PYTHONPATH=openandroidinstaller:$(PYTHONPATH) poetry run pytest --cov=openandroidinstaller tests/

app:
poetry run python openandroidinstaller/openandroidinstaller.py
Expand Down
47 changes: 28 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,32 @@ Vendor | Device Name | CodeName | Models | Status
---|---|---|---|---
Samsung | Galaxy J7 2015 | j7elte | | tested
Samsung | Galaxy A3 2017 | a3y17lte | SM-A320FL | tested
Samsung | Galaxy A5 2016 | a5xelte | SM-A510F | tested
Samsung | Galaxy A5 2016 | [a5xelte](https://wiki.lineageos.org/devices/a5xelte/) | SM-A510F | tested
Samsung | Galaxy A7 2016 | a7xelte | | tested
Samsung | Galaxy S7 | herolte | SM-G930F | tested
Samsung | Galaxy S9 | starlte | | tested
Samsung | Galaxy S10 | beyond1lte | | tested
Google | Pixel 3a | sargo | sargo | tested
Google | Pixel 4 | flame | flame | tested
Google | Pixel 4a | sunfish | sunfish | tested
Google | Pixel 5 | redfin | redfin | tested
Google | Pixel 5a | barbet | barbet | tested
Sony | Xperia Z | yuga | C6603 | tested
Sony | Xperia Z3 | z3 | | tested
Samsung | Galaxy S7 | [herolte](https://wiki.lineageos.org/devices/herolte/) | SM-G930F | tested
Samsung | Galaxy S9 | [starlte](https://wiki.lineageos.org/devices/starlte/) | | tested
Samsung | Galaxy Note 9 | [crownlte](https://wiki.lineageos.org/devices/crownlte/) | | tested
Samsung | Galaxy S10 | [beyond1lte](https://wiki.lineageos.org/devices/beyond1lte/) | | tested
Samsung | Galaxy Note 10 | [d1](https://wiki.lineageos.org/devices/d1/) | | tested
Google | Pixel 3a | [sargo](https://wiki.lineageos.org/devices/sargo/) | sargo | tested
Google | Pixel 4 | [flame](https://wiki.lineageos.org/devices/flame/) | flame | tested
Google | Pixel 4a | [sunfish](https://wiki.lineageos.org/devices/sunfish/) | sunfish | tested
Google | Pixel 5 | [redfin](https://wiki.lineageos.org/devices/redfin/) | redfin | tested
Google | Pixel 5a | [barbet](https://wiki.lineageos.org/devices/barbet/) | barbet | tested
Sony | Xperia Z | [yuga](https://wiki.lineageos.org/devices/yuga/) | C6603 | tested
Sony | Xperia Z3 | [z3](https://wiki.lineageos.org/devices/z3/) | | tested
Sony | Xperia ZX | kagura | | planned
Fairphone | Fairphone 2 | FP2 | | tested
Fairphone | Fairphone 3 | FP3 | | tested
Motorola | moto G5 | cedric | | planned
Motorola | moto g7 power | ocean | | under development
OnePlus | 6 | enchilada | | under development
OnePlus | 6T | fajita | | under development
OnePlus | 7T | hotdogb | | under development
Fairphone | Fairphone 2 | [FP2](https://wiki.lineageos.org/devices/FP2/) | | tested
Fairphone | Fairphone 3 | [FP3](https://wiki.lineageos.org/devices/FP3/) | | tested
Motorola | moto G5 | [cedric](https://wiki.lineageos.org/devices/cedric/) | | tested
Motorola | moto g7 power | [ocean](https://wiki.lineageos.org/devices/ocean/) | | tested
OnePlus | 6 | [enchilada](https://wiki.lineageos.org/devices/enchilada/) | | tested
OnePlus | 6T | [fajita](https://wiki.lineageos.org/devices/fajita/) | | tested
OnePlus | 7 | [guacamoleb](https://wiki.lineageos.org/devices/guacamoleb/) | | tested
OnePlus | 7 Pro | [guacamole](https://wiki.lineageos.org/devices/guacamole/) | | tested
OnePlus | 7T | [hotdogb](https://wiki.lineageos.org/devices/hotdogb/) | | tested
OnePlus | 7T Pro | [hotdog](https://wiki.lineageos.org/devices/hotdog/) | | tested
OnePlus | Nord N200 | [dre](https://wiki.lineageos.org/devices/dre/) | | tested
OnePlus | 9 | lemonade | | under development


Expand Down Expand Up @@ -105,11 +111,13 @@ Every step in the config file corresponds to one view in the application. These
- `call_button_with_input`: Display the content text, an input field and a button that runs a given command. The inputtext, can be used in the command by using the `<inputtext>` placeholder in the command field. After the command is run, a confirm button is displayed to allow the user to move to the next step.
- `link_button_with_confirm`: Display a button that opens a browser with a given link, confirm afterwards. Link is given in `link`.
- `content`: str; The content text displayed alongside the action of the step. Used to inform the user about whats going on.
- `command`: [ONLY for call_button* steps] str; The command to run. One of `adb_reboot`, `adb_reboot_bootloader`, `adb_reboot_download`, `adb_sideload`, `adb_twrp_wipe_and_install`, `fastboot_flash_recovery`, `fastboot_unlock_with_code`, `fastboot_unlock`, `fastboot_oem_unlock`, `fastboot_reboot`, `heimdall_flash_recovery`.
- `command`: [ONLY for call_button* steps] str; The command to run. One of `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_unlock`, `fastboot_oem_unlock`, `fastboot_get_unlock_data`, `fastboot_reboot`, `heimdall_flash_recovery`.
- `img`: [OPTIONAL] Display an image on the left pane of the step view. Images are loaded from `openandroidinstaller/assets/imgs/`.
- `allow_skip`: [OPTIONAL] boolean; If a skip button should be displayed to allow skipping this step. Can be useful when the bootloader is already unlocked.
- `link`: [OPTIONAL] Link to use for the link button if type is `link_button_with_confirm`.

You can also use the `requirements` field in the yaml, to specify `firmware` or `android` version requirements. The user will then be prompted if these requirements are satisfied.

### How to build the application for your platform

The executables for the OpenAndroidInstaller are build with [pyinstaller](https://pyinstaller.org/en/stable/index.html). You can create builds for MacOS or Linux with `make build-app`. For Windows the paths need to be modified. For now, you can have a look [here](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/v0.1.2-alpha/.github/workflows/manual-build-windows.yml#L22) on how it's done.
Expand All @@ -128,6 +136,7 @@ Other phone vendors stops allowing to unlock the bootloader all together. There
- The [Android SDK Platform Tools](https://developer.android.com/studio/releases/platform-tools) (such as adb and fastboot) are [Apache](https://android.googlesource.com/platform/system/adb/+/refs/heads/master/NOTICE)-licensed universal Android utilities
- [Heimdall](https://gitlab.com/BenjaminDobell/Heimdall/) is an [MIT](https://gitlab.com/BenjaminDobell/Heimdall/-/blob/master/LICENSE)-licensed replacement for the leaked ODIN tool to flash Samsung devices.
- [libusb-1.0](https://github.com/libusb/libusb) is a [LGPL-2.1](https://github.com/libusb/libusb/blob/master/COPYING)-licensed library for USB device access from Linux, macOS, Windows and others.
- [copy-partitions-20220613-signed.zip](https://mirrorbits.lineageos.org/tools/copy-partitions-20220613-signed.zip) The copy-partitions script was created by LineageOS developer erfanoabdi and filipepferraz and released under LGPL. It is used when the partitions need to be copied before flashing.


## Acknowledgements
Expand Down
Empty file.
3 changes: 1 addition & 2 deletions openandroidinstaller/app_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

from flet import ProgressBar
from installer_config import _load_config
from loguru import logger


class AppState:
Expand Down Expand Up @@ -67,6 +66,6 @@ def load_config(self, device_code: str):
def increment_progressbar(self):
"""Increment the progressbar and step counter."""
self.progressbar.value = (self.num_steps - 1) / (
self.num_total_steps + 2
self.num_total_steps + 3
) # don't show on the first step
self.num_steps += 1 # increase the step counter
2 changes: 1 addition & 1 deletion openandroidinstaller/assets/configs/FP3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ steps:
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_oem_unlock
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.
Expand Down
2 changes: 2 additions & 0 deletions openandroidinstaller/assets/configs/barbet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ metadata:
maintainer: Tobias Sterbak (tsterbak)
devicename: Pixel 5a
devicecode: barbet
requirements:
android: 12.1.0
steps:
unlock_bootloader:
- type: confirm_button
Expand Down
2 changes: 2 additions & 0 deletions openandroidinstaller/assets/configs/beyond1lte.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ metadata:
maintainer: Tobias Sterbak (tsterbak)
devicename: Samsung Galaxy S10
devicecode: beyond1lte
requirements:
android: 12
steps:
unlock_bootloader:
flash_recovery:
Expand Down
54 changes: 54 additions & 0 deletions openandroidinstaller/assets/configs/cedric.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
metadata:
maintainer: Tobias Sterbak (tsterbak)
devicename: Motorola Moto G5
devicecode: cedric
steps:
unlock_bootloader:
- type: call_button
command: adb_reboot_bootloader
content: >
As a first step, you need to unlock the bootloader of your device. A bootloader is the piece of software, that tells your phone
how to start and run an operating system (like Android). You need to boot into fastboot mode by pressing the 'Confirm and run' button. Then continue.
- type: call_button
command: fastboot_get_unlock_data
content: >
Now you need to get your device ID to get an unlock code from Motorola. Press 'Confirm and run' to get the ID. (You need to toggle 'Advanced Output' here to see it.)
Copy it to a separate file to use it in the next step.
- type: link_button_with_confirm
content: >
Click on the button to open the instructions on Motorola's official unlocking website to generate an unlock code for your bootloader.
Copy the code from the last step to the website and follow the instructions there. Then continue here.
link: https://motorola-global-portal.custhelp.com/app/standalone/bootloader/unlock-your-device-a
- type: confirm_button
content: Connect the device to your PC via USB. And confirm to continue.
- type: call_button_with_input
content: >
Use your code to unlock the bootloader of your device. Type in the full 21 character code you received by email (Example: 5RTSQCYL7ZJKL4NN35MY). Then confirm an run. Afterwards you can continue.
command: fastboot_unlock_with_code
- type: call_button_with_input
content: >
You need to perform the last command again, so reenter the code and run again. Afterwards you can continue.
command: fastboot_unlock_with_code
- type: call_button
content: >
Press the button to reboot. Since the device resets completely, you will need to re-enable USB debugging to continue.
Connect your device to your PC via USB. Then confirm here to continue.
command: fastboot_reboot
flash_recovery:
- type: call_button
content: >
Now you need to flash a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating,
adapting and repairing of the operating system.
Make sure your device is turned on. You need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue.
command: adb_reboot_bootloader
- type: call_button
content: 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
32 changes: 32 additions & 0 deletions openandroidinstaller/assets/configs/crownlte.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
metadata:
maintainer: Tobias Sterbak (tsterbak)
devicename: Samsung Galaxy Note 9
devicecode: crownlte
requirements:
android: 10
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* + *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
32 changes: 32 additions & 0 deletions openandroidinstaller/assets/configs/d1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
metadata:
maintainer: Tobias Sterbak (tsterbak)
devicename: Samsung Galaxy Note 10
devicecode: d1
requirements:
android: 12
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* + *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
53 changes: 53 additions & 0 deletions openandroidinstaller/assets/configs/dre.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
metadata:
maintainer: Tobias Sterbak (tsterbak)
devicename: OnePlus Nord N200
devicecode: dre
requirements:
android: 11
steps:
unlock_bootloader:
- type: call_button
content: >
As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone
how to start and run an operating system (like Android). Your device should be turned on.
Press 'Confirm and run' to reboot into the bootloader.
command: adb_reboot_bootloader
- 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_oem_unlock
- type: confirm_button
content: >
At this point the device may display on-screen prompts which will require interaction to continue the process of unlocking the bootloader.
Please take whatever actions the device asks you to to proceed.
- type: call_button
content: To finish the unlocking, the phone needs to reboot. Just press 'Confirm and run' here to reboot. Then continue.
command: fastboot_reboot
- type: confirm_button
content: The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue.
flash_recovery:
- type: call_button
content: >
Now you need to flash a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating,
adapting and repairing of the operating system.
Make sure your device is turned on. You need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue.
command: adb_reboot_bootloader
- type: call_button
content: 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
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
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
Loading

0 comments on commit 3790585

Please sign in to comment.