Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/0.4.0 beta #74

Merged
merged 42 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2bb75d0
Add an install view and allow to circle back to flash a recovery
tsterbak Jan 30, 2023
03e50a7
WIP
tsterbak Jan 30, 2023
97fd7be
Enable selecting addons
tsterbak Jan 30, 2023
2225d84
MVP for installing addons
tsterbak Jan 30, 2023
f54b51d
WIP
tsterbak Jan 31, 2023
0f6f6f0
Probably first working version of addons
tsterbak Feb 1, 2023
c56d42b
It finally works with sargo
tsterbak Feb 1, 2023
474d8bb
Merge branch 'main' into unified-install-step
tsterbak Feb 6, 2023
780fcc6
WIP - now detect a/b devices and pick different install paths; change…
tsterbak Feb 6, 2023
386a927
Remove install step from all configs
tsterbak Feb 6, 2023
69b35c0
Fix some issues with flashing addons
tsterbak Feb 6, 2023
721d15d
Fix for sideloading addons
tsterbak Feb 6, 2023
3734cd0
Update texts for isntalling addons
tsterbak Feb 6, 2023
c5744de
Improve description texts for addons
tsterbak Feb 7, 2023
81145af
Bump version to 0.4.0-beta
tsterbak Feb 7, 2023
8919ceb
Add more details about the recommended microg
tsterbak Feb 7, 2023
3cdd7af
Change the adb reboot bootlodaer function
tsterbak Feb 8, 2023
2020425
Allow the install process to fail and still continue and also recogni…
tsterbak Feb 8, 2023
649830e
Add download buttons for f-droid and microg
tsterbak Feb 8, 2023
4d5dd10
Unified install step & install addons (#65)
tsterbak Feb 8, 2023
e24b724
Merge branch 'release/0.3.5-alpha' into release/0.4.0-beta
tsterbak Feb 8, 2023
f8a4aaf
WIP
tsterbak Feb 8, 2023
d37c1c0
Fix configs
tsterbak Feb 8, 2023
56fef11
WIP
tsterbak Feb 9, 2023
f267dd6
Merge branch 'release/0.4.0-beta' into improve-cmd-interaction
tsterbak Feb 9, 2023
1c37547
Shell interactions optimized
tsterbak Feb 9, 2023
2544e39
Add some more tests for tooling functions
tsterbak Feb 9, 2023
93d8711
Fix advnaced toggle in install views; fix wiping partitions
tsterbak Feb 9, 2023
d280c14
Fix wiping cache after install
tsterbak Feb 9, 2023
b02c621
WIP
tsterbak Feb 9, 2023
3865d8f
Fix fastboot issue and clear error text at the right time
tsterbak Feb 9, 2023
a848ebd
Merge branch 'release/0.3.5-alpha' into release/0.4.0-beta
tsterbak Feb 9, 2023
9bb879e
Update new config
tsterbak Feb 9, 2023
1e96c77
Improve scripting component (#75)
tsterbak Feb 9, 2023
4efa9f7
Move modules around and improve tests
tsterbak Feb 9, 2023
bcd3f52
Improve typehints
tsterbak Feb 13, 2023
2798e47
Improve views handling
tsterbak Feb 13, 2023
218fba3
Make the title a bit higher to not distort it
tsterbak Feb 16, 2023
968c859
Add color to the bootloader unlocked switch
tsterbak Feb 16, 2023
e680cd0
Wait a bit longer before automatic reboot
tsterbak Feb 16, 2023
9772e07
Update readme
tsterbak Feb 16, 2023
78c2ad3
Merge branch 'main' into release/0.4.0-beta
tsterbak Feb 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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