Top  blogs

Wednesday, June 20, 2012

[PARANOIDANDROID] [CM9HYBRID] Developers only: Porting, Support and Maintanance















Some of you may have heard of tablet mode and if you have tried it you know well that it smashes your phone. Apps are small, their layout is screwed, things overlap, crash or stop working, Google Play forbids you to download, if you tried AOKP you cant even use launcher and phone. In short, it is a mess.

PARANOIDANDROID changed that. It does not "heal" tablet mode, it obliterates the boundaries. You define how big or small apps are, you define in which UI they display, no matter if your phone runs in tablet or phone mode, which also you can define. Customize every single entity on your phone, lockscreen, navigationbar, system-components, widgets, apps. If you prefer stay with your three bearpaw buttons + drop-down curtain or switch to a combined navigationbar + drop-up notificationcenter, enjoy Youtube in 3D, Gmail and settings in 2-columns, Chrome in its better mobile UI, etc. Nothing overlaps, nothing crashes, everything works as you'd expect. This is completely new ground and has never been realized before, it is lightyears from tablet mode.

We created it to establish the idea that tablet/hybrid mode can indeed work and that is was an error on Googles side to use the same layout for high resolution devices that is used on tiny little things like htc wildfire. We saw how badly build.prop tablet-mode was milked so we decided to remain closedsource until the codebase is mature enough to publish. Our first repos went public last week and the rest will follow soon, i will personally commit the hybrid sourcetree into CM9. Until then, do not ask us for sources, we have good reason to do it like this and when it's out people will know why, they will see something that works, not features for show. We are still fully open to ports. As long as they stay true to our vision and base on CM9.

As the sheer amount of porting requests needed to be addressed somehow we open this topic so maintainers can help each other and it'll be easy for us to take a look once in awhile as our pm-boxes are exploding. We understand that setting up PA can be quite confusing since it introduces must-have configurations that are unique.




  • 1. Unlock Tablet Mode for all devices
    This has been already stuffend into the framework by us and if you use our files you wont need it, but i will include it nonetheless. Legacy devices crippled with hardware buttons need hacks to make tablet mode work. I dont know exactly whom to thank for this find, names that pop up in my head are Xylograph and evilisto. Ics compilant devices simply need one more entry in their build.prop:qemu.hw.mainkeys=1. You can include both, doesnt hurt.
    Code:
    --- a/services/java/com/android/server/wm/WindowManagerService.java
    +++ b/services/java/com/android/server/wm/WindowManagerService.java
    @@ -5962,7 +5962,7 @@ public class WindowManagerService extends IWindowManager.S
    unrotDw = dw;
    unrotDh = dh;
    }
    - int sw = reduceConfigWidthSize(unrotDw, Surface.ROTATION_0, density, un
    + int sw = reduceConfigWidthSize((int)(unrotDw / density), Surface.ROTATI
    sw = reduceConfigWidthSize(sw, Surface.ROTATION_90, density, unrotDh, u
    sw = reduceConfigWidthSize(sw, Surface.ROTATION_180, density, unrotDw, 
    sw = reduceConfigWidthSize(sw, Surface.ROTATION_270, density, unrotDh,
    build.prop
    Code:
    ###################
    # PARANOIDANDROID #
    ###################
    
    ro.sf.lcd_density=192
    qemu.hw.mainkeys=1
  • 2. Find out tabletmode DPI treshold value
    Tablet mode is AOSP standard functionality. ICS is will drop into tablet mode if it acknowledges a certain treshold DPI, depending on your devices screen. Changing ro.sf.lcd_density in /system/build.prop will do. You can calculate that value as follows, here's a snippet of the ICS code that decides if your UI runs in tablet mode or phone mode.
    Code:
    int shortSizeDp = shortSize * DisplayMetrics.DENSITY_DEFAULT / DisplayMetrics.DENSITY_DEVICE;
    mStatusBarCanHide = shortSizeDp < 600;
    In short, you need to reach a short-side device-independend pixel number of 600. Example: Nexus has a width of 720 and a height of 1280, shortest side is 720, default density is 320. shortSizeDp = 720 * 160 / 320 = 360. lower than 600, phone mode. We need to lower the Dpi: shortSizeDp = 720 * 160 / 192 = 600. Thats it, tablet mode!
    The formula is:
    Code:
    treshold_dpi = shortest-side-dp * 160  / 600
  • 3. Setting up pad.prop
    /system/pad.prop is the file that defines how apps scale and in which UI they display. You should provide your users with a nice selection of everyday apps and define the system-apps well. Users should not be shocked when the phone boots up, what they are supposed to see is something that drops their jaws.
    For Galaxy Nexus it looks like this:
    Code:
    ###################
    # PARANOIDANDROID #
    ###################
    
    ## P.A.D PARAMETERS
    hybrid_mode=1
    rom_tablet_base=192
    rom_phone_base=320
    system_default_dpi=0
    user_default_dpi=320
    user_default_mode=1
    
    ## USER DEFINED VARIABLES
    rom_mid_dpi=240
    
    ## P.A.L PARAMETERS
    screen_default_width=360
    screen_default_height=567
    screen_default_layout=268435474
    screen_opposite_width=600
    screen_opposite_height=1018
    screen_opposite_layout=268435491
    
    # SYSTEM
    android.dpi=240
    com.android.systemui.dpi=220
    com.tmobile.themechooser.dpi=rom_phone_base
    com.tmobile.thememanager.dpi=rom_phone_base
    com.google.android.talk.dpi=rom_phone_base
    com.google.android.talk.mode=1
    com.android.bluetooth.dpi=rom_mid_dpi
    com.android.browser.dpi=rom_mid_dpi
    com.android.contacts.dpi=rom_mid_dpi
    com.android.contacts.mode=2
    com.android.email.dpi=rom_mid_dpi
    com.android.email.mode=2
    com.android.mms.dpi=rom_mid_dpi
    com.android.phone.dpi=rom_mid_dpi
    com.android.providers.downloads.ui.dpi=rom_mid_dpi
    com.android.settings.dpi=rom_mid_dpi
    com.android.settings.mode=2
    com.android.vending.dpi=rom_mid_dpi
    com.android.voicedialer.dpi=rom_mid_dpi
    com.android.vpndialogs.dpi=rom_mid_dpi
    com.android.wallpaper.livepicker.dpi=rom_mid_dpi
    com.google.android.gm.dpi=rom_mid_dpi
    com.google.android.gm.mode=2
    com.google.android.googlequicksearchbox.dpi=rom_mid_dpi
    com.google.android.gsf.login.dpi=rom_mid_dpi
    com.google.android.setupwizard.dpi=rom_mid_dpi
    com.google.android.voicesearch.dpi=rom_mid_dpi
    com.noshufou.android.su.dpi=rom_mid_dpi
    com.google.android.youtube.dpi=rom_mid_dpi
    com.android.calendar.dpi=rom_mid_dpi
    com.andrew.apollo.dpi=rom_mid_dpi
    com.cyanogenmod.trebuchet.dpi=rom_phone_base
    com.cyanogenmod.trebuchet.mode=1
    What is important here is that you need to set it up first with device specific informations. Here's a small rundown of these values:
    rom_tablet_base=xxx - tablet mode treshold dpi
    rom_phone_base=xxx - default device dpi
    system_default_dpi=0 - sets the global density for system apps. 0 means undefined. We will probably make it obsolete soon.
    user_default_dpi=xxx - sets the global density for non-system apps, set it to default dpi as this will guarantee that all of your users apps will look stock
    user_default_mode=1 - sets the global UI for non-system apps. 1 = phoneUI, 2 = tablet UI. set it to 1, all user apps will display in mobileUI. If the user has tablet ready apps he can switch himself in the settings panel
    ## USER DEFINED VARIABLES - you can define your own variables here
    ## P.A.L PARAMETERS - these are extremely important. you get them by logging the output of Configuration in tablet mode (_opposite) and phonemode (_default) kevdliu wrote a nice little helper to make it easier for you, look here
    ## SYSTEM - system apps, make sure you define them proper.
    notice that we use packagenames, if you dont know the name of an app open up your shell and type: 
    Code:
    adb shell
    pm list packages -f
    android - framework-res, applies to lockscreen, dialogs, powermenu, toasts
    systemUI - applies to the navigationbar, makes it bigger or smaller. DO NOT APPLY an UI to these two apps. everything else is fine, set it to tablet or phoneUI all you want, but not these two!
    Configuration in phone mode and tablet mode
  • 4. Check our sourcetrees
    More and more source will be published soon. Right now we have three projects out, OTA, Backup and Trebuchet (optimized for tabletmode with cool features). Hybrid code will come out soon. Use what you can get from there: http://betadan.com/paranoid/sources/
  • 5. Port the rom
    You are ready to go. Do what you always do when porting roms. I have zero experience with that. Again, use CM9. Do not even think about using AOKP.
    Check out Xylopgraph's PA porting guide
  • 6. Link to our Google Apps
    Google policy forbids you to use their market if you change your DPI. The only values allowed are 160, 240, 320. Why? No one knows why. There have been workaroundw, wiping cache, using a valid DPI, open market, reboot back, blablabla, forget it, its rubbish. It will work for a minute and then it will cease to. In our package Phonesky and GoogleServicesFramework were hacked. It has other additions aswell: http://4ndr01d.com/drcmda/common/
  • 7. Post your port link and help out others
    We will include you in our webpage and when our repo's are open you are invited to compile from source and/or submit patches and additions. We might even work together as theres still much to do. Be sure to help out others here.

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...