yashsingh1/xdaforums huggingface dataset:
[Miscellaneous Android Development] FoxBob79:
Nice, but wrong device ;)

[MENTION=507649]devs[/MENTION] A other idea is to uncomment/delete the setting in: drivers/base/power/wakeup.c line 23+24. The "msm_hsic_ws" was well known for causing batterie drain...
[Miscellaneous Android Development] mlara.particular:
So, thats it? We are stuck with a crappy phone, with a hardware failure on battery drain? Pretty sure Vernee is not going to do anything about it, and they allready know. We should have invested our money in a better phone :o. But maybe team M.A.D. will give us a surprise at the end???
[Miscellaneous Android Development] RalphMalph:
I don't think it is a crappy phone. Yes there are better ones, also for same amount of money.

But there are also alot of crappier phones, even for more money.

The battery-drain is strange, but only there with 7.1.1. It is probably something real small and easy to overlook. I have really faith that it will be solved one day.
[Miscellaneous Android Development] BlueFlame4:
We're on it but our days have also only 24 hours :D
[Miscellaneous Android Development] nature boy:
Is there anything us users can do?

Are there scenarios we could run to find out the bug(s) or exclude parts of the system?
[Miscellaneous Android Development] Zorikage:
Maybe developers can do a fix build for some of the bugs reported, without any battery fix.. and for the third time: is there any way to get Vulkan API?
[Miscellaneous Android Development] RalphMalph:
I asked that also, hopefully we will see a new build soon.

Vulkan support should be supported in Android 7.x AND in our x20. But don't know if it is implemented in the MAD-rom or in the official 7.x that is still to come.
[Miscellaneous Android Development] Zorikage:
Well M.A.D. rom for this device is not so bad at all, the performance is really good.. but if the official 7.0 nougat from Vernee gonna have better battery stat and the Vulkan API driver i'm going to give it a try for my other device and with my main apollo lite device i'm going to wait some new builds and implements from M.a.d. and his big work.

Hope battery problem is not going to stop M.A.D. for working on new features or fixing issues.. (i just love Vulkan graphics :P)

Edit: I've talk with the owner of Vernee and he tell me that only official release of 7.x going to have Vulkan Api.

So 100% vernee official release have Vulkan.

But what about unofficial release like this ROM? is it possible for the developers?
[Miscellaneous Android Development] fards:
Can you get vernee to release the source again for 7 when the release it?
[Miscellaneous Android Development] Zorikage:
When they officially release it, i can ask them if they can release the source code like the 6.x stock version..
[Miscellaneous Android Development] DerTeufel1980:
Yes, official Android 7 is going to have Vulkan support. We just need to wait till December.
[Miscellaneous Android Development] Zorikage:
I don't think so, it's the new year for chinese people and they are in holidays until 2 february, i think the official Nougat of vernee come out before April.. so is there any chance to put Vulkan API on this ROM or is that impossible? (or wait the source code for the vernee build?)
[Miscellaneous Android Development] DerTeufel1980:
Sorry, I had been sarcastic.

Vernee is like all Chinese companies... If you don't speak to the software developer (if there is one) in Chinese language (because those always do not speak English), people do not know what you are talking about.

They just give some random answers.

Till now, I did not speak to someone at vernee, who knows what a kernel is (it's the same for jiayu, oukitel, ulefone, uhans).

Having vulkan support is not default for mtk, but vendors can pay much more money to get it. I personally don't know any vendor who actually paid for it... Hence I say, that it won't get vulkan support.

I also could pretend we have vulkan support. There's no easy way to test it
[Miscellaneous Android Development] gpablo1:
Thank you so much for the awesome work. One question. Is the source of this ROM on the github website? I would like to take a look to see if I can contribute something in solving the problem with the battery.
[Miscellaneous Android Development] Zorikage:
I'm sorry for not getting your sarcastic then,

Thank you for getting away my doubt about it.. i think now is all about time, i trust Vernee (even if they lie about nougat release on December).

Thank you again.

Edit: if there is any way to help you all developer, users are always here :)
[Miscellaneous Android Development] NamelessXXV:
good

anyone release android 7.2 nougat, please?
[Miscellaneous Android Development] :
You could release it and share with the rest. :good:

Let us know when you're done. :highfive:
[Miscellaneous Android Development] cakemaker:
Hey all. If this works on Snapdragon, what kind of chance has it to work with a G9300 from China?
[Miscellaneous Android Development] RalphMalph:
I think it is almost guaranteed.....
[Miscellaneous Android Development] superdragonpt:
Google.source.com

(...)

Device kernel, device, vendor are on mad github...

Sure, I like nougat 7.3 even more...

Absolutely, our ROM works on all devices

(?)

^this

Ontopic: just to let you know, we didn't quit...

We are building other "flavours" ;)

Cheers
[Miscellaneous Android Development] gpablo1:
Thanks for your reply. On mad github I can only see these sources:

android_kernel_ulefone_metal

android_device_jiayu_s3_h560

android_vendor_jiayu_s3_h560

android_kernel_jiayu_s3_h560

android_device_ulefone_metal

android_kernel_jiayu_s3plus_n560a

android_kernel_vernee_apollo_lite

android_vendor_ulefone_metal

android_kernel_vernee_thor_k506

android_vendor_vernee_thor_k506

android_device_vernee_thor_k506

android_device_jiayu_s3plus_n560a

android_vendor_mad

android_vendor_jiayu_s3plus_n560a

android_vendor_elephone_vowney_lite

android_device_elephone_vowney_lite

android_device_doogee_x5

android_vendor_doogee_x5

For vernee apollo lite theres is a source: android_kernel_vernee_apollo_lite

I can't see the source for vendor and device. Are they hidden from some users? Are you using the source of another device like thor or jiayu?
[Miscellaneous Android Development] superdragonpt:
Deep Sleep Fixed

Baby Sleeps

zZZZZZZZZZZZZZ

woohooo

now ... we need to fix other things that are somehow related ......

;)

This was like 10minutes ago ... just passing by and sharing my joy

..........

was about to burn the damn phone
[Miscellaneous Android Development] reebomber:
\m/ \m/
[Miscellaneous Android Development] No1VIPER:
Great work [emoji16]
[Miscellaneous Android Development] Huncriter:
you rock man, keep going!!!:fingers-crossed:
[Miscellaneous Android Development] Zorikage:
I'm literally crying damn! Thank you all so much!
[Miscellaneous Android Development] FoxBob79:
That sounds totally awsome!! Thanks for all the work to get this bug solved!!
[Miscellaneous Android Development] superdragonpt:
ok everything is running fine ...

just to be sure,,, we'll be testing this even better ...

A brief explanation:

It's 100% MediaTek "fault" ... like always they messed things up with their s&%$#

( insert bad word here ) services and hals ...While this things works for them .... on their own build system ...

it completely messes things up when your building an Aosp / lineage / whatever 3rd party rom source ...

And no, like said, nothing to do with kernel ... or wakelocks, or whatever ...

.Need to sleep ...

.bb
[Miscellaneous Android Development] RalphMalph:
Great to hear. You are awesome. The whole team ofcourse.

Was it something really small and easy to overlook?
[Miscellaneous Android Development] mightymaki:
Fantastic stuff! Just bought you a coffee/beer/rest :good:
[Miscellaneous Android Development] DerTeufel1980:
It's been something totally stupid, which does not make any sense at all...
[Miscellaneous Android Development] fLaSk1n:
In which world things have to make sense?! x)

Just because I'm a bit interested:

Can you give more detail about the exact reason / service which and why kept the phone awake?

Great work Team M.A.D.
[Miscellaneous Android Development] DerTeufel1980:
Haha. No one knows.

As said, there's no sense in it.

The fix is (basically, because the binary does nothing else), to open a device node for reading.

Nothing needs to be done with the read data.... It just needs to be read --> no sense.

I guess [MENTION=5238428]superdragonpt[/MENTION] is going to reveal more details when he gets up
[Miscellaneous Android Development] fLaSk1n:
Aha.

Sounds really useless - reading if there's no need for...

So I basically expect some functionality in mediatek builds, but who knows..

Okay, just will wait if there are more details on it.

Great finding also for other developers and theire roms - you now prefixed / found something for theire switch to nougat. :)
[Miscellaneous Android Development] RalphMalph:
Indeed sounds really stupid and making no sense. Can be a feature of Google :p

[Silly-mode]

Will this fix also work on a Nokia dual sim?

[/Silly-mode]
[Miscellaneous Android Development] gbl08ma:
First of all, congratulations!

This is all really interesting and has got my inner low-level nerd going on.

Does this need to be done on all MT6797 devices, or only on the Apollo Lite? (or do you have no idea, I think this is the first MT6797 you're working on?)

You say it makes no sense... well, it has to make some sense, because it works and that's what MTK is doing. Now, why would Mediatek add an extension to the "official"/"normal" power states system that requires interaction with a device node? My wild guess is that it is mapped to some internal SoC part, perhaps just a register or two, and reading it (or just opening it for reading?) signals to the power management system that the SoC can enter deep sleep mode. But why? Why did they need to make things like this, isn't the "standard way" good enough? WTF... The thing is, my "wild guess" probably isn't it, because it makes too much sense... it is probably something stupider, perhaps simpler. I'm now going to see if I can find the corresponding code in the Vernee source drop, to satisfy my curiosity...
[Miscellaneous Android Development] FoxBob79:
And that is the point why I love the xda forum and all the "nerds" that are here!! :D Your curiosity is the same like my curiosity. And being here and read this make me feels like I am not totally alone with this curiosity and "nerdy-things" in my head...

And yes, i can hardly wait to install the new rom and start searching to find things that make the next rom a bit more better!! Your are all AMAZING!!
[Miscellaneous Android Development] DerTeufel1980:
It's because it's mtk... And it doesn't make sense.

To sum this. Mtk added a service to ramdisk, which executes a binary, which is just opening the device node for reading.

They also added a function to kernel, which is checking if the mentioned path gets opened.

If it does, the kernel loads some firmware, which is responsible for sleep.

Sounds logical? No!

We have added a function to kernel now, when screen turns off the first time, load the firmware...

Sounds more logical, right?

This way, there's no need for ramdisk changes, no need for selinux changes, no need for an extra binary...

I don't know what kind of drugs 'coders' of mediatek are taking... But they should stop it
[Miscellaneous Android Development] nature boy:
Bizarre indeed.

Is this new to 6797?
[Miscellaneous Android Development] DerTeufel1980:
Yes. Other (older) platforms don't have this
[Miscellaneous Android Development] RalphMalph:
Now that this is fixed, i am almost sure we will have a new build soon. Many people are asking to fix the battery-drain because of the lifetime of the battery. And a lot of other bugs were already known and if i am correct also checked and fixed.

If it takes some time.....Is a fix for the current build possible?
[Miscellaneous Android Development] DerTeufel1980:
Install terminal emulator and do:

cat /dev/spm

Maybe needs root. Device should be going into deep sleep afterwards
[Miscellaneous Android Development] fLaSk1n:
Really? That's all to do?

And doing the command does permanently "fix" the not-deep-sleeping,

Or do we have repeat that procedure say: after reboot?
[Miscellaneous Android Development] ernestorw:
Root needed

Thank you. This script wants root.

It's to early to report the success.
[Miscellaneous Android Development] RalphMalph:
Thankx

But its no excuse to delay the new build he :silly:
[Miscellaneous Android Development] DerTeufel1980:
Needs to be done after each boot
[Miscellaneous Android Development] mlara.particular:
Works only on NOUEGAT or also Marshmallow?
[Miscellaneous Android Development] superdragonpt:
That's just an temp workaround.

and will not take care of everything else...

im testing other new things...

bb
[Miscellaneous Android Development] kisger13:
It does not work for me. :confused:

[IMG="1"]https://xdaforums.com/attachment.php?attachmentid=4029220&stc=1&d=1486230678[/IMG]

[IMG="2"]https://xdaforums.com/attachment.php?attachmentid=4029221&stc=1&d=1486230678[/IMG]

Edit: Sorry, after restart and redo the command it works! :D:fingers-crossed:
[Miscellaneous Android Development] RalphMalph:
I was just joking... I know you are busy (and that work is in progress)
[Miscellaneous Android Development] lymbra:
Thanks a lot! Great work!

And it works for me! (rooted phone)
[Miscellaneous Android Development] genesisalgor:
You can create a script with that command and add init.d to load it after every reboot...
[Miscellaneous Android Development] gbl08ma:
OK, it's not to mess with memory-mapped registers but it's to load firmware... acceptable but the real WTF here is IMO:

a) why did they make the ability to enter deep sleep conditional (as opposed to just letting the kernel/Android/whatever decide when to sleep and not). In other words, why aren't they just loading the firmware on boot, like you are more or less doing now?

b) Why make the condition depend on the ramdisk? The only reason I can imagine is to make sure the device doesn't go into deep sleep if it is in recovery or one of those special modes added by Mediatek (like "factory", or the half-booted state where the battery animation shows, etc.).

Why wait for screen turn off instead of just loading the firmware on boot?

I'll try to get my hands on that firmware now, even if only to realize it's using some unknown instruction set and has no strings...

---

So today I spent a hour or so looking at the Vernee source drop, which I had cloned a while ago but never looked much into, besides checking that it compiled. Basically all I did was roam through random folders (and MTK added so, so much s***...), but that was enough to find interesting things like vendor/mediatek/proprietary/hardware/perfservice/mt6797/app_list/perfservapplist.txt, where the "performance service" (another MTK invention) can be configured to do certain things to certain apps, making (among other things) benchmark cheating as easy as editing a text file. There's also vendor/mediatek/proprietary/external/wechatproxy/ which I really hope wasn't added with the intention of bugging wechat, etc. For the sake of security, I really don't want to go back to a ROM with the "Mediatek framework", even if that means losing useful features like sounding alarms when off... their (unaudited, and probably unmaintained) code base is just too big, you can basically forget any notion of security. Guess why there are no flagships with their chips...

---

For those curious, but too lazy to grep, their wonderful "spm_loader" is at vendor/mediatek/proprietary/hardware/spm/spm_loader/

It loops up to 20 times until it can open /dev/spm, then reads one byte off it into a four byte buffer, closes the file... does absolutely nothing with the buffer, and the status code from the read syscall is the exit code of the program. Summing up, this program reads one byte from a character device, exits... and they call this a "loader". After looking at this, I agree that the MTK headquarters must be really high.

There are some bin files at vendor/mediatek/proprietary/hardware/spm/mt6797/, and a spm_script.sh that does nothing but "cat /sys/kernel/debug/spm/firmware"...
[Miscellaneous Android Development] superdragonpt:
you need to do it on every reboot

this will be taken care on next build, its handled differently now

plus other things , that have some co-relations
[Miscellaneous Android Development] No1VIPER:
Would it be possible to get a patch for the current build? Or is the new one coming soon?
[Miscellaneous Android Development] kisger13:
Thanks.

No, I mean, my phone was running a couple of days, I do the command and not works.When I restart and do the command immediately after restart and it works. I do not know if this matters maybe, just let you know.
[Miscellaneous Android Development] superdragonpt:
no patch
[Miscellaneous Android Development] lymbra:
btw. does anyone know an app to configure soft keys?

on my previous smartphone i had the option to confige long clicks on those keys.

f.e. pressing back key long kills the open app.
[Miscellaneous Android Development] FoxBob79:
Is this the new sustained performance mode?
[Miscellaneous Android Development] gbl08ma:
No. SPM stands for System Power Manager, as can be seen on kernel/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt.
[Miscellaneous Android Development] FoxBob79:
THANKS!! That makes sense... :) I was wondering why an API should be in /dev folder?!?!
[Miscellaneous Android Development] gbl08ma:
It's the Unix way of doing things: everything is a file.

On Linux, files that control hardware usually go on /dev, eventually abstracted in /sys. Files pertaining to the state of the OS and its processes go on /proc.

/sys (sysfs) is a more recent invention and fixes a number of problems with /proc (procfs) and /dev, streamlining the way the device tree, kernel modules, etc. are exposed. Which is why to control LEDs for example, the files to mess with have very similar paths across devices - unless manufacturers like Mediatek mess with things and decide the standard place for stuff isn't good enough for them, and break the standardization. Which gives an idea as to why, licensing issues aside, getting these drivers into mainline Linux is often so hard. (then there's also the wonderful code style, etc.)

BTW: my phone already slept one minute and six seconds in the past two hours, which for this ROM is amazing. There are certainly other factors at play, like these apps I'm seeing with almost a million wakeups... but at least it can now enter deep sleep.
[Miscellaneous Android Development] FoxBob79:
And thats why I love Linux for years... :D
[Miscellaneous Android Development] Zorikage:
Mh that command is not working for me even after restart, i'm doing something wrong?

Or it should be supposed that the terminal emulator doesn't give any word when we do the command?

(i do su command, after that i press ok and put cat /dev/spm but after that nothing happens)
[Miscellaneous Android Development] lymbra:
thats fine, it doesnt give u any response.

get WLD from app store and check deep sleep counter

(after opening, click on statistics and on the upper status bar to get an overview. the bar itself already tells you, how long it is active)
[Miscellaneous Android Development] Zorikage:
Thank you, i see difference now..

But i have another problem that i had in STOCK rom too:

The battery drops 2% sometimes and sometimes normally 1%

Like the battery is on 72% it drops 70% without 71% then it drops normally 69%.

Is this normal?
[Miscellaneous Android Development] stefg:
It's a nice day today! Thank you M.A.D. Team for your work! I guess you'll always remember Apollo Lite for that stupid bug. :D
[Miscellaneous Android Development] RalphMalph:
Since battery-drain is fixed, let's see what the current bugs from MAD's 7.1.1 are? Or what we wish to add/change.

- original flip-cover not working. When opening, the screen unlocks but comes with the shutdown/reboot-menu

- night light not working when screen is off

- no sound when headphone connected to usb-c connection

- camera quality can always be better, but is already much better than stockrom

- cpu governor (processor) cannot be changed

- Google security patch January and probably February

- wifi band frequency settings makes no difference, only 5ghz shows also 2.4ghz and can connect to 2.4ghz

Anyone else more?
[Miscellaneous Android Development] reebomber:
Power on lag? Or might that be solved with the deep sleep thing?
[Miscellaneous Android Development] kisger13:
Wow, now the deep sleep working fine! Thanks. ;)

But the battery consumption is still double then stock rom. On stock rom was 4-6% / night, here was 12% / night, so there's still something that needs to be optimize. This is not a complaint, just for your information. Anyway now much much better then was before, keep up good work. :highfive:

[IMG="1"]https://xdaforums.com/attachment.php?attachmentid=4029939&stc=1&d=1486289012[/IMG]

[IMG="2"]https://xdaforums.com/attachment.php?attachmentid=4029940&stc=1&d=1486289012[/IMG]
[Miscellaneous Android Development] gbl08ma:
After disabling WiFi and mobile data (but not turning on airplane mode, after all, it's a phone), it finally slept for some hours.

XDA attachments appear to be broken for me, once again...

http://s.lowendshare.com/1/1486297093.851.Sketch.png

http://s.lowendshare.com/1/1486297113.736.Screenshot_20170205-121638.png

So I'm seeing the 4-6%/night figure, but that's with WiFi off...
[Miscellaneous Android Development] reebomber:
Just installed SU and did the cat workaround and it appears power on no longer has a lag AND fingerprint lock is working flawlessly and fast, for the first time!!
[Miscellaneous Android Development] lymbra:
you slept long ;)

which app did you use?
[Miscellaneous Android Development] gbl08ma:
The screenshot is from Wakelock Detector, if that's what you're asking.
[Miscellaneous Android Development] kisger13:
My wifi and mobile data are always on, I don't want to care, the phone should manage, sorry I'm too lazy to take care to switch it on /off. I think that a smartphone should manage in 2017.

I used the stock rom with the same settings before.

I use greenify with shallow hibernate and aggressive doze, I do not know if it matter, I just let you know.
[Miscellaneous Android Development] Zorikage:
Deepsleep is indeed working 'better'

10% in 10 hours without touching the device.

I repeat my problem: when i use my phone it goes down very very very fast, and sometimes it drops 2% and not normally 1%. This was on the STOCK too, it happen in my other apollo lite too! Is this software related or something?
[Miscellaneous Android Development] ProfePaco:
Try using a standard charger. When I use it battery drops in 1% steps
[Miscellaneous Android Development] Zorikage:
You're saying the quick-charge is causing the "crazy" drop that is happening on my device?

I never used a standard charger (i don't have any), but if i buy one it should fix my problem and my phone will last more when screen-on?

If charging is the problem, everyone with the stock charger should have this problem!
[Miscellaneous Android Development] asusm930:
I'm trying out this deep sleep fix on my redmi note 4 (helio x20) for fun to see if it improves performance. Good job by the devs here
[Miscellaneous Android Development] kisger13:
I found a bug. Sometimes (not always) Gmail application not wake up the device and not giving the notification. But in this case when I unlock the screen it gives the notification in the next second. And this is not related to the deepsleep because it happened before too.
[Miscellaneous Android Development] wiz.wiz:
Hi,

just installed and testing this ROM.

I couldn't find where the 'privacy' settings are, are they available ?

Edit:

Same question for battery in status bar

also to customise the number of tiles in the QS ?

Thanks
[Miscellaneous Android Development] ProfePaco:
Try filling a bottle with low pressure and high pressure water. When you fill with low pressure you can fill more the bottle.
[Miscellaneous Android Development] Zorikage:
Thank you senpai, i will test it xD