Skip to content

Commit 474d8bb

Browse files
committed
Merge branch 'main' into unified-install-step
2 parents c56d42b + 1f73a79 commit 474d8bb

17 files changed

Lines changed: 851 additions & 446 deletions

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# These are supported funding model platforms
22

33
github: [openandroidinstaller-dev]
4+
open_collective: openandroidinstaller
45
patreon: # Replace with a single Patreon username
5-
open_collective: # Replace with a single Open Collective username
66
ko_fi: # Replace with a single Ko-fi username
77
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
88
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</p>
2727
</div>
2828

29-
> **Warning**: This application is currently in early alpha state, so use at your own risk! I take no responsibility for bricked devices or dead SD cards.
29+
> **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.
3030
3131
> **Note**: Unlocking the bootloader will erase all data on your device!
3232
This also includes your DRM keys, which are stored in the Trim Area partition (also called TA).
@@ -36,7 +36,7 @@ If you wish to backup the TA partition first, you can find tutorials related to
3636

3737
## Usage
3838

39-
Linux is currently the best supported platform (tested with Ubuntu 20.04 LTS). Windows and MacOS are also supported but you might experience more issues. So far there is no support for ARM-based systems.
39+
Linux is currently the best supported platform (tested with Ubuntu 20.04/22.04 LTS). Windows and MacOS are also supported but you might experience more issues. So far there is no support for ARM-based systems.
4040

4141
1. Download the AppImage, .exe or appropriate executable file for your OS. You might need to change permissions to run the executable.
4242
- On Windows also [install the Universal USB Drivers](https://adb.clockworkmod.com/) and other potentially drivers needed for your device.
@@ -55,7 +55,7 @@ Linux is currently the best supported platform (tested with Ubuntu 20.04 LTS). W
5555

5656
## Officially supported devices
5757

58-
Currently, the **we support 45 devices** by various vendors and working on adding more soon!
58+
Currently, the **we support 48 devices** by various vendors and working on adding more soon!
5959

6060

6161
Support for these devices is provided as best effort, but things might still go wrong.
@@ -69,7 +69,10 @@ Samsung | Galaxy J7 2015 | j7elte | | tested
6969
Samsung | Galaxy A3 2017 | a3y17lte | SM-A320FL | tested
7070
Samsung | Galaxy A5 2016 | [a5xelte](https://wiki.lineageos.org/devices/a5xelte/) | SM-A510F | tested
7171
Samsung | Galaxy A7 2016 | a7xelte | | tested
72+
Samsung | Galaxy S6 | [zerofltexx](https://wiki.lineageos.org/devices/zerofltexx/) | | tested
73+
Samsung | Galaxy S6 Edge | [zeroltexx](https://wiki.lineageos.org/devices/zeroltexx/) | | tested
7274
Samsung | Galaxy S7 | [herolte](https://wiki.lineageos.org/devices/herolte/) | SM-G930F | tested
75+
Samsung | Galaxy S7 Edge | [hero2lte](https://wiki.lineageos.org/devices/hero2lte/) | | tested
7376
Samsung | Galaxy S9 | [starlte](https://wiki.lineageos.org/devices/starlte/) | | tested
7477
Samsung | Galaxy Note 9 | [crownlte](https://wiki.lineageos.org/devices/crownlte/) | | tested
7578
Samsung | Galaxy S10 | [beyond1lte](https://wiki.lineageos.org/devices/beyond1lte/) | | tested
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
metadata:
2+
maintainer: Tobias Sterbak (tsterbak)
3+
devicename: Samsung Galaxy S7 Edge
4+
devicecode: hero2lte
5+
steps:
6+
unlock_bootloader:
7+
flash_recovery:
8+
- type: call_button
9+
content: >
10+
As a first step, you need to boot into the bootloader. A bootloader is the piece of software,
11+
that tells your phone who to start and run an operating system (like Android). Your device should be turned on.
12+
Then press 'Confirm and run' to reboot into the bootloader. Continue once it's done.
13+
command: adb_reboot_download
14+
- type: call_button
15+
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.
16+
command: heimdall_flash_recovery
17+
- type: confirm_button
18+
img: samsung-buttons.png
19+
content: >
20+
Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for 8~10 seconds
21+
until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off,
22+
hold *Volume Up* + *Home* + *Power button*.
23+
install_os:
24+
- type: call_button
25+
content: >
26+
In the next steps, you finally flash the selected OS image.
27+
Connect your device with your computer with the USB-Cable.
28+
This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored
29+
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.
30+
command: adb_twrp_wipe_and_install
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
metadata:
2+
maintainer: Tobias Sterbak (tsterbak)
3+
devicename: Samsung Galaxy S6
4+
devicecode: zerofltexx
5+
steps:
6+
unlock_bootloader:
7+
flash_recovery:
8+
- type: call_button
9+
content: >
10+
As a first step, you need to boot into the bootloader. A bootloader is the piece of software,
11+
that tells your phone who to start and run an operating system (like Android). Your device should be turned on.
12+
Then press 'Confirm and run' to reboot into the bootloader. Continue once it's done.
13+
command: adb_reboot_download
14+
- type: call_button
15+
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.
16+
command: heimdall_flash_recovery
17+
- type: confirm_button
18+
img: samsung-buttons.png
19+
content: >
20+
Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for 8~10 seconds
21+
until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off,
22+
hold *Volume Up* + *Home* + *Power button*.
23+
install_os:
24+
- type: call_button
25+
content: >
26+
In the next steps, you finally flash the selected OS image.
27+
Connect your device with your computer with the USB-Cable.
28+
This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored
29+
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.
30+
command: adb_twrp_wipe_and_install
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
metadata:
2+
maintainer: Tobias Sterbak (tsterbak)
3+
devicename: Samsung Galaxy S6 Edge
4+
devicecode: zeroltexx
5+
steps:
6+
unlock_bootloader:
7+
flash_recovery:
8+
- type: call_button
9+
content: >
10+
As a first step, you need to boot into the bootloader. A bootloader is the piece of software,
11+
that tells your phone who to start and run an operating system (like Android). Your device should be turned on.
12+
Then press 'Confirm and run' to reboot into the bootloader. Continue once it's done.
13+
command: adb_reboot_download
14+
- type: call_button
15+
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.
16+
command: heimdall_flash_recovery
17+
- type: confirm_button
18+
img: samsung-buttons.png
19+
content: >
20+
Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for 8~10 seconds
21+
until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off,
22+
hold *Volume Up* + *Home* + *Power button*.
23+
install_os:
24+
- type: call_button
25+
content: >
26+
In the next steps, you finally flash the selected OS image.
27+
Connect your device with your computer with the USB-Cable.
28+
This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored
29+
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.
30+
command: adb_twrp_wipe_and_install

openandroidinstaller/openandroidinstaller.py

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
# where to write the logs
5757
logger.add("openandroidinstaller.log")
5858

59+
# VERSION number
60+
VERSION = "0.3.4-alpha"
5961

6062
# detect platform
6163
PLATFORM = sys.platform
@@ -75,19 +77,22 @@ def __init__(self, state: AppState):
7577

7678
# create default starter views
7779
welcome_view = WelcomeView(
78-
on_confirm=self.confirm,
80+
on_confirm=self.to_next_view,
7981
state=self.state,
8082
)
8183
start_view = StartView(
82-
on_confirm=self.confirm,
84+
on_confirm=self.to_next_view,
85+
on_back=self.to_previous_view,
8386
state=self.state,
8487
)
8588
requirements_view = RequirementsView(
86-
on_confirm=self.confirm,
89+
on_confirm=self.to_next_view,
90+
on_back=self.to_previous_view,
8791
state=self.state,
8892
)
8993
select_files_view = SelectFilesView(
90-
on_confirm=self.confirm,
94+
on_confirm=self.to_next_view,
95+
on_back=self.to_previous_view,
9196
state=self.state,
9297
)
9398
# ordered to allow for pop
@@ -99,7 +104,7 @@ def __init__(self, state: AppState):
99104
]
100105

101106
# create the install view
102-
self.install_view = InstallView(on_confirm=self.confirm, state=self.state)
107+
self.install_view = InstallView(on_confirm=self.to_next_view, state=self.state)
103108

104109
# create the final success view
105110
self.final_view = SuccessView(state=self.state)
@@ -114,8 +119,11 @@ def __init__(self, state: AppState):
114119
self.state.final_default_views = self.final_default_views
115120
self.state.final_view = self.final_view
116121

122+
# stack of previous default views for the back-button
123+
self.previous_views = []
124+
117125
# initialize the addon view
118-
self.select_addon_view = AddonsView(on_confirm=self.confirm, state=self.state)
126+
self.select_addon_view = AddonsView(on_confirm=self.to_next_view, state=self.state)
119127
self.flash_recovery_view = StepView(
120128
step=Step(
121129
title="Flash custom recovery",
@@ -125,10 +133,10 @@ def __init__(self, state: AppState):
125133
img="twrp-start.jpeg",
126134
),
127135
state=self.state,
128-
on_confirm=self.confirm,
136+
on_confirm=self.to_next_view,
129137
)
130138
self.install_addons_view = InstallAddonsView(
131-
on_confirm=self.confirm, state=self.state
139+
on_confirm=self.to_next_view, state=self.state
132140
)
133141
self.state.addon_views = [
134142
self.install_addons_view,
@@ -140,8 +148,21 @@ def build(self):
140148
self.view.controls.append(self.default_views.pop())
141149
return self.view
142150

143-
def confirm(self, e):
151+
def to_previous_view(self, e):
152+
"""Method to display the previous view."""
153+
# store the current view
154+
self.default_views.append(self.view.controls[-1])
155+
# clear the current view
156+
self.view.controls = []
157+
# retrieve the new view and update
158+
self.view.controls.append(self.previous_views.pop())
159+
logger.info("One step back.")
160+
self.view.update()
161+
162+
def to_next_view(self, e):
144163
"""Confirmation event handler to use in views."""
164+
# store the current view
165+
self.previous_views.append(self.view.controls[-1])
145166
# remove all elements from column view
146167
self.view.controls = []
147168
# if there are default views left, display them first
@@ -152,7 +173,7 @@ def confirm(self, e):
152173
StepView(
153174
step=self.state.steps.pop(0),
154175
state=self.state,
155-
on_confirm=self.confirm,
176+
on_confirm=self.to_next_view,
156177
)
157178
)
158179
elif self.final_default_views:
@@ -162,7 +183,7 @@ def confirm(self, e):
162183
# else:
163184
# # display the final view
164185
# self.view.controls.append(self.final_view)
165-
logger.info("Confirmed.")
186+
logger.info("Confirmed and moved to next step.")
166187
self.view.update()
167188

168189

@@ -182,19 +203,28 @@ def configure(page: Page):
182203
def log_version_infos(bin_path):
183204
"""Log the version infos of adb, fastboot and heimdall."""
184205
# adb
185-
adbversion = [line for line in run_command("adb", ["version"], bin_path)]
186-
adbversion = "\n".join(adbversion[:1])
187-
logger.info(f"{adbversion}")
206+
adbversion = [
207+
line for line in run_command("adb", ["version"], bin_path, enable_logging=False)
208+
]
209+
logger.info(f"{adbversion[1].strip()}")
188210
# fastboot
189-
fbversion = [line for line in run_command("fastboot", ["--version"], bin_path)]
190-
logger.info(f"{fbversion[0]}")
211+
fbversion = [
212+
line
213+
for line in run_command(
214+
"fastboot", ["--version"], bin_path, enable_logging=False
215+
)
216+
]
217+
logger.info(f"{fbversion[1].strip()}")
191218
# heimdall
192-
hdversion = [line for line in run_command("heimdall", ["info"], bin_path)]
193-
logger.info(f"Heimdall version: {hdversion[0]}")
219+
hdversion = [
220+
line
221+
for line in run_command("heimdall", ["info"], bin_path, enable_logging=False)
222+
]
223+
logger.info(f"Heimdall version: {hdversion[1].strip()}")
194224

195225

196226
def main(page: Page, test: bool = False, test_config: str = "sargo"):
197-
logger.info(f"Running OpenAndroidInstaller on {PLATFORM}")
227+
logger.info(f"Running OpenAndroidInstaller version '{VERSION}' on '{PLATFORM}'.")
198228
log_version_infos(bin_path=BIN_PATH)
199229
logger.info(100 * "-")
200230

@@ -209,7 +239,7 @@ def main(page: Page, test: bool = False, test_config: str = "sargo"):
209239
leading_width=56,
210240
toolbar_height=72,
211241
elevation=0,
212-
title=Text("OpenAndroidInstaller alpha version", style="displaySmall"),
242+
title=Text(f"OpenAndroidInstaller version {VERSION}", style="displaySmall"),
213243
center_title=False,
214244
bgcolor="#00d886",
215245
actions=[

openandroidinstaller/tooling.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
PLATFORM = sys.platform
3333

3434

35-
def run_command(tool: str, command: List[str], bin_path: Path) -> CompletedProcess:
35+
def run_command(
36+
tool: str, command: List[str], bin_path: Path, enable_logging: bool = True
37+
) -> CompletedProcess:
3638
"""Run a command with a tool (adb, fastboot, heimdall)."""
3739
yield f"${' '.join([tool] + command )}"
3840
if tool not in ["adb", "fastboot", "heimdall"]:
@@ -45,7 +47,8 @@ def run_command(tool: str, command: List[str], bin_path: Path) -> CompletedProce
4547
else:
4648
full_command = [str(bin_path.joinpath(Path(f"{tool}")))] + command
4749
si = None
48-
logger.info(f"Run command: {full_command}")
50+
if enable_logging:
51+
logger.info(f"Run command: {full_command}")
4952
# run the command
5053
with Popen(
5154
full_command,
@@ -56,7 +59,8 @@ def run_command(tool: str, command: List[str], bin_path: Path) -> CompletedProce
5659
startupinfo=si,
5760
) as p:
5861
for line in p.stdout:
59-
logger.info(line.strip())
62+
if enable_logging:
63+
logger.info(line.strip())
6064
yield line
6165

6266
yield p.returncode == 0

openandroidinstaller/views/base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,10 @@ def __init__(self, state: AppState, image: str = "placeholder.png"):
5252
],
5353
alignment="spaceEvenly",
5454
)
55+
56+
def clear(
57+
self,
58+
):
59+
"""Clear the right view."""
60+
self.right_view.controls = []
61+
self.right_view_header.controls = []

0 commit comments

Comments
 (0)