Skip to content

Commit 1202bb1

Browse files
authored
Release v0.2.1-alpha (#30)
This PR for Release v.0.2.1-alpha adds: - Simplify config files - Popup enabled again - Make enabeling developer options clearer, better design hierarchy - Use twrp scripting - Use specific functions to run commands with tools - Write logs to file - Only support twrp recoveries in tool now - major refactoring and decoupling of frontend and logic - Enable terminal output in tool - Improve logging - Adapt config for TWRP recovery for FairPhones - Support new devices: - [x] samsung galaxy s9 - [x] samsung galaxy s10 - [x] Samsung Galaxy A7 (2016) - [x] Samsung Galaxy A72 - [x] Samsung Galaxy J7 (2015) - [x] pixel 4 - [x] pixel 4a - [x] pixel 5 - [x] pixel 5a - [x] Sony Xperia Z3
2 parents 68cf85e + 6ec588d commit 1202bb1

29 files changed

+1539
-993
lines changed

README.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
[![Release](https://img.shields.io/github/v/release/openandroidinstaller-dev/openandroidinstaller?include_prereleases&style=flat-square)](https://github.com/openandroidinstaller-dev/openandroidinstaller/releases)
77
[![Downloads](https://img.shields.io/github/downloads/openandroidinstaller-dev/openandroidinstaller/total?style=flat-square)](https://github.com/openandroidinstaller-dev/openandroidinstaller/releases)
88
[![Twitter](https://img.shields.io/twitter/follow/oainstaller?style=social)](https://twitter.com/OAInstaller)
9+
[![Mastodon](https://img.shields.io/mastodon/follow/109341220262803943?domain=https%3A%2F%2Ffosstodon.org&style=social)](https://fosstodon.org/@openandroidinstaller)
910
<p>Makes installing alternative Android distributions nice and easy.</p>
1011
<a href="https://github.com/openandroidinstaller-dev/openandroidinstaller">
1112
<img src="openandroidinstaller/assets/logo-192x192.png" alt="OpenAndroidInstaller" height="80">
@@ -35,19 +36,29 @@ If you wish to backup the TA partition first, you can find tutorials related to
3536
## Officially supported devices
3637
Vendor | Device Name | CodeName | Models | Status
3738
---|---|---|---|---
39+
Samsung | Galaxy J7 2015 | j7elte | | tested
3840
Samsung | Galaxy A3 2017 | a3y17lte | SM-A320FL | tested
3941
Samsung | Galaxy A5 2016 | a5xelte | SM-A510F | tested
42+
Samsung | Galaxy A7 2016 | a7xelte | | tested
4043
Samsung | Galaxy S7 | herolte | SM-G930F | tested
41-
Samsung | Galaxy S9 | starlte | | under development
44+
Samsung | Galaxy S9 | starlte | | tested
45+
Samsung | Galaxy S10 | beyond1lte | | tested
4246
Google | Pixel 3a | sargo | sargo | tested
43-
Google | Pixel 4a | sunfish | sunfish | planned
47+
Google | Pixel 4 | flame | flame | tested
48+
Google | Pixel 4a | sunfish | sunfish | tested
49+
Google | Pixel 5 | redfin | redfin | tested
50+
Google | Pixel 5a | barbet | barbet | tested
4451
Sony | Xperia Z | yuga | C6603 | tested
45-
Sony | Xperia Z3 | z3 | | under development
52+
Sony | Xperia Z3 | z3 | | tested
4653
Sony | Xperia ZX | kagura | | planned
47-
Fairphone | Fairphone 2 | FP2 | | under development
48-
Fairphone | Fairphone 3 | FP3 | | under development
49-
Motorola | Moto G5 | cedric | | planned
54+
Fairphone | Fairphone 2 | FP2 | | tested
55+
Fairphone | Fairphone 3 | FP3 | | tested
56+
Motorola | moto G5 | cedric | | planned
5057
Motorola | moto g7 power | ocean | | under development
58+
OnePlus | 6 | enchilada | | under development
59+
OnePlus | 6T | fajita | | under development
60+
OnePlus | 7T | hotdogb | | under development
61+
OnePlus | 9 | lemonade | | under development
5162

5263

5364
## Usage
@@ -87,18 +98,14 @@ If you want to use the tool for a non-supported smartphone, the fastest way is t
8798
#### Content of a config file
8899

89100
Every step in the config file corresponds to one view in the application. These steps should contain the following fields:
90-
- `title`: str; Describing the overall goal of the step. Will be displayed in the header of the view.
91101
- `type`: str; Corresponds to the type of view to generate. There are the following options:
92102
- `text`: Just display the text given in content.
93103
- `confirm_button`: Display the content, as well as a button to allow the user to go to the next step.
94104
- `call_button`: Display the content text and a button that runs a given command. After the command is run, a confirm button is displayed to allow the user to move to the next step.
95105
- `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.
96106
- `link_button_with_confirm`: Display a button that opens a browser with a given link, confirm afterwards. Link is given in `link`.
97107
- `content`: str; The content text displayed alongside the action of the step. Used to inform the user about whats going on.
98-
- `command`: [ONLY for call_button* steps] str; This is a terminal command run in a shell. (For example fastboot or adb). There are three types of placeholders supported, that will be filled by the tool as soon as information is given.
99-
- `<image>`: The path of the ROM image file.
100-
- `<recovery>`: The path of the recovery file.
101-
- `<inputtext>`: Text from the user input from `call_button_with_input` views.
108+
- `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`.
102109
- `img`: [OPTIONAL] Display an image on the left pane of the step view. Images are loaded from `openandroidinstaller/assets/imgs/`.
103110
- `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.
104111
- `link`: [OPTIONAL] Link to use for the link button if type is `link_button_with_confirm`.

openandroidinstaller/app_state.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
"""This file contains a class and function to manage the app state over various steps."""
2+
3+
# This file is part of OpenAndroidInstaller.
4+
# OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of
5+
# the GNU General Public License as published by the Free Software Foundation,
6+
# either version 3 of the License, or (at your option) any later version.
7+
8+
# OpenAndroidInstaller is distributed in the hope that it will be useful, but WITHOUT ANY
9+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
10+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
11+
12+
# You should have received a copy of the GNU General Public License along with OpenAndroidInstaller.
13+
# If not, see <https://www.gnu.org/licenses/>."""
14+
# Author: Tobias Sterbak
15+
16+
from pathlib import Path
17+
18+
from flet import ProgressBar
19+
from installer_config import _load_config
20+
from loguru import logger
21+
22+
23+
class AppState:
24+
"""Container class to store the state of the application."""
25+
26+
def __init__(
27+
self,
28+
platform: str,
29+
config_path: Path,
30+
bin_path: Path,
31+
progressbar: ProgressBar,
32+
num_steps: int,
33+
test: bool = False,
34+
test_config: str = None,
35+
):
36+
self.platform = platform
37+
self.config_path = config_path
38+
self.bin_path = bin_path
39+
self.progressbar = progressbar
40+
self.num_steps = num_steps # keep track of the steps already taken
41+
self.test = test
42+
self.test_config = test_config
43+
44+
# initialize the progress bar at 0
45+
self.progressbar.value = 0
46+
47+
# placeholders
48+
self.advanced = False
49+
self.config = None
50+
self.image_path = None
51+
self.recovery_path = None
52+
53+
# is this still needed?
54+
self.steps = None
55+
56+
def load_config(self, device_code: str):
57+
"""Load the config from file to state by device code."""
58+
self.config = _load_config(device_code, self.config_path)
59+
if self.config:
60+
self.steps = (
61+
self.config.unlock_bootloader
62+
+ self.config.flash_recovery
63+
+ self.config.install_os
64+
)
65+
self.num_total_steps = len(self.steps)
66+
67+
def increment_progressbar(self):
68+
"""Increment the progressbar and step counter."""
69+
self.progressbar.value = (self.num_steps - 1) / (
70+
self.num_total_steps + 2
71+
) # don't show on the first step
72+
self.num_steps += 1 # increase the step counter

openandroidinstaller/assets/configs/FP2.yaml

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,25 @@ metadata:
55
steps:
66
unlock_bootloader:
77
flash_recovery:
8-
- title: "Flash a custom recovery"
9-
type: confirm_button
8+
- type: confirm_button
109
content: >
1110
Now you need to flash a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating,
1211
adapting and repairing of the operating system.
13-
- title: "Flash a custom recovery"
14-
type: call_button
12+
- type: call_button
1513
content: Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue.
16-
command: "adb reboot bootloader"
17-
- title: "Flash a custom recovery"
18-
type: call_button
14+
command: adb_reboot_bootloader
15+
- type: call_button
1916
content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue.
20-
command: "fastboot flash recovery <recovery>"
21-
- title: "Flash temporary recovery"
22-
type: confirm_button
17+
command: fastboot_flash_recovery
18+
- type: confirm_button
2319
content: >
2420
Now reboot into recovery to verify the installation. Do not reboot into the existing OS, since it will overwrite the recovery you just installed!
2521
With the device powered off, hold 'Volume Up + Power'. Release when boot logo appears.
2622
install_os:
27-
- title: "Flash LineageOS"
28-
type: confirm_button
23+
- type: call_button
2924
content: >
30-
Now tap Factory Reset, then Format data / Factory reset on your phone screen and continue with the formatting process.
31-
This will remove encryption and delete all files stored in the internal storage, as well as format your cache partition (if you have one).
32-
- title: "Flash LineageOS"
33-
type: confirm_button
34-
content: Return to the main menu on the phone.
35-
- title: "Flash LineageOS"
36-
type: confirm_button
37-
content: On the device, select “Apply Update”, then “Apply from ADB” to begin sideload. Then confirm here.
38-
- title: "Flash LineageOS"
39-
type: call_button
40-
content: >
41-
Now it's time to flash the LineageOS image. Don't remove the USB-Cable and press 'Confirm and run' to start!
42-
This might take a while. Confirm after it's done.
43-
command: "adb sideload <image>"
44-
- title: "Flash LineageOS"
45-
type: confirm_button
46-
content: Flashing finished. Now press 'back' (arrow) and then 'Reboot system now' on the phone screen to finish the installation.
25+
In the next steps, you finally flash the selected OS image.
26+
Wait until the TWRP screen appears. Then run the command.
27+
This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored
28+
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.
29+
command: adb_twrp_wipe_and_install

openandroidinstaller/assets/configs/FP3.yaml

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,51 @@ metadata:
44
devicecode: FP3
55
steps:
66
unlock_bootloader:
7-
- title: "Unlock the bootloader"
8-
type: link_button_with_confirm
7+
- type: link_button_with_confirm
98
content: >
9+
As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone
10+
how to start and run an operating system (like Android). Your device should be turned on.
1011
Click on the button to open the instructions on the Fairphone Support official unlocking website to generate an unlock code for your device.
11-
Once you done that, continue.
12+
Once you've done that, continue.
1213
link: https://www.fairphone.com/en/bootloader-unlocking-code-for-fairphone-3/
14+
- type: call_button
15+
content: Press 'Confirm and run' to reboot into the bootloader.
16+
command: adb_reboot_bootloader
17+
- type: confirm_button
18+
content: >
19+
Select 'Restart bootloader' on your smartphone screen by pressing the volume button and the confirm by pushing the power button.
20+
Then press 'Confirm and continue' here.
21+
- type: call_button
22+
content: In this step you actually unlock the bootloader. Just press 'Confirm and run' here. Once it's done, press continue here.
23+
command: fastboot_oem_unlock
24+
- type: confirm_button
25+
content: >
26+
Follow the instructions on the Fairphone screen. This command will wipe all the personal data on your phone.
27+
- type: call_button
28+
content: To finish the unlocking, the phone needs to reboot. Just press 'Confirm and run' here to reboot. Then continue.
29+
command: fastboot_reboot
30+
- type: confirm_button
31+
content: The bootloader is now unlocked. Since the device resets completely, you will need to re-enable USB debugging to continue.
1332
flash_recovery:
14-
- title: "Flash a custom recovery"
15-
type: confirm_button
33+
- type: confirm_button
1634
content: >
1735
Now you need to flash a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating,
1836
adapting and repairing of the operating system.
19-
- title: "Flash a custom recovery"
20-
type: call_button
37+
- type: call_button
2138
content: Turn on your device. Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue.
22-
command: "adb reboot bootloader"
23-
- title: "Flash a custom recovery"
24-
type: call_button
39+
command: adb_reboot_bootloader
40+
- type: call_button
2541
content: Once the device is in fastboot mode, flash the custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue.
26-
command: "fastboot flash boot <recovery>"
27-
- title: "Flash temporary recovery"
28-
type: confirm_button
42+
command: fastboot_flash_recovery
43+
- type: confirm_button
2944
content: >
3045
Now reboot into recovery to verify the installation. Do not reboot into the existing OS, since it will overwrite the recovery you just installed!
3146
With the device powered off, hold 'Volume Up + Power'. Release when boot logo appears.
3247
install_os:
33-
- title: "Flash LineageOS"
34-
type: confirm_button
35-
content: >
36-
Now tap 'Factory Reset', then 'Format data / Factory reset' on your phone screen and continue with the formatting process.
37-
This will remove encryption and delete all files stored in the internal storage, as well as format your cache partition (if you have one).
38-
- title: "Flash LineageOS"
39-
type: confirm_button
40-
content: Return to the main menu on the phone.
41-
- title: "Flash LineageOS"
42-
type: confirm_button
43-
content: On the device, select “Apply Update”, then “Apply from ADB” to begin sideload. Then confirm here.
44-
- title: "Flash LineageOS"
45-
type: call_button
48+
- type: call_button
4649
content: >
47-
Now it's time to flash the LineageOS image. Don't remove the USB-Cable and press 'Confirm and run' to start!
48-
This might take a while. Confirm after it's done.
49-
command: "adb sideload <image>"
50-
- title: "Flash LineageOS"
51-
type: confirm_button
52-
content: Flashing finished. Now press 'back' (arrow) and then 'Reboot system now' on the phone screen to finish the installation. Then confirm here.
50+
In the next steps, you finally flash the selected OS image.
51+
Wait until the TWRP screen appears. Then run the command.
52+
This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored
53+
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.
54+
command: adb_twrp_wipe_and_install

openandroidinstaller/assets/configs/a3y17lte.yaml

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,28 @@ metadata:
55
steps:
66
unlock_bootloader:
77
flash_recovery:
8-
- title: "Boot into bootloader"
9-
type: call_button
8+
- type: call_button
109
content: >
1110
As a first step, you need to boot into the bootloader. A bootloader is the piece of software,
1211
that tells your phone who to start and run an operating system (like Android). Your device should be turned on.
1312
Then press 'Confirm and run' to reboot into the bootloader. Continue once it's done.
14-
command: "adb reboot download"
15-
- title: "Flash custom recovery"
16-
type: call_button
13+
command: adb_reboot_download
14+
- type: call_button
1715
content: >
1816
In this step, you need to flash a custom recovery on your device.
1917
Press 'Confirm and run' to start the process. Confirm afterwards to continue.
20-
command: "heimdall flash --no-reboot --RECOVERY <recovery>"
21-
- title: "Boot into recovery"
22-
type: confirm_button
18+
command: heimdall_flash_recovery
19+
- type: confirm_button
2320
img: samsung-buttons.png
2421
content: >
2522
Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for
2623
8~10 seconds until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off,
27-
hold *Volume Up* + *Home* + *Power*.
24+
hold *Volume Up* + *Home* + *Power*. Confirm when the recovery screen appears.
2825
install_os:
29-
- title: "Flash LineageOS"
30-
type: confirm_button
26+
- type: call_button
3127
content: >
32-
Now swipe right to allow modifications then tap 'Wipe' on your phone. Next tap 'Format Data' and follow
33-
the instructions on your phone to continue with the formatting process. This will remove encryption and delete all files stored
34-
in the internal storage. Confirm to continue once you are done.
35-
- title: "Flash LineageOS"
36-
type: confirm_button
37-
content: >
38-
Return to the previous menu on your phone by going back two times.
39-
Them tap 'Advanced Wipe', and select the 'Cache' and 'System' partitions and then 'Swipe to Wipe'.
40-
Confirm to continue once you are done.
41-
- title: "Flash LineageOS"
42-
type: confirm_button
43-
content: >
44-
Now connect the phone to the computer again with the USB-cable. On the device, go back three times and select “Advanced”,
45-
then “ADB Sideload”. Select 'Wipe cache' and 'Wipe dalvik cache', then swipe to begin sideload. Then confirm here.
46-
- title: "Flash LineageOS"
47-
type: call_button
48-
content: >
49-
Now it's time to flash the LineageOS image. Don't remove the USB-Cable and press 'Confirm and run' to start!
50-
This might take a while. Confirm after it's done.
51-
command: "adb sideload <image>"
52-
- title: "Reboot into LineageOS"
53-
type: call_button
54-
content: As a final step, reboot into LineageOS to finish the installation by pressing the button.
55-
command: "adb reboot"
28+
In the next steps, you finally flash the selected OS image.
29+
Connect your device with your computer with the USB-Cable.
30+
This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored
31+
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.
32+
command: adb_twrp_wipe_and_install

0 commit comments

Comments
 (0)