Trailing slashes (/'s) = important - myTouch 3G, Magic Android Development

Coming from a linux background I was under the assumption that if I issued a push using adb it would realise the /sdcard/app meant into that directory - not replace that directory! Just to save some other pour soul the pleasure of learning the hard way

td0s said:
Coming from a linux background I was under the assumption that if I issued a push using adb it would realise the /sdcard/app meant into that directory - not replace that directory! Just to save some other pour soul the pleasure of learning the hard way
Click to expand...
Click to collapse
If you're coming from a linux background, it is shocking that you don't appreciate the importance of the trailing slash. Though some programs have grown to be more tolerant, the trailing slash makes a very big difference in a lot of things you do. It is always a good practice to provide the full path as you mean it.

Related

G1 Shell Commands Documentation

Greetings, as some of you may have noticed the commands from the shell on the G1 do not match up perfectly with the Linux command line. I've decided that we need some documentation on the shell commands on the G1 so that skilled and unskilled command line people can use their G1 like a pro.
I've set up a wiki that will serve this exact purpose at http://android.syntaxdeath.com/
Right now its mostly just a list of commands since I havn't had time to test them all out yet (and well half the commands just crash my phone anyway) but its a good start!
Finally, if you would like to contribute to the wiki, please follow the template that I posted at the bottom for standardization purposes (its loosely based off Man pages)
update: Running total of commands: 302
I would imagine what commands are available depends to some degree on what OS distribution you're using? Differentiating between internal (busybox) and external commands would also be useful.
/Mats
very cool..
Only trick I've found (as I haven't gotten to mess with it much), is that radiooptions 8 [somenumber] will dial [somenumber]
Craftkiller said:
Greetings, as some of you may have noticed the commands from the shell on the G1 do not match up perfectly with the Linux command line. I've decided that we need some documentation on the shell commands on the G1 so that skilled and unskilled command line people can use their G1 like a pro.
I've set up a wiki that will serve this exact purpose at http://android.syntaxdeath.com/
Right now its mostly just a list of commands since I havn't had time to test them all out yet (and well half the commands just crash my phone anyway) but its a good start!
Finally, if you would like to contribute to the wiki, please follow the template that I posted at the bottom for standardization purposes (its loosely based off Man pages)
Click to expand...
Click to collapse
would it be easier to setup the wiki info right here on XDA?
http://wiki.xda-developers.com/index.php?pagename=HTC_Dream
just might help keep the information together in one place?
I would imagine what commands are available depends to some degree on what OS distribution you're using? Differentiating between internal (busybox) and external commands would also be useful.
Click to expand...
Click to collapse
That is true, right now I am running the most recent version of JF so I based it off that... as for separating them, its a good idea, but I'd like to hold off till I finish documenting more commands b4 I try to do that stuff.
very cool..
Only trick I've found (as I haven't gotten to mess with it much), is that radiooptions 8 [somenumber] will dial [somenumber]
Click to expand...
Click to collapse
Awesome, I'll document radiooptions next
would it be easier to setup the wiki info right here on XDA?
http://wiki.xda-developers.com/index...name=HTC_Dream
just might help keep the information together in one place?
Click to expand...
Click to collapse
That could work also. I'm just a newbie to this whole site so I figured I shouldn't start touching whats already great here. I imagine it would be extremely easy to copy this stuff over to that wiki or we could just provide a link... either way, I'll let the forum demigods decide since right now it might appear as spam since so few commands are documented.
this is a great thread, i had planned on doing this but never got around to it, if i can find my printout i have many of the commands already documented. never got radio options to work, but i ran it through the adb shell, will give the onboard terminal a run through later. as most of you know the commands available can be found by typing
ls /system/bin /system/xbin /system/xbin/bb
that will tell you what commands you can use. i'll have more later when i get to my comp.
HAPPY ST. PAT'S
tubaking182 said:
this is a great thread, i had planned on doing this but never got around to it, if i can find my printout i have many of the commands already documented. never got radio options to work, but i ran it through the adb shell, will give the onboard terminal a run through later. as most of you know the commands available can be found by typing
ls /system/bin /system/xbin /system/xbin/bb
that will tell you what commands you can use. i'll have more later when i get to my comp.
HAPPY ST. PAT'S
Click to expand...
Click to collapse
Oh wow, I didn't even bother to check xbin and xbin/bb.... I'll add these commands to the list!
btw on JF using terminal emulator I was able to use radiooptions to start a call
Ok, I've added the new commands to the list bringing the total to 302 commands.... and i've only got like 6 documented so far... =(
sounds good, i am on my way over to your page to see what i can help with
edit: added several commands to the page, will add more in an hour or so
haha thank you! I was about to install ubuntu so I could do a nandroid backup on my phone b4 testing out wipe but it seems you've already done the dangerous part first! much appreciated =)
you can do a nandroid backup and flash in windows, someone here had the correct sutup for windows somewhere, but i don't know where it's at since i use ubuntu. the only reason i even tried the command was so that i could document a few things for myself, i had a piece of paper somewhere that i can't find now where i had written out all the commands and highlighted them according to danger for n00bs and also had what they did, or at least a good portion of them. wipe is dangerous for n00bs and so i will only suggest it in the most DIRE emergency cases, i had to do it cause my phone died and i was a n00b on this phone and decided that it would be easier to wipe it than try to find the correct stuff to get it back to factory settings. i discovered it works well for those having issues booting or other such. and that command is one of the many reasons to keep a copy of the latest JF rom on your SD card. going back to add a few more now
perhaps it would be a good idea to sort the commands by the directory theyre in on the wiki page.
that was actually already on my list of things to do, i will probably get it tomorrow sometime unless someone beats me to it
the $PATH var should help with catching some of the more obscure ones...
$ echo $PATH
/usr/bin:/usr/sbin:/bin:/sbin:/system/sbin:/system/bin:/system/xbin:/system/xbin/bb:/data/local/bin

GUIDE: In the beginning... There was ROOT

So you’ve got a nice, shiny, new G1 and you’ve been hearing about all the amazing things you can do with it but you “MUST HAVE ROOT”. As far as you know, you’re not a plant (although you may feel as smart as one at this point) and beyond that, you have no clue what any of the terms or concepts mean in context.
Well, I’m bored so I’m going to try and clear some things up.
There are a lot of threads that cover each of these things but I’m going to try and put as many basics into one post as possible. Hopefully it can be a perfect start for n00bs and good reference in lieu of search for others. Please feel free to correct any semantic (or blatant) mistakes I make.
I’ll keep the glossary here and update terms as I add to this post:
Android OS - Like Windows Mobile but based on Linux, using a Java based front end.
Linux - Open Source operating system used instead of Windows XP/Vista, Mac OSX etc... it's free (as in beer).
Open Source (From Wiki) – Free and open source software, also F/OSS, FOSS, or FLOSS (free/libre/open source software) is software which is liberally licensed to grant the right of users to study, change, and improve its design through the availability of its source code.
Root (as in access)- root is like the administrator account on a windows machine (also referred to as su, or superuser). It allows you to have complete access to the underlying OS of a linux or *nix based machine. For the G1, it allows for the use of themes, native backup functionality, manually selecting which apps can utilize root access, auto-rotate screen, multi-touch in browser, moving applications/caches to the sd card etc...
Root (as in location)- the 'root' of a folder or drive is the top most area of that location. In windows, C:\ is the 'root' of your hard drive. The 'root' of your SD card just means you haven't moved into any subfolders.
Shell – (also heard as terminal, bash, command line) This is a loose definition, but it’s basically a command line to run specific actions against the OS.
Bootloader – the SPL and IPL of a flash based device. See jashu’s description here.
SPL (Secondary Program Loader) - You get to the SPL by holding the camera button while powering on your phone. This is where you flash NBH images. See bootloader above.
Recovery Mode - Holding the 'Home' key while while powering on the G1 will take you into Recovery Mode. From here you can perform a NANDroid backup, wipe your phone, access a command line and of course, flash your phone with an update.zip file.
RC## (or release candidate) – In context to the G1, it is an official release of Android from T-Mobile meant specifically for the G1 (not ADP).
ADP (Android Developer Phone) – A Google specific (or carrier non-specific) version of the G1/Dream that has root access by default and is meant for developers writing apps for the G1, or Android in general.
ADP vs. RC## - Neither RC’s or ADP versions are tied to their respective hardware. With the right bootloader, you can flash an ADP image to a G1 or an RC image to an ADP.
JFV1.## - Is a specific Version of a JesusFreke ROM. JesusFreke is a developer on this website that has graciously spent his time to modify the G1 OS to allow us to have root access to our phones. This gives us the ability to explore and modify our phones via a command line.
Cupcake – a development branch of the Android OS that contains many improvements that was merged into the master build of Android and is currently being released to new phones as Android 1.5.
Nandroid – a utility, accessible through Recovery Mode, that allows you to backup your phone and restore to the exact condition at backup.
Apps2SD – Applications moved to your SD card instead of internal memory. Some people like the extra room, some people don’t want to hassle with the partitioning.
Partition – just like the partitions that separate cubicles in an office, a partition separates parts of a drive.
File system – there are many. It’s basically a specific way of organizing data on a partition. FAT(32) is generally windows, ext2 is generally linux. This is not a hard and fast rule, just most common in context with what you’ll see here.
Scripts – scripts are text files that contain a list of commands to perform. Instead of typing each command out multiple times, a script can be run that will initiate all steps listed in the script.
Android SDK (System Developer’s Kit) – This includes all tools (sans fastboot) that a developer needs to create applications for the G1. It also has tools for interacting with the phone via a command line (ADB).
ADB - is a part of the SDK that allows you to run commands against the G1 in lieu of using the terminal on the phone itself.
Fastboot - is a tool used to flash system images (.img files) to the G1 from a command line on your pc. IMG files are created when you do NANDroid backups and official images can be downloaded from HTC as well. To get to fastboot mode on your phone, hold the back button while powering on.
When T-Mobile first released the G1, they left a bug in the Android OS that allowed anything typed on the keyboard to be passed on to a root shell running in the background. This really was a major flaw and needed to be patched. Unfortunately, when they patched it, they really patched it. RC29 was the last version that still had root. With all versions RC30 on, it was removed. It completely denied us any hope at modding our “open-source” phone.
Somehow, the base image for RC29 (dreaimg.nbh) was leaked and some enterprising developers were able get access to the bootloader and return an updated G1 (RC30+) to RC29 and use this to regain root.
Somewhere along this road, Google released the ADP (Android Developer Phone), which has root enabled and uses a specific SPL (EngineeringSPL) that was the base for the modified HardSPL that most of us use now. Nandroid was included to allow us to back up our phones and shortly after, JesusFreke modified RC30 to keep root and still provide the fixes and improvements that came with it.
I’m not sure where it all started, but eventually, LucidREM released a modified version of JesusFreke’s ROM. This made moving applications to SD painless and freed up system storage and now we can have 32 flashlights and 62 tip calculators installed all at once.
Apps2sd has been the bane of many peoples existence. It requires you to partition your SD card in to separate file systems (FAT32 to remain compatible with windows computers as a mass storage device and ext2 to maintain compatibility with the underlying linux OS of the G1). It also requires you to move your apps to the SD card and then create symbolic links (similar to a windows shortcut) from the internal location pointing to the SD card. Lots can go wrong in this process and that’s why LucidREM, MartinFick, MarcusMaximus04 and others have created tools to help simplify the process.
Now of course, to achieve any of the things you want to do with the G1, you have to interact with it. There are at least 2 main ways to do this. Some prefer to do everything from the phone itself using a terminal, while some prefer to use their PC with the phone connected via USB. Others avoid both of these, as best they can, and use other peoples apps or scripts anywhere they can get away with it. This is why you may find many different explanations of the same goal.
In order to interact with your phone from a pc, you need the Android SDK, which includes ADB. ADB is basically a linux shell that communicates with the G1. It is easier to copy and paste from threads and insert commands without worrying about making typos. It also requires it’s own bit of hoops to jump through (unless you use a mac or linux ;-)) and sometimes scares people away. It is highly recommended if you plan on hacking at your phone with any regularity.
Of course, there are some sadists (I once was one) that like to type line after line of code on a tiny keyboard and use the terminal directly from the phone. This is fun and it makes you feel 1337, but it also leaves a lot of room for error. Remember, you are a root user now, and any mistake you make can be potentially huge.
Well, that’s all for now folks. Please feel free to add, subtract, reorganize, correct anything I’ve said, in the comments. Also, I’ve tried to add links to any relevant threads and sources that I used in making this… this, whatever you wanna call it.
Thanks to everyone in this community for doing what you do. We are all geeks and enjoy doing this stuff. It's good to have so many talented people taking an interest in Android and the G1 in general. It is open source communites that keep technology interesting and exciting.
Thanks to Haykuro, TheDudeofLife, all the theme devs, and all the big players that I didn't reference in this post. Oh, and SolemWishing for the Timeline! It helped, thanks!
Reserved for future posting
Awesome post for nuubs. This should be permanently stickied!
Very cool. a couple terms you should add:
Fastboot
SPL
Recovery mode
(including what key strokes you need to hit to get into spl and recov. modes)
Thanks for the feedback!
I added SPL and Recovery... let me get my facts straight on fastboot and I'll add that tomorrow.
I don't know if it is the right place for it, but there seem to have been lots of question about "radio" or more specifically "radio update".
I feel smarter already.
I particularly found the file system explanation useful, i put it together that fat32 and the other were the two partitions but didnt realize which was for cpu. Not ready to attempt but definitely closer (although Im not even sure if I want to partition i have no need for all that space at this point) It doesnt affect performance does it?
Agreed. Good stuff. Definitely noob required reading material.
Yes, indeed a very nice guide for the beginners. Hell we ALL started that way...i remember when I first got this phone ~6 months ago (no root), and there was almost nothing about it, no support, no add-ons, no hacks, nothing. It was boring, and for me I was coming from a motorola (motomodders?), so going to something that was far superior but didnt have community support made me almost cry.
Though look now, 3 months later the market was filling up and being abundent of new stuff to play with (I didnt even try rooting for a while, until it became a lot more well-known [fixes and the likes], and themes became a necessity because they started to get really good), and now 6 months later people are hacking away figuring out soo much stuff about it. Amazing work everyone, seriously.
Something good: It all starts at the roots .
Well, I added info on fastboot and exceeded my 10000 character limit. Now I understand why so many people reserve the second post. lol...
I'll make some changes so I can add info about the radio, however the link to fastboot explains the radio fairly well.
Thanks for the feedback everybody, I hope this helps some people out.
skri11a said:
So you’ve got a nice, shiny, new G1 and you’ve been hearing about all the amazing things you can do with it but you “MUST HAVE ROOT”. As far as you know, you’re not a plant (although you may feel as smart as one at this point) and beyond that, you have no clue what any of the terms or concepts mean in context.
Click to expand...
Click to collapse
When i read those lines i knew that this post would be worth reading
It was a really nice n00b guide, though ive done some WiMo flashing so some of the terms sounded familliar i certanly learned a thing or two
I would say it should be stickied and put on the wiki - oh and perhaps list it in alphabetic order, it would make it more usefull as a "I dont understand this term so ill just look it up"-thread...
Perhaps you can get a mod to give you post #2 & #3
//M
DMaverick50 said:
I feel smarter already.
I particularly found the file system explanation useful, i put it together that fat32 and the other were the two partitions but didnt realize which was for cpu. Not ready to attempt but definitely closer (although Im not even sure if I want to partition i have no need for all that space at this point) It doesnt affect performance does it?
Click to expand...
Click to collapse
I'm glad it helped. As far as performance issues, I've had none. In fact, when I was skating along with 12-19MB of free space, my phone would crall and cause me all sorts of grief. Since I've moved the apps and dalvik-cache, it's been very responsive and reliable. That being said, get a GOOD sd card. I see a lot of people having problems using cheap or < class4 sd cards.
m.klinge said:
When i read those lines i knew that this post would be worth reading
It was a really nice n00b guide, though ive done some WiMo flashing so some of the terms sounded familliar i certanly learned a thing or two
I would say it should be stickied and put on the wiki - oh and perhaps list it in alphabetic order, it would make it more usefull as a "I dont understand this term so ill just look it up"-thread...
Perhaps you can get a mod to give you post #2 & #3
//M
Click to expand...
Click to collapse
lol... I'm glad you liked it.
And thanks for the tips. I'm gone for the weekend, but I'll alphabetize it when I get back. Not sure what I can do about getting it stickied but I'll look into the wiki on monday too.
can you add busybox
in the nandroid instructions it requires busybox but I didnt see an explanation for what busybox is. Thanks and this thread has already been very helpful for me
speaking of stickying this....
who is in charge of stickies? A lot of stickable topics aren't stickied and a lot of topics that should be unstickied are still stuck...
DMaverick50 said:
in the nandroid instructions it requires busybox but I didnt see an explanation for what busybox is. Thanks and this thread has already been very helpful for me
Click to expand...
Click to collapse
Hey sorry for the late reply... Been pretty busy since Friday.
I'll try and add this to the first post shortly. I may have to remove some of the history lesson if I can't get a mod to give me the second/third post.
BusyBox - This is a single executable utility that contains many common Linux commands, instead of having an individual executable for each command. As far as I know this is built into all of the JF releases, as well as Dude's. It is also usable in the JF recovery console by hitting alt-x. To use busybox, just type "busybox" in front of the command you want to use (i.e. #busybox ls -L --to get a list of your directory).
AbsoluteDesignz said:
speaking of stickying this....
who is in charge of stickies? A lot of stickable topics aren't stickied and a lot of topics that should be unstickied are still stuck...
Click to expand...
Click to collapse
If you figure this out, let me know. I haven't tried to PM a mod or anything but I'd still be curious to know what the magic requirements are.
This will definitely help a lot of newcomers. Thanks for taking the time to make it.
Way to get stickied! Now I can stop copying pasting updates worrying I might not be able to find the post...
skri11a:
BusyBox - This is a single executable utility that contains many common Linux commands, instead of having an individual executable for each command. As far as I know this is built into all of the JF releases, as well as Dude's. It is also usable in the JF recovery console by hitting alt-x. To use busybox, just type "busybox" in front of the command you want to use (i.e. #busybox ls -L --to get a list of your directory).
Click to expand...
Click to collapse
Wouldn't "Unix utilities" be more correct than "Linux commands"?
And saying Android is "like windows mobile" is blasphemy! You can't compare Unix to Micro$oft Windoze (Yes, that's a very sophisticated and mature way to express my hatred of the OS )! >:|
Anyway, it's good that you wrote this, theres probably a lot around here not having a clue about how things work in the world of unix

[THEME TOOL IDEA] Copy 9-patch from original files

While working on a ROM (for the hero), I have recently tried to do some theming by small changes (i.e. color changes) to the drawables in the framework-res.apk.
It appears the both for me, and the fellow that is helping me (floomat), these 9-patch files are giving a headache. We prefer editing them in some normal app (i.e. photoshop) but this seems to mess up the 9-patch "code".
I have written a very small program to apply the changes to a 9-patch image without disturbing the 9-patch itself. Note that this program is mainly meant as a "proof of concept" and hopefully one of the apk managing tools will pick up the ball and integrate it. In the meantime it might be useful even as it is (with some scripting around it most likely). Or it might be just a way to prove I am fool and there is simpler way to get around this I am not familiar with
"Program" and source: http://www.sendspace.com/file/sw4atc
(its really too small and simple to be called a program)
Usage:
Code:
java copy9patch original.9.png changed.png
Will copy the changes made to the changed.png over to the original.9.png but keep the 9-patch data of the original.9.png.
Its code (also included) and the way it works is very simple: It takes the size of the original image (i.e. 19x27), without the 1 pixel border with the 9-patch codes - so in our example it will be 17x25. Now it just copied the center 17x25 pixels from the changed.png over the original's center pixels. It has some very basic boundary conditions if the image sizes do not match but this could probably be handled better, possibly just by issuing an error in these cases.
If you want to use my code, change it, do whatever you like with it please do so and I'll be glad to checkout your result!
NOTE: I feel a bit uncomfortable posting this in the "G1 development" section but I see both apktool and apk manager are here....
erasmux said:
While working on a ROM (for the hero), I have recently tried to do some theming by small changes (i.e. color changes) to the drawables in the framework-res.apk.
It appears the both for me, and the fellow that is helping me (floomat), these 9-patch files are giving a headache. We prefer editing them in some normal app (i.e. photoshop) but this seems to mess up the 9-patch "code".
I have written a very small program to apply the changes to a 9-patch image without disturbing the 9-patch itself. Note that this program is mainly meant as a "proof of concept" and hopefully one of the apk managing tools will pick up the ball and integrate it. In the meantime it might be useful even as it is (with some scripting around it most likely). Or it might be just a way to prove I am fool and there is simpler way to get around this I am not familiar with
"Program" and source: http://www.sendspace.com/file/sw4atc
(its really too small and simple to be called a program)
Usage:
Code:
java copy9patch original.9.png changed.png
Will copy the changes made to the changed.png over to the original.9.png but keep the 9-patch data of the original.9.png.
Its code (also included) and the way it works is very simple: It takes the size of the original image (i.e. 19x27), without the 1 pixel border with the 9-patch codes - so in our example it will be 17x25. Now it just copied the center 17x25 pixels from the changed.png over the original's center pixels. It has some very basic boundary conditions if the image sizes do not match but this could probably be handled better, possibly just by issuing an error in these cases.
NOTE: I feel a bit uncomfortable posting this in the "G1 development" section but I see both apktool and apk manager are here....
Click to expand...
Click to collapse
Huh. I've been wondering if this was possible. I haven't tried this yet but if it works, nicely done! I think that this would be a huge improvement and addition to the themeporter programs that are out there. There is a high demand for this in that area and in the area of HDPI>MDPI/MDPI>HDPI conversion. I'm certainly bookmarking this!
Awesome, just checked out ur source, so simple but effective
Anyway wanted to ask if ur ok with me incorporating it into theme-porter ? Link
Wht im thinking is perhaps when "Hdpi to mdpi" is on, it would resize the .9.pngs by 66%, after which it would transfer the .9 data using this program so (9-patch) code is preserved.
Let me know. Thnx
FYI : Just gave it a whirl, works perfectly.
Daneshm90 said:
Awesome, just checked out ur source, so simple but effective
Anyway wanted to ask if ur ok with me incorporating it into theme-porter ? Link
Wht im thinking is perhaps when "Hdpi to mdpi" is on, it would resize the .9.pngs by 66%, after which it would transfer the .9 data using this program so (9-patch) code is preserved.
Let me know. Thnx
FYI : Just gave it a whirl, works perfectly.
Click to expand...
Click to collapse
Maybe my original post wasn't blunt enough, my code is just "proof of concept" because I am bit lazy in this department (themeing tools) - I'd rather spend my time compiling kernels (go figure ).
So my main goal for this post is for developers of apk managing tools and etc. to pick up the ball and go forward with this
And to be even clearer:
If you want to use my code, change it, do whatever you like with it please do so and I'll be glad to checkout your result!
(am also adding this to the main post)
Regarding your actual resizing idea, you might want to resize it with the 9-patch "codes" (in the 1-pixel border) because you want the codes from your original HDMI files just resized. This should work, just be careful with resizing algorithms which average pixels and such. If I understand correctly the edge pixels should be either white or black (defining stretchable and context areas). Need to play around with this until it works well.
Let me know if I can be of any further assistance.
erasmux said:
Maybe my original post wasn't blunt enough, my code is just "proof of concept" because I am bit lazy in this department (themeing tools) - I'd rather spend my time compiling kernels (go figure ).
So my main goal for this post is for developers of apk managing tools and etc. to pick up the ball and go forward with this
And to be even clearer:
If you want to use my code, change it, do whatever you like with it please do so and I'll be glad to checkout your result!
(am also adding this to the main post)
Regarding your actual resizing idea, you might want to resize it with the 9-patch "codes" (in the 1-pixel border) because you want the codes from your original HDMI files just resized. This should work, just be careful with resizing algorithms which average pixels and such. If I understand correctly the edge pixels should be either white or black (defining stretchable and context areas). Need to play around with this until it works well.
Let me know if I can be of any further assistance.
Click to expand...
Click to collapse
Hmm k i'll spend more time with it, perhaps the resizing program im using causes mishaps. Currently when i resize it completely messes stuff up even though the resolution corresponds to a mdpi device.
I'll do the good ol' trial/error n let u know. Thanks for the (proof of concept)
Edit :
Ok so upon using ur code for transferring images of diff sizes u can obviously tell whts up
So one improvement im thinking off, is if the images differ in size, it could draw the border and eliminate anything outside it. Ugh gotta brush up on my java though :S
bump
10 del al char har
bump
I tested it out and it works great! Thanks!
I really hope someone takes this idea and runs with it! If I knew how to code, I would certainly look into this. Maybe I can get one of the Vibrant Devs to look at this....
erasmux said:
While working on a ROM (for the hero), I have recently tried to do some theming by small changes (i.e. color changes) to the drawables in the framework-res.apk.
It appears the both for me, and the fellow that is helping me (floomat), these 9-patch files are giving a headache. We prefer editing them in some normal app (i.e. photoshop) but this seems to mess up the 9-patch "code".
I have written a very small program to apply the changes to a 9-patch image without disturbing the 9-patch itself. Note that this program is mainly meant as a "proof of concept" and hopefully one of the apk managing tools will pick up the ball and integrate it. In the meantime it might be useful even as it is (with some scripting around it most likely). Or it might be just a way to prove I am fool and there is simpler way to get around this I am not familiar with
"Program" and source: http://www.sendspace.com/file/sw4atc
(its really too small and simple to be called a program)
Usage:
Code:
java copy9patch original.9.png changed.png
Will copy the changes made to the changed.png over to the original.9.png but keep the 9-patch data of the original.9.png.
Its code (also included) and the way it works is very simple: It takes the size of the original image (i.e. 19x27), without the 1 pixel border with the 9-patch codes - so in our example it will be 17x25. Now it just copied the center 17x25 pixels from the changed.png over the original's center pixels. It has some very basic boundary conditions if the image sizes do not match but this could probably be handled better, possibly just by issuing an error in these cases.
If you want to use my code, change it, do whatever you like with it please do so and I'll be glad to checkout your result!
NOTE: I feel a bit uncomfortable posting this in the "G1 development" section but I see both apktool and apk manager are here....
Click to expand...
Click to collapse
Can U just tell how to use this code for bulk images?????
pratyush.creed said:
Can U just tell how to use this code for bulk images?????
Click to expand...
Click to collapse
Hmm, haven't used this for a very long time and don't really remember whats going on here.
Still attached is the version which I have on my HD, and it does support bulk images if all the images are in a folder.
If I remember correctly (mostly going by the help that is displayed by running the program without argument):
Code:
fixResPngs drawable-mdpi drawable-mdpi.org
Will go over all drawable-mdpi/*.png files (possibly also sub dirs?! I really have no idea, sorry), and "fix" each such file. If I am not mistaken it needs a "reference" file only for 9 patch files which are identified by their ".9.png" suffix (regular pngs I think are just rewritten without any change which I found improves compatibility). In case of a 9 patch file, the original file with exactly the same name should be found under the directory given in the second argument. For example: If drawable-mdpi/aaa.9.png is processed the 9-patch data will be copied from drawable-mdpi.org/aaa.9.png.
Obviously it also still works on single files. It does *not* work on lists of files or lists of directories.
If anyone is interested in the code, I am sure I have it somewhere (I hope)....
erasmux said:
Hmm, haven't used this for a very long time and don't really remember whats going on here.
Still attached is the version which I have on my HD, and it does support bulk images if all the images are in a folder.
If I remember correctly (mostly going by the help that is displayed by running the program without argument):
Code:
fixResPngs drawable-mdpi drawable-mdpi.org
Will go over all drawable-mdpi/*.png files (possibly also sub dirs?! I really have no idea, sorry), and "fix" each such file. If I am not mistaken it needs a "reference" file only for 9 patch files which are identified by their ".9.png" suffix (regular pngs I think are just rewritten without any change which I found improves compatibility). In case of a 9 patch file, the original file with exactly the same name should be found under the directory given in the second argument. For example: If drawable-mdpi/aaa.9.png is processed the 9-patch data will be copied from drawable-mdpi.org/aaa.9.png.
Obviously it also still works on single files. It does *not* work on lists of files or lists of directories.
If anyone is interested in the code, I am sure I have it somewhere (I hope)....
Click to expand...
Click to collapse
Gr8 work...u made themin a kid's job
Sent from my GT-S5670 using XDA Premium App
???
does the original still work cause im on windows 7 64 bit and i was able to copy the changes to original but not it makes no changes at all, so the original file doesnt get the changes...
please help!!

ADB Screenshotting

Found this binary that converts framebuffer dumps from /dev/graphics/fb0 into png files from the console.
http://code.google.com/p/android-fb2png/
Installed it, works pretty well. I made the following windows shell script to make screenshotting easier:
Code:
for /f "tokens=1-9 delims=/:. " %%a in ("%date% %time%") do (set stamp=%%d%%b%%c-%%e%%f%%g%%h)
adb shell /data/local/fb2png /sdcard/dcim/%stamp%.png
adb pull /sdcard/dcim/%stamp%.png %userprofile%\desktop\%stamp%.png
that whole %%d%%b%%c-%%e%%f%%g%%h madness formats the file name into YearMonthDay-HourMinuteSecondMillisecond.png so that they are always unique.
Hope someone finds this as useful as I did
combustiblemonkey said:
that whole %%d%%b%%c-%%e%%f%%g%%h madness formats the file name into YearMonthDay-HourMinuteSecondMillisecond.png so that they are always unique.
Hope someone finds this as useful as I did
Click to expand...
Click to collapse
Funny, I spent part of the day hacking together some date + batch foolishness.
Nice job. Should make documentation a lot easier.

Terminal/Script/ADB Cheat Sheet

I made this for my own reference and would like some experienced users to critique it (please don't laugh) and help me add to it. This is a first draft replacing the "napkin" I've got tucked under my keyboard. Specifically simple for newbes like myself to just help us get started with Terminal, Scripting, ADB and have a command reference to follow.
Please chim in on the ADB section which I know needs some serious help. I have almost no experience with ADB but seek to learn and document more so its useful. Or if something already exists like this but way better please point me to it so I can take from it or use it to replace this.
Thanks in advance!
Edit1: Redline1, change to:
chmod octal...10 columns: 1 Type, 9 Permissions
Nice start.
Some comments from top to bottom:
You don't need semicolons after each line. Only if you want to write more than one command on the same line - e.g. "if some condition; then".
For the directory commands (cd, mkdir, ...), you can type directories with leading "/" if you want to specify the complete path starting from root, and without leading "/" to refer to subdirectories of the current directory. ".." is the parent directory of the current directory.
"which" scans your $PATH for the command you give it, so especially if it exists multiple times it shows you "which" will get run if you type it without specifying a path. It has nothing to do with directories.
The permission groups are usually called "u=user", "g=group" and "o=other" (not "everyone else)". And "s---------" is a socket, not a binary - the rest is correct. Read all you wanted to know about the output of ls and much more here: http://www.gnu.org/software/coreuti...ion-is-listed.html#What-information-is-listed
You confused "logwrapper" with "logcat". You use "logcat" to display the log and "logwrapper" to redirect the output of something in your script to logcat.
"sh script.sh" will execute a script even if it doesn't have the "executable" permission set. Use chmod 7xx to make it executable directly without "sh".
"adb command" doesn't exist - to run a single command, you need to say "adb shell xxx".
"adb fastboot" also doesn't exist, at least on my adb.
Some general tips:
Many or all commands in busybox have built-in help if you invoke them with "--help". Also adb shows a small manual if you invoke it without parameters.
You can use most basic reference material for Linux, e.g. guides about shell scripting. It's 95% the same on Android.
Always be very careful when running commands as root - the system assumes you know what you are doing. There is no safety net. For example, "rm -rf" will happily wipe your entire device (if mounted writable) if you add a space between the following "/" and the rest of the path.
Thanks oodels for the feedback and corrections. I will update and rev the document based on this feedback when I get the time.
Also thanks for always being the one who takes the time to reply in detail to my threads, give me guidance, and inspire me to learn more about the discussion topic while NEVER making me feel like I have asked a dumb question or am the newbe I am. I had a college professor that reminds me of you who told me the only dumb question I could ask was the one I didn't ask. I appreciate that more than I can express. You are a plethora of knowledge and a master instructor with a winning humble and tackful approach to education and inspiration; a rare gem.
_that said:
Always be very careful when running commands as root - the system assumes you know what you are doing. There is no safety net. For example, "rm -rf" will happily wipe your entire device (if mounted writable) if you add a space between the following "/" and the rest of the path.
Click to expand...
Click to collapse
Thanks for _that tip. Knowing this now I think I will remove that example from the newbe guide as someone could easily mistype it, add a space after /, and wipe their device from the root down. I will also add the -i option to the command(s) that are dangerous, requiring user intervention (permission) to proceed with the command as a newbe safety factor.

Categories

Resources