How to properly theme ROMs using a vendor overlay

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

  1. koush

    koush Premium Member Premium Member Developer

    Joined:
    Mar 22, 2010
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +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

    stanrc Member

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

    koush Premium Member Premium Member Developer

    Joined:
    Mar 22, 2010
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +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

    Topsy Member

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

    doug piston Premium Member Rescue Squad Premium Member

    Joined:
    Dec 19, 2009
    Messages:
    1,204
    Likes Received:
    4
    Trophy Points:
    38
    Ratings:
    +4
    thanks for the heads up topsy. great work koush. keep up the great work for the communinty.
     
  6. R1Lover

    R1Lover Senior Member

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

    natediddy1120 Silver Member

    Joined:
    Jan 4, 2010
    Messages:
    3,180
    Likes Received:
    0
    Trophy Points:
    101
    Location:
    ???
    Ratings:
    +0
    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

    koush Premium Member Premium Member Developer

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

    koush Premium Member Premium Member Developer

    Joined:
    Mar 22, 2010
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +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

    Topsy Member

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

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

    Topsy Member

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

    koush Premium Member Premium Member Developer

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

    natediddy1120 Silver Member

    Joined:
    Jan 4, 2010
    Messages:
    3,180
    Likes Received:
    0
    Trophy Points:
    101
    Location:
    ???
    Ratings:
    +0
    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

    koush Premium Member Premium Member Developer

    Joined:
    Mar 22, 2010
    Messages:
    128
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +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

    tktouch12 Active Member

    Joined:
    Nov 17, 2009
    Messages:
    1,240
    Likes Received:
    0
    Trophy Points:
    36
    Ratings:
    +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 build overlays
,
android framework overlay
,
android overlay package
,
android overlay resource
,

android resource overlay

,
android vendor@overlay@framework@framework-res.apk@idmap
,
android+overlay make
,
cyanogen overlay theme vendor c1505
,
idmap android
,
vendor overlay