yashsingh1/xdaforums huggingface dataset:
[Defy Android Development] Blechd0se:
Trim explained

Let me shortly explain how trim works;

We all know mobile devices use flash disk instead of the common hard drive disk. They

are similar to SSDs, but of course not that powerful. The filesystem is made upon pages and a certain amount of pages are one block.

Now the filesystem can only delete blocks, so each time you are deleting something, the filesystem marks pages as "deleted".

However, they are not really deleted until one block is "full". Then the real deletion process starts. Now image you have deleted lots of files and

suddenly every write process slows down as hell. Thats because the filesystem has to delete the old blocks first and can then write new ones.

Kinda wired, isn't it?

Trim actually tries a different approach. As you can image, it will free those pages (blocks) before the next writing process is happening.

This can (in theory) speed up writing a lot!

How does it work on a mobile device?

Google introduced with 4.3 a automatic trim operation to ensure the file system speed is consistent as it was at the beginning.

Every time you delete something those pages are "marked" as free. This can be updating/installing of apps, but also some random noise

caused from the OS itself. In the end the result is very marginal. There are some benchmark apps (don't remember the name), which can

detect the speed increase, but its nothing like a 20-50% performance increase. With trim you can ensure the same speed over a longer

period of time. Also the speed of I/O Operations might slightly increase (and the OS uses a lot of I/O stuff).

[MENTION=4998126]frozenwaverider[/MENTION]

I am not sure if the hint from the developer is actual right. A reboot will only do harm. The kernel know which pages/blocks are trimmed, but not

the filesystem itself and since the kernel is "fresh" on each reboot it marks pages again as "for-deletion-ready". So a reboot is nothing you want to

do after trimming. During the boot, lots of files are written, so there is no point in rebooting (its actually the design of linux that you don't have to reboot):

With fstrim -v /data you can see how many pages are actually freed now. If you type this command again, you'll see that the number went

down to 0. If rebooted you can "trim again".

This means either your kernel or your busybox doesn't support the trim command. Since i guess you are using the latest build,

it's the fault of busybox. An update should solve it.

I hope this explanation helps a little bit, feel free to quote this post if this question ever comes up again. :)
[Defy Android Development] cyrusct82:
Is there a way to enable it without a computer?

EDIT:

Found it. In TWRP\advanced\terminal command and enabled it.

As for log I will post it as soon as the time permits (I'm at work now).
[Defy Android Development] xergio24:
Sorry for the OT but... when I do it from TWRP -> advanced -> terminal command, it keeps telling me ".../tune2fs: not found".

And if I go to system -> bin, there is nothing in there =/

Am I doing something wrong? :confused:
[Defy Android Development] cyrusct82:
Go to system -> bin and press select.

Then you must enter the command from tune2fs...... (without system\bin) will work a little and then you're done.
[Defy Android Development] xergio24:
Thanks man!

I had already tried that but I was putting a "\" before "tune2fs" and of course it wasn't working that way -.-'

Thanks again!
[Defy Android Development] Mickey M Mouse:
Looking forward to the 'set at boot' option working :) Really nice app.
[Defy Android Development] cyrusct82:
Dear Blech,

I have tried those days to provide the logs for you but unfortunately I cannot reproduce the bug.

Even I have made a new clean install but even with this there is no problem. If it will appear I will provide you the log.
[Defy Android Development] Blechd0se:
Just a small update what i am working on:

https://plus.google.com/117941672478859152986/posts/NmxdyrtLmnB

Next release will have a kernel backup/restore interface. I also added many small things and translated the app into german :)

If some of you want to help me translate, this is the file to go for. You can send me this translated file or fork my project and make a git pull request.

I also added a file system check which might help against the /data corruption bug :)
[Defy Android Development] MarcinRN:
some Polish translation added. thanks for your efforts!
[Defy Android Development] cyrusct82:
Romanian translation added.
[Defy Android Development] bone101:
If I use fstrim -v /data in terminal

I get fstrim: FITRIM: I/O error
[Defy Android Development] slimshady76:
Spanish translation

I'm a total n00b when it comes to GitHub, but I still wanted to contribute, so here is the Spanish translation. Please rename it to strings.xml.
[Defy Android Development] Blechd0se:
Already merged, perfect work thanks! :)

I commented on that on github, could you do it like the other translators? :)

I have no clue whats going wrong, i assume you already wiped /data. This isn't the right place to discuss this anyway.

Thank you, i will add them as soon as i can! I have currently no access to my development machine, so i can only do pull requests :)

Thank you all guys, the next update will be big :)
[Defy Android Development] Kayant:
Well since so many people are noobs with Github I will get to work on finishing my tutorial....
[Defy Android Development] cyrusct82:
Done. I think now is correct.
[Defy Android Development] Blechd0se:
v0.9.4

While there is a brand new release of kitkat and i am preparing many things for 3.0.8, i thought

of releasing another alpha :)

This one is pretty big compared to the previous ones, however its designed to work with the latest 4.4 release

perfectly together.

Besides some translations contributed by users (thank you very much!) there are other exciting new things in;

Fixed a bug in the CPU Fragment, where values won't update on UC/OC

Fixed the slow UI perfomance on Live OC/UC

Fixed wrong io scheduler in memory fragment

Added a "Default Values" Button to the Live OC/UC

Added a filesystem check, which shows the user if the "has_journal" feature is disabled

Added german, polish (@marcin92), romanian (@cyrusct82) and spanish (@slimshady76) translations

Added basic kernel backup/restore fragment

Added showcase library and added a few helpers for berginners

Added /system trim option

There might be some small other improvements as well, such as small UI changes and a few new icons.

All kernel backups will be saved here: /sdcard/com.aero.control/<date>/zImage

If you want, you can help to translate it.

Download

Let me know what you think about it and what should be improved :)
[Defy Android Development] slimshady76:
Cool, thanks! One small glitch: The Spanish translation isn't showing the right characters when they are accentuated.
[Defy Android Development] Antiga Prime:
The "strings.txt" file you uploaded is ANSI encoded. Changing it to UTF-8 will most likely fix that problem.

Edit: Then again, the original file is an .xml file, so I don't know if that changes anything or not.
[Defy Android Development] slimshady76:
Darn! I knew I should have edited it in my Linux laptop, not in the infamous Windows workstation...
[Defy Android Development] cyrusct82:
When I'm entering in updater the app is FC.
[Defy Android Development] struq:
Thank you for the app! I have translated it into Chinese and sent a pull request.

However I noticed some problems too.

1. I cannot open the updater part, the app force closes. :( I'm on Quarx's 20131020 CM10.2 build.

2. Didn't find corresponding values to translate for the pop-up about 'has_journal' feature.

3. This could be minor though. While in settings page, I click back key expecting to get back to the previous page and surprisingly find that the whole app exit directly. Is it designed to be like this? :)
[Defy Android Development] MarcinRN:
@Blechd0se

i've updated Polish translations & made a pull request.

some issues:

- trim progress bar can be closed while trimming (simply by touching any area except the bar). imo it'd be good if it stayed unable to close untill the trimming is done

- swiping from left to right doesn't open the navigation panel

other stuff seems to be fine except the for the mentioned by struq and cyrusct82

overall, great work and beautiful design!
[Defy Android Development] stari_alca:
+1 on the updater option causing FC.

And for some reason when I enter manage apps in settings and choose Aero Control it says my version is 0.9.3. I did download and install the latest apk several times. I can't find any options for kernel backup. Trim option is now available for /system too but I haven't tried it yet since I can't even get /cache trimmed. I get impatient and touch the screen and trim stops running.

Slimbean 4.3, build 2
[Defy Android Development] Blechd0se:
Thank you for translation, i already merged it :)

1.) Fixed! It couldnt find /sdcard/com.aero.control (obviously, because you haven't done any backup). Sorry about that.

2.) I added it to strings.xml :)

3.) Interesting found, i will investigate this. Probably something with the history stack, will read into this.

Thanks, already merged :) I am happy if you keep maintaining it like this :)

1.) Yes its intended, but i am not sure about this. I like your proposal, i will see how it fits :)

2.) It does work, you have to start from the very left, its googles design :)

I just pushed v0.9.5 to fix this updater bug, download.
[Defy Android Development] okij:
Thanks for your new versions, I just installed 0.9.5! :)

One question about this feature: Do we just get a feedback if "has_journal" is disabled?

IMHO it would be good if the user also gets a positive feedback if this feature is enabled, e.g. with an entry in the overview page.

Also one question about the new Trim /system option: Does it work for you and does it show a positive effect? Because when I tried it (with 0.9.4), the system froze after about one minute of trimming and I had to pull battery. Fortunately, booting was without problems and /system still intact. :)
[Defy Android Development] Proverbs2:
I was able to trim /system with 0.9.4 and with 0.9.5, no problems. :good: I didn't notice any major performance effects, but it seemed to help a little. (Maybe that's just the placebo effect, though, I'm not sure.) ;)

I'm still running the October 20 nightly, which doesn't automatically enable the has_journal feature, so I was able to test the filesystem check. It works great! I've attached a screenshot of the warning I see when I select the "memory tuning" option.

Backup and restore kernel seems to work too. Thanks, Blechd0se!
[Defy Android Development] vaserbanix:
That apk afects the imei?

Becouse i instaled the last 0.9.5 and check zcache(only this modification i made in it) and rebooted the phone

And my imei is gone(unknown)

I uninstaled the apk, rebooted and my imei is back
[Defy Android Development] justjr:
It reboots while I try to trim /data, /system, anything.
[Defy Android Development] Blechd0se:
I don't want the user to get spammed with unhelpful things, it should be only displayed if there is really something missing :)

Yes trimming works for me flawless, no matter if 2.6.32 or 3.0 :)

Its a bug of the ROM, my app won't do anything about your IMEI.

Get me logs, otherwise i can't help you. Logcat&dmesg would be enough :)
[Defy Android Development] Andrey Piekas:
[MENTION=4855459]Blechd0se[/MENTION]

This is the update done by me for the PT-BR.

If you want to use in the next version of the app.

GITHUB
[Defy Android Development] justjr:
Sorry, I really like to provide logs, but I don't know how to. Can you explain or point me somewhere explaining how to? I will surely do it as quick as I can.
[Defy Android Development] bone101:
Here my dmesg output q. cm10.3 rom

https://db.tt/eGmLsbj8

Sent from my ...no need Tod know
[Defy Android Development] justjr:
Anyway, after some wipes, cm10.3 re installed and data recovered, I can trim data em system fine now, but it restarted the phone while trimming the cache.

One thing I noticed with new version (for new kernel 11/11), is that the write back control option don't stay ticked, idk if it works, but after open the app again there it is unticked.
[Defy Android Development] Proverbs2:
+1
[Defy Android Development] Blechd0se:
Reboot is strange, it shouldn't reboot, don't know whats wrong there. I can trim all things perfectly without any issues.

Maybe you can provide logs next time? I have written a nice guide over here.

I also fixed the writeback thing, thanks for noting that :)

What should i do with this? There isn't anything wrong?
[Defy Android Development] xdaid:
Hi there,

sometimes when i use the CPU's Live OC tool one or more vsels don't get saved, it does not happen all the times though. Is it just me? Does anybody confirm this?

Other than that, this weekend i have some extra spare time and finally i put my hands on your code, Blechd0se :)

Working on:

1) Preferences fixes for all the fragments so that the values set by the user get saved

2) Set-On-Boot implementation so that AeroControl will be able to commit permanent changes

3) Minor fixes here and there

Actually they're already done, but not tested at all.

I will join on github soon.
[Defy Android Development] Blechd0se:
Live OC works for me as it *should* but i will investigate it :) At the moment Live OC uses a very static interface, one approach would be to handle

this like the governor page, where those values would be loaded dynamically. This could then be enhanced for other devices as well :)

Really glad you'll join this, now this will get more truly development. Apart from language updates, i haven't had the time to work on Aero Control lately (very busy with 3.0).

1.) If a user changed the preference than thats useful, we can save this in the app data folder, but on first start, we should

read everything the kernel offers (and thats how i do it at the moment). I like the idea to rather read the kernel values instead of

the app saved ones.

2.) I haven't implemented the "Set-on-Boot", because i wanted first confirm all features work and nothing screws up. We probably have

to use a service at boot to set the values, but i am not sure about this. A good approach would be to set those values for each setting

individually, but again i am not sure about this, you can surprise me :)

3.) Yes there is a lot to polish up and i also have a problem with several threads (we need better thread handling).

I won't have much free time in the next week (exams :( ), but afterwards i am totally free :)
[Defy Android Development] slimshady76:
I've had several (not saved/applied after I exit AeroControl) modified voltages/speeds as well, but I believe it has to do with the default Performace Settings' "Set at Boot" option. In order to get the voltage/speed preferences in AeroControl working, I must untick "Set at Boot" in the System Preferences first.
[Defy Android Development] Blechd0se:
v0.9.6

Hello guys,

i just pushed v0.9.6. It has some pretty nice changes;

Add Display Color Control (only available with recent kernels)

Add Writeback driver control (only available with recent kernels)

Add Control for free amount of ram (e.g. you can set 80 MB of free ram at all time, the kernel will try to keep it at least at this threshold)

Add the "Set-on-Boot"-Feature thanks [MENTION=1892363]xdaid[/MENTION] !

Add "low mem"-option for Kitkat devices

Add basic multicore support (if you have a device with more than one cpu, Aero Control should display and set all values correct)

Add reboot alert, if a sudden reboot was detected inform the user (requires a 3.x kernel, click here for a demo).

Add language updates ( [MENTION=4514770]Husi10[/MENTION] for french, [MENTION=3897045]spear1403[/MENTION] for croatian, [MENTION=3629267]xanubisx[/MENTION] for spanish)

Fix application would quite if back button was pressed

Fix app would spam logcat when its not running in foreground

Fix RefresherThread priority, for slightly better cpu handling

Many more little fixes to give a overall better user experience

So all in all many new things in there. The biggest one is probably the new set on boot functionality which was originally developed by [MENTION=1892363]xdaid[/MENTION]. I just

enhanced it a bit. Also the new debugging features may help with our new 3.0 kernel. Many thanks to all contributors!

I hope you'll have as much fun playing with it as i making it. :)

Download

I will focus on the defy parts on the next update, so we can leave this alpha stage finally. If you have any suggestions regarding this or regarding the

app in general be sure to drop a small feedback post, thank you. :)
[Defy Android Development] bhupatib:
Just installed the new version on the latest cm10.2 with the 2.6 kernel from cm11-24112013

Initial observation suggests some issue with the back button implementation in the UI.

In settings, the back button doesn't take you to the previous screen instead it exits the app after showing some gibberish:

Whereas in other places the back button causes either a blank screen or shows the previous screen with wrong title and then a blank screen.

Apart from these niggles, the app is really becoming awesome! The new low energy display option and memory limiter is great! Set on boot works too :)

UPDATE: I think with slide out navigation, back button should be used only to exit out of the app ( perhaps by showing a toast notification "press back button again to exit" ) instead of going back to the previous screen within the main activity. The settings screen should be a separate activity so that back button will take you back to the main activity as usual. This is a standard approach used by other apps with slide out bar like Google Keep, YouTube etc.

Also, under display options "Defy Green" is more like "Defy Blue" :p
[Defy Android Development] Walking dead:
Bug : some setting won't save over reboot.

[MENTION=4855459]Blechd0se[/MENTION]

the app works good overall but here is a small bug ,

settings (tweaks) of governor won't save over reboot remaining settings like governor ,io ,over clock settings all survive reboot.

I like to have enable_suspend to 0 but it gets reset to 1 and many other(governor) options show unavailable (empty values) as they (stock)are with the kernel .

I'm on pa 4.3 by kayant 2.6 kernel 03-nov.
[Defy Android Development] Blechd0se:
v0.9.7

[MENTION=4360080]bhupatib[/MENTION]

Thank you for very constructive feedback!

You are right this backStack thing was just broken, i also like your approach to make a separate activity for

the settings panel. I integrated your ideas :)

Btw. "Defy Green" means the same colors like on a Green Lense Defy, thats why its called green.

[MENTION=4817189]Walking dead[/MENTION]

Yes you are right, i just forgot this. I added it in, i hope you'll like it :)

Just pushing out a new version with the bug fixes mentioned;

Fix governor specific settings won't save when "Set-On-Boot" is set

Fix strange behavior with back button (double tab back to exit)

Reworked the settings panel and start new activity (also some new and fresh icons, less hacky more Google guideline)

Have fun and enjoy it, as always i appreciate any feedback!

Download
[Defy Android Development] TJKV:
I love the new layout in 0.9.7 :)

[MENTION=4855459]Blechd0se[/MENTION]

When I fstrim this happens:

http://pastebin.com/hvb5fF4N

(rebooted after hanging)

Any idea what happened, or why?

EDIT: Is it because I may have removed something important here, like the exfat, fuse, or ntfs-3g branches?

https://github.com/tejus/android_manifest/commit/ea395fa3d2a3a85591e15993a18e98fb974597df
[Defy Android Development] hotdog125:
+1

When I tried TRIM on the system partition, the phone got stuck and I expected it to return to normal after a couple if minutes. After 6 hours, the phone was still unresponsive.
[Defy Android Development] TJKV:
6 hours?! My phone started to heat up after around 8 minutes, so I removed the battery and rebooted. If I had left it for 6 hours my battery would have taken a real beating...
[Defy Android Development] Proverbs2:
TRIM option works fine for me. It only took a minute or two to trim /system

I'm still using the October 20th build of 4.3, in case that's relevant.
[Defy Android Development] slimshady76:
With a clean install of KitKat (2.6.3 kernel) and AeroControl 0.9.7 I've been able to trim the three FSs (/data, /cache and /system) successfully for the first time. I have ~300MB used in /data, and it took about three minutes to finish. Two minutes for /system and less than 30 seconds for /cache.
[Defy Android Development] ela1103:
what is Advantage of TRIM
[Defy Android Development] bhupatib:
http://www.anandtech.com/show/7185/android-43-update-brings-trim-to-all-nexus-devices
[Defy Android Development] bhupatib:
On our phone TRIM isn't automatically enabled unlike Nexus devices where fstrim is scheduled to run in the background. Aero Control allows you to selectively TRIM your partitions when you want to and improve IO performance. You don't have to do it all the time; I do it once a month.
[Defy Android Development] TJKV:
[MENTION=4855459]Blechd0se[/MENTION]

Until you integrate Defy Parts into your app, why not make the Defy Part entry a shortcut to the existing app instead? :)
[Defy Android Development] Blechd0se:
Thats a nice idea, but if one would use the app on a different device (and i plan to make it at least work of some of my nexus devices),

it will most likely turn into some kind of troubles.

I could add some checks, but then i would end up patching something already strange instead of doing it right :)

I also want to rework the defy parts a bit, to fit the overall needs. I was just busy with kernel stuff and couldn't really

focus on that.

About your trim problem, i saw you removed busybox, Aero Control needs that framework for some commands.

You can always check if trim works for you by entering fstrim -v /cache in the terminal :)
[Defy Android Development] TJKV:
I didn't remove busybox, just switched back to the slimroms version. But it might be missing some extras that cm has, I will test with the cm version and see :)
[Defy Android Development] Hasuris:
[MENTION=4855459]Blechd0se[/MENTION]: can you pls PLS remove the enable_suspend 1 of Interactive? This setting doesn't stick with AeroControl and I absolutely loathe this. I have to set it every time after a reboot. If I forget this and play music with Viper4Android, I am stuck with an unresponsive phone for up to 10 minutes. There is no point to cap the CPU while the screen is off. Either I want my phone to do some tasks while the screen is off or some app is doing stuff it shouldn't do in the first place and needs debugging on my part.

The only thing that caping the CPU at 300mhz does is the phone takes slightly longer to fry the battery. But it still fries it (if there is a process pushing the CPU to 100%).
[Defy Android Development] Proverbs2:
Strange. I have suspend_enabled set to 0, and it sticks for me; no need to set it again after reboot. You're using the latest version of AeroControl, with "set at boot" enabled, right?
[Defy Android Development] Hasuris:
Yes but on Kitkat "set at boot" seems to doesn't work at all :( Maybe AeroControl got broken from incomplete restoring with TB or something. Will try to reinstall it and see what happens.

/edit: doesn't work. I think this is a problem of the kitkat roms. Still I think capping the cpu causes more problems than it solves.
[Defy Android Development] Blechd0se:
You can try to wipe the app cache, the set on boot functionality works perfect for me, even with the suspend_enabled

parameter.

Also make sure you are running the latest Aero Control :)
[Defy Android Development] TJKV:
Okay similar results with 0.9.7, here I have trimmed /system (Line 513). I've pastebinned the log, from launch of the app till I exited it.

http://pastebin.com/SzDxYUZc