diff --git a/README.md b/README.md index b149a4ff..fcf40554 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ Linux is currently the best supported platform (tested with Ubuntu 20.04/22.04 L ## Officially supported devices -Currently, the **we support 56 devices** by various vendors and working on adding more soon! +Currently, the **we support 57 devices** by various vendors and working on adding more soon! Support for these devices is provided as best effort, but things might still go wrong. @@ -198,6 +198,7 @@ A config file consists of two parts. The first part are some metadata about the Every config file should have `metadata` with the following fields: - `maintainer`: str; Maintainer and author of the config file. - `device_name`: str; Name of the device. +- `is_ab_device`: bool; A boolean to determine if the device is a/b-partitioned or not. - `device_code`: str; The official device code. - `supported_device_codes`: List[str]; A list of supported device codes for the config. The config will be loaded based on this field. - `twrp-link`: [OPTIONAL] str; name of the corresponding twrp page. diff --git a/openandroidinstaller/app_state.py b/openandroidinstaller/app_state.py index 40fb427d..49f69155 100644 --- a/openandroidinstaller/app_state.py +++ b/openandroidinstaller/app_state.py @@ -43,7 +43,6 @@ def __init__( self.config = None self.image_path = None self.recovery_path = None - self.is_ab = None # store views self.default_views: List = [] diff --git a/openandroidinstaller/assets/configs/FP2.yaml b/openandroidinstaller/assets/configs/FP2.yaml index 75b505a2..8cf68c97 100644 --- a/openandroidinstaller/assets/configs/FP2.yaml +++ b/openandroidinstaller/assets/configs/FP2.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Fairphone 2 + is_ab_device: false device_code: FP2 supported_device_codes: - FP2 diff --git a/openandroidinstaller/assets/configs/FP3.yaml b/openandroidinstaller/assets/configs/FP3.yaml index 9f82917c..32b0e23c 100644 --- a/openandroidinstaller/assets/configs/FP3.yaml +++ b/openandroidinstaller/assets/configs/FP3.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Fairphone 3 + is_ab_device: true device_code: FP3 supported_device_codes: - FP3 diff --git a/openandroidinstaller/assets/configs/FP4.yaml b/openandroidinstaller/assets/configs/FP4.yaml index bdd9a2d5..af164fe8 100644 --- a/openandroidinstaller/assets/configs/FP4.yaml +++ b/openandroidinstaller/assets/configs/FP4.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Fairphone 4 + is_ab_device: true device_code: FP4 supported_device_codes: - FP4 diff --git a/openandroidinstaller/assets/configs/a3y17lte.yaml b/openandroidinstaller/assets/configs/a3y17lte.yaml index e0ec7461..27f86cc4 100644 --- a/openandroidinstaller/assets/configs/a3y17lte.yaml +++ b/openandroidinstaller/assets/configs/a3y17lte.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy A3 (2017) + is_ab_device: false device_code: a3y17lte supported_device_codes: - a3y17lte diff --git a/openandroidinstaller/assets/configs/a5xelte.yaml b/openandroidinstaller/assets/configs/a5xelte.yaml index 0b7898df..b61bd068 100644 --- a/openandroidinstaller/assets/configs/a5xelte.yaml +++ b/openandroidinstaller/assets/configs/a5xelte.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy A5 (2016) + is_ab_device: false device_code: a5xelte supported_device_codes: - a5xelte diff --git a/openandroidinstaller/assets/configs/a72q.yaml b/openandroidinstaller/assets/configs/a72q.yaml index 0107db28..b613076a 100644 --- a/openandroidinstaller/assets/configs/a72q.yaml +++ b/openandroidinstaller/assets/configs/a72q.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy A72 + is_ab_device: false device_code: a72q supported_device_codes: - a72q diff --git a/openandroidinstaller/assets/configs/a7xelte.yaml b/openandroidinstaller/assets/configs/a7xelte.yaml index c6e2e3e3..e8151b28 100644 --- a/openandroidinstaller/assets/configs/a7xelte.yaml +++ b/openandroidinstaller/assets/configs/a7xelte.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy A7 (2016) + is_ab_device: false device_code: a7xelte supported_device_codes: - a7xelte diff --git a/openandroidinstaller/assets/configs/akari.yaml b/openandroidinstaller/assets/configs/akari.yaml index 51bf4500..4f1accba 100644 --- a/openandroidinstaller/assets/configs/akari.yaml +++ b/openandroidinstaller/assets/configs/akari.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Sony Xperia XZ2 + is_ab_device: true device_code: akari supported_device_codes: - akari diff --git a/openandroidinstaller/assets/configs/akatsuki.yaml b/openandroidinstaller/assets/configs/akatsuki.yaml index ef870c1d..07defb8f 100644 --- a/openandroidinstaller/assets/configs/akatsuki.yaml +++ b/openandroidinstaller/assets/configs/akatsuki.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Sony Xperia XZ3 + is_ab_device: true device_code: akatsuki supported_device_codes: - akatsuki diff --git a/openandroidinstaller/assets/configs/avicii.yaml b/openandroidinstaller/assets/configs/avicii.yaml index 662c632f..f65d4191 100644 --- a/openandroidinstaller/assets/configs/avicii.yaml +++ b/openandroidinstaller/assets/configs/avicii.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: OnePlus Nord + is_ab_device: true device_code: avicii supported_device_codes: - avicii @@ -16,17 +17,13 @@ steps: Press 'Confirm and run' to reboot into the bootloader. command: adb_reboot_bootloader - type: call_button - content: In this step you actually unlock the bootloader. Just press 'Confirm and run' here. Once it's done, press continue here. - command: fastboot_oem_unlock - - type: confirm_button content: > - At this point the device may display on-screen prompts which will require interaction to continue the process of unlocking the bootloader. - Please take whatever actions the device asks you to to proceed. - - type: call_button - content: To finish the unlocking, the phone needs to reboot. Just press 'Confirm and run' here to reboot. Then continue. - command: fastboot_reboot + In this step you actually unlock the bootloader. Just press 'Confirm and run' here. The phone will automatically reboot and reformat. + Once it's done, press continue here. + command: fastboot_oem_unlock - type: confirm_button - content: The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. + content: > + The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. boot_recovery: - type: call_button content: > @@ -36,13 +33,14 @@ steps: command: adb_reboot_bootloader - type: call_button img: twrp-start.jpeg - content: Boot a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. + content: > + Boot a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. command: fastboot_boot_recovery - 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. + command: adb_twrp_copy_partitions - type: call_button img: twrp-start.jpeg content: > diff --git a/openandroidinstaller/assets/configs/bacon.yaml b/openandroidinstaller/assets/configs/bacon.yaml index ed49081f..43dc97e7 100644 --- a/openandroidinstaller/assets/configs/bacon.yaml +++ b/openandroidinstaller/assets/configs/bacon.yaml @@ -1,6 +1,7 @@ metadata: maintainer: MagicLike device_name: OnePlus One + is_ab_device: false device_code: bacon supported_device_codes: - bacon diff --git a/openandroidinstaller/assets/configs/barbet.yaml b/openandroidinstaller/assets/configs/barbet.yaml index 49b26bba..17fff981 100644 --- a/openandroidinstaller/assets/configs/barbet.yaml +++ b/openandroidinstaller/assets/configs/barbet.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Pixel 5a + is_ab_device: true device_code: barbet supported_device_codes: - barbet diff --git a/openandroidinstaller/assets/configs/beyond0lte.yaml b/openandroidinstaller/assets/configs/beyond0lte.yaml index 161299ed..63d6e5cd 100644 --- a/openandroidinstaller/assets/configs/beyond0lte.yaml +++ b/openandroidinstaller/assets/configs/beyond0lte.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy S10e + is_ab_device: false device_code: beyond0lte supported_device_codes: - beyond0lte diff --git a/openandroidinstaller/assets/configs/beyond1lte.yaml b/openandroidinstaller/assets/configs/beyond1lte.yaml index 97100ea5..d5f10be2 100644 --- a/openandroidinstaller/assets/configs/beyond1lte.yaml +++ b/openandroidinstaller/assets/configs/beyond1lte.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy S10 + is_ab_device: false device_code: beyond1lte supported_device_codes: - beyond1lte diff --git a/openandroidinstaller/assets/configs/beyond2lte.yaml b/openandroidinstaller/assets/configs/beyond2lte.yaml index 9c70b0dd..42b25f5c 100644 --- a/openandroidinstaller/assets/configs/beyond2lte.yaml +++ b/openandroidinstaller/assets/configs/beyond2lte.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy S10+ + is_ab_device: false device_code: beyond2lte supported_device_codes: - beyond2lte diff --git a/openandroidinstaller/assets/configs/blueline.yaml b/openandroidinstaller/assets/configs/blueline.yaml index f172d012..3b19352d 100644 --- a/openandroidinstaller/assets/configs/blueline.yaml +++ b/openandroidinstaller/assets/configs/blueline.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Google Pixel 3 + is_ab_device: true device_code: blueline supported_device_codes: - blueline diff --git a/openandroidinstaller/assets/configs/bonito.yaml b/openandroidinstaller/assets/configs/bonito.yaml index e9bc2480..464ccbf8 100644 --- a/openandroidinstaller/assets/configs/bonito.yaml +++ b/openandroidinstaller/assets/configs/bonito.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Google Pixel 3a XL + is_ab_device: true device_code: bonito supported_device_codes: - bonito diff --git a/openandroidinstaller/assets/configs/cedric.yaml b/openandroidinstaller/assets/configs/cedric.yaml index 6da75604..dc41d5e5 100644 --- a/openandroidinstaller/assets/configs/cedric.yaml +++ b/openandroidinstaller/assets/configs/cedric.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Motorola Moto G5 + is_ab_device: false device_code: cedric supported_device_codes: - cedric diff --git a/openandroidinstaller/assets/configs/cheeseburger.yaml b/openandroidinstaller/assets/configs/cheeseburger.yaml index 0bddaa81..ae4d4c21 100644 --- a/openandroidinstaller/assets/configs/cheeseburger.yaml +++ b/openandroidinstaller/assets/configs/cheeseburger.yaml @@ -1,6 +1,7 @@ metadata: maintainer: SirRGB device_name: OnePlus 5 + is_ab_device: false device_code: cheeseburger supported_device_codes: - cheeseburger @@ -15,17 +16,13 @@ steps: Press 'Confirm and run' to reboot into the bootloader. command: adb_reboot_bootloader - type: call_button - content: In this step you actually unlock the bootloader. Just press 'Confirm and run' here. Once it's done, press continue here. - command: fastboot_oem_unlock - - type: confirm_button content: > - At this point the device may display on-screen prompts which will require interaction to continue the process of unlocking the bootloader. - Please take whatever actions the device asks you to to proceed. - - type: call_button - content: To finish the unlocking, the phone needs to reboot. Just press 'Confirm and run' here to reboot. Then continue. - command: fastboot_reboot + In this step you actually unlock the bootloader. Just press 'Confirm and run' here. The phone will automatically reboot and reformat. + Once it's done, press continue here. + command: fastboot_oem_unlock - type: confirm_button - content: The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. + content: > + The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. boot_recovery: - type: call_button content: > diff --git a/openandroidinstaller/assets/configs/coral.yaml b/openandroidinstaller/assets/configs/coral.yaml index 6ce2af96..119d5ac6 100644 --- a/openandroidinstaller/assets/configs/coral.yaml +++ b/openandroidinstaller/assets/configs/coral.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Google Pixel 4 XL + is_ab_device: true device_code: coral supported_device_codes: - coral diff --git a/openandroidinstaller/assets/configs/crosshatch.yaml b/openandroidinstaller/assets/configs/crosshatch.yaml index 5a2ced42..a612f210 100644 --- a/openandroidinstaller/assets/configs/crosshatch.yaml +++ b/openandroidinstaller/assets/configs/crosshatch.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Google Pixel 3 XL + is_ab_device: true device_code: crosshatch supported_device_codes: - crosshatch diff --git a/openandroidinstaller/assets/configs/crownlte.yaml b/openandroidinstaller/assets/configs/crownlte.yaml index 58a5a55b..00625586 100644 --- a/openandroidinstaller/assets/configs/crownlte.yaml +++ b/openandroidinstaller/assets/configs/crownlte.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy Note 9 + is_ab_device: false device_code: crownlte supported_device_codes: - crownlte diff --git a/openandroidinstaller/assets/configs/d1.yaml b/openandroidinstaller/assets/configs/d1.yaml index a85b70f4..61a9169b 100644 --- a/openandroidinstaller/assets/configs/d1.yaml +++ b/openandroidinstaller/assets/configs/d1.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy Note 10 + is_ab_device: false device_code: d1 supported_device_codes: - d1 diff --git a/openandroidinstaller/assets/configs/d2s.yaml b/openandroidinstaller/assets/configs/d2s.yaml index 0756e970..ffe15246 100644 --- a/openandroidinstaller/assets/configs/d2s.yaml +++ b/openandroidinstaller/assets/configs/d2s.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy Note 10+ + is_ab_device: false device_code: d2s supported_device_codes: - d2s diff --git a/openandroidinstaller/assets/configs/dre.yaml b/openandroidinstaller/assets/configs/dre.yaml index 1d93c8cd..7601b1c0 100644 --- a/openandroidinstaller/assets/configs/dre.yaml +++ b/openandroidinstaller/assets/configs/dre.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: OnePlus Nord N200 + is_ab_device: true device_code: dre supported_device_codes: - dre @@ -16,17 +17,13 @@ steps: Press 'Confirm and run' to reboot into the bootloader. command: adb_reboot_bootloader - type: call_button - content: In this step you actually unlock the bootloader. Just press 'Confirm and run' here. Once it's done, press continue here. - command: fastboot_oem_unlock - - type: confirm_button content: > - At this point the device may display on-screen prompts which will require interaction to continue the process of unlocking the bootloader. - Please take whatever actions the device asks you to to proceed. - - type: call_button - content: To finish the unlocking, the phone needs to reboot. Just press 'Confirm and run' here to reboot. Then continue. - command: fastboot_reboot + In this step you actually unlock the bootloader. Just press 'Confirm and run' here. The phone will automatically reboot and reformat. + Once it's done, press continue here. + command: fastboot_oem_unlock - type: confirm_button - content: The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. + content: > + The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. boot_recovery: - type: call_button content: > @@ -36,13 +33,14 @@ steps: command: adb_reboot_bootloader - type: call_button img: twrp-start.jpeg - content: Boot a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. + content: > + Boot a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. command: fastboot_boot_recovery - 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. + command: adb_twrp_copy_partitions - type: call_button img: twrp-start.jpeg content: > diff --git a/openandroidinstaller/assets/configs/dumpling.yaml b/openandroidinstaller/assets/configs/dumpling.yaml index 57b1b55a..e35645f7 100644 --- a/openandroidinstaller/assets/configs/dumpling.yaml +++ b/openandroidinstaller/assets/configs/dumpling.yaml @@ -1,6 +1,7 @@ metadata: maintainer: SirRGB device_name: OnePlus 5T + is_ab_device: false device_code: dumpling supported_device_codes: - dumpling @@ -15,17 +16,13 @@ steps: Press 'Confirm and run' to reboot into the bootloader. command: adb_reboot_bootloader - type: call_button - content: In this step you actually unlock the bootloader. Just press 'Confirm and run' here. Once it's done, press continue here. - command: fastboot_oem_unlock - - type: confirm_button content: > - At this point the device may display on-screen prompts which will require interaction to continue the process of unlocking the bootloader. - Please take whatever actions the device asks you to to proceed. - - type: call_button - content: To finish the unlocking, the phone needs to reboot. Just press 'Confirm and run' here to reboot. Then continue. - command: fastboot_reboot + In this step you actually unlock the bootloader. Just press 'Confirm and run' here. The phone will automatically reboot and reformat. + Once it's done, press continue here. + command: fastboot_oem_unlock - type: confirm_button - content: The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. + content: > + The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. boot_recovery: - type: call_button content: > @@ -35,5 +32,6 @@ steps: command: adb_reboot_bootloader - type: call_button img: twrp-start.jpeg - content: Boot a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. + content: > + Boot a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. command: fastboot_boot_recovery \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/enchilada.yaml b/openandroidinstaller/assets/configs/enchilada.yaml index e5d6d395..cb859bb0 100644 --- a/openandroidinstaller/assets/configs/enchilada.yaml +++ b/openandroidinstaller/assets/configs/enchilada.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: OnePlus 6 + is_ab_device: true device_code: enchilada supported_device_codes: - enchilada @@ -16,17 +17,13 @@ steps: Press 'Confirm and run' to reboot into the bootloader. command: adb_reboot_bootloader - type: call_button - content: In this step you actually unlock the bootloader. Just press 'Confirm and run' here. Once it's done, press continue here. - command: fastboot_oem_unlock - - type: confirm_button content: > - At this point the device may display on-screen prompts which will require interaction to continue the process of unlocking the bootloader. - Please take whatever actions the device asks you to to proceed. - - type: call_button - content: To finish the unlocking, the phone needs to reboot. Just press 'Confirm and run' here to reboot. Then continue. - command: fastboot_reboot + In this step you actually unlock the bootloader. Just press 'Confirm and run' here. The phone will automatically reboot and reformat. + Once it's done, press continue here. + command: fastboot_oem_unlock - type: confirm_button - content: The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. + content: > + The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. boot_recovery: - type: call_button content: > @@ -36,13 +33,14 @@ steps: command: adb_reboot_bootloader - type: call_button img: twrp-start.jpeg - content: Boot a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. + content: > + Boot a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. command: fastboot_boot_recovery - 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. + command: adb_twrp_copy_partitions - type: call_button img: twrp-start.jpeg content: > diff --git a/openandroidinstaller/assets/configs/evert.yaml b/openandroidinstaller/assets/configs/evert.yaml index cf7d336b..08bb1726 100644 --- a/openandroidinstaller/assets/configs/evert.yaml +++ b/openandroidinstaller/assets/configs/evert.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Motorola moto g6 plus + is_ab_device: true device_code: evert supported_device_codes: - evert diff --git a/openandroidinstaller/assets/configs/fajita.yaml b/openandroidinstaller/assets/configs/fajita.yaml index f4e6af1f..e575408b 100644 --- a/openandroidinstaller/assets/configs/fajita.yaml +++ b/openandroidinstaller/assets/configs/fajita.yaml @@ -1,10 +1,12 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: OnePlus 6T + is_ab_device: true device_code: fajita supported_device_codes: - fajita - OnePlus6T + - OnePlus6TSingle requirements: android: 11 steps: @@ -16,17 +18,13 @@ steps: Press 'Confirm and run' to reboot into the bootloader. command: adb_reboot_bootloader - type: call_button - content: In this step you actually unlock the bootloader. Just press 'Confirm and run' here. Once it's done, press continue here. - command: fastboot_oem_unlock - - type: confirm_button content: > - At this point the device may display on-screen prompts which will require interaction to continue the process of unlocking the bootloader. - Please take whatever actions the device asks you to to proceed. - - type: call_button - content: To finish the unlocking, the phone needs to reboot. Just press 'Confirm and run' here to reboot. Then continue. - command: fastboot_reboot + In this step you actually unlock the bootloader. Just press 'Confirm and run' here. The phone will automatically reboot and reformat. + Once it's done, press continue here. + command: fastboot_oem_unlock - type: confirm_button - content: The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. + content: > + The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. boot_recovery: - type: call_button content: > @@ -36,15 +34,17 @@ steps: command: adb_reboot_bootloader - type: call_button img: twrp-start.jpeg - content: Boot a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. + content: > + Boot a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue. command: fastboot_boot_recovery - 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. + command: adb_twrp_copy_partitions - type: call_button img: twrp-start.jpeg command: fastboot_boot_recovery content: > - Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. \ No newline at end of file + Now we need to boot into recovery again. Press run and when you see the TWRP screen you can continue. + command: fastboot_boot_recovery \ No newline at end of file diff --git a/openandroidinstaller/assets/configs/flame.yaml b/openandroidinstaller/assets/configs/flame.yaml index 912074e3..045753ac 100644 --- a/openandroidinstaller/assets/configs/flame.yaml +++ b/openandroidinstaller/assets/configs/flame.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Pixel 4 + is_ab_device: true device_code: flame supported_device_codes: - flame diff --git a/openandroidinstaller/assets/configs/greatlte.yaml b/openandroidinstaller/assets/configs/greatlte.yaml index f5b48cf3..d2e4d476 100644 --- a/openandroidinstaller/assets/configs/greatlte.yaml +++ b/openandroidinstaller/assets/configs/greatlte.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Michel Memeteau (freechelmi) device_name: Samsung Galaxy note 8 + is_ab_device: false device_code: greatlte supported_device_codes: - greatlte diff --git a/openandroidinstaller/assets/configs/griffin.yaml b/openandroidinstaller/assets/configs/griffin.yaml index bddef411..391857fb 100644 --- a/openandroidinstaller/assets/configs/griffin.yaml +++ b/openandroidinstaller/assets/configs/griffin.yaml @@ -1,6 +1,7 @@ metadata: maintainer: SirRGB device_name: Motorola Moto Z + is_ab_device: false device_code: griffin supported_device_codes: - griffin diff --git a/openandroidinstaller/assets/configs/guacamole.yaml b/openandroidinstaller/assets/configs/guacamole.yaml index 7aeb4e44..d1d5bd78 100644 --- a/openandroidinstaller/assets/configs/guacamole.yaml +++ b/openandroidinstaller/assets/configs/guacamole.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: OnePlus 7 Pro + is_ab_device: true device_code: guacamole supported_device_codes: - guacamole @@ -16,17 +17,13 @@ steps: Press 'Confirm and run' to reboot into the bootloader. command: adb_reboot_bootloader - type: call_button - content: In this step you actually unlock the bootloader. Just press 'Confirm and run' here. Once it's done, press continue here. - command: fastboot_oem_unlock - - type: confirm_button content: > - At this point the device may display on-screen prompts which will require interaction to continue the process of unlocking the bootloader. - Please take whatever actions the device asks you to to proceed. - - type: call_button - content: To finish the unlocking, the phone needs to reboot. Just press 'Confirm and run' here to reboot. Then continue. - command: fastboot_reboot + In this step you actually unlock the bootloader. Just press 'Confirm and run' here. The phone will automatically reboot and reformat. + Once it's done, press continue here. + command: fastboot_oem_unlock - type: confirm_button - content: The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. + content: > + The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. boot_recovery: - type: call_button content: > diff --git a/openandroidinstaller/assets/configs/guacamoleb.yaml b/openandroidinstaller/assets/configs/guacamoleb.yaml index 32571b38..7696427c 100644 --- a/openandroidinstaller/assets/configs/guacamoleb.yaml +++ b/openandroidinstaller/assets/configs/guacamoleb.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: OnePlus 7 + is_ab_device: true device_code: guacamoleb supported_device_codes: - guacamoleb @@ -16,17 +17,13 @@ steps: Press 'Confirm and run' to reboot into the bootloader. command: adb_reboot_bootloader - type: call_button - content: In this step you actually unlock the bootloader. Just press 'Confirm and run' here. Once it's done, press continue here. - command: fastboot_oem_unlock - - type: confirm_button content: > - At this point the device may display on-screen prompts which will require interaction to continue the process of unlocking the bootloader. - Please take whatever actions the device asks you to to proceed. - - type: call_button - content: To finish the unlocking, the phone needs to reboot. Just press 'Confirm and run' here to reboot. Then continue. - command: fastboot_reboot + In this step you actually unlock the bootloader. Just press 'Confirm and run' here. The phone will automatically reboot and reformat. + Once it's done, press continue here. + command: fastboot_oem_unlock - type: confirm_button - content: The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. + content: > + The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. boot_recovery: - type: call_button content: > diff --git a/openandroidinstaller/assets/configs/hero2lte.yaml b/openandroidinstaller/assets/configs/hero2lte.yaml index 6928af5a..c544c1e7 100644 --- a/openandroidinstaller/assets/configs/hero2lte.yaml +++ b/openandroidinstaller/assets/configs/hero2lte.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy S7 Edge + is_ab_device: false device_code: hero2lte supported_device_codes: - hero2lte diff --git a/openandroidinstaller/assets/configs/herolte.yaml b/openandroidinstaller/assets/configs/herolte.yaml index 8bea5fe7..25f6f9f5 100644 --- a/openandroidinstaller/assets/configs/herolte.yaml +++ b/openandroidinstaller/assets/configs/herolte.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy S7 + is_ab_device: false device_code: herolte supported_device_codes: - herolte diff --git a/openandroidinstaller/assets/configs/hltetmo.yaml b/openandroidinstaller/assets/configs/hltetmo.yaml index 57776fa1..b9fbc135 100644 --- a/openandroidinstaller/assets/configs/hltetmo.yaml +++ b/openandroidinstaller/assets/configs/hltetmo.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy Note 3 LTE (N900T/V/W8) + is_ab_device: false device_code: hltetmo supported_device_codes: - hltetmo diff --git a/openandroidinstaller/assets/configs/hotdog.yaml b/openandroidinstaller/assets/configs/hotdog.yaml index a0ab6c9b..850965c8 100644 --- a/openandroidinstaller/assets/configs/hotdog.yaml +++ b/openandroidinstaller/assets/configs/hotdog.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: OnePlus 7T Pro + is_ab_device: true device_code: hotdog supported_device_codes: - hotdog @@ -16,17 +17,13 @@ steps: Press 'Confirm and run' to reboot into the bootloader. command: adb_reboot_bootloader - type: call_button - content: In this step you actually unlock the bootloader. Just press 'Confirm and run' here. Once it's done, press continue here. - command: fastboot_oem_unlock - - type: confirm_button content: > - At this point the device may display on-screen prompts which will require interaction to continue the process of unlocking the bootloader. - Please take whatever actions the device asks you to to proceed. - - type: call_button - content: To finish the unlocking, the phone needs to reboot. Just press 'Confirm and run' here to reboot. Then continue. - command: fastboot_reboot + In this step you actually unlock the bootloader. Just press 'Confirm and run' here. The phone will automatically reboot and reformat. + Once it's done, press continue here. + command: fastboot_oem_unlock - type: confirm_button - content: The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. + content: > + The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. boot_recovery: - type: call_button content: > diff --git a/openandroidinstaller/assets/configs/hotdogb.yaml b/openandroidinstaller/assets/configs/hotdogb.yaml index 4b8661a6..6bf44a55 100644 --- a/openandroidinstaller/assets/configs/hotdogb.yaml +++ b/openandroidinstaller/assets/configs/hotdogb.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: OnePlus 7T + is_ab_device: true device_code: hotdogb supported_device_codes: - hotdogb @@ -16,17 +17,13 @@ steps: Press 'Confirm and run' to reboot into the bootloader. command: adb_reboot_bootloader - type: call_button - content: In this step you actually unlock the bootloader. Just press 'Confirm and run' here. Once it's done, press continue here. - command: fastboot_oem_unlock - - type: confirm_button content: > - At this point the device may display on-screen prompts which will require interaction to continue the process of unlocking the bootloader. - Please take whatever actions the device asks you to to proceed. - - type: call_button - content: To finish the unlocking, the phone needs to reboot. Just press 'Confirm and run' here to reboot. Then continue. - command: fastboot_reboot + In this step you actually unlock the bootloader. Just press 'Confirm and run' here. The phone will automatically reboot and reformat. + Once it's done, press continue here. + command: fastboot_oem_unlock - type: confirm_button - content: The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. + content: > + The bootloader is now unlocked. Since the device resets completely, you will need to re-enable Developer Options and USB debugging to continue. boot_recovery: - type: call_button content: > diff --git a/openandroidinstaller/assets/configs/j7elte.yaml b/openandroidinstaller/assets/configs/j7elte.yaml index 32d4bc0c..49489de6 100644 --- a/openandroidinstaller/assets/configs/j7elte.yaml +++ b/openandroidinstaller/assets/configs/j7elte.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy J7 (2015) + is_ab_device: false device_code: j7elte supported_device_codes: - j7elte diff --git a/openandroidinstaller/assets/configs/kiev.yaml b/openandroidinstaller/assets/configs/kiev.yaml index 773c3f67..e8e810e1 100644 --- a/openandroidinstaller/assets/configs/kiev.yaml +++ b/openandroidinstaller/assets/configs/kiev.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Motorola moto g 5G / one 5G ace + is_ab_device: true device_code: kiev supported_device_codes: - kiev diff --git a/openandroidinstaller/assets/configs/kirin.yaml b/openandroidinstaller/assets/configs/kirin.yaml index 2e58a27c..f7c5893c 100644 --- a/openandroidinstaller/assets/configs/kirin.yaml +++ b/openandroidinstaller/assets/configs/kirin.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Sony Xperia 10 + is_ab_device: true device_code: kirin supported_device_codes: - kirin diff --git a/openandroidinstaller/assets/configs/mermaid.yaml b/openandroidinstaller/assets/configs/mermaid.yaml index b6375ca6..676f605d 100644 --- a/openandroidinstaller/assets/configs/mermaid.yaml +++ b/openandroidinstaller/assets/configs/mermaid.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Sony Xperia 10 Plus + is_ab_device: true device_code: mermaid supported_device_codes: - mermaid diff --git a/openandroidinstaller/assets/configs/nairo.yaml b/openandroidinstaller/assets/configs/nairo.yaml index 6d1d8dfc..3a8dbad8 100644 --- a/openandroidinstaller/assets/configs/nairo.yaml +++ b/openandroidinstaller/assets/configs/nairo.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Motorola moto g 5G plus / one 5G + is_ab_device: true device_code: nairo supported_device_codes: - nairo diff --git a/openandroidinstaller/assets/configs/ocean.yaml b/openandroidinstaller/assets/configs/ocean.yaml index 445f3241..cb99db52 100644 --- a/openandroidinstaller/assets/configs/ocean.yaml +++ b/openandroidinstaller/assets/configs/ocean.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Motorola Moto G7 power + is_ab_device: true device_code: ocean supported_device_codes: - ocean diff --git a/openandroidinstaller/assets/configs/pioneer.yaml b/openandroidinstaller/assets/configs/pioneer.yaml index d78ff292..b24868dd 100644 --- a/openandroidinstaller/assets/configs/pioneer.yaml +++ b/openandroidinstaller/assets/configs/pioneer.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Sony Xperia XA2 + is_ab_device: true device_code: pioneer supported_device_codes: - pioneer diff --git a/openandroidinstaller/assets/configs/racer.yaml b/openandroidinstaller/assets/configs/racer.yaml index 81e832f0..561632d0 100644 --- a/openandroidinstaller/assets/configs/racer.yaml +++ b/openandroidinstaller/assets/configs/racer.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Motorola edge + is_ab_device: true device_code: racer supported_device_codes: - racer diff --git a/openandroidinstaller/assets/configs/redfin.yaml b/openandroidinstaller/assets/configs/redfin.yaml index 191feb60..9cb84672 100644 --- a/openandroidinstaller/assets/configs/redfin.yaml +++ b/openandroidinstaller/assets/configs/redfin.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Pixel 5 + is_ab_device: true device_code: redfin supported_device_codes: - redfin diff --git a/openandroidinstaller/assets/configs/s3ve3g.yaml b/openandroidinstaller/assets/configs/s3ve3g.yaml index 19dbf51e..7fb97bf4 100644 --- a/openandroidinstaller/assets/configs/s3ve3g.yaml +++ b/openandroidinstaller/assets/configs/s3ve3g.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy S III Neo + is_ab_device: false device_code: s3ve3g supported_device_codes: - s3ve3g diff --git a/openandroidinstaller/assets/configs/sargo.yaml b/openandroidinstaller/assets/configs/sargo.yaml index bf19826c..28d8fe04 100644 --- a/openandroidinstaller/assets/configs/sargo.yaml +++ b/openandroidinstaller/assets/configs/sargo.yaml @@ -1,7 +1,8 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Pixel 3a - device_code: sargo + is_ab_device: true + device_code: sargo supported_device_codes: - sargo requirements: diff --git a/openandroidinstaller/assets/configs/starlte.yaml b/openandroidinstaller/assets/configs/starlte.yaml index bf8d5af1..2d6fc875 100644 --- a/openandroidinstaller/assets/configs/starlte.yaml +++ b/openandroidinstaller/assets/configs/starlte.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy S9 + is_ab_device: false device_code: starlte supported_device_codes: - starlte diff --git a/openandroidinstaller/assets/configs/sunfish.yaml b/openandroidinstaller/assets/configs/sunfish.yaml index 8b8a9df8..0d92f669 100644 --- a/openandroidinstaller/assets/configs/sunfish.yaml +++ b/openandroidinstaller/assets/configs/sunfish.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Pixel 4a + is_ab_device: true device_code: sunfish supported_device_codes: - sunfish diff --git a/openandroidinstaller/assets/configs/taimen.yaml b/openandroidinstaller/assets/configs/taimen.yaml index c955b30d..c900636a 100644 --- a/openandroidinstaller/assets/configs/taimen.yaml +++ b/openandroidinstaller/assets/configs/taimen.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Google Pixel 2 XL + is_ab_device: true device_code: taimen supported_device_codes: - taimen diff --git a/openandroidinstaller/assets/configs/walleye.yaml b/openandroidinstaller/assets/configs/walleye.yaml index 2f3d3ea4..6f35cfbd 100644 --- a/openandroidinstaller/assets/configs/walleye.yaml +++ b/openandroidinstaller/assets/configs/walleye.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Google Pixel 2 + is_ab_device: true device_code: walleye supported_device_codes: - walleye diff --git a/openandroidinstaller/assets/configs/yuga.yaml b/openandroidinstaller/assets/configs/yuga.yaml index f7905f0d..82d68222 100644 --- a/openandroidinstaller/assets/configs/yuga.yaml +++ b/openandroidinstaller/assets/configs/yuga.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Sony Xperia Z + is_ab_device: false device_code: yuga supported_device_codes: - yuga diff --git a/openandroidinstaller/assets/configs/z3.yaml b/openandroidinstaller/assets/configs/z3.yaml index 1f3a3872..649de2f0 100644 --- a/openandroidinstaller/assets/configs/z3.yaml +++ b/openandroidinstaller/assets/configs/z3.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Sony Xperia Z3 + is_ab_device: false device_code: z3 supported_device_codes: - z3 diff --git a/openandroidinstaller/assets/configs/zerofltexx.yaml b/openandroidinstaller/assets/configs/zerofltexx.yaml index d38f9072..04a6abd9 100644 --- a/openandroidinstaller/assets/configs/zerofltexx.yaml +++ b/openandroidinstaller/assets/configs/zerofltexx.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy S6 + is_ab_device: false device_code: zerofltexx supported_device_codes: - zerofltexx diff --git a/openandroidinstaller/assets/configs/zeroltexx.yaml b/openandroidinstaller/assets/configs/zeroltexx.yaml index 5336f7de..00ea15ea 100644 --- a/openandroidinstaller/assets/configs/zeroltexx.yaml +++ b/openandroidinstaller/assets/configs/zeroltexx.yaml @@ -1,6 +1,7 @@ metadata: maintainer: Tobias Sterbak (tsterbak) device_name: Samsung Galaxy S6 Edge + is_ab_device: false device_code: zeroltexx supported_device_codes: - zeroltexx diff --git a/openandroidinstaller/installer_config.py b/openandroidinstaller/installer_config.py index 0707423b..70ca5a01 100644 --- a/openandroidinstaller/installer_config.py +++ b/openandroidinstaller/installer_config.py @@ -61,6 +61,7 @@ def __init__( self.metadata = metadata self.requirements = requirements self.device_code = metadata.get("device_code") + self.is_ab = metadata.get("is_ab_device", False) self.supported_device_codes = metadata.get("supported_device_codes") self.twrp_link = metadata.get("twrp-link") @@ -161,6 +162,7 @@ def validate_config(config: str) -> bool: "metadata": { "maintainer": str, "device_name": str, + "is_ab_device": bool, "device_code": str, "supported_device_codes": [str], schema.Optional("twrp-link"): str, diff --git a/openandroidinstaller/openandroidinstaller.py b/openandroidinstaller/openandroidinstaller.py index a04bea42..1862c3fd 100644 --- a/openandroidinstaller/openandroidinstaller.py +++ b/openandroidinstaller/openandroidinstaller.py @@ -31,7 +31,6 @@ Icon, Image, Page, - Text, TextButton, UserControl, colors, @@ -39,6 +38,9 @@ ) from loguru import logger +from styles import ( + Text, +) from app_state import AppState from views import ( SelectFilesView, diff --git a/openandroidinstaller/styles.py b/openandroidinstaller/styles.py new file mode 100644 index 00000000..6d8f8aa8 --- /dev/null +++ b/openandroidinstaller/styles.py @@ -0,0 +1,30 @@ +"""This module contains different pre-configured style elements for building the application.""" + +# This file is part of OpenAndroidInstaller. +# OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of +# the GNU General Public License as published by the Free Software Foundation, +# either version 3 of the License, or (at your option) any later version. + +# OpenAndroidInstaller is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along with OpenAndroidInstaller. +# If not, see .""" +# Author: Tobias Sterbak + +import flet as ft + + +class Text(ft.Text): + """Text element to replace the default text element from flet but is selectable.""" + + def __init__(self, *args, **kwargs): + super().__init__(selectable=True, *args, **kwargs) + + +class Markdown(ft.Markdown): + """Markdown element to replace the markdown element from flet but is selectable.""" + + def __init__(self, *args, **kwargs): + super().__init__(selectable=True, *args, **kwargs) diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index 097c35e6..c8b95dfd 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -468,43 +468,3 @@ def search_device(platform: str, bin_path: Path) -> Optional[str]: except CalledProcessError: logger.error("Failed to detect a device.") return None - - -def check_ab_partition(platform: str, bin_path: Path) -> Optional[bool]: - """Figure out, if its an a/b-partitioned device.""" - logger.info(f"Run on {platform} with {bin_path}...") - try: - # check if ab device - if platform in ("linux", "darwin"): - output = check_output( - [ - str(bin_path.joinpath(Path("adb"))), - "shell", - "getprop", - "|", - "grep", - "ro.boot.slot_suffix", - ], - stderr=STDOUT, - ).decode() - elif platform in ("windows", "win32"): - output = check_output( - [ - str(bin_path.joinpath(Path("adb.exe"))), - "shell", - "getprop", - "|", - "findstr", - "ro.boot.slot_suffix", - ], - stderr=STDOUT, - shell=True, - ).decode() - else: - raise Exception(f"Unknown platform {platform}.") - logger.info(output) - logger.info("This is an a/b-partitioned device.") - return True - except CalledProcessError: - logger.info("This is not an a/b-partitioned device.") - return False diff --git a/openandroidinstaller/utils.py b/openandroidinstaller/utils.py index ea34997f..0c17baf5 100644 --- a/openandroidinstaller/utils.py +++ b/openandroidinstaller/utils.py @@ -22,15 +22,16 @@ def get_download_link(devicecode: str) -> Optional[str]: """Check if a lineageOS version for this device exists on download.lineageos.com and return the respective download link.""" - url = f"https://download.lineageos.org/{devicecode}" + url = f"https://download.lineageos.org/api/v2/devices/{devicecode}" try: logger.info(f"Checking {url}") # Get Url res = requests.get(url, timeout=5) # if the request succeeds if res.status_code == 200: - logger.info(f"{url} exists.") - return url + download_url = f"https://download.lineageos.org/devices/{devicecode}/builds" + logger.info(f"{download_url} exists.") + return download_url else: logger.info(f"{url} doesn't exist, status_code: {res.status_code}") return None diff --git a/openandroidinstaller/views/addon_view.py b/openandroidinstaller/views/addon_view.py index d9d89333..93171ece 100644 --- a/openandroidinstaller/views/addon_view.py +++ b/openandroidinstaller/views/addon_view.py @@ -23,9 +23,7 @@ ElevatedButton, OutlinedButton, FilledButton, - Markdown, Row, - Text, colors, icons, TextButton, @@ -35,6 +33,10 @@ ) from flet.buttons import CountinuosRectangleBorder +from styles import ( + Text, + Markdown, +) from views import BaseView from app_state import AppState from widgets import get_title, confirm_button diff --git a/openandroidinstaller/views/install_addons_view.py b/openandroidinstaller/views/install_addons_view.py index 7bb71e42..547ea540 100644 --- a/openandroidinstaller/views/install_addons_view.py +++ b/openandroidinstaller/views/install_addons_view.py @@ -21,10 +21,13 @@ Column, ElevatedButton, Row, - Text, icons, Switch, colors, +) + +from styles import ( + Text, Markdown, ) @@ -158,7 +161,7 @@ def run_install_addons(self, e): for line in adb_twrp_install_addons( addons=self.state.addon_paths, bin_path=self.state.bin_path, - is_ab=self.state.is_ab, + is_ab=self.state.config.is_ab, ): # write the line to advanced output terminal self.terminal_box.write_line(line) diff --git a/openandroidinstaller/views/install_view.py b/openandroidinstaller/views/install_view.py index 29283fab..fca0e728 100644 --- a/openandroidinstaller/views/install_view.py +++ b/openandroidinstaller/views/install_view.py @@ -21,10 +21,13 @@ Column, ElevatedButton, Row, - Text, icons, Switch, colors, +) + +from styles import ( + Text, Markdown, ) @@ -189,7 +192,7 @@ def run_install(self, e): config_path=self.state.config_path, bin_path=self.state.bin_path, install_addons=self.state.install_addons, - is_ab=self.state.is_ab, + is_ab=self.state.config.is_ab, recovery=self.state.recovery_path, ): # write the line to advanced output terminal diff --git a/openandroidinstaller/views/requirements_view.py b/openandroidinstaller/views/requirements_view.py index 327649d6..3d3d7efd 100644 --- a/openandroidinstaller/views/requirements_view.py +++ b/openandroidinstaller/views/requirements_view.py @@ -22,17 +22,19 @@ Container, Divider, ElevatedButton, - Markdown, Row, colors, OutlinedButton, - Text, icons, TextButton, AlertDialog, ) from flet.buttons import CountinuosRectangleBorder +from styles import ( + Text, + Markdown, +) from views import BaseView from app_state import AppState from widgets import get_title diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index ac65fd5d..0f851241 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -23,9 +23,7 @@ ElevatedButton, OutlinedButton, FilledButton, - Markdown, Row, - Text, colors, icons, TextButton, @@ -35,6 +33,10 @@ ) from flet.buttons import CountinuosRectangleBorder +from styles import ( + Text, + Markdown, +) from views import BaseView from app_state import AppState from widgets import get_title, confirm_button diff --git a/openandroidinstaller/views/start_view.py b/openandroidinstaller/views/start_view.py index abf64064..b2c912b5 100644 --- a/openandroidinstaller/views/start_view.py +++ b/openandroidinstaller/views/start_view.py @@ -25,19 +25,21 @@ ElevatedButton, OutlinedButton, FilledButton, - Markdown, Row, - Text, TextButton, colors, icons, ) from flet.buttons import CountinuosRectangleBorder +from styles import ( + Text, + Markdown, +) from views import BaseView from app_state import AppState from widgets import get_title -from tooling import search_device, check_ab_partition +from tooling import search_device class StartView(BaseView): @@ -213,7 +215,7 @@ def search_devices(self, e): # search the device if self.state.test: # this only happens for testing - device_code, is_ab = self.state.test_config, True + device_code = self.state.test_config logger.info( f"Running search in development mode and loading config {device_code}.yaml." ) @@ -221,9 +223,6 @@ def search_devices(self, e): device_code = search_device( platform=self.state.platform, bin_path=self.state.bin_path ) - is_ab = check_ab_partition( - platform=self.state.platform, bin_path=self.state.bin_path - ) if device_code: self.device_name.value = device_code self.device_name.color = colors.BLACK @@ -239,8 +238,6 @@ def search_devices(self, e): self.device_name.value = device_code # load config from file self.state.load_config(device_code) - # write ab-info to state - self.state.is_ab = is_ab if self.state.config: device_name = self.state.config.metadata.get( "device_name", "No device name in config." @@ -257,6 +254,9 @@ def search_devices(self, e): f"{device_name} (code: {self.state.config.device_code})" ) self.device_name.color = colors.GREEN + # if there are no steps for bootloader unlocking, assume there is nothing to do and toggle the switch + if len(self.state.config.unlock_bootloader) == 0: + self.bootloader_switch.value = True else: # failed to load config logger.error(f"Failed to load config for {device_code}.") diff --git a/openandroidinstaller/views/step_view.py b/openandroidinstaller/views/step_view.py index eb484eb3..0fd5966a 100644 --- a/openandroidinstaller/views/step_view.py +++ b/openandroidinstaller/views/step_view.py @@ -22,13 +22,17 @@ Column, ElevatedButton, Row, - Text, icons, TextField, Switch, colors, ) + +from styles import ( + Text, +) + from views import BaseView from installer_config import Step from app_state import AppState @@ -220,7 +224,7 @@ def call_to_phone(self, e, command: str): "fastboot_boot_recovery": partial( fastboot_boot_recovery, recovery=self.state.recovery_path, - is_ab=self.state.is_ab, + is_ab=self.state.config.is_ab, ), "fastboot_flash_boot": partial( fastboot_flash_boot, diff --git a/openandroidinstaller/views/success_view.py b/openandroidinstaller/views/success_view.py index 30a1dc8a..697b59d7 100644 --- a/openandroidinstaller/views/success_view.py +++ b/openandroidinstaller/views/success_view.py @@ -17,10 +17,12 @@ from flet import ( ElevatedButton, Row, +) + +from styles import ( Text, Markdown, ) - from views import BaseView from app_state import AppState from widgets import get_title diff --git a/openandroidinstaller/views/welcome_view.py b/openandroidinstaller/views/welcome_view.py index 59de038b..a3560ea7 100644 --- a/openandroidinstaller/views/welcome_view.py +++ b/openandroidinstaller/views/welcome_view.py @@ -18,12 +18,15 @@ from flet import ( Divider, ElevatedButton, - Markdown, Row, - Text, icons, ) +from styles import ( + Text, + Markdown, +) + from views import BaseView from app_state import AppState from widgets import get_title diff --git a/openandroidinstaller/widgets.py b/openandroidinstaller/widgets.py index d57c006f..c488d36c 100644 --- a/openandroidinstaller/widgets.py +++ b/openandroidinstaller/widgets.py @@ -26,7 +26,6 @@ ProgressRing, ProgressBar, Row, - Text, alignment, icons, IconButton, @@ -34,6 +33,10 @@ Column, ) +from styles import ( + Text, +) + class TerminalBox(UserControl): def __init__(self, expand: bool = True, visible: bool = False): @@ -43,7 +46,7 @@ def __init__(self, expand: bool = True, visible: bool = False): def build(self): self._box = Container( content=Column( - controls=[Text("", selectable=True)], + controls=[Text("")], scroll="auto", expand=True, auto_scroll=True, diff --git a/tests/test_tooling.py b/tests/test_tooling.py index c66f6e97..ffcaeb5a 100644 --- a/tests/test_tooling.py +++ b/tests/test_tooling.py @@ -19,7 +19,6 @@ from openandroidinstaller.tooling import ( adb_reboot, search_device, - check_ab_partition, ) @@ -96,43 +95,3 @@ def patched_check_output(*args, **kwargs): ) assert device_code == None - - -def test_check_ab_device_is_ab(mocker): - """Test if checking for ab device works fine.""" - mocker.patch( - "openandroidinstaller.tooling.check_output", - return_value=b"[ro.boot.slot_suffix]: [_b]", - ) - - # test linux - is_ab = check_ab_partition( - platform="linux", bin_path=Path("openandroidinstaller/bin/") - ) - - assert is_ab - - # test windows - is_ab = check_ab_partition( - platform="windows", bin_path=Path("openandroidinstaller/bin/") - ) - - assert is_ab - - -def test_check_ab_device_not_ab(mocker): - """Test if checking for ab device returns False if it fails.""" - - def patched_check_output(*args, **kwargs): - raise CalledProcessError(returncode=1, cmd="output is None") - - mocker.patch( - "openandroidinstaller.tooling.check_output", - patched_check_output, - ) - - is_ab = check_ab_partition( - platform="linux", bin_path=Path("openandroidinstaller/bin/") - ) - - assert not is_ab