Skip to content

Commit db206ed

Browse files
authored
Release v0.3.3-alpha (#51)
This PR adds: - progress bar do show the progress of the flashing. - force light mode to address (#54) - a fix with alternative device code resolution (#56) - support for new devices (#52) : - Motorola moto g6 plus - Motorola moto g 5G plus / one 5G - Motorola moto g 5G / one 5G ace - Motorola edge
2 parents 5330d1e + 30dd2c2 commit db206ed

File tree

16 files changed

+715
-205
lines changed

16 files changed

+715
-205
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,12 @@ Fairphone | Fairphone 4 | [FP4](https://wiki.lineageos.org/devices/FP4/) | | tes
121121

122122
Vendor | Device Name | CodeName | Models | Status
123123
---|---|---|---|---
124-
Motorola | moto G5 | [cedric](https://wiki.lineageos.org/devices/cedric/) | | tested
125-
Motorola | moto G7 power | [ocean](https://wiki.lineageos.org/devices/ocean/) | | tested
124+
Motorola | moto g5 | [cedric](https://wiki.lineageos.org/devices/cedric/) | | tested
125+
Motorola | moto g6 plus | [evert](https://wiki.lineageos.org/devices/evert/) | | tested
126+
Motorola | moto g7 power | [ocean](https://wiki.lineageos.org/devices/ocean/) | | tested
127+
Motorola | moto g 5G plus / one 5G | [nairo](https://wiki.lineageos.org/devices/nairo/) | | tested
128+
Motorola | moto g 5G / one 5G ace | [kiev](https://wiki.lineageos.org/devices/kiev/) | | tested
129+
Motorola | edge | [racer](https://wiki.lineageos.org/devices/racer/) | | tested
126130
</details>
127131

128132
<details><summary><b>OnePlus</b></summary>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
metadata:
2+
maintainer: Tobias Sterbak (tsterbak)
3+
devicename: Motorola moto g6 plus
4+
devicecode: evert
5+
steps:
6+
unlock_bootloader:
7+
- type: call_button
8+
command: adb_reboot_bootloader
9+
content: >
10+
As a first step, you need to unlock the bootloader of your device. A bootloader is the piece of software, that tells your phone
11+
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.
12+
- type: call_button
13+
command: fastboot_get_unlock_data
14+
content: >
15+
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.)
16+
Copy it to a separate file to use it in the next step.
17+
- type: link_button_with_confirm
18+
content: >
19+
Click on the button to open the instructions on Motorola's official unlocking website to generate an unlock code for your bootloader.
20+
Copy the code from the last step to the website and follow the instructions there. Then continue here.
21+
link: https://motorola-global-portal.custhelp.com/app/standalone/bootloader/unlock-your-device-a
22+
- type: confirm_button
23+
content: Connect the device to your PC via USB. And confirm to continue.
24+
- type: call_button_with_input
25+
content: >
26+
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.
27+
command: fastboot_unlock_with_code
28+
- type: call_button_with_input
29+
content: >
30+
You need to perform the last command again, so reenter the code and run again. Afterwards you can continue.
31+
command: fastboot_unlock_with_code
32+
- type: call_button
33+
content: >
34+
Press the button to reboot. Since the device resets completely, you will need to re-enable USB debugging to continue.
35+
Connect your device to your PC via USB. Then confirm here to continue.
36+
command: fastboot_reboot
37+
flash_recovery:
38+
- type: call_button
39+
content: >
40+
Now you need to flash a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating,
41+
adapting and repairing of the operating system.
42+
Make sure your device is turned on. You need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue.
43+
command: adb_reboot_bootloader
44+
- type: call_button
45+
content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue.
46+
command: fastboot_flash_recovery
47+
- type: call_button
48+
command: adb_twrp_copy_partitions
49+
content: >
50+
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.
51+
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.
52+
- type: call_button
53+
command: fastboot_flash_recovery
54+
content: >
55+
Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue.
56+
install_os:
57+
- type: call_button
58+
content: >
59+
In this last step, you finally flash the selected OS image.
60+
Wait until the TWRP screen appears. Then run the command.
61+
This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored
62+
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.
63+
command: adb_twrp_wipe_and_install
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
metadata:
2+
maintainer: Tobias Sterbak (tsterbak)
3+
devicename: Motorola moto g 5G / one 5G ace
4+
devicecode: kiev
5+
steps:
6+
unlock_bootloader:
7+
- type: call_button
8+
command: adb_reboot_bootloader
9+
content: >
10+
As a first step, you need to unlock the bootloader of your device. A bootloader is the piece of software, that tells your phone
11+
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.
12+
- type: call_button
13+
command: fastboot_get_unlock_data
14+
content: >
15+
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.)
16+
Copy it to a separate file to use it in the next step.
17+
- type: link_button_with_confirm
18+
content: >
19+
Click on the button to open the instructions on Motorola's official unlocking website to generate an unlock code for your bootloader.
20+
Copy the code from the last step to the website and follow the instructions there. Then continue here.
21+
link: https://motorola-global-portal.custhelp.com/app/standalone/bootloader/unlock-your-device-a
22+
- type: confirm_button
23+
content: Connect the device to your PC via USB. And confirm to continue.
24+
- type: call_button_with_input
25+
content: >
26+
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.
27+
command: fastboot_unlock_with_code
28+
- type: call_button_with_input
29+
content: >
30+
You need to perform the last command again, so reenter the code and run again. Afterwards you can continue.
31+
command: fastboot_unlock_with_code
32+
- type: call_button
33+
content: >
34+
Press the button to reboot. Since the device resets completely, you will need to re-enable USB debugging to continue.
35+
Connect your device to your PC via USB. Then confirm here to continue.
36+
command: fastboot_reboot
37+
flash_recovery:
38+
- type: call_button
39+
content: >
40+
Now you need to flash a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating,
41+
adapting and repairing of the operating system.
42+
Make sure your device is turned on. You need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue.
43+
command: adb_reboot_bootloader
44+
- type: call_button
45+
content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue.
46+
command: fastboot_flash_recovery
47+
- type: call_button
48+
command: adb_twrp_copy_partitions
49+
content: >
50+
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.
51+
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.
52+
- type: call_button
53+
command: fastboot_flash_recovery
54+
content: >
55+
Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue.
56+
install_os:
57+
- type: call_button
58+
content: >
59+
In this last step, you finally flash the selected OS image.
60+
Wait until the TWRP screen appears. Then run the command.
61+
This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored
62+
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.
63+
command: adb_twrp_wipe_and_install
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
metadata:
2+
maintainer: Tobias Sterbak (tsterbak)
3+
devicename: Motorola moto g 5G plus / one 5G
4+
devicecode: nairo
5+
steps:
6+
unlock_bootloader:
7+
- type: call_button
8+
command: adb_reboot_bootloader
9+
content: >
10+
As a first step, you need to unlock the bootloader of your device. A bootloader is the piece of software, that tells your phone
11+
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.
12+
- type: call_button
13+
command: fastboot_get_unlock_data
14+
content: >
15+
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.)
16+
Copy it to a separate file to use it in the next step.
17+
- type: link_button_with_confirm
18+
content: >
19+
Click on the button to open the instructions on Motorola's official unlocking website to generate an unlock code for your bootloader.
20+
Copy the code from the last step to the website and follow the instructions there. Then continue here.
21+
link: https://motorola-global-portal.custhelp.com/app/standalone/bootloader/unlock-your-device-a
22+
- type: confirm_button
23+
content: Connect the device to your PC via USB. And confirm to continue.
24+
- type: call_button_with_input
25+
content: >
26+
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.
27+
command: fastboot_unlock_with_code
28+
- type: call_button_with_input
29+
content: >
30+
You need to perform the last command again, so reenter the code and run again. Afterwards you can continue.
31+
command: fastboot_unlock_with_code
32+
- type: call_button
33+
content: >
34+
Press the button to reboot. Since the device resets completely, you will need to re-enable USB debugging to continue.
35+
Connect your device to your PC via USB. Then confirm here to continue.
36+
command: fastboot_reboot
37+
flash_recovery:
38+
- type: call_button
39+
content: >
40+
Now you need to flash a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating,
41+
adapting and repairing of the operating system.
42+
Make sure your device is turned on. You need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue.
43+
command: adb_reboot_bootloader
44+
- type: call_button
45+
content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue.
46+
command: fastboot_flash_recovery
47+
- type: call_button
48+
command: adb_twrp_copy_partitions
49+
content: >
50+
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.
51+
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.
52+
- type: call_button
53+
command: fastboot_flash_recovery
54+
content: >
55+
Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue.
56+
install_os:
57+
- type: call_button
58+
content: >
59+
In this last step, you finally flash the selected OS image.
60+
Wait until the TWRP screen appears. Then run the command.
61+
This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored
62+
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.
63+
command: adb_twrp_wipe_and_install
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
metadata:
2+
maintainer: Tobias Sterbak (tsterbak)
3+
devicename: Motorola edge
4+
devicecode: racer
5+
steps:
6+
unlock_bootloader:
7+
- type: call_button
8+
command: adb_reboot_bootloader
9+
content: >
10+
As a first step, you need to unlock the bootloader of your device. A bootloader is the piece of software, that tells your phone
11+
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.
12+
- type: call_button
13+
command: fastboot_get_unlock_data
14+
content: >
15+
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.)
16+
Copy it to a separate file to use it in the next step.
17+
- type: link_button_with_confirm
18+
content: >
19+
Click on the button to open the instructions on Motorola's official unlocking website to generate an unlock code for your bootloader.
20+
Copy the code from the last step to the website and follow the instructions there. Then continue here.
21+
link: https://motorola-global-portal.custhelp.com/app/standalone/bootloader/unlock-your-device-a
22+
- type: confirm_button
23+
content: Connect the device to your PC via USB. And confirm to continue.
24+
- type: call_button_with_input
25+
content: >
26+
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.
27+
command: fastboot_unlock_with_code
28+
- type: call_button_with_input
29+
content: >
30+
You need to perform the last command again, so reenter the code and run again. Afterwards you can continue.
31+
command: fastboot_unlock_with_code
32+
- type: call_button
33+
content: >
34+
Press the button to reboot. Since the device resets completely, you will need to re-enable USB debugging to continue.
35+
Connect your device to your PC via USB. Then confirm here to continue.
36+
command: fastboot_reboot
37+
flash_recovery:
38+
- type: call_button
39+
content: >
40+
Now you need to flash a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating,
41+
adapting and repairing of the operating system.
42+
Make sure your device is turned on. You need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue.
43+
command: adb_reboot_bootloader
44+
- type: call_button
45+
content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue.
46+
command: fastboot_flash_recovery
47+
- type: call_button
48+
command: adb_twrp_copy_partitions
49+
content: >
50+
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.
51+
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.
52+
- type: call_button
53+
command: fastboot_flash_recovery
54+
content: >
55+
Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue.
56+
install_os:
57+
- type: call_button
58+
content: >
59+
In this last step, you finally flash the selected OS image.
60+
Wait until the TWRP screen appears. Then run the command.
61+
This step will format your phone and wipe all the data. It will also remove encryption and delete all files stored
62+
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.
63+
command: adb_twrp_wipe_and_install

openandroidinstaller/installer_config.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,22 @@ def __init__(
4949

5050

5151
class InstallerConfig:
52+
53+
# map some detected device codes to their real code.
54+
device_code_mapping = {
55+
# Sony issues
56+
"C6603": "yuga",
57+
# OnePlus issues
58+
"OnePlus6": "enchilada",
59+
"OnePlus6T": "fajita",
60+
"OnePlus7": "guacamoleb",
61+
"OnePlus7Pro": "guacamole",
62+
"OnePlus7T": "hotdogb",
63+
"OnePlus7TPro": "hotdog",
64+
"Nord": "avicii",
65+
"NordN200": "dre",
66+
}
67+
5268
def __init__(
5369
self,
5470
unlock_bootloader: List[Step],
@@ -62,6 +78,11 @@ def __init__(
6278
self.install_os = install_os
6379
self.metadata = metadata
6480
self.requirements = requirements
81+
self.device_code = metadata.get("devicecode")
82+
inverted_mapping = dict(map(reversed, self.device_code_mapping.items()))
83+
self.alternative_device_code = inverted_mapping.get(
84+
self.device_code, self.device_code
85+
)
6586

6687
@classmethod
6788
def from_file(cls, path):
@@ -107,15 +128,18 @@ def _load_config(device_code: str, config_path: Path) -> Optional[InstallerConfi
107128
Try to load local file in the same directory as the executable first, then load from assets.
108129
"""
109130
# try loading a custom local file first
110-
custom_path = Path.cwd().joinpath(Path(f"{device_code}.yaml"))
131+
mapped_device_code = InstallerConfig.device_code_mapping.get(
132+
device_code, device_code
133+
)
134+
custom_path = Path.cwd().joinpath(Path(f"{mapped_device_code}.yaml"))
111135
try:
112136
config = InstallerConfig.from_file(custom_path)
113137
logger.info(f"Loaded custom device config from {custom_path}.")
114138
logger.info(f"Config metadata: {config.metadata}.")
115139
return config
116140
except FileNotFoundError:
117141
# if no localfile, then try to load a config file from assets
118-
path = config_path.joinpath(Path(f"{device_code}.yaml"))
142+
path = config_path.joinpath(Path(f"{mapped_device_code}.yaml"))
119143
try:
120144
config = InstallerConfig.from_file(path)
121145
logger.info(f"Loaded device config from {path}.")

openandroidinstaller/openandroidinstaller.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def configure(page: Page):
129129
"""Configure the application."""
130130
# Configure the application base page
131131
page.title = "OpenAndroidInstaller"
132+
page.theme_mode = "light"
132133
page.window_height = 900
133134
page.window_width = int(1.5 * page.window_height)
134135
page.window_top = 100

0 commit comments

Comments
 (0)