Skip to content

Commit

Permalink
Release/0.4.0 beta (#74)
Browse files Browse the repository at this point in the history
This Release adds:
- install view and allow to circle back to flash a recovery
- enable selecting addons
- enable installing addons
- download buttons for Google apps, f-droid and microg

Improvements:
- typehints
- better views handling 

Fixes:
- remove error messages after retry
  • Loading branch information
tsterbak committed Feb 16, 2023
2 parents cfef18f + 78c2ad3 commit 598671f
Show file tree
Hide file tree
Showing 79 changed files with 1,422 additions and 865 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ format:
lint:
poetry run ruff openandroidinstaller/ --ignore E501

typing:
poetry run mypy openandroidinstaller/. --ignore-missing-imports

test: format lint
PYTHONPATH=openandroidinstaller:$(PYTHONPATH) poetry run pytest --cov=openandroidinstaller tests/

Expand Down
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</p>
</div>

> **Warning**: This application is currently in alpha state, so use at your own risk! While many people tested the application so far and we heard of no bricked devices, thinks might still go wrong.
> **Warning**: This application is currently in beta state, so use at your own risk! While many people tested the application so far and we heard of no bricked devices, thinks might still go wrong.
> **Note**: Unlocking the bootloader will erase all data on your device!
This also includes your DRM keys, which are stored in the Trim Area partition (also called TA).
Expand All @@ -40,16 +40,23 @@ Linux is currently the best supported platform (tested with Ubuntu 20.04/22.04 L

1. Download the AppImage, .exe or appropriate executable file for your OS. You might need to change permissions to run the executable.
- On Windows also [install the Universal USB Drivers](https://adb.clockworkmod.com/) and other potentially drivers needed for your device.
2. Download the custom ROM image and the TWRP recovery image for your device. A source for files can be found on the following websites:
- some custom ROMs:
- [LineageOS](https://wiki.lineageos.org/devices/)
- [/e/OS](https://doc.e.foundation/devices)
- [LineageOS for microg](https://download.lineage.microg.org/)
- [BlissRoms](https://blissroms.org/)
- [PixelExperience](https://download.pixelexperience.org/)
- TWRP Recovery:
- [TWRP recovery](https://twrp.me/Devices/)
- or you can just search the web or the [xda-developers forum](https://forum.xda-developers.com) for an appropriate version for your device.
2. Download the custom ROM image and the TWRP recovery image for your device and optionally some addons. A source for files can be found on the following websites:
- some custom ROMs:
- [LineageOS](https://wiki.lineageos.org/devices/)
- [/e/OS](https://doc.e.foundation/devices)
- [LineageOS for microg](https://download.lineage.microg.org/)
- [BlissRoms](https://blissroms.org/)
- [PixelExperience](https://download.pixelexperience.org/)
- TWRP Recovery:
- [TWRP recovery](https://twrp.me/Devices/)
- Optional Addons:
- There are different packages of *Google Apps* available.
- [MindTheGapps](https://wiki.lineageos.org/gapps#downloads)
- [NikGApps](https://nikgapps.com/)
- [MicroG](https://microg.org/)
- The recommended way to install MicroG is to use the zip file provided here: [https://github.com/FriendlyNeighborhoodShane/MinMicroG_releases/releases](https://github.com/FriendlyNeighborhoodShane/MinMicroG_releases/releases).
- [F-Droid App-Store](https://f-droid.org/en/packages/org.fdroid.fdroid.privileged.ota/).
- or you can just search the web or the [xda-developers forum](https://forum.xda-developers.com) for an appropriate version for your device.
3. Start the desktop app and follow the instructions.


Expand Down Expand Up @@ -218,7 +225,7 @@ If you build the application for your platform and want to contribute the build,
#### On unlocking the bootloader
Devices by *Samsung*, *Google* and *Fairphone* make it fairly easy to unlock the bootloader and receive good support in the installer.

Some devices with require manual steps to unlock the bootloader. In general you will need to create an account at a vendor website and receive some code from there. OpenAndroidInstaller will try to guide you as far as possible. These vendors include *Sony, Motorola, Xiaomi* among others.
Some devices with require manual steps to unlock the bootloader. In general you will need to create an account at a vendor website and receive some code from there. OpenAndroidInstaller will try to guide you as far as possible. These vendors include *Sony, Motorola, Xiaomi* and *OnePlus* among others.

Other phone vendors stops allowing to unlock the bootloader all together. There is nothing to be done if you didn't unlock your device in time. These vendors include *Huawei and LG* among others. Support for these vendors will always be very limited.

Expand Down
30 changes: 23 additions & 7 deletions openandroidinstaller/app_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
# If not, see <https://www.gnu.org/licenses/>."""
# Author: Tobias Sterbak

import copy
from pathlib import Path
from typing import List, Optional

from installer_config import _load_config

Expand All @@ -27,7 +29,7 @@ def __init__(
config_path: Path,
bin_path: Path,
test: bool = False,
test_config: str = None,
test_config: Optional[str] = None,
):
self.platform = platform
self.config_path = config_path
Expand All @@ -37,19 +39,33 @@ def __init__(

# placeholders
self.advanced = False
self.install_addons = False
self.config = None
self.image_path = None
self.recovery_path = None
self.is_ab = None

# is this still needed?
self.steps = None
# store views
self.default_views: List = []
self.addon_views: List = []
self.final_default_views: List = []

def add_default_views(self, views: List):
"""Add default views to store"""
self.default_views.extend(views)

def add_addon_views(self, views: List):
"""Add addon views to store"""
self.addon_views.extend(views)

def add_final_default_views(self, views: List):
"""Add final default views to store"""
self.final_default_views.extend(views)

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
)
10 changes: 1 addition & 9 deletions openandroidinstaller/assets/configs/FP2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
With the device powered off, hold 'Volume Up + Power'. Release when boot logo appears.
10 changes: 1 addition & 9 deletions openandroidinstaller/assets/configs/FP3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
With the device powered off, hold 'Volume Up + Power'. Release when boot logo appears.
10 changes: 1 addition & 9 deletions openandroidinstaller/assets/configs/FP4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
With the device powered off, hold 'Volume Up + Power'. Release when boot logo appears.
10 changes: 1 addition & 9 deletions openandroidinstaller/assets/configs/a3y17lte.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
hold *Volume Up* + *Home* + *Power*. Confirm when the recovery screen appears.
10 changes: 1 addition & 9 deletions openandroidinstaller/assets/configs/a5xelte.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
hold *Volume Up* + *Home* + *Power button*.
10 changes: 1 addition & 9 deletions openandroidinstaller/assets/configs/a72q.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
hold *Volume Up* + *Power button*.
10 changes: 1 addition & 9 deletions openandroidinstaller/assets/configs/a7xelte.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
hold *Volume Up* + *Home* + *Power button*.
14 changes: 3 additions & 11 deletions openandroidinstaller/assets/configs/akari.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue.
14 changes: 3 additions & 11 deletions openandroidinstaller/assets/configs/akatsuki.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue.
10 changes: 1 addition & 9 deletions openandroidinstaller/assets/configs/avicii.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue.
10 changes: 1 addition & 9 deletions openandroidinstaller/assets/configs/barbet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
command: fastboot_flash_recovery
10 changes: 1 addition & 9 deletions openandroidinstaller/assets/configs/beyond1lte.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
hold *Volume Up* + *Bixby* + *Power button*.
10 changes: 1 addition & 9 deletions openandroidinstaller/assets/configs/blueline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
img: twrp-start.jpeg
Loading

0 comments on commit 598671f

Please sign in to comment.