Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,731,985 Members 41,103 Now Online
XDA Developers Android and Mobile Development Forum

[TUT]How To Add/Port Various Framework Mods And Apps[21/3/2014]

Tip us?
 
sandy7
Old
(Last edited by sandy7; 21st March 2014 at 05:23 AM.)
#1  
sandy7's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 6840
Posts: 6,179
Join Date: May 2012
Location: bangalore

 
DONATE TO ME
Default [TUT]How To Add/Port Various Framework Mods And Apps[21/3/2014]

hello everyone

iam here to make a tutorial thread to teach u guys to port and add various mods by urself...


All these tut will work or might work for JB+ fws

so lets start


BACK TO KILL APPS

framework-res.apk

-----------------

1 - Add to strings.xml:

Code:
 <string name="back_longpress_kill_app_message">Application killed !!</string>
2 - Compile framework-res.apk





android.policy.jar
------------------

1 - Edit:

\com\android\internal\policy\impl\PhoneWindowManag er.smali

...ADD...

# instance fields
Code:
.field mBackLongPressKillApp:Ljava/lang/Runnable;
...ADD... the red marked lines at the end of the method
.method public constructor <init>()V
.registers 7
.
.
.
.
.line 4986
new-instance v0, Lcom/android/internal/policy/impl/PhoneWindowManager$28;

invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/PhoneWindowManager$28;-><init>(Lcom/android/internal/policy/impl/PhoneWindowManagerV

iput-object v0, p0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPressKillApp:Ljava/lang/Runnable;

return-void
.end method



navigate to ---


.method public interceptKeyBeforeDispatching(Landroid/view/WindowManagerPolicy$WindowState;Landroid/view/KeyEvent;I)J
.
.
.
.
...LOOK FOR SOMETHING LIKE THIS IN THE METHOD

iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownKeyConsumedByScreenshotChord:Z

.line 1909
:cond_6e
const-wide/16 v32, -0x1

goto :goto_51

.line 1917
:cond_71
const/16 v32, 0x3

move/from16 v0, v18

move/from16 v1, v32

if-ne v0, v1, :cond_17e

.line 1921
if-nez v9, :cond_e9

.line 1922
move-object/from16 v0, p0

iget-boolean v13, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomeLongPressed:Z


...AND ADD SPACE and Insert the red marked lines (SEE SPACES)...
Code:
    

    iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mVolumeDownKeyConsumedByScreenshotChord:Z

    .line 1909
    :cond_6e
    const-wide/16 v32, -0x1

    goto :goto_51
    
    .line 1917
    :cond_71
    
    
    
    
    const/16 v32, 0x4

    move/from16 v0, v32

    move/from16 v1, v18 # <<< PAY ATTENTION HERE, IF YOU LOOK AT UPWARDS, v18 IS = .local v18, keyCode:I
    
    if-ne v1, v0, :cond_7e
    
    if-nez v9, :cond_7e

    .line 157
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;

    move-object/from16 v32, v0

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPressKillApp:Ljava/lang/Runnable;

    move-object/from16 v33, v0

    invoke-virtual/range {v32 .. v33}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 158
    :cond_7e
    
    
    
    
    const/16 v32, 0x3

    move/from16 v0, v18

    move/from16 v1, v32

    if-ne v0, v1, :cond_17e

    .line 1921
    if-nez v9, :cond_e9

    .line 1922
    move-object/from16 v0, p0

    iget-boolean v13, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHomeLongPressed:Z

ONCE DONE REMOVE THE SPACES








...LOOK FOR SOMETHING...

invoke-virtual {v0, v1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->showOrHideRecentAppsDialog(I)V

.line 2048
:cond_210
const-wide/16 v32, -0x1

goto/16 :goto_51

.line 2049
:cond_214
const/16 v32, 0xdb

move/from16 v0, v18

move/from16 v1, v32

if-ne v0, v1, :cond_259

.line 2050
if-eqz v9, :cond_242

.line 2051
if-nez v23, :cond_22c

.line 2052
const/16 v32, 0x0

move/from16 v0, v32

move-object/from16 v1, p0

iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mAssistKeyLongPressed:Z




...AND ADD SPACE and Insert the red marked lines (SEE SPACES)...


Code:
invoke-virtual {v0, v1}, Lcom/android/internal/policy/impl/PhoneWindowManager;->showOrHideRecentAppsDialog(I)V

    .line 2048
    :cond_210
    const-wide/16 v32, -0x1

    goto/16 :goto_51

    .line 2049
    :cond_214
    
    
    
    
    const/16 v32, 0x4

    move/from16 v0, v32

    move/from16 v1, v18 # <<< PAY ATTENTION HERE, IF YOU LOOK AT UPWARDS, v18 IS = .local v18, keyCode:I
    
    if-ne v1, v0, :cond_1f0
    
    if-eqz v9, :cond_1f0 # <<< PAY ATTENTION HERE, IF YOU LOOK AT UPWARDS, v9 IS = .local v9, down:Z

    if-nez v23, :cond_1f0 # <<< PAY ATTENTION HERE, IF YOU LOOK AT UPWARDS, v23 IS = .local v23, repeatCount:I

    .line 169
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mHandler:Landroid/os/Handler;

    move-object/from16 v32, v0

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/PhoneWindowManager;->mBackLongPressKillApp:Ljava/lang/Runnable;

    move-object/from16 v33, v0

    invoke-static {}, Landroid/view/ViewConfiguration;->getGlobalActionKeyTimeout()J

    move-result-wide v34

    invoke-virtual/range {v32 .. v35}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 170
    :cond_1f0
    
    
    
    
    const/16 v32, 0xdb

    move/from16 v0, v18

    move/from16 v1, v32

    if-ne v0, v1, :cond_259

    .line 2050
    if-eqz v9, :cond_242

    .line 2051
    if-nez v23, :cond_22c

    .line 2052
    const/16 v32, 0x0

    move/from16 v0, v32

    move-object/from16 v1, p0

    iput-boolean v0, v1, Lcom/android/internal/policy/impl/PhoneWindowManager;->mAssistKeyLongPressed:Z
.
.
.
.
.end method
ONCE DONE REMOVE THE SPACES



2 - Add these new file: in smali\com\android\internal\policy\impl (see attachment)

PhoneWindowManager$28.smali



3 - Done !!





Thank u...More guides will be ADDED ASAP

if u like my works consider donating me to buy some beers..
Attached Files
File Type: rar back to kill files.rar - [Click for QR Code] (1.3 KB, 49 views)
The Following 21 Users Say Thank You to sandy7 For This Useful Post: [ Click to Expand ]
 
sandy7
Old
(Last edited by sandy7; 10th March 2014 at 08:53 AM.)
#2  
sandy7's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 6840
Posts: 6,179
Join Date: May 2012
Location: bangalore

 
DONATE TO ME
Default Port apps from different API's

For more info for porting OEM apps follow this guide....
http://www.xda-developers.com/androi...other-devices/



Before porting any thing u need disable signature check (aka 'Super user mod')
u can fallow this guide to activate it...
http://forum.xda-developers.com/show....php?t=2458144




How to enable Xperia HOME.apk (Honami home) to support your framework

Decompile framework.jar

goto ...\android\content\res\Configuration.smali

...ADD NEW METHOD...

Code:
# virtual methods

.method public getLayoutDirection()I
    .registers 2

    .prologue
    .line 1270
    iget v0, p0, Landroid/content/res/Configuration;->screenLayout:I

    and-int/lit16 v0, v0, 0xc0

    shr-int/lit8 v0, v0, 0x6

    add-int/lit8 v0, v0, -0x1

    return v0
.end method
The Following 10 Users Say Thank You to sandy7 For This Useful Post: [ Click to Expand ]
 
sandy7
Old
(Last edited by sandy7; 21st March 2014 at 05:22 AM.)
#3  
sandy7's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 6840
Posts: 6,179
Join Date: May 2012
Location: bangalore

 
DONATE TO ME
Default Reboot options for jb 4.3

So lets Start

Required
1-apktool
2-notepad++
3-some brains


Before u decompile anything see this Guide by @erorcun for how to compile a JB framework without bootloop..
http://forum.xda-developers.com/show....php?t=2321207



STEP-1

Decompile Framework-res.apk

goto to res/vlaues/arrays.xml

and add these lines at the end

Code:
    <string-array name="reboot_options">
        <item>@string/reboot_normal</item>
        <item>@string/reboot_recovery</item>
        <item>@string/reboot_bootloader</item>
    </string-array>
    <string-array name="reboot_actions">
        <item>now</item>
        <item>recovery</item>
        <item>bootloader</item>
    </string-array>

now goto res/values/strings
and add these lines at the end


Code:
    <string name="reboot">Reboot</string>
    <string name="reboot_normal">Reboot</string>
    <string name="reboot_recovery">Recovery</string>
    <string name="reboot_bootloader">Bootloader</string>

goto add the ic_lock_reboot.png which i have i provided in the resources attached below this post to drawablw-hdpi folder

so before compiling the framework-res.apk follow erorcun's guide to properly recompile framework-res.apk

once recompile is done ....decompile again to get the HEX ID's

STEP-2

decompile android.policy.jar

goto classout\com\android\internal\policy\impl

and add the 3 smali's files which i provided in the resources attached below

Now option classout\com\android\internal\policy\impl\GlobalAc tions.smali

and find these lines and add the red marked lines between them

Code:
    .line 235
    iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

    new-instance v1, Lcom/android/internal/policy/impl/GlobalActions$2;

    const v2, 0x1080030

    const v3, 0x10400fa

    invoke-direct {v1, p0, v2, v3}, Lcom/android/internal/policy/impl/GlobalActions$2;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

    invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 213
    move-object/from16 v0, p0

    iget-object v1, v0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

    new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$11;

    const v3, 0x1080827

    const v4, 0x104060b

    move-object/from16 v0, p0

    invoke-direct {v2, v0, v3, v4}, Lcom/android/internal/policy/impl/GlobalActions$11;-><init>(Lcom/android/internal/policy/impl/GlobalActions;II)V

    invoke-virtual {v1, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 260
    iget-object v0, p0, Lcom/android/internal/policy/impl/GlobalActions;->mItems:Ljava/util/ArrayList;

    iget-object v1, p0, Lcom/android/internal/policy/impl/GlobalActions;->mAirplaneModeOn:Lcom/android/internal/policy/impl/GlobalActions$ToggleAction;

    invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

now we need to assign the Hex id's as per ur Public.xml

NOTE: the hex id's might be different from mine and yours so be careful while comparing

new as per the above changes in GlobalActions.xml

assign the id's as below

<public type="drawable" name="ic_lock_reboot" id="0x01080827" />

Code:
 new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$11;

    const v3, 0x1080827

<public type="string" name="reboot" id="0x0104060b" />

Code:
new-instance v2, Lcom/android/internal/policy/impl/GlobalActions$11;

    const v3, 0x1080827

    const v4, 0x104060b


Now option up classout\com\android\internal\policy\impl\GlobalAc tions$11.smali

find and replace the following

@line 70
<public type="string" name="reboot" id="0x0104060b" />


Code:
const v3, 0x104060b

@line 90
<public type="array" name="reboot_options" id="0x0107003b" />


Code:
const v3, 0x107003b

@line 105
<public type="string" name="ok" id="0x0104000a" />



Code:
  const v2, 0x104000a

@line 147
<public type="bool" name="config_sf_slowBlur" id="0x0111000b" />


Code:
const v3, 0x111000b

now open up classout\com\android\internal\policy\impl\GlobalAc tions$11$2.smali

@line 59
<public type="array" name="reboot_actions" id="0x0107003c" />


Code:
const v2, 0x107003c

save it and recompile android.policy.jar


now push all the files into ut phone...will have the new Advanced reboot options
Attached Files
File Type: rar reboot_option_resources.rar - [Click for QR Code] (4.5 KB, 32 views)
The Following 5 Users Say Thank You to sandy7 For This Useful Post: [ Click to Expand ]
 
sandy7
Old
#4  
sandy7's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 6840
Posts: 6,179
Join Date: May 2012
Location: bangalore

 
DONATE TO ME
also need this
The Following 3 Users Say Thank You to sandy7 For This Useful Post: [ Click to Expand ]
 
slink722
Old
#5  
slink722's Avatar
Senior Member
Thanks Meter 1238
Posts: 965
Join Date: May 2012
Location: San Fernando City
great mate! keep it coming!!!
 
DarkFalcon
Old
#6  
DarkFalcon's Avatar
Senior Member
Thanks Meter 648
Posts: 691
Join Date: Nov 2012
Location: Pune

Awesome work bro!
I wanted this!
Will surely try it out as soon my laptop is fixed.
"The more you explain it, the more I don't understand it"
-Mark Twain

My Device:
 
Sony Xperia Sola {pepper}

Stock JB 4.1

Modified Munjeni's JB Kernel

 
Abhinav2
Old
#7  
Abhinav2's Avatar
Recognized Contributor / Themer
Thanks Meter 4426
Posts: 2,240
Join Date: Jul 2012
Great work sandy

Cheers,
AJ
The Following 2 Users Say Thank You to Abhinav2 For This Useful Post: [ Click to Expand ]
 
Rajeev
Old
#8  
Rajeev's Avatar
Senior Member
Thanks Meter 7125
Posts: 6,651
Join Date: Nov 2012
Location: Chennai , I N D I A

 
DONATE TO ME
Cool Work Sandy Broooooo.. Waiting for more mods tutorial...
If You Like My Work Please Consider A Small Donation

For Donating Click Below

 
Please Do The Following:
Sign In To Your PayPal Account Page
Go To 'Send Payment'
Enter My Email ID "dipesh.febrius@gmail.com"
Option "Personal Payment" Doesn't Work For India, So Kindly Set "Online Purchases". And Check Goods or Service (Preferably Service)
Make The Payment of The Desired Amount of Donation You Want To Send.
Thank You For Your Kind Donations!
 
sandy7
Old
#9  
sandy7's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 6840
Posts: 6,179
Join Date: May 2012
Location: bangalore

 
DONATE TO ME
updated...see post #2

more to come..stay tuned
The Following 2 Users Say Thank You to sandy7 For This Useful Post: [ Click to Expand ]
 
serajr
Old
#10  
serajr's Avatar
Recognized Developer / Recognized Themer
Thanks Meter 8883
Posts: 2,304
Join Date: Apr 2011
Location: Rafard - SP
Default AWESOME!!!!!!

Thanks you!!!!!!
I have paced these forests for so long
I don`t know, if I am a man or I am beast
I though hold deep within me, a quest for revenge
Then I must be a man as much as I can be
I have learned to speak the tongue of animal
I have learned to read the signs in bark and snow
I have taken within myself the spirits of my fathers long time gone
In this short time, far from home
A man of iron I`ve grown...
...A man of iron I have grown

(Hail Quorthon... RIP)

If you like my work and consider me worthy, consider DONATE me too. Thanks in advance!

The Following User Says Thank You to serajr For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes