[Huawei P20 Pro Themes, Apps, and Mods] Aodrulez:
Hi everyone,

After installing EMUI 9 (.241) on my P20 Pro & switching to Lawnchair V2, I was happy with pretty much everything except EMUI's default app switcher (Recents Screen). It's bug ridden & lags way too much for usability. That was when I decided to try QuickSwitch Magisk module from [MENTION=6315410]Skittles9823[/MENTION] & [MENTION=6018897]paphonb[/MENTION] . Unfortunately, it didn't work for EMUI 9 & I decided to dig further into it.

Background Info:

In Android Pie, "recents screen" feature is handled by the launcher & is no more part of the OS itself. Android OS triggers recents screen by starting an intent "android.intent.action.QUICKSTEP_SERVICE" which is bound to the default launcher. What this means is that only the application specified in the intent can receive it. Now, in case of most OEM roms, this value is defined inside an XML resource in "/system/framework/framework-res.apk" (the file name can be different for different roms) file. QuickSwitch Magisk module apparently replaces this value using "Runtime Resource Overlay" technique to setup any launcher of your choice as the default handler for recents screen or QUICKSTEP as it's called.

Huawei, you bad boy

In EMUI 9, instead of defining this value inside some xml resource, Huawei decided to create a jar file instead named "hwServices.jar" & hardcoded EMUI launcher's package name in a "String" variable to be used for triggering the QUICKSTEP intent. This effectively kills the approach taken by QuickSwitch magisk module & us Huawei device owners are left with no other option but EMUI 9's bad implementation.

The way around

There are couple of options in this case:

Patch "hwServices.jar" file to point so some 3rd party launcher

Remove default EMUI launcher, create an application with the same package name to relay QUICKSTEP intent between system & third party launchers

Remove default EMUI launcher & replace it with a third party launcher that's modified to have EMUI's default launcher's package name

After spending the entire weekend trying Option 2 with limited success, I decided to go for Option 3 as modifying "hwServices.jar" itself seemed like too much meddling with the system's functioning. And so I removed default EMUI launcher from my system, took the latest Lawnchair v2's alpha build, patched it to have EMUI's default launcher's package name & installed it instead with system permissions. This works like a charm!

Instructions

You need a rooted device with Magisk installed

Install (QuickSwitch Magisk module v1.1.2)

Delete "/system/app/HwLauncher6" folder's contents using some file-manager like ES explorer with root permissions ( Create a backup if you want, it can be restored by copying the files back in the same folder if needed)

Reboot phone

Install patched Lawnchair V2's apk attached to this post on your phone.

Using QuickSwitch app installed on your phone, select Lawnchair V2 as the default home app & QuickStep provider. (We are using QuickSwitch only to give our patched Lawnchair v2 app system privileges. If you have any other way of doing this, feel free to do so & you can ignore installing QuickSwitch & it's steps above entirely)

Reboot & everything should be setup correctly.

Note

The patched version of Lawnchair v2 attached here is based on the latest alpha build at the time of this post& although everything seems to be working just great, there might be few bugs here & there. I'll update the attachment as & when more stable versions are released.

Credits

Special thanks to both [MENTION=6315410]Skittles9823[/MENTION] & [MENTION=6018897]paphonb[/MENTION] for interacting with me while I was trying to find a way to get this working on EMUI. Much appreciated!

Update 1

The patched version of Lawnchair attached isn't entirely perfect, I'll wait for it's source code to be released to refactor everything properly. Until then, you can use this to replace your existing recents screen & even use a different launcher along with it, as long as attached Lawnchair V2 is a system app.

Update 2

Have also added OnePlus's Launcher ported by Paphonb with patch for EMUI 9. You can use this one instead of Lawnchair V2 too, if you like. Kindly note that these might be unstable due to my patches.

Update 3

Have updated the attached Lawnchair v2 apk with patch v1.1 (Fixes crashes)

Latest build download for Lawnchair V2

You should find fairly recent builds of Lawnchair V2 patched for EMUI here: (To be updated soon!)