apk/classes.dex editing - Nexus One Q&A, Help & Troubleshooting

i'm attempting change a background by editing classes.dex of an apk
there doesn't appear to be a resource (jpg/image) for the background so i'm assuming it is set by rgb of some sort.
i found this line but i'm not sure what it refers to.
.field public static final background:I = 0x7f020001
is 0x7f020001 an offset similar to how exe's work? would it be in the resource.arsc file or xml? classes.dex or some other file.
any help appreciated

Related

Which xml file has the color for the default status bar notification text?

Which xml file has the color for the default status bar notification text?
Examples: the "usb connected", "application installed successfully" messages on the status bar.
I have tried all 9 options available in colorchangev3.jar and none of them change the color from back.
[ticker] - ARGB color for ticker notifications on the status bar
[clock] - ARGB color for the clock text
[date] - ARGB color for the date
[ongoing] - ARGB color for "Ongoing" Label
[latest] - ARGB color for "Notifications" Label
[none] - ARGB color for "No Notifications" Label
[clear] - ARGB color for text on Clear Notifications button
[network] - ARGB color for network name (T-Mobile usually)
[roam] - Not sure where this color shows up, possibly network name when roaming
Click to expand...
Click to collapse
edit: I suspect its in another jar/apk other than framework* OR services.jar.... (for example the music notification text color is in Music.apk)
lol, well I found it last night but couldn't install the apk after changing it... now interestingly I knew you posted to the thread here about resigning framework-res and I was looking through your posts to find that thread when I found this question.
So, I'll share with you if you can collaborate with me and between us we can get a modded one completed (I want ffd3d3d3 for most of my colours).
Indeed, the notification ticker, last and ongoing are all in the same xml so it's real easy.
BUT - I followed your steps in the other thread (to sign update.zip) and I got a boot loop...
Here's what I did:
using this framework
move classes.dex from framework.jar to framework-res.apk
apktool -d framework-res.apk - success
change xml
apktool -b framework-res.apk - success
move classes.dex from framework-res.apk to framework.jar
sign neither files
make update.zip
sign update.zip
install update.zip
boot loop - it's not because of the xml changes, they were small.
Note how in all of that I didn't tell you what xml... I'm not being mean I just need to trade... can we collaborate to get this thing working? I need it for Kang-o-rama...
OR - should we just create a Morph for the xml, would that work?
I dont get this step: framework-res.apk does not have a classes.dex right?
move classes.dex from framework-res.apk to framework.jar
Click to expand...
Click to collapse
britoso said:
I dont get this step: framework-res.apk does not have a classes.dex right?
Click to expand...
Click to collapse
No... but it wont backsmali (apktool decode) without the java classes which are in framework.jar (at least they are in the one linked above) so I took that out of that file and dumped it in framework-res.apk (.jar and .apk are only containers). Perhaps with apktool there's a command line to point to an external class file but I'm not aware of it.
I don't actually know if the other dependencies will work with classes.dex contained in framework-res.apk so I moved it back to framework.jar after rebuilding the apk.
But now I don't know (trial and all error so far) if I need to sign all of the dependencies with the same sig, the zip file or what.
I'm confused by the advice in the other thread (if I understood it correctly) to not sign the framework-res.apk and only the .zip - because an unsigned manifest will get rejected by the system at boot (even if not at installation). lol - I have boot loop logs to prove it...
Code:
E/ActivityThread( 526): Failed to find provider info for settings
W/dalvikvm( 526): threadid=31: thread exiting with uncaught exception (group=0x4001b1d0)
E/AndroidRuntime( 526): Uncaught handler: thread PowerManagerService exiting due to uncaught exception
E/AndroidRuntime( 526): *** EXCEPTION IN SYSTEM PROCESS. System will crash.
java -jar apktool.jar b framework-res.apk-decoded
where framework-res.apk-decoded is a folder, works fine for me.
are you referring to the instructions at http://forum.xda-developers.com/showpost.php?p=6334671&postcount=11 ?
britoso said:
java -jar apktool.jar b framework-res.apk-decoded
where framework-res.apk-decoded is a folder, works fine for me.
are you referring to the instructions at http://forum.xda-developers.com/showpost.php?p=6334671&postcount=11 ?
Click to expand...
Click to collapse
Different thread, same instructions... using those instructions the AndroidManifest.xml file in framework-res.apk doesn't get signed so I can't see how it's ever loaded by the system...
Oh, I can build the file okay... but apktool can't decode the one I'm using properly unless I add the classes.dex file to it...
INFO: Baksmaling...
Exception in thread "main" org.jf.dexlib.DexFile$NoClassesDexException: zip file framework-res.apk does not contain a classes.dex file
Click to expand...
Click to collapse
Oh, and the file you're looking for is status_bar.xml in /res/layout/ <- this is only for the main notification ticker (in the status bar).
Although, I've just hex edited the colours and flashed a new rom with it and it did nothing at all. I'll verify my work but this leads me to suspect that the new spare parts is overwriting these defaults with it's own defaults... which could make this a painful tracing exercise. I might need to try and trace the source code which I'd like to avoid.
djmcnz said:
apktool can't decode the one I'm using properly unless I add the classes.dex file to it...
Click to expand...
Click to collapse
use the -s option, it will work
d[ecode] [-s|--no-src] [-r|--no-res] <file.apk> <dir>
Decode <file.apk> to <dir>.
-s, --no-src
Do not decode sources.
-r, --no-res
Do not decode resources.
Click to expand...
Click to collapse
Thanks for the tip, will be interested to see it working.
britoso said:
use the -s option, it will work
Thanks for the tip, will be interested to see it working.
Click to expand...
Click to collapse
lol, so simple.
Okay, I've verified that I did patch the file correctly (I pulled it from my phone, decoded it and checked the xml). My hex edits were made correctly to the xml but they had no effect whatsoever. This, I assume, means that the way the new Spare Parts (with the colour picker) works is different and status_bar.xml is no longer the primary source of the default colours. This means existing morphs, hex edits, colorchange.jar and themes may apply but have no effect. Since there's a track record of Wysie's Spare Parts code being rolled into Cyanogen's source it seems that this might be a long term consideration.
So, I'm going to try and trace the replacement defaults (and I don't think it will simply be in spareparts.apk)... I might ping Wysie...
If you're using an older framework then I imagine you'll have more positive results.
In some respects this may be good because the date is set to:
Code:
android:textColor="?textColorPrimaryInverse"
Which would be impossible to hex edit.
Thanks for the tip on apktool!
britoso said:
Which xml file has the color for the default status bar notification text?
Examples: the "usb connected", "application installed successfully" messages on the status bar.
Click to expand...
Click to collapse
Okay mate, I've got it working thanks to some pointers from wysie.
It's all changed, the xml is no longer used. No more simple morphs but I expect that this will just mean two version float around in the wild.
Key defaults are now in the code, services.jar - specifically StatusBarService.java. Two constants are established "blackcolor" and "whitecolor" and simply inserted where needed. You can change the value of the constants or simply change how they're inserted (which is the approach I took).
For a "complete" change, you need to also modify the Spare Parts app so that the "Reset UI Tweaks" defaults to the new order of things as implemented in services.jar.
Hopefully I'll be releasing a version of Kang-o-rama today that will include these mods, feel free to kang them if you want to save some effort!
cool, will be nice to finally have this missing piece

[GUIDE] T-mobile theme engine for the faint at heart (non-linux users)

Hi guys,
This is a guide I put together to make themes for the T-Mobile theme engine based mostly on what i've figured out by digging into haxzamatic's awesome template.
This does not require you to be on linux or whatever.
This is mainly a temporary guide till an Eclipse template for the engine is released, or for those who dont want to use eclipse, etc.
Requirements:
-You should know how to decompile/recompile/sign apk files.
-You should know some basic xml editing and theming.
-basic terminal commands
-You must install the framework for apktool, navigate to the folder containing framework-res.apk and execute -
apktool if framework-res.apk
GUIDE:
1. Get the compiled Templatebread from here: http://bit.ly/hdEWsf
2. Decompile it with apktool or whatever you use.
3. Open the AndroidManifest.xml
4. Change the names according to your theme. Here's my manifest for my NTSense theme:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest android:hasCode="false" android:versionCode="2" android:versionName="1.1" android:installLocation="internalOnly" package="com.nhnt11.theme.ntsense"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:pluto="http://www.w3.org/2001/pluto.html">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9" />
<application android:label="@string/theme_name" android:icon="@drawable/icon">
<activity android:label="@string/theme_name" android:name="com.tmobile.theme.Foo" />
</application>
<theme pluto:themeId="NTSense" pluto:styleId="@style/NTSense" pluto:name="@string/theme_name" pluto:preview="\@drawable/preview" pluto:author="@string/author" pluto:copyright="@string/copyright" pluto:wallpaperImage="@drawable/wallpaper" pluto:styleName="@string/style_appearance_name" pluto:ringtoneName="Standard" pluto:ringtoneFileName="media/audio/ringtones/Standard.mp3" pluto:notificationRingtoneName="Subtle" pluto:notificationRingtoneFileName="media/audio/notifications/Subtle.mp3" />
</manifest>
Note that the template xml file has "pluto:name="\@string/theme_name" - you need to remove this backslash, its a typo. it should be just "@string/theme_name" Should not be needed using latest version of apktool.
More detail about stuff in the manifest in 2nd post.
5. Open /res/values/strings.xml. Edit to match your theme. Here's mine again:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="app_name">NTSense Theme</string>
<string name="theme_name">NTSense</string>
<string name="style_appearance_name">NTSense</string>
<string name="author">nhnt11</string>
<string name="copyright">nhnt11</string>
</resources>
6. Same for /res/values/styles.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<style name="NTSense" parent="@android:style/Theme" />
</resources>
NOTE: the name of your style must be the same as the pluto:styleID in the manifest!!!
7. Now, if you are making a theme from scratch, go ahead and just edit the images already in the hdpi folder. compile and sign. done. But, read on anyway because i explain how the theme engine works below.
If you want to port a theme, here's what to do:
First, go ahead and delete all the drawable folders. Now, copy your THEMED drawable folders into the directory. You now have to add the following to your theme:
/res/drawable-_dpi/preview.png (prefarably hdpi I guess) (I suggest that you DO NOT remove the backslash in the manifest as different locations of preview.png do not work on different screen sized devices. RETAIN the backslash!! Your theme will not have a preview, but this is a small trade off to get themes working if you're not on linux.)
/res/drawable/wallpaper.png (this can be in drawable-_dpi for different screen res. too)
/res/drawable-_dpi/icon.png.
More detail on those in the second post.
8. Now go to /res/xml - there are a ton of xml's here. Open redirections.xml.
Here, there are entries for specifying which XML redirects which app. Add entries like so:
<package-redirections android:name="<app package name here>"
android:minSdkVersion="7"
android:resource="@xml/your_xml_file(without '.xml' at the end)" />
You have now specified that you want resources in <app> to be redirected based on what's in your_xml_file. Where and what is this your_xml_file and how do you add/modify it? That's what the rest of the xml's in the res/xml folder are.
The rest of these xmls are the heart of the theme engine. How they work is, when android asks for an image or other resource, they come in and switch that resource for your themed one. So its sort of like a proxy server.
Each xml contains the redirections for an app.
For example, redirections to framework-res.apk are in android.xml, and SystemUI is in com_android_systemui.xml
Delete files corresponding to apps you have not themed (for consistency, you might also want to delete the corresponding entry in redirections.xml. If you don't know how, just leave it). You can also add apps by using the convention, <package name>.xml where dots in the package name are separated by underscores, ie. your_package_name.xml for your.package.name
Package names of apps can be found in their respective AndroidManifest.xml's after decompiling. See 2nd post for more detail.
To redirect files, for eg. title_bar_portrait.9.png, just add the item to the systemui xml like so:
Code:
<item name="drawable/title_bar_portrait">@drawable/title_bar_portrait</item>
Note: To make it easy to add hundreds of drawables, I've written a little xml generator - here
Here, the "name" part tells the theme engine WHAT you're replacing.
the part inside the item tag ("@drawable/title_..... in this case") tells it WHAT to replace it with.
In all android packages, the @ sign means that you are referring to a resource in the package. Also, you can refer to a general system-wide resource by using @android:<whatever>
for example, you can replace the above title_bar_portrait with statusbar_background thats already in the android framework like so:
Code:
<item name="drawable/title_bar_portrait">@android:drawable/statusbar_background</item>
After the @ symbol, you have to specify the type of resource. in this case, "drawable".
Note that because the @ symbol refers to something INSIDE your package, you SHOULD NOT use it in the item name="<blablabla>" part.
See Variables in the second post for more detail.
Back to the xmls.
Pretty much all images are ALREADY entered in the xml. Just do a find and replace and get rid of all the "frameworks_res_" and "com_android_systemui_"
for eg, it already has <item name="drawable/title_bar_portrait">@drawable/com_android_systemui_title_bar_portrait</item>, so you need to get rid of the "com_android_systemui_" part.
Actually the professional/clean way to do it would be to rename all of your files to include "package_to_which_it_belongs_" at the front of the filename for better organisation. if you have the time and patience, do it this way!!!!
9. Delete the /res/values/public.xml. Its useless and annoying while compiling. It will be regenerated while compiling.
10. Try to compile the apk. you will probably get errors, because although all the resources are listed in the android.xml (or whatever) you deleted the HDPI folder so many might be missing! it will print what is missing when you compile though, so just go ahead and delete those lines.
11. you can also re-map styles, colors, drawables, etc.. for eg. battery percentage, add this to android.xml after putting the required battery xml in res/drawable:
<item name="drawable/stat_sys_battery">@drawable/stat_sys_battery</item>
also for a color, just add it to /res/values/colors.xml and then in android.xml, add
<item name="color/[name of color]">@color/[name of your color]</item>
See variables in the second post for more info.
12. Sign your compiled apk, and install it! If all goes well you will be able to apply and see the changes after you reboot.
Hope this helped!
More detail
Stuff in the Manifest
The manifest contains several general properties of your app file.
The following are a few which are referenced here.
To change the ringtone: Just put your desired ringtones/notification sound in /assets/media/audio/<Ringtones/Notifications> To prevent your theme from changing the ringtones, delete the corresponding lines from AndroidManifest.xml. I'm sure you can figure out which lines to delete. Also, you can remove the /assets folder, unless you have some other asset in it. (in which case just delete the ringtone buried inside as mentioned above)
Your theme's wallpaper is set to /res/drawable/wallpaper.png. Again, remove the required line from AndroidManifest.xml to make sure you dont mess up your users'wallpapers.
Your theme's theme chooser preview is set to /res/drawable/preview.png. (NEW - I suggest that you DO NOT remove the backslash from the manifest! (see first post))
The icon of your theme's apk file is set to /res/drawable-_dpi/icon.png. You should have an icon for at least one screen-size (preferably hdpi), but its nice to have it for all three.
Variables
This is to help those who don't have dev experience. In android packages, wherever you see an "@" symbol, the part following it will refer to a variable. A variable is basically a name given to refer to a resource for convenient use.
Here are a few types of variables you should know about (note that the explanations may not apply to the theme chooser, but are general):
1. drawable
2. color
3. style
4. string
5. dimen
1. Drawables - Drawbles are, well, drawable. These are resources which android can draw. That includes your theme images, wallpaper, preview, and also stuff like the battery percentage xml's, progress bar xml's etc.
1. Colors - Colors are colors!! Duh! LOL . Anyway, in /res/values/colors.xml you will find an editable list of colors. Say you use green a lot in your theme. Instead of typing "#ff00ff00" everywhere, you can simply define a color called "green" here, by adding the following line:
Code:
<color name="green">#ff00ff00</color>
Now, you can substitute "@color/green" wherever you want to use green.
3. Styles - these are a little advanced. They allow you to define a set of attributes and apply the entire set to different components.
Here's an example style:
Code:
<style name="mytext" parent="@android:style/TextAppearance.Small">
<item name="android:textColor">#ffff0000</item>
</style>
Let's break this down -
First of all, we're naming this style "mytext".
We're saying that its parent is "@android:style/TextAppearance.Small".
This means, that it automatically inherits ALL the properties of the android system style, "TextAppearance.Small" which can be found in the styles.xml in framework-res/res/values.
Now, we're adding an item with the android attribute, "textColor". There are many attributes to choose from, you can look in the attrs.xml in framework-res/res/values. (Note that an attribute may not be applicable to every situation)
Next we're giving the text color a value - in this case, red.
Now, this style can be applied anywhere to get red text in the normal system font size for small text.
Here's an example of how to use styles: post 88.
4. Strings - Strings let you make references to text. Maybe you have your theme name everywhere, and its really long. Maybe your theme name is "supercalifragilisticexpialidocious". Well, you dont want to type that every time. So you can add the following to /res/values/strings.xml:
Code:
<string name="myname">supercalifragilisticexpialidocious</string>
Now, wherever you want to use the word "supercalifragilisticexpialidocious", just substitute it with "@string/myname". And it will use whatever you defined for "myname" there.
5. Dimensions - These store values for sizes and so on. For example, its an easy way to remember a custom text size that you need a lot. Add the following to "/res/values/dimens.xml" (this does not exist by default)
Code:
<dimen name="mysize">33.4sp</dimen>
This will allow you to use the font size 33.4 by substituting "@dimen/mysize" wherever you want. For sizes in pixels, use "____.__dip" instead of "sp".
Comments
Comments are useful little dev tools. Comments basically let a developer (but they're useful to themers too) make comments in the code. Basically, the syntax of a comment (more on that in just a bit) tells the compiler to ignore that line(s). A side effect is that you can "comment" parts of your code - which means that you are marking it as a comment - which are not used (or not yet ready to be used), before compiling and releasing, while retaining the old code for future reference.
How to make a comment in xml files:
Simply surround the code you want to comment with "<!-- ......... -->.
The "<!--" part tells the compiler where a comment starts, and "-->" tells it where the comment ends.
More stuff will come here as I think of it.
I received many error:
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_input_selected.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_disabled.9.png malformed.
No marked region found along edge.
Found along top edge.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_disabled.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_disabled_focused.9.png malformed.
Frame pixels must be either solid or transparent (not intermediate alphas).
Found at pixel #8 along top edge.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_disabled_focused.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_normal.9.png malformed.
No marked region found along edge.
Found along top edge.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_normal.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_pressed.9.png malformed.
No marked region found along edge.
Found along top edge.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_pressed.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_selected.9.png malformed.
No marked region found along edge.
Found along top edge.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_selected.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-land-hdpi\frameworks_res_title_bar.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-land-hdpi\frameworks_res_title_bar.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_medium.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_medium.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-land-hdpi\frameworks_res_title_bar_medium.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-land-hdpi\frameworks_res_title_bar_medium.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_portrait.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_portrait.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_portrait_cust.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_portrait_cust.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_shadow.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_shadow.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_tall.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_tall.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-land-hdpi\frameworks_res_title_bar_tall.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-land-hdpi\frameworks_res_title_bar_tall.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_toast_frame.9.png malformed.
No marked region found along edge.
Found along top edge.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_toast_frame.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_zoom_plate.9.png malformed.
No marked region found along edge.
Found along top edge.
Look up nine-patch pngs. Theres plenty of information about them. You didn't properly edit the nine-patch images (ending with .9.png)
Sent from my HTC Wildfire using XDA App
If i replaced some pngs with other my prefer pngs, then resigned, everything was OK. But if i wanted to add new pngs, i got that errors!
Strange... you shouldn't be getting nine-patch errors if you simply added some extra pngs. are you SURE you're doing it right?
Did you add the pngs from an already compiled framework or did you decompile them? or did you make them from scratch?
What OS are you using to build your theme apks? Are you using Windows?
No i'm on a hackintosh setup, why?
I'm limited to Windows, and the t-mo engine requires a special aapt, which has not been compiled for Windows to my knowledge.
Yeah, I heard about that. But I'm using the normal non-t-mobile aapt that came bundled with apktool, and it works fine for me.
Edit: AFAIK, you only need the T-mo aapt the first time you compile, after that decompiling and recompiling with apktool works. Correct me if I'm wrong please.
Gah! I've been led astray. I've been talking with one of the developers to ask for features, and learn more about the engine. I just didn't bother trying to build a theme, because of what I learned about the aapt change.
FYI to all t-mobile engine themers:
There are currently 2 "skinning" implementations on the table before Google. T-mo's current implementation is not the favored one. Currently, the t-mo team is working on a new engine that will hopefully make Google happy (or happier).
Sony-Ericson is developing the other concept, but it is not ready for inclusion into AOSP either. While they have Google's attention, their approach is currently focused on OEM skinning. (i.e. no root = no skinning)
Confirming, I just recompiled my theme in windows using apktool. It compiles and applies fine. This guide is valid for all OSes.
By the way, Just wanted to mention that like i said in the first post, this is sort of a temporary workaround for theming. Not in any way the best way to do it, but it's clean (at least, almost) and it works, and is, in my opinion, far more convenient than modifying and releasing and reflashing system files all the time.
nhnt11 said:
<snip> it works, and is, in my opinion, far more convenient than modifying and releasing and reflashing system files all the time.
Click to expand...
Click to collapse
I completely agree there.
I went looking into the CM source. I think an uber-genius avoided the need to the custom aapt. Sweet!
Now to have some fun...
BTW, I'm looking to put together something so "we" can share parts of themes (i.e. pack up UI changes, icon sets, mods, etc. in separate zips). Then people could mix and match to one's liking. (Based off the concepts from apk manager 4.9, ZipThemer, and my own special sauce.)
Cool! Looking forward to what you come up with. I was actually thinking kind of the same thing, like, making a base theme, and then being able to have add on packs to override only a few things in the theme like icons, etc.
Sent from my HTC Wildfire using XDA App
I'm after simple and straightforward.
You unpack the apk you want to theme/skin in directory <package name>, make your changes, then delete all the unchanged files. ZIP up one more more of these package trees, and distribute.
To build a theme/skin of your very own, download the ZIPs you like, combine (resolve 'conflicts'), package, and voila.
The BIG advantage of my approach will be that you won't have to do squat with file names! The program will take care of that for you.
Hmmm, that would work, pretty straightforward way to share resources between theme devs.
But what I think would be cool is if we could make packages for users to apply ON TOP of an already applied theme. That would obviously need to be implemented in the theme engine though.
Sent from my HTC Wildfire using XDA App
nhnt11 said:
Hmmm, that would work, pretty straightforward way to share resources between theme devs.
But what I think would be cool is if we could make packages for users to apply ON TOP of an already applied theme. That would obviously need to be implemented in the theme engine though.
Click to expand...
Click to collapse
http://code.google.com/p/cyanogenmod/issues/detail?id=2812
The reason I got in touch with the t-mo dev was so I could toss in my 2 cents. He liked the idea, but he is concerned that, for a simple user, it could be too complicated and/or confusing. Adding support for multiple APKs to ThemeManager would not be difficult. It is that Theme Chooser needs a user friendly UI that can handle multiple APKs and overlaps/conflicts. (I have in my minds eye what one could/would look like. I'm just not going to be the one writing it.)
It can't be that hard, as you said, or even complicated for a user. Two menus - one with full themes, one with addons (maybe a special flag in the package indicating what it is). All addons override everything in the theme with what they have. And you can order applied addons to prioritize which gets the final say. That's it. Not too confusing IMO.
Sent from my HTC Wildfire using XDA App
nhnt11 said:
It can't be that hard, as you said, or even complicated for a user. Two menus - one with full themes, one with addons (maybe a special flag in the package indicating what it is). All addons override everything in the theme with what they have. And you can order applied addons to prioritize which gets the final say. That's it. Not too confusing IMO.
Click to expand...
Click to collapse
I didn't think 2 listings are needed. Good naming and descriptions would be extremely helpful, but not actually required.
Just 1 multi-select "list" (could be like the current chooser with a check box added). Then an ordering screen only if an overlap is detected.
I get this error in apktool. There is more to it but I didnt include it because it was so long and just repeats of beginning only to different files.
C:\Program Files\Android\android-sdk-windows\tools\com.fyb3roptik.theme.androidi
an\res\drawable\zzz_btn_application_selector.xml:4: error: Error: No resource fo
und that matches the given name (at 'drawable' with value '@drawable/pressed_app
lication_background_static').
C:\Program Files\Android\android-sdk-windows\tools\com.fyb3roptik.theme.androidi
an\res\drawable\zzz_btn_application_selector.xml:5: error: Error: No resource fo
und that matches the given name (at 'drawable' with value '@drawable/focused_app
lication_background_static').
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutExce
ption: could not exec command: [aapt, p, -F, C:\DOCUME~1\Nate\LOCALS~1\Temp\APKT
OOL2146181265913808293.tmp, -x, -I, C:\Documents and Settings\Nate\apktool\frame
work\1.apk, -S, C:\Program Files\Android\android-sdk-windows\tools\com.fyb3ropti
k.theme.androidian\res, -M, C:\Program Files\Android\android-sdk-windows\tools\c
om.fyb3roptik.theme.androidian\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(Unknown Source)
at brut.androlib.Androlib.buildResourcesFull(Unknown Source)
at brut.androlib.Androlib.buildResources(Unknown Source)
at brut.androlib.Androlib.build(Unknown Source)
at brut.androlib.Androlib.build(Unknown Source)
at brut.apktool.Main.cmdBuild(Unknown Source)
at brut.apktool.Main.main(Unknown Source)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\D
OCUME~1\Nate\LOCALS~1\Temp\APKTOOL2146181265913808293.tmp, -x, -I, C:\Documents
and Settings\Nate\apktool\framework\1.apk, -S, C:\Program Files\Android\android-
sdk-windows\tools\com.fyb3roptik.theme.androidian\res, -M, C:\Program Files\Andr
oid\android-sdk-windows\tools\com.fyb3roptik.theme.androidian\AndroidManifest.xm
l]
at brut.util.OS.exec(Unknown Source)
... 7 more
Can anyone help please? Thanks!

[Tool] nhnt11's XML Generator Revived V2+Extended UPDATED!

Hey guys, I had made a tutorial video on how to edit xml files and using nhnt11's xml generator found here: http://www.youtube.com/watch?v=xObYfIynRlw
In this tutorial I covered a lot of how to edit xml files. I also covered some issues wrong with this xml generator. One viewer of my tutorial, who goes by the name of fcknghst here on xda, was kind enough to listen to problems I explained and is in the process of fixing these issues to have a more complete xml generator. He told me I could post the fixed file here. Originally, nhnt11's xml generator was great except for a few small issues. For 1, it would skip images/lines in the generated xml of # 9s. 2nd the xml line would be set to drawable which would make it a pain to go through and edit all the mipmap images from drawable to mipmap. The way this works, as I understand it, everything is pretty much the same except with a few added Operators. The commands are as follows for the operators:
Code:
[B]Operator Codes:[/B]
Drawable: -d
Mipmap: -m
Complete xml drawable: -df
Complete xml mipmap: -mf
So now new commands should look like this:
Code:
java -jar XMLGenerator2.jar <package names separated by spaces> [operator] <input directory> <output file>
Thank you so much for listening to me and helping us out with this, I do not take credit for this, credit goes to the original xml generator dev nhnt11 and bug fixes by fcknghst.
Download Link​There was a minor update and the download link was updated so you want to get the XMLGenerator2(1).zip, it is more common package name friendly now!!!
Here is the README:
Code:
I claim no ownership for this script.
This script was created by Nihanth (nhnt11 @xda)
Only bug fixed and "extended" by Foster Buster (fcknghst @xda)
---------------------------------------------------------------------
Some basic documentation:
Usage: java -jar XMLGenerator2.jar <package names separated by spaces> [operator] <input directory> <output file>
An example could be that I wanted a ready-made xml of files from the package "com_mycats_areawesome":
And if I wrote java -jar XMLGenerator2.jar -df something something.xml
it would output <item name="drawable/com_mycats_areawesome_something">@drawable/com_mycats_areawesome_something</item>
Which is not correct.
It should be <item name="drawable/something">@drawable/com_mycats_areawesome_something</item>
This is because the package "com_mycats_areawesome" is not included in this script (see included packages at the bottom of this document).
Now if I wrote java -jar XMLGenerator2.jar com_mycats_areawesome -df something something.xml
It would give the correct output.
You can always add more package names in the source (Main.java), or perhaps write yourself a nifty little batch script.
The operators are as follows:
-d = Writes it as "drawable"
-m = Writes it as "mipmap"
-df = Writes it as "drawable", and makes it a complete xml-file.
-mf = Writes it as "drawable", and makes it a complete xml-file.
Not using a operator will result in an empty file.
If you at some point forget this, just type "java -jar XMLGenerator2.jar" into the command prompt and it will list how to use the script.
If you dont feel like typing "XMLGenerator2.jar" every time, you can always rename it to whatever.
Package names already included: (There will properly never be any need for some of them, but it was an automated process :))
app_fastfacebook_com
cn_wps_moffice_eng
com_accuweather_android
com_adobe_flashplayer
com_adobe_psmobile
com_adobe_reader
com_alphonso_pulse
com_amazon_venezia
com_anddoes_launcher
com_andrew_apollo
com_android_bluetooth
com_android_browser
com_android_calculator2
com_android_calendar
com_android_camera
com_android_chrome
com_android_contacts
com_android_deskclock
com_android_development
com_android_dreams
com_android_email
com_android_fm
com_android_gallery3d
com_android_inputmethod_latin
com_android_launcher
com_android_mifileexplorer
com_android_mms
com_android_music
com_android_phone
com_android_providers_calendar
com_android_providers_downloads_ui
com_android_quicksearchbox
com_android_settings
com_android_stk_
com_android_systemui
com_android_vending
com_android_videoeditor
com_android_voicedialer
com_android_wallpaper
com_android_wallpaper_livepicker
com_antivirus
com_anydo
com_apdroid_tabtalk
com_appspot_swisscodemonkeys_apps
com_baked_romcontrol
com_baked_walls
com_bel_android_dspmanager
com_bellmo_selfserve
com_bigeyes0x0_trickstermod
com_bigtincan_android_adfree
com_booking
com_box_android
com_bsplayer_bspandroid_free
com_citc_wallbase
com_citc_weather
com_clov4r_android_nil
com_cooliris_media
com_cyandelta
com_cyanogenmod_filemanager
com_cyanogenmod_settings_device
com_cyanogenmod_trebuchet
com_cyanogenmod_updater
com_dataviz_docstogo
com_derkernel_tkt
com_dropbox_android
com_drx2_bootmanager
com_duduapps_craigslistfree
com_dwdesign_tweetings
com_dynamixsoftware_printershare
com_ebay_mobile
com_endomondo_android
com_espn_score_center
com_estrongs_android_pop
com_evernote
com_facebook_katana
com_facebook_orca
com_farproc_wifi_analyzer
com_fitnesskeeper_runkeeper_pro
com_floriandraschbacher_fastfiletransfer
com_flyersoft_moonreader
com_funtrigger_mp3tag
com_geogrant_bordertimes
com_glympse_android_glympse
com_google_android_apps_books
com_google_android_apps_currents
com_google_android_apps_docs
com_google_android_apps_genie_geniewidget
com_google_android_apps_googlevoice
com_google_android_apps_maps_ic
com_google_android_apps_plus
com_google_android_apps_reader
com_google_android_apps_translate
com_google_android_carhome
com_google_android_ears
com_google_android_gm
com_google_android_gm_com
com_google_android_googlequicksearchbox
com_google_android_marvin_talkback
com_google_android_talk
com_google_android_youtube
com_google_earth
com_google_zxing_client_android
com_gotv_nflgamecenter_us_lite
com_handcent_nextsms
com_handlerexploit_tweedle
com_handmark_friendcaster_chat
com_handmark_tweetcaster
com_happydroid_tweetline
com_hootsuite_droid_full_icon
com_hotfree_iheart
com_imdb_mobile
com_indeed_android_jobsearch
com_instagram_android
com_intonow
com_intsig_camscanner
com_joelapenna_foursquared
com_jrummy_liberty_toolbox
com_jv_cleanwidgets
com_jv_falcon
com_koushikdutta_rommanager
com_levelup_beautifulwidgets
com_levelup_touiteur
com_linkedin_android
com_lookout
com_manor_currentwidget
com_mapquest_android_ace
com_mathpad_mobile_android_wt_unit_
com_metago_astro
com_microsoft_skydrive
com_microsoft_smartglass
com_mobisystems_office
com_mseven_msecure
com_mxtech_videoplayer_ad
com_netflix_mediaclient
com_nimbuzz
com_nixpa_kik_video
com_noinnion_android_greader_reader
com_noshufou_android_su
com_nuance_swype_beta
com_nullsoft_winamp
com_olive_office
com_olivephone_edit
com_onelouder_baconreader
com_onelouder_tweetvision
com_onexuan_battery
com_opera_browser
com_otaupdater
com_pandora_android
com_paranoid_preferences
com_path
com_paypal_android_p2pmobile
com_picsart_studio
com_pinterest
com_platinumapps_facedroid
com_plexapp_android
com_quoord_tapatalkpro_activity
com_quoord_tapatalkrwk_activity
com_quoord_tapatalkxda_activity
com_rdio_android_ui
com_rebelvox_voxer
com_ringdroid
com_roidapp_photogrid
com_s0up_goomanager
com_sand_airdroid
com_seesmic
com_sgiggle_production
com_shazam_android
com_shinycore_picsayfree
com_skype_raider
com_smartandroidapps_audiowidget
com_socialnmobile_dictapps_notepad_color_note
com_songkick
com_spartancoders_gtok
com_speedsoftware_rootexplorer
com_spotify_mobile_android_ui
com_teamviewer_teamviewer_market_mobile
com_tenthbit_juliet
com_texty_sms_app
com_thedeck_android_app
com_threebanana_notes
com_tmobile_themechooser
com_tumblr_app
com_tweetlanes_android
com_twidroid
com_twidroydlegacy
com_twitter_android
com_uberullu_rescansd
com_utorrent_client
com_vevo
com_viber_voip
com_whatsapp
com_yahoo_mobile_client_android_im
com_yahoo_mobile_client_android_mail
de_devmil_minimaltext
de_softxperience_android_noteeverything
eu_chainfire_supersu
ext_recovery_update
flipboard_app
frameworks_res
google_android_youtube
hu_tagsoft_ttorrent_lite_
im_mercury_android
in_vineetsirohi_customwidget
intelgeen_rocketdial_trail
jackpal_androidterm
kik_android
me_sonar_androi
mobi_cyann_nstools
mobi_ifunny
mobi_mgeek_TunnyBrowser
net_cactii_flash2
net_flixster_android
net_rgruet_android_g3watchdog
net_sourceforge_subsonic_androidapp
net_zedge_android_launcher
org_adaway
org_adw_launcher
org_adwfreak_launcher
org_mozilla_firefox
org_openintents_filemanager
org_projectvoodoo_controlapp
org_zwanoo_android_speedtest
pl_solidexplorer
radiotime_player
ru_zdevs_zarchiver
usa_jersey_tvlistings
This seems like it might come in handy for some of those little issues that can arise. Thanks for the heads up!
OP Updated
great info!
Nice. Very useful tool. One has to batch rename the PNGs though first.
On Windows, if you want to batch rename, open command prompt (type cmd in search/run) and then go into the folder where all the PNGs that have to batch renamed are. Then just type this,
for %a in (*.*) do ren "%a" "prefix%a"
Click to expand...
Click to collapse
Replace the word prefix with the word you want to prefix all the PNGs with.
You can also add a postfix. Just place the postfix after %a.
dhirend_6d said:
On Windows, if you want to batch rename, open command prompt (type cmd in search/run) and then go into the folder where all the PNGs that have to batch renamed are. Then just type this
Click to expand...
Click to collapse
I just use Faststone Photo Resizer for bulk renaming.
XperienceD said:
I just use Faststone Photo Resizer for bulk renaming.
Click to expand...
Click to collapse
I use it for batch converting from Indexed and Greyscale to RGB mode.
I never tried batch renaming using Faststone.
Can it add a prefix/postfix??

[Q] Couldn't load private static inner class

I'm trying to load a class with classLoader.loadClass(). This class' package name is "com.android.inputmethod.keyboard.KeyboardView.KeyDrawParams".
It's definied as
Code:
private static class KeyDrawParams
The snippet of code that doesn't works is this
Code:
Class<?> mKeyDrawParams = lpparam.classLoader.loadClass("com.android.inputmethod.keyboard.KeyboardView$KeyDrawParams");
I've tried everything, but it still doesn't work. It seems that the classLoader doesn't find the class in the .dex file. I obtain this log in xposed
Code:
java.lang.ClassNotFoundException: Didn't find class "com.android.inputmethod.keyboard.KeyboardView$KeyDrawParams" on path: DexPathList[[zip file "/system/app/LatinIME.apk"],nativeLibraryDirectories=[/system/lib]]
Is there any problem with private static inner class? I've decompiled the apk of the keyboard with an online tool, because apktool doesn't work on my ubuntu... Do anyone know if there is an error in decompilation? (I don't find the usefulness of declaring a private static (inner) class....)
I decompiled it again. It has a completely different code-structure. I give you an advice: don't trust in online decompiling tool

combine SystemUI.apk with SystemUI.odex

I am facing issues in compiling systemui.apk and systemUI.odex files. I was porting Pixel Navigation bar for AOSP ROM of @Santhosh M. There is any to combine both the files?
If i remember right i made the Pixel navbar for Santhosh M ROM. Doesn't it work anymore? If you don't like the home button just decompile the apk and go to drawable-xxhdpi-v4 and change the ic_sysbar_home icon.
Anyway in order to combine them
1. Download baksmali. Make new folder and put the baksmali.jar and SystemUI.odex there.
2. Open command prompt in the folder where baksmali is located. Type in command prompt "adb pull /system/framework/arm" to extract the required files from the phone.
3. Type "java -jar baksmali.jar deodex SystemUI.odex -l" in the command prompt and if it successful there should be an output folder called "out". Copy it and paste it to the decompiled SystemUI.apk then rename it "smali"
4. Get the required odex files from Pixel's SystemUI(tho' i would recommend you to get them from the already modified systemUI as it usually generates the same number IDs so you wont have to deal with odex file changes).
5. Paste them to smali/com/google/android/systemui(if i remember right you had to create google/android/systemui folders so no worries if they are missing)
6.Recompile
I'd advise you to use this tutorial as it is way more detailed.
Sashko98 said:
If i remember right i made the Pixel navbar for Santhosh M ROM. Doesn't it work anymore? If you don't like the home button just decompile the apk and go to drawable-xxhdpi-v4 and change the ic_sysbar_home icon.
Anyway in order to combine them
1. Download baksmali. Make new folder and put the baksmali.jar and SystemUI.odex there.
2. Open command prompt in the folder where baksmali is located. Type in command prompt "adb pull /system/framework/arm" to extract the required files from the phone.
3. Type "java -jar baksmali.jar deodex SystemUI.odex -l" in the command prompt and if it successful there should be an output folder called "out". Copy it and paste it to the decompiled SystemUI.apk then rename it "smali"
4. Get the required odex files from Pixel's SystemUI(tho' i would recommend you to get them from the already modified systemUI as it usually generates the same number IDs so you wont have to deal with odex file changes).
5. Paste them to smali/com/google/android/systemui(if i remember right you had to create google/android/systemui folders so no worries if they are missing)
6.Recompile
I'd advise you to use this tutorial as it is way more detailed.
Click to expand...
Click to collapse
Thanks! I will be trying this out today. You developed Pixel Nav bars and the thing is you made it for January build. This is April so I have seen that it doesn't works. We need to decompile the systemui.apk again and again Change the ID and other things.
I have ported pixel Navbars for LineageOS. It was easy and today, I stuck in this steps.
I just followed your tutorial and I got this error
C:\Users\Xaif\Desktop\Baksmali\framework>java -jar baksmali.jar deodex SystemUI.
odex -x
usage: java -jar baksmali.jar [options] <dex-file>
disassembles and/or dumps a dex file
-?,--help prints the help message then exits.
Specify twice for debug options
-a,--api-level <API_LEVEL> The numeric api-level of the file
being disassembled. If not
specified, it defaults to 15 (ICS).
-b,--no-debug-info don't write out debug info (.local,
.param, .line, etc.)
-c,--bootclasspath <BOOTCLASSPATH> A colon-separated list of
bootclasspath jar/oat files to use
for analysis. Add an initial colon
to specify that the jars/oats should
be appended to the default
bootclasspath instead of replacing
it
-d,--bootclasspath-dir <DIR> the base folder to look for the
bootclasspath files in. Defaults to
the current directory
-e,--dex-file <DEX_FILE> looks for dex file named DEX_FILE,
defaults to classes.dex
-f,--code-offsets add comments to the disassembly
containing the code offset for each
address
-i,--resource-id-files <FILES> the resource ID files to use, for
analysis. A colon-separated list of
prefix=file pairs. For example
R=res/values/public.xml:android.R=$A
NDROID_HOME/platforms/android-19/dat
a/res/values/public.xml
-j,--jobs <NUM_THREADS> The number of threads to use.
Defaults to the number of cores
available, up to a maximum of 6
-k,--check-package-private-access When deodexing, use the
package-private access check when
calculating vtable indexes. It
should only be needed for 4.2.0
odexes. The functionality was
reverted for 4.2.1.
-l,--use-locals output the .locals directive with
the number of non-parameter
registers, rather than the .register
directive with the total number of
register
-m,--no-accessor-comments don't output helper comments for
synthetic accessors
-n,--normalize-virtual-methods Normalize virtual method references
to the reference the base method.
-o,--output <DIR> the directory where the disassembled
files will be placed. The default is
out
-p,--no-parameter-registers use the v<n> syntax instead of the
p<n> syntax for registers mapped to
method parameters
-r,--register-info <REGISTER_INFO_TYPES> print the specificed type(s) of
register information for each
instruction. "ARGS,DEST" is the
default if no types are specified.
Valid values are:
ALL: all pre- and post-instruction
registers.
ALLPRE: all pre-instruction
registers
ALLPOST: all post-instruction
registers
ARGS: any pre-instruction registers
used as arguments to the instruction
DEST: the post-instruction
destination register, if any
MERGE: Any pre-instruction register
has been merged from more than 1
different post-instruction register
from its predecessors
FULLMERGE: For each register that
would be printed by MERGE, also show
the incoming register types that
were merged
-s,--sequential-labels create label names using a
sequential numbering scheme per
label type, rather than using the
bytecode addressQA
-t,--implicit-references Use implicit (type-less) method and
field references
-v,--version prints the version then exits
-X,--experimental enable experimental opcodes to be
disassembled, even if they aren't
necessarily supported in the Android
runtime yet
-x,--deodex deodex the given odex file. This
option is ignored if the input file
is not an odex file
Click to expand...
Click to collapse
I also tried doing like the above given command so I followed this steps:
C:\Users\Xaif\Desktop\Baksmali\framework>java -jar baksmali.jar --deodex SystemU
I.odex -l
Error occurred while loading boot class path files. Aborting.
org.jf.util.ExceptionWithContext: Cannot locate boot class path file /system/fra
mework/core.jar
at org.jf.dexlib2.analysis.ClassPath.loadClassPathEntry(ClassPath.java:2
96)
at org.jf.dexlib2.analysis.ClassPath.fromClassPath(ClassPath.java:207)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:67)
at org.jf.baksmali.main.main(main.java:305)
C:\Users\Xaif\Desktop\Baksmali\framework>
Click to expand...
Click to collapse
I have used ApkTool for Android to deodex that file and it did it successfully. Now, I am porting again

Categories

Resources