[CM11][Port][XS]Smallapps/Taskswitcher guide

Search This thread

Kevin-0100

Senior Member
Feb 16, 2013
124
70
Vlaardingen
Xperia XZ2
OnePlus 7T
First of all: this guide is based off the guide by @lukakas found here http://xdaforums.com/showthread.php?t=2460877

I tweaked it to get it to work on CM11, comparing the files of the Z2 system dump, the 4.3 resources provided in the guide by @lukakas and compared the difference with CM11 files.

In this guide I am using OPENsemc rom beta 3, wich is CyanogenMod 11 / Android KitKat

Before flashing the files, perform a FULL BACKUP in case something goes wrong!

Code:
I will NOT be held responsible if something happens to your device while or after flashing any of these files! All flashing is done at your OWN RISK.



I recommend using Virtuous Ten Studio for editing the files. It can be downloaded from: http://www.virtuous-ten-studio.com/index.php/downloads

Setting up Virtuous Ten Studio

Click on “File” then on “Open Settings” then proceed to ApkTool, and install Framework-res.apk from the rom you are trying to port SmallApps to by clicking on “Add single framework”

6rby.jpg



Android.policy.jar

Click on “Open” then on “New Project” and import anroid.policy.jar as shown below:
(note, in properties/settings click on “Smali” and make sure the API is set to 4.4 KitKat)

v4bz.jpg


Now open smali\com\android\internal\policy\impl\PhoneWindowManager.smali and select checkAddPermission from the dropdown menu

ob8x.jpg


Find and alter the following lines of code: (added code is marked in green)

.method public checkAddPermission(Landroid/view/WindowManager$LayoutParams;[I)I

(Lines of code not needed in the part of the tutorial has been cut, do not delete them though)
:cond_1
const/4 v0, 0x0

.line 1609
.local v0, permission:Ljava/lang/String;
sparse-switch v1, :sswitch_data_0

(Lines of code not needed in the part of the tutorial has been cut, do not delete them though)

:sswitch_1
const-string v0, "android.permission.SYSTEM_ALERT_WINDOW"

.line 1627
const/16 v3, 0x18

aput v3, p2, v2

goto :goto_1

.line 1397 - This number should be a new number and should not be found elsewhere in this document
:sswitch_2
const-string v0, "com.sony.smallapp.permission.SMALLAPP"


.line 1398 - This number should be a new number and should not be found elsewhere in this document
goto :goto_1


.line 1609 - This number must match the number above the line.local v0, permission:Ljava/lang/String;
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
0xbb5 -> :sswitch_2
0xbb6 -> :sswitch_2

.end sparse-switch
.end method

Press control s to save the document and recompile it: (use right click on android.policy and click “Build project”


Framework2.jar

For this step, import and decompile Framework2.jar like in steps show above. Right click on “framework2” and select “Open in windows explorer”

In the explorer screen, navigate to Data/smali/com, copy and paste the “sony” folder provided in the resources zip. Once done, right click on “framework2” and select “Reload project”

Once the project has reloaded, right click on “framework2” and select “Build project”

Framework-res.apk

Import framework-res.apk into the project.
Note: make sure before importing that in the Apk-Tool section you select “Use newest ApkTool” and that you select the Framework tag. (Remember you installed framework-res.apk earlier?)

Once framework-res.apk has imported, open AndroidManifest.XML
Add the lines marked in green like below.

<permission android:name="com.sony.smallapp.permission.CONTROL_SMALLAPP" android:protectionLevel="system|signature" />
<permission android:label="@string/permlab_smallapp" android:name="com.sony.smallapp.permission.SMALLAPP" android:protectionLevel="dangerous" android:description="@string/permdesc_smallapp" />
<permission android:label="@string/permlab_taskSwitcherPluginView" android:name="com.sonymobile.permission.TASK_SWITCHER_PLUGIN_VIEW" android:protectionLevel="signatureOrSystem" android:description="@string/permdesc_taskSwitcherPluginView" />
<permission android:name="com.sonymobile.permission.ACCESS_BEACON_MANAGER" android:protectionLevel="system|signature" />


drm8.jpg


Don’t forget to save the modifications you just made.

Next up: open res/values/ and open “strings.xml”

At the end of the file, copy the green lines:

<string name="permlab_smallapp">Small application overlay</string>
<string name="permdesc_smallapp">Allows running movable small applications on top of other applications.</string>
<string name="permlab_taskSwitcherPluginView">Provide plugin-view to the task-switcher</string>
<string name="permdesc_taskSwitcherPluginView">Allows the application to provide a plugin-view to the task-switcher</string>


r0tn.jpg


Save your modifications and and “Build project”

SystemUI.apk

This part can be the trickiest and can cause a lot of headache. Import SystemUI.apk and open AndroidManifest.xml

Note: make sure before importing that in the Apk-Tool section you select “Use newest ApkTool” and that you select the Framework tag.

Add the lines marked in green like below.

<uses-permission android:name="com.sonymobile.permission.XSSM_PROVIDER" />
<uses-permission android:name="com.sonymobile.permission.XSSM" />
<uses-permission android:name="android.permission.BIND_APPWIDGET" />
<uses-permission android:name="com.sony.smallapp.app.widget.permission.BIND_SMALLAPP_WIDGET_MANAGER" />
<uses-permission android:name="com.sony.smallapp.permission.SMALLAPPMANAGER_CONTROL" />
<uses-permission android:name="com.sony.smallapp.launcher.permission.ACCESS_DATABASE" />
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
<permission android:name="com.sonymobile.permission.TASK_SWITCHER_PLUGIN_VIEW" android:protectionLevel="normal" />


x2vu.jpg


Add the lines marked in green like below. (in Recents Activity)

<action android:name="com.android.systemui.recent.action.OPEN_RECENTS_INTENT_FROM_SMALL_APP_LAUNCHER" />


tll4.jpg


Now navigate to res/values/ and open “attrs.xml”

Add the line marked in green at the end of the file:

<attr name="lookupKey" format="string" />



5w0x.jpg



Now navigate to res/values/ and open “ids.xml”

Add the line marked in green at the end of the file:

<item type="id" name="recent_wipe_app">false</item>
<item type="id" name="recents_inject_custom_view">false</item>
<item type="id" name="recents_layout">false</item>
<item type="id" name="recents_pluginview_container">false</item>


xf8z.jpg


Now navigate to res/values/ and open “public.xml”

Since we will be working with hex id’s, a word of advice.

Always create a new hex id in this file. Duplicating other hex number will result in a fail when trying to recompile


As an example:

<public type="attr" name="maxSize" id="0x7f010008" />
<public type="attr" name="holdTime" id="0x7f010009" />
<public type="attr" name="decayTime" id="0x7f01000a" />
<public type="attr" name="orientation" id="0x7f01000b" />
<public type="attr" name="singleRow" id="0x7f01000c" />
<public type="attr" name="lookupKey" id="0x7f01000d" />

Notice that all the hex number are sequential? All these numbers are only found once in the entire document. If I were to add another line below LookupKey it would look like this:


<public type="attr" name="Tutorial" id="0x7f01000e" />

When in doubt as to if the number you assigned to a line, just copy the hex number and use control f to search for it. When you can’t find another line with that number, you know that your hex number is one of a kind.

Let’s get started shall we.

First of all locate the last “attr” line and add the line below marked in green:

<public type="attr" name="lookupKey" id="PUT_HEX_HERE" />


6ipu.jpg


Locate the last “layout” line (like where you put LookupKey in the example above) and add line below marked in green:

<public type="layout" name="plugin_view" id="PUT_HEX_HERE" />

Locate the last “id” line and do the same with the line below

<public type="id" name="recents_inject_custom_view" id=" PUT_HEX_HERE" " />
<public type="id" name="recents_layout" id=" PUT_HEX_HERE" " />
<public type="id" name="recents_pluginview_container" id=" PUT_HEX_HERE" " />


Now copy and paste (and overwrite) the files in the resources to res/layout and res/layout-land.

Now copy and paste (and overwrite) the .smali files in the resources to com/android/systemui and com/android/systemui/recent

Before going any further, don’t forget to save ALL the modifications you made and after that you need to right click on “SystemUI” and click on “Reload project”

Now open up RecentsActivity.smali

Virtuous Ten Studio helps you in which lines you need to alter. Every line that has an hex id will be marked by a little blue box

kry8.jpg


In the example above, 0x7f07007f represents “recents_pluginview_container” you need to change that hex number to the number you assigned to it earlier in “public.xml”

You need to change every hex number in this file to match the hex numbers you assigned earlier.

These are:

recents_pluginview_container
recents_layout
plugin_view
status_bar_recent_panel
recents_root
config_recent_item_min_alpha
recents_pluginview_container
recents_return_to_launcher_enter
recents_return_to_launcher_exit

Note that the list above is in the same order as the lines containing the hex numbers in RecentsActivity.smali. This means that “recents_pluginview_container” represents the first hex number, “recents_layout” the second, “plugin_view” the third etc. etc.

Once that is done, save the file and open R$styleable.smali.

Find line: sput-object v0, Lcom/android/systemui/R$styleable;->RecentsPanelView:[I

plid.jpg


Change that hex id to match the id for LookupKey, you added that in “public.xml”.

Save all modifications and build your project.

Zip up all the files in a flashable zip and start flashing

These are all the steps I made to get it working, I hope this guide will help others to port SmallApps/Taskswitcher.
 

Attachments

  • Screenshot_2014-04-23-22-44-00.jpg
    Screenshot_2014-04-23-22-44-00.jpg
    39.8 KB · Views: 3,096
  • Screenshot_2014-04-23-22-44-11.png
    Screenshot_2014-04-23-22-44-11.png
    141 KB · Views: 2,876
  • Screenshot_2014-04-23-22-44-21.png
    Screenshot_2014-04-23-22-44-21.png
    223.4 KB · Views: 2,769
  • Xperia-SmallApps+TaskSwitcherv2.zip
    20 MB · Views: 4,452
  • CM-11-Resources.zip
    8.9 MB · Views: 3,161
Last edited:

carlito-lt26i

Senior Member
Nov 1, 2012
211
345
nice i will try when i come home.

thanks the guide

Sent from my LT26i using xda app-developers app
 

Kevin-0100

Senior Member
Feb 16, 2013
124
70
Vlaardingen
Xperia XZ2
OnePlus 7T
In the top bar in VTS, click on view log. There you will find which lines are causing the build error. Are you trying to port it tot OmniRom? If so you should not copy and paste the .smali files in my resources as they come from another ROM (opensemc). Try using the .smali files from the OmniRom

Sent from my Xperia S using XDA Premium 4 mobile app
 
  • Like
Reactions: sud.vastav

nut27455

Member
Aug 22, 2010
30
19
Tokyo
Error on

\res\layout\status_bar_recent_panel.xml:11: error: Error: No resource found that matches the given name (at 'id' with value '@id/recents_clear').'
\res\layout-land\status_bar_recent_panel.xml:11: error: Error: No resource found that matches the given name (at 'id' with value '@id/recents_clear').'

what should I do

Using Beanstalk ROM
I found similar error and fix by find some similar picture
I already change @drawable/ic_recents_clear to @drawable/ic_notify_clear_normal in both status_bar_recent_panel.xml
 
Last edited:

Kevin-0100

Senior Member
Feb 16, 2013
124
70
Vlaardingen
Xperia XZ2
OnePlus 7T
Error on

\res\layout\status_bar_recent_panel.xml:11: error: Error: No resource found that matches the given name (at 'id' with value '@id/recents_clear').'
\res\layout-land\status_bar_recent_panel.xml:11: error: Error: No resource found that matches the given name (at 'id' with value '@id/recents_clear').'

what should I do

Using Beanstalk ROM
I found similar error and fix by find some similar picture
I already change @drawable/ic_recents_clear to @drawable/ic_notify_clear_normal in both status_bar_recent_panel.xml

You need to go to res/values/ids and make a new value for recents_clear. That should fix it

Sent from my C1905 using XDA Premium 4 mobile app
 

nut27455

Member
Aug 22, 2010
30
19
Tokyo
Got it

I/dalvikvm(3258): Could not find method com.android.systemui.recent.RecentsActivity.dismissAndDoNothing, referenced from method com.android.systemui.recent.RecentsPanelView.dismissAndDoNothing
W/dalvikvm(3258): VFY: unable to resolve virtual method 4171: Lcom/android/systemui/recent/RecentsActivity;.dismissAndDoNothing ()V
 

Kevin-0100

Senior Member
Feb 16, 2013
124
70
Vlaardingen
Xperia XZ2
OnePlus 7T
There is an error in your RecentsActivity.smali. Open that file and search for PanelView and see if everything is correct. I think the FC may be caused by an error in the PanelView section.

Sent from my C1905 using XDA Premium 4 mobile app
 

Pro_SmarT

Senior Member
Feb 10, 2014
100
37
@Kevin-0100
I can't understant last step.In oldu version. 10.1 Op write the line which we must past the hex code at the public. Find the blué line in RecentsActivity.smali but which is the "recents_pluginview_container" or "recents_layout" cant find.
 

Kevin-0100

Senior Member
Feb 16, 2013
124
70
Vlaardingen
Xperia XZ2
OnePlus 7T
You will not find "recents_activity" etc. In Recentsactivity.smali the names are replaced with hex numbers. Follow the last step precisely (using virtuous ten studio) and you will find which lines to edit

Sent from my C1905 using XDA Premium 4 mobile app
 

carlito-lt26i

Senior Member
Nov 1, 2012
211
345
First of all: this guide is based off the guide by @lukakas found here http://xdaforums.com/showthread.php?t=2460877

I tweaked it to get it to work on CM11, comparing the files of the Z2 system dump, the 4.3 resources provided in the guide by @lukakas and compared the difference with CM11 files.

In this guide I am using OPENsemc rom beta 3, wich is CyanogenMod 11 / Android KitKat

Before flashing the files, perform a FULL BACKUP in case something goes wrong!

Code:
I will NOT be held responsible if something happens to your device while or after flashing any of these files! All flashing is done at your OWN RISK.



I recommend using Virtuous Ten Studio for editing the files. It can be downloaded from: http://www.virtuous-ten-studio.com/index.php/downloads

Setting up Virtuous Ten Studio

Click on “File” then on “Open Settings” then proceed to ApkTool, and install Framework-res.apk from the rom you are trying to port SmallApps to by clicking on “Add single framework”

6rby.jpg



Android.policy.jar

Click on “Open” then on “New Project” and import anroid.policy.jar as shown below:
(note, in properties/settings click on “Smali” and make sure the API is set to 4.4 KitKat)

v4bz.jpg


Now open smali\com\android\internal\policy\impl\PhoneWindowManager.smali and select checkAddPermission from the dropdown menu

ob8x.jpg


Find and alter the following lines of code: (added code is marked in green)

.method public checkAddPermission(Landroid/view/WindowManager$LayoutParams;[I)I

(Lines of code not needed in the part of the tutorial has been cut, do not delete them though)
:cond_1
const/4 v0, 0x0

.line 1609
.local v0, permission:Ljava/lang/String;
sparse-switch v1, :sswitch_data_0

(Lines of code not needed in the part of the tutorial has been cut, do not delete them though)

:sswitch_1
const-string v0, "android.permission.SYSTEM_ALERT_WINDOW"

.line 1627
const/16 v3, 0x18

aput v3, p2, v2

goto :goto_1

.line 1397 - This number should be a new number and should not be found elsewhere in this document
:sswitch_2
const-string v0, "com.sony.smallapp.permission.SMALLAPP"


.line 1398 - This number should be a new number and should not be found elsewhere in this document
goto :goto_1


.line 1609 - This number must match the number above the line.local v0, permission:Ljava/lang/String;
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
0xbb5 -> :sswitch_2
0xbb6 -> :sswitch_2

.end sparse-switch
.end method

Press control s to save the document and recompile it: (use right click on android.policy and click “Build project”


Framework2.jar

For this step, import and decompile Framework2.jar like in steps show above. Right click on “framework2” and select “Open in windows explorer”

In the explorer screen, navigate to Data/smali/com, copy and paste the “sony” folder provided in the resources zip. Once done, right click on “framework2” and select “Reload project”

Once the project has reloaded, right click on “framework2” and select “Build project”

Framework-res.apk

Import framework-res.apk into the project.
Note: make sure before importing that in the Apk-Tool section you select “Use newest ApkTool” and that you select the Framework tag. (Remember you installed framework-res.apk earlier?)

Once framework-res.apk has imported, open AndroidManifest.XML
Add the lines marked in green like below.

<permission android:name="com.sony.smallapp.permission.CONTROL_SMALLAPP" android:protectionLevel="system|signature" />
<permission android:label="@string/permlab_smallapp" android:name="com.sony.smallapp.permission.SMALLAPP" android:protectionLevel="dangerous" android:description="@string/permdesc_smallapp" />
<permission android:label="@string/permlab_taskSwitcherPluginView" android:name="com.sonymobile.permission.TASK_SWITCHER_PLUGIN_VIEW" android:protectionLevel="signatureOrSystem" android:description="@string/permdesc_taskSwitcherPluginView" />
<permission android:name="com.sonymobile.permission.ACCESS_BEACON_MANAGER" android:protectionLevel="system|signature" />


drm8.jpg


Don’t forget to save the modifications you just made.

Next up: open res/values/ and open “strings.xml”

At the end of the file, copy the green lines:

<string name="permlab_smallapp">Small application overlay</string>
<string name="permdesc_smallapp">Allows running movable small applications on top of other applications.</string>
<string name="permlab_taskSwitcherPluginView">Provide plugin-view to the task-switcher</string>
<string name="permdesc_taskSwitcherPluginView">Allows the application to provide a plugin-view to the task-switcher</string>


r0tn.jpg


Save your modifications and and “Build project”

SystemUI.apk

This part can be the trickiest and can cause a lot of headache. Import SystemUI.apk and open AndroidManifest.xml

Note: make sure before importing that in the Apk-Tool section you select “Use newest ApkTool” and that you select the Framework tag.

Add the lines marked in green like below.

<uses-permission android:name="com.sonymobile.permission.XSSM_PROVIDER" />
<uses-permission android:name="com.sonymobile.permission.XSSM" />
<uses-permission android:name="android.permission.BIND_APPWIDGET" />
<uses-permission android:name="com.sony.smallapp.app.widget.permission.BIND_SMALLAPP_WIDGET_MANAGER" />
<uses-permission android:name="com.sony.smallapp.permission.SMALLAPPMANAGER_CONTROL" />
<uses-permission android:name="com.sony.smallapp.launcher.permission.ACCESS_DATABASE" />
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
<permission android:name="com.sonymobile.permission.TASK_SWITCHER_PLUGIN_VIEW" android:protectionLevel="normal" />


x2vu.jpg


Add the lines marked in green like below. (in Recents Activity)

<action android:name="com.android.systemui.recent.action.OPEN_RECENTS_INTENT_FROM_SMALL_APP_LAUNCHER" />


tll4.jpg


Now navigate to res/values/ and open “attrs.xml”

Add the line marked in green at the end of the file:

<attr name="lookupKey" format="string" />



5w0x.jpg



Now navigate to res/values/ and open “ids.xml”

Add the line marked in green at the end of the file:

<item type="id" name="recent_wipe_app">false</item>
<item type="id" name="recents_inject_custom_view">false</item>
<item type="id" name="recents_layout">false</item>
<item type="id" name="recents_pluginview_container">false</item>


xf8z.jpg


Now navigate to res/values/ and open “public.xml”

Since we will be working with hex id’s, a word of advice.

Always create a new hex id in this file. Duplicating other hex number will result in a fail when trying to recompile


As an example:

<public type="attr" name="maxSize" id="0x7f010008" />
<public type="attr" name="holdTime" id="0x7f010009" />
<public type="attr" name="decayTime" id="0x7f01000a" />
<public type="attr" name="orientation" id="0x7f01000b" />
<public type="attr" name="singleRow" id="0x7f01000c" />
<public type="attr" name="lookupKey" id="0x7f01000d" />

Notice that all the hex number are sequential? All these numbers are only found once in the entire document. If I were to add another line below LookupKey it would look like this:


<public type="attr" name="Tutorial" id="0x7f01000e" />

When in doubt as to if the number you assigned to a line, just copy the hex number and use control f to search for it. When you can’t find another line with that number, you know that your hex number is one of a kind.

Let’s get started shall we.

First of all locate the last “attr” line and add the line below marked in green:

<public type="attr" name="lookupKey" id="PUT_HEX_HERE" />


6ipu.jpg


Locate the last “layout” line (like where you put LookupKey in the example above) and add line below marked in green:

<public type="layout" name="plugin_view" id="PUT_HEX_HERE" />

Locate the last “id” line and do the same with the line below

<public type="id" name="recents_inject_custom_view" id=" PUT_HEX_HERE" " />
<public type="id" name="recents_layout" id=" PUT_HEX_HERE" " />
<public type="id" name="recents_pluginview_container" id=" PUT_HEX_HERE" " />


Now copy and paste (and overwrite) the files in the resources to res/layout and res/layout-land.

Now copy and paste (and overwrite) the .smali files in the resources to com/android/systemui and com/android/systemui/recent

Before going any further, don’t forget to save ALL the modifications you made and after that you need to right click on “SystemUI” and click on “Reload project”

Now open up RecentsActivity.smali

Virtuous Ten Studio helps you in which lines you need to alter. Every line that has an hex id will be marked by a little blue box

kry8.jpg


In the example above, 0x7f07007f represents “recents_pluginview_container” you need to change that hex number to the number you assigned to it earlier in “public.xml”

You need to change every hex number in this file to match the hex numbers you assigned earlier.

These are:

recents_pluginview_container
recents_layout
plugin_view
status_bar_recent_panel
recents_root
config_recent_item_min_alpha
recents_pluginview_container
recents_return_to_launcher_enter
recents_return_to_launcher_exit

Note that the list above is in the same order as the lines containing the hex numbers in RecentsActivity.smali. This means that “recents_pluginview_container” represents the first hex number, “recents_layout” the second, “plugin_view” the third etc. etc.

Once that is done, save the file and open R$styleable.smali.

Find line: sput-object v0, Lcom/android/systemui/R$styleable;->RecentsPanelView:[I

plid.jpg


Change that hex id to match the id for LookupKey, you added that in “public.xml”.

Save all modifications and build your project.

Zip up all the files in a flashable zip and start flashing

These are all the steps I made to get it working, I hope this guide will help others to port SmallApps/Taskswitcher.



when i recompile, erro RecentsActivity$1.smali show screenshotView attachment 2715043
 

Top Liked Posts

  • There are no posts matching your filters.
  • 25
    First of all: this guide is based off the guide by @lukakas found here http://xdaforums.com/showthread.php?t=2460877

    I tweaked it to get it to work on CM11, comparing the files of the Z2 system dump, the 4.3 resources provided in the guide by @lukakas and compared the difference with CM11 files.

    In this guide I am using OPENsemc rom beta 3, wich is CyanogenMod 11 / Android KitKat

    Before flashing the files, perform a FULL BACKUP in case something goes wrong!

    Code:
    I will NOT be held responsible if something happens to your device while or after flashing any of these files! All flashing is done at your OWN RISK.



    I recommend using Virtuous Ten Studio for editing the files. It can be downloaded from: http://www.virtuous-ten-studio.com/index.php/downloads

    Setting up Virtuous Ten Studio

    Click on “File” then on “Open Settings” then proceed to ApkTool, and install Framework-res.apk from the rom you are trying to port SmallApps to by clicking on “Add single framework”

    6rby.jpg



    Android.policy.jar

    Click on “Open” then on “New Project” and import anroid.policy.jar as shown below:
    (note, in properties/settings click on “Smali” and make sure the API is set to 4.4 KitKat)

    v4bz.jpg


    Now open smali\com\android\internal\policy\impl\PhoneWindowManager.smali and select checkAddPermission from the dropdown menu

    ob8x.jpg


    Find and alter the following lines of code: (added code is marked in green)

    .method public checkAddPermission(Landroid/view/WindowManager$LayoutParams;[I)I

    (Lines of code not needed in the part of the tutorial has been cut, do not delete them though)
    :cond_1
    const/4 v0, 0x0

    .line 1609
    .local v0, permission:Ljava/lang/String;
    sparse-switch v1, :sswitch_data_0

    (Lines of code not needed in the part of the tutorial has been cut, do not delete them though)

    :sswitch_1
    const-string v0, "android.permission.SYSTEM_ALERT_WINDOW"

    .line 1627
    const/16 v3, 0x18

    aput v3, p2, v2

    goto :goto_1

    .line 1397 - This number should be a new number and should not be found elsewhere in this document
    :sswitch_2
    const-string v0, "com.sony.smallapp.permission.SMALLAPP"


    .line 1398 - This number should be a new number and should not be found elsewhere in this document
    goto :goto_1


    .line 1609 - This number must match the number above the line.local v0, permission:Ljava/lang/String;
    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
    0xbb5 -> :sswitch_2
    0xbb6 -> :sswitch_2

    .end sparse-switch
    .end method

    Press control s to save the document and recompile it: (use right click on android.policy and click “Build project”


    Framework2.jar

    For this step, import and decompile Framework2.jar like in steps show above. Right click on “framework2” and select “Open in windows explorer”

    In the explorer screen, navigate to Data/smali/com, copy and paste the “sony” folder provided in the resources zip. Once done, right click on “framework2” and select “Reload project”

    Once the project has reloaded, right click on “framework2” and select “Build project”

    Framework-res.apk

    Import framework-res.apk into the project.
    Note: make sure before importing that in the Apk-Tool section you select “Use newest ApkTool” and that you select the Framework tag. (Remember you installed framework-res.apk earlier?)

    Once framework-res.apk has imported, open AndroidManifest.XML
    Add the lines marked in green like below.

    <permission android:name="com.sony.smallapp.permission.CONTROL_SMALLAPP" android:protectionLevel="system|signature" />
    <permission android:label="@string/permlab_smallapp" android:name="com.sony.smallapp.permission.SMALLAPP" android:protectionLevel="dangerous" android:description="@string/permdesc_smallapp" />
    <permission android:label="@string/permlab_taskSwitcherPluginView" android:name="com.sonymobile.permission.TASK_SWITCHER_PLUGIN_VIEW" android:protectionLevel="signatureOrSystem" android:description="@string/permdesc_taskSwitcherPluginView" />
    <permission android:name="com.sonymobile.permission.ACCESS_BEACON_MANAGER" android:protectionLevel="system|signature" />


    drm8.jpg


    Don’t forget to save the modifications you just made.

    Next up: open res/values/ and open “strings.xml”

    At the end of the file, copy the green lines:

    <string name="permlab_smallapp">Small application overlay</string>
    <string name="permdesc_smallapp">Allows running movable small applications on top of other applications.</string>
    <string name="permlab_taskSwitcherPluginView">Provide plugin-view to the task-switcher</string>
    <string name="permdesc_taskSwitcherPluginView">Allows the application to provide a plugin-view to the task-switcher</string>


    r0tn.jpg


    Save your modifications and and “Build project”

    SystemUI.apk

    This part can be the trickiest and can cause a lot of headache. Import SystemUI.apk and open AndroidManifest.xml

    Note: make sure before importing that in the Apk-Tool section you select “Use newest ApkTool” and that you select the Framework tag.

    Add the lines marked in green like below.

    <uses-permission android:name="com.sonymobile.permission.XSSM_PROVIDER" />
    <uses-permission android:name="com.sonymobile.permission.XSSM" />
    <uses-permission android:name="android.permission.BIND_APPWIDGET" />
    <uses-permission android:name="com.sony.smallapp.app.widget.permission.BIND_SMALLAPP_WIDGET_MANAGER" />
    <uses-permission android:name="com.sony.smallapp.permission.SMALLAPPMANAGER_CONTROL" />
    <uses-permission android:name="com.sony.smallapp.launcher.permission.ACCESS_DATABASE" />
    <uses-permission android:name="android.permission.DELETE_PACKAGES" />
    <permission android:name="com.sonymobile.permission.TASK_SWITCHER_PLUGIN_VIEW" android:protectionLevel="normal" />


    x2vu.jpg


    Add the lines marked in green like below. (in Recents Activity)

    <action android:name="com.android.systemui.recent.action.OPEN_RECENTS_INTENT_FROM_SMALL_APP_LAUNCHER" />


    tll4.jpg


    Now navigate to res/values/ and open “attrs.xml”

    Add the line marked in green at the end of the file:

    <attr name="lookupKey" format="string" />



    5w0x.jpg



    Now navigate to res/values/ and open “ids.xml”

    Add the line marked in green at the end of the file:

    <item type="id" name="recent_wipe_app">false</item>
    <item type="id" name="recents_inject_custom_view">false</item>
    <item type="id" name="recents_layout">false</item>
    <item type="id" name="recents_pluginview_container">false</item>


    xf8z.jpg


    Now navigate to res/values/ and open “public.xml”

    Since we will be working with hex id’s, a word of advice.

    Always create a new hex id in this file. Duplicating other hex number will result in a fail when trying to recompile


    As an example:

    <public type="attr" name="maxSize" id="0x7f010008" />
    <public type="attr" name="holdTime" id="0x7f010009" />
    <public type="attr" name="decayTime" id="0x7f01000a" />
    <public type="attr" name="orientation" id="0x7f01000b" />
    <public type="attr" name="singleRow" id="0x7f01000c" />
    <public type="attr" name="lookupKey" id="0x7f01000d" />

    Notice that all the hex number are sequential? All these numbers are only found once in the entire document. If I were to add another line below LookupKey it would look like this:


    <public type="attr" name="Tutorial" id="0x7f01000e" />

    When in doubt as to if the number you assigned to a line, just copy the hex number and use control f to search for it. When you can’t find another line with that number, you know that your hex number is one of a kind.

    Let’s get started shall we.

    First of all locate the last “attr” line and add the line below marked in green:

    <public type="attr" name="lookupKey" id="PUT_HEX_HERE" />


    6ipu.jpg


    Locate the last “layout” line (like where you put LookupKey in the example above) and add line below marked in green:

    <public type="layout" name="plugin_view" id="PUT_HEX_HERE" />

    Locate the last “id” line and do the same with the line below

    <public type="id" name="recents_inject_custom_view" id=" PUT_HEX_HERE" " />
    <public type="id" name="recents_layout" id=" PUT_HEX_HERE" " />
    <public type="id" name="recents_pluginview_container" id=" PUT_HEX_HERE" " />


    Now copy and paste (and overwrite) the files in the resources to res/layout and res/layout-land.

    Now copy and paste (and overwrite) the .smali files in the resources to com/android/systemui and com/android/systemui/recent

    Before going any further, don’t forget to save ALL the modifications you made and after that you need to right click on “SystemUI” and click on “Reload project”

    Now open up RecentsActivity.smali

    Virtuous Ten Studio helps you in which lines you need to alter. Every line that has an hex id will be marked by a little blue box

    kry8.jpg


    In the example above, 0x7f07007f represents “recents_pluginview_container” you need to change that hex number to the number you assigned to it earlier in “public.xml”

    You need to change every hex number in this file to match the hex numbers you assigned earlier.

    These are:

    recents_pluginview_container
    recents_layout
    plugin_view
    status_bar_recent_panel
    recents_root
    config_recent_item_min_alpha
    recents_pluginview_container
    recents_return_to_launcher_enter
    recents_return_to_launcher_exit

    Note that the list above is in the same order as the lines containing the hex numbers in RecentsActivity.smali. This means that “recents_pluginview_container” represents the first hex number, “recents_layout” the second, “plugin_view” the third etc. etc.

    Once that is done, save the file and open R$styleable.smali.

    Find line: sput-object v0, Lcom/android/systemui/R$styleable;->RecentsPanelView:[I

    plid.jpg


    Change that hex id to match the id for LookupKey, you added that in “public.xml”.

    Save all modifications and build your project.

    Zip up all the files in a flashable zip and start flashing

    These are all the steps I made to get it working, I hope this guide will help others to port SmallApps/Taskswitcher.
    3
    Later this evening I will upload my modded files for you to try :)

    Sent from my C1905 using XDA Premium 4 mobile app
    2
    Error on

    \res\layout\status_bar_recent_panel.xml:11: error: Error: No resource found that matches the given name (at 'id' with value '@id/recents_clear').'
    \res\layout-land\status_bar_recent_panel.xml:11: error: Error: No resource found that matches the given name (at 'id' with value '@id/recents_clear').'

    what should I do

    Using Beanstalk ROM
    I found similar error and fix by find some similar picture
    I already change @drawable/ic_recents_clear to @drawable/ic_notify_clear_normal in both status_bar_recent_panel.xml

    You need to go to res/values/ids and make a new value for recents_clear. That should fix it

    Sent from my C1905 using XDA Premium 4 mobile app
    2
    If you get a logcat you could try finding the reason for the FC

    Sent from my C1905 using XDA Premium 4 mobile app
    2
    i am success.1399219373851.jpg1399219386313.jpg1399219398581.jpg



    look nice .thank you very much.mate
    Sent from my LT26i using XDA Free mobile app