Transplant Sony's floating gadget
Transplant Sony's floating gadget

 
Sony's newly released Xperia has a floating gadget function, which can easily use computers, laptops, etc. without switching applications. Today, let's teach you how to transplant this function to other CM systems without Xperia.

This article is not suitable for users without experience. Please build a decompilation environment for android apk by yourself. The author is not responsible for any accidents.

Step 1:

Decompile the framework-res.apk in your current ROM

Find res/values/strings.xml in the export directory and insert the following lines to 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

Then add the following two lines of code

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" />

as well as

code:
 <permission android:name="com.sony.smallapp.permission.SMALLAPP" android:label="@string/permlab_smallapp" android:description="@string/permdesc_smallapp" android:protectionLevel="dangerous" />

As shown in the figure below

Recompile framework-res.apk

 

Step 2:

Decompile android.policy.jar

Find com android internal policy impl PhoneWindowManager.smal

Add the following red paragraph

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 you don't have one .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"

Then find the following section

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

All blue The marked part is replaced by gules Marking section

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 and recompile android policy.jar

 
Step 3:


Decompile framework.jar
Put the entire sony folder into the export folder smali/com
Then recompile framework.jar

 
Step 4:


Add floating tool framework to system/app, system/etc and system/framework
All the files have been packed, or you can use them to add them directly to the brush package you made.

 
Step 5:

You need to download one more To launch these gadgets, which can be found in Google Play

Done! You can enjoy these gadgets in most CM based ROMs.

The screenshot shows the Galaxy SL running CM10 and installing the xperia theme.

 

This method is only tested in most Xperia devices and Galaxy SLs using CM9, cm10, PA, and PACMAN.

 

Learn more about new cool devices, stay tuned

Share:
igao7-Mr.DoubleX
edit
Focus on computer for 20 years!
Share Weibo Share WeChat
 Aigoji WeChat

Aigoji WeChat

 WeChat

WeChat

Recommended products

Sorry, the product you are looking for is not available in the product library

on trial