31/01/2017

31/01/2017

Xposed Framework para Android Nougat: Actualização


O Android é conhecido por permitir um sem número de configurações que possibilitam ao utilizador ter um smartphone ou tablet mais à sua imagem. A Xposed Framework é desde há vários anos uma das forma que os utilizadores têm para conseguir este fim.

Com a Xposed Framework é possível aceder a determinados parâmetros de configuração que de outra forma ficariam indisponíveis. É possível modificar a interface do Android, configurar as permissões das aplicações, consumo de bateria, ou por exemplo ter o Youtube a correr em fundo. Os módulos que permitem este tipo de funcionalidades acabaram por ter tanto sucesso que mais tarde vieram a dar origem a funcionalidades semelhantes no próprio Android.

A cada nova versão desde sistema operativo, há sempre que aguardar pacientemente que Rovo89, o developer responsável pelo desenvolvimento da Xposed Framework consiga implementar as modificações necessárias para que esta seja compatível com o novo Android.

Este é um trabalho moroso, que obriga a muitas horas de investigação, pelo que se torna impossível prever quando é que estará disponível. Para acalmar as hostes, o developer publicou um ponto de situação sobre os trabalhos que estão a decorrer, o qual reproduzimos em baixo.

It seems that more and more people get nervous about whether (and when) there will be Xposed for Nougat or not, so I felt I should say something.

Why does it take that long? Because with every release, I try to ensure that Xposed integrates nicely with the improvements in the new ART version. The step from Lollipop to Marshmallow wasn't huge. It was an evolution, some things even made it possible to integrate Xposed in a more elegant way. On the whole, it was mainly careful porting than rather innovating.

With Nougat, something fundamental has changed. If you're using Nougat already, you'll have noticed that installations are much faster now. That's because APKs aren't compiled immediately (AOT), but start in (slower) interpreting mode. Sounds bad, but they have enabled JIT, which will quickly compile those methods that are used very often. That will restore the well-known and constantly improving performance of native code. Besides that, ART keeps a list of these frequently used methods ("profiling"). When the device is idle, it finally does the AOT compilation, but based on the profiling data. After that, you get the great performance right after starting the app. JIT is still waiting in case the usage patterns change, and I think it will also adjust the profile and improve the AOT compilation.

That results in various different compilation states and more complexity. Besides that, there were many issues in the past caused by Xposed's need to recompile the whole ROM and all apps: It sometimes caused boot loops when the odex files were too heavily pre-optimized, it blocked quite some storage space to store the recompiled files, and I needed to disable some optimizations like inlining and direct pointer calls. I hope that I can make use of the JIT compiler to avoid that in Nougat. If Xposed knew from where a method is called, it could invalidate the callers' compiled code, so that they would temporarily use the interpreter. If they're important enough, JIT will recompile them.

I have already done a lot of research and experiments for this and I'm currently trying to implement this. But as you can imagine, all of that is much effort and can easily take hundreds of hours. That's net (working) time, not real time. If I worked on Xposed 24 hours a day, that might be done within a week or two. But, in the last year or so, my "time for Xposed stuff" was about 5 hours a week, sometimes more and sometimes less. You can do the math yourselves... There are just so many other (non-technical) things that I need or want to do. If you substract the time it took me to build the new installer version, move the repo to a new server and restore compatibility with the Nov 2016 security patches, that's even less time for new stuff.

So yes, I'm still working on Nougat support, whenever my free time allows it, but I don't have any idea when it will be done. Once it's done, you'll know. 

0 comments:

Enviar um comentário