From 76442946bbb18b68835cf01d8a63dc988eada348 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Thu, 27 Jul 2023 22:23:49 +0200 Subject: [PATCH 001/102] Upgraded actions --- .github/workflows/build-release.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index e00a8c1f..dd71cfa7 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -14,8 +14,8 @@ jobs: matrix: os: ['ubuntu-20.04', 'ubuntu-latest'] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: 3.9 - run: pip install -r requirements.txt @@ -32,8 +32,8 @@ jobs: matrix: os: ['ubuntu-20.04', 'ubuntu-latest', 'macos-latest'] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: 3.9 - run: pip install -r requirements.txt @@ -48,8 +48,8 @@ jobs: needs: ci runs-on: 'windows-latest' steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: 3.9 - run: pip install -r requirements.txt @@ -66,7 +66,7 @@ jobs: - build-windows runs-on: 'ubuntu-latest' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download artifact uses: actions/download-artifact@v3 - name: Display structure of downloaded files From af662daa68140f40762d40118d38ec8d8b44e354 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Thu, 27 Jul 2023 22:24:06 +0200 Subject: [PATCH 002/102] Upgraded python version --- .github/workflows/build-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index dd71cfa7..288ee031 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.11 - run: pip install -r requirements.txt - run: python scripts/download-tools.py - run: black . @@ -35,7 +35,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.11 - run: pip install -r requirements.txt - run: python scripts/download-tools.py - run: python scripts/build.py @@ -51,7 +51,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.11 - run: pip install -r requirements.txt - run: python scripts/download-tools.py - run: python scripts/build.py From 3fee6e5dab273634b18c5e255de255014506b810 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Thu, 27 Jul 2023 22:24:51 +0200 Subject: [PATCH 003/102] Upgraded release action Switched to fork, which includes latest patches, until the main project is patched --- .github/workflows/build-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 288ee031..857d0f75 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -86,7 +86,7 @@ jobs: - name: Display structure of downloaded files run: ls -R - name: Create release - uses: marvinpinto/action-automatic-releases@latest + uses: dciborow/action-github-releases@latest if: startsWith(github.ref, 'refs/tags/') with: repo_token: ${{ secrets.GITHUB_TOKEN }} From 51c8ef4597b69800c063d964817c07e4d335501a Mon Sep 17 00:00:00 2001 From: MagicLike Date: Thu, 27 Jul 2023 22:36:46 +0200 Subject: [PATCH 004/102] Revert "Upgraded python version" This reverts commit af662daa68140f40762d40118d38ec8d8b44e354. --- .github/workflows/build-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 857d0f75..100926a5 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: 3.11 + python-version: 3.9 - run: pip install -r requirements.txt - run: python scripts/download-tools.py - run: black . @@ -35,7 +35,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: 3.11 + python-version: 3.9 - run: pip install -r requirements.txt - run: python scripts/download-tools.py - run: python scripts/build.py @@ -51,7 +51,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: 3.11 + python-version: 3.9 - run: pip install -r requirements.txt - run: python scripts/download-tools.py - run: python scripts/build.py From f285572ee291b0bc98d990156bfdb064acd34617 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Thu, 27 Jul 2023 22:53:13 +0200 Subject: [PATCH 005/102] Switch t oversion number on release action --- .github/workflows/build-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 100926a5..93cbe314 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -86,7 +86,7 @@ jobs: - name: Display structure of downloaded files run: ls -R - name: Create release - uses: dciborow/action-github-releases@latest + uses: dciborow/action-github-releases@v1 if: startsWith(github.ref, 'refs/tags/') with: repo_token: ${{ secrets.GITHUB_TOKEN }} From 29ac30b7ae849dfffb99cea06a25b9ee7bfdce03 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Thu, 27 Jul 2023 23:03:16 +0200 Subject: [PATCH 006/102] Updated version number --- .github/workflows/build-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 93cbe314..d71f33a6 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -86,7 +86,7 @@ jobs: - name: Display structure of downloaded files run: ls -R - name: Create release - uses: dciborow/action-github-releases@v1 + uses: dciborow/action-github-releases@v1.0.1 if: startsWith(github.ref, 'refs/tags/') with: repo_token: ${{ secrets.GITHUB_TOKEN }} From fda82729145896ef51171fcfceeb0cec647da723 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Fri, 28 Jul 2023 00:14:05 +0200 Subject: [PATCH 007/102] Upgraded manual build script --- .github/workflows/manual-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/manual-build.yml b/.github/workflows/manual-build.yml index 91a8cb3c..e54f9f71 100644 --- a/.github/workflows/manual-build.yml +++ b/.github/workflows/manual-build.yml @@ -13,8 +13,8 @@ jobs: os: ['ubuntu-20.04', 'ubuntu-latest', 'macos-latest', 'windows-latest'] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: 3.9 - run: pip install -r requirements.txt From a6dfa9e3d943aa251931df23147a6c48d67f296d Mon Sep 17 00:00:00 2001 From: Heus Sueh Date: Sun, 30 Jul 2023 12:27:37 -0300 Subject: [PATCH 008/102] Adding the doc folder --- README.md | 63 ++----------------- ...te_your_own_installation_configurations.md | 39 ++++++++++++ doc/Unlocking_the_bootloader.md | 6 ++ ...lding_the_application_for_your_platform.md | 14 +++++ 4 files changed, 63 insertions(+), 59 deletions(-) create mode 100644 doc/How_to_contribute_your_own_installation_configurations.md create mode 100644 doc/Unlocking_the_bootloader.md create mode 100644 doc/building_the_application_for_your_platform.md diff --git a/README.md b/README.md index a49b1a4a..652569ad 100644 --- a/README.md +++ b/README.md @@ -172,15 +172,6 @@ OnePlus | 9 | lemonade | | under development And more to come! -## Run OpenAndroidInstaller for development - -Currently development is only supported on Ubuntu Linux. MacOS and Windows should also work fine. You might need to install additional USB-drivers on Windows. - -1. Clone the main branch of this repository -2. Run `make poetry` and `make install` to install poetry to manage python and install the required dependencies like adb, fastboot and heimdall. -3. Run `make app` to start the desktop app from the source. - - ## Contributing All kinds of contributions are welcome. These include: @@ -192,62 +183,16 @@ All kinds of contributions are welcome. These include: - Add features and/or improve the code base. - Report bugs. +[How to contribute your own installation configurations](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/How_to_contribute_your_own_installation_configurations.md) +[How to build the application for your platform](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/building_the_application_for_your_platform.md) +[Unlocking the bootloader](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/Unlocking_the_bootloader.md) + More details on how to contribute can be found [here](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/CONTRIBUTING.md). Please have a look before opening an issue or starting to contribute. A detailed list can be found [here](https://openandroidinstaller.org/#contribute). -### How to contribute your own installation configurations - -If you want to use the tool for a non-supported smartphone, the fastest way is to adapt an [existing config file](https://github.com/openandroidinstaller-dev/openandroidinstaller/tree/main/openandroidinstaller/assets/configs). The file should be named after the official `device code` of the device. Add the code output by `adb shell getprop | grep ro.product.device` (when the devices is connected to the computer) as well as the official device code to the `supported_device_codes` list in the config. You can also get the device code by connecting the device to the computer and run OpenAndroidInstaller to detect the device. - -**To test your config file with the executable** without using the developer setup, place it in the same directory as the executable. There it will be detected by name. After you created a config file and it works fine, you can open a pull request to make the file available to other users. Please also add the device to the supported devices table above. - -#### Content of a config file - -A config file consists of two parts. The first part are some metadata about the device and the second parts are the steps to unlock the bootloader, boot a recovery and install the ROMs. - -##### How to write Metadata -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. - -In addition to these metadata, every config can have optional `requirements`. If these are set, the user is asked to check if they are meet. -- `android`: [OPTIONAL] int|str; Android version to install prior to installing a custom ROM. -- `firmware`: [OPTIONAL] str; specific firmware version to install before installing a custom ROM. - -##### How to write steps: -Every step in the config file corresponds to one view in the application. These steps should contain the following fields: -- `type`: str; Corresponds to the type of view to generate. There are the following options: - - `text`: Just display the text given in content. - - `confirm_button`: Display the content, as well as a button to allow the user to go to the next step. - - `call_button`: Display the content text and a button that runs a given command. After the command is run, a confirm button is displayed to allow the user to move to the next step. - - `call_button_with_input`: Display the content text, an input field and a button that runs a given command. The inputtext, can be used in the command by using the `` placeholder in the command field. After the command is run, a confirm button is displayed to allow the user to move to the next step. - - `link_button_with_confirm`: Display a button that opens a browser with a given link, confirm afterwards. Link is given in `link`. -- `img`: [OPTIONAL] Display an image on the left pane of the step view. Images are loaded from `openandroidinstaller/assets/imgs/`. -- `content`: str; The content text displayed alongside the action of the step. Used to inform the user about what's going on. For consistency and better readability the text should be moved into the next line using `>`. -- `link`: [OPTIONAL] Link to use for the link button if type is `link_button_with_confirm`. -- `command`: [ONLY for call_button* steps] str; The command to run. One of `adb_reboot`, `adb_reboot_bootloader`, `adb_reboot_download`, `adb_sideload`, `adb_twrp_wipe_and_install`, `adb_twrp_copy_partitions`, `fastboot_boot_recovery`, `fastboot_unlock_with_code`, `fastboot_unlock`, `fastboot_oem_unlock`, `fastboot_get_unlock_data`, `fastboot_reboot`, `heimdall_flash_recovery`. -- `allow_skip`: [OPTIONAL] boolean; If a skip button should be displayed to allow skipping this step. Can be useful when the bootloader is already unlocked. - -**Please try to retain this order of these fields in your config to ensure consistency.** - -## How to build the application for your platform - -The executables for the OpenAndroidInstaller are build with [pyinstaller](https://pyinstaller.org/en/stable/index.html). You can create builds for MacOS or Linux with `make build-app`. For Windows the paths need to be modified. For now, you can have a look [here](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/v0.1.2-alpha/.github/workflows/manual-build-windows.yml#L22) on how it's done. - -If you build the application for your platform and want to contribute the build, please reach out to me. - -#### On unlocking the bootloader -Devices by *Samsung*, *Google* and *Fairphone* make it fairly easy to unlock the bootloader and receive good support in the installer. - -Some devices with require manual steps to unlock the bootloader. In general you will need to create an account at a vendor website and receive some code from there. OpenAndroidInstaller will try to guide you as far as possible. These vendors include *Sony, Motorola, Xiaomi* and *OnePlus* among others. -Other phone vendors stops allowing to unlock the bootloader all together. There is nothing to be done if you didn't unlock your device in time. These vendors include *Huawei and LG* among others. Support for these vendors will always be very limited. ## Tools diff --git a/doc/How_to_contribute_your_own_installation_configurations.md b/doc/How_to_contribute_your_own_installation_configurations.md new file mode 100644 index 00000000..1e481e70 --- /dev/null +++ b/doc/How_to_contribute_your_own_installation_configurations.md @@ -0,0 +1,39 @@ +### How to contribute your own installation configurations + +If you want to use the tool for a non-supported smartphone, the fastest way is to adapt an [existing config file](https://github.com/openandroidinstaller-dev/openandroidinstaller/tree/main/openandroidinstaller/assets/configs). The file should be named after the official `device code` of the device. Add the code output by `adb shell getprop | grep ro.product.device` (when the devices is connected to the computer) as well as the official device code to the `supported_device_codes` list in the config. You can also get the device code by connecting the device to the computer and run OpenAndroidInstaller to detect the device. + +**To test your config file with the executable** without using the developer setup, place it in the same directory as the executable. There it will be detected by name. After you created a config file and it works fine, you can open a pull request to make the file available to other users. Please also add the device to the supported devices table above. + +#### Content of a config file + +A config file consists of two parts. The first part are some metadata about the device and the second parts are the steps to unlock the bootloader, boot a recovery and install the ROMs. + +##### How to write Metadata +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. + +In addition to these metadata, every config can have optional `requirements`. If these are set, the user is asked to check if they are meet. +- `android`: [OPTIONAL] int|str; Android version to install prior to installing a custom ROM. +- `firmware`: [OPTIONAL] str; specific firmware version to install before installing a custom ROM. + +##### How to write steps: +Every step in the config file corresponds to one view in the application. These steps should contain the following fields: +- `type`: str; Corresponds to the type of view to generate. There are the following options: + - `text`: Just display the text given in content. + - `confirm_button`: Display the content, as well as a button to allow the user to go to the next step. + - `call_button`: Display the content text and a button that runs a given command. After the command is run, a confirm button is displayed to allow the user to move to the next step. + - `call_button_with_input`: Display the content text, an input field and a button that runs a given command. The inputtext, can be used in the command by using the `` placeholder in the command field. After the command is run, a confirm button is displayed to allow the user to move to the next step. + - `link_button_with_confirm`: Display a button that opens a browser with a given link, confirm afterwards. Link is given in `link`. +- `img`: [OPTIONAL] Display an image on the left pane of the step view. Images are loaded from `openandroidinstaller/assets/imgs/`. +- `content`: str; The content text displayed alongside the action of the step. Used to inform the user about what's going on. For consistency and better readability the text should be moved into the next line using `>`. +- `link`: [OPTIONAL] Link to use for the link button if type is `link_button_with_confirm`. +- `command`: [ONLY for call_button* steps] str; The command to run. One of `adb_reboot`, `adb_reboot_bootloader`, `adb_reboot_download`, `adb_sideload`, `adb_twrp_wipe_and_install`, `adb_twrp_copy_partitions`, `fastboot_boot_recovery`, `fastboot_unlock_with_code`, `fastboot_unlock`, `fastboot_oem_unlock`, `fastboot_get_unlock_data`, `fastboot_reboot`, `heimdall_flash_recovery`. +- `allow_skip`: [OPTIONAL] boolean; If a skip button should be displayed to allow skipping this step. Can be useful when the bootloader is already unlocked. + +**Please try to retain this order of these fields in your config to ensure consistency.** + diff --git a/doc/Unlocking_the_bootloader.md b/doc/Unlocking_the_bootloader.md new file mode 100644 index 00000000..baed2fca --- /dev/null +++ b/doc/Unlocking_the_bootloader.md @@ -0,0 +1,6 @@ +#### On unlocking the bootloader +Devices by *Samsung*, *Google* and *Fairphone* make it fairly easy to unlock the bootloader and receive good support in the installer. + +Some devices with require manual steps to unlock the bootloader. In general you will need to create an account at a vendor website and receive some code from there. OpenAndroidInstaller will try to guide you as far as possible. These vendors include *Sony, Motorola, Xiaomi* and *OnePlus* among others. + +Other phone vendors stops allowing to unlock the bootloader all together. There is nothing to be done if you didn't unlock your device in time. These vendors include *Huawei and LG* among others. Support for these vendors will always be very limited. diff --git a/doc/building_the_application_for_your_platform.md b/doc/building_the_application_for_your_platform.md new file mode 100644 index 00000000..a905e84b --- /dev/null +++ b/doc/building_the_application_for_your_platform.md @@ -0,0 +1,14 @@ +## How to build the application for your platform + +The executables for the OpenAndroidInstaller are build with [pyinstaller](https://pyinstaller.org/en/stable/index.html). You can create builds for MacOS or Linux with `make build-app`. For Windows the paths need to be modified. For now, you can have a look [here](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/v0.1.2-alpha/.github/workflows/manual-build-windows.yml#L22) on how it's done. + +If you build the application for your platform and want to contribute the build, please reach out to me. + +## Run OpenAndroidInstaller for development + +Currently development is only supported on Ubuntu Linux. MacOS and Windows should also work fine. You might need to install additional USB-drivers on Windows. + +1. Clone the main branch of this repository +2. Run `make poetry` and `make install` to install poetry to manage python and install the required dependencies like adb, fastboot and heimdall. +3. Run `make app` to start the desktop app from the source. + From 990654d7c4206ec03e5b02fdf4f2ada2ba9daccb Mon Sep 17 00:00:00 2001 From: Heus-Sueh <98482469+Heus-Sueh@users.noreply.github.com> Date: Sun, 30 Jul 2023 15:32:55 +0000 Subject: [PATCH 009/102] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 652569ad..84503ed8 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,9 @@ All kinds of contributions are welcome. These include: - Report bugs. [How to contribute your own installation configurations](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/How_to_contribute_your_own_installation_configurations.md) + [How to build the application for your platform](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/building_the_application_for_your_platform.md) + [Unlocking the bootloader](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/Unlocking_the_bootloader.md) More details on how to contribute can be found [here](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/CONTRIBUTING.md). From 19921228a4daba8b5282566b476ddcc9b1bdb20f Mon Sep 17 00:00:00 2001 From: Heus-Sueh <98482469+Heus-Sueh@users.noreply.github.com> Date: Sun, 30 Jul 2023 12:34:25 -0300 Subject: [PATCH 010/102] test --- ...d => How_to_contribute_your_own_installation_configurations.md | 0 doc/Unlocking_the_bootloader.md => Unlocking_the_bootloader.md | 0 ...r_platform.md => building_the_application_for_your_platform.md | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename doc/How_to_contribute_your_own_installation_configurations.md => How_to_contribute_your_own_installation_configurations.md (100%) rename doc/Unlocking_the_bootloader.md => Unlocking_the_bootloader.md (100%) rename doc/building_the_application_for_your_platform.md => building_the_application_for_your_platform.md (100%) diff --git a/doc/How_to_contribute_your_own_installation_configurations.md b/How_to_contribute_your_own_installation_configurations.md similarity index 100% rename from doc/How_to_contribute_your_own_installation_configurations.md rename to How_to_contribute_your_own_installation_configurations.md diff --git a/doc/Unlocking_the_bootloader.md b/Unlocking_the_bootloader.md similarity index 100% rename from doc/Unlocking_the_bootloader.md rename to Unlocking_the_bootloader.md diff --git a/doc/building_the_application_for_your_platform.md b/building_the_application_for_your_platform.md similarity index 100% rename from doc/building_the_application_for_your_platform.md rename to building_the_application_for_your_platform.md From 36b197d17a48787e09f012a40ad0566f60cbcd15 Mon Sep 17 00:00:00 2001 From: Heus-Sueh <98482469+Heus-Sueh@users.noreply.github.com> Date: Sun, 30 Jul 2023 12:35:15 -0300 Subject: [PATCH 011/102] adding them in the right folder --- .../How_to_contribute_your_own_installation_configurations.md | 0 Unlocking_the_bootloader.md => doc/Unlocking_the_bootloader.md | 0 .../building_the_application_for_your_platform.md | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename How_to_contribute_your_own_installation_configurations.md => doc/How_to_contribute_your_own_installation_configurations.md (100%) rename Unlocking_the_bootloader.md => doc/Unlocking_the_bootloader.md (100%) rename building_the_application_for_your_platform.md => doc/building_the_application_for_your_platform.md (100%) diff --git a/How_to_contribute_your_own_installation_configurations.md b/doc/How_to_contribute_your_own_installation_configurations.md similarity index 100% rename from How_to_contribute_your_own_installation_configurations.md rename to doc/How_to_contribute_your_own_installation_configurations.md diff --git a/Unlocking_the_bootloader.md b/doc/Unlocking_the_bootloader.md similarity index 100% rename from Unlocking_the_bootloader.md rename to doc/Unlocking_the_bootloader.md diff --git a/building_the_application_for_your_platform.md b/doc/building_the_application_for_your_platform.md similarity index 100% rename from building_the_application_for_your_platform.md rename to doc/building_the_application_for_your_platform.md From 4b5e1885af93cf74a4e5eeed5a906c9f12e5ecdd Mon Sep 17 00:00:00 2001 From: Heus-Sueh <98482469+Heus-Sueh@users.noreply.github.com> Date: Sun, 30 Jul 2023 15:37:04 +0000 Subject: [PATCH 012/102] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 84503ed8..a93dc0cd 100644 --- a/README.md +++ b/README.md @@ -183,11 +183,11 @@ All kinds of contributions are welcome. These include: - Add features and/or improve the code base. - Report bugs. -[How to contribute your own installation configurations](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/How_to_contribute_your_own_installation_configurations.md) +[How to contribute your own installation configurations](https://github.com/Heus-Sueh/openandroidinstaller/blob/main/doc/How_to_contribute_your_own_installation_configurations.md) -[How to build the application for your platform](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/building_the_application_for_your_platform.md) +[How to build the application for your platform](https://github.com/Heus-Sueh/openandroidinstaller/blob/main/doc/building_the_application_for_your_platform.md) -[Unlocking the bootloader](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/Unlocking_the_bootloader.md) +[Unlocking the bootloader](https://github.com/Heus-Sueh/openandroidinstaller/blob/main/doc/Unlocking_the_bootloader.md) More details on how to contribute can be found [here](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/CONTRIBUTING.md). Please have a look before opening an issue or starting to contribute. From 41d8edbc2a50facfc27b0858e49bbaacd157e2e1 Mon Sep 17 00:00:00 2001 From: Heus-Sueh <98482469+Heus-Sueh@users.noreply.github.com> Date: Sun, 30 Jul 2023 15:45:44 +0000 Subject: [PATCH 013/102] return some changes of the README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a93dc0cd..84503ed8 100644 --- a/README.md +++ b/README.md @@ -183,11 +183,11 @@ All kinds of contributions are welcome. These include: - Add features and/or improve the code base. - Report bugs. -[How to contribute your own installation configurations](https://github.com/Heus-Sueh/openandroidinstaller/blob/main/doc/How_to_contribute_your_own_installation_configurations.md) +[How to contribute your own installation configurations](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/How_to_contribute_your_own_installation_configurations.md) -[How to build the application for your platform](https://github.com/Heus-Sueh/openandroidinstaller/blob/main/doc/building_the_application_for_your_platform.md) +[How to build the application for your platform](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/building_the_application_for_your_platform.md) -[Unlocking the bootloader](https://github.com/Heus-Sueh/openandroidinstaller/blob/main/doc/Unlocking_the_bootloader.md) +[Unlocking the bootloader](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/Unlocking_the_bootloader.md) More details on how to contribute can be found [here](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/CONTRIBUTING.md). Please have a look before opening an issue or starting to contribute. From 2a136b50cf259f7e1b9658df1a12916da7aeb6a7 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Sun, 30 Jul 2023 18:17:17 +0200 Subject: [PATCH 014/102] Fixed multiple spelling and formatting issues in Samsung configs --- openandroidinstaller/assets/configs/dreamlte.yaml | 8 +++++--- openandroidinstaller/assets/configs/grandprimevelte.yaml | 6 ++++-- openandroidinstaller/assets/configs/serranoltexx.yaml | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/openandroidinstaller/assets/configs/dreamlte.yaml b/openandroidinstaller/assets/configs/dreamlte.yaml index 694b17b6..7ccbef80 100644 --- a/openandroidinstaller/assets/configs/dreamlte.yaml +++ b/openandroidinstaller/assets/configs/dreamlte.yaml @@ -7,18 +7,20 @@ metadata: - dreamlte twrp-link: dreamlte requirements: - android: "9.0" + android: 9.0 steps: unlock_bootloader: boot_recovery: - type: call_button content: > As a first step, you need to boot into the bootloader. A bootloader is the piece of software, - that tells your phone who to start and run an operating system (like Android). Your device should be turned on. + that tells your phone how to start and run an operating system (like Android). Your device should be turned on. Then press 'Confirm and run' to reboot into the bootloader. Continue once it's done. command: adb_reboot_download - type: call_button - content: In this step, you need to boot a custom recovery on your device. Press 'Confirm and run' to start the process. Confirm afterwards to continue. + 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. command: heimdall_flash_recovery - type: confirm_button img: samsung-buttons-bixby.png diff --git a/openandroidinstaller/assets/configs/grandprimevelte.yaml b/openandroidinstaller/assets/configs/grandprimevelte.yaml index 3b913f17..2ac226c0 100644 --- a/openandroidinstaller/assets/configs/grandprimevelte.yaml +++ b/openandroidinstaller/assets/configs/grandprimevelte.yaml @@ -14,11 +14,13 @@ steps: - type: call_button content: > As a first step, you need to boot into the bootloader. A bootloader is the piece of software, - that tells your phone who to start and run an operating system (like Android). Your device should be turned on. + that tells your phone how to start and run an operating system (like Android). Your device should be turned on. Then press 'Confirm and run' to reboot into the bootloader. Continue once it's done. command: adb_reboot_download - type: call_button - content: In this step, you need to boot a custom recovery on your device. Press 'Confirm and run' to start the process. Confirm afterwards to continue. + 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. command: heimdall_flash_recovery - type: confirm_button img: samsung-buttons.png diff --git a/openandroidinstaller/assets/configs/serranoltexx.yaml b/openandroidinstaller/assets/configs/serranoltexx.yaml index 1d18ebef..f0431ae6 100644 --- a/openandroidinstaller/assets/configs/serranoltexx.yaml +++ b/openandroidinstaller/assets/configs/serranoltexx.yaml @@ -12,7 +12,7 @@ steps: - type: call_button content: > As a first step, you need to boot into the bootloader. A bootloader is the piece of software, - that tells your phone who to start and run an operating system (like Android). Your device should be turned on. + that tells your phone how to start and run an operating system (like Android). Your device should be turned on. Then press 'Confirm and run' to reboot into the bootloader. Continue once it's done. command: adb_reboot_download - type: call_button From 82be752f982098fb28ac2e2488d3e56084c51cd3 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Sun, 30 Jul 2023 18:22:58 +0200 Subject: [PATCH 015/102] LineageOS page for S8 does not exist --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a49b1a4a..35917bfd 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ Samsung | Galaxy S6 | [zerofltexx](https://wiki.lineageos.org/devices/zerofltexx Samsung | Galaxy S6 Edge | [zeroltexx](https://wiki.lineageos.org/devices/zeroltexx) | | tested Samsung | Galaxy S7 | [herolte](https://wiki.lineageos.org/devices/herolte) | SM-G930F | tested Samsung | Galaxy S7 Edge | [hero2lte](https://wiki.lineageos.org/devices/hero2lte) | | tested -Samsung | Galaxy S8 | [dreamlte](https://wiki.lineageos.org/devices/dreamlte) | | tested +Samsung | Galaxy S8 | dreamlte | | tested Samsung | Galaxy S9 | [starlte](https://wiki.lineageos.org/devices/starlte) | | tested Samsung | Galaxy S10 | [beyond1lte](https://wiki.lineageos.org/devices/beyond1lte) | | tested Samsung | Galaxy S10e | [beyond0lte](https://wiki.lineageos.org/devices/beyond0lte) | | tested From 965dd0cc8dd02f0ce52db00f748a6c858eed628f Mon Sep 17 00:00:00 2001 From: Heus-Sueh <98482469+Heus-Sueh@users.noreply.github.com> Date: Sun, 30 Jul 2023 16:40:17 +0000 Subject: [PATCH 016/102] Rename How_to_contribute_your_own_installation_configurations.md to how_to_contribute_your_own_installation_configurations.md --- ... => how_to_contribute_your_own_installation_configurations.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/{How_to_contribute_your_own_installation_configurations.md => how_to_contribute_your_own_installation_configurations.md} (100%) diff --git a/doc/How_to_contribute_your_own_installation_configurations.md b/doc/how_to_contribute_your_own_installation_configurations.md similarity index 100% rename from doc/How_to_contribute_your_own_installation_configurations.md rename to doc/how_to_contribute_your_own_installation_configurations.md From 5efd3a01ef3647c22ee0a3b6022a439585edbbb1 Mon Sep 17 00:00:00 2001 From: Heus-Sueh <98482469+Heus-Sueh@users.noreply.github.com> Date: Sun, 30 Jul 2023 16:40:29 +0000 Subject: [PATCH 017/102] Rename Unlocking_the_bootloader.md to unlocking_the_bootloader.md --- doc/{Unlocking_the_bootloader.md => unlocking_the_bootloader.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/{Unlocking_the_bootloader.md => unlocking_the_bootloader.md} (100%) diff --git a/doc/Unlocking_the_bootloader.md b/doc/unlocking_the_bootloader.md similarity index 100% rename from doc/Unlocking_the_bootloader.md rename to doc/unlocking_the_bootloader.md From 061c6b858a7fe636cccac858c158271676fe4d1a Mon Sep 17 00:00:00 2001 From: MagicLike Date: Mon, 31 Jul 2023 12:27:52 +0200 Subject: [PATCH 018/102] Added new device code variant to `beyond0lte` --- openandroidinstaller/assets/configs/beyond0lte.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openandroidinstaller/assets/configs/beyond0lte.yaml b/openandroidinstaller/assets/configs/beyond0lte.yaml index 21f89f18..ffbcd414 100644 --- a/openandroidinstaller/assets/configs/beyond0lte.yaml +++ b/openandroidinstaller/assets/configs/beyond0lte.yaml @@ -4,7 +4,8 @@ metadata: is_ab_device: false device_code: beyond0lte supported_device_codes: - - beyond0lte + - beyond0lte + - beyond0 requirements: android: 12 steps: From 1148287df7c1199c1c66974717a820077d30d5d9 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Mon, 31 Jul 2023 12:28:01 +0200 Subject: [PATCH 019/102] Added new device code variant to `beyond1lte` --- openandroidinstaller/assets/configs/beyond1lte.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openandroidinstaller/assets/configs/beyond1lte.yaml b/openandroidinstaller/assets/configs/beyond1lte.yaml index fa5c8161..f83f9740 100644 --- a/openandroidinstaller/assets/configs/beyond1lte.yaml +++ b/openandroidinstaller/assets/configs/beyond1lte.yaml @@ -4,7 +4,8 @@ metadata: is_ab_device: false device_code: beyond1lte supported_device_codes: - - beyond1lte + - beyond1lte + - beyond1 requirements: android: 12 steps: From e593c639c30038bffbc400f95c49ddc80ee89f51 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Mon, 31 Jul 2023 12:34:29 +0200 Subject: [PATCH 020/102] Added new device code variant to `a5y17lte` --- openandroidinstaller/assets/configs/a5y17lte.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/openandroidinstaller/assets/configs/a5y17lte.yaml b/openandroidinstaller/assets/configs/a5y17lte.yaml index 47df4dbf..e0ea6925 100644 --- a/openandroidinstaller/assets/configs/a5y17lte.yaml +++ b/openandroidinstaller/assets/configs/a5y17lte.yaml @@ -5,6 +5,7 @@ metadata: device_code: a5y17lte supported_device_codes: - a5y17lte + - a5y17ltecan steps: unlock_bootloader: boot_recovery: From cad4a7021e027b3e82e129a83522a118370a7ae6 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Mon, 31 Jul 2023 19:31:17 +0200 Subject: [PATCH 021/102] Added new device code variant to `j7elte` --- openandroidinstaller/assets/configs/j7elte.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openandroidinstaller/assets/configs/j7elte.yaml b/openandroidinstaller/assets/configs/j7elte.yaml index a34c5e98..6ad9c1cc 100644 --- a/openandroidinstaller/assets/configs/j7elte.yaml +++ b/openandroidinstaller/assets/configs/j7elte.yaml @@ -4,7 +4,8 @@ metadata: is_ab_device: false device_code: j7elte supported_device_codes: - - j7elte + - j7elte + - j7eltetmo steps: unlock_bootloader: boot_recovery: From 9bc282d6c48dbe727e0e609e739bc76f9ce49ee5 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Mon, 31 Jul 2023 19:32:38 +0200 Subject: [PATCH 022/102] Added TWRP link --- openandroidinstaller/assets/configs/j7elte.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/openandroidinstaller/assets/configs/j7elte.yaml b/openandroidinstaller/assets/configs/j7elte.yaml index 6ad9c1cc..ca66f630 100644 --- a/openandroidinstaller/assets/configs/j7elte.yaml +++ b/openandroidinstaller/assets/configs/j7elte.yaml @@ -6,6 +6,7 @@ metadata: supported_device_codes: - j7elte - j7eltetmo + twrp-link: j7elte steps: unlock_bootloader: boot_recovery: From 0604ff11002697ce00b8e19d781bc7700a33994e Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Tue, 1 Aug 2023 13:03:59 +0200 Subject: [PATCH 023/102] Add dtbo, vbmeta, super_empty flashing --- README.md | 3 +- openandroidinstaller/app_state.py | 3 + openandroidinstaller/installer_config.py | 6 +- openandroidinstaller/tooling.py | 51 +++++++ openandroidinstaller/views/select_view.py | 170 ++++++++++++++++++++++ openandroidinstaller/views/step_view.py | 8 + 6 files changed, 239 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a49b1a4a..622e9ed5 100644 --- a/README.md +++ b/README.md @@ -215,6 +215,7 @@ Every config file should have `metadata` with the following fields: - `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. +- `additional_steps` : [OPTIONAL] List[str]; A list of additional steps. Could be `dtbo`, `vbmeta`, `super_empty`. In addition to these metadata, every config can have optional `requirements`. If these are set, the user is asked to check if they are meet. - `android`: [OPTIONAL] int|str; Android version to install prior to installing a custom ROM. @@ -231,7 +232,7 @@ Every step in the config file corresponds to one view in the application. These - `img`: [OPTIONAL] Display an image on the left pane of the step view. Images are loaded from `openandroidinstaller/assets/imgs/`. - `content`: str; The content text displayed alongside the action of the step. Used to inform the user about what's going on. For consistency and better readability the text should be moved into the next line using `>`. - `link`: [OPTIONAL] Link to use for the link button if type is `link_button_with_confirm`. -- `command`: [ONLY for call_button* steps] str; The command to run. One of `adb_reboot`, `adb_reboot_bootloader`, `adb_reboot_download`, `adb_sideload`, `adb_twrp_wipe_and_install`, `adb_twrp_copy_partitions`, `fastboot_boot_recovery`, `fastboot_unlock_with_code`, `fastboot_unlock`, `fastboot_oem_unlock`, `fastboot_get_unlock_data`, `fastboot_reboot`, `heimdall_flash_recovery`. +- `command`: [ONLY for call_button* steps] str; The command to run. One of `adb_reboot`, `adb_reboot_bootloader`, `adb_reboot_download`, `adb_sideload`, `adb_twrp_wipe_and_install`, `adb_twrp_copy_partitions`, `fastboot_boot_recovery`, `fastboot_flash_additional_partitions`, `fastboot_unlock_with_code`, `fastboot_unlock`, `fastboot_oem_unlock`, `fastboot_get_unlock_data`, `fastboot_reboot`, `heimdall_flash_recovery`. - `allow_skip`: [OPTIONAL] boolean; If a skip button should be displayed to allow skipping this step. Can be useful when the bootloader is already unlocked. **Please try to retain this order of these fields in your config to ensure consistency.** diff --git a/openandroidinstaller/app_state.py b/openandroidinstaller/app_state.py index eee468a9..3fa621a3 100644 --- a/openandroidinstaller/app_state.py +++ b/openandroidinstaller/app_state.py @@ -44,6 +44,9 @@ def __init__( self.config = None self.image_path = None self.recovery_path = None + self.dtbo_path = None + self.vbmeta_path = None + self.super_empty_path = None # store views self.default_views: List = [] diff --git a/openandroidinstaller/installer_config.py b/openandroidinstaller/installer_config.py index 2a857d83..c7b68a77 100644 --- a/openandroidinstaller/installer_config.py +++ b/openandroidinstaller/installer_config.py @@ -62,6 +62,7 @@ def __init__( self.requirements = requirements self.device_code = metadata.get("device_code") self.is_ab = metadata.get("is_ab_device", False) + self.additional_steps = metadata.get("additional_steps") self.supported_device_codes = metadata.get("supported_device_codes") self.twrp_link = metadata.get("twrp-link") @@ -134,6 +135,8 @@ def _load_config(device_code: str, config_path: Path) -> Optional[InstallerConfi config = InstallerConfig.from_file(path) logger.info(f"Loaded device config from {path}.") if config: + if "additional_steps" not in config.metadata: + config.metadata.update({"additional_steps": "[]"}) logger.info(f"Config metadata: {config.metadata}.") return config else: @@ -150,7 +153,7 @@ def validate_config(config: str) -> bool: ), "content": str, schema.Optional("command"): Regex( - r"adb_reboot|adb_reboot_bootloader|adb_reboot_download|adb_sideload|adb_twrp_wipe_and_install|adb_twrp_copy_partitions|fastboot_boot_recovery|fastboot_flash_boot|fastboot_unlock_with_code|fastboot_get_unlock_data|fastboot_unlock|fastboot_oem_unlock|fastboot_reboot|heimdall_flash_recovery" + r"adb_reboot|adb_reboot_bootloader|adb_reboot_download|adb_sideload|adb_twrp_wipe_and_install|adb_twrp_copy_partitions|fastboot_boot_recovery|fastboot_flash_boot|fastboot_unlock_with_code|fastboot_get_unlock_data|fastboot_unlock|fastboot_oem_unlock|fastboot_reboot|heimdall_flash_recovery|fastboot_flash_additional_partitions" ), schema.Optional("allow_skip"): bool, schema.Optional("img"): str, @@ -166,6 +169,7 @@ def validate_config(config: str) -> bool: "device_code": str, "supported_device_codes": [str], schema.Optional("twrp-link"): str, + schema.Optional("additional_steps"): [str], }, schema.Optional("requirements"): { schema.Optional("android"): schema.Or(str, int), diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index d3a551be..2b0d1f98 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -497,3 +497,54 @@ def search_device(platform: str, bin_path: Path) -> Optional[str]: except CalledProcessError: logger.error("Failed to detect a device.") return None + + +@add_logging("Flash additional partitions with fastboot") +def fastboot_flash_additional_partitions( + bin_path: Path, dtbo: str, vbmeta: str, super_empty: str, is_ab: bool = True +) -> TerminalResponse: + """Flash additional partitions (dtbo, vbmeta, super_empty) with fastboot.""" + if dtbo: + for line in run_command( + "fastboot flash dtbo ", target=f"{dtbo}", bin_path=bin_path + ): + yield line + if not is_ab: + if (type(line) == bool) and not line: + logger.error("Flashing dtbo failed.") + yield False + else: + yield True + else: + logger.info("No dtbo selected. Skipping") + yield True + + if vbmeta: + for line in run_command( + "fastboot flash vbmeta ", target=f"{vbmeta}", bin_path=bin_path + ): + yield line + if not is_ab: + if (type(line) == bool) and not line: + logger.error("Flashing vbmeta failed.") + yield False + else: + yield True + else: + logger.info("No vbmeta selected. Skipping") + yield True + + if super_empty: + for line in run_command( + "fastboot wipe-super ", target=f"{super_empty}", bin_path=bin_path + ): + yield line + if not is_ab: + if (type(line) == bool) and not line: + logger.error("Wiping super failed.") + yield False + else: + yield True + else: + logger.info("No super_empty selected. Skipping") + yield True diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index 442fa98b..a4c1aaec 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -95,14 +95,26 @@ def init_visuals( # initialize file pickers self.pick_image_dialog = FilePicker(on_result=self.pick_image_result) self.pick_recovery_dialog = FilePicker(on_result=self.pick_recovery_result) + self.pick_dtbo_dialog = FilePicker(on_result=self.pick_dtbo_result) + self.pick_vbmeta_dialog = FilePicker(on_result=self.pick_vbmeta_result) + self.pick_super_empty_dialog = FilePicker( + on_result=self.pick_super_empty_result + ) + self.selected_image = Text("Selected image: ") self.selected_recovery = Text("Selected recovery: ") + self.selected_dtbo = Text("Selected dtbo: ") + self.selected_vbmeta = Text("Selected vbmeta: ") + self.selected_super_empty = Text("Selected super_empty: ") # initialize and manage button state. self.confirm_button = confirm_button(self.on_confirm) self.confirm_button.disabled = True self.pick_recovery_dialog.on_result = self.enable_button_if_ready self.pick_image_dialog.on_result = self.enable_button_if_ready + self.pick_dtbo_dialog.on_result = self.enable_button_if_ready + self.pick_vbmeta_dialog.on_result = self.enable_button_if_ready + self.pick_super_empty_dialog.on_result = self.enable_button_if_ready # back button self.back_button = ElevatedButton( "Back", @@ -122,6 +134,9 @@ def build(self): # attach hidden dialogues self.right_view.controls.append(self.pick_image_dialog) self.right_view.controls.append(self.pick_recovery_dialog) + self.right_view.controls.append(self.pick_dtbo_dialog) + self.right_view.controls.append(self.pick_vbmeta_dialog) + self.right_view.controls.append(self.pick_super_empty_dialog) # create help/info button to show the help dialog info_button = OutlinedButton( @@ -226,6 +241,83 @@ def build(self): ), self.selected_recovery, Divider(), + ] + ) + + # attach the controls for uploading others partitions, like dtbo, vbmeta & super_empty + if "dtbo" in self.state.config.metadata["additional_steps"]: + self.right_view.controls.extend( + [ + Text("Select other specific images:", style="titleSmall"), + Markdown( + """ + Depending of the ROM, OpenAndroidInstaller may have to install additional images. + These images are usually needed for Android 13 ROM. + Make sure the file is for **your exact phone model!** + """ + ), + Row( + [ + FilledButton( + "Pick `dtbo.img` image", + icon=icons.UPLOAD_FILE, + on_click=lambda _: self.pick_dtbo_dialog.pick_files( + allow_multiple=False, + file_type="custom", + allowed_extensions=["img"], + ), + expand=True, + ), + ] + ), + self.selected_dtbo, + ] + ) + if "vbmeta" in self.state.config.metadata["additional_steps"]: + self.right_view.controls.extend( + [ + Row( + [ + FilledButton( + "Pick `vbmeta.img` image", + icon=icons.UPLOAD_FILE, + on_click=lambda _: self.pick_vbmeta_dialog.pick_files( + allow_multiple=False, + file_type="custom", + allowed_extensions=["img"], + ), + expand=True, + ), + ] + ), + self.selected_vbmeta, + ] + ) + if "super_empty" in self.state.config.metadata["additional_steps"]: + self.right_view.controls.extend( + [ + Row( + [ + FilledButton( + "Pick `super_empty.img` image", + icon=icons.UPLOAD_FILE, + on_click=lambda _: self.pick_super_empty_dialog.pick_files( + allow_multiple=False, + file_type="custom", + allowed_extensions=["img"], + ), + expand=True, + ), + ] + ), + self.selected_super_empty, + Divider(), + ] + ) + + # attach the bottom buttons + self.right_view.controls.extend( + [ self.info_field, Row([self.back_button, self.confirm_button]), ] @@ -291,6 +383,61 @@ def pick_recovery_result(self, e: FilePickerResultEvent): # update self.selected_recovery.update() + def pick_dtbo_result(self, e: FilePickerResultEvent): + path = ", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!" + # update the textfield with the name of the file + self.selected_dtbo.value = self.selected_dtbo.value.split(":")[0] + f": {path}" + if e.files: + # check if the dtbo works with the device and show the filename in different colors accordingly + if path == "dtbo.img": + self.selected_dtbo.color = colors.GREEN + self.state.dtbo_path = e.files[0].path + logger.info(f"Selected dtbo from {self.state.dtbo_path}") + else: + self.selected_dtbo.color = colors.RED + else: + logger.info("No image selected.") + # update + self.selected_dtbo.update() + + def pick_vbmeta_result(self, e: FilePickerResultEvent): + path = ", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!" + # update the textfield with the name of the file + self.selected_vbmeta.value = ( + self.selected_vbmeta.value.split(":")[0] + f": {path}" + ) + if e.files: + # check if the vbmeta works with the device and show the filename in different colors accordingly + if path == "vbmeta.img": + self.selected_vbmeta.color = colors.GREEN + self.state.vbmeta_path = e.files[0].path + logger.info(f"Selected vbmeta from {self.state.vbmeta_path}") + else: + self.selected_vbmeta.color = colors.RED + else: + logger.info("No image selected.") + # update + self.selected_vbmeta.update() + + def pick_super_empty_result(self, e: FilePickerResultEvent): + path = ", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!" + # update the textfield with the name of the file + self.selected_super_empty.value = ( + self.selected_super_empty.value.split(":")[0] + f": {path}" + ) + if e.files: + # check if the super_empty works with the device and show the filename in different colors accordingly + if path == "super_empty.img": + self.selected_super_empty.color = colors.GREEN + self.state.super_empty_path = e.files[0].path + logger.info(f"Selected super_empty from {self.state.super_empty_path}") + else: + self.selected_super_empty.color = colors.RED + else: + logger.info("No image selected.") + # update + self.selected_super_empty.update() + def enable_button_if_ready(self, e): """Enable the confirm button if both files have been selected.""" if (".zip" in self.selected_image.value) and ( @@ -320,6 +467,29 @@ def enable_button_if_ready(self, e): self.confirm_button.disabled = True self.right_view.update() return + + if ( + (self.selected_dtbo.color and self.selected_dtbo.color == "red") + or (self.selected_vbmeta.color and self.selected_vbmeta.color == "red") + or ( + self.selected_super_empty.color + and self.selected_super_empty.color == "red" + ) + ): + logger.error( + "Some additional images don't match. Please select different ones." + ) + self.info_field.controls = [ + Text( + "Some additional images don't match. Select right ones or unselect them.", + color=colors.RED, + weight="bold", + ) + ] + self.confirm_button.disabled = True + self.right_view.update() + return + logger.info("Image and recovery work with the device. You can continue.") self.info_field.controls = [] self.confirm_button.disabled = False diff --git a/openandroidinstaller/views/step_view.py b/openandroidinstaller/views/step_view.py index 1e4dffbf..969197c7 100644 --- a/openandroidinstaller/views/step_view.py +++ b/openandroidinstaller/views/step_view.py @@ -45,6 +45,7 @@ adb_twrp_copy_partitions, fastboot_boot_recovery, fastboot_flash_boot, + fastboot_flash_additional_partitions, fastboot_oem_unlock, fastboot_reboot, fastboot_unlock, @@ -231,6 +232,13 @@ def call_to_phone(self, e, command: str): fastboot_flash_boot, recovery=self.state.recovery_path, ), + "fastboot_flash_additional_partitions": partial( + fastboot_flash_additional_partitions, + dtbo=self.state.dtbo_path, + vbmeta=self.state.vbmeta_path, + super_empty=self.state.super_empty_path, + is_ab=self.state.config.is_ab, + ), "fastboot_reboot": fastboot_reboot, "heimdall_flash_recovery": partial( heimdall_flash_recovery, recovery=self.state.recovery_path From 62be5c351fb79d87ca6b51be03f8cbfbc652b25d Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Tue, 1 Aug 2023 13:27:27 +0200 Subject: [PATCH 024/102] Added device specific notes --- README.md | 1 + openandroidinstaller/installer_config.py | 1 + openandroidinstaller/views/select_view.py | 14 ++++++++++++++ 3 files changed, 16 insertions(+) diff --git a/README.md b/README.md index a49b1a4a..bea6ab57 100644 --- a/README.md +++ b/README.md @@ -215,6 +215,7 @@ Every config file should have `metadata` with the following fields: - `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. +- `notes`: [OPTIONAL] str; specific phone information, showed before choosing ROM / recovery In addition to these metadata, every config can have optional `requirements`. If these are set, the user is asked to check if they are meet. - `android`: [OPTIONAL] int|str; Android version to install prior to installing a custom ROM. diff --git a/openandroidinstaller/installer_config.py b/openandroidinstaller/installer_config.py index 2a857d83..cf41617a 100644 --- a/openandroidinstaller/installer_config.py +++ b/openandroidinstaller/installer_config.py @@ -166,6 +166,7 @@ def validate_config(config: str) -> bool: "device_code": str, "supported_device_codes": [str], schema.Optional("twrp-link"): str, + schema.Optional("notes"): str, }, schema.Optional("requirements"): { schema.Optional("android"): schema.Or(str, int), diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index 442fa98b..a83ae0fe 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -144,6 +144,20 @@ def build(self): # text row to show infos during the process self.info_field = Row() + + # Device specific notes + if "notes" in self.state.config.metadata: + self.right_view.controls.extend( + [ + Text( + "Important notes for your device", + style="titleSmall", + color=colors.RED, + weight="bold", + ), + Markdown(f"""{self.state.config.metadata['notes']}"""), + ] + ) # if there is an available download, show the button to the page if self.download_link: twrp_download_link = f"https://dl.twrp.me/{self.state.config.twrp_link if self.state.config.twrp_link else self.state.config.device_code}" From 7d807e36bcec004c687e514287a442aeeea920bb Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Tue, 1 Aug 2023 14:11:12 +0200 Subject: [PATCH 025/102] Added lavender (Redmi Note 7) --- README.md | 7 +++ .../assets/configs/lavender.yaml | 60 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 openandroidinstaller/assets/configs/lavender.yaml diff --git a/README.md b/README.md index a49b1a4a..c50652b3 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,13 @@ OnePlus | Nord N200 | [dre](https://wiki.lineageos.org/devices/dre) | | tested OnePlus | 9 | lemonade | | under development +
Xiaomi + +Vendor | Device Name | CodeName | Models | Status +---|---|---|---|--- +Xiaomi | Redmi Note 7 | [lavender](https://wiki.lineageos.org/devices/lavender) | | tested +
+ And more to come! diff --git a/openandroidinstaller/assets/configs/lavender.yaml b/openandroidinstaller/assets/configs/lavender.yaml new file mode 100644 index 00000000..dc62e297 --- /dev/null +++ b/openandroidinstaller/assets/configs/lavender.yaml @@ -0,0 +1,60 @@ +metadata: + maintainer: A non (anon) + device_name: Xiaomi Redmi Note 7 + is_ab_device: false + device_code: lavender + supported_recovery: + - orangefox + - twrp + supported_device_codes: + - lavender + notes: > + - If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com/miui/lavender/ + + - You should install Android 10 or newer ROM. + + - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) +requirements: + android: 10 (Q) +steps: + unlock_bootloader: + - type: confirm_button + content: > + As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone + how to start and run an operating system (like Android). Your device should be turned on. This will reset your phone. + - type: link_button_with_confirm + content: > + - Create a Mi account on Xiaomi’s website. Beware that one account is only allowed to unlock one unique device every 30 days. + + - Add a phone number to your Mi account, insert a SIM into your phone. + + - Enable developer options in `Settings` > `About Phone` by repeatedly tapping MIUI Version. + + - Link the device to your Mi account in `Settings` > `Additional settings` > `Developer options` > `Mi Unlock status`. + + - Download the Mi Unlock app with the link bellow (Windows is required to run the app), and follow the instructions provided by the app. It may tell you that you have to wait, usually 7 days. If it does so, please wait the quoted amount of time before continuing to the next step! + + - After device and Mi account are successfully verified, the bootloader should be unlocked. + + - Since the device resets completely, you will need to re-enable USB debugging to continue : `Settings` > `Additional settings` > `Developer options` > `USB debugging` + link: https://en.miui.com/unlock/download_en.html + boot_recovery: + - type: confirm_button + content: > + Now you need to boot a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating, + adapting and repairing of the operating system. + - type: call_button + content: > + Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. + command: fastboot_flash_recovery + - type: call_button + img: ofox.png + content: > + Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. + If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. + Once it's done continue. + command: fastboot_reboot_recovery \ No newline at end of file From bf968ff9fdba7a3887f4539528cae5f0a7393072 Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Tue, 1 Aug 2023 14:14:54 +0200 Subject: [PATCH 026/102] Added ginkgo (Redmi Note 8 / 8T) --- README.md | 7 +++ .../assets/configs/ginkgo.yaml | 59 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 openandroidinstaller/assets/configs/ginkgo.yaml diff --git a/README.md b/README.md index a49b1a4a..737ccce1 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,13 @@ OnePlus | Nord N200 | [dre](https://wiki.lineageos.org/devices/dre) | | tested OnePlus | 9 | lemonade | | under development +
Xiaomi + +Vendor | Device Name | CodeName | Models | Status +---|---|---|---|--- +Xiaomi | Redmi Note 8 / 8T | [ginkgo](https://wiki.lineageos.org/devices/ginkgo) / willow | | untested +
+ And more to come! diff --git a/openandroidinstaller/assets/configs/ginkgo.yaml b/openandroidinstaller/assets/configs/ginkgo.yaml new file mode 100644 index 00000000..248ca052 --- /dev/null +++ b/openandroidinstaller/assets/configs/ginkgo.yaml @@ -0,0 +1,59 @@ +metadata: + maintainer: A non (anon) + device_name: Xiaomi Redmi Note 8 / 8T + is_ab_device: false + device_code: ginkgo + supported_recovery: + - orangefox + - twrp + supported_device_codes: + - ginkgo + - willow + notes: > + - If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com + - You should install Android 10 or newer ROM. + - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) +requirements: + android: 10 (Q) +steps: + unlock_bootloader: + - type: confirm_button + content: > + As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone + how to start and run an operating system (like Android). Your device should be turned on. This will reset your phone. + - type: link_button_with_confirm + content: > + - Create a Mi account on Xiaomi’s website. Beware that one account is only allowed to unlock one unique device every 30 days. + + - Add a phone number to your Mi account, insert a SIM into your phone. + + - Enable developer options in `Settings` > `About Phone` by repeatedly tapping MIUI Version. + + - Link the device to your Mi account in `Settings` > `Additional settings` > `Developer options` > `Mi Unlock status`. + + - Download the Mi Unlock app with the link bellow (Windows is required to run the app), and follow the instructions provided by the app. It may tell you that you have to wait, usually 7 days. If it does so, please wait the quoted amount of time before continuing to the next step! + + - After device and Mi account are successfully verified, the bootloader should be unlocked. + + - Since the device resets completely, you will need to re-enable USB debugging to continue : `Settings` > `Additional settings` > `Developer options` > `USB debugging` + link: https://en.miui.com/unlock/download_en.html + boot_recovery: + - type: confirm_button + content: > + Now you need to boot a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating, + adapting and repairing of the operating system. + - type: call_button + content: > + Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. + command: fastboot_flash_recovery + - type: call_button + img: ofox.png + content: > + Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. + If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. + Once it's done continue. + command: fastboot_reboot_recovery \ No newline at end of file From 7af7976005c8efbb0646fe9fb7fd30444b4f8c6d Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:05:49 +0200 Subject: [PATCH 027/102] Added garden (Redmi 9A & co.) --- README.md | 7 +++ .../assets/configs/garden.yaml | 63 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 openandroidinstaller/assets/configs/garden.yaml diff --git a/README.md b/README.md index a49b1a4a..f944899d 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,13 @@ OnePlus | Nord N200 | [dre](https://wiki.lineageos.org/devices/dre) | | tested OnePlus | 9 | lemonade | | under development +
Xiaomi + +Vendor | Device Name | CodeName | Models | Status +---|---|---|---|--- +Xiaomi | Redmi 9A / 9C / 9AT / 9i / 9A Sport / 10A / 10A Sport | garden / dandelion / blossom / angelican | | tested +
+ And more to come! diff --git a/openandroidinstaller/assets/configs/garden.yaml b/openandroidinstaller/assets/configs/garden.yaml new file mode 100644 index 00000000..4a1169f2 --- /dev/null +++ b/openandroidinstaller/assets/configs/garden.yaml @@ -0,0 +1,63 @@ +metadata: + maintainer: A non (anon) + device_name: Xiaomi Redmi 9A / 9C / 9AT / 9i / 9A Sport / 10A / 10A Sport + is_ab_device: false + device_code: garden + supported_recovery: + - orangefox + - twrp + supported_device_codes: + - dandelion + - garden + - blossom + - angelican + notes: > + - If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com + + - OAI don't support ROM that requires permissiver. + + - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) +requirements: + firmware: MiUI 12.5 (Q) +steps: + unlock_bootloader: + - type: confirm_button + content: > + As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone + how to start and run an operating system (like Android). Your device should be turned on. This will reset your phone. + - type: link_button_with_confirm + content: > + - Create a Mi account on Xiaomi’s website. Beware that one account is only allowed to unlock one unique device every 30 days. + + - Add a phone number to your Mi account, insert a SIM into your phone. + + - Enable developer options in `Settings` > `About Phone` by repeatedly tapping MIUI Version. + + - Link the device to your Mi account in `Settings` > `Additional settings` > `Developer options` > `Mi Unlock status`. + + - Download the Mi Unlock app with the link bellow (Windows is required to run the app), and follow the instructions provided by the app. It may tell you that you have to wait, usually 7 days. If it does so, please wait the quoted amount of time before continuing to the next step! + + - After device and Mi account are successfully verified, the bootloader should be unlocked. + + - Since the device resets completely, you will need to re-enable USB debugging to continue : `Settings` > `Additional settings` > `Developer options` > `USB debugging` + link: https://en.miui.com/unlock/download_en.html + boot_recovery: + - type: confirm_button + content: > + Now you need to boot a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating, + adapting and repairing of the operating system. + - type: call_button + content: > + Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. + command: fastboot_flash_recovery + - type: call_button + img: ofox.png + content: > + Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. + If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. + Once it's done continue. + command: fastboot_reboot_recovery \ No newline at end of file From 361f0a432e4a184647568e009bc1f200016ca515 Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:09:02 +0200 Subject: [PATCH 028/102] Added Mi439 (Redmi 7A & co.) --- README.md | 7 ++ .../assets/configs/Mi439.yaml | 71 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 openandroidinstaller/assets/configs/Mi439.yaml diff --git a/README.md b/README.md index a49b1a4a..b836eb29 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,13 @@ OnePlus | Nord N200 | [dre](https://wiki.lineageos.org/devices/dre) | | tested OnePlus | 9 | lemonade | | under development +
Xiaomi + +Vendor | Device Name | CodeName | Models | Status +---|---|---|---|--- +Xiaomi | Redmi 7A / 8 / 8A / 8A Dual | [Mi439](https://wiki.lineageos.org/devices/Mi439) : pine / olive / olivelite / olivewood | | tested +
+ And more to come! diff --git a/openandroidinstaller/assets/configs/Mi439.yaml b/openandroidinstaller/assets/configs/Mi439.yaml new file mode 100644 index 00000000..1e706574 --- /dev/null +++ b/openandroidinstaller/assets/configs/Mi439.yaml @@ -0,0 +1,71 @@ +metadata: + maintainer: A non (anon) + device_name: Xiaomi Redmi 7A / 8 / 8A / 8A Dual + is_ab_device: false + device_code: Mi439 + supported_recovery: + - orangefox + - twrp + additional_steps: + - dtbo + - vbmeta + - super_empty + supported_device_codes: + - Mi439 + - pine + - olive + - olivelite + - olivewood + notes: > + - If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com + + - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) +requirements: + firmware: MiUI 12.5 (Q) +steps: + unlock_bootloader: + - type: confirm_button + content: > + As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone + how to start and run an operating system (like Android). Your device should be turned on. This will reset your phone. + - type: link_button_with_confirm + content: > + - Create a Mi account on Xiaomi’s website. Beware that one account is only allowed to unlock one unique device every 30 days. + + - Add a phone number to your Mi account, insert a SIM into your phone. + + - Enable developer options in `Settings` > `About Phone` by repeatedly tapping MIUI Version. + + - Link the device to your Mi account in `Settings` > `Additional settings` > `Developer options` > `Mi Unlock status`. + + - Download the Mi Unlock app with the link bellow (Windows is required to run the app), and follow the instructions provided by the app. It may tell you that you have to wait, usually 7 days. If it does so, please wait the quoted amount of time before continuing to the next step! + + - After device and Mi account are successfully verified, the bootloader should be unlocked. + + - Since the device resets completely, you will need to re-enable USB debugging to continue : `Settings` > `Additional settings` > `Developer options` > `USB debugging` + link: https://en.miui.com/unlock/download_en.html + boot_recovery: + - type: call_button + content: > + Now you need to install a custom recovery system on the phone. A recovery is a small subsystem on your phone, + that manages updating, adapting and repairing of the operating system. + + Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + Install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue. + + Note : If you have not selected this partition, it will do nothing. + command: fastboot_flash_additional_partitions + - type: call_button + content: > + Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. + command: fastboot_flash_recovery + - type: call_button + img: ofox.png + content: > + Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. + If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. + Once it's done continue. + command: fastboot_reboot_recovery \ No newline at end of file From f3c91bcae3cdc7723062bf2cd25683322f131ac3 Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:11:47 +0200 Subject: [PATCH 029/102] Added rosemary (Redmi Note 10S & co.) --- README.md | 7 +++ .../assets/configs/rosemary.yaml | 53 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 openandroidinstaller/assets/configs/rosemary.yaml diff --git a/README.md b/README.md index a49b1a4a..0a936efe 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,13 @@ OnePlus | Nord N200 | [dre](https://wiki.lineageos.org/devices/dre) | | tested OnePlus | 9 | lemonade | | under development +
Xiaomi + +Vendor | Device Name | CodeName | Models | Status +---|---|---|---|--- +Xiaomi | Redmi Note 10S / 11SE / Poco M5S | [rosemary](https://wiki.lineageos.org/devices/rosemary) / maltose / secret /rosemary_p | | untested +
+ And more to come! diff --git a/openandroidinstaller/assets/configs/rosemary.yaml b/openandroidinstaller/assets/configs/rosemary.yaml new file mode 100644 index 00000000..eb3d31fd --- /dev/null +++ b/openandroidinstaller/assets/configs/rosemary.yaml @@ -0,0 +1,53 @@ +metadata: + maintainer: A non (anon) + device_name: Xiaomi Redmi Note 10S / 11SE / Poco M5S + is_ab_device: false + device_code: rosemary + supported_recovery: + - orangefox + - twrp + supported_device_codes: + - rosemary + - secret + - maltose + - rosemary_p + notes: > + - If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com + - Please respect the requested by the ROM developers version for MIUI and Android + - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) +steps: + unlock_bootloader: + - type: confirm_button + content: > + As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone + how to start and run an operating system (like Android). Your device should be turned on. This will reset your phone. + - type: link_button_with_confirm + content: > + - Create a Mi account on Xiaomi’s website. Beware that one account is only allowed to unlock one unique device every 30 days. + + - Add a phone number to your Mi account, insert a SIM into your phone. + + - Enable developer options in `Settings` > `About Phone` by repeatedly tapping MIUI Version. + + - Link the device to your Mi account in `Settings` > `Additional settings` > `Developer options` > `Mi Unlock status`. + + - Download the Mi Unlock app with the link bellow (Windows is required to run the app), and follow the instructions provided by the app. It may tell you that you have to wait, usually 7 days. If it does so, please wait the quoted amount of time before continuing to the next step! + + - After device and Mi account are successfully verified, the bootloader should be unlocked. + + - Since the device resets completely, you will need to re-enable USB debugging to continue : `Settings` > `Additional settings` > `Developer options` > `USB debugging` + link: https://en.miui.com/unlock/download_en.html + boot_recovery: + - type: confirm_button + content: > + Now you need to boot a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating, + adapting and repairing of the operating system. + - type: call_button + content: > + Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. + UNTESTED : Need to hold Vol+ or no ? + command: fastboot_flash_boot \ No newline at end of file From f373bc4df5131de248b35c0ac0bda2d5f0dcaad2 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Tue, 1 Aug 2023 18:26:36 +0200 Subject: [PATCH 030/102] Added standard labels to issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/device-support-request.md | 2 +- .github/ISSUE_TEMPLATE/feature-request.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 5b1823ce..233deb9f 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,7 +2,7 @@ name: Bug report about: Create a report to help us improve title: '' -labels: '' +labels: 'bug' assignees: '' --- diff --git a/.github/ISSUE_TEMPLATE/device-support-request.md b/.github/ISSUE_TEMPLATE/device-support-request.md index 325b5f8e..19c848f2 100644 --- a/.github/ISSUE_TEMPLATE/device-support-request.md +++ b/.github/ISSUE_TEMPLATE/device-support-request.md @@ -2,7 +2,7 @@ name: Device support request about: Request support for a new device title: '' -labels: '' +labels: 'device' assignees: '' --- diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md index bbcbbe7d..36014cde 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.md +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -2,7 +2,7 @@ name: Feature request about: Suggest an idea for this project title: '' -labels: '' +labels: 'enhancement' assignees: '' --- From 30c94fa9a44a376313a96f2d4d78e198cf6aeb36 Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Wed, 2 Aug 2023 12:41:11 +0200 Subject: [PATCH 031/102] Add miatoll (Redmi Note 9 Pro &co.) --- README.md | 6 ++ .../assets/configs/miatoll.yaml | 64 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 openandroidinstaller/assets/configs/miatoll.yaml diff --git a/README.md b/README.md index a49b1a4a..e4194acb 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,12 @@ OnePlus | Nord N200 | [dre](https://wiki.lineageos.org/devices/dre) | | tested OnePlus | 9 | lemonade | | under development +
Xiaomi + +Vendor | Device Name | CodeName | Models | Status +---|---|---|---|--- +Xiaomi | Redmi Note 9S / 9 Pro / 9 Pro Max / 10 Lite / Poco M2 pro | [miatoll](https://wiki.lineageos.org/devices/lavender) : gram / curtana / excalibur / joyeuse | | untested +
And more to come! diff --git a/openandroidinstaller/assets/configs/miatoll.yaml b/openandroidinstaller/assets/configs/miatoll.yaml new file mode 100644 index 00000000..2a175b60 --- /dev/null +++ b/openandroidinstaller/assets/configs/miatoll.yaml @@ -0,0 +1,64 @@ +metadata: + maintainer: A non (anon) + device_name: Xiaomi Redmi Note 9S / 9 Pro / 9 Pro Max / 10 Lite / Poco M2 pro + is_ab_device: false + device_code: miatoll + supported_recovery: + - orangefox + - twrp + supported_device_codes: + - miatoll + - gram + - curtana + - excalibur + - joyeuse + notes: > + - If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com/miui/lavender/ + + - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) + + - **This device has never been tested with OAI.** It can go wrong. You may have to finish the installation with command lines. If you test, please report the result on GitHub. +requirements: + android: 12 +steps: + unlock_bootloader: + - type: confirm_button + content: > + As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone + how to start and run an operating system (like Android). Your device should be turned on. This will reset your phone. + - type: link_button_with_confirm + content: > + - Create a Mi account on Xiaomi’s website. Beware that one account is only allowed to unlock one unique device every 30 days. + + - Add a phone number to your Mi account, insert a SIM into your phone. + + - Enable developer options in `Settings` > `About Phone` by repeatedly tapping MIUI Version. + + - Link the device to your Mi account in `Settings` > `Additional settings` > `Developer options` > `Mi Unlock status`. + + - Download the Mi Unlock app with the link bellow (Windows is required to run the app), and follow the instructions provided by the app. It may tell you that you have to wait, usually 7 days. If it does so, please wait the quoted amount of time before continuing to the next step! + + - After device and Mi account are successfully verified, the bootloader should be unlocked. + + - Since the device resets completely, you will need to re-enable USB debugging to continue : `Settings` > `Additional settings` > `Developer options` > `USB debugging` + link: https://en.miui.com/unlock/download_en.html + boot_recovery: + - type: confirm_button + content: > + Now you need to boot a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating, + adapting and repairing of the operating system. + - type: call_button + content: > + Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. + command: fastboot_flash_recovery + - type: call_button + img: ofox.png + content: > + Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. + If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. + Once it's done continue. + command: fastboot_reboot_recovery \ No newline at end of file From 812bb51d9909c33f0b6e72ae7f0aedbb71e01f98 Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Wed, 2 Aug 2023 13:58:18 +0200 Subject: [PATCH 032/102] Update `notes`, add `brand` and `untested` metadata. --- README.md | 4 +++- openandroidinstaller/views/select_view.py | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bea6ab57..e20c44e9 100644 --- a/README.md +++ b/README.md @@ -210,12 +210,14 @@ A config file consists of two parts. The first part are some metadata about the ##### How to write Metadata Every config file should have `metadata` with the following fields: - `maintainer`: str; Maintainer and author of the config file. +- `brand`: [OPTIONAL] str; Name of the brand. Can be used to make brand specific actions. - `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. -- `notes`: [OPTIONAL] str; specific phone information, showed before choosing ROM / recovery +- `notes`: [OPTIONAL] List[str]; specific phone information, showed before choosing ROM / recovery +- `untested`: [OPTIONAL] bool; If `true`, a warning message is showed during installation process. In addition to these metadata, every config can have optional `requirements`. If these are set, the user is asked to check if they are meet. - `android`: [OPTIONAL] int|str; Android version to install prior to installing a custom ROM. diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index a83ae0fe..19b24700 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -147,6 +147,13 @@ def build(self): # Device specific notes if "notes" in self.state.config.metadata: + notes = "" + if "brand" in self.state.config.metadata and (self.state.config.metadata['brand'] == "xiaomi" or self.state.config.metadata['brand'] == "poco"): + notes += "- If something goes wrong, you can reinstall MiUI here :\n\n\n" + if "untested" in self.state.config.metadata and self.state.config.metadata['untested'] == True: + notes += "- **This device has never been tested with OpenAndroidInstaller.** The installation can go wrong. You may have to finish the installation process with command line. If you test, please report the result on GitHub.\n\n" + for note in self.state.config.metadata['notes']: + notes += "- " + note + "\n\n" self.right_view.controls.extend( [ Text( @@ -155,7 +162,7 @@ def build(self): color=colors.RED, weight="bold", ), - Markdown(f"""{self.state.config.metadata['notes']}"""), + Markdown(f"""{notes}"""), ] ) # if there is an available download, show the button to the page From 48be05d5d745966f533c54e983c395b745f5bf9c Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:12:58 +0200 Subject: [PATCH 033/102] Add `brand` metadata & update of `notes` --- openandroidinstaller/assets/configs/Mi439.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openandroidinstaller/assets/configs/Mi439.yaml b/openandroidinstaller/assets/configs/Mi439.yaml index 1e706574..57797c68 100644 --- a/openandroidinstaller/assets/configs/Mi439.yaml +++ b/openandroidinstaller/assets/configs/Mi439.yaml @@ -1,5 +1,6 @@ metadata: maintainer: A non (anon) + brand: xiaomi device_name: Xiaomi Redmi 7A / 8 / 8A / 8A Dual is_ab_device: false device_code: Mi439 @@ -16,9 +17,7 @@ metadata: - olive - olivelite - olivewood - notes: > - - If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com - + notes: - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) requirements: firmware: MiUI 12.5 (Q) From f9351ddc4170f72cfd0dc77ddbbfc89ad4c54abd Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:14:17 +0200 Subject: [PATCH 034/102] Add `brand` metadata & update of `notes` --- openandroidinstaller/assets/configs/garden.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/openandroidinstaller/assets/configs/garden.yaml b/openandroidinstaller/assets/configs/garden.yaml index 4a1169f2..c22b0a5b 100644 --- a/openandroidinstaller/assets/configs/garden.yaml +++ b/openandroidinstaller/assets/configs/garden.yaml @@ -1,5 +1,6 @@ metadata: maintainer: A non (anon) + brand: xiaomi device_name: Xiaomi Redmi 9A / 9C / 9AT / 9i / 9A Sport / 10A / 10A Sport is_ab_device: false device_code: garden @@ -11,11 +12,8 @@ metadata: - garden - blossom - angelican - notes: > - - If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com - + notes: - OAI don't support ROM that requires permissiver. - - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) requirements: firmware: MiUI 12.5 (Q) From 14229af558e06dc4c43715140fe27a1d0b0f7edf Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:14:57 +0200 Subject: [PATCH 035/102] Add `brand` metadata & update of `notes` --- openandroidinstaller/assets/configs/ginkgo.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openandroidinstaller/assets/configs/ginkgo.yaml b/openandroidinstaller/assets/configs/ginkgo.yaml index 248ca052..5e957940 100644 --- a/openandroidinstaller/assets/configs/ginkgo.yaml +++ b/openandroidinstaller/assets/configs/ginkgo.yaml @@ -1,5 +1,6 @@ metadata: maintainer: A non (anon) + brand: xiaomi device_name: Xiaomi Redmi Note 8 / 8T is_ab_device: false device_code: ginkgo @@ -9,8 +10,7 @@ metadata: supported_device_codes: - ginkgo - willow - notes: > - - If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com + notes: - You should install Android 10 or newer ROM. - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) requirements: From 887e265c1b0e16d7a970693fd51d52eac93decc1 Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:15:45 +0200 Subject: [PATCH 036/102] Add `brand` metadata & update of `notes` --- openandroidinstaller/assets/configs/lavender.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/openandroidinstaller/assets/configs/lavender.yaml b/openandroidinstaller/assets/configs/lavender.yaml index dc62e297..bd76bdc9 100644 --- a/openandroidinstaller/assets/configs/lavender.yaml +++ b/openandroidinstaller/assets/configs/lavender.yaml @@ -1,5 +1,6 @@ metadata: maintainer: A non (anon) + brand: xiaomi device_name: Xiaomi Redmi Note 7 is_ab_device: false device_code: lavender @@ -8,11 +9,8 @@ metadata: - twrp supported_device_codes: - lavender - notes: > - - If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com/miui/lavender/ - + notes: - You should install Android 10 or newer ROM. - - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) requirements: android: 10 (Q) From c4aaa3cb0608b35bb8cb6ede35816e2c2f8f4e13 Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:18:45 +0200 Subject: [PATCH 037/102] Add `brand` & `untested` metadata & update of `notes` --- openandroidinstaller/assets/configs/rosemary.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openandroidinstaller/assets/configs/rosemary.yaml b/openandroidinstaller/assets/configs/rosemary.yaml index eb3d31fd..5904a996 100644 --- a/openandroidinstaller/assets/configs/rosemary.yaml +++ b/openandroidinstaller/assets/configs/rosemary.yaml @@ -1,5 +1,6 @@ metadata: maintainer: A non (anon) + brand: xiaomi device_name: Xiaomi Redmi Note 10S / 11SE / Poco M5S is_ab_device: false device_code: rosemary @@ -11,8 +12,8 @@ metadata: - secret - maltose - rosemary_p - notes: > - - If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com + untested: true + notes: - Please respect the requested by the ROM developers version for MIUI and Android - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) steps: From b27cb330d4c0d11eceff761705f33e9be79a6af2 Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:19:14 +0200 Subject: [PATCH 038/102] Add `brand` & `untested` metadata & update of `notes` --- openandroidinstaller/assets/configs/ginkgo.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/openandroidinstaller/assets/configs/ginkgo.yaml b/openandroidinstaller/assets/configs/ginkgo.yaml index 5e957940..537bbb86 100644 --- a/openandroidinstaller/assets/configs/ginkgo.yaml +++ b/openandroidinstaller/assets/configs/ginkgo.yaml @@ -10,6 +10,7 @@ metadata: supported_device_codes: - ginkgo - willow + untested: true notes: - You should install Android 10 or newer ROM. - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) From 0e06fff5d4bfeba27c7d36eb89d0e3347de3cc82 Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:20:05 +0200 Subject: [PATCH 039/102] Add `brand` & `untested` metadata & update of `notes` --- openandroidinstaller/assets/configs/miatoll.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/openandroidinstaller/assets/configs/miatoll.yaml b/openandroidinstaller/assets/configs/miatoll.yaml index 2a175b60..5af6defa 100644 --- a/openandroidinstaller/assets/configs/miatoll.yaml +++ b/openandroidinstaller/assets/configs/miatoll.yaml @@ -1,5 +1,6 @@ metadata: maintainer: A non (anon) + brand: xiaomi device_name: Xiaomi Redmi Note 9S / 9 Pro / 9 Pro Max / 10 Lite / Poco M2 pro is_ab_device: false device_code: miatoll @@ -12,12 +13,9 @@ metadata: - curtana - excalibur - joyeuse - notes: > - - If something goes wrong, you can reinstall MiUI here : https://xiaomifirmwareupdater.com/miui/lavender/ - + untested: true + notes: - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) - - - **This device has never been tested with OAI.** It can go wrong. You may have to finish the installation with command lines. If you test, please report the result on GitHub. requirements: android: 12 steps: From 616c7e6f73fe752e7d9851679663f165b729b023 Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:54:55 +0200 Subject: [PATCH 040/102] Fix --- openandroidinstaller/views/select_view.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index 19b24700..0c45502f 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -146,14 +146,16 @@ def build(self): self.info_field = Row() # Device specific notes + notes = "" + if "brand" in self.state.config.metadata and ( + self.state.config.metadata['brand'] == "xiaomi" or self.state.config.metadata['brand'] == "poco"): + notes += "- If something goes wrong, you can reinstall MiUI here :\n\n\n" + if "untested" in self.state.config.metadata and self.state.config.metadata['untested'] == True: + notes += "- **This device has never been tested with OpenAndroidInstaller.** The installation can go wrong. You may have to finish the installation process with command line. If you test, please report the result on GitHub.\n\n" if "notes" in self.state.config.metadata: - notes = "" - if "brand" in self.state.config.metadata and (self.state.config.metadata['brand'] == "xiaomi" or self.state.config.metadata['brand'] == "poco"): - notes += "- If something goes wrong, you can reinstall MiUI here :\n\n\n" - if "untested" in self.state.config.metadata and self.state.config.metadata['untested'] == True: - notes += "- **This device has never been tested with OpenAndroidInstaller.** The installation can go wrong. You may have to finish the installation process with command line. If you test, please report the result on GitHub.\n\n" for note in self.state.config.metadata['notes']: notes += "- " + note + "\n\n" + if notes != "": self.right_view.controls.extend( [ Text( From 910e04438e3b475a8cf613c22adae9e09972143e Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Fri, 4 Aug 2023 10:52:47 +0200 Subject: [PATCH 041/102] Add davinci (Xiaomi Mi 9T / Redmi K20) --- README.md | 7 +++ .../assets/configs/davinci.yaml | 57 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 openandroidinstaller/assets/configs/davinci.yaml diff --git a/README.md b/README.md index a49b1a4a..8a078e99 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,13 @@ OnePlus | Nord N200 | [dre](https://wiki.lineageos.org/devices/dre) | | tested OnePlus | 9 | lemonade | | under development +
Xiaomi + +Vendor | Device Name | CodeName | Models | Status +---|---|---|---|--- +Xiaomi | Mi 9T / Redmi K20 | [davinci](https://wiki.lineageos.org/devices/davinci) / davinciin | | untested +
+ And more to come! diff --git a/openandroidinstaller/assets/configs/davinci.yaml b/openandroidinstaller/assets/configs/davinci.yaml new file mode 100644 index 00000000..837a9453 --- /dev/null +++ b/openandroidinstaller/assets/configs/davinci.yaml @@ -0,0 +1,57 @@ +metadata: + maintainer: A non (anon) + brand: xiaomi + device_name: Xiaomi Mi 9T / Redmi K20 + is_ab_device: false + device_code: davinci + untested: true + supported_recovery: + - orangefox + - twrp + supported_device_codes: + - davinci + - davinciin + notes: + - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) +steps: + unlock_bootloader: + - type: confirm_button + content: > + As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone + how to start and run an operating system (like Android). Your device should be turned on. This will reset your phone. + - type: link_button_with_confirm + content: > + - Create a Mi account on Xiaomi’s website. Beware that one account is only allowed to unlock one unique device every 30 days. + + - Add a phone number to your Mi account, insert a SIM into your phone. + + - Enable developer options in `Settings` > `About Phone` by repeatedly tapping MIUI Version. + + - Link the device to your Mi account in `Settings` > `Additional settings` > `Developer options` > `Mi Unlock status`. + + - Download the Mi Unlock app with the link bellow (Windows is required to run the app), and follow the instructions provided by the app. It may tell you that you have to wait, usually 7 days. If it does so, please wait the quoted amount of time before continuing to the next step! + + - After device and Mi account are successfully verified, the bootloader should be unlocked. + + - Since the device resets completely, you will need to re-enable USB debugging to continue : `Settings` > `Additional settings` > `Developer options` > `USB debugging` + link: https://en.miui.com/unlock/download_en.html + boot_recovery: + - type: confirm_button + content: > + Now you need to boot a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating, + adapting and repairing of the operating system. + - type: call_button + content: > + Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. + command: fastboot_flash_recovery + - type: call_button + img: ofox.png + content: > + Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. + If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. + Once it's done continue. + command: fastboot_reboot_recovery From 73b7f10767f36554f8447f303a4949dff8083dd9 Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Fri, 4 Aug 2023 16:32:09 +0200 Subject: [PATCH 042/102] Add raphael (Xiaomi Mi 9T Pro / Redmi K20 Pro) --- README.md | 7 ++ .../assets/configs/raphael.yaml | 64 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 openandroidinstaller/assets/configs/raphael.yaml diff --git a/README.md b/README.md index a49b1a4a..8a57cf42 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,13 @@ OnePlus | Nord N200 | [dre](https://wiki.lineageos.org/devices/dre) | | tested OnePlus | 9 | lemonade | | under development +
Xiaomi + +Vendor | Device Name | CodeName | Models | Status +---|---|---|---|--- +Xiaomi | Redmi K20 Pro / Mi 9T Pro | raphael / raphaelin | | untested +
+ And more to come! diff --git a/openandroidinstaller/assets/configs/raphael.yaml b/openandroidinstaller/assets/configs/raphael.yaml new file mode 100644 index 00000000..cb33c102 --- /dev/null +++ b/openandroidinstaller/assets/configs/raphael.yaml @@ -0,0 +1,64 @@ +metadata: + maintainer: A non (anon) + brand: xiaomi + device_name: Xiaomi Mi 9T Pro / Redmi K20 Pro + is_ab_device: false + device_code: raphael + untested: true + supported_recovery: + - orangefox + - twrp + additional_steps: + - super_empty + supported_device_codes: + - raphael + - raphaelin + notes: + - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) +steps: + unlock_bootloader: + - type: confirm_button + content: > + As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone + how to start and run an operating system (like Android). Your device should be turned on. This will reset your phone. + - type: link_button_with_confirm + content: > + - Create a Mi account on Xiaomi’s website. Beware that one account is only allowed to unlock one unique device every 30 days. + + - Add a phone number to your Mi account, insert a SIM into your phone. + + - Enable developer options in `Settings` > `About Phone` by repeatedly tapping MIUI Version. + + - Link the device to your Mi account in `Settings` > `Additional settings` > `Developer options` > `Mi Unlock status`. + + - Download the Mi Unlock app with the link bellow (Windows is required to run the app), and follow the instructions provided by the app. It may tell you that you have to wait, usually 7 days. If it does so, please wait the quoted amount of time before continuing to the next step! + + - After device and Mi account are successfully verified, the bootloader should be unlocked. + + - Since the device resets completely, you will need to re-enable USB debugging to continue : `Settings` > `Additional settings` > `Developer options` > `USB debugging` + link: https://en.miui.com/unlock/download_en.html + boot_recovery: + - type: call_button + content: > + Now you need to install a custom recovery system on the phone. A recovery is a small subsystem on your phone, + that manages updating, adapting and repairing of the operating system. + + Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + Install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue. + + Note : If you have not selected this partition, it will do nothing. + command: fastboot_flash_additional_partitions + - type: call_button + content: > + Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. + command: fastboot_flash_recovery + - type: call_button + img: ofox.png + content: > + Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. + If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. + Once it's done continue. + command: fastboot_reboot_recovery From f46439634d2e3ed36dd9391abfcad50076595b8c Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Fri, 4 Aug 2023 16:58:29 +0200 Subject: [PATCH 043/102] Add function to know image sdk (mainly Android version+20) --- openandroidinstaller/utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/openandroidinstaller/utils.py b/openandroidinstaller/utils.py index 0c17baf5..47aefcaa 100644 --- a/openandroidinstaller/utils.py +++ b/openandroidinstaller/utils.py @@ -59,6 +59,20 @@ def image_works_with_device(supported_device_codes: List[str], image_path: str) ) return False +def image_sdk_level(image_path: str) -> int: + """ + Determine Android version of the selected image. + Android 13 : 33 + """ + with zipfile.ZipFile(image_path) as image_zip: + with image_zip.open( + "META-INF/com/android/metadata", mode="r" + ) as image_metadata: + metadata = image_metadata.readlines() + for line in metadata: + if b"sdk-level" in line: + return int(line[line.find(b'=')+1:-1].decode("utf-8")) + return 0 def recovery_works_with_device(device_code: str, recovery_path: str) -> bool: """Determine if a recovery works for the given device. From dd931a4c6e378848c452a2615faf56c9fddf8145 Mon Sep 17 00:00:00 2001 From: anon1892 <40572253+anon1892@users.noreply.github.com> Date: Fri, 4 Aug 2023 17:34:23 +0200 Subject: [PATCH 044/102] Update device-support-request.md Make simple fields about device, so even beginner fills it up correctly --- .github/ISSUE_TEMPLATE/device-support-request.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/device-support-request.md b/.github/ISSUE_TEMPLATE/device-support-request.md index 19c848f2..2c8b630d 100644 --- a/.github/ISSUE_TEMPLATE/device-support-request.md +++ b/.github/ISSUE_TEMPLATE/device-support-request.md @@ -7,9 +7,10 @@ assignees: '' --- -**Device name** -Please enter the name of the device you would like to request support for. -If you know the device code, please also add it here. +**Device informations** +- Brand: +- Model name: +- Device code: (if unknown, leave blank) **Device images** Please provide links to any available images of the device, such as official stock firmware or custom ROMs you would like to install. From 7e398b8f1ef25a8d967eee350444aeb7feb94001 Mon Sep 17 00:00:00 2001 From: anon1892 <40572253+anon1892@users.noreply.github.com> Date: Fri, 4 Aug 2023 20:02:33 +0200 Subject: [PATCH 045/102] Update device-support-request.md --- .github/ISSUE_TEMPLATE/device-support-request.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/device-support-request.md b/.github/ISSUE_TEMPLATE/device-support-request.md index 2c8b630d..81b7008a 100644 --- a/.github/ISSUE_TEMPLATE/device-support-request.md +++ b/.github/ISSUE_TEMPLATE/device-support-request.md @@ -9,14 +9,15 @@ assignees: '' **Device informations** - Brand: -- Model name: -- Device code: (if unknown, leave blank) +- Phone name: +- Device code (if unknown, leave blank): +- Model (if several models exist): -**Device images** -Please provide links to any available images of the device, such as official stock firmware or custom ROMs you would like to install. +**Device images** +Please provide links to any available images of the device, such as official stock firmware or custom ROMs you would like to install. **Do you own the device and would be willing to test the installer?** - [ ] -**Additional context** -Please provide any additional context or information that may be helpful in adding support for this device. +**Additional context** +Please provide any additional context or information that may be helpful in adding support for this device. From 8f3ac859b39a7fb79cc50596c16689ec3b70496c Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Sat, 5 Aug 2023 18:49:22 +0200 Subject: [PATCH 046/102] Fix readme links... --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 84503ed8..233b3bd7 100644 --- a/README.md +++ b/README.md @@ -183,11 +183,11 @@ All kinds of contributions are welcome. These include: - Add features and/or improve the code base. - Report bugs. -[How to contribute your own installation configurations](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/How_to_contribute_your_own_installation_configurations.md) +[How to contribute your own installation configurations](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/how_to_contribute_your_own_installation_configurations.md) [How to build the application for your platform](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/building_the_application_for_your_platform.md) -[Unlocking the bootloader](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/Unlocking_the_bootloader.md) +[On unlocking the bootloader](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/unlocking_the_bootloader.md) More details on how to contribute can be found [here](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/CONTRIBUTING.md). Please have a look before opening an issue or starting to contribute. From e14293b95353878d1c1921fd3128ee4fc4d059cc Mon Sep 17 00:00:00 2001 From: MagicLike Date: Sun, 6 Aug 2023 15:21:06 +0200 Subject: [PATCH 047/102] Reworked the device request template as form --- .../ISSUE_TEMPLATE/device-support-request.md | 23 ----- .../device-support-request.yaml | 89 +++++++++++++++++++ 2 files changed, 89 insertions(+), 23 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/device-support-request.md create mode 100644 .github/ISSUE_TEMPLATE/device-support-request.yaml diff --git a/.github/ISSUE_TEMPLATE/device-support-request.md b/.github/ISSUE_TEMPLATE/device-support-request.md deleted file mode 100644 index 81b7008a..00000000 --- a/.github/ISSUE_TEMPLATE/device-support-request.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -name: Device support request -about: Request support for a new device -title: '' -labels: 'device' -assignees: '' - ---- - -**Device informations** -- Brand: -- Phone name: -- Device code (if unknown, leave blank): -- Model (if several models exist): - -**Device images** -Please provide links to any available images of the device, such as official stock firmware or custom ROMs you would like to install. - -**Do you own the device and would be willing to test the installer?** -- [ ] - -**Additional context** -Please provide any additional context or information that may be helpful in adding support for this device. diff --git a/.github/ISSUE_TEMPLATE/device-support-request.yaml b/.github/ISSUE_TEMPLATE/device-support-request.yaml new file mode 100644 index 00000000..9823d1f5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/device-support-request.yaml @@ -0,0 +1,89 @@ +name: Device support request +description: Request support for a new device +title: Add support for +labels: ["device"] +body: + - type: markdown + attributes: + value: "Thank you for your interest in OpenAndroidInstaller!" + - type: markdown + attributes: + value: "To get your device supported, please take the time to fill out this form." + - type: markdown + attributes: + value: "---" + - type: checkboxes + attributes: + label: Is your device already requested? + description: Please search to see if an issue for your device already exists. + options: + - label: I have searched the existing issues + required: true + - type: markdown + attributes: + value: "---" + - type: markdown + attributes: + value: "**Please input your device's details below:**" + - type: input + attributes: + label: Brand + description: The brand / manufacturer of your device + placeholder: Google + validations: + required: true + - type: input + attributes: + label: Name + description: The name of your device + placeholder: Pixel 3a + validations: + required: true + - type: input + attributes: + label: Device code + description: The device code OAI gave you in the error message + placeholder: sargo + validations: + required: true + - type: input + attributes: + label: Model + description: The model name of your device (only required, if there are several models) + placeholder: G020F + validations: + required: false + - type: markdown + attributes: + value: "---" + - type: textarea + attributes: + label: Device images + description: "Please provide links to any available images for the device, such as official stock firmware, Custom ROMs and Recoveries you would like to install." + placeholder: | + - Custom ROM: https://wiki.lineageos.org/devices/sargo + - Recovery: https://twrp.me/google/googlepixel3a.html + #value: | + # - Custom ROM: + # - Recovery: + # - Stock firmware (if needed & existing): + render: Markdown + validations: + required: false + - type: markdown + attributes: + value: "---" + - type: checkboxes + attributes: + label: Do you own the device and would be willing to test the installer? + options: + - label: I own the device and am willing to test the installer on it. + required: true + - type: markdown + attributes: + value: "---" + - type: textarea + attributes: + label: Additional context + description: Please provide any additional context or information that might be helpful in adding support for this device. + render: Markdown From b1cee5b83d9b085bc0fc977eb6ed97c4308fc779 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Sun, 6 Aug 2023 19:17:50 +0200 Subject: [PATCH 048/102] Fix unlock_critical --- openandroidinstaller/installer_config.py | 2 +- openandroidinstaller/views/step_view.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/openandroidinstaller/installer_config.py b/openandroidinstaller/installer_config.py index 2a857d83..be6d2dca 100644 --- a/openandroidinstaller/installer_config.py +++ b/openandroidinstaller/installer_config.py @@ -150,7 +150,7 @@ def validate_config(config: str) -> bool: ), "content": str, schema.Optional("command"): Regex( - r"adb_reboot|adb_reboot_bootloader|adb_reboot_download|adb_sideload|adb_twrp_wipe_and_install|adb_twrp_copy_partitions|fastboot_boot_recovery|fastboot_flash_boot|fastboot_unlock_with_code|fastboot_get_unlock_data|fastboot_unlock|fastboot_oem_unlock|fastboot_reboot|heimdall_flash_recovery" + r"adb_reboot|adb_reboot_bootloader|adb_reboot_download|adb_sideload|adb_twrp_wipe_and_install|adb_twrp_copy_partitions|fastboot_boot_recovery|fastboot_flash_boot|fastboot_unlock|fastboot_unlock_critical|fastboot_unlock_with_code|fastboot_get_unlock_data|fastboot_unlock|fastboot_oem_unlock|fastboot_reboot|heimdall_flash_recovery" ), schema.Optional("allow_skip"): bool, schema.Optional("img"): str, diff --git a/openandroidinstaller/views/step_view.py b/openandroidinstaller/views/step_view.py index 1e4dffbf..3ab89f23 100644 --- a/openandroidinstaller/views/step_view.py +++ b/openandroidinstaller/views/step_view.py @@ -48,6 +48,7 @@ fastboot_oem_unlock, fastboot_reboot, fastboot_unlock, + fastboot_unlock_critical, fastboot_unlock_with_code, fastboot_get_unlock_data, heimdall_flash_recovery, @@ -217,6 +218,7 @@ def call_to_phone(self, e, command: str): adb_twrp_copy_partitions, config_path=self.state.config_path ), "fastboot_unlock": fastboot_unlock, + "fastboot_unlock_critical": fastboot_unlock_critical, "fastboot_unlock_with_code": partial( fastboot_unlock_with_code, unlock_code=self.inputtext.value ), From 18faaf61e95b8f259ecc259da45e1a30737a8f8c Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Sun, 6 Aug 2023 19:18:31 +0200 Subject: [PATCH 049/102] fix dreamlte config --- openandroidinstaller/assets/configs/dreamlte.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openandroidinstaller/assets/configs/dreamlte.yaml b/openandroidinstaller/assets/configs/dreamlte.yaml index 7ccbef80..88de8897 100644 --- a/openandroidinstaller/assets/configs/dreamlte.yaml +++ b/openandroidinstaller/assets/configs/dreamlte.yaml @@ -7,7 +7,7 @@ metadata: - dreamlte twrp-link: dreamlte requirements: - android: 9.0 + android: 9 steps: unlock_bootloader: boot_recovery: From 60515ce9c67063476308ebe151fff1b9230db000 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Mon, 7 Aug 2023 17:19:45 +0200 Subject: [PATCH 050/102] Updated hard-coded link to create a device request --- openandroidinstaller/views/start_view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openandroidinstaller/views/start_view.py b/openandroidinstaller/views/start_view.py index ccac31f9..08ecb749 100644 --- a/openandroidinstaller/views/start_view.py +++ b/openandroidinstaller/views/start_view.py @@ -272,7 +272,7 @@ def search_devices_clicked(self, e): f"Device with code '{device_code}' is not supported yet." ) # add request support for device button - request_url = f"https://github.com/openandroidinstaller-dev/openandroidinstaller/issues/new?assignees=&labels=device&projects=&template=device-support-request.md&title=Add support for {device_code}" + request_url = f"https://github.com/openandroidinstaller-dev/openandroidinstaller/issues/new?labels=device&template=device-support-request.yaml&title=Add support for {device_code}" self.device_request_row.controls.append( ElevatedButton( "Request support for this device", From 83d2de40ac7d18789010ed260349316bb3e1fdd5 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Tue, 8 Aug 2023 07:05:22 +0100 Subject: [PATCH 051/102] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 04859e3c..5f651d92 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -6,7 +6,7 @@ patreon: # Replace with a single Patreon username ko_fi: # Replace with a single Ko-fi username tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username +liberapay: OpenAndroidInstaller issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry From 017d3ec60f7b7eba235fb3d4878d4a0256e3e2d0 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Tue, 8 Aug 2023 08:51:11 +0200 Subject: [PATCH 052/102] Allow flashing a custom recovery with a toggle switch --- openandroidinstaller/views/start_view.py | 38 ++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/openandroidinstaller/views/start_view.py b/openandroidinstaller/views/start_view.py index ccac31f9..200ed817 100644 --- a/openandroidinstaller/views/start_view.py +++ b/openandroidinstaller/views/start_view.py @@ -101,14 +101,15 @@ def check_bootloader_unlocked(e): """Enable skipping unlocking the bootloader if selected.""" if self.bootloader_switch.value: logger.info("Skipping bootloader unlocking.") - self.state.steps = copy.deepcopy(self.state.config.boot_recovery) - self.state.num_total_steps = len(self.state.steps) + self.state.steps = [] else: logger.info("Enabled unlocking the bootloader again.") self.state.steps = copy.deepcopy( self.state.config.unlock_bootloader - ) + copy.deepcopy(self.state.config.boot_recovery) - self.state.num_total_steps = len(self.state.steps) + ) + # if the recovery is already flashed, skip flashing it again + if self.recovery_switch.value == False: + self.state.steps += copy.deepcopy(self.state.config.boot_recovery) self.bootloader_switch = Switch( label="Bootloader is already unlocked.", @@ -118,6 +119,32 @@ def check_bootloader_unlocked(e): active_color=colors.GREEN, ) + # toggleswitch to allow skipping flashing recovery + def check_recovery_already_flashed(e): + """Enable skipping flashing recovery if selected.""" + + # manage the bootloader unlocking switch + if self.bootloader_switch.value == False: + self.state.steps = copy.deepcopy( + self.state.config.unlock_bootloader + ) + else: + self.state.steps = [] + + if self.recovery_switch.value: + logger.info("Skipping flashing recovery.") + else: + logger.info("Enabled flashing recovery again.") + self.state.steps += copy.deepcopy(self.state.config.boot_recovery) + + self.recovery_switch = Switch( + label="Custom recovery is already flashed.", + on_change=check_recovery_already_flashed, + disabled=False, + inactive_thumb_color=colors.YELLOW, + active_color=colors.GREEN, + ) + # inform the user about the device detection self.device_name = Text("", weight="bold") self.device_detection_infobox = Row( @@ -179,11 +206,12 @@ def build(self): Divider(), Markdown( """ -If you **already unlocked the bootloader** of your device, please toggle the switch below, to skip the procedure. +If you **already unlocked the bootloader** of your device or already **flashed a custom recovery**, please toggle the respective switch below, to skip the procedure. If you don't know what this means, you most likely don't need to do anything and you can just continue. """ ), Row([self.bootloader_switch]), + Row([self.recovery_switch]), Divider(), self.device_infobox, Row( From 661f9b44f724fc4ccbcc180ae364f536fd4b3afc Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Tue, 8 Aug 2023 19:02:10 +0200 Subject: [PATCH 053/102] Update the code for flashing additional partitions and improve the layout a bit --- ...te_your_own_installation_configurations.md | 3 +- openandroidinstaller/tooling.py | 103 ++++++++------- openandroidinstaller/utils.py | 7 +- openandroidinstaller/views/select_view.py | 118 ++++++++++-------- openandroidinstaller/views/start_view.py | 3 +- 5 files changed, 121 insertions(+), 113 deletions(-) diff --git a/doc/how_to_contribute_your_own_installation_configurations.md b/doc/how_to_contribute_your_own_installation_configurations.md index 1e481e70..c4167dc8 100644 --- a/doc/how_to_contribute_your_own_installation_configurations.md +++ b/doc/how_to_contribute_your_own_installation_configurations.md @@ -16,6 +16,7 @@ Every config file should have `metadata` with the following fields: - `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. +- `additional_steps` : [OPTIONAL] List[str]; A list of additional steps. Can be `dtbo`, `vbmeta`, `vendor_boot` or `super_empty`. In addition to these metadata, every config can have optional `requirements`. If these are set, the user is asked to check if they are meet. - `android`: [OPTIONAL] int|str; Android version to install prior to installing a custom ROM. @@ -32,7 +33,7 @@ Every step in the config file corresponds to one view in the application. These - `img`: [OPTIONAL] Display an image on the left pane of the step view. Images are loaded from `openandroidinstaller/assets/imgs/`. - `content`: str; The content text displayed alongside the action of the step. Used to inform the user about what's going on. For consistency and better readability the text should be moved into the next line using `>`. - `link`: [OPTIONAL] Link to use for the link button if type is `link_button_with_confirm`. -- `command`: [ONLY for call_button* steps] str; The command to run. One of `adb_reboot`, `adb_reboot_bootloader`, `adb_reboot_download`, `adb_sideload`, `adb_twrp_wipe_and_install`, `adb_twrp_copy_partitions`, `fastboot_boot_recovery`, `fastboot_unlock_with_code`, `fastboot_unlock`, `fastboot_oem_unlock`, `fastboot_get_unlock_data`, `fastboot_reboot`, `heimdall_flash_recovery`. +- `command`: [ONLY for call_button* steps] str; The command to run. One of `adb_reboot`, `adb_reboot_bootloader`, `adb_reboot_download`, `adb_sideload`, `adb_twrp_wipe_and_install`, `adb_twrp_copy_partitions`, `fastboot_boot_recovery`, `fastboot_flash_additional_partitions`, `fastboot_unlock_with_code`, `fastboot_unlock`, `fastboot_unlock_critical`, `fastboot_oem_unlock`, `fastboot_get_unlock_data`, `fastboot_reboot`, `heimdall_flash_recovery`. - `allow_skip`: [OPTIONAL] boolean; If a skip button should be displayed to allow skipping this step. Can be useful when the bootloader is already unlocked. **Please try to retain this order of these fields in your config to ensure consistency.** diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index 2b0d1f98..e3999c0b 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -416,7 +416,7 @@ def fastboot_boot_recovery( def fastboot_flash_boot(bin_path: Path, recovery: str) -> TerminalResponse: - """Temporarily, flash custom recovery with fastboot to boot partition.""" + """Flash custom recovery with fastboot to boot partition.""" logger.info("Flash custom recovery with fastboot.") for line in run_command( "fastboot flash boot", target=f"{recovery}", bin_path=bin_path @@ -440,6 +440,54 @@ def fastboot_flash_boot(bin_path: Path, recovery: str) -> TerminalResponse: yield True +@add_logging("Flash additional partitions with fastboot") +def fastboot_flash_additional_partitions( + bin_path: Path, dtbo: Optional[str], vbmeta: Optional[str], super_empty: Optional[str], is_ab: bool = True +) -> TerminalResponse: + """Flash additional partitions (dtbo, vbmeta, super_empty) with fastboot.""" + logger.info("Flash additional partitions with fastboot.") + if dtbo: + logger.info("dtbo selected. Flashing dtbo partition.") + for line in run_command( + "fastboot flash dtbo ", target=f"{dtbo}", bin_path=bin_path + ): + yield line + if not is_ab: + if (type(line) == bool) and not line: + logger.error("Flashing dtbo failed.") + yield False + else: + yield True + else: + yield True + + if vbmeta: + logger.info("vbmeta selected. Flashing vbmeta partition.") + for line in run_command( + "fastboot flash vbmeta ", target=f"{vbmeta}", bin_path=bin_path + ): + yield line + if not is_ab: + if (type(line) == bool) and not line: + logger.error("Flashing vbmeta failed.") + yield False + else: + yield True + + if super_empty: + logger.info("super_empty selected. Wiping super partition.") + for line in run_command( + "fastboot wipe-super ", target=f"{super_empty}", bin_path=bin_path + ): + yield line + if not is_ab: + if (type(line) == bool) and not line: + logger.error("Wiping super failed.") + yield False + else: + yield True + + def heimdall_wait_for_download_available(bin_path: Path) -> bool: """Use heimdall detect to wait for download mode to become available on the device.""" logger.info("Wait for download mode to become available.") @@ -496,55 +544,4 @@ def search_device(platform: str, bin_path: Path) -> Optional[str]: return device_code except CalledProcessError: logger.error("Failed to detect a device.") - return None - - -@add_logging("Flash additional partitions with fastboot") -def fastboot_flash_additional_partitions( - bin_path: Path, dtbo: str, vbmeta: str, super_empty: str, is_ab: bool = True -) -> TerminalResponse: - """Flash additional partitions (dtbo, vbmeta, super_empty) with fastboot.""" - if dtbo: - for line in run_command( - "fastboot flash dtbo ", target=f"{dtbo}", bin_path=bin_path - ): - yield line - if not is_ab: - if (type(line) == bool) and not line: - logger.error("Flashing dtbo failed.") - yield False - else: - yield True - else: - logger.info("No dtbo selected. Skipping") - yield True - - if vbmeta: - for line in run_command( - "fastboot flash vbmeta ", target=f"{vbmeta}", bin_path=bin_path - ): - yield line - if not is_ab: - if (type(line) == bool) and not line: - logger.error("Flashing vbmeta failed.") - yield False - else: - yield True - else: - logger.info("No vbmeta selected. Skipping") - yield True - - if super_empty: - for line in run_command( - "fastboot wipe-super ", target=f"{super_empty}", bin_path=bin_path - ): - yield line - if not is_ab: - if (type(line) == bool) and not line: - logger.error("Wiping super failed.") - yield False - else: - yield True - else: - logger.info("No super_empty selected. Skipping") - yield True + return None \ No newline at end of file diff --git a/openandroidinstaller/utils.py b/openandroidinstaller/utils.py index 0b3e606a..c3539ae6 100644 --- a/openandroidinstaller/utils.py +++ b/openandroidinstaller/utils.py @@ -61,9 +61,10 @@ def image_works_with_device(supported_device_codes: List[str], image_path: str) def image_sdk_level(image_path: str) -> int: - """ - Determine Android version of the selected image. - Android 13 : 33 + """Determine Android version of the selected image. + + Example: + Android 13: 33 """ with zipfile.ZipFile(image_path) as image_zip: with image_zip.open( diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index a4c1aaec..5f17b6d3 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -30,6 +30,7 @@ AlertDialog, FilePicker, FilePickerResultEvent, + Checkbox, ) from flet_core.buttons import CountinuosRectangleBorder @@ -40,7 +41,7 @@ from views import BaseView from app_state import AppState from widgets import get_title, confirm_button -from utils import get_download_link, image_works_with_device, recovery_works_with_device +from utils import get_download_link, image_works_with_device, recovery_works_with_device, image_sdk_level class SelectFilesView(BaseView): @@ -103,9 +104,9 @@ def init_visuals( self.selected_image = Text("Selected image: ") self.selected_recovery = Text("Selected recovery: ") - self.selected_dtbo = Text("Selected dtbo: ") - self.selected_vbmeta = Text("Selected vbmeta: ") - self.selected_super_empty = Text("Selected super_empty: ") + self.selected_dtbo = Checkbox(fill_color=colors.RED, value=None, disabled=True, tristate=True) + self.selected_vbmeta = Checkbox(fill_color=colors.RED, value=None, disabled=True, tristate=True) + self.selected_super_empty = Checkbox(fill_color=colors.RED, value=None, disabled=True, tristate=True) # initialize and manage button state. self.confirm_button = confirm_button(self.on_confirm) @@ -132,11 +133,13 @@ def build(self): ) # attach hidden dialogues - self.right_view.controls.append(self.pick_image_dialog) - self.right_view.controls.append(self.pick_recovery_dialog) - self.right_view.controls.append(self.pick_dtbo_dialog) - self.right_view.controls.append(self.pick_vbmeta_dialog) - self.right_view.controls.append(self.pick_super_empty_dialog) + self.right_view.controls.extend([ + self.pick_image_dialog, + self.pick_recovery_dialog, + self.pick_dtbo_dialog, + self.pick_vbmeta_dialog, + self.pick_super_empty_dialog + ]) # create help/info button to show the help dialog info_button = OutlinedButton( @@ -159,6 +162,8 @@ def build(self): # text row to show infos during the process self.info_field = Row() + # column to insert the additional image selection controls if needed + self.additional_image_selection = Column() # if there is an available download, show the button to the page if self.download_link: twrp_download_link = f"https://dl.twrp.me/{self.state.config.twrp_link if self.state.config.twrp_link else self.state.config.device_code}" @@ -241,21 +246,36 @@ def build(self): ), self.selected_recovery, Divider(), + self.additional_image_selection, ] ) + # attach the bottom buttons + self.right_view.controls.extend( + [ + self.info_field, + Row([self.back_button, self.confirm_button]), + ] + ) + return self.view + + def toggle_additional_image_selection(self): + """Toggle the visibility of the additional image selection controls.""" # attach the controls for uploading others partitions, like dtbo, vbmeta & super_empty + additional_image_selection = [] + if self.state.config.metadata["additional_steps"]: + additional_image_selection.extend([ + Text("Select required additional images:", style="titleSmall"), + Markdown(""" +Your selected device and ROM requires flashing of additional partitions. Please select the required images below. + +Make sure the file is for **your exact phone model!**""", + ) + ]) if "dtbo" in self.state.config.metadata["additional_steps"]: - self.right_view.controls.extend( + self.selected_dtbo.value = False + additional_image_selection.extend( [ - Text("Select other specific images:", style="titleSmall"), - Markdown( - """ - Depending of the ROM, OpenAndroidInstaller may have to install additional images. - These images are usually needed for Android 13 ROM. - Make sure the file is for **your exact phone model!** - """ - ), Row( [ FilledButton( @@ -268,13 +288,14 @@ def build(self): ), expand=True, ), + self.selected_dtbo, ] ), - self.selected_dtbo, ] ) if "vbmeta" in self.state.config.metadata["additional_steps"]: - self.right_view.controls.extend( + self.selected_vbmeta.value = False + additional_image_selection.extend( [ Row( [ @@ -288,13 +309,14 @@ def build(self): ), expand=True, ), + self.selected_vbmeta, ] ), - self.selected_vbmeta, ] ) if "super_empty" in self.state.config.metadata["additional_steps"]: - self.right_view.controls.extend( + self.selected_super_empty.value = False + additional_image_selection.extend( [ Row( [ @@ -308,21 +330,14 @@ def build(self): ), expand=True, ), + self.selected_super_empty, ] ), - self.selected_super_empty, Divider(), ] ) - - # attach the bottom buttons - self.right_view.controls.extend( - [ - self.info_field, - Row([self.back_button, self.confirm_button]), - ] - ) - return self.view + self.additional_image_selection.controls = additional_image_selection + self.additional_image_selection.update() def open_explain_images_dlg(self, e): """Open the dialog to explain OS and recovery image.""" @@ -356,6 +371,12 @@ def pick_image_result(self, e: FilePickerResultEvent): self.selected_image.color = colors.GREEN else: self.selected_image.color = colors.RED + # if the image works and the sdk level is 33 or higher, show the additional image selection + if self.selected_image.color == colors.GREEN and image_sdk_level(self.state.image_path) >= 33: + self.toggle_additional_image_selection() + else: + self.additional_image_selection.controls = [] + self.additional_image_selection.update() # update self.selected_image.update() @@ -385,16 +406,16 @@ def pick_recovery_result(self, e: FilePickerResultEvent): def pick_dtbo_result(self, e: FilePickerResultEvent): path = ", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!" - # update the textfield with the name of the file - self.selected_dtbo.value = self.selected_dtbo.value.split(":")[0] + f": {path}" if e.files: # check if the dtbo works with the device and show the filename in different colors accordingly if path == "dtbo.img": - self.selected_dtbo.color = colors.GREEN + self.selected_dtbo.fill_color = colors.GREEN + self.selected_dtbo.value = True self.state.dtbo_path = e.files[0].path logger.info(f"Selected dtbo from {self.state.dtbo_path}") else: - self.selected_dtbo.color = colors.RED + self.selected_dtbo.fill_color = colors.RED + self.selected_dtbo.value = False else: logger.info("No image selected.") # update @@ -402,10 +423,6 @@ def pick_dtbo_result(self, e: FilePickerResultEvent): def pick_vbmeta_result(self, e: FilePickerResultEvent): path = ", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!" - # update the textfield with the name of the file - self.selected_vbmeta.value = ( - self.selected_vbmeta.value.split(":")[0] + f": {path}" - ) if e.files: # check if the vbmeta works with the device and show the filename in different colors accordingly if path == "vbmeta.img": @@ -422,17 +439,16 @@ def pick_vbmeta_result(self, e: FilePickerResultEvent): def pick_super_empty_result(self, e: FilePickerResultEvent): path = ", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!" # update the textfield with the name of the file - self.selected_super_empty.value = ( - self.selected_super_empty.value.split(":")[0] + f": {path}" - ) if e.files: # check if the super_empty works with the device and show the filename in different colors accordingly if path == "super_empty.img": - self.selected_super_empty.color = colors.GREEN + self.selected_super_empty.fill_color = colors.GREEN + self.selected_super_empty.value = True self.state.super_empty_path = e.files[0].path logger.info(f"Selected super_empty from {self.state.super_empty_path}") else: - self.selected_super_empty.color = colors.RED + self.selected_super_empty.fill_color = colors.RED + self.selected_super_empty.value = False else: logger.info("No image selected.") # update @@ -468,20 +484,14 @@ def enable_button_if_ready(self, e): self.right_view.update() return - if ( - (self.selected_dtbo.color and self.selected_dtbo.color == "red") - or (self.selected_vbmeta.color and self.selected_vbmeta.color == "red") - or ( - self.selected_super_empty.color - and self.selected_super_empty.color == "red" - ) - ): + # check if the additional images work with the device + if any(v == False for v in [self.selected_dtbo.value, self.selected_vbmeta.value, self.selected_super_empty.value]): logger.error( "Some additional images don't match. Please select different ones." ) self.info_field.controls = [ Text( - "Some additional images don't match. Select right ones or unselect them.", + "Some additional images don't match. Please select the right ones.", color=colors.RED, weight="bold", ) diff --git a/openandroidinstaller/views/start_view.py b/openandroidinstaller/views/start_view.py index ad729262..0a9245d5 100644 --- a/openandroidinstaller/views/start_view.py +++ b/openandroidinstaller/views/start_view.py @@ -206,8 +206,7 @@ def build(self): If you don't know what this means, you most likely don't need to do anything and you can just continue. """ ), - Row([self.bootloader_switch]), - Row([self.recovery_switch]), + Row([self.bootloader_switch, self.recovery_switch]), Divider(), self.device_infobox, Row( From 357002c3631d089a64f6a507985133aa189f9acd Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 16 Aug 2023 10:21:58 +0200 Subject: [PATCH 054/102] Add fastboot_flash_recovery and fastboot_reboot_recovery from anon1892 --- openandroidinstaller/tooling.py | 35 ++++++++++++- openandroidinstaller/utils.py | 2 +- openandroidinstaller/views/select_view.py | 60 ++++++++++++++++------- openandroidinstaller/views/step_view.py | 8 +++ 4 files changed, 85 insertions(+), 20 deletions(-) diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index e3999c0b..f7c23db2 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -440,9 +440,40 @@ def fastboot_flash_boot(bin_path: Path, recovery: str) -> TerminalResponse: yield True +@add_logging("Flash custom recovery with fastboot.") +def fastboot_flash_recovery( + bin_path: Path, recovery: str, is_ab: bool = True +) -> TerminalResponse: + """Flash custom recovery with fastboot.""" + for line in run_command( + "fastboot flash recovery ", target=f"{recovery}", bin_path=bin_path + ): + yield line + if not is_ab: + if (type(line) == bool) and not line: + logger.error("Flashing recovery failed.") + yield False + else: + yield True + + +@add_logging("Rebooting device to recovery.") +def fastboot_reboot_recovery(bin_path: Path) -> TerminalResponse: + """Reboot to recovery with fastboot. + + WARNING: On some devices, users need to press a specific key combo to make it work. + """ + for line in run_command("fastboot reboot recovery", bin_path): + yield line + + @add_logging("Flash additional partitions with fastboot") def fastboot_flash_additional_partitions( - bin_path: Path, dtbo: Optional[str], vbmeta: Optional[str], super_empty: Optional[str], is_ab: bool = True + bin_path: Path, + dtbo: Optional[str], + vbmeta: Optional[str], + super_empty: Optional[str], + is_ab: bool = True, ) -> TerminalResponse: """Flash additional partitions (dtbo, vbmeta, super_empty) with fastboot.""" logger.info("Flash additional partitions with fastboot.") @@ -544,4 +575,4 @@ def search_device(platform: str, bin_path: Path) -> Optional[str]: return device_code except CalledProcessError: logger.error("Failed to detect a device.") - return None \ No newline at end of file + return None diff --git a/openandroidinstaller/utils.py b/openandroidinstaller/utils.py index c3539ae6..42f2dccb 100644 --- a/openandroidinstaller/utils.py +++ b/openandroidinstaller/utils.py @@ -63,7 +63,7 @@ def image_works_with_device(supported_device_codes: List[str], image_path: str) def image_sdk_level(image_path: str) -> int: """Determine Android version of the selected image. - Example: + Example: Android 13: 33 """ with zipfile.ZipFile(image_path) as image_zip: diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index 5f17b6d3..ef759809 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -41,7 +41,12 @@ from views import BaseView from app_state import AppState from widgets import get_title, confirm_button -from utils import get_download_link, image_works_with_device, recovery_works_with_device, image_sdk_level +from utils import ( + get_download_link, + image_works_with_device, + recovery_works_with_device, + image_sdk_level, +) class SelectFilesView(BaseView): @@ -104,9 +109,15 @@ def init_visuals( self.selected_image = Text("Selected image: ") self.selected_recovery = Text("Selected recovery: ") - self.selected_dtbo = Checkbox(fill_color=colors.RED, value=None, disabled=True, tristate=True) - self.selected_vbmeta = Checkbox(fill_color=colors.RED, value=None, disabled=True, tristate=True) - self.selected_super_empty = Checkbox(fill_color=colors.RED, value=None, disabled=True, tristate=True) + self.selected_dtbo = Checkbox( + fill_color=colors.RED, value=None, disabled=True, tristate=True + ) + self.selected_vbmeta = Checkbox( + fill_color=colors.RED, value=None, disabled=True, tristate=True + ) + self.selected_super_empty = Checkbox( + fill_color=colors.RED, value=None, disabled=True, tristate=True + ) # initialize and manage button state. self.confirm_button = confirm_button(self.on_confirm) @@ -133,13 +144,15 @@ def build(self): ) # attach hidden dialogues - self.right_view.controls.extend([ - self.pick_image_dialog, - self.pick_recovery_dialog, - self.pick_dtbo_dialog, - self.pick_vbmeta_dialog, - self.pick_super_empty_dialog - ]) + self.right_view.controls.extend( + [ + self.pick_image_dialog, + self.pick_recovery_dialog, + self.pick_dtbo_dialog, + self.pick_vbmeta_dialog, + self.pick_super_empty_dialog, + ] + ) # create help/info button to show the help dialog info_button = OutlinedButton( @@ -264,14 +277,17 @@ def toggle_additional_image_selection(self): # attach the controls for uploading others partitions, like dtbo, vbmeta & super_empty additional_image_selection = [] if self.state.config.metadata["additional_steps"]: - additional_image_selection.extend([ + additional_image_selection.extend( + [ Text("Select required additional images:", style="titleSmall"), - Markdown(""" + Markdown( + """ Your selected device and ROM requires flashing of additional partitions. Please select the required images below. Make sure the file is for **your exact phone model!**""", - ) - ]) + ), + ] + ) if "dtbo" in self.state.config.metadata["additional_steps"]: self.selected_dtbo.value = False additional_image_selection.extend( @@ -372,7 +388,10 @@ def pick_image_result(self, e: FilePickerResultEvent): else: self.selected_image.color = colors.RED # if the image works and the sdk level is 33 or higher, show the additional image selection - if self.selected_image.color == colors.GREEN and image_sdk_level(self.state.image_path) >= 33: + if ( + self.selected_image.color == colors.GREEN + and image_sdk_level(self.state.image_path) >= 33 + ): self.toggle_additional_image_selection() else: self.additional_image_selection.controls = [] @@ -485,7 +504,14 @@ def enable_button_if_ready(self, e): return # check if the additional images work with the device - if any(v == False for v in [self.selected_dtbo.value, self.selected_vbmeta.value, self.selected_super_empty.value]): + if any( + v == False + for v in [ + self.selected_dtbo.value, + self.selected_vbmeta.value, + self.selected_super_empty.value, + ] + ): logger.error( "Some additional images don't match. Please select different ones." ) diff --git a/openandroidinstaller/views/step_view.py b/openandroidinstaller/views/step_view.py index 5824884f..9d431513 100644 --- a/openandroidinstaller/views/step_view.py +++ b/openandroidinstaller/views/step_view.py @@ -45,6 +45,8 @@ adb_twrp_copy_partitions, fastboot_boot_recovery, fastboot_flash_boot, + fastboot_flash_recovery, + fastboot_reboot_recovery, fastboot_flash_additional_partitions, fastboot_oem_unlock, fastboot_reboot, @@ -234,6 +236,12 @@ def call_to_phone(self, e, command: str): fastboot_flash_boot, recovery=self.state.recovery_path, ), + "fastboot_flash_recovery": partial( + fastboot_flash_recovery, + recovery=self.state.recovery_path, + is_ab=self.state.config.is_ab, + ), + "fastboot_reboot_recovery": fastboot_reboot_recovery, "fastboot_flash_additional_partitions": partial( fastboot_flash_additional_partitions, dtbo=self.state.dtbo_path, From 9ba8e215e29d327d353e11702f36cca2422a15a5 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 16 Aug 2023 10:34:42 +0200 Subject: [PATCH 055/102] Fix merge issue --- openandroidinstaller/installer_config.py | 4 +++- openandroidinstaller/views/select_view.py | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/openandroidinstaller/installer_config.py b/openandroidinstaller/installer_config.py index 57393d85..77407a19 100644 --- a/openandroidinstaller/installer_config.py +++ b/openandroidinstaller/installer_config.py @@ -170,7 +170,9 @@ def validate_config(config: str) -> bool: "device_code": str, "supported_device_codes": [str], schema.Optional("twrp-link"): str, - schema.Optional("additional_steps"): Regex(r"dtbo|vbmeta|vendor_boot|super_empty"), + schema.Optional("additional_steps"): [ + Regex(r"dtbo|vbmeta|vendor_boot|super_empty") + ], schema.Optional("notes"): str, schema.Optional("brand"): str, }, diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index 4a262d87..8a66bb0b 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -181,12 +181,17 @@ def build(self): # Device specific notes notes = "" if "brand" in self.state.config.metadata and ( - self.state.config.metadata['brand'] == "xiaomi" or self.state.config.metadata['brand'] == "poco"): + self.state.config.metadata["brand"] == "xiaomi" + or self.state.config.metadata["brand"] == "poco" + ): notes += "- If something goes wrong, you can reinstall MiUI here :\n\n\n" - if "untested" in self.state.config.metadata and self.state.config.metadata['untested'] == True: + if ( + "untested" in self.state.config.metadata + and self.state.config.metadata["untested"] == True + ): notes += "- **This device has never been tested with OpenAndroidInstaller.** The installation can go wrong. You may have to finish the installation process with command line. If you test, please report the result on GitHub.\n\n" if "notes" in self.state.config.metadata: - for note in self.state.config.metadata['notes']: + for note in self.state.config.metadata["notes"]: notes += "- " + note + "\n\n" if notes != "": self.right_view.controls.extend( From 554b75b64ebc039eab1df5e24d9591eecaf58a4f Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 16 Aug 2023 10:39:00 +0200 Subject: [PATCH 056/102] Remove supported recoveries from Mi439 config for now --- openandroidinstaller/assets/configs/Mi439.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/openandroidinstaller/assets/configs/Mi439.yaml b/openandroidinstaller/assets/configs/Mi439.yaml index 57797c68..2ab5be21 100644 --- a/openandroidinstaller/assets/configs/Mi439.yaml +++ b/openandroidinstaller/assets/configs/Mi439.yaml @@ -4,9 +4,6 @@ metadata: device_name: Xiaomi Redmi 7A / 8 / 8A / 8A Dual is_ab_device: false device_code: Mi439 - supported_recovery: - - orangefox - - twrp additional_steps: - dtbo - vbmeta From 0bd2ccc3661e95b34b72d63f7980575401fe4c1b Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 16 Aug 2023 10:40:58 +0200 Subject: [PATCH 057/102] Fix config validation for notes field --- openandroidinstaller/installer_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openandroidinstaller/installer_config.py b/openandroidinstaller/installer_config.py index 77407a19..59419b0c 100644 --- a/openandroidinstaller/installer_config.py +++ b/openandroidinstaller/installer_config.py @@ -173,7 +173,7 @@ def validate_config(config: str) -> bool: schema.Optional("additional_steps"): [ Regex(r"dtbo|vbmeta|vendor_boot|super_empty") ], - schema.Optional("notes"): str, + schema.Optional("notes"): [str], schema.Optional("brand"): str, }, schema.Optional("requirements"): { From 13c85be1897f6e59f46f98b196842d64d1d5d9a3 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 16 Aug 2023 10:55:11 +0200 Subject: [PATCH 058/102] Improve the code of the notes generation a bit --- openandroidinstaller/views/select_view.py | 41 ++++++++++++++--------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index 8a66bb0b..43e5800f 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -179,21 +179,8 @@ def build(self): self.additional_image_selection = Column() # Device specific notes - notes = "" - if "brand" in self.state.config.metadata and ( - self.state.config.metadata["brand"] == "xiaomi" - or self.state.config.metadata["brand"] == "poco" - ): - notes += "- If something goes wrong, you can reinstall MiUI here :\n\n\n" - if ( - "untested" in self.state.config.metadata - and self.state.config.metadata["untested"] == True - ): - notes += "- **This device has never been tested with OpenAndroidInstaller.** The installation can go wrong. You may have to finish the installation process with command line. If you test, please report the result on GitHub.\n\n" - if "notes" in self.state.config.metadata: - for note in self.state.config.metadata["notes"]: - notes += "- " + note + "\n\n" - if notes != "": + notes = self.get_notes() + if notes: self.right_view.controls.extend( [ Text( @@ -202,9 +189,10 @@ def build(self): color=colors.RED, weight="bold", ), - Markdown(f"""{notes}"""), + Markdown(notes), ] ) + # if there is an available download, show the button to the page if self.download_link: twrp_download_link = f"https://dl.twrp.me/{self.state.config.twrp_link if self.state.config.twrp_link else self.state.config.device_code}" @@ -300,6 +288,27 @@ def build(self): ) return self.view + def get_notes(self) -> str: + """Prepare and get notes for the specific device from config.""" + notes = [] + + brand = self.state.config.metadata.get("brand", "") + if brand in ["xiaomi", "poco"]: + notes.append( + f"- If something goes wrong, you can reinstall MiUI here:\n\n" + ) + + # this should be used as little as possible! + if self.state.config.metadata.get("untested", False): + notes.append( + "- **This device has not been tested with OpenAndroidInstaller yet.** The installation can go wrong. You may have to finish the installation process with command line. If you test, please report the result on GitHub." + ) + + notes.extend( + f"- {note}" for note in self.state.config.metadata.get("notes", []) + ) + return "\n\n".join(notes) + def toggle_additional_image_selection(self): """Toggle the visibility of the additional image selection controls.""" # attach the controls for uploading others partitions, like dtbo, vbmeta & super_empty From b90a5e4fe59acbe99850b6a52774e4dc552ed39f Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 16 Aug 2023 11:06:04 +0200 Subject: [PATCH 059/102] Change the location the skip-buttons to the bottom of the start view. --- openandroidinstaller/views/start_view.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openandroidinstaller/views/start_view.py b/openandroidinstaller/views/start_view.py index 0a9245d5..4833a620 100644 --- a/openandroidinstaller/views/start_view.py +++ b/openandroidinstaller/views/start_view.py @@ -120,7 +120,6 @@ def check_bootloader_unlocked(e): # toggleswitch to allow skipping flashing recovery def check_recovery_already_flashed(e): """Enable skipping flashing recovery if selected.""" - # manage the bootloader unlocking switch if self.bootloader_switch.value == False: self.state.steps = copy.deepcopy(self.state.config.unlock_bootloader) @@ -136,7 +135,7 @@ def check_recovery_already_flashed(e): self.recovery_switch = Switch( label="Custom recovery is already flashed.", on_change=check_recovery_already_flashed, - disabled=False, + disabled=True, inactive_thumb_color=colors.YELLOW, active_color=colors.GREEN, ) @@ -206,8 +205,6 @@ def build(self): If you don't know what this means, you most likely don't need to do anything and you can just continue. """ ), - Row([self.bootloader_switch, self.recovery_switch]), - Divider(), self.device_infobox, Row( [ @@ -223,6 +220,8 @@ def build(self): ], alignment="center", ), + Divider(), + Row([self.bootloader_switch, self.recovery_switch]), ] ) return self.view @@ -278,6 +277,7 @@ def search_devices_clicked(self, e): if device_name: self.continue_button.disabled = False self.bootloader_switch.disabled = False + self.recovery_switch.disabled = False # overwrite the text field with the real name from the config self.device_name.value = ( f"{device_name} (code: {self.state.config.device_code})" From fd29a48fa384000088a25044c58cdf7a23649374 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 16 Aug 2023 11:16:37 +0200 Subject: [PATCH 060/102] Improve typing a bit --- openandroidinstaller/installer_config.py | 3 ++- poetry.lock | 2 +- pyproject.toml | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/openandroidinstaller/installer_config.py b/openandroidinstaller/installer_config.py index 59419b0c..62e87bdc 100644 --- a/openandroidinstaller/installer_config.py +++ b/openandroidinstaller/installer_config.py @@ -15,6 +15,7 @@ from pathlib import Path from typing import List, Optional +from typing_extensions import Self import schema import yaml @@ -67,7 +68,7 @@ def __init__( self.twrp_link = metadata.get("twrp-link") @classmethod - def from_file(cls, path): + def from_file(cls, path) -> Self: with open(path, "r", encoding="utf-8") as stream: try: raw_config = yaml.safe_load(stream) diff --git a/poetry.lock b/poetry.lock index 63bc8e14..143175c4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -903,7 +903,7 @@ dev = ["black (>=19.3b0)", "pytest (>=4.6.2)"] [metadata] lock-version = "1.1" python-versions = "<3.11,>=3.9" -content-hash = "f5462dcfd8695f093ffdc7e70d7a90909ab0982f96c3de1564b831223221faeb" +content-hash = "5eb8a128bbc3eb03bb8dd70b45c9e546d7ef88c16b9b562e9c769d1ccc7c0f52" [metadata.files] altgraph = [ diff --git a/pyproject.toml b/pyproject.toml index 61b0fd15..9e20594a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,7 @@ pytest-mock = "^3.10.0" bandit = "^1.7.4" pytest-subprocess = "^1.5.0" mypy = "^1.0.0" +typing-extensions = "^4.7.1" [tool.poetry.dev-dependencies] From 08fa43f6c1edce110cb784f61ee4c7eccc43a00f Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 16 Aug 2023 17:26:09 +0200 Subject: [PATCH 061/102] Add an info box with explainations for additional images; show the scrollbar by default if there is scrolling necessary --- openandroidinstaller/views/base.py | 2 +- openandroidinstaller/views/select_view.py | 79 +++++++++++++++++++++-- 2 files changed, 75 insertions(+), 6 deletions(-) diff --git a/openandroidinstaller/views/base.py b/openandroidinstaller/views/base.py index f32b9d31..e40dd31b 100644 --- a/openandroidinstaller/views/base.py +++ b/openandroidinstaller/views/base.py @@ -34,7 +34,7 @@ def __init__(self, state: AppState, image: str = "placeholder.png"): # right part of the display, add content here. self.right_view_header = Column(width=self.column_width, height=120, spacing=30) self.right_view = Column( - alignment="center", width=self.column_width, height=650, scroll="auto" + alignment="center", width=self.column_width, height=650, scroll="adaptive" ) # left part of the display: used for displaying the images self.left_view = Column( diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index 43e5800f..23368255 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -154,8 +154,8 @@ def build(self): ] ) - # create help/info button to show the help dialog - info_button = OutlinedButton( + # create help/info button to show the help dialog for the image and recovery selection + explain_images_button = OutlinedButton( "What is this?", on_click=self.open_explain_images_dlg, expand=True, @@ -168,7 +168,7 @@ def build(self): self.right_view_header.controls.append( get_title( "Now pick an OS image and a recovery file:", - info_button=info_button, + info_button=explain_images_button, step_indicator_img="steps-header-select.png", ) ) @@ -289,7 +289,10 @@ def build(self): return self.view def get_notes(self) -> str: - """Prepare and get notes for the specific device from config.""" + """Prepare and get notes for the specific device from config. + + These notes should be displayed to the user. + """ notes = [] brand = self.state.config.metadata.get("brand", "") @@ -311,12 +314,67 @@ def get_notes(self) -> str: def toggle_additional_image_selection(self): """Toggle the visibility of the additional image selection controls.""" + # dialogue box to explain additional required images + self.dlg_explain_additional_images = AlertDialog( + modal=True, + title=Text("Why do I need additional images and where do I get them?"), + content=Markdown( + f"""## About additional images +Some devices require additional images to be flashed before the recovery and OS image can be flashed. +Not all images explained below are required for all devices. The installer will tell you which images are required for your device. + +### dtbo.img +The `dtbo.img` is a partition image that contains the device tree overlay. + +### vbmeta.img +The `vbmeta.img` is a partition image that contains the verified boot metadata. +This is required to prevent issues with the verified boot process. + +### super_empty.img +The `super_empty.img` is used to wipe the super partition. This is required to +prevent issues with the super partition when flashing a new ROM. + +### vendor_boot.img +The `vendor_boot.img` is a partition image that contains the vendor boot image. + +## Where do I get these images? +You can download the required images for your device from the [LineageOS downloads page](https://download.lineageos.org/devices/{self.state.config.device_code}/builds). +If this download page does not contain the required images, you can try to find them on the [XDA developers forum](https://forum.xda-developers.com/). + """, + auto_follow_links=True, + ), + actions=[ + TextButton( + "Close", on_click=self.close_close_explain_additional_images_dlg + ), + ], + actions_alignment="end", + shape=CountinuosRectangleBorder(radius=0), + ) + + # create help/info button to show the help dialog for the image and recovery selection + explain_additional_images_button = OutlinedButton( + "Why do I need this and where do I get it?", + on_click=self.open_explain_additional_images_dlg, + expand=True, + icon=icons.HELP_OUTLINE_OUTLINED, + icon_color=colors.DEEP_ORANGE_500, + tooltip="Get more details on additional images and download links.", + ) + # attach the controls for uploading others partitions, like dtbo, vbmeta & super_empty additional_image_selection = [] if self.state.config.metadata["additional_steps"]: additional_image_selection.extend( [ - Text("Select required additional images:", style="titleSmall"), + Row( + [ + Text( + "Select required additional images:", style="titleSmall" + ), + explain_additional_images_button, + ] + ), Markdown( """ Your selected device and ROM requires flashing of additional partitions. Please select the required images below. @@ -403,6 +461,17 @@ def close_close_explain_images_dlg(self, e): self.dlg_explain_images.open = False self.page.update() + def open_explain_additional_images_dlg(self, e): + """Open the dialog to explain additional images.""" + self.page.dialog = self.dlg_explain_additional_images + self.dlg_explain_additional_images.open = True + self.page.update() + + def close_close_explain_additional_images_dlg(self, e): + """Close the dialog to explain additional images.""" + self.dlg_explain_additional_images.open = False + self.page.update() + def pick_image_result(self, e: FilePickerResultEvent): path = ", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!" # update the textfield with the name of the file From ee8938cb1ff24a145a4dd5d6bc5016eedd0f84a3 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Tue, 22 Aug 2023 10:34:47 +0200 Subject: [PATCH 062/102] Add support for Samsung Galaxy S5 LTE (G900F) --- README.md | 1 + openandroidinstaller/assets/configs/klte.yaml | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 openandroidinstaller/assets/configs/klte.yaml diff --git a/README.md b/README.md index 107d001f..ca2e0f61 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,7 @@ Samsung | Galaxy Grand Prime VE | grandprimevelte | SM-G531F | tested Samsung | Galaxy S III Neo | s3ve3g | GT-I9301I | tested Samsung | Galaxy Tab S2 | [gts210vewifi](https://wiki.lineageos.org/devices/gts210vewifi/) | T813 | tested Samsung | Galaxy S4 Mini LTE| [serranoltexx](https://wiki.lineageos.org/devices/serranoltexx) | | tested +Samsung | Galaxy S5 | [klte](https://wiki.lineageos.org/devices/klte) | G900F/M/R4/R7/T/V/W8 | tested Samsung | Galaxy S6 | [zerofltexx](https://wiki.lineageos.org/devices/zerofltexx) | | tested Samsung | Galaxy S6 Edge | [zeroltexx](https://wiki.lineageos.org/devices/zeroltexx) | | tested Samsung | Galaxy S7 | [herolte](https://wiki.lineageos.org/devices/herolte) | SM-G930F | tested diff --git a/openandroidinstaller/assets/configs/klte.yaml b/openandroidinstaller/assets/configs/klte.yaml new file mode 100644 index 00000000..c9dfcc47 --- /dev/null +++ b/openandroidinstaller/assets/configs/klte.yaml @@ -0,0 +1,27 @@ +metadata: + maintainer: Tobias Sterbak (tsterbak) + device_name: Samsung Galaxy S5 LTE + is_ab_device: false + device_code: klte + supported_device_codes: + - klte +steps: + unlock_bootloader: + boot_recovery: + - type: call_button + content: > + As a first step, you need to boot into the bootloader. A bootloader is the piece of software, + that tells your phone how to start and run an operating system (like Android). Your device should be turned on. + Then press 'Confirm and run' to reboot into the bootloader. Continue once it's done. + command: adb_reboot_download + - type: call_button + 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. + command: heimdall_flash_recovery + - type: confirm_button + img: samsung-buttons.png + content: > + Unplug the USB cable from your device. Then manually reboot into recovery by pressing the *Volume Down* + *Power buttons* for 8~10 seconds + until the screen turns black & release the buttons immediately when it does, then boot to recovery with the device powered off, + hold *Volume Up* + *Home* + *Power button*. \ No newline at end of file From a4320b8d1a1edeaeed716e9aacf22a99d2ac7d78 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Tue, 22 Aug 2023 11:46:05 +0200 Subject: [PATCH 063/102] Fix the bug with the progress bar percentages --- .../views/install_addons_view.py | 2 + openandroidinstaller/views/install_view.py | 2 + openandroidinstaller/views/start_view.py | 13 ++---- openandroidinstaller/widgets.py | 46 +++++++++++++------ tests/test_progress_bar.py | 6 +-- 5 files changed, 45 insertions(+), 24 deletions(-) diff --git a/openandroidinstaller/views/install_addons_view.py b/openandroidinstaller/views/install_addons_view.py index ab8068f9..bdc54840 100644 --- a/openandroidinstaller/views/install_addons_view.py +++ b/openandroidinstaller/views/install_addons_view.py @@ -203,6 +203,8 @@ def run_install_addons(self, e): self.error_text.value = "Installation failed! Try again or make sure everything is setup correctly." else: sleep(4) # wait to make sure everything is fine + self.progress_indicator.set_progress_bar(100) + self.progress_indicator.update() logger.success("Installation process was successful. Allow to continue.") # enable the confirm button and disable the call button self.confirm_button.disabled = False diff --git a/openandroidinstaller/views/install_view.py b/openandroidinstaller/views/install_view.py index de6c3858..4b2b7021 100644 --- a/openandroidinstaller/views/install_view.py +++ b/openandroidinstaller/views/install_view.py @@ -210,6 +210,8 @@ def run_install(self, e): self.error_text.value = "Installation failed! Try again or make sure everything is setup correctly." else: sleep(5) # wait to make sure everything is fine + self.progress_indicator.set_progress_bar(100) + self.progress_indicator.update() logger.success("Installation process was successful. Allow to continue.") # enable the confirm button and disable the call button self.confirm_button.disabled = False diff --git a/openandroidinstaller/views/start_view.py b/openandroidinstaller/views/start_view.py index f67e48f4..441f1c28 100644 --- a/openandroidinstaller/views/start_view.py +++ b/openandroidinstaller/views/start_view.py @@ -104,9 +104,7 @@ def check_bootloader_unlocked(e): self.state.steps = [] else: logger.info("Enabled unlocking the bootloader again.") - self.state.steps = copy.deepcopy( - self.state.config.unlock_bootloader - ) + self.state.steps = copy.deepcopy(self.state.config.unlock_bootloader) # if the recovery is already flashed, skip flashing it again if self.recovery_switch.value == False: self.state.steps += copy.deepcopy(self.state.config.boot_recovery) @@ -122,12 +120,10 @@ def check_bootloader_unlocked(e): # toggleswitch to allow skipping flashing recovery def check_recovery_already_flashed(e): """Enable skipping flashing recovery if selected.""" - + # manage the bootloader unlocking switch if self.bootloader_switch.value == False: - self.state.steps = copy.deepcopy( - self.state.config.unlock_bootloader - ) + self.state.steps = copy.deepcopy(self.state.config.unlock_bootloader) else: self.state.steps = [] @@ -140,7 +136,7 @@ def check_recovery_already_flashed(e): self.recovery_switch = Switch( label="Custom recovery is already flashed.", on_change=check_recovery_already_flashed, - disabled=False, + disabled=True, inactive_thumb_color=colors.YELLOW, active_color=colors.GREEN, ) @@ -283,6 +279,7 @@ def search_devices_clicked(self, e): if device_name: self.continue_button.disabled = False self.bootloader_switch.disabled = False + self.recovery_switch.disabled = False # overwrite the text field with the real name from the config self.device_name.value = ( f"{device_name} (code: {self.state.config.device_code})" diff --git a/openandroidinstaller/widgets.py b/openandroidinstaller/widgets.py index 98b8b147..e4400c5a 100644 --- a/openandroidinstaller/widgets.py +++ b/openandroidinstaller/widgets.py @@ -114,6 +114,20 @@ def display_progress_bar(self, line: str): """Display and update the progress bar for the given line.""" percentage_done = None result = None + # create the progress bar + if self.progress_bar == None: + self.progress_bar = ProgressBar( + value=1 / 100, + width=500, + bar_height=32, + color="#00d886", + bgcolor="#eeeeee", + ) + # text to display the percentage + self.percentage_text = Text("1%") + self._container.content.controls.append( + Row([self.percentage_text, self.progress_bar]) + ) # get the progress numbers from the output lines if (type(line) == str) and line.strip(): result = re.search( @@ -122,23 +136,29 @@ def display_progress_bar(self, line: str): ) if result: if result.group(2): - percentage_done = 100 + percentage_done = 99 elif result.group(1): percentage_done = int(result.group(1)) + if percentage_done == 0: + percentage_done = 1 + elif percentage_done == 100: + percentage_done = 99 - # create the progress bar on first occurrence - if percentage_done == 0: - self.progress_bar = ProgressBar( - width=500, bar_height=32, color="#00d886", bgcolor="#eeeeee" - ) - self.percentage_text = Text(f"{percentage_done}%") - self._container.content.controls.append( - Row([self.percentage_text, self.progress_bar]) - ) # update the progress bar - if self.progress_bar: - self.progress_bar.value = percentage_done / 100 - self.percentage_text.value = f"{percentage_done}%" + self.set_progress_bar(percentage_done) + + def set_progress_bar(self, percentage_done: int): + """Set the progress bar to the given percentage. + + Args: + percentage_done (int): Percentage of the progress bar to be filled. + """ + assert ( + percentage_done >= 0 and percentage_done <= 100 + ), "Percentage must be between 0 and 100" + if self.progress_bar: + self.progress_bar.value = percentage_done / 100 + self.percentage_text.value = f"{percentage_done}%" def display_progress_ring( self, diff --git a/tests/test_progress_bar.py b/tests/test_progress_bar.py index 5b1b1fc8..6d79afe5 100644 --- a/tests/test_progress_bar.py +++ b/tests/test_progress_bar.py @@ -30,13 +30,13 @@ def test_init(): def test_update_progress_bar(): """Test if the progress bar is updated properly based on lines.""" progress_indicator = ProgressIndicator(expand=True) - build_indicator = progress_indicator.build() + progress_indicator.build() # test if other line is fine progress_indicator.display_progress_bar( line="Failed to mount '/data' (Device or resource busy)" ) - assert not progress_indicator.progress_bar + assert progress_indicator.progress_bar # test if percentages are parsed correctly and update is performed for percentage in range(0, 47): @@ -46,4 +46,4 @@ def test_update_progress_bar(): # test if the finishing print is detected and updated correctly. progress_indicator.display_progress_bar(line="Total xfer: 1.00x\n") - assert progress_indicator.progress_bar.value == 1.0 + assert progress_indicator.progress_bar.value == 0.99 From 3789f8228fb683f034583ff4c9e3f942094c63b1 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Tue, 22 Aug 2023 12:09:52 +0200 Subject: [PATCH 064/102] Fix vbmeta selection bug and update recovery checks on device codes --- .../assets/configs/Mi439.yaml | 1 + openandroidinstaller/utils.py | 25 ++++++++++++++++--- openandroidinstaller/views/select_view.py | 7 +++++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/openandroidinstaller/assets/configs/Mi439.yaml b/openandroidinstaller/assets/configs/Mi439.yaml index 2ab5be21..a5362a32 100644 --- a/openandroidinstaller/assets/configs/Mi439.yaml +++ b/openandroidinstaller/assets/configs/Mi439.yaml @@ -10,6 +10,7 @@ metadata: - super_empty supported_device_codes: - Mi439 + - mi439 - pine - olive - olivelite diff --git a/openandroidinstaller/utils.py b/openandroidinstaller/utils.py index 42f2dccb..a8511611 100644 --- a/openandroidinstaller/utils.py +++ b/openandroidinstaller/utils.py @@ -41,7 +41,15 @@ def get_download_link(devicecode: str) -> Optional[str]: def image_works_with_device(supported_device_codes: List[str], image_path: str) -> bool: - """Determine if an image works for the given device.""" + """Determine if an image works for the given device. + + Args: + supported_device_codes: List of supported device codes from the config file. + image_path: Path to the image file. + + Returns: + True if the image works with the device, False otherwise. + """ with zipfile.ZipFile(image_path) as image_zip: with image_zip.open( "META-INF/com/android/metadata", mode="r" @@ -77,13 +85,24 @@ def image_sdk_level(image_path: str) -> int: return 0 -def recovery_works_with_device(device_code: str, recovery_path: str) -> bool: +def recovery_works_with_device( + supported_device_codes: List[str], recovery_path: str +) -> bool: """Determine if a recovery works for the given device. BEWARE: THE RECOVERY PART IS STILL VERY BASIC! + + Args: + supported_device_codes: List of supported device codes from the config file. + recovery_path: Path to the recovery file. + + Returns: + True if the recovery works with the device, False otherwise. """ recovery_file_name = recovery_path.split("/")[-1] - if (device_code in recovery_file_name) and ("twrp" in recovery_file_name): + if any(code in recovery_file_name for code in supported_device_codes) and ( + "twrp" in recovery_file_name + ): logger.success("Device supported by the selected recovery.") return True else: diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index 23368255..6a03b976 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -296,7 +296,11 @@ def get_notes(self) -> str: notes = [] brand = self.state.config.metadata.get("brand", "") - if brand in ["xiaomi", "poco"]: + if brand in "xiaomi": + notes.append( + "- If something goes wrong, you can reinstall MiUI here:\n\n" + ) + elif brand in "poco": notes.append( f"- If something goes wrong, you can reinstall MiUI here:\n\n" ) @@ -552,6 +556,7 @@ def pick_vbmeta_result(self, e: FilePickerResultEvent): # check if the vbmeta works with the device and show the filename in different colors accordingly if path == "vbmeta.img": self.selected_vbmeta.color = colors.GREEN + self.selected_vbmeta.value = True self.state.vbmeta_path = e.files[0].path logger.info(f"Selected vbmeta from {self.state.vbmeta_path}") else: From b0e2a0b8d16379008a80236bf38d9d5da1049578 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Tue, 22 Aug 2023 17:50:33 +0200 Subject: [PATCH 065/102] Fix bugs on vbmeta flashing and checking recovery image --- openandroidinstaller/views/select_view.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index 6a03b976..b3d78621 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -555,12 +555,13 @@ def pick_vbmeta_result(self, e: FilePickerResultEvent): if e.files: # check if the vbmeta works with the device and show the filename in different colors accordingly if path == "vbmeta.img": - self.selected_vbmeta.color = colors.GREEN + self.selected_vbmeta.fill_color = colors.GREEN self.selected_vbmeta.value = True self.state.vbmeta_path = e.files[0].path logger.info(f"Selected vbmeta from {self.state.vbmeta_path}") else: - self.selected_vbmeta.color = colors.RED + self.selected_vbmeta.fill_color = colors.RED + self.selected_vbmeta.value = False else: logger.info("No image selected.") # update @@ -589,14 +590,14 @@ def enable_button_if_ready(self, e): if (".zip" in self.selected_image.value) and ( ".img" in self.selected_recovery.value ): - device_code = self.state.config.device_code if not ( image_works_with_device( supported_device_codes=self.state.config.supported_device_codes, image_path=self.state.image_path, ) and recovery_works_with_device( - device_code=device_code, recovery_path=self.state.recovery_path + supported_device_codes=self.state.config.supported_device_codes, + recovery_path=self.state.recovery_path ) ): # if image and recovery work for device allow to move on, otherwise display message From ff5c2a1160b8c23a9ed2acc4b8050b782f74ecbd Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Tue, 29 Aug 2023 10:22:37 +0200 Subject: [PATCH 066/102] Update tests --- openandroidinstaller/views/select_view.py | 2 +- tests/test_progress_bar.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index b3d78621..006b44a9 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -597,7 +597,7 @@ def enable_button_if_ready(self, e): ) and recovery_works_with_device( supported_device_codes=self.state.config.supported_device_codes, - recovery_path=self.state.recovery_path + recovery_path=self.state.recovery_path, ) ): # if image and recovery work for device allow to move on, otherwise display message diff --git a/tests/test_progress_bar.py b/tests/test_progress_bar.py index 6d79afe5..31700450 100644 --- a/tests/test_progress_bar.py +++ b/tests/test_progress_bar.py @@ -39,7 +39,7 @@ def test_update_progress_bar(): assert progress_indicator.progress_bar # test if percentages are parsed correctly and update is performed - for percentage in range(0, 47): + for percentage in range(1, 47): line = f"serving: '/home/tobias/Repositories/openandroidinstaller/images/google-pixel3a/lineage-19.1-20221004-nightly-sargo-signed.zip' (~{percentage}%)\n" progress_indicator.display_progress_bar(line) assert progress_indicator.progress_bar.value == percentage / 100 @@ -47,3 +47,7 @@ def test_update_progress_bar(): # test if the finishing print is detected and updated correctly. progress_indicator.display_progress_bar(line="Total xfer: 1.00x\n") assert progress_indicator.progress_bar.value == 0.99 + + # test if the final set_progress_bar is working correctly + progress_indicator.set_progress_bar(100) + assert progress_indicator.progress_bar.value == 1.0 From 0b53accaf205027bf530aa0b5a2d8c3db1c76b2c Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Tue, 29 Aug 2023 11:15:39 +0200 Subject: [PATCH 067/102] ADd workflows to not flash the recovery and still work --- openandroidinstaller/app_state.py | 52 ++++++++++- openandroidinstaller/tooling.py | 9 ++ openandroidinstaller/views/select_view.py | 102 ++++++++++++++-------- openandroidinstaller/views/start_view.py | 23 +---- openandroidinstaller/views/step_view.py | 2 + 5 files changed, 131 insertions(+), 57 deletions(-) diff --git a/openandroidinstaller/app_state.py b/openandroidinstaller/app_state.py index 3fa621a3..3af77e1e 100644 --- a/openandroidinstaller/app_state.py +++ b/openandroidinstaller/app_state.py @@ -16,8 +16,9 @@ import copy from pathlib import Path from typing import List, Optional +from loguru import logger -from installer_config import _load_config +from installer_config import _load_config, Step class AppState: @@ -37,6 +38,10 @@ def __init__( self.test = test self.test_config = test_config + # store state + self.unlock_bootloader = True + self.flash_recovery = True + # placeholders self.advanced = False self.install_addons = False @@ -72,3 +77,48 @@ def load_config(self, device_code: str): self.steps = copy.deepcopy(self.config.unlock_bootloader) + copy.deepcopy( self.config.boot_recovery ) + + def toggle_flash_unlock_bootloader(self): + """Toggle flashing of unlock bootloader.""" + self.unlock_bootloader = not self.unlock_bootloader + if self.unlock_bootloader: + logger.info("Enabled unlocking the bootloader again.") + self.steps = copy.deepcopy(self.config.unlock_bootloader) + else: + logger.info("Skipping bootloader unlocking.") + self.steps = [] + # if the recovery is already flashed, skip flashing it again + if self.flash_recovery: + self.steps += copy.deepcopy(self.config.boot_recovery) + else: + self.steps = [ + Step( + title="Boot custom recovery", + type="confirm_button", + content="If you already flashed TWRP, boot into it by pressing 'Confirm and run'. Otherwise restart the process. Once your phone screen looks like the picture on the left, continue.", + command="adb_reboot_recovery", + img="twrp-start.jpeg", + ) + ] + + def toggle_flash_recovery(self): + """Toggle flashing of recovery.""" + self.flash_recovery = not self.flash_recovery + if self.unlock_bootloader: + self.steps = copy.deepcopy(self.config.unlock_bootloader) + else: + self.steps = [] + if self.flash_recovery: + logger.info("Enabled flashing recovery again.") + self.steps += copy.deepcopy(self.config.boot_recovery) + else: + logger.info("Skipping flashing recovery.") + self.steps = [ + Step( + title="Boot custom recovery", + type="confirm_button", + content="If you already flashed TWRP, boot into it by pressing 'Confirm and run'. Otherwise restart the process. Once your phone screen looks like the picture on the left, continue.", + command="adb_reboot_recovery", + img="twrp-start.jpeg", + ) + ] diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index f7c23db2..03dcff5a 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -161,6 +161,15 @@ def adb_wait_for_sideload(bin_path: Path) -> TerminalResponse: yield line +@add_logging("Reboot to recovery with adb") +def adb_reboot_recovery(bin_path: Path) -> TerminalResponse: + """Reboot to recovery with adb.""" + for line in run_command("adb reboot recovery", bin_path): + yield line + for line in adb_wait_for_recovery(bin_path=bin_path): + yield line + + def adb_twrp_copy_partitions(bin_path: Path, config_path: Path) -> TerminalResponse: # some devices like one plus 6t or motorola moto g7 power need the partitions copied to prevent a hard brick logger.info("Sideload copy_partitions script with adb.") diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index 006b44a9..0a1a0736 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -251,33 +251,38 @@ def build(self): ), self.selected_image, Divider(), - Text("Select a TWRP recovery image:", style="titleSmall"), - Markdown( - f""" + ] + ) + if self.state.flash_recovery: + self.right_view.controls.extend( + [ + Text("Select a TWRP recovery image:", style="titleSmall"), + Markdown( + f""" The recovery image should look something like `twrp-3.7.0_12-0-{self.state.config.device_code}.img`. **Note:** This tool **only supports TWRP recoveries**.""", - extension_set="gitHubFlavored", - ), - Row( - [ - FilledButton( - "Pick TWRP recovery file", - icon=icons.UPLOAD_FILE, - on_click=lambda _: self.pick_recovery_dialog.pick_files( - allow_multiple=False, - file_type="custom", - allowed_extensions=["img"], + extension_set="gitHubFlavored", + ), + Row( + [ + FilledButton( + "Pick TWRP recovery file", + icon=icons.UPLOAD_FILE, + on_click=lambda _: self.pick_recovery_dialog.pick_files( + allow_multiple=False, + file_type="custom", + allowed_extensions=["img"], + ), + expand=True, ), - expand=True, - ), - ] - ), - self.selected_recovery, - Divider(), - self.additional_image_selection, - ] - ) + ] + ), + self.selected_recovery, + Divider(), + self.additional_image_selection, + ] + ) # attach the bottom buttons self.right_view.controls.extend( @@ -296,11 +301,11 @@ def get_notes(self) -> str: notes = [] brand = self.state.config.metadata.get("brand", "") - if brand in "xiaomi": + if brand == "xiaomi": notes.append( "- If something goes wrong, you can reinstall MiUI here:\n\n" ) - elif brand in "poco": + elif brand == "poco": notes.append( f"- If something goes wrong, you can reinstall MiUI here:\n\n" ) @@ -498,14 +503,15 @@ def pick_image_result(self, e: FilePickerResultEvent): else: self.selected_image.color = colors.RED # if the image works and the sdk level is 33 or higher, show the additional image selection - if ( - self.selected_image.color == colors.GREEN - and image_sdk_level(self.state.image_path) >= 33 - ): - self.toggle_additional_image_selection() - else: - self.additional_image_selection.controls = [] - self.additional_image_selection.update() + if self.state.flash_recovery: + if ( + self.selected_image.color == colors.GREEN + and image_sdk_level(self.state.image_path) >= 33 + ): + self.toggle_additional_image_selection() + else: + self.additional_image_selection.controls = [] + self.additional_image_selection.update() # update self.selected_image.update() @@ -523,9 +529,9 @@ def pick_recovery_result(self, e: FilePickerResultEvent): logger.info("No image selected.") # check if the recovery works with the device and show the filename in different colors accordingly if e.files: - device_code = self.state.config.device_code if recovery_works_with_device( - device_code=device_code, recovery_path=self.state.recovery_path + supported_device_codes=self.state.config.supported_device_codes, + recovery_path=self.state.recovery_path, ): self.selected_recovery.color = colors.GREEN else: @@ -642,5 +648,31 @@ def enable_button_if_ready(self, e): self.info_field.controls = [] self.confirm_button.disabled = False self.right_view.update() + elif (".zip" in self.selected_image.value) and (not self.state.flash_recovery): + if not ( + image_works_with_device( + supported_device_codes=self.state.config.supported_device_codes, + image_path=self.state.image_path, + ) + ): + # if image works for device allow to move on, otherwise display message + logger.error( + "Image doesn't work with the device. Please select a different one." + ) + self.info_field.controls = [ + Text( + "Image doesn't work with the device.", + color=colors.RED, + weight="bold", + ) + ] + self.confirm_button.disabled = True + self.right_view.update() + return + + logger.info("Image works with the device. You can continue.") + self.info_field.controls = [] + self.confirm_button.disabled = False + self.right_view.update() else: self.confirm_button.disabled = True diff --git a/openandroidinstaller/views/start_view.py b/openandroidinstaller/views/start_view.py index 4833a620..8bc9d3fc 100644 --- a/openandroidinstaller/views/start_view.py +++ b/openandroidinstaller/views/start_view.py @@ -13,7 +13,6 @@ # If not, see .""" # Author: Tobias Sterbak -import copy import webbrowser from loguru import logger from typing import Callable @@ -99,15 +98,7 @@ def init_visuals( # toggleswitch to allow skipping unlocking the bootloader def check_bootloader_unlocked(e): """Enable skipping unlocking the bootloader if selected.""" - if self.bootloader_switch.value: - logger.info("Skipping bootloader unlocking.") - self.state.steps = [] - else: - logger.info("Enabled unlocking the bootloader again.") - self.state.steps = copy.deepcopy(self.state.config.unlock_bootloader) - # if the recovery is already flashed, skip flashing it again - if self.recovery_switch.value == False: - self.state.steps += copy.deepcopy(self.state.config.boot_recovery) + self.state.toggle_flash_unlock_bootloader() self.bootloader_switch = Switch( label="Bootloader is already unlocked.", @@ -120,17 +111,7 @@ def check_bootloader_unlocked(e): # toggleswitch to allow skipping flashing recovery def check_recovery_already_flashed(e): """Enable skipping flashing recovery if selected.""" - # manage the bootloader unlocking switch - if self.bootloader_switch.value == False: - self.state.steps = copy.deepcopy(self.state.config.unlock_bootloader) - else: - self.state.steps = [] - - if self.recovery_switch.value: - logger.info("Skipping flashing recovery.") - else: - logger.info("Enabled flashing recovery again.") - self.state.steps += copy.deepcopy(self.state.config.boot_recovery) + self.state.toggle_flash_recovery() self.recovery_switch = Switch( label="Custom recovery is already flashed.", diff --git a/openandroidinstaller/views/step_view.py b/openandroidinstaller/views/step_view.py index 9d431513..3fbe2af3 100644 --- a/openandroidinstaller/views/step_view.py +++ b/openandroidinstaller/views/step_view.py @@ -41,6 +41,7 @@ adb_reboot, adb_reboot_bootloader, adb_reboot_download, + adb_reboot_recovery, adb_sideload, adb_twrp_copy_partitions, fastboot_boot_recovery, @@ -216,6 +217,7 @@ def call_to_phone(self, e, command: str): "adb_reboot": adb_reboot, "adb_reboot_bootloader": adb_reboot_bootloader, "adb_reboot_download": adb_reboot_download, + "adb_reboot_recovery": adb_reboot_recovery, "adb_sideload": partial(adb_sideload, target=self.state.image_path), "adb_twrp_copy_partitions": partial( adb_twrp_copy_partitions, config_path=self.state.config_path From 70925970f1b8fd579571ba1a2e7cadad4b611d11 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Tue, 29 Aug 2023 12:49:13 +0200 Subject: [PATCH 068/102] Minor fix --- openandroidinstaller/views/select_view.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index 0a1a0736..5965d2ae 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -301,14 +301,10 @@ def get_notes(self) -> str: notes = [] brand = self.state.config.metadata.get("brand", "") - if brand == "xiaomi": + if brand in ["xiaomi", "poco"]: notes.append( "- If something goes wrong, you can reinstall MiUI here:\n\n" ) - elif brand == "poco": - notes.append( - f"- If something goes wrong, you can reinstall MiUI here:\n\n" - ) # this should be used as little as possible! if self.state.config.metadata.get("untested", False): From 6c09fbfc09847f49899447fb354fa3938a1de7c0 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Mon, 4 Sep 2023 17:56:26 +0200 Subject: [PATCH 069/102] Fix some bugs in the behaviour of the select view with additional images; now allow to skip additional images if you want to --- openandroidinstaller/app_state.py | 2 +- openandroidinstaller/views/select_view.py | 29 +++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/openandroidinstaller/app_state.py b/openandroidinstaller/app_state.py index 3af77e1e..30f68b08 100644 --- a/openandroidinstaller/app_state.py +++ b/openandroidinstaller/app_state.py @@ -116,7 +116,7 @@ def toggle_flash_recovery(self): self.steps = [ Step( title="Boot custom recovery", - type="confirm_button", + type="call_button", content="If you already flashed TWRP, boot into it by pressing 'Confirm and run'. Otherwise restart the process. Once your phone screen looks like the picture on the left, continue.", command="adb_reboot_recovery", img="twrp-start.jpeg", diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index 5965d2ae..da3e08cb 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -122,6 +122,10 @@ def init_visuals( # initialize and manage button state. self.confirm_button = confirm_button(self.on_confirm) self.confirm_button.disabled = True + self.continue_eitherway_button = confirm_button( + self.on_confirm, "Continue without additional images" + ) + self.continue_eitherway_button.disabled = True self.pick_recovery_dialog.on_result = self.enable_button_if_ready self.pick_image_dialog.on_result = self.enable_button_if_ready self.pick_dtbo_dialog.on_result = self.enable_button_if_ready @@ -288,7 +292,13 @@ def build(self): self.right_view.controls.extend( [ self.info_field, - Row([self.back_button, self.confirm_button]), + Row( + [ + self.back_button, + self.continue_eitherway_button, + self.confirm_button, + ] + ), ] ) return self.view @@ -614,24 +624,26 @@ def enable_button_if_ready(self, e): ) ] self.confirm_button.disabled = True + self.continue_eitherway_button.disabled = True self.right_view.update() return - # check if the additional images work with the device - if any( - v == False - for v in [ + self.continue_eitherway_button.disabled = False + + # check if the additional images are there + if not all( + [ self.selected_dtbo.value, self.selected_vbmeta.value, self.selected_super_empty.value, ] ): logger.error( - "Some additional images don't match. Please select different ones." + "Some additional images don't match or are missing. Please select different ones." ) self.info_field.controls = [ Text( - "Some additional images don't match. Please select the right ones.", + "Some additional images don't match or are missing. Please select the right ones.", color=colors.RED, weight="bold", ) @@ -663,12 +675,15 @@ def enable_button_if_ready(self, e): ) ] self.confirm_button.disabled = True + self.continue_eitherway_button.disabled = True self.right_view.update() return logger.info("Image works with the device. You can continue.") self.info_field.controls = [] self.confirm_button.disabled = False + self.continue_eitherway_button.disabled = False self.right_view.update() else: self.confirm_button.disabled = True + self.continue_eitherway_button.disabled = True From 83dbd7ae3880454033b99251a1098a5d02a68b6f Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Mon, 4 Sep 2023 18:08:38 +0200 Subject: [PATCH 070/102] Update the message to acompany the install progress bar --- openandroidinstaller/views/install_view.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openandroidinstaller/views/install_view.py b/openandroidinstaller/views/install_view.py index 4b2b7021..6e8c7b4d 100644 --- a/openandroidinstaller/views/install_view.py +++ b/openandroidinstaller/views/install_view.py @@ -54,7 +54,7 @@ def __init__( def build(self): """Create the content of the view.""" # error text - self.error_text = Text("", color=colors.RED) + self.error_text = Text("", color=colors.GREEN) # switch to enable advanced output - here it means show terminal input/output in tool def check_advanced_switch(e): @@ -178,7 +178,8 @@ def run_install(self, e): # disable the call button while the command is running self.install_button.disabled = True self.install_addons_switch.disabled = True - self.error_text.value = "" + self.error_text.value = "Please be patient, it may take a few minutes." + self.error_text.color = colors.GREEN # reset the progress indicators self.progress_indicator.clear() # reset terminal output @@ -208,6 +209,7 @@ def run_install(self, e): self.install_button.disabled = False # also remove the last error text if it happened self.error_text.value = "Installation failed! Try again or make sure everything is setup correctly." + self.error_text.color = colors.RED else: sleep(5) # wait to make sure everything is fine self.progress_indicator.set_progress_bar(100) From 1cfc293819eff34f54645a1563985aecd57e0709 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Tue, 5 Sep 2023 13:38:49 +0200 Subject: [PATCH 071/102] Fix bug where the validation still required some additional images even if non are required; hide the additional button to bypass additional images if non are necessary --- openandroidinstaller/installer_config.py | 4 +--- openandroidinstaller/views/select_view.py | 29 +++++++++++++---------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/openandroidinstaller/installer_config.py b/openandroidinstaller/installer_config.py index 62e87bdc..e5be79c7 100644 --- a/openandroidinstaller/installer_config.py +++ b/openandroidinstaller/installer_config.py @@ -63,7 +63,7 @@ def __init__( self.requirements = requirements self.device_code = metadata.get("device_code") self.is_ab = metadata.get("is_ab_device", False) - self.additional_steps = metadata.get("additional_steps") + self.additional_steps = metadata.get("additional_steps", []) self.supported_device_codes = metadata.get("supported_device_codes") self.twrp_link = metadata.get("twrp-link") @@ -136,8 +136,6 @@ def _load_config(device_code: str, config_path: Path) -> Optional[InstallerConfi config = InstallerConfig.from_file(path) logger.info(f"Loaded device config from {path}.") if config: - if "additional_steps" not in config.metadata: - config.metadata.update({"additional_steps": "[]"}) logger.info(f"Config metadata: {config.metadata}.") return config else: diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index da3e08cb..c767d343 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -289,16 +289,19 @@ def build(self): ) # attach the bottom buttons + if self.state.config.additional_steps: + bottom_buttons = [ + self.back_button, + self.continue_eitherway_button, + self.confirm_button, + ] + + else: + bottom_buttons = [self.back_button, self.confirm_button] self.right_view.controls.extend( [ self.info_field, - Row( - [ - self.back_button, - self.continue_eitherway_button, - self.confirm_button, - ] - ), + Row(bottom_buttons), ] ) return self.view @@ -379,7 +382,7 @@ def toggle_additional_image_selection(self): # attach the controls for uploading others partitions, like dtbo, vbmeta & super_empty additional_image_selection = [] - if self.state.config.metadata["additional_steps"]: + if self.state.config.additional_steps: additional_image_selection.extend( [ Row( @@ -398,7 +401,7 @@ def toggle_additional_image_selection(self): ), ] ) - if "dtbo" in self.state.config.metadata["additional_steps"]: + if "dtbo" in self.state.config.additional_steps: self.selected_dtbo.value = False additional_image_selection.extend( [ @@ -419,7 +422,7 @@ def toggle_additional_image_selection(self): ), ] ) - if "vbmeta" in self.state.config.metadata["additional_steps"]: + if "vbmeta" in self.state.config.additional_steps: self.selected_vbmeta.value = False additional_image_selection.extend( [ @@ -440,7 +443,7 @@ def toggle_additional_image_selection(self): ), ] ) - if "super_empty" in self.state.config.metadata["additional_steps"]: + if "super_empty" in self.state.config.additional_steps: self.selected_super_empty.value = False additional_image_selection.extend( [ @@ -631,7 +634,7 @@ def enable_button_if_ready(self, e): self.continue_eitherway_button.disabled = False # check if the additional images are there - if not all( + if self.state.config.additional_steps and not all( [ self.selected_dtbo.value, self.selected_vbmeta.value, @@ -686,4 +689,4 @@ def enable_button_if_ready(self, e): self.right_view.update() else: self.confirm_button.disabled = True - self.continue_eitherway_button.disabled = True + # self.continue_eitherway_button.disabled = True From ed77d85b7fc488248cc03cb880a0371e39c62cf4 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Tue, 5 Sep 2023 15:00:28 +0200 Subject: [PATCH 072/102] Improve behaviour of the continue buttons and validation --- openandroidinstaller/views/select_view.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index c767d343..1e3e98f0 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -636,9 +636,9 @@ def enable_button_if_ready(self, e): # check if the additional images are there if self.state.config.additional_steps and not all( [ - self.selected_dtbo.value, - self.selected_vbmeta.value, - self.selected_super_empty.value, + self.selected_dtbo.value or "dtbo" not in self.state.config.additional_steps, + self.selected_vbmeta.value or "vbmeta" not in self.state.config.additional_steps, + self.selected_super_empty.value or "super_empty" not in self.state.config.additional_steps, ] ): logger.error( @@ -658,6 +658,7 @@ def enable_button_if_ready(self, e): logger.info("Image and recovery work with the device. You can continue.") self.info_field.controls = [] self.confirm_button.disabled = False + self.continue_eitherway_button.disabled = True self.right_view.update() elif (".zip" in self.selected_image.value) and (not self.state.flash_recovery): if not ( @@ -685,7 +686,7 @@ def enable_button_if_ready(self, e): logger.info("Image works with the device. You can continue.") self.info_field.controls = [] self.confirm_button.disabled = False - self.continue_eitherway_button.disabled = False + self.continue_eitherway_button.disabled = True self.right_view.update() else: self.confirm_button.disabled = True From bd343ed90dd15ee1c353dd4a12c03f22e2728247 Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Fri, 8 Sep 2023 20:34:38 +0200 Subject: [PATCH 073/102] Add support for vayu (Poco X3 Pro) --- README.md | 7 +++ openandroidinstaller/assets/configs/vayu.yaml | 56 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 openandroidinstaller/assets/configs/vayu.yaml diff --git a/README.md b/README.md index a49b1a4a..c883804b 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,13 @@ OnePlus | Nord N200 | [dre](https://wiki.lineageos.org/devices/dre) | | tested OnePlus | 9 | lemonade | | under development +
Xiaomi + +Vendor | Device Name | CodeName | Models | Status +---|---|---|---|--- +Xiaomi | Poco X3 Pro | [vayu](https://wiki.lineageos.org/devices/vayu) | | untested +
+ And more to come! diff --git a/openandroidinstaller/assets/configs/vayu.yaml b/openandroidinstaller/assets/configs/vayu.yaml new file mode 100644 index 00000000..63bd752e --- /dev/null +++ b/openandroidinstaller/assets/configs/vayu.yaml @@ -0,0 +1,56 @@ +metadata: + maintainer: A non (anon) + brand: poco + device_name: Poco X3 Pro + is_ab_device: false + device_code: vayu + supported_recovery: + - orangefox + - twrp + supported_device_codes: + - vayu + - bhima +requirements: + android: 12 (S) +steps: + unlock_bootloader: + - type: confirm_button + content: > + As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone + how to start and run an operating system (like Android). Your device should be turned on. This will reset your phone. + - type: link_button_with_confirm + content: > + - Create a Mi account on Xiaomi’s website. Beware that one account is only allowed to unlock one unique device every 30 days. + + - Add a phone number to your Mi account, insert a SIM into your phone. + + - Enable developer options in `Settings` > `About Phone` by repeatedly tapping MIUI Version. + + - Link the device to your Mi account in `Settings` > `Additional settings` > `Developer options` > `Mi Unlock status`. + + - Download the Mi Unlock app with the link bellow (Windows is required to run the app), and follow the instructions provided by the app. It may tell you that you have to wait, usually 7 days. If it does so, please wait the quoted amount of time before continuing to the next step! + + - After device and Mi account are successfully verified, the bootloader should be unlocked. + + - Since the device resets completely, you will need to re-enable USB debugging to continue : `Settings` > `Additional settings` > `Developer options` > `USB debugging` + link: https://en.miui.com/unlock/download_en.html + boot_recovery: + - type: confirm_button + content: > + Now you need to boot a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating, + adapting and repairing of the operating system. + - type: call_button + content: > + Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. + command: fastboot_flash_recovery + - type: call_button + img: ofox.png + content: > + Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. + If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. + Once it's done continue. + command: fastboot_reboot_recovery \ No newline at end of file From 0bc2f9dc0c3183e7b4190b9e64e0159ad22a1771 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Mon, 11 Sep 2023 17:17:34 +0200 Subject: [PATCH 074/102] Added formatting for device request link Added monospace formatting for the device code getting placed into the title of the issue in case the "Request support for this device" button is used. --- openandroidinstaller/views/start_view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openandroidinstaller/views/start_view.py b/openandroidinstaller/views/start_view.py index 441f1c28..1f30490d 100644 --- a/openandroidinstaller/views/start_view.py +++ b/openandroidinstaller/views/start_view.py @@ -297,7 +297,7 @@ def search_devices_clicked(self, e): f"Device with code '{device_code}' is not supported yet." ) # add request support for device button - request_url = f"https://github.com/openandroidinstaller-dev/openandroidinstaller/issues/new?labels=device&template=device-support-request.yaml&title=Add support for {device_code}" + request_url = f"https://github.com/openandroidinstaller-dev/openandroidinstaller/issues/new?labels=device&template=device-support-request.yaml&title=Add support for `{device_code}`" self.device_request_row.controls.append( ElevatedButton( "Request support for this device", From b95be2f0083f0edf45702655f01fd21cb160e5dc Mon Sep 17 00:00:00 2001 From: MagicLike Date: Tue, 12 Sep 2023 15:41:30 +0200 Subject: [PATCH 075/102] Bump actions/checkout to v4 --- .github/workflows/build-release.yml | 8 ++++---- .github/workflows/manual-build.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index d71f33a6..26dd3907 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -14,7 +14,7 @@ jobs: matrix: os: ['ubuntu-20.04', 'ubuntu-latest'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: 3.9 @@ -32,7 +32,7 @@ jobs: matrix: os: ['ubuntu-20.04', 'ubuntu-latest', 'macos-latest'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: 3.9 @@ -48,7 +48,7 @@ jobs: needs: ci runs-on: 'windows-latest' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: 3.9 @@ -66,7 +66,7 @@ jobs: - build-windows runs-on: 'ubuntu-latest' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Download artifact uses: actions/download-artifact@v3 - name: Display structure of downloaded files diff --git a/.github/workflows/manual-build.yml b/.github/workflows/manual-build.yml index e54f9f71..1b55c315 100644 --- a/.github/workflows/manual-build.yml +++ b/.github/workflows/manual-build.yml @@ -13,7 +13,7 @@ jobs: os: ['ubuntu-20.04', 'ubuntu-latest', 'macos-latest', 'windows-latest'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: 3.9 From f26a6e4183e03817f6cdf4f9360f6b4dd1cc0155 Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Fri, 15 Sep 2023 16:03:13 +0200 Subject: [PATCH 076/102] Add support for cupid (Xiaomi 13) --- README.md | 7 ++ .../assets/configs/cupid.yaml | 64 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 openandroidinstaller/assets/configs/cupid.yaml diff --git a/README.md b/README.md index a49b1a4a..dc0f1f3c 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,13 @@ OnePlus | Nord N200 | [dre](https://wiki.lineageos.org/devices/dre) | | tested OnePlus | 9 | lemonade | | under development +
Xiaomi + +Vendor | Device Name | CodeName | Models | Status +---|---|-------|---|--- +Xiaomi | 12 | cupid | | untested +
+ And more to come! diff --git a/openandroidinstaller/assets/configs/cupid.yaml b/openandroidinstaller/assets/configs/cupid.yaml new file mode 100644 index 00000000..8bc5c03a --- /dev/null +++ b/openandroidinstaller/assets/configs/cupid.yaml @@ -0,0 +1,64 @@ +metadata: + maintainer: A non (anon) + brand: xiaomi + device_name: Xiaomi 12 + is_ab_device: false + device_code: cupid + supported_recovery: + - orangefox + - twrp + additional_steps: + - dtbo + - vbmeta + - super_empty + supported_device_codes: + - cupid +requirements: + android: 13 +steps: + unlock_bootloader: + - type: confirm_button + content: > + As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone + how to start and run an operating system (like Android). Your device should be turned on. This will reset your phone. + - type: link_button_with_confirm + content: > + - Create a Mi account on Xiaomi’s website. Beware that one account is only allowed to unlock one unique device every 30 days. + + - Add a phone number to your Mi account, insert a SIM into your phone. + + - Enable developer options in `Settings` > `About Phone` by repeatedly tapping MIUI Version. + + - Link the device to your Mi account in `Settings` > `Additional settings` > `Developer options` > `Mi Unlock status`. + + - Download the Mi Unlock app with the link bellow (Windows is required to run the app), and follow the instructions provided by the app. It may tell you that you have to wait, usually 7 days. If it does so, please wait the quoted amount of time before continuing to the next step! + + - After device and Mi account are successfully verified, the bootloader should be unlocked. + + - Since the device resets completely, you will need to re-enable USB debugging to continue : `Settings` > `Additional settings` > `Developer options` > `USB debugging` + link: https://en.miui.com/unlock/download_en.html + boot_recovery: + - type: call_button + content: > + Now you need to install a custom recovery system on the phone. A recovery is a small subsystem on your phone, + that manages updating, adapting and repairing of the operating system. + + Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + Install additional partitions selected before by pressing 'Confirm and run'. Once it's done continue. + + Note : If you have not selected this partition, it will do nothing. + command: fastboot_flash_additional_partitions + - type: call_button + content: > + Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. + command: fastboot_flash_recovery + - type: call_button + img: ofox.png + content: > + Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. + If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. + Once it's done continue. + command: fastboot_reboot_recovery From 68b458832817a6ca8dcc03b7ba21477c591e6e24 Mon Sep 17 00:00:00 2001 From: Michel Memeteau Date: Sat, 16 Sep 2023 14:01:02 +0200 Subject: [PATCH 077/102] Update Bootloader unlock info --- doc/unlocking_the_bootloader.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/unlocking_the_bootloader.md b/doc/unlocking_the_bootloader.md index baed2fca..102b0c27 100644 --- a/doc/unlocking_the_bootloader.md +++ b/doc/unlocking_the_bootloader.md @@ -1,6 +1,10 @@ #### On unlocking the bootloader -Devices by *Samsung*, *Google* and *Fairphone* make it fairly easy to unlock the bootloader and receive good support in the installer. +Devices by *Samsung*, *Google*, *OnePlus* and *Fairphone* make it fairly easy to unlock the bootloader and receive good support in the installer. -Some devices with require manual steps to unlock the bootloader. In general you will need to create an account at a vendor website and receive some code from there. OpenAndroidInstaller will try to guide you as far as possible. These vendors include *Sony, Motorola, Xiaomi* and *OnePlus* among others. +Some devices with require manual steps to unlock the bootloader. In general you will need to create an account at a vendor website and receive some code from there. OpenAndroidInstaller will try to guide you as far as possible. These vendors include *Sony, Motorola, Xiaomi* among others. -Other phone vendors stops allowing to unlock the bootloader all together. There is nothing to be done if you didn't unlock your device in time. These vendors include *Huawei and LG* among others. Support for these vendors will always be very limited. +Other phone vendors stops allowing to unlock the bootloader all together. There is nothing to be done if you didn't unlock your device in time. These vendors include *Huawei LG Asus* among others. Support for these vendors will always be very limited. + +You can find more info about the brands and their Bootloader policy here ( in French) + +https://wikilibriste.fr/fr/tutoriels-android/bootloader-unlock From c1fc3d44db198ea237da93a937bc6e75487991a3 Mon Sep 17 00:00:00 2001 From: Michel Memeteau Date: Sat, 16 Sep 2023 15:25:35 +0200 Subject: [PATCH 078/102] reformat --- doc/unlocking_the_bootloader.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/unlocking_the_bootloader.md b/doc/unlocking_the_bootloader.md index 102b0c27..43c4f410 100644 --- a/doc/unlocking_the_bootloader.md +++ b/doc/unlocking_the_bootloader.md @@ -1,10 +1,10 @@ #### On unlocking the bootloader -Devices by *Samsung*, *Google*, *OnePlus* and *Fairphone* make it fairly easy to unlock the bootloader and receive good support in the installer. +Devices by *Samsung, Google, OnePlus, Fairphone* among others make it fairly easy to unlock the bootloader and receive good support in the installer. -Some devices with require manual steps to unlock the bootloader. In general you will need to create an account at a vendor website and receive some code from there. OpenAndroidInstaller will try to guide you as far as possible. These vendors include *Sony, Motorola, Xiaomi* among others. +Some devices with require manual steps to unlock the bootloader. In general you will need to create an account at a vendor website and receive some code from there. OpenAndroidInstaller will try to guide you as far as possible. These vendors include *Sony, Motorola, Xiaomi* among others. -Other phone vendors stops allowing to unlock the bootloader all together. There is nothing to be done if you didn't unlock your device in time. These vendors include *Huawei LG Asus* among others. Support for these vendors will always be very limited. +Other phone vendors stops allowing to unlock the bootloader all together. There is nothing to be done if you didn't unlock your device in time. These vendors include *Huawei, LG, Asus* among others. Support for these vendors will always be very limited. -You can find more info about the brands and their Bootloader policy here ( in French) +You can find more info about the brands and their Bootloader policy here (in french) https://wikilibriste.fr/fr/tutoriels-android/bootloader-unlock From 4ba78de50dd7ec925f25e485a08b91ebefcdbd5c Mon Sep 17 00:00:00 2001 From: Michel Memeteau Date: Sat, 16 Sep 2023 15:37:13 +0200 Subject: [PATCH 079/102] url linked --- doc/unlocking_the_bootloader.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/unlocking_the_bootloader.md b/doc/unlocking_the_bootloader.md index 43c4f410..9d6669ed 100644 --- a/doc/unlocking_the_bootloader.md +++ b/doc/unlocking_the_bootloader.md @@ -5,6 +5,6 @@ Some devices with require manual steps to unlock the bootloader. In general you Other phone vendors stops allowing to unlock the bootloader all together. There is nothing to be done if you didn't unlock your device in time. These vendors include *Huawei, LG, Asus* among others. Support for these vendors will always be very limited. -You can find more info about the brands and their Bootloader policy here (in french) +You can find more info about the brands and their bootloader policy [here in French](https://wikilibriste.fr/fr/tutoriels-android/bootloader-unlock) + -https://wikilibriste.fr/fr/tutoriels-android/bootloader-unlock From 15e48d6925ba0515364ddb6c156f347619adcf5c Mon Sep 17 00:00:00 2001 From: MagicLike Date: Sun, 17 Sep 2023 11:07:30 +0200 Subject: [PATCH 080/102] Resolved formatting issues in docs --- doc/unlocking_the_bootloader.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/unlocking_the_bootloader.md b/doc/unlocking_the_bootloader.md index 9d6669ed..45fd47ba 100644 --- a/doc/unlocking_the_bootloader.md +++ b/doc/unlocking_the_bootloader.md @@ -5,6 +5,4 @@ Some devices with require manual steps to unlock the bootloader. In general you Other phone vendors stops allowing to unlock the bootloader all together. There is nothing to be done if you didn't unlock your device in time. These vendors include *Huawei, LG, Asus* among others. Support for these vendors will always be very limited. -You can find more info about the brands and their bootloader policy [here in French](https://wikilibriste.fr/fr/tutoriels-android/bootloader-unlock) - - +You can find more info about the brands and their bootloader policy [here](https://wikilibriste.fr/fr/tutoriels-android/bootloader-unlock) (in French). From bb78278256a68a10d6463ed2abfefbe443add142 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Sun, 17 Sep 2023 11:08:54 +0200 Subject: [PATCH 081/102] Renamed `doc` folder to `docs` --- README.md | 6 +++--- {doc => docs}/building_the_application_for_your_platform.md | 0 ...ow_to_contribute_your_own_installation_configurations.md | 0 {doc => docs}/unlocking_the_bootloader.md | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename {doc => docs}/building_the_application_for_your_platform.md (100%) rename {doc => docs}/how_to_contribute_your_own_installation_configurations.md (100%) rename {doc => docs}/unlocking_the_bootloader.md (100%) diff --git a/README.md b/README.md index ca2e0f61..e30f8076 100644 --- a/README.md +++ b/README.md @@ -184,11 +184,11 @@ All kinds of contributions are welcome. These include: - Add features and/or improve the code base. - Report bugs. -[How to contribute your own installation configurations](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/how_to_contribute_your_own_installation_configurations.md) +[How to contribute your own installation configurations](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/docs/how_to_contribute_your_own_installation_configurations.md) -[How to build the application for your platform](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/building_the_application_for_your_platform.md) +[How to build the application for your platform](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/docs/building_the_application_for_your_platform.md) -[On unlocking the bootloader](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/doc/unlocking_the_bootloader.md) +[On unlocking the bootloader](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/docs/unlocking_the_bootloader.md) More details on how to contribute can be found [here](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/CONTRIBUTING.md). Please have a look before opening an issue or starting to contribute. diff --git a/doc/building_the_application_for_your_platform.md b/docs/building_the_application_for_your_platform.md similarity index 100% rename from doc/building_the_application_for_your_platform.md rename to docs/building_the_application_for_your_platform.md diff --git a/doc/how_to_contribute_your_own_installation_configurations.md b/docs/how_to_contribute_your_own_installation_configurations.md similarity index 100% rename from doc/how_to_contribute_your_own_installation_configurations.md rename to docs/how_to_contribute_your_own_installation_configurations.md diff --git a/doc/unlocking_the_bootloader.md b/docs/unlocking_the_bootloader.md similarity index 100% rename from doc/unlocking_the_bootloader.md rename to docs/unlocking_the_bootloader.md From f37564b98877f1ed3c57b97ed6fafb2bb11a4b9e Mon Sep 17 00:00:00 2001 From: MagicLike Date: Sun, 17 Sep 2023 11:17:56 +0200 Subject: [PATCH 082/102] Bootloader documentation reworded --- docs/unlocking_the_bootloader.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/unlocking_the_bootloader.md b/docs/unlocking_the_bootloader.md index 45fd47ba..c3536ed1 100644 --- a/docs/unlocking_the_bootloader.md +++ b/docs/unlocking_the_bootloader.md @@ -1,8 +1,8 @@ #### On unlocking the bootloader -Devices by *Samsung, Google, OnePlus, Fairphone* among others make it fairly easy to unlock the bootloader and receive good support in the installer. +Devices by *Samsung, Google, OnePlus, Fairphone* and others make it relatively easy to unlock the bootloader and get good support in the installer. -Some devices with require manual steps to unlock the bootloader. In general you will need to create an account at a vendor website and receive some code from there. OpenAndroidInstaller will try to guide you as far as possible. These vendors include *Sony, Motorola, Xiaomi* among others. +For some devices, it is necessary to unlock the bootloader manually. You usually need to create an account on the manufacturer's website, wait for a certain time and obtain a code from there. OpenAndroidInstaller will try to guide you as far as possible. These vendors include *Sony, Motorola and Xiaomi* amongst others. -Other phone vendors stops allowing to unlock the bootloader all together. There is nothing to be done if you didn't unlock your device in time. These vendors include *Huawei, LG, Asus* among others. Support for these vendors will always be very limited. +Other phone manufacturers no longer allow you to unlock the bootloader. Nothing can be done if you have not unlocked your device in time. These manufacturers include *Huawei, LG and Asus*. Support for these manufacturers will always be very limited. -You can find more info about the brands and their bootloader policy [here](https://wikilibriste.fr/fr/tutoriels-android/bootloader-unlock) (in French). +You can find more information about the brands and their bootloader policies [here](https://wikilibriste.fr/fr/tutoriels-android/bootloader-unlock). (in French) From fe58bb32474d3b447fb58b10a3dd75fb3d319e45 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Sun, 17 Sep 2023 16:36:02 +0200 Subject: [PATCH 083/102] Added bootloader policies Added curiated bootloader policy docs, with links and listings of supported devices (incomplete) --- docs/unlocking_the_bootloader.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/unlocking_the_bootloader.md b/docs/unlocking_the_bootloader.md index c3536ed1..79bffeac 100644 --- a/docs/unlocking_the_bootloader.md +++ b/docs/unlocking_the_bootloader.md @@ -3,6 +3,30 @@ Devices by *Samsung, Google, OnePlus, Fairphone* and others make it relatively e For some devices, it is necessary to unlock the bootloader manually. You usually need to create an account on the manufacturer's website, wait for a certain time and obtain a code from there. OpenAndroidInstaller will try to guide you as far as possible. These vendors include *Sony, Motorola and Xiaomi* amongst others. -Other phone manufacturers no longer allow you to unlock the bootloader. Nothing can be done if you have not unlocked your device in time. These manufacturers include *Huawei, LG and Asus*. Support for these manufacturers will always be very limited. +Other phone manufacturers no longer allow you to unlock the bootloader. Nothing can be done if you have not unlocked your device in time. These manufacturers include *Huawei, Honor, LG and ASUS*. Support for these manufacturers will always be very limited. + +
+ + Here is a brief overview of the bootloader policies of some of the most popular brands (may be incomplete/inaccurate) + + +| Brand | Flashing tool | Unlocking Method | Loss of guarantee\* | Supported models | +|---|---|---|---|---| +| Google | Fastboot | OEM/Flashing unlock | No | Pixel and Nexus | +| Samsung | ODIN or Heimdall | Download mode | **Yes** | Galaxy S and A series
(Increasing complexity **on and after S10**) | +| OnePlus | Fastboot | OEM/Flashing unlock | No | All | +| Fairphone | Fastboot | [Code from manufacturer](https://support.fairphone.com/hc/en-us/articles/10492476238865-Manage-the-Bootloader)
(**Already unlocked until FP2**) | No | All | +| Xiaomi | Fastboot | [Mi Unlock Tool](https://new.c.mi.com/global/post/101245) | **Yes** | Mi 4c, Redmi Note 3, Mi Note Pro, Redmi 3, Mi 4S, Mi 5 and all devices from 2016 onwards | +| Motorola | Fastboot | [Code from manufacturer](https://en-us.support.motorola.com/app/standalone/bootloader/unlock-your-device-a) | **Yes** | Almost all **except** carrier specific models (e.g. Verizon, AT&T, Tracfone) and certain other models | +| Sony | Fastboot | [Code from manufacturer](https://developer.sony.com/open-source/aosp-on-xperia-open-devices/get-started/unlock-bootloader) | **Yes** | All **except** XQ-CT62 (1Ⅳ US) & XQ-CQ62 (5Ⅳ US) | +| Huawei | Fastboot | No official codes since 2017/2018
(**Unofficial methods available**) | **Yes** | Mate 9/9Pro, P10/P10Plus | +| Honor | Fastboot | No official codes since 2017/2018
(**Unofficial methods available**) | **Yes** | Honor 8 | +| LG | --- | Impossible since December 2021 | **Yes** | | +| ASUS | Fastboot | Impossible since May 2023 (ASUS unlocking App) | **Yes** | | + +**\*** In the EU you won't loose your standard 2 years of the warranty when you unlock your bootloader, flash your device or root it. ([source](https://forum.xda-developers.com/t/info-eu-rooting-and-flashing-dont-void-the-warranty.1998801/)) + +
+
You can find more information about the brands and their bootloader policies [here](https://wikilibriste.fr/fr/tutoriels-android/bootloader-unlock). (in French) From 560c5baa173c1290ccec4acd1ff4614450fccf68 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Sun, 17 Sep 2023 17:55:05 +0200 Subject: [PATCH 084/102] Moved period Co-authored-by: Tobias Sterbak --- docs/unlocking_the_bootloader.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/unlocking_the_bootloader.md b/docs/unlocking_the_bootloader.md index 79bffeac..402271f1 100644 --- a/docs/unlocking_the_bootloader.md +++ b/docs/unlocking_the_bootloader.md @@ -29,4 +29,4 @@ Other phone manufacturers no longer allow you to unlock the bootloader. Nothing
-You can find more information about the brands and their bootloader policies [here](https://wikilibriste.fr/fr/tutoriels-android/bootloader-unlock). (in French) +You can find more information about the brands and their bootloader policies [here](https://wikilibriste.fr/fr/tutoriels-android/bootloader-unlock) (in French). From e6cda79cb4a9f884555660dda68f699447b3b3e5 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Sun, 17 Sep 2023 17:56:47 +0200 Subject: [PATCH 085/102] Added Fastboot as flashing tool for LG Co-authored-by: Tobias Sterbak --- docs/unlocking_the_bootloader.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/unlocking_the_bootloader.md b/docs/unlocking_the_bootloader.md index 402271f1..6f871503 100644 --- a/docs/unlocking_the_bootloader.md +++ b/docs/unlocking_the_bootloader.md @@ -21,7 +21,7 @@ Other phone manufacturers no longer allow you to unlock the bootloader. Nothing | Sony | Fastboot | [Code from manufacturer](https://developer.sony.com/open-source/aosp-on-xperia-open-devices/get-started/unlock-bootloader) | **Yes** | All **except** XQ-CT62 (1Ⅳ US) & XQ-CQ62 (5Ⅳ US) | | Huawei | Fastboot | No official codes since 2017/2018
(**Unofficial methods available**) | **Yes** | Mate 9/9Pro, P10/P10Plus | | Honor | Fastboot | No official codes since 2017/2018
(**Unofficial methods available**) | **Yes** | Honor 8 | -| LG | --- | Impossible since December 2021 | **Yes** | | +| LG | Fastboot | Impossible since December 2021 | **Yes** | | | ASUS | Fastboot | Impossible since May 2023 (ASUS unlocking App) | **Yes** | | **\*** In the EU you won't loose your standard 2 years of the warranty when you unlock your bootloader, flash your device or root it. ([source](https://forum.xda-developers.com/t/info-eu-rooting-and-flashing-dont-void-the-warranty.1998801/)) From 1386f3c84a1a1f37bdc504a1749e59ff4fdb7e32 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Sun, 17 Sep 2023 20:55:33 +0200 Subject: [PATCH 086/102] Implemented GitHub's highlighted blockquotes --- README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e30f8076..3ead6639 100644 --- a/README.md +++ b/README.md @@ -27,20 +27,21 @@

-> **Warning**: This application is currently in beta state, so use at your own risk! While many people tested the application so far and we heard of no bricked devices, things might still go wrong. - -> **Note**: Unlocking the bootloader will erase all data on your device! -This also includes your DRM keys, which are stored in the Trim Area partition (also called TA) in case your device is fairly recent and supports DRM L1. Those devices will be downgraded to DRM L3. Devices on DRM L3 by default will not be affected. -Before proceeding, ensure the data you would like to retain is backed up to your PC and/or your Google account, or equivalent. Please note that OEM backup solutions like Samsung and Motorola backup may not be accessible from LineageOS once installed. -If you wish to backup the TA partition first, you can find tutorials related to your device on the internet. +> [!WARNING] +> This application is currently in beta state, so use at your own risk! While many people tested the application so far and we heard of no bricked devices, things might still go wrong. +> [!IMPORTANT] +> Unlocking the bootloader will erase all data on your device! +> This also includes your DRM keys, which are stored in the Trim Area partition (also called TA) in case your device is fairly recent and supports DRM L1. Those devices will be downgraded to DRM L3. Devices on DRM L3 by default will not be affected. +> Before proceeding, ensure the data you would like to retain is backed up to your PC and/or your Google account, or equivalent. Please note that OEM backup solutions like Samsung and Motorola backup may not be accessible from LineageOS once installed. +> If you wish to backup the TA partition first, you can find tutorials related to your device on the internet. ## Usage 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. 1. Download the [.exe or appropriate executable file for your OS](https://github.com/openandroidinstaller-dev/openandroidinstaller/releases) from the releases or get the [official flatpak from flathub](https://flathub.org/apps/org.openandroidinstaller.OpenAndroidInstaller). You might need to change permissions to run the executable. - - On Windows also [install the Universal USB Drivers](https://adb.clockworkmod.com/) and other potentially drivers needed for your device. + - On Windows also [install the Universal USB Drivers](https://adb.clockworkmod.com) and other potentially drivers needed for your device. 2. Download the custom ROM image and the TWRP recovery image for your device and optionally some addons. A source for files can be found on the following websites: - some custom ROMs: - [LineageOS](https://wiki.lineageos.org/devices) From b25e5bb902567beac4a980874c083f9fad596c10 Mon Sep 17 00:00:00 2001 From: MagicLike Date: Mon, 18 Sep 2023 15:53:26 +0200 Subject: [PATCH 087/102] Added vendor lock disclamer --- docs/unlocking_the_bootloader.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/unlocking_the_bootloader.md b/docs/unlocking_the_bootloader.md index 6f871503..f30079d6 100644 --- a/docs/unlocking_the_bootloader.md +++ b/docs/unlocking_the_bootloader.md @@ -1,4 +1,7 @@ #### On unlocking the bootloader + +First of all, this tool will not help you bypass any vender locked bootloaders in non-official ways. + Devices by *Samsung, Google, OnePlus, Fairphone* and others make it relatively easy to unlock the bootloader and get good support in the installer. For some devices, it is necessary to unlock the bootloader manually. You usually need to create an account on the manufacturer's website, wait for a certain time and obtain a code from there. OpenAndroidInstaller will try to guide you as far as possible. These vendors include *Sony, Motorola and Xiaomi* amongst others. From 2a274cd76086f86df59fade0d4dde5478a9db988 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 27 Sep 2023 16:28:02 +0200 Subject: [PATCH 088/102] Fix lavender --- openandroidinstaller/assets/configs/lavender.yaml | 4 ---- openandroidinstaller/views/select_view.py | 11 +++++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/openandroidinstaller/assets/configs/lavender.yaml b/openandroidinstaller/assets/configs/lavender.yaml index bd76bdc9..754269f1 100644 --- a/openandroidinstaller/assets/configs/lavender.yaml +++ b/openandroidinstaller/assets/configs/lavender.yaml @@ -4,14 +4,10 @@ metadata: device_name: Xiaomi Redmi Note 7 is_ab_device: false device_code: lavender - supported_recovery: - - orangefox - - twrp supported_device_codes: - lavender notes: - You should install Android 10 or newer ROM. - - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) requirements: android: 10 (Q) steps: diff --git a/openandroidinstaller/views/select_view.py b/openandroidinstaller/views/select_view.py index 1e3e98f0..5c9c116d 100644 --- a/openandroidinstaller/views/select_view.py +++ b/openandroidinstaller/views/select_view.py @@ -636,9 +636,12 @@ def enable_button_if_ready(self, e): # check if the additional images are there if self.state.config.additional_steps and not all( [ - self.selected_dtbo.value or "dtbo" not in self.state.config.additional_steps, - self.selected_vbmeta.value or "vbmeta" not in self.state.config.additional_steps, - self.selected_super_empty.value or "super_empty" not in self.state.config.additional_steps, + self.selected_dtbo.value + or "dtbo" not in self.state.config.additional_steps, + self.selected_vbmeta.value + or "vbmeta" not in self.state.config.additional_steps, + self.selected_super_empty.value + or "super_empty" not in self.state.config.additional_steps, ] ): logger.error( @@ -658,7 +661,7 @@ def enable_button_if_ready(self, e): logger.info("Image and recovery work with the device. You can continue.") self.info_field.controls = [] self.confirm_button.disabled = False - self.continue_eitherway_button.disabled = True + self.continue_eitherway_button.disabled = True self.right_view.update() elif (".zip" in self.selected_image.value) and (not self.state.flash_recovery): if not ( From 12e61ffd31d7f5494f6257c01af5314f10ba4c3f Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 27 Sep 2023 16:50:49 +0200 Subject: [PATCH 089/102] Update ginkgo --- openandroidinstaller/assets/configs/ginkgo.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/openandroidinstaller/assets/configs/ginkgo.yaml b/openandroidinstaller/assets/configs/ginkgo.yaml index 537bbb86..b2bd6c3f 100644 --- a/openandroidinstaller/assets/configs/ginkgo.yaml +++ b/openandroidinstaller/assets/configs/ginkgo.yaml @@ -4,16 +4,12 @@ metadata: device_name: Xiaomi Redmi Note 8 / 8T is_ab_device: false device_code: ginkgo - supported_recovery: - - orangefox - - twrp supported_device_codes: - ginkgo - willow untested: true notes: - You should install Android 10 or newer ROM. - - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) requirements: android: 10 (Q) steps: From 9890fd3f9c0632f683576e81dae2f33d9bf79d5f Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 27 Sep 2023 16:52:59 +0200 Subject: [PATCH 090/102] Update garden --- openandroidinstaller/assets/configs/garden.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/openandroidinstaller/assets/configs/garden.yaml b/openandroidinstaller/assets/configs/garden.yaml index c22b0a5b..512a9913 100644 --- a/openandroidinstaller/assets/configs/garden.yaml +++ b/openandroidinstaller/assets/configs/garden.yaml @@ -4,9 +4,6 @@ metadata: device_name: Xiaomi Redmi 9A / 9C / 9AT / 9i / 9A Sport / 10A / 10A Sport is_ab_device: false device_code: garden - supported_recovery: - - orangefox - - twrp supported_device_codes: - dandelion - garden @@ -14,7 +11,6 @@ metadata: - angelican notes: - OAI don't support ROM that requires permissiver. - - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) requirements: firmware: MiUI 12.5 (Q) steps: From 30874e43a5f7376c2d1a2af4108ed25d680413dd Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 27 Sep 2023 16:55:21 +0200 Subject: [PATCH 091/102] Update rosemary --- openandroidinstaller/assets/configs/rosemary.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/openandroidinstaller/assets/configs/rosemary.yaml b/openandroidinstaller/assets/configs/rosemary.yaml index 5904a996..9bf589ed 100644 --- a/openandroidinstaller/assets/configs/rosemary.yaml +++ b/openandroidinstaller/assets/configs/rosemary.yaml @@ -4,9 +4,6 @@ metadata: device_name: Xiaomi Redmi Note 10S / 11SE / Poco M5S is_ab_device: false device_code: rosemary - supported_recovery: - - orangefox - - twrp supported_device_codes: - rosemary - secret @@ -14,8 +11,7 @@ metadata: - rosemary_p untested: true notes: - - Please respect the requested by the ROM developers version for MIUI and Android - - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) + - Please respect the requested by the ROM developers version for MIUI and Android. steps: unlock_bootloader: - type: confirm_button From 7ed8dc89245bfd3bce175d387041e0046f2c3947 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 27 Sep 2023 16:59:24 +0200 Subject: [PATCH 092/102] Update miatoll --- openandroidinstaller/assets/configs/ginkgo.yaml | 1 - openandroidinstaller/assets/configs/miatoll.yaml | 6 ------ openandroidinstaller/assets/configs/rosemary.yaml | 1 - 3 files changed, 8 deletions(-) diff --git a/openandroidinstaller/assets/configs/ginkgo.yaml b/openandroidinstaller/assets/configs/ginkgo.yaml index b2bd6c3f..4ad8d385 100644 --- a/openandroidinstaller/assets/configs/ginkgo.yaml +++ b/openandroidinstaller/assets/configs/ginkgo.yaml @@ -7,7 +7,6 @@ metadata: supported_device_codes: - ginkgo - willow - untested: true notes: - You should install Android 10 or newer ROM. requirements: diff --git a/openandroidinstaller/assets/configs/miatoll.yaml b/openandroidinstaller/assets/configs/miatoll.yaml index 5af6defa..48ba7cce 100644 --- a/openandroidinstaller/assets/configs/miatoll.yaml +++ b/openandroidinstaller/assets/configs/miatoll.yaml @@ -4,18 +4,12 @@ metadata: device_name: Xiaomi Redmi Note 9S / 9 Pro / 9 Pro Max / 10 Lite / Poco M2 pro is_ab_device: false device_code: miatoll - supported_recovery: - - orangefox - - twrp supported_device_codes: - miatoll - gram - curtana - excalibur - joyeuse - untested: true - notes: - - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) requirements: android: 12 steps: diff --git a/openandroidinstaller/assets/configs/rosemary.yaml b/openandroidinstaller/assets/configs/rosemary.yaml index 9bf589ed..1fb1923d 100644 --- a/openandroidinstaller/assets/configs/rosemary.yaml +++ b/openandroidinstaller/assets/configs/rosemary.yaml @@ -9,7 +9,6 @@ metadata: - secret - maltose - rosemary_p - untested: true notes: - Please respect the requested by the ROM developers version for MIUI and Android. steps: From 976fa07e6c87a3497cead779b30c4aa6f831d474 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 27 Sep 2023 17:01:44 +0200 Subject: [PATCH 093/102] Update davinci --- openandroidinstaller/assets/configs/davinci.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/openandroidinstaller/assets/configs/davinci.yaml b/openandroidinstaller/assets/configs/davinci.yaml index 837a9453..69e10263 100644 --- a/openandroidinstaller/assets/configs/davinci.yaml +++ b/openandroidinstaller/assets/configs/davinci.yaml @@ -4,15 +4,9 @@ metadata: device_name: Xiaomi Mi 9T / Redmi K20 is_ab_device: false device_code: davinci - untested: true - supported_recovery: - - orangefox - - twrp supported_device_codes: - davinci - davinciin - notes: - - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) steps: unlock_bootloader: - type: confirm_button From 7a456fe69c07bc07062e63bb4c5e37c5ed28a5c5 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Wed, 27 Sep 2023 17:08:22 +0200 Subject: [PATCH 094/102] Update configs --- openandroidinstaller/assets/configs/cupid.yaml | 3 --- openandroidinstaller/assets/configs/raphael.yaml | 6 ------ openandroidinstaller/assets/configs/vayu.yaml | 3 --- 3 files changed, 12 deletions(-) diff --git a/openandroidinstaller/assets/configs/cupid.yaml b/openandroidinstaller/assets/configs/cupid.yaml index 8bc5c03a..563b2f0d 100644 --- a/openandroidinstaller/assets/configs/cupid.yaml +++ b/openandroidinstaller/assets/configs/cupid.yaml @@ -4,9 +4,6 @@ metadata: device_name: Xiaomi 12 is_ab_device: false device_code: cupid - supported_recovery: - - orangefox - - twrp additional_steps: - dtbo - vbmeta diff --git a/openandroidinstaller/assets/configs/raphael.yaml b/openandroidinstaller/assets/configs/raphael.yaml index cb33c102..f3a30e6b 100644 --- a/openandroidinstaller/assets/configs/raphael.yaml +++ b/openandroidinstaller/assets/configs/raphael.yaml @@ -4,17 +4,11 @@ metadata: device_name: Xiaomi Mi 9T Pro / Redmi K20 Pro is_ab_device: false device_code: raphael - untested: true - supported_recovery: - - orangefox - - twrp additional_steps: - super_empty supported_device_codes: - raphael - raphaelin - notes: - - Be careful when choosing OrangeFox version, Android 12 & 13 ROM needs OrangeFox version code with `A12`, for example `R11.1_5_A12`. Android 10 & 11 ROM needs OrangeFox version code without `A12` (bellow on the page) steps: unlock_bootloader: - type: confirm_button diff --git a/openandroidinstaller/assets/configs/vayu.yaml b/openandroidinstaller/assets/configs/vayu.yaml index 63bd752e..47a1c6fe 100644 --- a/openandroidinstaller/assets/configs/vayu.yaml +++ b/openandroidinstaller/assets/configs/vayu.yaml @@ -4,9 +4,6 @@ metadata: device_name: Poco X3 Pro is_ab_device: false device_code: vayu - supported_recovery: - - orangefox - - twrp supported_device_codes: - vayu - bhima From e889ccb6e1035ad9a38765ffa19e74532bd3fc7c Mon Sep 17 00:00:00 2001 From: RaptaG Date: Wed, 27 Sep 2023 21:38:18 +0300 Subject: [PATCH 095/102] HTML header improvements Signed-off-by: RaptaG --- README.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 233b3bd7..e1950e12 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,29 @@ -
+ + OpenAndroidInstaller + +

OpenAndroidInstaller

- [![License](https://img.shields.io/github/license/openandroidinstaller-dev/openandroidinstaller?color=green&style=flat-square)](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/LICENSE) - [![Release](https://img.shields.io/github/v/release/openandroidinstaller-dev/openandroidinstaller?include_prereleases&style=flat-square)](https://github.com/openandroidinstaller-dev/openandroidinstaller/releases) - [![Downloads](https://img.shields.io/github/downloads/openandroidinstaller-dev/openandroidinstaller/total?style=flat-square)](https://github.com/openandroidinstaller-dev/openandroidinstaller/releases) - [![Flathub](https://img.shields.io/flathub/downloads/org.openandroidinstaller.OpenAndroidInstaller?label=flathub%20installs&style=flat-square)](https://flathub.org/apps/org.openandroidinstaller.OpenAndroidInstaller) + [![License](https://img.shields.io/github/license/openandroidinstaller-dev/openandroidinstaller?color=green)](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/LICENSE) + [![Release](https://img.shields.io/github/v/release/openandroidinstaller-dev/openandroidinstaller?include_prereleases)](https://github.com/openandroidinstaller-dev/openandroidinstaller/releases) + [![Downloads](https://img.shields.io/github/downloads/openandroidinstaller-dev/openandroidinstaller/total)](https://github.com/openandroidinstaller-dev/openandroidinstaller/releases) + [![Flathub](https://img.shields.io/flathub/downloads/org.openandroidinstaller.OpenAndroidInstaller?label=flathub%20installs)](https://flathub.org/apps/org.openandroidinstaller.OpenAndroidInstaller) [![Twitter](https://img.shields.io/twitter/follow/oainstaller?style=social)](https://twitter.com/OAInstaller) [![Mastodon](https://img.shields.io/mastodon/follow/109341220262803943?domain=https%3A%2F%2Ffosstodon.org&style=social)](https://fosstodon.org/@openandroidinstaller) +

Makes installing alternative Android distributions nice and easy.

- - OpenAndroidInstaller -

-
The OpenAndroidInstaller project helps Android users to keep their smartphone's operating system up to date with free software and to continue using the device even though the manufacturer no longer offers updates. With a graphical installation software, users are easily guided through the installation process of free Android operating systems like LineageOS. -
-
- Report Bug - · - Website - · - Request Feature -
+

+ + Website + · + Report Bugs + · + Request Feature +

From fcfe2a58cc4598bf3694c4f4b22edc4779402a0f Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Thu, 28 Sep 2023 08:59:36 +0200 Subject: [PATCH 096/102] Add and fix the metadata --- openandroidinstaller/assets/configs/cupid.yaml | 3 ++- openandroidinstaller/assets/configs/davinci.yaml | 1 + openandroidinstaller/assets/configs/ginkgo.yaml | 1 + openandroidinstaller/assets/configs/miatoll.yaml | 1 + openandroidinstaller/assets/configs/raphael.yaml | 1 + openandroidinstaller/assets/configs/rosemary.yaml | 1 + openandroidinstaller/assets/configs/vayu.yaml | 1 + openandroidinstaller/installer_config.py | 2 ++ 8 files changed, 10 insertions(+), 1 deletion(-) diff --git a/openandroidinstaller/assets/configs/cupid.yaml b/openandroidinstaller/assets/configs/cupid.yaml index 563b2f0d..117a50e1 100644 --- a/openandroidinstaller/assets/configs/cupid.yaml +++ b/openandroidinstaller/assets/configs/cupid.yaml @@ -3,13 +3,14 @@ metadata: brand: xiaomi device_name: Xiaomi 12 is_ab_device: false - device_code: cupid additional_steps: - dtbo - vbmeta - super_empty + device_code: cupid supported_device_codes: - cupid + untested: true requirements: android: 13 steps: diff --git a/openandroidinstaller/assets/configs/davinci.yaml b/openandroidinstaller/assets/configs/davinci.yaml index 69e10263..73b4554a 100644 --- a/openandroidinstaller/assets/configs/davinci.yaml +++ b/openandroidinstaller/assets/configs/davinci.yaml @@ -7,6 +7,7 @@ metadata: supported_device_codes: - davinci - davinciin + untested: true steps: unlock_bootloader: - type: confirm_button diff --git a/openandroidinstaller/assets/configs/ginkgo.yaml b/openandroidinstaller/assets/configs/ginkgo.yaml index 4ad8d385..b2bd6c3f 100644 --- a/openandroidinstaller/assets/configs/ginkgo.yaml +++ b/openandroidinstaller/assets/configs/ginkgo.yaml @@ -7,6 +7,7 @@ metadata: supported_device_codes: - ginkgo - willow + untested: true notes: - You should install Android 10 or newer ROM. requirements: diff --git a/openandroidinstaller/assets/configs/miatoll.yaml b/openandroidinstaller/assets/configs/miatoll.yaml index 48ba7cce..82c15a88 100644 --- a/openandroidinstaller/assets/configs/miatoll.yaml +++ b/openandroidinstaller/assets/configs/miatoll.yaml @@ -10,6 +10,7 @@ metadata: - curtana - excalibur - joyeuse + untested: true requirements: android: 12 steps: diff --git a/openandroidinstaller/assets/configs/raphael.yaml b/openandroidinstaller/assets/configs/raphael.yaml index f3a30e6b..db518866 100644 --- a/openandroidinstaller/assets/configs/raphael.yaml +++ b/openandroidinstaller/assets/configs/raphael.yaml @@ -9,6 +9,7 @@ metadata: supported_device_codes: - raphael - raphaelin + untested: true steps: unlock_bootloader: - type: confirm_button diff --git a/openandroidinstaller/assets/configs/rosemary.yaml b/openandroidinstaller/assets/configs/rosemary.yaml index 1fb1923d..9bf589ed 100644 --- a/openandroidinstaller/assets/configs/rosemary.yaml +++ b/openandroidinstaller/assets/configs/rosemary.yaml @@ -9,6 +9,7 @@ metadata: - secret - maltose - rosemary_p + untested: true notes: - Please respect the requested by the ROM developers version for MIUI and Android. steps: diff --git a/openandroidinstaller/assets/configs/vayu.yaml b/openandroidinstaller/assets/configs/vayu.yaml index 47a1c6fe..16223090 100644 --- a/openandroidinstaller/assets/configs/vayu.yaml +++ b/openandroidinstaller/assets/configs/vayu.yaml @@ -7,6 +7,7 @@ metadata: supported_device_codes: - vayu - bhima + untested: true requirements: android: 12 (S) steps: diff --git a/openandroidinstaller/installer_config.py b/openandroidinstaller/installer_config.py index e5be79c7..7eafe47e 100644 --- a/openandroidinstaller/installer_config.py +++ b/openandroidinstaller/installer_config.py @@ -66,6 +66,7 @@ def __init__( self.additional_steps = metadata.get("additional_steps", []) self.supported_device_codes = metadata.get("supported_device_codes") self.twrp_link = metadata.get("twrp-link") + self.untested = metadata.get("untested", False) @classmethod def from_file(cls, path) -> Self: @@ -166,6 +167,7 @@ def validate_config(config: str) -> bool: "maintainer": str, "device_name": str, "is_ab_device": bool, + schema.Optional("untested"): bool, "device_code": str, "supported_device_codes": [str], schema.Optional("twrp-link"): str, From fce097dc43f7aba810bc33c9a079e04a0b0012a4 Mon Sep 17 00:00:00 2001 From: RaptaG Date: Fri, 29 Sep 2023 13:18:52 +0300 Subject: [PATCH 097/102] Even more tweaks Signed-off-by: RaptaG --- README.md | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index e1950e12..3ed3e770 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@

OpenAndroidInstaller

+

Makes installing alternative Android distributions nice and easy!

[![License](https://img.shields.io/github/license/openandroidinstaller-dev/openandroidinstaller?color=green)](https://github.com/openandroidinstaller-dev/openandroidinstaller/blob/main/LICENSE) [![Release](https://img.shields.io/github/v/release/openandroidinstaller-dev/openandroidinstaller?include_prereleases)](https://github.com/openandroidinstaller-dev/openandroidinstaller/releases) @@ -12,9 +13,7 @@ [![Twitter](https://img.shields.io/twitter/follow/oainstaller?style=social)](https://twitter.com/OAInstaller) [![Mastodon](https://img.shields.io/mastodon/follow/109341220262803943?domain=https%3A%2F%2Ffosstodon.org&style=social)](https://fosstodon.org/@openandroidinstaller) -

Makes installing alternative Android distributions nice and easy.

- -

+

The OpenAndroidInstaller project helps Android users to keep their smartphone's operating system up to date with free software and to continue using the device even though the manufacturer no longer offers updates. With a graphical installation software, users are easily guided through the installation process of free Android operating systems like LineageOS.

@@ -27,17 +26,16 @@

-> **Warning**: This application is currently in beta state, so use at your own risk! While many people tested the application so far and we heard of no bricked devices, things might still go wrong. +> **Warning:** This application is currently in beta state, so use at your own risk! While many people tested the application so far and we heard of no bricked devices, things might still go wrong. -> **Note**: Unlocking the bootloader will erase all data on your device! +> **Note:** Unlocking the bootloader will erase all data on your device! This also includes your DRM keys, which are stored in the Trim Area partition (also called TA) in case your device is fairly recent and supports DRM L1. Those devices will be downgraded to DRM L3. Devices on DRM L3 by default will not be affected. Before proceeding, ensure the data you would like to retain is backed up to your PC and/or your Google account, or equivalent. Please note that OEM backup solutions like Samsung and Motorola backup may not be accessible from LineageOS once installed. If you wish to backup the TA partition first, you can find tutorials related to your device on the internet. - ## Usage -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. +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. 1. Download the [.exe or appropriate executable file for your OS](https://github.com/openandroidinstaller-dev/openandroidinstaller/releases) from the releases or get the [official flatpak from flathub](https://flathub.org/apps/org.openandroidinstaller.OpenAndroidInstaller). You might need to change permissions to run the executable. - On Windows also [install the Universal USB Drivers](https://adb.clockworkmod.com/) and other potentially drivers needed for your device. @@ -60,12 +58,10 @@ Linux is currently the best supported platform (tested with Ubuntu 20.04/22.04 L - or you can just search the web or the [xda-developers forum](https://forum.xda-developers.com) for an appropriate version for your device. 3. Start the desktop app and follow the instructions. - ## Officially supported devices Currently, the **we support 62 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. Help to improve the tool by reporting any issues you might face. @@ -96,6 +92,7 @@ Samsung | Galaxy Note 8 | greatlte | SM-N950F | tested Samsung | Galaxy Note 9 | [crownlte](https://wiki.lineageos.org/devices/crownlte) | | tested Samsung | Galaxy Note 10 | [d1](https://wiki.lineageos.org/devices/d1) | | tested Samsung | Galaxy Note 10+ | [d2s](https://wiki.lineageos.org/devices/d2s) | | tested +
Google @@ -113,6 +110,7 @@ Google | Pixel 4 XL | [coral](https://wiki.lineageos.org/devices/coral) | coral Google | Pixel 4a | [sunfish](https://wiki.lineageos.org/devices/sunfish) | sunfish | tested Google | Pixel 5 | [redfin](https://wiki.lineageos.org/devices/redfin) | redfin | tested Google | Pixel 5a | [barbet](https://wiki.lineageos.org/devices/barbet) | barbet | tested +
Sony @@ -127,6 +125,7 @@ Sony | Xperia XA2 | [pioneer](https://wiki.lineageos.org/devices/pioneer) | | te Sony | Xperia XZ2 | [akari](https://wiki.lineageos.org/devices/akari) | | tested Sony | Xperia XZ3 | [akatsuki](https://wiki.lineageos.org/devices/akatsuki) | | tested Sony | Xperia ZX | kagura | | planned +
Fairphone @@ -136,6 +135,7 @@ Vendor | Device Name | CodeName | Models | Status Fairphone | Fairphone 2 | [FP2](https://wiki.lineageos.org/devices/FP2) | | tested Fairphone | Fairphone 3 | [FP3](https://wiki.lineageos.org/devices/FP3) | | tested Fairphone | Fairphone 4 | [FP4](https://wiki.lineageos.org/devices/FP4) | | tested +
Motorola @@ -149,6 +149,7 @@ Motorola | moto g 5G plus / one 5G | [nairo](https://wiki.lineageos.org/devices/ Motorola | moto g 5G / one 5G ace | [kiev](https://wiki.lineageos.org/devices/kiev) | | tested Motorola | edge | [racer](https://wiki.lineageos.org/devices/racer) | | tested Motorola | moto z | [griffin](https://wiki.lineageos.org/devices/griffin) | | tested +
OnePlus @@ -167,11 +168,11 @@ OnePlus | 7T Pro | [hotdog](https://wiki.lineageos.org/devices/hotdog) | | teste OnePlus | Nord | [avicii](https://wiki.lineageos.org/devices/avicii) | | tested OnePlus | Nord N200 | [dre](https://wiki.lineageos.org/devices/dre) | | tested OnePlus | 9 | lemonade | | under development +
And more to come! - ## Contributing All kinds of contributions are welcome. These include: @@ -194,8 +195,6 @@ Please have a look before opening an issue or starting to contribute. A detailed list can be found [here](https://openandroidinstaller.org/#contribute). - - ## Tools - The [Android SDK Platform Tools](https://developer.android.com/studio/releases/platform-tools) (such as adb and fastboot) are [Apache](https://android.googlesource.com/platform/system/adb/+/refs/heads/master/NOTICE)-licensed universal Android utilities @@ -203,13 +202,12 @@ A detailed list can be found [here](https://openandroidinstaller.org/#contribute - [libusb-1.0](https://github.com/libusb/libusb) is a [LGPL-2.1](https://github.com/libusb/libusb/blob/master/COPYING)-licensed library for USB device access from Linux, macOS, Windows and others. - [copy-partitions-20220613-signed.zip](https://mirrorbits.lineageos.org/tools/copy-partitions-20220613-signed.zip) The copy-partitions script was created by LineageOS developer erfanoabdi and filipepferraz and released under LGPL. It is used when the partitions need to be copied before flashing. - ## Acknowledgements * Funded from September 2022 until February 2023 by ![logos of the "Bundesministerium für Bildung und Forschung", Prodotype Fund and OKFN-Deutschland](resources/pf_funding_logos.svg) - ## License + Original development by [Tobias Sterbak](https://tobiassterbak.com). Copyright (C) 2022-2023. This program 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. From 42cd623059e32170092687a7e41c9b9b99ee4f05 Mon Sep 17 00:00:00 2001 From: RaptaG Date: Sat, 30 Sep 2023 16:23:00 +0300 Subject: [PATCH 098/102] Better image alignment Signed-off-by: RaptaG --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3ed3e770..7e07b9f0 100644 --- a/README.md +++ b/README.md @@ -204,7 +204,9 @@ A detailed list can be found [here](https://openandroidinstaller.org/#contribute ## Acknowledgements -* Funded from September 2022 until February 2023 by ![logos of the "Bundesministerium für Bildung und Forschung", Prodotype Fund and OKFN-Deutschland](resources/pf_funding_logos.svg) +* Funded from September 2022 until February 2023 by: + +![logos of the "Bundesministerium für Bildung und Forschung", Prodotype Fund and OKFN-Deutschland](resources/pf_funding_logos.svg) ## License From f293cae4c62e15c27c7133946bf39e4b369af10f Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Sun, 1 Oct 2023 17:58:26 +0200 Subject: [PATCH 099/102] Display details table on bootloader unlocking --- docs/unlocking_the_bootloader.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/docs/unlocking_the_bootloader.md b/docs/unlocking_the_bootloader.md index f30079d6..b3e1502f 100644 --- a/docs/unlocking_the_bootloader.md +++ b/docs/unlocking_the_bootloader.md @@ -1,6 +1,6 @@ -#### On unlocking the bootloader +# On unlocking the bootloader -First of all, this tool will not help you bypass any vender locked bootloaders in non-official ways. +[!IMPORTANT] First of all, this tool will not help you bypass any vender locked bootloaders in non-official ways. Devices by *Samsung, Google, OnePlus, Fairphone* and others make it relatively easy to unlock the bootloader and get good support in the installer. @@ -8,10 +8,7 @@ For some devices, it is necessary to unlock the bootloader manually. You usually Other phone manufacturers no longer allow you to unlock the bootloader. Nothing can be done if you have not unlocked your device in time. These manufacturers include *Huawei, Honor, LG and ASUS*. Support for these manufacturers will always be very limited. -
- - Here is a brief overview of the bootloader policies of some of the most popular brands (may be incomplete/inaccurate) - +## Here is a brief overview of the bootloader policies of some of the most popular brands (may be incomplete/inaccurate) | Brand | Flashing tool | Unlocking Method | Loss of guarantee\* | Supported models | |---|---|---|---|---| @@ -29,7 +26,4 @@ Other phone manufacturers no longer allow you to unlock the bootloader. Nothing **\*** In the EU you won't loose your standard 2 years of the warranty when you unlock your bootloader, flash your device or root it. ([source](https://forum.xda-developers.com/t/info-eu-rooting-and-flashing-dont-void-the-warranty.1998801/)) -
-
- You can find more information about the brands and their bootloader policies [here](https://wikilibriste.fr/fr/tutoriels-android/bootloader-unlock) (in French). From 43648742fd6f5098d4053dbdd2b80a2e119a68f9 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Sun, 1 Oct 2023 18:46:19 +0200 Subject: [PATCH 100/102] fix formating on bootloader-doc --- docs/unlocking_the_bootloader.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/unlocking_the_bootloader.md b/docs/unlocking_the_bootloader.md index b3e1502f..e693a721 100644 --- a/docs/unlocking_the_bootloader.md +++ b/docs/unlocking_the_bootloader.md @@ -1,6 +1,7 @@ # On unlocking the bootloader -[!IMPORTANT] First of all, this tool will not help you bypass any vender locked bootloaders in non-official ways. +> [!IMPORTANT] +> First of all, this tool will not help you bypass any vender locked bootloaders in non-official ways. Devices by *Samsung, Google, OnePlus, Fairphone* and others make it relatively easy to unlock the bootloader and get good support in the installer. From 9ba8c276ac41090e6a93179e935fa8f4398287cd Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Mon, 2 Oct 2023 08:24:44 +0200 Subject: [PATCH 101/102] Bump device count to 73 and version to 0.5.0 --- README.md | 2 +- openandroidinstaller/openandroidinstaller.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 55e30516..41c49969 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Linux is currently the best supported platform (tested with Ubuntu 20.04/22.04 L ## Officially supported devices -Currently, the **we support 62 devices** by various vendors and working on adding more soon! +Currently, the **we support 73 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. diff --git a/openandroidinstaller/openandroidinstaller.py b/openandroidinstaller/openandroidinstaller.py index 2e175dc9..34cfccd5 100644 --- a/openandroidinstaller/openandroidinstaller.py +++ b/openandroidinstaller/openandroidinstaller.py @@ -56,7 +56,7 @@ from tooling import run_command # VERSION number -VERSION = "0.4.5-beta" +VERSION = "0.5.0-beta" # detect platform PLATFORM = sys.platform From 99189992573c1719bfb5edfae4de0e7f6d518780 Mon Sep 17 00:00:00 2001 From: rudu <40572253+anon1892@users.noreply.github.com> Date: Tue, 3 Oct 2023 20:28:51 +0200 Subject: [PATCH 102/102] Add support for begonia (Xiaomi Redmi Note 8 Pro) --- README.md | 1 + .../assets/configs/begonia.yaml | 56 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 openandroidinstaller/assets/configs/begonia.yaml diff --git a/README.md b/README.md index db0aa725..c3e40324 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,7 @@ Vendor | Device Name | CodeName | Models | Status Xiaomi | Redmi Note 7 | [lavender](https://wiki.lineageos.org/devices/lavender) | | tested Xiaomi | Redmi 7A / 8 / 8A / 8A Dual | [Mi439](https://wiki.lineageos.org/devices/Mi439) : pine / olive / olivelite / olivewood | | tested Xiaomi | Redmi Note 8 / 8T | [ginkgo](https://wiki.lineageos.org/devices/ginkgo) / willow | | untested +Xiaomi | Redmi Note 8 Pro | begonia | | untested Xiaomi | Redmi 9A / 9C / 9AT / 9i / 9A Sport / 10A / 10A Sport | garden / dandelion / blossom / angelican | | tested Xiaomi | Mi 9T / Redmi K20 | [davinci](https://wiki.lineageos.org/devices/davinci) / davinciin | | untested Xiaomi | Redmi K20 Pro / Mi 9T Pro | raphael / raphaelin | | untested diff --git a/openandroidinstaller/assets/configs/begonia.yaml b/openandroidinstaller/assets/configs/begonia.yaml new file mode 100644 index 00000000..f99ef571 --- /dev/null +++ b/openandroidinstaller/assets/configs/begonia.yaml @@ -0,0 +1,56 @@ +metadata: + maintainer: A non (anon) + brand: xiaomi + device_name: Xiaomi Redmi Note 8 Pro + is_ab_device: false + device_code: begonia + supported_device_codes: + - begonia + - begoniain + untested: true + notes: + - You should install Android 10 or newer ROM. +requirements: + android: 11 (MiUI 12.5) +steps: + unlock_bootloader: + - type: confirm_button + content: > + As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone + how to start and run an operating system (like Android). Your device should be turned on. This will reset your phone. + - type: link_button_with_confirm + content: > + - Create a Mi account on Xiaomi’s website. Beware that one account is only allowed to unlock one unique device every 30 days. + + - Add a phone number to your Mi account, insert a SIM into your phone. + + - Enable developer options in `Settings` > `About Phone` by repeatedly tapping MIUI Version. + + - Link the device to your Mi account in `Settings` > `Additional settings` > `Developer options` > `Mi Unlock status`. + + - Download the Mi Unlock app with the link bellow (Windows is required to run the app), and follow the instructions provided by the app. It may tell you that you have to wait, usually 7 days. If it does so, please wait the quoted amount of time before continuing to the next step! + + - After device and Mi account are successfully verified, the bootloader should be unlocked. + + - Since the device resets completely, you will need to re-enable USB debugging to continue : `Settings` > `Additional settings` > `Developer options` > `USB debugging` + link: https://en.miui.com/unlock/download_en.html + boot_recovery: + - type: confirm_button + content: > + Now you need to boot a custom recovery system on the phone. A recovery is a small subsystem on your phone, that manages updating, + adapting and repairing of the operating system. + - type: call_button + content: > + Once the device is fully booted, you need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue. + command: adb_reboot_bootloader + - type: call_button + content: > + Install the recovery you chosen before by pressing 'Confirm and run'. Once it's done continue. + command: fastboot_flash_recovery + - type: call_button + img: ofox.png + content: > + Reboot to recovery by pressing 'Confirm and run', and hold the Vol+ button of your phone UNTIL you see the recovery. + If MiUI starts, you have to start the process again, since MiUI delete the recovery you just flashed. + Once it's done continue. + command: fastboot_reboot_recovery \ No newline at end of file