yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Themes and Apps] Tungstwenty:
Once again I have underestimated you, my friend.

I should have figured out that those frame counts were already after some experimentation :)

About the hook, I was handleLoadPackage for every one and it worked, so it's a "regular" process. After some trial and error I pinpointed "android" as the package we wanted. I've updated my previous post with a new apk that only attaches there and also removed logging to avoid too much growth of /data/xposed/debug.log

I'm also following kamma's changes and hope it's what is missing to get a nice beam.

CM9's latest source (line 2228) does not have that change and is similar to the ICS 4.0.3 sources at https://android.googlesource.com/platform/frameworks/base

I assume therefore that CM9 is exhibiting the same results as our current ones. Can anyone on CM9 confirm that the ON effect doesn't have the same perfection as the OFF effect?

rovo, are you able to compile a version of kamma's changes and test them out on an ASOP ROM to see if it fixes the quality?

Also, can anyone confirm that indeed CM9 does have a different aspect when turning ON when compared to OFF?
[Galaxy S II Themes and Apps] Tungstwenty:
Can you clarify what you mean?

I was still using siyah before, and don't think the kernel is related to this (I could be wrong)
[Galaxy S II Themes and Apps] rovo89:
Ah, yes. This is a special process name when no real name is available. Should be fine (and more specific).

I think there are indeed some changes he did that are necessary for the nice effect, for example drawing white vertices.

I'm using a Stock ROM as well and I'd rather not flash a completely different one. After all, that's why I started developing Xposed. ;) Not sure if this can be done via dual boot. If so and it does not impact my primary ROM or my data, I might try that.

My idea was rather to compile the AOSP libsurfaceflinger.so, save it and compile it again with kamma's changes. Then I can check with objdump (I suppose you are using that too) which code was added or changed and try to add it to the Samsung lib.
[Galaxy S II Themes and Apps] Ba7rani123:
me 2 I dont think it is, but before there was the flicker after applying the fix it still wasnt really like the nexus original CRT off effect, after it turns off u may see a line or sometimes the effect doesnt work.

Now its perfect :)
[Galaxy S II Themes and Apps] The Undertakerr:
Heyy Tungstwenty,

If flashed your libsurfaceflinger.so, installed all kinds of apk's, exposed framework and Tungstwenty Xposed Mods, ticked the crton in it, but still no CRTOn... Am I doing something wrong, I would prefer to try it out without all the apk's that need to be installed...

Thanks in advance!
[Galaxy S II Themes and Apps] Tungstwenty:
Once you see the kind of flexibility this framework gives you instead of recompiling, odexing, etc. for every single source variation, you'll change your mind about the APKs ;)

Checklist for troubleshooting:

On the "Xposed Installer" app, check that version 1.7b2 of both files are active, if not Install/Update

On the Modules tab, make sure Tungswenty... is selected (and Twekbox as well if you like)

In the "Tungstwenty Xposed Mods" app, turn on the CRT effect

In the "Tweakbox" app, if installed, disable the "CRT off effect" just to make sure

Make sure you're using my latest lib and apk, here (I've made a minor change to the .apk yesterday and incremented to 0.2.1)

A reboot is necessary after installation of the Xposed framework and modules, but after that you should be able to toggle CRT-On true/false and get instant results, as described in the option text.

Please try this and let me know how it goes.

Also, something that was detected by JKay:

If you're viewing a youtube movie and turn off, when turning on with the effect active it will hang the screen and reboot after a while.

I think this is due to the hwcomposer.exynos4.so Samsung proprietary driver, and have already asked in the CM9 dev thread if they notice it too. Can anyone with an AOSP ROM on this device let me know if that happens to them too?
[Galaxy S II Themes and Apps] The Undertakerr:
I did exactly as you decribed above, and now it is working!!!

Looks beautiful!

Wel done guys!

Good teamwork between you and Rovo!

I mean no disrespect to Rovo and his great exposed inventure, but still I would like to see this mod without the need to install those apk's...

But really amazing:) CRTON working on Samsung S2 ICS!:)

EDIT:

Yes, I have this also... Phone will hang and reboot when you put on a youtube movie, and turn the screen off with the on/off button.

But not a really big deal as far as I'm concerned...
[Galaxy S II Themes and Apps] rovo89:
Sure, maybe someone wants to translate the Java changes into smali. Then themers can integrate it.

The main advantage of my way is that it will work for many different ROMs and in combination with other modules. Whereas themers need to release X different versions for different base ROMs and combinations of effects (or write a settings app for the latter, but that is more complicated). And even then, the users can only use the combinations that were explicitely created, and if they don't like a feature, they are out of luck. So for me it means some kind of freedom. ;)
[Galaxy S II Themes and Apps] Tungstwenty:
Glad it worked for you.

As for the Xposed, let me tell you this:

Can you imagine all the trouble that JKay has constantly installing ROMs, decompiling, odexing, etc.? Apart from coding all the features, of course. Whenever a correction is needed he surely has to reinstall all ROMs to bundle the new framework, *every single time a change is needed*

The beauty of Xposed is that:

- You install its framework, ONCE

- You find one or more mods, which are written in high-level code and can be very granular in nature and therefore not collide with each other

- You activate the mods you want on the framework app (no rogue hacks just by installing apps that are Xposed mods without you knowing)

- You use the UI of each of the apps to enable its particular features

To give you an example, I am 99% certain that if I install my mod on top of whatever ROM - odexed, deodexed, modded, custom built, etc. - the "Vibrate when Call on Hold" feature will always work without any collisions. The chances of problems are very very slim. And I just wrote and compiled it once, very easily once you followed a small tutorial.

I don't know if you're a dev, but if so I'm sure you'll understand just by taking a look at an example. And the advantages for users are also great, provided all mod producers are careful to touch just the stuff they need and not replace entire layouts, replace methods instead of just adding some stuff to the existing code (whatever it might be), etc.

So I cannot thank rovo enough :)
[Galaxy S II Themes and Apps] Brazooka:
Just to say thanks to both Tungstwenty and Rovo89.

My SII now have a perfect CRT-Off Effect and a very nice CRT-On as well.

Amazing work!
[Galaxy S II Themes and Apps] Tungstwenty:
Finished inserting the additional code in the library so that the CRT-On animation has the same regular colors as CRT-Off.

First post updated with the final library and instructions on how to use it.
[Galaxy S II Themes and Apps] rovo89:
Congrats! :-)

So we have to independently created versions of the CRT on effect now. I also finished my version yesterday, but I was to tired to prepare a new Tweakbox beta and still want to check a few things.

For me, it would be good to compare our approaches etc, I'm sure you had some ideas that I didn't have and vice versa. For example, I wrote a little command-line tool to calculate branching commands for me... worked fine for almost every jump and saved a lot of trying. But in one case, two bits were wrong, although my tool's output seemed to follow the specification. Maybe you can figure out where the error is. I 'll also try the your version to see if they look different.

So far, I think I have implemented all the commands kamma added. It looks much better than without, close to what you can see in his video (white line expanding from mid of the screen). I also noticed that it takes about a second after pressing the power button until the animation starts. Sometimes the effect isn't showing... I'll see if I can tweak that a bit more. Anyway, not as annoying as the flickering we saw before. And if I hit the power button like crazy, turning the screen of and on very fast multiple times in a row, sometimes the phone hangs. This might have also occurred before, I'm not using my phone like that normally. ;-)
[Galaxy S II Themes and Apps] Tungstwenty:
Some comments on the changes I did (here's the diff link you provided earlier, for reference):

I also applied everything from kamma.

Line 2006 doesn't need changes, the outcome in bytecode is the same (checked it on line 1834).

Updated lines 2016 and 2018.

Added the blocks at 2095 and 2129. Without these, the colors were a bit strange when turning on, perhaps on purpose (?)

As for the frame count ...

Unlinke what happens at line 1925, the constructors invoked at 2076 for the 3 colors end up in line 2029 with a hard-coded value of 0.14286, or 1/(8-1).

This means that changing the number of frames at 2075 forces you to change that constant as well. I experimented increasing from 8 to 12 and changed the constant to 1/11 accordingly.

This also implies that line 2093 shouldn't specify a different frame count, since the interpolator is reused at 2099 and it will end up not matching the intended progression.

I've tested with 12 frames and it felt too slow, so I left it at 8 and changed 2093 to 8 also.

It also looks similar to kamma's video, although perhaps a bit faster. I can also increase it if you guys think it's too fast.

About the 1s delay before the animation starts, it's due to the ICS kernels (all have this delay right now, which is slightly bigger than on GB). When the CPU enters deep sleep, it will only wake up 1s after pressing the button.

If you disable the CRT-On effect, you'll notice that the regular lock screen will also show up only after 1s; with the effect it's after waking up that the animation begins.

Also, if you don't wait too much (but also not too fast, dunno why), the ON animation will start immediately since the cpu hasn't shut down yet. You might also get lucky and even with an idle phone for some time, press Power on the exact moment that it's running something in the background and therefore have an instant reaction.
[Galaxy S II Themes and Apps] rovo89:
I did the same things... :)

I thought it would be something like this.. I have currently set 12/12 frames. This mainly seems to have the effect that I can see the white bar a little bit longer.. does not look to bad. But I will also check how it looks with more frames when done correctly.

Very likely, this will not happen today though. I cannot spend every evening and night hacking Android. ;)
[Galaxy S II Themes and Apps] failax:
I've made all these steps but not CRT-ON effect unfortunately.CRT-OFF is perfect.
[Galaxy S II Themes and Apps] Tungstwenty:
Do you have version 0.2.1 of my APK?

Can you double check that your /system/lib/libsurfaceflinger.so is the one currently posted on the first post?
[Galaxy S II Themes and Apps] failax:
Yes all downloaded one hour ago.
[Galaxy S II Themes and Apps] ElDiablo77:
Hi just wondered if anyone could help out with a query.

I just need to know if this would work on the SGS II running the latest MIUI ROM?
[Galaxy S II Themes and Apps] rovo89:
The Java part will probably work when you are using Xposed and the module for it.

The library might work or might not work. If you know how you can restore a file via adb or so (without access to the UI), you can try to make a backup of your /system/lib/libsurfaceflinger.so and replace it by Tungstwenty's file. But only do this if you feel safe using the command line to replace files!
[Galaxy S II Themes and Apps] ElDiablo77:
Thanks, I can use the command line in windows no problem but never set adb up before and it worked. I will try and get used to it as I want to start getting more of an understanding.
[Galaxy S II Themes and Apps] rovo89:
After lots of debugging and trying, I have finally fixed the remaining issues. Attached are the new library and new betas of Xposed and my Tweakbox. I will integrate the on-the-fly patching option again, but for now you have to upload the library manually.

Summary:

- CRT off and on are working reliably now (show when they should and without flickering)

- on effect looks very similar to off effect, just reversed and a bit faster (could make it slower, but it happens that I actually wanna use my phone and not just look at the effects)

- Working also when the lockscreen or face unlock is active

- Not crashing when turning off and on during Youtube playback

- Options to enable/disable CRT off/on individually
[Galaxy S II Themes and Apps] celeritykid:
im using the latest miui, the libsurfaceflinger.so is working properly. by using the xposed framework and the tweakbox attached, i will have both CRT screen on/off. however i couldnt apply miui theme anymore if i use the xposed framework. any idea on just putting the crt on/off without using the xposed framework? its ok if cant
[Galaxy S II Themes and Apps] rovo89:
I just had a quick look at the way the themes work. Miui has a very similar approach to replacing resources: They have their own subclass of android.content.res.Resources, which checks whether the theme contains resources to override the default ones. Xposed does the same, but dynamically. As it replaces the instance of the Resources class a bit later, it wins the race.

I could imagine to add a switch to Xposed to disable the resource replacing routines. Then you can decide which "engine" you want to use - both together would be very complicated to implement. In general, it would be great if such themes could be used with Xposed as well. I'm not sure if everything can be made compatible, but for things like graphics, texts, colors and some other things, we would just need an Xposed module that can understand the Miui theme files and calls some functions in Xposed to override the resources according. The good thing is that there seem to be many themes already. And that such a module would make them available to all ICS roms.

For now.. I think you have to decide which mod brings you closer to your perfect phone, sorry.
[Galaxy S II Themes and Apps] Tungstwenty:
I will update the first post with the final library that rovo89 prepared, and state there that you have 2 options to use this:

Either use his Tweakbox mod, which includes CRT among other things

Ask your ROM / Themer / etc. to integrate the fixed CRT code in his distribution
[Galaxy S II Themes and Apps] jbiton:
Thanks for your work,

but sometimes 1 in 10 times the CRT-OFF doesn't work while screen goes off, I know your fix has nothing to do with that issue, but does anyone have a clue about that?

BTW, your CRT-ON is awesome :-)

Sent from my GT-I9100
[Galaxy S II Themes and Apps] Tungstwenty:
There are at least 2 situations where the animation is not used when turning off, and it's the standard behavior:

When the screen turns off due to the proximity sensor (e.g. when in a call, if you put it near your head or some obstacle

When pressing power during the playback of video, or some other similar situations.

Apart from these, there might be others and unless there is some crash, it shouldn't need any further correction.

I have now updated the 1st post with the final version and instructions for use.

Please refer to it, thanks.
[Galaxy S II Themes and Apps] jbiton:
Thanks man for the update, I got the following to say,

1) Now I never miss CRT on-off, thanks man.

2) CRT-ON is working more perfect, thanks man.

3) CRT-OFF sometimes still draws in un smooth way.

Sent from my GT-I9100
[Galaxy S II Themes and Apps] Ba7rani123:
try siyah kernel but NOT 2.3.8 ;), try 2.3.6.X its alot smoother :)
[Galaxy S II Themes and Apps] rovo89:
Ehrm... Siyah Kernels for ICS have version numbers 3.xxx.

What do you mean with "unsmooth"? Tungstwenty named two situations where it doesn't show on purpose. Otherwise, it is working fine for me.
[Galaxy S II Themes and Apps] jbiton:
sometimes it works perfect as I used to see it on my previous Galaxy S, and sometimes it has a quicker speed when the vertical compression begins, and ends by taking full width line at the middle of the screen (end of the vertical compression), and the line looks distorted.

Sent from my GT-I9100
[Galaxy S II Themes and Apps] StevenBX:
Is there any video available of the CRT On effect?
[Galaxy S II Themes and Apps] rovo89:
Ok.. I can't remember having seen that on my phone, sorry.

Yes, it looks similar to the one in this thread: http://xdaforums.com/showthread.php?t=1490127. It is just a little bit faster because we found that a long screen-on animation can be annoying after some time, especially if you just want to have a quick look at the time or so.

@others: I clicked "thanks" instead of "quote" by mistake, so please don't be annoyed if you didn't get a "thanks" for your question. ;)
[Galaxy S II Themes and Apps] jbiton:
Guys,

Finally I knew what was making the crt-off horrible even after the fix, it was the dark wallpaper ( too much Black), when I moved to lighter ones (more white), it works perfectly now.

Sent from my GT-I9100
[Galaxy S II Themes and Apps] DanDroidian:
I'm getting a "parsing error" when i try to install either xposed apk. Solution?
[Galaxy S II Themes and Apps] rovo89:
Make sure that the files were downloaded correctly. They should be 63/235 kB big.
[Galaxy S II Themes and Apps] eybee1970:
I just wanted to inform you 2 guys (rovo89 and Tungstwenty), that your mods are working perfectly on Galaxy Note ICS! Just CRT On not working....but all the others PERFECTLY including libsurfaceflinger.so (which i know is not made for Note but found no negative side effects on 2 days testing now) for great CRT Off!!!

thx a lot guys, really fantastic work!! I spent all my 8 thanks on you :)
[Galaxy S II Themes and Apps] DanDroidian:
Thanks, but they are both the appropriate size. Any other possible reason(s) for a parsing error?
[Galaxy S II Themes and Apps] The Undertakerr:
Maybe because you are trying to install them on Gingerbread??

That would give you a parsing error...
[Galaxy S II Themes and Apps] Tungstwenty:
From the previous posts of @DanDroidian it seems he's using an I9100T. However, the forum mentions that any stock ROM for 9100 can be used on 9100T as well, so I'm not sure whether that's related :confused:
[Galaxy S II Themes and Apps] rovo89:
And he had the same problem with swype, so it seems to be a more general problem, not necessarily related to these apps. I obviously couldn't test Xposed on other devices, but it has been reported to be working on the Galaxy Tab. I haven't heard about I9100T though.

One last idea: Have you allowed installing software from unknown (non-market) sources?
[Galaxy S II Themes and Apps] jbiton:
Do u recommend a specific kernel or a particular animation scale settings?

Sent from my GT-I9100
[Galaxy S II Themes and Apps] Ba7rani123:
Siyah kernel v3.3.1, it really fixed that issue for me :D check it out
[Galaxy S II Themes and Apps] jbiton:
Thanks man, yeah it is better, at least it settled its shape.

And many Thanks for Rovo89 and Tungstwenty, at least they moved us very near to the Proper CRT-OFF animation.

Sent from my GT-I9100
[Galaxy S II Themes and Apps] Ba7rani123:
Anytime :D, not just very near :p its exactly the same :eek: if u use siyah kernel :D
[Galaxy S II Themes and Apps] DanDroidian:
Well, i just read these replies and decided to try again... Worked perfectly! Both installed without any problems (the installer and the tweek

box).

From everything I've read, i will never notice any difference with the "T" version, except that flashing A "T" Modem afterwards will provide better reception on certain networks, which suggests there's A slight difference in the hardware....

Thanks again!
[Galaxy S II Themes and Apps] The Undertakerr:
Heyy Tungstwenty & Rovo,

I have a littlebit strange question.

Probably this is not possible.

And probably you guys don't think it's worth the effort to look into this...

But maybe it could be a new challenge to you guys!

And for sure you would make some people very happy with it, including me...

Ok, here it comes:

I'm back to Gingerbread right now, I've got my reasons...

As you probably know the CRT OFF on Gingerbread for the S2 was not very good also, the same problem as on ICS...

Could you maybe fix it on Gingerbread as well?:-)

I would be very happy with it.

Now the second part of the question:

We also had the fancy ICS Rotation on Gingerbread. But with that libsurfaceflinger.so flashed, the CRT Off would become really, really bad.

So I was thinking... If you could do your "Ctr Off fix magic" on that one, We would have perfect Ctroff AND the ICS fancy rotation on Gingerbread...

The libsurfaceflinger.so with the fancy ICS rotation and more info can be found in this post: http://xdaforums.com/showthread.php?t=1362354

Would be awsome!!!:D
[Galaxy S II Themes and Apps] Tungstwenty:
Well, I'll really need to leave this to rovo to check if it's doable and he has the time for it :D

I'm quite busy atm to spend the very little time I have left on GB (or even ICS native libs really :rolleyes:) so let's see what is rovo's position on this
[Galaxy S II Themes and Apps] rovo89:
I don't plan that. First because it would probably much work, second because it is almost impossible to do if I'm not on the same ROM (and I will never go back to GB again).

As mentioned, I will not do it for GB. Looking at the video, the animation is quite similar to the one I see on my ICS phone.. or is there a major difference worth porting?
[Galaxy S II Themes and Apps] The Undertakerr:
Ok.

Hoped you would be willing to port the CRToff fix to Gingerbread also...

The fancy ICS rotation won't add nothing to an ICS Rom.

But the fancy rotation mod is located is the same lib as your CRToff fix.

So if the ctroff could be fixed in that libsurfaceflinger.so, many Gingerbread users would double profit from it...
[Galaxy S II Themes and Apps] sphinx02:
Hello,

on the Galaxy S3 afaik till now there is no working crt-off effect. I think it's the same problematic than here, so do you think about doing these modifications for the s3 also?

Or is there anywhere a good how-to/tutorial what have to be changed in the lib files to get the crt-off enabled?

Kind regards..
[Galaxy S II Themes and Apps] rovo89:
The CRT-off effect on SGS2 (and I think most other phones with ICS) consists of two parts:

a) the native library (libsurfaceflinger.so) that contains the actual implementation of the effect

b) the Java part which triggers the effect

Step b) is described for example here: http://xdaforums.com/showthread.php?t=1599379 (the same is done by Tweakbox during runtime). But I cannot exclude that something is different in the Java part as well. After all, you are saying that CRT off doesn't work at all. In SGS2, it worked after the Java changes, although there was some flickering.

But of course, the problem can also be in the native library. This might be easy to resolve if the libs are compatible between SGS2 and 3. You can easily try this by copying the library attached to the first post to /system/lib, but make sure you have a recent nandroid backup just in case (or know how you can restore the original library via ADB). If this library works, then we know that the more complex part is working and that the difference has to be in the Java part.

If it doesn't work... well, I don't have an SGS3 and patching the library required lots of testing, restoring the library, testing again etc. I can share what I have changed, but that's at least 10 different places, sometimes just changing one command, sometimes adding more code. This cannot simply be copied to a new library, it needs to be done again by someone who knows assembler and some tools like objdump. Maybe you can attach the SGS3 library so we/I can have a look, but as I wrote, patching it blindly is very, very hard to do.