Friday, May 23, 2014

[GUIDE][CM10.1/JB 4.2] HOW TO PORT SONY SMALL APPS

How to port sony small apps, Hallo droiders setelah kemaren ngeshare Cara Menambahkan Traffic Thinking Bridge/ChaOS dan sebelumnya lagi Cara Membuat Xperia Z Lockscreen for JB sekarang mau ngeshare ga jauh jauh dari SONY nih, yaitu HOW TO PORT SONY SMALL APPS, ini di port dari JB 4.3 Xperia Z yang working di Device 4.2+. Untested di JB 4.1 or ICS yah.

Langsung aja ya ::

Bahan-bahannya :
  1. APK MULTI TOOLS, APK TOOLS, alat untuk compile/decompile lainnya.
  2. framework-res.apk
  3. framework.jar
  4. android.policy.jar
  5. SystemUI.apk
  6. Niat

Langkah-langkahnya :
android.policy.jar 
  • Decompile android.policy.jar
  • Buka smali/com/android/internal/policy/impl/PhoneWindowManager.smali
  • Ctrl+f code ini
.method public checkAddPermission(Landroid/view/WindowManager$LayoutParams;)I
  • Lalu hapus sampai .end method kemudian ganti dengan ini
.method public checkAddPermission(Landroid/view/WindowManager$LayoutParams;)I
    .locals 4
    .parameter "attrs"

    .prologue
    const/4 v2, 0x0

    .line 1315
    iget v1, p1, Landroid/view/WindowManager$LayoutParams;->type:I

    .line 1317
    .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 1353
    :cond_0
    :goto_0
    return v2

    .line 1321
    :cond_1
    const/4 v0, 0x0

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

    .line 1345
    const-string v0, "android.permission.INTERNAL_SYSTEM_WINDOW"

    .line 1347
    :goto_1
    :sswitch_0
    if-eqz v0, :cond_0

    .line 1348
    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 1350
    const/4 v2, -0x8

    goto :goto_0

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

    .line 1339
    goto :goto_1

    .line 1342
    :sswitch_2
    const-string v0, "com.sony.smallapp.permission.SMALLAPP"

    .line 1343
    goto :goto_1

    .line 1322
    :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
  • Save lalu recompile dah.
framework.jar 
  • Decompile framework.jar
  • Download filenya disini, ekstrak lalu taroh di smali/com/disini
  • Recompile dan Done
framework-res.apk 
  • Decompile framework-res.apk
  • Buka android.manifest.xml, lalu tambahkan line berikut tepat di bawah line permission terakhir
<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" />
  • Buka res/values/strings.xml lalu tambahkan
<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>
<string name="permlab_smallapp">Small application overlay</string>
<string name="permdesc_smallapp">Allows running movable small applications on top of other applications.</string>
  • Save and Recompile and sign
  • Done
SystemUI.apk 
  • Decompile SystemUI.apk
  • Buka android.manifest.xml, lalu tambahkan line ini setelah line permission terakhir
<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="signatureOrSystem" />
  • Lalu ctrl+f line ini
<action android:name="com.android.systemui.TOGGLE_RECENTS" />
  • Tambahkan tepat di bawahnya
<action android:name="com.android.systemui.recent.action.OPEN_RECENTS_INTENT_FROM_SMALL_APP_LAUNCHER" />
  • Buka res/values/attrs.xml lalu tambahkan
<attr name="lookupKey" format="string" />
  • Buka ids.xml, lalu tambahkan (bila sudah ada maka ga usah)
<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>
    <item type="id" name="recents_clear">false</item>
    <item type="id" name="recents_inject_closeall_button">false</item>
    <item type="id" name="recents_transition_background">false</item>
    <item type="id" name="recents_transition_placeholder_icon">false</item>
  • Buka dimens.xml, lalu tambahkan
<dimen name="task_killer_button_layout_padding_top">0.0dip</dimen>
    <dimen name="task_killer_button_layout_padding_left">16.0dip</dimen>
  • Download File tambahannya disini, ekstrak lalu taroh di tempatnya, replace aja.
  • Kalo mau xml ane yg udah jadi Sense recent apps, bisa download xmlnya filenya disini tapi tetep kudu download yg File tambahannya soalnya smalinya disini haha
  • Recompile, sign dan pastikan ga ada yang error.
  • Decompile lagi
  • Buka public.xml
  • Download Public.xml ane (buat nyocokin code public di smali)
  • Yang perlu di cocokin code publicnya hanya com/android/systemui/R$styleable.smali dan com/android/systemui/recent/RecentsActivity.smali
  • Kalo udah, save recompile
  • Sign and Done
  • Kalo ada yg FC biasakan pake Catlog biar tau dimana errornya, bisa liat di Cara memakai CatLog  
Kalo udah masukin semua file tadi ke flashable.zip ini dengan rincian SystemUI.apk ke system/app dan sisanya ke system/framework.
Kalo ada yang error bisa langsung comment atau hubungin ane :v

SS ::



Tested :
A7S
IMO S89

Thanks to :
Allah SWT
Ori Mardo
Lukakas@xda
you

19 komentar

Mastah... Ada tutor dc rc ga sih... Kok ane gagal trus ya... Selalu sysui telah berhenti truss...

This comment has been removed by the author.

Gan link download bahan tidak bs dibuka

koq ane ga bisa nyari di bbm channel nya gan ...?

Gan, Saya mau minta bantuannya neh. Krn di Blog ini banyak sekali tutor modding Android. Apa ada tutor untuk membuat Dual 3G di Stock ROM? Saya cari tutor di XDA gak pernah dapet ampe skrng. Please help.

link smali framework.jar uda expired kaga bisa donlot reupload um...

om bisa kasih cara lbh detil bagian mana aja yg harus di compare di smali recent activity dan $styleable smali. ane bingun di step ini. line mana aja yg harus ane cocokin dgn id public.di bantu om. makasih

kan tinggal replace aja um, jangan compare, langsung aja replace, jadi semua code public dsana kudu disamakan.

lagian ga banyak2 bngt kok public yg kudu di samakan :-)

oh jadi kode public sdh ada di smali om. jadi tinggal masukkan public punya om ke public ane.seperti recent layout atau recent root.sip om makasih.coba lg

kebalik um, di smalinya kan masi pake code public ane, nah ente ganti pake code public ente :-)

udah beres semua om tp pas home di tahan lama UI fc trs normal lg. tu salah di mana om? confirm om fb ane @ abdullah baaqil. dah ane add om tio

udh beres semua ? udh di sign ?? ada logcatnya ga ??

udah di sign om. ampe 3 kali nyoba hasil sama.

09-02 21:17:48.900 E/EnterpriseContainerManager(2468): ContainerPolicy Service is not yet ready!!!
09-02 21:17:48.910 E/EnterpriseContainerManager(2468): ContainerPolicy Service is not yet ready!!!
09-02 21:17:48.915 E/EnterpriseContainerManager(2468): ContainerPolicy Service is not yet ready!!!
09-02 21:17:48.920 E/EnterpriseContainerManager(2468): ContainerPolicy Service is not yet ready!!!
09-02 21:17:48.920 E/EnterpriseContainerManager(2468): ContainerPolicy Service is not yet ready!!!
09-02 21:17:48.920 E/EnterpriseContainerManager(2468): ContainerPolicy Service is not yet ready!!!
09-02 21:17:48.920 E/EnterpriseContainerManager(2468): ContainerPolicy Service is not yet ready!!!
09-02 21:17:48.920 E/EnterpriseContainerManager(2468): ContainerPolicy Service is not yet ready!!!
09-02 21:17:48.935 E/EnterpriseContainerManager(2468): ContainerPolicy Service is not yet ready!!!
09-02 21:17:48.955 E/EnterpriseContainerManager(2468): ContainerPolicy Service is not yet ready!!!
09-02 21:17:48.970 E/EnterpriseContainerManager(2468): ContainerPolicy Service is not yet ready!!!
09-02 21:17:48.975 E/EnterpriseContainerManager(2468): ContainerPolicy Service is not yet ready!!!
09-02 21:17:48.980 E/EnterpriseContainerManager(2468): ContainerPolicy Service is not yet ready!!!
09-02 21:17:49.145 E/ (2890): Device driver API match
09-02 21:17:49.145 E/ (2890): Device driver API version: 23
09-02 21:17:49.145 E/ (2890): User space API version: 23
09-02 21:17:49.145 E/ (2890): mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Fri Mar 21 13:52:50 KST 2014
09-02 21:17:49.675 E/OpenGLRenderer(4921): SFEffectCache:clear(), mSize = 0
09-02 21:17:51.410 E/EnterpriseContainerManager(2468): ContainerPolicy Service is not yet ready!!!
09-02 21:17:51.540 E/ActivityThread(7591): Pause GC
09-02 21:17:51.540 E/ActivityThread(7591): java.lang.reflect.InvocationTargetException
09-02 21:17:51.540 E/ActivityThread(7591): at java.lang.reflect.Method.invokeNative(Native Method)
09-02 21:17:51.540 E/ActivityThread(7591): at java.lang.reflect.Method.invoke(Method.java:515)
09-02 21:17:51.540 E/ActivityThread(7591): at android.app.ActivityThread.pauseGC(ActivityThread.java)
09-02 21:17:51.540 E/ActivityThread(7591): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java)
09-02 21:17:51.540 E/ActivityThread(7591): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java)
09-02 21:17:51.540 E/ActivityThread(7591): at android.app.ActivityThread.access$900(ActivityThread.java)
09-02 21:17:51.540 E/ActivityThread(7591): at android.app.ActivityThread$H.handleMessage(ActivityThread.java)
09-02 21:17:51.540 E/ActivityThread(7591): at android.os.Handler.dispatchMessage(Handler.java)
09-02 21:17:51.540 E/ActivityThread(7591): at android.os.Looper.loop(Looper.java)
09-02 21:17:51.540 E/ActivityThread(7591): at android.app.ActivityThread.main(ActivityThread.java)
09-02 21:17:51.540 E/ActivityThread(7591): at java.lang.reflect.Method.invokeNative(Native Method)
09-02 21:17:51.540 E/ActivityThread(7591): at java.lang.reflect.Method.invoke(Method.java:515)
09-02 21:17:51.540 E/ActivityThread(7591): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
09-02 21:17:51.540 E/ActivityThread(7591): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
09-02 21:17:51.540 E/ActivityThread(7591): at dalvik.system.NativeStart.main(Native Method)
09-02 21:17:51.540 E/ActivityThread(7591): Caused by: java.lang.UnsatisfiedLinkError: Native method not found: dalvik.system.VMRuntime.pauseGc:(Ljava/lang/String;)I
09-02 21:17:51.540 E/ActivityThread(7591): at dalvik.system.VMRuntime.pauseGc(Native Method)
09-02 21:17:51.540 E/ActivityThread(7591): ... 15 more

09-02 21:17:51.590 E/rsC++ (2890): RS Message thread exiting.
09-02 21:17:51.595 E/OpenGLRenderer(2890): SFEffectCache:clear(), mSize = 0
09-02 21:17:52.265 E/cutils-trace(7615): Error opening trace file: No such file or directory (2)
09-02 21:17:52.400 E/memtrack(7615): Couldn't load memtrack module (No such file or directory)
09-02 21:17:52.400 E/android.os.Debug(7615): failed to load memtrack module: -2
09-02 21:17:53.300 E/OpenGLRenderer(6270): SFEffectCache:clear(), mSize = 0
09-02 21:17:53.775 E/cutils-trace(7650): Error opening trace file: No such file or directory (2)
09-02 21:17:53.905 E/memtrack(7650): Couldn't load memtrack module (No such file or directory)
09-02 21:17:53.905 E/android.os.Debug(7650): failed to load memtrack module: -2
09-02 21:17:54.160 E/cutils-trace(7664): Error opening trace file: No such file or directory (2)
09-02 21:17:54.305 E/memtrack(7664): Couldn't load memtrack module (No such file or directory)
09-02 21:17:54.305 E/android.os.Debug(7664): failed to load memtrack module: -2
09-02 21:17:54.520 E/cutils-trace(7674): Error opening trace file: No such file or directory (2)
09-02 21:17:54.670 E/memtrack(7674): Couldn't load memtrack module (No such file or directory)
09-02 21:17:54.670 E/android.os.Debug(7674): failed to load memtrack module: -2
09-02 21:18:03.010 E/Watchdog(2468): !@Sync 27
09-02 21:18:03.350 E/ViewRootImpl(7591): sendUserActionEvent() mView == null
09-02 21:18:04.810 E/ViewRootImpl(7591): sendUserActionEvent() mView == null
09-02 21:18:10.445 E/ViewRootImpl(7591): sendUserActionEvent() mView == null
09-02 21:18:16.845 E/ViewRootImpl(7591): sendUserActionEvent() mView == null

log ane om.ga semua ane post.confirm om fb ane ya biar ane gampang kirim logcat

gan kalo di ks 4.4.2 bisa gk pake cara ini?

gan, compile awal sebelum nembak public udah gagal duluan, ini logcatnya gan, solusinya gimana gan
..\Decompiled_apk\SystemUI\smali\com\android\systemui\recent\RecentsActivity$1.smali[24,4] Error for input '.parameter': Invalid directive
..\Decompiled_apk\SystemUI\smali\com\android\systemui\recent\RecentsActivity$1.smali[39,4] Error for input '.parameter': Invalid directive
..\Decompiled_apk\SystemUI\smali\com\android\systemui\recent\RecentsActivity$1.smali[40,4] Error for input '.parameter': Invalid directive
..\Decompiled_apk\SystemUI\smali\com\android\systemui\recent\RecentsActivity$1.smali[39,15] mismatched input '"context"' expecting END_METHOD_DIRECTIVE
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: com/android/systemui/recent/RecentsActivity$1.smali
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:72)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:56)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:41)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:338)
at brut.androlib.Androlib.buildSources(Androlib.java:299)
at brut.androlib.Androlib.build(Androlib.java:285)
at brut.androlib.Androlib.build(Androlib.java:258)
at brut.apktool.Main.cmdBuild(Main.java:236)
at brut.apktool.Main.main(Main.java:88)
The system cannot find the file specified.
The system cannot find the file specified.

Berkomentarlah yang baik, tidak mencela postingan :-) . Gunakan bahasa yang sopan dan mudah di mengerti.

TERIMA KASIH TELAH BERKOMENTAR, karena pengunjung yang baik adalah pengunjung yang berkomentar :-) :v
EmoticonEmoticon