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

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

Tip us?
 
sandy7
Old
(Last edited by sandy7; 20th April 2013 at 04:35 PM.)
#1  
sandy7's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 6840
Posts: 6,179
Join Date: May 2012
Location: bangalore

 
DONATE TO ME
Tutorial [GUIDE] How to port SONY Small Apps to Any Device Cm Based Roms

SONY SMALL APPS FOR CM BASED ROM


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
c3ma138 (for help , resources , app)
The Following 78 Users Say Thank You to sandy7 For This Useful Post: [ Click to Expand ]
 
predatOr
Old
(Last edited by predatOr; 10th April 2013 at 01:48 PM.)
#2  
predatOr's Avatar
Senior Member
Thanks Meter 990
Posts: 1,117
Join Date: Sep 2012
Location: Hisar
Its weird how smilies show up in tutorials instead of : permission... It becomes ermission

Anyways nice tutorial bro... The screens are of sony stock ROM... any screens of it running on CM?

And are the smallapps affected by CM themes too?

Edit: oops I missed the slauncher part. Got my answers.

 

INDEX LIST OF ROMs/KERNELs/GUIDES/FIRMWARES/FTFs
XPERIA mdpi 2011
XPERIA Z
HTC ONE


The Following 2 Users Say Thank You to predatOr For This Useful Post: [ Click to Expand ]
 
sandy7
Old
#3  
sandy7's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 6840
Posts: 6,179
Join Date: May 2012
Location: bangalore

 
DONATE TO ME
Quote:
Originally Posted by predatOr View Post
Its weird how smilies show up in tutorials instead of : permission... It becomes ermission

Anyways nice tutorial bro... The screens are of sony stock ROM... any screens of it running on CM?

And are the smallapps affected by CM themes too?

Edit: oops I missed the slauncher part. Got my answers.
The screenshots are from galaxy SL running cm10 xperia themed rom...

Sent from my SK17i using XDA Premium HD app
The Following 5 Users Say Thank You to sandy7 For This Useful Post: [ Click to Expand ]
 
dewasathya
Old
#4  
Senior Member
Thanks Meter 86
Posts: 189
Join Date: Sep 2012
Location: Bali, Indonesia
Quote:
Originally Posted by sandy7 View Post
The screenshots are from galaxy SL running cm10 xperia themed rom...

Sent from my SK17i using XDA Premium HD app
So wait, it can run on Galaxy SL? Gonna try it on another based CM10. BTW, do you own a Galaxy SL?
Press Thanks If I help you
My Device(s): Samsung Galaxy Tab 2 (P-3100) running CM 10.2, Asus N43S (i7 2nd Gen+Nvidia GeForce GT540M) running Windows 8.1[BROKEN, Can't Read the HDD][FIXED, BROKEN CHIPSET)
Former Devices: iPod 4G (Give it to my bro), Samsung Galaxy SL (GT-i9003) (Retired)
Next Device (Probably): [PHONE] LG G2 32 GB(D803)/Lumia 930/OnePlus One 32GB, [LAPTOP] Laptop with i5/i7 3/4th Gen + Nvidia GeForce GT740/750M
The Following User Says Thank You to dewasathya For This Useful Post: [ Click to Expand ]
 
mateuszwon94
Old
#5  
Junior Member
Thanks Meter 2
Posts: 14
Join Date: Jul 2011
Location: Łodygowice
Is it possible to make a flashable zip?
The Following User Says Thank You to mateuszwon94 For This Useful Post: [ Click to Expand ]
 
deniz2051
Old
#6  
Senior Member
Thanks Meter 24
Posts: 207
Join Date: Dec 2012
Location: Istanbul
Yes please,CWM flashable zip!
The Following User Says Thank You to deniz2051 For This Useful Post: [ Click to Expand ]
 
Ashutos1997
Old
#7  
Ashutos1997's Avatar
Senior Member
Thanks Meter 605
Posts: 469
Join Date: May 2012
Location: New Delhi , India
i am getting some errors while compiling the framework-res.apk
Check my other posts at http://www.ugeeky.com or at
http://www.betech.in
The Following User Says Thank You to Ashutos1997 For This Useful Post: [ Click to Expand ]
 
sandy7
Old
#8  
sandy7's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 6840
Posts: 6,179
Join Date: May 2012
Location: bangalore

 
DONATE TO ME
Quote:
Originally Posted by Rich'Dawg' View Post
So wait, it can run on Galaxy SL? Gonna try it on another based CM10. BTW, do you own a Galaxy SL?
no i dont own a Galaxy SL.....but the mod was test and reported working my friend Vasishta Reddy on his Galaxy SL

Quote:
Originally Posted by mateuszwon94 View Post
Is it possible to make a flashable zip?
Quote:
Originally Posted by deniz2051 View Post
Yes please,CWM flashable zip!
its a easy tutorial try it for ur self...if u guys can make it...upload me the framework-res.pak , framework.jar and android.policy.jar from ur rom ill make one cwm flashable when i have free time


Quote:
Originally Posted by Ashutos1997 View Post
i am getting some errors while compiling the framework-res.apk
plz post the error log..
The Following 2 Users Say Thank You to sandy7 For This Useful Post: [ Click to Expand ]
 
Abhinav2
Old
#9  
Abhinav2's Avatar
Recognized Contributor / Themer
Thanks Meter 4417
Posts: 2,239
Join Date: Jul 2012
Nice tut bro....keep it up

Best Regards,
AJ
The Following User Says Thank You to Abhinav2 For This Useful Post: [ Click to Expand ]
 
jumper62
Old
#10  
Senior Member
Thanks Meter 180
Posts: 1,084
Join Date: Sep 2012
Did this, when i tried to flash, it said error status 7. Any help?

Sent from my Sony Tablet S using xda app-developers app

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes