Archive for October 2013

  • [GUIDE] How to port SONY Small Apps to Any Device Cm Based Roms

    0
    1-STEP

    decompile framework-res.apk

    goto res/values/strings.xml and add these lines a the end 



    Code:
     <string name="permlab_externalTaskSwitcher">Start as an external task switcher</string>
        <string name="permdesc_externalTaskSwitcher">Allows the application to be an external task switcher replacing the native task switcher</string>
        <string name="permlab_smallapp">Small application overlay</string>
        <string name="permdesc_smallapp">Allows running movable small applications on top of other applications.</string>


    open AndroidManifest.xml

    and add the following lines 
    Code:
     <permission android:name="android.permission.SYSTEM_ALERT_WINDOW" android:label="@string/permlab_systemAlertWindow" android:description="@string/permdesc_systemAlertWindow" android:protectionLevel="dangerous" android:permissionGroup="android.permission-group.SYSTEM_TOOLS" />
    and 
    Code:
     <permission android:name="com.sony.smallapp.permission.SMALLAPP" android:label="@string/permlab_smallapp" android:description="@string/permdesc_smallapp" android:protectionLevel="dangerous" />

    like this shown in the pic..





    done recompile the framework-res.apk

    2-STEP

    decompile android.policy.jar 

    and open com\android\internal\policy\impl\PhoneWindowManager.smal

    and add the red marked lines 

    Code:
    .field static final RECENT_APPS_BEHAVIOR_DISMISS_AND_SWITCH:I = 0x3
    
    .field static final RECENT_APPS_BEHAVIOR_EXIT_TOUCH_MODE_AND_SHOW:I = 0x1
    
    .field static final RECENT_APPS_BEHAVIOR_SHOW_OR_DISMISS:I = 0x0
    
    .field static final SHOW_PROCESSES_ON_ALT_MENU:Z = false
    
    .field static final SHOW_STARTING_ANIMATIONS:Z = true   ----------------------add this line if u dont have
    
    .field static final SMALLAPP_LAYER:I = 0x3
    
    .field public static final SYSTEM_DIALOG_REASON_ASSIST:Ljava/lang/String; = "assist"
    
    .field public static final SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS:Ljava/lang/String; = "globalactions"
    
    .field public static final SYSTEM_DIALOG_REASON_HOME_KEY:Ljava/lang/String; = "homekey"
    
    .field public static final SYSTEM_DIALOG_REASON_KEY:Ljava/lang/String; = "reason"
    
    .field public static final SYSTEM_DIALOG_REASON_RECENT_APPS:Ljava/lang/String; = "recentapps"

    and find these lines in the same file.

    Code:
    .method public checkAddPermission(Landroid/view/WindowManager$LayoutParams;)I
        .locals 4
        .parameter "attrs"
    
        .prologue
        const/4 v2, 0x0
    
        .line 1588
        iget v1, p1, Landroid/view/WindowManager$LayoutParams;->type:I
    
        .line 1590
        .local v1, type:I
        const/16 v3, 0x7d0
    
        if-lt v1, v3, :cond_0
    
        const/16 v3, 0xbb7
    
        if-le v1, v3, :cond_1
    
        .line 1622
        :cond_0
        :goto_0
        return v2
    
        .line 1594
        :cond_1
        const/4 v0, 0x0
    
        .line 1595
        .local v0, permission:Ljava/lang/String;
        sparse-switch v1, :sswitch_data_0
    
        .line 1614
        const-string v0, "android.permission.INTERNAL_SYSTEM_WINDOW"
    
        .line 1616
        :goto_1
        :sswitch_0
        if-eqz v0, :cond_0
    
        .line 1617
        iget-object v3, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
    
        invoke-virtual {v3, v0}, Landroid/content/Context;->checkCallingOrSelfPermission(Ljava/lang/String;)I
    
        move-result v3
    
        if-eqz v3, :cond_0
    
        .line 1619
        const/4 v2, -0x8
    
        goto :goto_0
    
        .line 1611
        :sswitch_1
        const-string v0, "android.permission.SYSTEM_ALERT_WINDOW"
    
        .line 1612
        goto :goto_1
    
        .line 1595
        nop
    
        :sswitch_data_0
        .sparse-switch
            0x7d2 -> :sswitch_1
            0x7d3 -> :sswitch_1
            0x7d5 -> :sswitch_0
            0x7d6 -> :sswitch_1
            0x7d7 -> :sswitch_1
            0x7da -> :sswitch_1
            0x7db -> :sswitch_0
            0x7dd -> :sswitch_0
            0x7e7 -> :sswitch_0
        .end sparse-switch
    .end method

    no is the funny part replace all the above blue marked lines with the below red marked lines

    Code:
    .method public checkAddPermission(Landroid/view/WindowManager$LayoutParams;)I
        .locals 4
        .parameter "attrs"
    
        .prologue
        const/4 v2, 0x0
    
        .line 1115
        iget v1, p1, Landroid/view/WindowManager$LayoutParams;->type:I
    
        .line 1117
        .local v1, type:I
        const/16 v3, 0x7d0
    
        if-lt v1, v3, :cond_0
    
        const/16 v3, 0xbb7
    
        if-le v1, v3, :cond_1
    
        .line 1152
        :cond_0
        :goto_0
        return v2
    
        .line 1121
        :cond_1
        const/4 v0, 0x0
    
        .line 1122
        .local v0, permission:Ljava/lang/String;
        sparse-switch v1, :sswitch_data_0
    
        .line 1144
        const-string v0, "android.permission.INTERNAL_SYSTEM_WINDOW"
    
        .line 1146
        :goto_1
        :sswitch_0
        if-eqz v0, :cond_0
    
        .line 1147
        iget-object v3, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mContext:Landroid/content/Context;
    
        invoke-virtual {v3, v0}, Landroid/content/Context;->checkCallingOrSelfPermission(Ljava/lang/String;)I
    
        move-result v3
    
        if-eqz v3, :cond_0
    
        .line 1149
        const/4 v2, -0x8
    
        goto :goto_0
    
        .line 1137
        :sswitch_1
        const-string v0, "android.permission.SYSTEM_ALERT_WINDOW"
    
        .line 1138
        goto :goto_1
    
        .line 1141
        :sswitch_2
        const-string v0, "com.sony.smallapp.permission.SMALLAPP"
    
        .line 1142
        goto :goto_1
    
        .line 1122
        :sswitch_data_0
        .sparse-switch
            0x7d2 -> :sswitch_1
            0x7d3 -> :sswitch_1
            0x7d5 -> :sswitch_0
            0x7d6 -> :sswitch_1
            0x7d7 -> :sswitch_1
            0x7da -> :sswitch_1
            0x7db -> :sswitch_0
            0x7dd -> :sswitch_0
            0xbb5 -> :sswitch_2
            0xbb6 -> :sswitch_2
        .end sparse-switch
    .end method

    save it..done now recompile the android.policy.jar


    3-STEP

    decompile framework.jar

    add the whole sony folder (provided in the resources.zip attached below ) in classout/com 

    and recompile framework.jar

    4-STEP

    now u need to add some files in system/app
    system/etc
    system/framework

    all the files are provided in resources.zip so just take them and add those files in ur flashable zip

    5-STEP

    once u flash the mod .u need an Slauncher or Small app launcher app to launch the small apps...download it from google play

    so its done enjoy the smalls on cm based roms..

    This is the screenshots from galaxy SL Running CM10 xperia themed..


    some more SS of more small apps



    ROM THREAD LINK with working small apps using this tutorial..
    http://forum.xda-developers.com/show....php?t=1862705

    This method is tested working on most xperia devices and GALAXY SL and also on CM9 , CM10 , PA , PACMAN


    Also tested working CM10.1



    Here is a video from CM10.1



    might also work on Stock based FW but not tested

    CREDITS
    SANDY7 - XDA
    c3ma138

    File 

    ATTACHED FILES
    File Type: rarCM_smallapps_resorces.rar
    File Type: zipSmallApp_flashable_zip_format_TWRP_recovery.zip 
    File Type: zipSMALL_APPS_flashable_zip_format_cwm.zip 
    File Type: rarCM_smallapps_NEW resources.rar 


    Source - XDA
  • [TUTORIAL] Theming Android

    2
    Guide only cover:
    • De-compile & compile of .apk
    • changing the .png file inside .apk
    • Modifying tricky .9.png file.
    • Modifying .xml file.
    • Zip Align the .apk

    What you need:
    • Your phone must be ROOT and DEODEXED.
    • CWM pre-install recommended, you can simply get this function by installing superatmos / Lucifr kernel.
    • 7-zip - for replacing file inside .apk
    • JRE (Java Runtime Environment) - required to run the APKtool
    • Android-SDK - must install before APKtool & Zipalign work.
    • APKTool Download the apktool & also apktool-install-windows.

    Before Start:

    • Always remember make a backup for any .apk file you plan to change or amend.
    • Recommended make a flash-able version of origin not amend .apk in-case something went wrong, you can always flash back the original file via CWM. Example if you did something wrong in your systemUI.apk (for statusbar) it will probably make your phone nearly impossible access any part due to unstop FC.

    De-compile & Compile of .apk

    Why this step is required:
    • You need to de-compile the .apk before you can correctly modified the tricky .9.png and also to see a readable .xml for amending.
    Step:
    • Install JRE (Java Runtime Environment) & Android-SDK.
    • Download the apktool & also apktool-install-windows, extract the file and put inside your Windows Folder.
    • Open command prompt (Start - Run - CMD)
    • Before de-compile the .apk, make sure you copy out your current phone framework-res.apk & twframework-res.apk, lidroid-res.apk only required if you using lidroid-res.apk in your framework.
      Code:
      apktool if [location of .apk]
      
      Example:
      apktool if D:\APK\framework-res.apk
      apktool if D:\APK\twframework-res.apk
      apktool if D:\APK\lidroid-res.apk
    • Now, De-compile the .apk
      Code:
      apktool d [filename.apk] [directory]
      
      Example: apktool d D:\framework-res.apk D:\De-compile
    • If sucess, you will seen the following line in your CMD.
    • The De-compile folder will be generate as seen below.
    • Now you can amend whatever you like to amend, after done, proceed to following step.
    • Compile back:
      Code:
      apktool b [directory]
      
      Example: apktool b D:\De-compile
    • Extra build folder will appear inside your De-compile folder, all file inside here already compile and can use later in your Android phone.



    Changing/Replacing the .png file inside .apk
    • Amending normal .png no need to de-compile, just extract the file and modified using any photoshop tools or simply replace the .png
    • Just right click any .apk file and select 7-zip extract to, as seen below:
    • Now go to the extracted folder and amend / replace any .png file you like to replace. (Remember .9.png file cannot just simply replace, check following post for instruction.)



    Modifying tricky .9.png file.
    • The .9.png cannot just simply amend using any photoshop and put back, because by doing so, either the amend .9.png won't appear or just simply give you FC in your phone when running it.

    What to do:
    • De-compile the .apk.
    • Below showing the different between before and after de-compile of .9.png, as you can seen on right image,they is extra 4 black dot + 1 black bar and surrouding with transparent bar, all this area must be keep and not amend during photoshop. The de-compile image will auto increase 1 x pixel + 1 y Pixel.
       
    • Just amend without touching those area, save it and then put back to correct folder and compile back.



    Modifying .xml file
    • After you have de-compile the .apk, now all inside .xml is readable where you can make some changes on the color selection, clock position and etc. by just simply open with notepad and modified.
    • Before de-compile, the .xml look like below which is not readable and understand by human.
    • After de-compile, now the .xml is readable and understand by human.
    • Now you can amend what ever you like, Google/Search XDA forum for which .XML to amend.
    • Use this color code checker site for getting your desire color code.
    • After done, don't forget, you must compile back the .xml before it is understandable by Android OS.
    • Screenshot below showing modifying the sub text .xml to ICS blue color.

      Change all
    Code:
    from android:color="#ffffffff to android:color="#ff3f9bbf




    Zipalign the .apk

    Why this step is required:
    • You need to align the .apk to let the Android phone run the modified .apk perform much smoother and better, if you have more not align .apk file in your phone, it will eventually drag down your entire phone performance.
    • This step is not necessary but recommended.

    Step:
    • Open command prompt at your Android-SDK Tools folder
    • Type following command and run
      Code:
      zipalign -fv 4 [filename.apk] [filename-new.apk]
      
      Example: zipalign -fv 4 framework-res.apk framework-res-new.apk
    • A new Zipalign .apk will be generate as seen below, highlight in blue.
    • Zipalign in batch, save following code in .bat and put in your folder that contains .apk file. It will batch running zipalign all .apk inside, this guide I found from user Grumpy Old Man post at RootWiki. Thanks for this easier method.
    Code:
    @echo off
    
    REM Batch file to recursively zip align *.apk files in a directory
    
    REM and its sub-directories. This is significantly easier and faster
    
    REM than manually zip aligning them.
    
    @echo Zip aligning now...
    
    for /R %%X in (*.apk) do zipalign 4 "%%X" "%%~dpX%%~nX.new"
    
    @echo Replacing non-aligned files with zip aligned files...
    
    for /R %%X in (*.new) do move /Y "%%X" "%%~dpX%%~nX.apk"
    
    @echo Zip aligning done, press any key to exit
    
    pause

    Final Step

    OK, done everything? now you need to put back to your phone with 2 method
    • Flash via CWM - highly recommended
    • Root Explorer - not recommended as it may not properly change for Statusbar theming.

    Using CWM
    • Make a flash-able .zip to flash at CWM
    • Not sure how to do, let use a easier way, take any flash-able .zip, use 7-zip and choose open archive as seen below:
    • Now just drag and drop all your modified .apk inside the .zip file, choose YES when ask "Confirm File Copy" as seen below:
    • Copy the modified .zip to your root SDCARD and restart to CWM and install. Done!

    Using Root Explorer
    • Temporary copy your modified .apk to your /system/csc
    • Right click choose permission and set as below:
    • Move your current .apk to correct directory /system/app
    • Done! This method is not recommended for framework-res.apk & systemUI.apk, better way still flashing via CWM.




  • [GUIDE][How-to]Create your Own Custom ROM Part 3

    0
    Part 3 :Change/modify/update rom


    • Quote:
      YOU CAN MODIFY YOUR ROM IN TWO STEPS:
    • MODIFY USING ANDROID KITCHEN - for basic modification.
    • MODIFY MANUALLY. - for advanced modification.
    Quote:

    2. MODIFYING MANUALLY.

    Check this Guide for some MODs like center clock,CRT animation, ics and jelly bean style mods etc...
    [LIST][*]Adding/removing applications
    1. Go to the working folder where you extracted your rom, inside you will find:
     OR 
    2. Then go to "system/app" inside this folder you will find all the rom applications(apks) you may also find some in the data folder if your rom has this folder.
    3. Copy, replace, and change any app(apk) be carefull if you dont know what the apk is do not delete!!
    LIST OF APPS YOU CAN DELETE - HERE OR HERE
    If you can not find some apps in this guide then try opening all those app in your phone and see app name and icon or move those apps from system/app to sdcard and see what is not working...

    [*]Adding new boot animation
    android kitchen doesn't works for my Karbonn A5 . So we need a different method.
    1) Download and extract the bootanimation and samsungani file from Custom Booting.zip attached in first post.
    2) Put them in the /system/bin folder and replace the existing files there
    3) Now download any boot animation, and rename the bootanimation to “sanim.zip”.
    4) Now, navigate to /system/media and replace the “ODEanim” with “sanim.zip”
    You are done with the bootanimation change


    [*]Edit the gps script for your country/location
    1. In the workingfolder/system/etc/ you will find a file named gps.conf, you can
    edit this file with notepad++ or even word.
    2. using the right gps script in this file can speed up gps lock, you can
    find some from angeldeath, download extract and replace the gps.conf.

    [*]Adding ringtones :
    • Take your ringtone file...it should be in .ogg format..If not then convert it to .ogg..
    • Locate to the folder system>media>audio>ringtones>
    • Copy and paste your .ogg files here in ringtones folder..
    • You can also change notifications, alarm and UI tones like this..
    [*]Changing the Fonts :
    • Take your desired font.ttf file and rename it as DroidSans.ttf..
    • Locate to the folder system>fonts>
    • Now, replace the file DroidSans.ttf with your desired DoridSans.ttf...
    • To change the lock screen clock font...replace the Clocktopia.ttf with your desired one..(rename first)..

    build.prop tweaks!!
    check this or this or this post for build.prop
    NOTE: EDIT BUILD.PROP WITH NOTEPAD++. SIMPLE NOTEPAD WILL CORRUPT THE FILE.
  • [GUIDE][How-to]Create your Own Custom ROM Part 2

    0
    Part 2:Setting up a working folder

    THERE ARE TWO METHODS FOR THIS.
    1. WHEN YOU HAVE BASE ROM AVAILABLE.
    2. WHEN YOU DON'T HAVE BASE ROM.


    FIRST METHOD -



    ->First our folder structure should look like this:

    Code:
    cygwin folder/home/your user name/kitchen
    -> Inside the kitchen it should look like this:


    -> Now we need a rom to work on,

    -> Just Place the original rom zip in the original_update folder inside the kitchen.
    run the cygwin.exe again type:

    Code:
    cd kitchen(enter)
    ./menu(enter)
    -> Now enter option 1, enter again. You should see your rom listed, choose and enter
    you will be asked about changing the working folders name, at this point it makes no difference so just continue.

    congratulations you have a working folder!!!



    Second METHOD -it is almost like ROM Dumping works on any device!

    Quote:
    -> FIRST MAKE A WORKING FOLDER IN CYGWIN FOLDER
    IT SHOULD LOOK LIKE THIS
    cygwin folder/home/your user name/kitchen/WORKING_(your rom name)
    NOTE: FOR THIS MEETHOD WE NEED 3 FILES AND FOLDERS TO BE PLACED IN WORKING FOLDER.
    1. META-INF FOLDER - GET THIS FROM DOWNLOAD FILES LIST IN FIRST POST
    2. SYSTEM FOLDER - TUTORIAL BELOW
    3. BOOT.IMG - TUTORIAL BELOW

    2. getting system folder
    (NOTE - Rooted phone required!!)

    This is universal method and can be done easily using terminal emulator.
    For this simply download Terminal Emulator from Android Market.
    we need freshly flashed device here. OTHERWISE YOU WILL HAVE LOT OF JUNK FILES.
    Open it and type:

    Code:
    su
     tar -c system/* >> sdcard/system.tar
    This will copy all your /system folder to your SDcard with name System.tar
    This will take some time to finish so be patient.
    After it's done you should have a tar file in your /sdcard named system.tar
    You can extract it using Winrar or 7zip software. But yes this will have huge size , as it has other useless folders so you will have to delete them. After extracting this system.tar file you will get following folders (Similar one)

    Quote:
    /etc
    /fonts
    /framework
    /lib
    /lost-found
    /media
    /sd
    /usr
    /xbin
    build.prop
    -> Now simply delete the folders marked in red color and its done.Don't worry if you don't have folders with red colors above,we don't need them.
    And the final files that we will have in our system folders will be

    Quote:
    /app
    /bin
    /etc
    /fonts
    /framework
    /lib
    /media
    /semc
    /usr
    /xbin
    build.prop
    NOW COPY THIS system FOLDER TO WORKING FOLDER
    Quote:
    3. getting boot.img

    Here we have 2 options
    1. stock boot.img from stock rom - simple kernel which we get in brand new mobile.
    2. custom boot.img from custom kernel - kernel which are modified for overclock or other features

    1. getting stock boot.img from stock rom.
    extract your stock rom with winrar or 7zip. you will see boot.img there. copy it to working folder

    2. getting custom boot.img from custom kernel.
    download any custom kernel which is only for your device.
    extract it with winrar or 7zip and copy boot.img to working folder
    NOTE: many of new devices have kernel.bin and other files instead of boot.img so skip this part if your device don't have it...
  • [GUIDE][How-to]Create your Own Custom ROM Part 1

    0
    This tutorial is specially for
    Quote:
    • Newcomers to the world of Android 
    • People who want to create their own ROM but unable to do so as it is going over the head 
    • People who did not had any encounters with Programming
    • Even Experienced One 

    Quote:
    Tools Required : (Report me dead links please)
    Part 1Installing the JAVA JDK, Cygwin and Setting up the Kitchen.
    Code:
    *Before you do anything install the java jdk*
    Quote:
    watch this video tutorial by gitagaire for how to setup cygwin and kitchen(recommended)
    INSTRUCTIONS

    ->Download and extract the cygwin_packages.zip
    -
    >Run the set up(make sure there is no previous cygwin installation)


    ->when it shows all the package names, go to the top and select "all default" until it changes to "all install" (you must click on the arrows)


    ->Download the kitchen from above. Then, extract the kitchen's .zip file to a folder under your home account. Rename the dsixda-android-kitchen-*** folder to just "kitchen". In Cygwin, this folder would depend on what was set for your Cygwin install directory, e.g. C:\cygwin\home\John\kitchen

    NOTE!! If your user folder contains spaces (e.g. C:\cygwin\home\John Smith\kitchen), then the kitchen will not function properly. Instead, copy it under C:\cygwin\home\kitchen.

    ->Now your ready to run the kitchen type:
    those who have their kitchen like this C:\cygwin\home\John\kitchen use these commands given below

    Code:
    cd kitchen(enter)
     ./menu(enter)
    those who have their kitchen like this C:\cygwin\home\kitchen use these commands given below.

    Quote:
    If you did things right you should see this:
  • Copyright © 2013 - Znxt

    Znxt Blog - Powered by Blogger - Designed by Dafuqers