Deodexing Explained + How To

So you want to theme… but you keep hearing about all this deodexing stuff… so whats that all about?

Stock android implements an odex file structure; for every (well…most) system app(s) (.apk file) and framework files (.jar) there is a corresponding .odex file, so for example you have;
/system/app/Phone.apk
/system/app/Phone.odex
/system/framework/com.motorola.android.mediasync.jar
/system/framework/com.motorola.android.mediasync.odex

What do the .odex files do?

All of your apps on your device are packaged as .apk files; these files are compiled from google source code and can interchangeably be viewed/thought of as a compressed folder (like a .zip or a .rar); and all of your framework components (well most…) are packaged as .jar files which literally stands for Java Archive (so again this can be compared to a .zip or a .rar).

When the android OS want’s to run your apps or utilize its framework components, it has to parse (read/interpret) the compressed data held within your .apk and/or.jar files. What the odex file structure aims to do, is to expedited this process by utilizing another file (.odex file) to compliment every.apk file (and .jar file); the odex file, includes the most critical data in an uncompressed format so the android os can quickly interpret that important information before parsing through the rest of the data held within the compressed .apk files (and .jar files). So subsequently, in an .odex file structure the .apk .jar files don’t include all of the applications/framework-components data; Essentially, two files are acting as one; for your apps there are .apk files + their corresponding .odex file and for your framework components there are .jar files + their corresponding .odex file. This works nicely as an optimized file structure, except in the circumstance when the user want’s to theme; theming requires a modification to your .apks; the image files (.pngs) held within the pngs are replaced with different ones. However it is impossible to theme an application if it exists as two files. So that is why it is said you need to be DeOdexed in order to theme; DeOdexing is the process of re-bundling that uncompressed critical data (.odex files) back into your compressed .apk (& .jar) files, so that now all of the data is included in the .apk files necessary to run your applications without the presence of .odex files; in addition all the data is now included within the .jar files necessary to utilize your framework components without .odex files. In a DeOdexed file structure, there are no odex files present.

 

What are the benefit’s of DeOdexing?

Simple. To be able to theme a stock ROM.
Deodexing doesn’t speed your phone up or do anything of the sort.
It is simply something that is necessary to be able to theme a stock ROM.

How do you DeOdex?

One way you can deodex is to use the application xUltimate which actually rebundles that information for you. Another way, is to use a pre-made DeOdexer Update.zip; this zip already has all the repackaged fully compressed .apk files and utilizes code in the update script to delete all of the odex files present. So essentially all it’s doing is overwriting all your old semi data inclusive .apk files with fully inclusive ones and then deleting the (now) superfluous .odex files. This is the easiest way to do it, since all the work is already done for you. Just flash it in clockwork as you would for any theme:
  1. Download it
  2. Place it on your sdcard
  3. Open Droid X Bootstrap
  4. Hit Bootstrap Recover > Ok > Reboot Recovery
  5. Navigate to ‘Install zip from sdcard’ with volume keys and select with camera button
  6. Navigate to ‘Choose zip from sdcard’ and select
  7. Navigate to the directory containing the above deodexer zip
  8. Select it > Yes
  9. Wait for it to do its thing > reboot system
  10. You are now deodexed.

How can you check to see if you DeOdexed successfully?

  1. Open a file explorer (like Root Explorer or Astro)
  2. Navigate to the directory /system/app
  3. Check for the presence of .odex files
  4. Navigate to the directory /system/framework
  5. Check for the presence of .odex files
  6. If there are no odex files present then you are deodexed!
  7. Now you can theme!

Will DeOdexing slow you down?

Technically it should, but in actuality its really quite negligible to notice, however… In my opinion, it’s rather silly to DeOdex and stay on stock ROM; you should just make the switch to a custom ROM. Why? Because custom ROMs are already deodexed and they zipalign your apps on boot; zipaliging is the process of reorganizing the manner in which the .apk is packaged to optimized it for being parsed faster by the android OS, it is comparable if not better than the odex file structure, so you get the best of both worlds; a themed ROM and the speed of an optimized file structure. That is why Stock is lame and custom ROMS pwn (IMO of course…)

Optimizing Battery Life & Speed

Introduction:

Consider your device a mini computer, in order for it to do anything it’s reliant on its ability to process new information, write that information to memory, and then output that information to your screen. Like all computers, its ability to perform well is dependent on all of the components/factors working together as one unified system; starting from its core/foundation (hardware) ranging all the way to the user apps. Each layer plays an important role regarding how your device will perform, however the farther and farther you move away from the Hardware Level (level 1) regarding tweaks/mods/settings, the potential benefits will decline in their relative significance. Therefore the best way for me to explain what it will take to improve the overall performance of your device, will be for me to methodically and sequentially break down the specifics regarding each of these levels:

Breakdown:

Optimization Guide:

Level 1: Hardware & External Factors

At the core of every computerized device is the physical hardware available. No matter how much you tweak your system, mod your apps, and change your settings, at the end of the day, it all comes back to what your working with, and that’s the hardware. Regarding computer technology, you will always be restrained by your hardware capabilities; this is the primary reason why people set out to purchase the next generation smartphones/computers, because you, the end-user knows (either consciously or subconsciously) that the latest and greatest device will out perform your current (outdated hardware) device due to the improved/new hardware included.

The other component of this level is “External Factors”; regarding your smartphone, this is more specifically referring to the available internet infrastructure. No matter how good your base-band radio receivers (hardware) are, if you are in a cave, you are not going to be able to browse the web. Understanding that you are limited by coverage and available internet infrastructure is very important because it has the most noticeable and significant effect (which is why it’s included in the first level). This is the primary reason why people are inclined to switch from 3G service to 4G service because they know that it will have the most dramatic effect towards improving their browsing speeds.

So what are the ways can we improve overall performance on the hardware/external factors level???

1. Buy an extended battery(..I need a link to a thread which discusses the best ones…)

Seems obvious…right? Well it should be  , because we as consumers instinctively know that better hardware = better performance

2. Get better service

I say this kinda jokingly, because yes I know… it’s not that simple, and we are only offered 3G service on this device, but for the sake of this explanation I wanted to include it to make it clear what factors are involved in this layer. All of us have already succeeded in this section anyway… I mean… we aren’t on AT&T right? lol.

3. Overclock your device

Your device come’s shipped with a CPU (processor) that’s only been tested (and pre-configured/set) to perform at the factory standard for this device (1 GHz for DroidX). All moto’s quality control people care about before approving your device to sell in the smartphone market is weather or not the CPU will perform at 1GHz; that is the factory standard and the given/advertised specs for this device. However, due to variance in hardware manufacturing, there is high possibility that your CPU can in fact perform at higher speeds while remaining stable. That is what overclocking is all about, getting the maximum performance out of your available hardware. The app on the market QuickClock makes this very simple, because it automatically determines your maximum settings for you. Other apps on the market like Droid Overclock also do a very good job at this but is geared more towards advanced users, and may require you to spend more time manually testing. The QuickClock app will actually allow you to export your profiles to be used in Droid Overclock, so you can also go that route if you chose.

4. Undervolt your device

Your device comes shipped with pre-configured settings governing exactly how much power is drawn from lithium-ion battery when actively using your device. Moto’s quality control people only care about ensuring that each device they ship out will remain stable, so this value tends to be way higher than it needs to be. That is where undervolting comes in, you can reduce this value, thus improving battery life, while still remaining stable. The app QuickClock can actually do this (automatically) for you as well, making it an all around very useful app and well worth the 2-3 bucks. The ROM Rubix actually comes prepackaged with a lite version of QuickClock which you could use to give it a test run if you like. Undervolting is a very beneficial procedure so pushing your device beyond QuickClock’s settings may very well be worth it. Check out this Undervolting Guide for a more in-depth overview of whats involved as well as procedures for manually doing it.

Level 2a: Kernel

After the hardware level, there needs to exist something that can then access those resources in matter which they can be used by your applications. That is exactly what the kernel does, it serves as the central component of the system level (level 2), bridging the divide between hardware and applications so that your device can do all the cool stuff it does. The kernel is an integral part of any operating system because it is the only thing that can provide the lowest-level of abstraction when trying to access the available hardware resources, therefore making modifications to the kernel would prove to be the second most beneficial component one could tweak; rendering the most noticeable/significant effects (well… after modifications to hardware level… but you knew that already ).

So what are the ways can we improve overall performance on the kernel level???

If you are on a Droid-x then as of today you can’t

Sorry. I don’t like being the one that delivers bad news, but unfortunately for Droid-X users due moto’s locked bootloader policy, they have essentially locked us all out of the most valuable component of the computer technology we purchased. MOTO FAIL!  Sign the petition to get in unlocked:  Let your voice be heard. Even if you haven’t rooted yet, this locked bootloader policy is holding all development back. Please take the two seconds to sign: Motorola Locked/Encrypted Bootloader Policy | groubal complaints

If you are on a super cool phone like the Samsung Galaxy Nexus then you can flash custom kernels.

Custom kernels are often bundled in custom ROMs, and can be flashed in CWM recovery.  Alternatively if they come in boot.img format they can be flash them with fastboot (or with my Toolkit).

Level 2b: Operating System

This is the level that unites us all! At the heart of every android device, there exists one similarity and that’s ANDROID!!! Hooray for android! The android platform is truly amazing and as the android community continues to grow, so have the capabilities of the platform itself. New android release have been coming out at staggering rate (weather or not they’re getting pushed to all the devices is another story though :sigh); From donut to eclair to froyo to gingerbread to honeycomb to whatever the next one will be called, I’m gonna go ahead and guess blueberry-cheesecake… lol, the android platform just gets better and better (and tastier!) with new features, advanced hardware support, improved stability, and all around increased awesomeness (yes, that’s a real feature.. don’t judge me! lol). But understanding what goes on at this level is not only fun, it actually will dramatically help you increase/improve your overall system performance; Why? – because behind all the ROM’s, theme’s, applications, sleek protective casing, car docks and accessories, the core functionality of your device all depends on our little green friend (well…after hardware ‘level 1’ and lowest level system access ‘kernel – level 2a’, but you knew that already  ).

So what are the ways can we can improve overall system performance on the OS level? More specifically, what defines/governs the android OS, what can be tweaked on the back-end, and what settings can be tweaked on the front-end to achieve overall performance increases?

Back-end:

1. Sysctl.conf tweaks

Going back to the very first sentence I stated in the introduction section, in order for your device to perform any operation it has to be able to write data to memory; so for such a essential component to the big picture, wouldn’t you think that being able to have direct control over how this is done would be really powerful? Yes it would, that’s a 100% correct (great guess 😛 lol!). This is exactly what sysctl.conf tweaks offer you; a way in which you can modify exactly how the system goes about writing data to memory, how the system will preference writing data to system cache vs writing it to ram, and also how much free memory the operating system allocates just for kernel. Now that’s what I am talking about! For a really detailed and solid overview delineating exactly what each entry in the sysctl.conf file does, instructions for exactly how to go about making these adjustments, some different viewpoints on recommended settings, and even pre-made flashable system tweak.zips check out the Syst.conf tweaks support thread here.

2. Build.prop edits

This is another very important back end system file which governs hows your device allocates and uses its limited hardware resources; entries in this file control things like Dalvik VM heap size, the frequency in which Wifi scans for access points (for battery savings), windows manager max events per second (for increased scrolling speeds), LCD screen density, for higher resolution, and even changing the ro.build.fingerprint to tricking the market into thinking you have a different device so you can see more apps in the market (this may be an outdated tweak now that we are all on a newer market version than when this tweak was initially discovered.. but this sort of tweak works for fixing market problems on the TBH new blur 3.4.2, so it’s still applicable in some circumstances). Modifying these build.prop entries will greatly improve your overall performance, so its a great thing to check out and start implementing. But when it comes to build.prop edits sir Beesley knows best so I will leave it to him to take it from here, check out Beesley’s thread here: Build.prop edits = great battery life + fast phone + full market

3. Battery Recalibration

No matter how good your hardware is or how many mods you make, you may be suffering from sub-par battery life due to your operating systems inability to accurately gauge its available battery life. What this means is that your device could actually be shutting down prematurely, so you actually are never getting the full use out of each charge. Luckily for you, there is an easy way to re-calibrate your battery so that your OS will no longer mistakenly gauge your available power levels. To recalibrate simply do the following;

  • Turn you device off an plug into charger
  • Let your device charge until it reaches its maximum charge (100%)
  • Unplug your device from the charger
  • Boot into clockwork mod recovery & navigate to the advanced menu > clear battery stats > yes > back button or power button once to go back to main menu > reboot system
  • Once the phone is booted, let it fully discharge, by fully discharges I mean literally until the point that it dies.
  • Now re-plug your dead device back into charger and fully charge again (back to 100%), preferably while off.
  • Once fully charged, unplug from charger, boot up and resume regular usage
  • Your device is now fully re-calibrated

No matter what your usage patterns are, its recommended to preform this recalibration procedure approximately once a month. Understandably some of you will never have the time to have your device turned off for all that time necessary to do this, so please note that these guide lines can be bent slightly, and you can get away with doing some of the steps with the phone powered on rather than off, the main idea is simply let it charge, clear stats, let it discharge, recharge, resume usage… that’s all. 

Front-end:

1. Lower Display Brightness

This is a really important one. Your nice over-sized-sized high resolution LCD screen on your DX may in fact be one of your favorite features, however, to display anything on your screen requires a lot of energy (relatively speaking of course); just think of how many photons are being emitted from your screen at any given moment, every second you screen is on your device is drawing power from the battery. So simply lowering the display brightness or setting it auto-brightness can really help, but please note that auto-brightness won’t be as effective as simply setting your device to a low display brightness. How do you set display brightness?

  • Home screen > menu button > settings > display > brightness

Alternatively, if you really want to save battery life, you can use the app Adj Brightness to set your display brightness to values lower than the factory settings for lowest brightness. This app will not only help to improve your battery life, but its also just a really nice app to have at night time, when even at 0% the screen still feels too bright and hurts your eyes, Adj Brightness will take care of that for you, and allow you to set the display brightness much lower.

2. Turn Off AutoSync When Not Needed

Constantly fetching data from servers is a sure shot way to drain you battery. Personally I don’t abide by this guideline because I need to know the second I get an email, but if you can get away with fetching data less frequently it’s highly recommended to improve your battery life. You can also change your data fetch settings from push, to fetch and reduce the fetch frequency; these options for fetch frequency do not apply to all account types, this option is usually always present for exchange accounts. I personally don’t use it because I am constantly using my 3G connection, however many people have benefited from the app called JuiceDefender or the paid version called UltimateJuice which allows you to change the way your device uses your 3G connection. These apps can significantly improve your battery life however I strongly advice against using the app JuicePlotter made by the same company, which actively logs your battery stats. Anything that actively monitors something on your device will drain your battery, so any gains you made with JuiceDefender will be offset by JuicePlotter.

  • To turn autosync off: Home screen > long press empty space > add widget > power control > toggle the autosync icon off (one that looks like arrows going in a circle)
  • To change your data fetch settings: Home screen > menu button > settings > accounts & sync > exchange account > account settings > amount to synchronize

3. Use WiFi When Available Rather Than 3G

Most people are not aware of this, but using a WiFi connection actually uses less battery than your 3G connection. So whenever available, turn off your 3G connection and turn on WiFi. The best an easiest way to toggle these settings on/off is to get yourself a good toggle widget like PowerControlPlus (paid) or WidgetSoid2.x (free/donate version).

Level 3: Applications
After the hardware level (level 1) and the system level (level 2), come’s the real fun stuff, the apps! With a marketplace growing bigger and bigger everyday, there are a lot of apps to choose from, each one bringing their own cool features and functionality to the table. But don’t let the structure of this write up confuse you, just because applications are level three (the last layer of the computer technology hierarchy structure), they can easily be responsible for draining your battery and/or limited system resources if you are un-aware what they are doing and the proper ways to configure them. The fundamental purpose of applications is to do something that otherwise wasn’t offered by the operating system alone, that is the very reason why we go out and buy/download apps, weather it be to play a fun game, edit our pictures, or login to our favorite social networking sites, apps let us do things that is why Droid Does! However by their very nature, applications are the leachers, because the only way our apps can do things for us is at the expense of our system resources. But that’s not to say you shouldn’t install apps, who cares how well your phone performs, if you don’t use it for anything… that’s just silly!

 

So what are the ways can we can improve overall system performance on the application level?

1. Make Educated App Selections

Careful app selection is great preemptive measure to take to avoid downloading and installing apps which really drain you system resources. Always review the comments and app rating before downloading/purchasing and also try and look for apps that serve multiple functions; if you can replace three apps with one, then that’s a great app! Any app that says it monitors something, or implies its actively running, is probably something you want to avoid downloading. Anything running actively in memory is something that is using system resources constantly. Besides apps that fetch data in the background, any app that is actively running will always appear in your status bar.

 

2. Don’t Run Any Apps That Do Things Your System Already Does On Its Own

Or better put, don’t use task killers. The way the android operating system manages its own memory is very unique and is nothing like the way Windows does it. On the android platform, apps that aren’t running actively in memory, actually use 0% of your system resources; instead they sit in a completely dormant state until they are called upon; that way, the next time they load, they will actually start up faster because they are already in memory, therefore killing them preemptively doesn’t improve your battery at all, in fact it wastes your system resources… why? – because the next time that app is loaded, it will have to first load itself back into memory and then run. Furthermore, android will automatically kill your low priority apps (those that are the last on your list of recently run apps) whenever it needs more memory. For these reasons, task killers are completely redundant and shouldn’t be used on the android platform whatsoever. The only circumstance where killing an app is acceptable is if it’s actively running in memory and you can’t get it to stop through normal means. To do this, simply use androids built in memory manager, which can be found by hitting the menu button > settings > applications > running services. You can even make a shortcut to this for quick access if you like, using as an app like ShorterCut or with the default shortcut options built into many of the popular Home Launcher Replacements, like launcherpro or go launcher.

 

3. Configure Your Apps For Better System Performance

Apps that actively run in memory or constantly fetch data from servers are the ones that are really going to drain your system performance. Check you app settings to see if you can reduce the frequency in which they fetch data from servers, this also applies to widgets, like your news/weather widgets. Consider uninstalling and replacing any apps you have that constantly run active in memory for no reason.
Tweak app settings that make your phone feel faster, like speeding up how fast your launcher opens your app drawer, or transitions between your various home screens. Its also recommend that you use apps like Spare Parts which will allow you to speed up how fast your transition animations occur. Changing applications settings like these, will really help to make your phone feel snapier and give you the true benefits of all your other system tweaks and and mods.

Conclusion:

When it comes to optimizing battery life and speed, if you can learn to tackle it from all three levels, you will achieve the gains you are after. Furthermore, becoming a root user will give you ability to do all the things discussed in this thread. As a non root user you are very limited as to what you can accomplished regarding system optimization; the only things you can do as a stock ROM non rooted user, is to buy an extended battery, lower your display brightness (you can’t even use the app adj brightness), reduce the frequency your apps fetch data, and use an app like juice defender; those literally are your only good options, everything else discussed in this thread requires you to be a root user, why? – because the primary battery saving techniques on the system level, require you to have system level access, and unfortunately for you non root users, you don’t have this type of access. If you are interested in rooting, check out my post here on the reasons why you should and how you can go about doing it. Enjoy!