yashsingh1/xdaforums huggingface dataset:
[Xiaomi Mi Pad 4 Questions & Answers] AndyYan:
Awesome, you're the pioneer of the community!

You might need to change build.prop in system or vendor to appropriate tablet characteristics like said above.

I might build a tablet UI GSI directly if that's at all feasible, but that'd have to wait.

Also, if other ROMs have the brightness problem as well, consider reporting it to PHH and helping them fix it. We're an official Treble device so the fix should be done on their side.
[Xiaomi Mi Pad 4 Questions & Answers] darkjedi:
Could you share that TWRP version? I don't have a Baidu account. Thank you. :)
[Xiaomi Mi Pad 4 Questions & Answers] ph0t0gr4ph3r:
I'm in Vietnam got it two weeks ago, already have go ahead to unlock bootloader but I have no reason to unlock the bootloader if there isn't a recovery or any roms for the device
[Xiaomi Mi Pad 4 Questions & Answers] Ralfioni:
build.prop includes device information such as manufacturer, model name, SOC architecture, hardware specifics (tablet, sd slot) etc.

As it is apparently a device specific Android config file (which is located in the system partition and therefore part of the GSI), how can ONE GSI fit ALL devices? Any insights on this are appreciated.
[Xiaomi Mi Pad 4 Questions & Answers] AndyYan:
Since Treble is implemented, build.prop has been separated into 2 parts, /system/build.prop and /vendor/build.prop, the latter of which holds device-specific info.

It does surprise me that tablet characteristics aren't stored there though. As I just said, if the build.prop modify trick doesn't work, maybe we'd have to build a separate GSI targeting tablets.
[Xiaomi Mi Pad 4 Questions & Answers] Ralfioni:
Thanks, that makes sense. Maybe *someone* ;) can extract the build.prop of the vendor partition and share it here, so we can see what the problem is?
[Xiaomi Mi Pad 4 Questions & Answers] Ralfioni:
Sorry for my ignorance, but why do we need a modified boot.img if the GSI boots as described by [MENTION=5436136]NexusRunner[/MENTION]?

I assumed it was the core idea of a GSI for "everything to be just fine". ;) What modifications are you saying are necessary to have an out-of-the-box experience?
[Xiaomi Mi Pad 4 Questions & Answers] AndyYan:
Mirrored here: https://drive.google.com/open?id=13FOkGOcr6HnPoZpeNOxeynxGPmBscth_

Flash rec img to "recovery" and misc.bin to "misc". I have no idea why the latter is needed though...

Try the one above.

Not me... The Chinese Beta doesn't even contain Security Center, which denies root access. I'd only be able to look further into the situation after my own unlock. I do hope someone else figures it out before I do though.
[Xiaomi Mi Pad 4 Questions & Answers] Ralfioni:
If only we knew about someone, who already unlocked their device? ;) [MENTION=5436136]NexusRunner[/MENTION]
[Xiaomi Mi Pad 4 Questions & Answers] P.Kosunen:
How do i install this version, system updater says something "...can install only from stable version", but i have stable?
[Xiaomi Mi Pad 4 Questions & Answers] AndyYan:
You can only install the latest available, and now it's 8.7.19.
[Xiaomi Mi Pad 4 Questions & Answers] bradputt:
There's already custom rom on China xiaomi site.

http://www.miui.com/forum.php?mod=viewthread&tid=16749699&extra=page=3&page=1&mobile=2

https://download.mokeedev.com/?device=clover
[Xiaomi Mi Pad 4 Questions & Answers] AndyYan:
Thanks for verifying the build.prop trick, knowing that we can have proper UI makes me feel at ease.

So what's the brightness situation now? Are you stuck with one fixed brightness value?

As far as I understand, the GSIs available right now aren't so "generic", and PHH makes device-specific overlays to fix small problems for individual devices. That's why I said before that you should inform and work with them - provide whatever info needed for them to adapt to this specific device.

---------- Post added at 03:54 PM ---------- Previous post was at 03:52 PM ----------

I haven't seen much feedback on that MoKee yet, besides kernel source isn't available either, so this doesn't make much of a difference compared to GSIs.
[Xiaomi Mi Pad 4 Questions & Answers] P.Kosunen:
Yes, that did it, thanks.
[Xiaomi Mi Pad 4 Questions & Answers] NexusRunner:
The current brightness issue affecting all GSIs is like this:

Say OS calls SetBrightness(N) to set brightness level to N, but the brightness level we actually get is f(N), where f is seemingly a hash function.

So set brightness on our device is like a lottery: the brightness changes to an unpredictable value every time, you just have to try again and again to get near what you want.

And whenever there should be a smooth transition of brightness, like when you move the brightness slider or when screen turns on / goes off, because f(N) changes drastically, the screen flickers.

How to properly inform GSI devs of this issue then?

NEWS: the almighty phh is quick to provide a workaround for us. just run this and reboot:

the brightness issue is gone
[Xiaomi Mi Pad 4 Questions & Answers] AndyYan:
Awesome, so it actually is the same issue Mix 2S suffered as well. Guess being from the same manufacturer has its merits.

I think this property could be set in build.prop ("persist.sys.qcom-brightness=4095") as well, but yeah that isn't much more convenient in most cases. I'll definitely embed it into my vendor build.prop when time comes though, so that it stays between ROM flashes.
[Xiaomi Mi Pad 4 Questions & Answers] bradputt:
are there any instructions on how to flash GSI? i'm wating for permission to unlock my bootloader now
[Xiaomi Mi Pad 4 Questions & Answers] keyid:
great stuff, will be following until i get my mipad4
[Xiaomi Mi Pad 4 Questions & Answers] Ralfioni:
[MENTION=5436136]NexusRunner[/MENTION] Thank you so much for sharing all this. So from your report, I take it, the device is 100% working now? I think I'm ready to order. :)

BTW: Is the microSD port working, too? AFAIK that "characteristic" also needs to be configured in build.prop.

Just out of curiosity: Do you think you could share the vendor/build.prop with us?

Anyone have an idea why Xiaomi did not put the right settings in vendor build.prop? It would have been nice if the tablet had been working without having to fix these 4 issues first:

- ro.sf.lcd_density=280

- ro.build.characteristics=tablet

- persist.sys.qcom-brightness=4095

- Universal DM-Verity and ForceEncrypt Disabler
[Xiaomi Mi Pad 4 Questions & Answers] AndyYan:
The density one is pretty much a personal preference - it *has* to be in one of the build.prop. That along with the tablet characteristic one might be in /system/build.prop in MIUI though, which explains why it's gone when flashing GSI.

The brightness one I have no idea either.

From my experience of working with other Treble devices, encryption support isn't always there for GSIs.
[Xiaomi Mi Pad 4 Questions & Answers] NexusRunner:
It's quite straightforward actually:

How to flash a Generic System Image on a Project Treble-supported device

When you download GSI, choose arm64-aonly variant for our device. You also have to disable dm-verity, please refer to "Troubleshooting Tips".
[Xiaomi Mi Pad 4 Questions & Answers] NexusRunner:
Certainly not 100%. Autobrightness is still missing. There could be other issue that I didn't notice, I'm going to put it to daily use and see.

Here, just extracted from MIUI 8.7.19. I think I've already uploaded build.props extracted from 8.7.2 in previous posts.

dm-verity prevents stock kernel boots non-stock /system, it's a feature you have to disable before choosing any 3rd party ROM. This one doesn't count.

The other 3 lines are all I've got so far. btw I changed dpi to 320 according to stock /system/build.prop

microSD slot seems to be working, but exFAT is not recognized as in stock MIUI, it keeps asking me to format it. This is a known issue of GSI.
[Xiaomi Mi Pad 4 Questions & Answers] Ralfioni:
General steps are:

1) Apply for unlock permission: http://en.miui.com/unlock/

2) Unlock bootloader using their tool

3) Download and flash GSI

There are plenty of guides on the Internet. E.g. this one here:

https://www.xda-developers.com/flash-generic-system-image-project-treble-device/
[Xiaomi Mi Pad 4 Questions & Answers] NexusRunner:
After reading this thread, I think I misunderstood Project Treble and Generic System Image. Correct me if I'm wrong but here's what I learned:

So GSI is a precious gift from phh. Project Treble doesn't imply we can install ROM like we install Windows or Linux: Every stock system image is still device specific, not generic at all. The reason that GSI can boot on multiple devices is simply because phh is awesome.

At least for current treble devices, truth is, for every specific device, there's specific work to do. Only we need dpi tricks? Maybe it's just because all the other treble devices have similar dpi. And for auto brightness, we need to know the parameters to map the reading of ambient light sensor to brightness of display. Most OEMs stored them in the system partition, and may be rightfully so, because that parameter is not determined by vendor of screen or light sensor, but by OEM after all. Knowing the parameters, an overlay can be created to enable auto brightness (or fix other issue), device by device. I guess that's why I see bunch of device specific overlays in GSI

I'm so grateful that I have an almost fully working custom ROM to enjoy from Day 16. Thank you all.

And let's wish dev of our device is going strong.
[Xiaomi Mi Pad 4 Questions & Answers] Ralfioni:
That's not my understanding of Treble. From what I got Treble strictly separates vendor and non-vendor specific parts of the OS into 2 partitions. Hardware related stuff (like drivers, device-specific configuration) is saved in \vendor while the actual (generic) Android OS is saved in \system. A generic system image (GSI) - not necessarily by phh (!) - can be installed on any Treble compatible device in the system partition (while the vendor partition can stay untouched). The issues you have encountered (dpi and tablet settings) are IMHO due to an incorrect implementation on Xiaomi's part. The settings should have been put in the vendor build.prop in the first place.
[Xiaomi Mi Pad 4 Questions & Answers] Ralfioni:
I'm very curious about the reason for the auto-brightness bug. Maybe it's another configuration switch that was incorrectly put into system instead of vendor?

If you notice any other bugs or non-working functionality please let us know!
[Xiaomi Mi Pad 4 Questions & Answers] NexusRunner:
That's exactly my initial thought regarding Project Treble and I wish you were right, because that would be perfect for custom ROM scene.

But the more I learned, the more doubt I have. At least for Oreo, we are not quite there yet.

Now I view /vendor as the partition to put all codes from vendors, like drivers from Qualcomm, while OEM or "device maker" like XiaoMi put their code on /system. Google's defining the interface between the two partitions and enforcing this model on all new devices. This is Project Treble. In this way each partition can be worked on simultaneously when a new device is launching, or updated separately when a new Android build is pushing to /system, or a driver fix is deployed to /vendor.

In short, Project Treble is vendor's code goes to /vendor, OEM's code goes to /system. Google requires a generic system image for test purpose must boot on every treble device, but I think it doesn't require it's 100% working. Well maybe every hardware part from every vendor is 100% working, but as a whole final device not 100%. OEM still needs to do device specific work before adding bloatware craps and releasing.

Vendor parts don't have a clue about it's in a tablet or a phone, that UI decision is made by OEM when it assembly those parts together. Auto Brightness is an Android system feature that rely on control of two separate vendor's hardware, and enabled by OEM. And for fingerprint scanner, vendor's code should pass the test not knowing it's mounted on front or rear. But for a front mounted fingerprint scanner, when the system is unlocked, it's acting as a HOME button. I think it's OEM to implement this feature.

A GSI that we talk of, is generically bootable, but specific tailored for every device. And some feature might not ever come to it, like exFAT. exFAT is a software implementation, and OEMs implement it differently. We might get exFAT enabled ROM come to our device, but no by a GSI.
[Xiaomi Mi Pad 4 Questions & Answers] Ralfioni:
Interesting point. But as long as it's just configuration switches I think the adjustments can be done quickly. Regarding auto brightness have you checked if the light sensor is working? There's an app called sensors test on the play store. Maybe the sensor needs to be switched on with another parameter?
[Xiaomi Mi Pad 4 Questions & Answers] NexusRunner:
Sensor is working no doubt. Those parameters and switches are coded in framework-res.apk. To properly support it in a GSI we need to build an "overlay" in the form of an apk. That's beyond my capability. We'll have to wait and see. If I'm so desperately in need of auto brightness I can always install Lux and let that app handle brightness.

Relax, I feel Project Treble is a wonderful beginning of something HUGE. I still can't believe it.
[Xiaomi Mi Pad 4 Questions & Answers] Thargorsson:
Ok as soon as the pad gets available on honorbuy with Europe shipping il buy it :D

Regarding the light sensor I know how to implement this framework stuff the "old-school" way.

But as the processor is a Qualcomm chip you got

source code for light HAL and other stuff which will come in handy (especially for a potential custom camera HAL)...

I would need to read myself through other devices and if/how they did that stuff as you just building a generic arm64 image for a GSI.

Anyway the previous stuff looks very promising and I'm looking forward to hopefully improving stuff even more.
[Xiaomi Mi Pad 4 Questions & Answers] Ralfioni:
You can get the 3GB Wifi version for under 190 € at geekbuying.com
[Xiaomi Mi Pad 4 Questions & Answers] Thargorsson:
But not with shipping in under 3 days....
[Xiaomi Mi Pad 4 Questions & Answers] Ralfioni:
Will it be available on Honorbuy in under 3 days?
[Xiaomi Mi Pad 4 Questions & Answers] dopefish1337:
why do you need a quick shipment if you wait longer? This makes no sense!? Just buy at gearbest, see mydealz. Mine will arrive after 8 days.
[Xiaomi Mi Pad 4 Questions & Answers] schiway:
you're awesome, count on your further information!
[Xiaomi Mi Pad 4 Questions & Answers] bradputt:
seems like you can skip the 360 hours wait if you update to developer version before unlocking

more info here (it's in chinese):

http://www.miui.com/thread-16332219-1-1.html
[Xiaomi Mi Pad 4 Questions & Answers] AndyYan:
[MENTION=5436136]NexusRunner[/MENTION] has already figured out most of the stuff we care about GSIs ahead of all of us; read the previous pages. Best I can do is just reaffirm it with LOS GSI, and probably tinker with /vendor to integrate the changes into it.

---------- Post added at 02:15 PM ---------- Previous post was at 02:13 PM ----------

I've read it through, mixed response. To me it seems it's just that the OP's account is somehow privileged and eligible for quick unlock.

Also, since MIUI only allows flashing the latest Beta available at the time, it's now impossible to flash that version.
[Xiaomi Mi Pad 4 Questions & Answers] bradputt:
oh... guess i'll wait another 5 days to unlock my mipad..... thanks for the advice.

may i know what's "REC"? recovery? i see this many times....
[Xiaomi Mi Pad 4 Questions & Answers] AndyYan:
Yes. That sentence you quoted goes: "Unlocking the Beta then flashing the recovery results in the device unable to boot".
[Xiaomi Mi Pad 4 Questions & Answers] Ralfioni:
[MENTION=5436136]NexusRunner[/MENTION] there are 2 settings in the system/build.prop that contain the string "bright" - maybe putting these in your GSI might help fix the auto brightness bug?

persist.power.useautobrightadj=true

sys.autobrightness_optimize=true
[Xiaomi Mi Pad 4 Questions & Answers] NexusRunner:
haha fat chance :p

already tried that last week, even attached whole /system/build.prop to GSI, no luck

it's more than just a switch. If you gonna attempt it, you may download stock MIUI images, extract framework-res.apk, look inside and see what's missing. As I told you before you can do that even if you don't get hands on actual device.

other minor issues I found so far and happy to live with for now:

charging/notification led on the front is not working - like it doesn't exist in GSI

can't read system clock - but TWRP can

WiFi is not automatically turned on after boot

Because of the above, system time fallbacks to GSI build time after reboot, until you manually turned on WiFi then it automatically fetches current time from internet
[Xiaomi Mi Pad 4 Questions & Answers] Ralfioni:
Okay, thanks for the feedback. Let's hope someone with some development knowledge can figure these things out. :)
[Xiaomi Mi Pad 4 Questions & Answers] rioru:
It says "Your device LAUNCHED with Android 8.0 Oreo or a newer version (eg. Android 8.1 Oreo) AND is Google Play certified". Mi Pad 4 is not Google Play certified, right? So it's not suppose to work?
[Xiaomi Mi Pad 4 Questions & Answers] rioru:
Isn't clover by default not 'google play certified'? And in the article it says that to install a GSI not only you have to have a Treble supporting device, but also a Google certified device.

It's been a while since the last time I touched the 'android flashing theme' but I remember when I installed custom roms on my flo 4 years ago, I only flashed rom itself and gaps. It wasn't Google certified, but I could fully use all the google services including Google Play with all the updates. So I'm not entirely sure what I'm missing here.
[Xiaomi Mi Pad 4 Questions & Answers] NexusRunner:
It seems Mi Pad 4 is actually certified.

https://support.google.com/googleplay/answer/1727131?hl=en
[Xiaomi Mi Pad 4 Questions & Answers] rioru:
If you install Google Play using 'Google installer' provided by miui forum, Play Market says that device is not certified. At least on my device.
[Xiaomi Mi Pad 4 Questions & Answers] NexusRunner:
Don’t worry. As the guide said:

which suggests you look up that list.

If you are still in doubt, forget it. All we care about is Project Treble compatibility here, and there are numerous ways to check it directly once you laid hands on the device.
[Xiaomi Mi Pad 4 Questions & Answers] AndyYan:
The day's finally arrived - unlocked my own MiPad4, flashed LOS GSI on it. Allow me to sum it up again here...

The steps [MENTION=5436136]NexusRunner[/MENTION] already scouted ahead for us:

And the appropriate build.prop mods inserted into /vendor/build.prop, so it won't be lost during ROM flashes/updates:

I found out that although there is "ro.build.characteristics=default" defined in the GSI /system/build.prop, the one from vendor has a higher priority and overrides it, so jolly for us - we can just dump the above into vendor and stop caring about it, until when we need to update /vendor sometime later in the future.

Thoughts and additional notes:

- General smoothness is good and certainly better than Mi Max 2 (my previous makeshift tablet). The only game I play on tablets runs sh!t on SD625 but runs at normal framerate on SD660, so I'm satisfied in that aspect.

- The rounded corner of our screen is silkscreened on the glass panel, rather than cut on the LCD itself, and as such you will notice that these corners are kinda rough and will "change size" depending on the angle you view the screen at. MIUI has a software overlay of larger radius than the physical rounded corner, so you wouldn't notice, but these GSIs don't come with such overlay by default (since it's universal), which immediately makes the problem noticeable. If you're disturbed by the problem, try any 3rd-party rounded corner overlay app to remedy it.

- One other thing I noticed is that the tablet can no longer automatically sleep/wake on magnetic cover - the Hall sensor implementation likely isn't there in the GSI.

- As for the inaccurate clock on boot, ClockSync handles it perfectly.

Some screenshots below. I'm using a self-built LOS GSI with slightly modified UI but this doesn't make much difference. The 2nd shot is my own Nova+KLWP setup.
[Xiaomi Mi Pad 4 Questions & Answers] rioru:
Is scrolling smoothness the same on custom GSI ? On MIUI it's jittery and croppy everywhere when you scroll with moderate rate. It feels like refresh rate of the screen drops low while scrolling and when you first touch the screen to 'initiate' scrolling. Is there way to display refresh rate (or fps) on screen? It's very irritating to use the device (compared to iPad where scrolling is perfectly smooth).

Is there a magnetic sensor on this device? I installed Device Box to check the sensors and it said there's no magnetic sensor in it.
[Xiaomi Mi Pad 4 Questions & Answers] AndyYan:
Now that you mentioned it, I went ahead to enable and observe GPU profiling curve - it occasionally pops a little above the green line, meaning it's not consistently rendering at 60FPS, but still 50+ FPS and looks great to my eyes.

Magnetic sleep/wake works well under MIUI.
[Xiaomi Mi Pad 4 Questions & Answers] rioru:
How can I view this GPU curve? Is it available in developer settings?
[Xiaomi Mi Pad 4 Questions & Answers] arkansis:
Hi !

I have LTE version. Must wait special LTE version of LOS ?
[Xiaomi Mi Pad 4 Questions & Answers] AndyYan:
You can go ahead and try anyway... GSI are made for phones in the first place, though that "tablet" build.prop mod might kill cellular capabilities with it.
[Xiaomi Mi Pad 4 Questions & Answers] arkansis:
Thanks, I Will try when TWRP and first release of LOS are available to Download.
[Xiaomi Mi Pad 4 Questions & Answers] rioru:
https://youtu.be/FNjiqzZIvyw

Here's what I get when fast scrolling (good performance) and slow-moderate scrolling (bad perfomance), also spikes on touching the touchscreen. This doesnt seem normal. Do you have the same charts?
[Xiaomi Mi Pad 4 Questions & Answers] AndyYan:
Definitely different - here on GSI, fast scrolling is likely to trigger some spikes (likely due to elements loading) but slow scrolling hardly yield a spike. Also, even the highest spike here only goes over the green line for a little bit. I might upload a video tomorrow morning when I'm more awake.

EDIT: Here's the vid. I noticed that using a recorder will put more pressure on the device causing it to lag even more, resulting in a worse curve, so I just used a phone to record it.

[YOUTUBE]hDSQCastwo8[/YOUTUBE]
[Xiaomi Mi Pad 4 Questions & Answers] Thargorsson:
Just bought my mi pad with lte, will arrive next week. Also I found a device tree already on github :D so i could try creating a twrp after the 360 hours of waiting time.
[Xiaomi Mi Pad 4 Questions & Answers] frandavid100:
Hi Andy,

I edited build.prop, but I'm still getting the phone UI. These are the steps I followed:

1. I opened TWRP and connected it to the computer, then I typed "adb pull /vendor/build.prop" on a terminal, but it told me there was no such file. So I typed "adb pull /system/build.prop" instead, and that worked.

2. I used a text editor to add those lines on your quote to the end of build.prop.

3. I typed "adb push build.prop /vendor" and gave it the right permissions by typing "adb shell", "cd vendor" and "chmod 644 build.prop".

However, after restarting the tablet, I'm still getting the phone UI.

Am I doing something wrong? Is there something I need to change?
[Xiaomi Mi Pad 4 Questions & Answers] AndyYan:
You will need to mount /system or /vendor in the TWRP menu before accessing the files. The steps you did only touched the build.prop of TWRP itself, not of the OS.

---------- Post added at 11:27 PM ---------- Previous post was at 11:24 PM ----------

Already mirrored a TWRP (made by a Chinese dev) above - flip back a few pages. Would indeed love to see a "vanilla" TWRP build though, I dislike that dev's decision to change the splash screen and fonts.

Guaiyihu made MoKee available quite early, though since kernel source isn't available yet, it's not much different compared to GSIs.