[Lenovo P11] LSS4181:
#include <std/disclaimer.h>
/*
* I am not responsible for bricked devices, dead SD cards, thermonuclear
* war, or the current economic crisis caused by you following these
* directions. YOU are choosing to make these modifications, and
* if you point your finger at me for messing up your device, I will
* laugh at you.
*/

I bought the new tablet and unlocked it as soon as I was able to. After some fiddling I eventually got GSI up and running.

Originally I planned to post this when an actual forum for P12 becomes available, but given some known issues with the stock FW at the time of writing, I think I'll just post it here now.

What you need

1. Unlocked bootloader

Go to ZUI official unlock page to request an unlock (the page is in Chinese). For this tablet, you need to use the 4th option (Lenovo Tablet), which only requires you to enter the device's SN (can be found in the Settings screen, or from bootloader). Once you obtained the file needed to be flashed for unlocking, follow the official instructions to unlock the device.

NOTE: You need to wait for at least 8 hours since the device's initial connection to Internet to get your device's SN recognized by the official unlock service. If it complains about "incorrect SN" but you've verified that your input is correct, simply wait a few more hours and try again.

!!! WARNING: Like any other Android device, unlocking bootloader will wipe your data so BACKUP FIRST !!!

2. fastboot

The process utilizes fastboot exclusively, so make sure you have fastboot installed. No other tools are needed.

3. Magisk-patched boot.img, or a patched vbmeta

As there's currently no available PRC ROM dump for this tablet, the currently only known ROW dump will do.

Although you should be able to use GSI without Magisk, you'll probably need to patch vbmeta so the stock kernel won't refuse to boot the GSI in this case. This guide does not cover non-Magisk scenario for now, as I'm not entirely sure. With Magisk, patching vbmeta is not needed. Optionally you may consider patching and flashing vbmeta_system (it's most likely not needed).

!!! WARNING: Flashing images with fastboot/fastbootd can invalidate existing encryption signature so the device will no longer be able to decrypt userdata, requiring you to format and start over. As a result, BACKUP EVERYTHING FIRST IN CASE OF CLEAN FLASHING OR UPDATING OTHER COMPONENTS. !!!

4. Additional stuffs to flash

WARNING: This tablet happens to be very picky about the kernel and vendor image you use when running GSI. While a mismatched kernel (Magisk patched) worked fine on stock as far as I could remember, on GSI, it'll result in the device's Wi-Fi and Audio not working, unless additional components (vendor, maybe also odm) of the same FW version are also used.

If you're going to use the boot.img from the ROW dump (and patched it with Magisk), note about these images from the dump. I think at least vendor is needed. You may also try flashing odm if you're having issues.

- super_5.img (vendor.img)

- super_6.img (odm.img)

FOR EXPERTS: The boot.img and vendor.img (as well as additional files like dtbo and vbmeta) from Android 12L developer preview might also be usable for running GSIs. I haven't tested this yet and it's possible the binaries may carry known or unknown issues.

Steps to flash GSI

1. Enter fastboot

Use the following adb command to enter fastboot.

adb reboot bootloader

2. Enter fastbootd

Enter the following command to enter fastbootd, where you can actually access the system partitions, as this tablet uses Dynamic Paritions.

fastboot reboot fastboot

WARNING: The following steps will actually modify your system partitions and may leave your tablet unbootable. Make sure you have backed up everything before proceeding.

3. Flash Magisk patched boot.img

Assume you have the Magisk patched boot.img as boot_magisk.img, enter the following command.

fastboot flash boot boot_magisk.img

Note that you can also flash boot.img directly from fastboot, before entering fastbootd.

4. Flash the GSI

Enter the following commands, assuming your GSI is called gsi.img.

fastboot erase system
fastboot flash system gsi.img

Note that the erase command is optional. Replace gsi.img with the actual GSI image file of your choice.

5. Flash additional stuffs

You need to flash the vendor.img (or also odm.img) from the same FW dump as your boot.img. Assuming your vendor image is vendor.img, and odm image is odm.img, use the following command.

fastboot flash vendor vendor.img
fastboot flash odm odm.img

NOTE: For which image files in the ROW dump correspond to vendor and odm, read above.

FOR EXPERTS: If you could somehow obtain a dump of the running boot.img and patch it with Magisk, you may skip this step, but you can always flash those stuffs in case Wi-Fi and Audio are not working. As there's no known PRC ROM dumps at the time of writing, I'm not entirely sure.

6. Wipe userdata if needed

You don't need to wipe userdata if you are dirty flashing newer build of a same GSI over the existing one.

In case you need to do so (such as flashing a different GSI, or factory reset), enter the following commands.

WARNING: These commands will erase everything in the internal storage, not just app data! Make sure you have everything in the internal storage backed up before doing this.

fastboot erase userdata
fastboot erase metadata

7. Reboot

Enter the following command to reboot.

fastboot reboot

If nothing goes wrong and the GSI doesn't have any major issue that might prevent it from successfully booting, you should be able to boot the GSI and further configure it yourself.

Current Status for GSIs

So far everything I could test works on Android 11 and 12 GSIs.

- Wi-Fi (needs matching vendor and maybe odm images, read above)

- Camera (both sides)

- Fingerprint Sensor (may occasionally not work)

- 120Hz refresh rate

- Bluetooth (Lenovo Precision Pen works)

- Physical Keyboard Case

I'm currently running DotOS 5.2 GSI on this tablet and am yet to encounter any serious issue. Even some demanding games work just fine. Just that when using the boot.img, vendor.img (as well as odm.img) from the ROW dump, the system would use a smaller font size by default.

The latest phh-AOSP A12 (v400) as well as some other unofficial A12 GSIs can work with this tablet. I'm currently running SuperiorOS-12. Everything works fine after some tweaking, just that I noticed some touch related issues which might have something to do with similar reports on official Android 12L beta.

NOTE: Like any other Qualcomm devices, "Use alternate audio policy" option may be needed to ensure audio works the same as on stock ROM. However, it seems audio can work without enabling this option on Android 12 GSIs.

Still, I'm not sure about how to get features specific to ZUI, like Desktop Mode, to work on GSIs.