yashsingh1/xdaforums huggingface dataset:
[Galaxy S III Android Development] Tungstwenty:
Can you open the Xposed Installer app and post a screenshot of each of the 3 tabs? "Framework", "Modules" and "Libraries" (in this last one, scroll to the bottom to display the "libsurfaceflinger.so" entry so it's visible in the picture)
[Galaxy S III Android Development] sphinx02:
Can you send me the modded libsurfaceflinger.so so I can test it directly?

Maybe a downloadlink via pm...
[Galaxy S III Android Development] failax:
I have sphinx mod for CRT, so If I deselect CRT off on tweakbox, it is shown the same.
[Galaxy S III Android Development] Tungstwenty:
Would you mind just taking it from the Tweakbox package, and in the process also checking if the on-the-fly replacement is working for you?

---------- Post added at 12:03 PM ---------- Previous post was at 12:01 PM ----------

Your lib settings are ok, so if you do a soft reboot (pressing the button on the app), it should come back with a libsurfaceflinger.so file in /vendor/lib. It's won't happen, though, if you do a "normal" reboot.

It isn't happening to you? Could it be that the soft reboot tries to load the new lib, fails, and immediately does a hard/normal reboot - did you notice anything that could point to this?
[Galaxy S III Android Development] m3dd0g:
It´s working :D. CRT-ON, CRT-OFF and landscape both are working without flickering thank you my friend.
[Galaxy S III Android Development] failax:
If I try a soft reboot, the terminal reboots without showing boot logo and boot animation, but under vendor/lib there's not a libsurfaceflinger.so file.
[Galaxy S III Android Development] 9Lukas5:
On which rom have you tried it? I have tried it on HyperGalaxy v0.4. That's based on stock XXALF6 and it only works on startup the first time w/o flickering, after that it always flickers (also if I disable the crt mod again, the mod is gone again but the flickering stays).

L
[Galaxy S III Android Development] m3dd0g:
My Rom...:D
[Galaxy S III Android Development] 9Lukas5:
Based on which firmware?
[Galaxy S III Android Development] m3dd0g:
LF2 ...

Gesendet von meinem GT-I9300 mit Tapatalk 2
[Galaxy S III Android Development] Z3roCz:
CheckRom HD v2 screen still flickers :/ did everything exactly following your guide.
[Galaxy S III Android Development] sphinx02:
Yes I can confirm, the libsurfaceflinger.so is working!

I created flashable zips for the .so file so it's possible to test it without the tweakbox app!

Together with my mod it is working great!

[MOD][ALF2/ALF6][ODEX/DEODEX] 1% Battery Mod + Extended Power Menu + NEW CRT-OFF!!

I also updated the first post with the great news!
[Galaxy S III Android Development] failax:
Now everything works, thank you!
[Galaxy S III Android Development] sphinx02:
One question Tungstwenty:

When this one is for CRT-ON and OFF:

const/16 v3, 0x11 # CRT-On and CRT-Off

Which one is it for only CRT-OFF? I think a lot of people dont want the ON-animation..

Thank you again for you perfect work on the libsurfaceflinger.so, you are the best ;)
[Galaxy S III Android Development] jugih:
It wasnt working for me via tweak-box, but now via zip flash WORKS PERFECTLY. So many thanks to mr. Sphinx02 !!!!!!

And of course not to forget mr. Tungstwenty also for the code :)
[Galaxy S III Android Development] failax:
Tungstwenty it's possible to create a mod that makes the drop down status bar transparent ?Not only the top side.

Thank you.
[Galaxy S III Android Development] Tungstwenty:
Sure, I'll add it to the todo list.

Do you have any reference on how it might be achieved? It can spare a few minutes looking at smali code :)

BTW, is the file replacement already working? Considering m3dd0g's feedback, you can now disable the "test-mode only" checkbox and the file should be there on /vendor/lib when you reboot normally, making the effects available.

---------- Post added at 05:08 PM ---------- Previous post was at 05:03 PM ----------

Great! So we can say that Xposed and Tweakbox, and in particular CRT effects, are now "certified" on the S3 :cool:

Believe it or not, all the ARM code patching was done in the dark, with no device to test it on, and it worked right on the first try :highfive:
[Galaxy S III Android Development] failax:
I come from SGS2 as you, do you know VK rom?It has that feature of status bar drop down transparent.If you tell me what files it need I provide you.You can write me in private if you want.My email is pcruzz @ email.it

Thank you
[Galaxy S III Android Development] jacobmllr95:
Very nice work :)

But can you please make a Version just without CRT On, it takes to long till the screen is on and it don't look that good in my opinion.

I would do it for, myself, but I have problems with the tweakbox.
[Galaxy S III Android Development] Tungstwenty:
It's 0x01 for CRT-On, and 0x10 for CRT-Off (or combined for both).

The lib is always the same. Just use the Tweakbox settings panel to enable the ones you want, or if you're not using Tweakbox then copy the lib and make sure the mod you use allows you to configure what you want.
[Galaxy S III Android Development] kamaliqwan:
Great work man!

Can u make it available on CM/AOKP as well..? :D

Crt-off is already there but it woud be great if u could get crt-on enable!please!! :good:
[Galaxy S III Android Development] sphinx02:
I think I have to take a closer look at the prinicple of Tweakbox! It's very interesting.. Is it possible to add the extended power menu via Tweakbox?

And isn't it very dangerous to use it because every other app can use the API to implement bad code?

regards..
[Galaxy S III Android Development] Tungstwenty:
It's answered here: http://xdaforums.com/showpost.php?p=24511933&postcount=18

Basically, you need root to install the framework (which does nothing by itself).

Then, for every app that declares itself to be an Xposed module (such as e.g. Tweakbox), it will show up in Xposed Intaller (the management app) and you'll need to enable it so it starts working. It's the same as clicking "allow" on an su prompt - only if you trust that mod should you enable it, cause indeed it can do pretty much anything.

Yes, it is possible to change the power menu, although it's not something included in Tweakbox yet or other modules that I know of.

Read the framework's thread, it has an explanation of how it works and a tutorial on how easy is it to create your own mod: http://xdaforums.com/showthread.php?t=1574401

Although it's not something you'd use to revamp or theme an entire ROM, with thousands of files, it's an excellent framework for this kind of stuff. And in addition to "code patching", it can also change resources, layouts, etc. on the fly so you can even replace icons if needed.
[Galaxy S III Android Development] sphinx02:
Thank you for that information.. I already read a little bit of the Tutorial and as I am familiar with android-app development, perhaps I will give it a try to realize my MODs as a Tweakbox-Module..
[Galaxy S III Android Development] FadeFx:
Thanx, installed the zip file on xLite Rom v7.0 and can confirm that it works perfectly, only thing i see is that screen on has a little delay now, but no big issue.

–—–—–—–—–—–—–—–—

tapatalked from Galaxy SIII
[Galaxy S III Android Development] g4rvd4:
First off I would like to say "Amazing work" to the devs.. :) :thumbup::thumbup:

Secondly I request a flashable zip with only the CRT-Off as I don't want CRT-On and have no idea how to remove it myself from your file... :o
[Galaxy S III Android Development] jugih:
So basically long story short:

In order to make this work (in stock deodexed LF6), I had to flash two .zips

first the crt-off.zip and then this surfacelingerCRTonoff.zip

If I install only latter one, it wont work.

Just to clarify this, because there are so many intsructions, underlinings and overstrikings at first post of this topic.
[Galaxy S III Android Development] Tungstwenty:
Let me clarify what is required in order to have the CRT effects working:

A patched library that properly (i.e. no flicker, etc.) provides the effects

Code changes on the ROM in order to properly trigger the effect(s), which the library will then respond to those triggers

Item no. 1 is the one that I worked on and for which a fully working library was now provided.

The 2nd part can be done in 2 different ways - either patching the S3's ROM to properly enable the CRT-On and/or CRT-Off effects, OR do some hooking on the existing methods in the ROM and without changing that code, override the flags (i.e., the way Tweakbox does it).

It's this 2nd aspect that you guys need to address somehow. I worked with rovo89 on Tweakbox and not only does it bundle with the library, it also does the code changes in memory to make it work (topic no. 2).

But sphinx02 had already provided that, initially, after some discussion on what needed to be patched on the S3 ROM.

So, in order to have it working you have 2 ways:

Either use Tweakbox and make use of its configuration options to enable only CRT-Off, only CRT-On, or whatever you fancy.

Ask for someone (such as sphinx02) that has an S3, to keep up with existing ROMs (it will need to be changed separately for every one), and provide patched apk's on top of the existing ones so that it enables the effect triggers I mentioned. This will also need to take into account whether you prefer both effects on, only CRT-Off, etc.

I hope this is a bit more clear now, if not just let me know.

---------- Post added at 01:18 AM ---------- Previous post was at 01:13 AM ----------

For CM/AOKP I'm really not the best person for that since I'm not very familiar with that dev environment, I'm using stock since the beginning.

Although, I think in CM the sources for this lib are all there (I could be wrong), so pretty much any developer should be able to change the code and make a version that has CRT Off and On.

The big challenge on the stock roms was precisely the lack of sources, meaning, the approach that Samsung has of using a closed source library and therefore the need to hand-patch ARM bytecode.

Do you know where to report issues/requests for CM/AOKP? If so, I'd suggest you create a request there to address that issue and if the code is indeed available for CM it's much easier for one of their developers to change the code, do the usual code revisions and testing, etc.
[Galaxy S III Android Development] Martini3001:
Works perfect with Omega 7.1 and Abyss 1.3G :-D

Thanks a lot!!

Gesendet von meinem GT-I9300 mit Tapatalk 2
[Galaxy S III Android Development] Tungstwenty:
I don't have a clue what you're talking about, but that's great nevertheless :laugh:
[Galaxy S III Android Development] jugih:
ahh, yes, its been clear to me from the day this surfacelinger.so-mod rolled out.

but I wanted to clarify flash-wise how to do this without all the computer-jargon nor Tweakbox (which is excellent by the way).

Flash-wise it goes down like this:

TWO files is needed to be flashed

First the original flickery CRT-OFF .zip for example HERE

and then flash modded surface linger.so.zip from first post of this thread.

And it works flawlessly
[Galaxy S III Android Development] sphinx02:
I will soon provide flashable zip-packages where everything is involved.. So you than have to flash only one file!

Monday is my last exam for this semester ;)
[Galaxy S III Android Development] jugih:
Loving you man for your efforts on this CRT matter <3
[Galaxy S III Android Development] sphinx02:
Thank you, I think it's a great effect and we have to have it on our S3 ;)

Check

[MOD][ALF2/ALF6][ODEX/DEODEX] 1% BatMod + ExtPowMen + NEW CRT-OFF-ON or CRT-OFF-ONLY

for ONE-FILE-PACKAGES and CRT-OFF-ONLY...

regards :)
[Galaxy S III Android Development] Tungstwenty:
Just an update on this.

I've found on my own phone some occasions when after a reboot, the libraries (CRT or the ones for call recording, at least for S3) are not copied to /vendor/lib as they should. This leads to the usage of the original one which does not respond to the requests for the CRT-On, Landscape, and does respond to CRT-Off but with the flicker problem.

Since I can reproduce the issue (not always but every once in a while), I'll try to find the reason and will get back to you when it can be identified and fixed for good.
[Galaxy S III Android Development] s11nny:
is this working on the new firmware ?

Working on

Wanamlite rom 1.4 xxalf
[Galaxy S III Android Development] LawlietHD:
First off i would like to say its brillaint what you and the other devs and done, great work so far. :laugh: i would like to give you feedback on this issue also, i have a S3 with LE8 stock firmware, however in my case the problem is presistance, from the start i have had the flicker problem. I am using lastest version of xposed and tweakbox, i am assuming you are using the same method?
[Galaxy S III Android Development] blu3angel:
1+ using LF6 rom...
[Galaxy S III Android Development] sphinx02:
Other libsurfaceflinger.so in newer ROM

Hello,

the new XXBLFB-ROM that is out, have an other libsurfaceflinger.so! As far as I can say, the old original libsurfaceflinger.so and so the modded libsurfaceflinger.so are not working anymore with XXBLFB (system is not booting).

I attached the new libsurfaceflinger.so, perhaps Tungstwenty you can have a look at it?

regards..
[Galaxy S III Android Development] Tungstwenty:
Will do, but currently it's not on the top of my list as I have other things to fix.

Thx for the file, hopefully there aren't any relevant changes and it's more hard-labor than actual puzzle solving.
[Galaxy S III Android Development] failax:
Doesn't work in LFB rom?
[Galaxy S III Android Development] sphinx02:
Can't you read? Two posts up ;)
[Galaxy S III Android Development] failax:
Please Tungstwenty make another miracle..I dont want to thange to new rom until you release the fix for libsurfaceflinger.so

Thank you
[Galaxy S III Android Development] Tungstwenty:
Please have some patience...

I'm hoping I can dedicate some time to this early next week ;)
[Galaxy S III Android Development] sphinx02:
I thought about you could perhaps record your screen while doing this, as a kind of Tutorial.. Only if you are willing to...

Kind regards...

Gesendet von meinem GT-I9300 mit Tapatalk 2
[Galaxy S III Android Development] Tungstwenty:
The recipe is now pretty straightforward:

- Binary diff the original and patched files to find the changed offsets

- Do ".../toolchains/.../bin/...objdump -d libsurfaceflinger.so" on both versions and take note of the changed code

- Open up the new original file, do an objdump as well and find the new offsets

- Apply the same code changes on top of the new base file, minding the offsets

Easy! :eek:

The "only" real issue is the amount of work involved in this. Wanna try doing it? :laugh:
[Galaxy S III Android Development] comnam90:
HAHAHAHAHA

Oh I wish I was capable of doing that so that I could use it on BLFB rom working on
[Galaxy S III Android Development] jdbeitz:
Ok, ive tried everything including both swipeflinger.so files frrom the 9100 AND 9300 and im still getting screen flicker >.<
[Galaxy S III Android Development] sphinx02:
Ok, I tried exactly this. Looked for the changes, found the new offsets in the new lib file and replaced the changed bytes..

But if I try the lib-file, the CRT-OFF effect works not at all and the phone can't come back to screen after turn screen off.. So I think there is something wrong, is there something I have to change in the changed code? Or can I take it byte by byte without modification?
[Galaxy S III Android Development] Tungstwenty:
That's the tiresome part. It's not byte-per-byte, but rather "instruction-per-instruction".

Imagine you have the function "flipBuffers" which on the previous version was at offset 0x123456 and on the new one is at 0x123700.

When you're changing the new file and one of the things you need to do is introduce a call to flipBuffers, which wasn't there in the unpatched file and is needed for CRT-On to work, you can't simply place the exact same bytes.

Previously I inserted the bytes that reflect the instruction "BL 0x123456". Now, we'll need to put the instruction "BL 0x123700", so the bytecode isn't the same.

Worse! Even if the target address was still the same, the BL instruction isn't encoded with the absolute address of the destination, but rather the difference between the offset of the calling position to the destination, so that the code is position-independent.

This is just a mere example (I don't even remember if flipBuffers is one of the calls), but which should be enough to illustrate the involved work.

It's the logic that needs to be replicated, but that's very far from being the exact same bytes just at a different offset.
[Galaxy S III Android Development] sphinx02:
Yes, I already thought about that.. For example in your older modded one changes are like that:

[COLOR="Red"]1e938:	f000 [/COLOR][COLOR="Blue"]fb53[/COLOR][COLOR="Red"]	bl	1efe2 <_ZN7android14SurfaceFlinger4dumpEiRKNS_6VectorINS_8String16EEE+0x1ca>[/COLOR]
1e93c:	2001	movs	r0, #1
1e93e:	2100	movs	r1, #0
1e940:	4603	mov	r3, r0
1e942:	460a	mov	r2, r1
1e944:	f7f9 e8ea	blx	17b1c <_ZN7android19DisplayHardwareBase18DisplayEventThread10readyToRunEv-0x570>
1e948:	2204	movs	r2, #4
1e94a:	2006	movs	r0, #6
1e94c:	2100	movs	r1, #0
1e94e:	f7f8 ed7a	blx	17444 <_ZN7android19DisplayHardwareBase18DisplayEventThread10readyToRunEv-0xc48>
1e952:	eeb0 0a68	fcpys	s0, s17
1e956:	4640	mov	r0, r8
1e958:	4649	mov	r1, r9
[COLOR="Red"]1e95a:	f000 [/COLOR][COLOR="Blue"]fb42[/COLOR][COLOR="Red"]	bl	1efe2 <_ZN7android14SurfaceFlinger4dumpEiRKNS_6VectorINS_8String16EEE+0x1ca>[/COLOR]
1e95e:	2000	movs	r0, #0
1e960:	2101	movs	r1, #1
1e962:	4602	mov	r2, r0
1e964:	460b	mov	r3, r1
1e966:	f7f9 e8da	blx	17b1c <_ZN7android19DisplayHardwareBase18DisplayEventThread10readyToRunEv-0x570>
1e96a:	2204	movs	r2, #4
1e96c:	2006	movs	r0, #6
1e96e:	2100	movs	r1, #0
1e970:	f7f8 ed68	blx	17444 <_ZN7android19DisplayHardwareBase18DisplayEventThread10readyToRunEv-0xc48>
1e974:	eeb0 0a69	fcpys	s0, s19
1e978:	4640	mov	r0, r8
1e97a:	4649	mov	r1, r9
[COLOR="Red"]1e97c:	f000 [/COLOR][COLOR="Blue"]fb31[/COLOR][COLOR="Red"]	bl	1efe2 <_ZN7android14SurfaceFlinger4dumpEiRKNS_6VectorINS_8String16EEE+0x1ca>[/COLOR]

So in the new lib-file FB53, FB42 and FB31 must be replaced, is this correct?

But offset in this older lib file for the called function is:

000[COLOR="Blue"]1ee18[/COLOR] <_ZN7android14SurfaceFlinger4dumpEiRKNS_6VectorINS_8String16EEE>:

So how can I now what are the values for the new lib? Is there a way of calculation?
[Galaxy S III Android Development] Tungstwenty:
To get to the new bytes, you need to understand how are the instructions encoded.

I learned this by looking at specs such as these:

http://bear.ces.cwru.edu/eecs_382/ARM7-TDMI-manual-pt3.pdf

www.ittc.ku.edu/~kulkarni/research/thumb_ax.pdf

You could also try writing normal assembler sources like

.org 0x1e938
bl 0x1efe2

and use the toolchain assembler to see what the generated bytes are, instead of doing it by hand looking at the bitmask of the encoded instructions.

Also, note that line calling "_ZN7android14SurfaceFlinger4dumpEiRKNS_6VectorINS_8String16EEE + 0x1ca"!

To make it work, it was necessary not only to perform changes, but also *additions*. And for that, some usable space within the code section was required. Turns out that the dump function is something that can be discarded (surfaceflinger will stop showing info when running dumpsys), but you can use that space to put the extra instructions that were needed to make CRT-On work, CRT-Off not flicker, etc.
[Galaxy S III Android Development] sphinx02:
Puhh, not that easy dude :D
[Galaxy S III Android Development] Tungstwenty:
Hope you understand now why I didn't manage to do it yet :p
[Galaxy S III Android Development] sphinx02:
Hey Tungstwenty,

how can I translate asm-commands into machine-code with the toolchain?

Can you give me the instructions to translate for example:

.org 0x1e938
bl 0x1efe2

So I can try around a little bit..

regards :)
[Galaxy S III Android Development] aquariex24:
Hello, I am quite new to this stuff but from what I understand because of the latest "LFB" stock ROM the only CRT effect that works is the CRT-Off (with an occasional flicker), correct? Because CRT-ON and horizontal CRT effects did not work.

Btw, I also included changes for the number of "signal bars" displayed, "input method" when typing and those worked as stated. Thanks for everyone involved in this project.
[Galaxy S III Android Development] Tungstwenty:
That would be the "****as" binary.

You can google for sample source files, for instance I just came across this one: http://pygmy.utoh.org/riscy/cortex/led-stm32.html#sec-4

AS will produce the .o output file from your source code, and you should be able to pick the bytes from there and place them on the final binary. If org directives are used properly, the code should contain the right offsets to it will work.

---------- Post added at 01:48 PM ---------- Previous post was at 01:43 PM ----------

The original surfaceflinger libraries shipped by Samsung on S2 and S3 do include the CRT-Off effect, but with a glitch that makes it sometimes flicker after turning off.

In order to activate using this effect, some changes have to be made on the framework, but that's pretty much solved and it works for all versions.

The thing is that in order to also have CRT-On effect, and also landscape support, extensive changes need to be applied to the library otherwise the effect simply isn't there.

Those changes have been performed on existing S2 and S3 libraries (each of them has different base files which are not interchangeable between the 2 models), but more recent ROMs come with different libs where this fix wasn't applied yet.

Until that happens, what's available is using the stock libraries which means that only CRT-Off works and even then, occasional there's the flicker when turning off.