1. DroidForums.net is currently undergoing a major software upgrade. If you are experiencing any problems logging in please: Contact Us

How to properly theme ROMs using a vendor overlay

Discussion in 'Android Roms' started by koush, Apr 12, 2010.

  1. koush
    Offline

    koush Premium Member Premium Member Developer

    Joined:
    Mar 22, 2010
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    0
    A good number of ROMs now are being build using my sholes-open vendor overlay. However, I still see developers post-build theming the APKs. The "proper" way to theme a ROM is by creating a vendor config, and adding overlays. For example, my vendor overlay is "cyanogen". To replace the stock Browser icon, I could add an icon.png file in the following location:

    vendor/cyanogen/packages/apps/Browser/res/drawable/icon.png.

    The nice thing about this is that you don't need to much with the Browser repository itself, and deal wil subsequent merge headaches. It also gives you an update.zip that is already themed.

    Hope this helps some.




    Incidentally, I've started implementing theming at runtime... the basic user scenario will be: Enter settings app and choose a theme .zip that has a bunch of images that will override the resource loading of various applications. The cool thing is that you don't need to ever modify APKs anymore, and your theme will stay intact between ROMs and upgrades.
  2. stanrc
    Offline

    stanrc New Member

    Joined:
    Dec 19, 2009
    Messages:
    415
    Likes Received:
    0
    Trophy Points:
    0
    Can't wait to see this feature.
  3. koush
    Offline

    koush Premium Member Premium Member Developer

    Joined:
    Mar 22, 2010
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    0
    Same here ;) The main reason I don't use themes is cause they generally screw up your phone, and don't survive flashes. Basically pointless when I flash several times as day.
  4. Topsy
    Offline

    Topsy New Member

    Joined:
    Dec 28, 2009
    Messages:
    677
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Rio Rancho, New Mexico
    Was wondering about the consequences with a future update and needing to merge, great tip Koush, many thanks.
  5. doug piston
    Offline

    doug piston Premium Member Premium Member

    Joined:
    Dec 19, 2009
    Messages:
    1,203
    Likes Received:
    4
    Trophy Points:
    0
    thanks for the heads up topsy. great work koush. keep up the great work for the communinty.
  6. R1Lover
    Offline

    R1Lover New Member

    Joined:
    Nov 6, 2009
    Messages:
    1,702
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Northern Ca
    So is this setup now or is it something coming in your Roms?
  7. natediddy1120
    Offline

    natediddy1120 New Member

    Joined:
    Jan 4, 2010
    Messages:
    3,183
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    ???
    Thanks koush for the themeing tip with the vendor setup. I am definitely going to try this. But I do have one question. I looked in my cyanogen vendor setup in /overlay/packages/apps and I'm assuming you create the folder you need for the app you desire to be themed? Because I just have 4 app folders there. And also, I assume framework-res.apk still needs to be themed from the main frameworks/base/core/res directory right?
  8. koush
    Offline

    koush Premium Member Premium Member Developer

    Joined:
    Mar 22, 2010
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    0
    Yes, if the folder does not exist, you will need to add it.
  9. koush
    Offline

    koush Premium Member Premium Member Developer

    Joined:
    Mar 22, 2010
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    0
    No, you can just do overlay/frameworks/base/core/res/res/... etc. The overlay directory works on the entirety of the android repo.
  10. Topsy
    Offline

    Topsy New Member

    Joined:
    Dec 28, 2009
    Messages:
    677
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Rio Rancho, New Mexico
    does overlay work as well with other files?

    say an xml variation could be done the same way?
  11. Topsy
    Offline

    Topsy New Member

    Joined:
    Dec 28, 2009
    Messages:
    677
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Rio Rancho, New Mexico
    thinking this through i see where it might not, depends on the edit made and how it effects the app during compile.
  12. koush
    Offline

    koush Premium Member Premium Member Developer

    Joined:
    Mar 22, 2010
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    0
    Yes, works on any resource file. It might even work on .java files? Haven't tried that though.
  13. natediddy1120
    Offline

    natediddy1120 New Member

    Joined:
    Jan 4, 2010
    Messages:
    3,183
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    ???
    Oh wow I had no clue. This is great koush :)

    Ok so since I can add the /frameworks/base/core/res to the cyanogen vendor, I assume the .9.png's still need to have their 1 pixel borders right?
  14. koush
    Offline

    koush Premium Member Premium Member Developer

    Joined:
    Mar 22, 2010
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    0
    You should create .9 png's using the draw9patch tool in the SDK. I'm not sure exactly what happens if you straight edit them. I think they have some metadata that may not be rewritten sometimes. But yea, there should be a 1 px border, though the tool does that automatically.
  15. tktouch12
    Offline

    tktouch12 New Member

    Joined:
    Nov 17, 2009
    Messages:
    1,242
    Likes Received:
    0
    Trophy Points:
    0
    i didnt take the time to try to understand this, but i just want to say, its things like this that are the reason i use the cyanogen rom. it sounds like a great thing
Search tags for this page
android bookmarks resource overlay
,
android build overlays
,

android framework overlay

,
android overlay app's resource
,
android overlay framework
,
android overlay package
,
android overlay resource
,

android resource overlay

,
android vendor overlay howto
,
android vendor@overlay@framework@framework-res.apk@idmap
,
android+overlay make
,
build android appears in overlay but not in base
,
how to write vendor service in android framework
,
vendor overlay
,
where is vendor overlay framework located android