yashsingh1/xdaforums huggingface dataset:
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
So both my worries came true - it kinda works in Google Camera, but many other apps are calling the old camera APIs and simply didn't activate the routine I wrote, and on top of that switching out/into the app quickly can cause double popup/takeback issues (where the camera attempts to pop up when it already is up, same for takeback). After looking at the logs, I do have ideas for both cases though (thank goodness the people at Google gave plenty of log output), but it's gonna be even dirtier than what I already wrote, so don't expect this to be in any other GSIs. It's also gonna be written in NDK (C++) rather than Java, something I'm even more unsure of. Anyway, see you in a bit :)
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
Progress is good - all camera-capable apps I have on my phone can trigger cam popup/takeback now. There still is a rare case of double popup/takeback though, which my current solution - using a persist prop as camera status indicator - can't take into account. Gonna look into how to get that status from the motor HAL itself.

Also, camera still pops up on boot, which admittedly isn't ideal, but that's a lesser, one-off problem we'll get to later.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
And we're done - I wrote a dirty way to grab camera status from HAL, and that worked nicely. Well, not 100% - if you switch to / out of front cam rapidly, the status detection won't be able to keep up, but at least there won't be double popup/takeback issues. I've dumped it here for PHH and whoever interested to review.

As said, I see this as a VERY dirty solution, so don't expect this to be merged/included anywhere else, though I'll likely include it in the next update of LOS (should be due this weekend). For now I'll take a break and see what PHH thinks about it.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] ermacwins:
Thanks for your continued work man.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] iXanza:
I see phh has some modifications that look clean enough. hopefully the fixes get merged soon. I'm getting tired of miui
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Abaddon:
You the man! Thanks for everything you've done. :highfive:
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
His "proper" approach of directly calling the HAL functions does look much cleaner, but will involve SELinux/sepolicy, which I have zero knowledge of and can't figure out. Given that the solution works well under SELinux permissive, I've submitted that part as a PR and will wait for PHH to do the corresponding sepolicy.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
This is great work. Have 5 more days before I can unlock the bootloader, this will definitely be the first ROM to go on.

Have you tried testing the pop-up safety mechanism when dropping? I was wondering if this function is purely hardware and therefore still works?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
Many advanced front cam functionalities are definitely software-based. You know that in MIUI you can apply pressure on a popped-up front cam and it'll retract responding to that to avoid mechanical damage? That's software as well, GSIs don't do that.

I'm already glad that we are close to completing the basic functionality and also managed to avoid double popup/takeback (which is a much more likely source of mechanical damage). I'm not motivated to do those advanced functionalities and I guess PHH won't either.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
That's unfortunate. For me it will be rare to use the front cam, so it's not a problem for me, though I imagine some people might have a problem with that.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] ermacwins:
Andy, will your next build include these features? https://www.xda-developers.com/lineageos-changelog-23-features/
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
Upstream changes will always be included. Most are already in June's build though - you see the LOS team doesn't post changelogs very often.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] iXanza:
Does auto brightness work in your gsi for this phone? Will the camera motor be implemented in your next build?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
1) Yes, though the brightness curve is kinda weird (don't blame me, I ripped the values outta stock ROM).

2) The aforementioned motor workaround will be included, but since the sepolicy haven't been figured out, you'll need an SELinux permissive kernel or manually setting SELinux to permissive on each boot (neither are hard to do, just one more hassle).
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] iXanza:
Sorry I haven't flashed a gsi in forever, would I need to format userdata for this phone? Do I need to flash the file in the phh wiki then flash the gsi?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
1) idk, I prefer unencrypted data so I have to format either way.

2) vbmeta is necessary but only for once (unless you return to stock by fastboot in the future)
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] tenshikurabu:
I like los very much, thank you for your great work.

My previous k20 pro didn't flash with the right command, it hadn't boot up ever. I was using the EU ROM for a week. Days ago, it has some issues with hardware, I exchanged a brand new one from xiaomi service center, I should wait for unlock again till next Wednesday, so I can try it out.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] rifles:
Just done reading on 1st post.. Is that means that flashing LR.Team/wzsx150's TWRP will giving some issue like camera not popping up? At the original chinese miui website mention some kind of vibration not working.

And what are these Status on GSIs/PHH things is?? Sorry for asking because I have no idea what these 2 things means.

I need TWRP to move some apk into system apps .
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
Nah, as you can see the post is split into 2 independent parts. TWRP is just your ordinary TWRP, nothing to do with the status/bugs of GSIs. You can safely ignore what you don't understand.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] rifles:
Can u briefly tell me what is the 2 things for so I can understand ?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] xuananh94:
wrong chat sorry
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
TWRP is a custom recovery that lets you do many things. Mainly it is used to install custom ROMs, install root and install apps to the system.

GSI ROMs are ROMs that are released as a single ROM image that can be installed on many different phones.

Normally a custom ROM will need to release a separate ROM image for each phone it supports.

In the OP the first part gives links to the LR.Team version of TWRP.

In the second part of the post Andy talks about what currently does and doesn't work with GSI ROMs.

At the moment there is an issue with TWRP on phones with the SD855 SoC. In TWRP vibrations don't work when you touch the screen when performing actions. This issue is only when using TWRP. It does not affect the phone in normal use.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] rifles:
Noted.. Thanks for the explaination.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] tenshikurabu:
May I ask you a question, the k20 pro is an a-only or an a/b partition device?

I search some threads and use command line getprop, can not make sure which it is. Thank you!
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Abaddon:
It is A only but;

All devices that came in with Android Pie and above has system-as-root so you'll be needing A/B for GSI
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] tenshikurabu:
Thank you for your help, I'll try it on next Wednesday. Before I get started, I have much time to read this thread carefully.

And sorry for my memory is not good, I've asked same question days ago.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] pritambhadane:
Why development is so slow for awesome k20 pro ??

Bcoz not a single custom ROM available yet?

What is the problem ?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
It's only been released officially in China and doesn't have full global lte bands.

Once it's released globally more developers will get their hands on it.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] iXanza:
fastboot is telling me the command --disable-verity is unknown when following the vbmeta flashing command from PHH's wiki. What am I doing wrong here?

C:\adb\fastboot.exe: unknown option -- disable-verity

EDIT: Nvm fixed that by using proper sdk tools fastboot. I flashed your GSI but now I'm getting terrible audio tearing especially from the notification sounds. Would you be able to help with this?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] ermacwins:
Andy where do you post your builds?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Abaddon:
There's a link at the OP
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
Good news - I've figured out the sepolicy. It's incredibly frustrating to do, given that I know little about SELinux, but we now have auto popup/takeback even under SELinux enforcing.

Unfortunately I still didn't have success implementing takeback on boot, but for now you can just open any camera app and switch to then out of front camera in order to make it retract.

With the sepolicy in place, running "xiaomi-motor" is limited to ADB shell and superuser - regular apps like Terminal Emulator can't call it unless you "su".

My LOS GSI was just updated with the required changes; I've also submitted them to PHH for review, but until he merges them, no other GSIs will be capable of doing the same.

OP and PHH wiki page will not be updated with this progress until PHH completes the merge.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
This is one of the things that had been fixed on the first go, and I can personally verify it doesn't happen on my device.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] LegionCommander:
I just tried your latest build sir (BVN) and I keep on getting play services has stopped on a fresh install. tried 2 different gapps with factory reset. I will try with wiping data. is it because I am decrypted? without gapps all is fine and +1 with audio cracking still present
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
This is good news indeed. My unlock wait finished today, but I've had other things to attend to. Tomorrow I should have time to unlock and install your LOS GSI and have time to deal with any problems. Cannot wait to get back to a proper ROM.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
I have no idea about GAPPS (I don't use any). Waiting for further verification.

For audio cracking, tell me the ringtone(s) that sound bad on your side, as well as do "getprop ro.audio.ignore_effects" in ADB shell or terminal.

EDIT: I've just backed up and tried a fresh install from the released image, plus OpenGAPPS pico. I didn't log into my Google account, but at least there's no crashing on my side, and ringtones sound right.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] LegionCommander:
Thanks for the reply and sorry for the bother. I just wiped my data including internal again and flashed rom + gapps. booted now with no play services error but I am still getting the audio cracking, may audio compatibility module can fix it temporarily for me
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
As said, more details on the cracking please.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] ermacwins:
There's 3 files on the sourceforge page, which one to download?

Also is possible to flash with twrp by selecting IMG instead of zip?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
bvN (referred to as "AB", "64B" or system-as-root).

TWRP has an option for flashing images.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] ermacwins:
When I try to flash vbmetei.img in fastboot it says: fastboot: unrecognised option `--disable-verity
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Logi_Ca1:
Your fastboot version is too old. Grab the latest version off Google:

https://developer.android.com/studio/releases/platform-tools
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] iXanza:
RE: crackling. I am now on MIUI china stable but I will flash your latest build tonight and let you know again. I got the issues only on notification sounds, alarms and the ringtones, not on audio playback via youtube and it was the default sounds that came preselected.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] prorcracer87:
Just flashed Andy's 0707 GSI.

I'm having crash reboots in Instagram. It doesn't crash when it opens, but crashes after slight usage.

There are also some random crash reboots during normal usage.

Anyone else experience this?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] ermacwins:
Up and running. The rounded corners are not smooth but look jagged. FP reader is finnicky. Will do some more testing.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
Had this installed for a few hours now. Not had any app crashes on anything I've tried so far. The corners look smooth on my phone (at least to my eyes).

The FP is very hit and miss. When it's active the circle area on the display doesn't get anywhere near as bright as it does on MIUI based ROMs. I imagine this is why it struggles so much.

It was surprising how early in the boot process that the camera pops up. I was expecting it to happen during the LOS animation at least. Not had any issues with the camera trying to pop up when it's up or down when it's down, so that fix seems good.

None of the other known GSI issues for this phone are a problem for me. So this will be my ROM, for the foreseeable future.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
I didn't include a rounded corner overlay (it requires a separate SystemUI overlay which is a nuisance), so the pixelated corner you might see is the display's natural appearance.

I never tested FP under MIUI, but indeed here the sensor seems quite picky, only achieving good speed/accuracy when you use the center ("belly") of the finger.

The recog circle is as bright as it can get though - the display automatically rises to full brightness when you press a finger in the area.

Since the position of the sensor itself is unwieldy (high risk of dropping the phone when using), I prefer simply not using it most of the time.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
In MIUI, the display in the FP circle area goes white and very bright, rather than the muddy yellow/green here.

A couple of other issues I've come across, which I don't think I've seen mentioned yet.

The notification led on top the pop-up camera doesn't work, either when there are notifications or when charging.

In the Magisk manager SafetyNet check, it fails with the ctsProfile returning false.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
What? From what I read, all devices with in-display FP sensors specifically use a green light, there's a theory behind it.

LED is something I solid acknowledge but have no idea why it happens. Maybe I'm missing something obvious, but I'm not really interested at the moment, since our LED is at the top which is hard to see anyway.

I don't think you'd get SafetyNet pass reliably without help from Magisk.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Abaddon:
MIUI uses teal or cyan as fp light rather than green
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
Have a look at this video. If it's not white, then it's close to white.

https://m.youtube.com/watch?v=AVfzSt-bu-U
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] iXanza:
Flashed the latest LOS gsi again after coming from miui China stable and the audio issues were gone. Maybe it's because I was on xiaomi.eu rom previously.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] hclyde:
Thanks guys. Just flashed Xiaomi eu rom to my Redmi K20 pro from China rom successfully. mighty thanks to this/all your messaging thread. Special thanks to the LR team. Donations to the TWRP team, am up for it

Thanks everyone
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] iXanza:
Has anyone passed safety net on any GSIs? When I use magisk hide props I get thrown into a bootloop
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
Yes, search for and install SafetyPatch module in magisk manager.

Working in AndyYan's LOS GSI
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Abaddon:
Safety patch works. But safetynet props gave me bootloop too which is sad because for me it is better than safety patch but at least for now it works.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] NZ Razer:
Flashed the latest China Stable rom then flashed Andy's latest GSI but I still encounter random crashes, and full system reboots to TWRP randomly. Really unsure as to what I could do differently to produce the same results as those that are using it as a daily driver. Anyone else encounter this at all?

Edit: Switched over to Havoc OS and so far is running very smoothly aside from the camera pop-up on boot as expected.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] knift:
Hi, I flash the Havoc, too. It seems fine but the fingerprint unlucky always fail.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
Try deleting the fingerprint(s), then make sure the screen and your fingers are clean, then try saving the fingerprint(s) again. The first 2 times for me were not good, would only unlock once in 5 or 6 times.

Now I've got it to unlock maybe half the time. Sometimes first go, sometimes 2 or 3 goes. Now it's good enough to use fingerprint authorisation in apps that use it.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] THeSTIG8888:
Can we get some roms for the k20 as well the developers if seeing this please show some love for the k20 too
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Schnedi:
GSIs work on your device too.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] THeSTIG8888:
I am a noob i have some experience with flashing roms but not building them ??
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
You don't need to build them. You download a GSI image and flash it. Go to Phhusson's K20 Pro page in his guthub wiki for details on flashing A GSI, it's only a couple of extra steps. The link is in this threads OP.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] THeSTIG8888:
Thank you so much for the info bro but will it work for the k20 and how do iron out the bugs
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Abaddon:
you can ask here

https://xdaforums.com/mi-9t/help/gsi-roms-t3944946
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] AndyYan:
Latest news is that [MENTION=7500669]TingyiChen[/MENTION] (Isaac Chen) has finished bringing up the device, and a MoKee build based on his work should be around the corner. Given that he's also the official LOS maintainer of quite a bunch of Xiaomi devices, it's likely that the device would join LOS's lineup some time later, and I bet it'd work better than the GSI and the workarounds I hastily coded.

Of course, obligatory warning here: if you want to use his device trees (or anyone's, really) to build other ROMs and want to release it to the public, ask for permission! Sure it's open-source, but apart from the kernel, not obligatory so. I don't want to see more devs leave just because the community doesn't show respect.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] knift:
I encountered the same problem. And the latest version from Google can't resolve it. At last I found to execute fastboot in cmd shell but not in powershell resolved it.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] manan001:
Waiting for the k20 roms soon:good:

---------- Post added at 02:55 AM ---------- Previous post was at 02:53 AM ----------

Can this be for k20 indian version?
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
Try looking and asking in the K20 forums
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Abaddon:
That twrp will only work on k20 PRO china and indian. As per indian devices. Convert it to china rom or rename the updater script for raphaelin. Chinese k20 pro uses raphael while india uses raphaelin. But every rom and kernel should work on both.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] manan001:
So then i will aait for k20 twrp indian version as i dont want to cha ge to rom.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] ermacwins:
Anyone have a direct link to the havoc GSI they're using as I'm getting a bootloop
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
Don't have a direct link, I got it from here. https://xdaforums.com/project-treble/trebleenabled-device-development/gsi-havoc-os-t3930030

I'm on the 12 July build, which I think is still the latest. Everything works fine for me. Have you installed vbmeta.img? Can find that on Phhuson's K20 Pro Wiki page. Have you uninstalled Magisk before flashing, as the instructions specifically say to do that? For me I went from stock straight to LOS GSI, then from there clean flashed Havoc GSI.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] saxena.siddhu:
Are you saying it's as good as a daily driver then? What about the issues that are mentioned in the wiki attached below.

Cheers.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
It's very good as a daily driver. The camera module works fine as it has AndyYans fix merged in. With the Magisk module as well, which retracts the camera after first boot, then it's no problem. Everything else for me are not a problem. Don't use Bluetooth headsets or audio over USB. I always turn off auto brightness. No matter what phone I've never liked it.

The other issue is the FP sensor which is fussy. But I've got it good enough that I'm OK with it.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] saxena.siddhu:
Ah. That sounds great. Sucks for me cos I've got Bluetooth earbuds that I use regularly. Auto brightness is not a big deal but oh well. Anyway thanks for the reply.

Cheers.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
As far as I know, music is OK with Bluetooth. The issue says it's in call audio that's the problem. The Havoc OP has a Magisk fix that might work for Bluetooth audio.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] EnForce61:
Hello guys. I am buying K20 Pro in about a month or so and I just have one question for now. When I apply for Unlocking and then try to unlock it do I have to keep it plugged into whole 7 days or what is procedure to get it unlocked. Please someone explain me. Thank youuu :laugh:
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Robbo.5000:
Follow this guide https://xdaforums.com/k20-pro/how-to/howto-flash-twrp-xiaomi-eu-rom-fix-gpay-t3946342

During your first attempt to unlock, the Mi Flash Tool will tell you how long you have to wait before it can be unlocked. Normally it should be 7 days. Now you just remove the phone from the PC and use it as normal. After waiting 7 days (or whatever was your time to wait) try and unlock the phone with the Mi Flash Tool again. It should now unlock successfully.

When waiting to unlock the phone.

Do not change the Mi account on the phone. Do not factory reset the phone. Do not try and register the phone for unlocking again.

Doing any of these will reset your wait time. Just use the phone normally and be patient.
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] Abaddon:
When you opt in to unlock bootloader in your phone and mi unlock tool, you have to use it for 7 days without disabling system apps. Then when you're unlocked you can do whatever you want. Just don't relock it :highfive:
[Redmi K20 Pro / Xiaomi Mi 9T Pro Guides, News, & D] andy21304:
Thanks for the sharing on Baidu Pan and also Google Drive!