Friday, August 22, 2014

[GUIDE] HOW TO PORT OMNI HEADER

How to port omni header ,Hallo droiders, selamat pagi kali ini ane mau ngeshare sebuah postingan, yaitu [GUIDE] HOW TO PORT OMNI HEADER, nah Omni Header itu apa ?? Ane juga gtw (asli) wkwkw, maybe salah satu feature dari Omni Rom kebetulan Device ane ga dapet itu ROM wkwk, Nah apa spesialnya ?? jadi nanti kalo uda jadi, itu Background ekspanded header berubah otomatis sesuai waktu berkala, kaya samsung accu weather gitu, berubah sesuai waktu.


OK langsung aja ya,
Bahan-bahan :
  1. APK MULTI TOOLS, APK TOOLS, alat untuk compile/decompile lainnya.
  2. SystemUI.apk
  3. Settings.apk
  4. Niat
Langkah-langkah :
SystemUI.apk
  • Download bahan-bahannya disini.
  • Ekstrak, lalu taroh di tempatnya masing-masing.
  • Buka smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali
  • Ctrl+f .field mStatusIcons:Landroid/widget/LinearLayout;
  • Lalu tambahkan tepat di atasnya :
.field private mStatusHeaderMachine:Lcom/android/systemui/omni/adi/StatusHeaderMachine;

.field private mStatusHeaderUpdater:Ljava/lang/Runnable;
  • Ctrl+f .method static synthetic access$2300
  • Lalu tambahkan tepat di atasnya :
.method static synthetic access$22900(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)Lcom/android/systemui/omni/adi/StatusHeaderMachine;
    .locals 1
    .parameter "x0"

    .prologue
    .line 152
    iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusHeaderMachine:Lcom/android/systemui/omni/adi/StatusHeaderMachine;

    return-object v0
.end method
  • Ctrl+f .method static synthetic access$3400
  • Lalu tambahkan tepat di atasnya :
.method static synthetic access$33000(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;Landroid/graphics/drawable/Drawable;)V
    .locals 0
    .parameter "x0"
    .parameter "x1"

    .prologue
    .line 152
    invoke-direct {p0, p1}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->setNotificationPanelHeaderBackground(Landroid/graphics/drawable/Drawable;)V

    return-void
.end method

.method static synthetic access$33100(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)Lcom/android/systemui/statusbar/BaseStatusBar$H;
    .locals 1
    .parameter "x0"

    .prologue
    .line 152
    iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mHandler:Lcom/android/systemui/statusbar/BaseStatusBar$H;

    return-object v0
.end method
  • Ctrl+f .method private setPileLayers(I)V
  • Lalu tambahkan tepat di atasnya :
.method private setNotificationPanelHeaderBackground(Landroid/graphics/drawable/Drawable;)V
    .locals 6
    .parameter "dw"

    .prologue
    const/4 v5, 0x1

    .line 1441
    const/4 v3, 0x2

    new-array v0, v3, [Landroid/graphics/drawable/Drawable;

    .line 1443
    .local v0, arrayDrawable:[Landroid/graphics/drawable/Drawable;
    instance-of v3, p1, Landroid/graphics/drawable/BitmapDrawable;

    if-eqz v3, :cond_0

    move-object v1, p1

    .line 1444
    check-cast v1, Landroid/graphics/drawable/BitmapDrawable;

    .line 1445
    .local v1, bdw:Landroid/graphics/drawable/BitmapDrawable;
    const/16 v3, 0x30

    invoke-virtual {v1, v3}, Landroid/graphics/drawable/BitmapDrawable;->setGravity(I)V

    .line 1448
    .end local v1           #bdw:Landroid/graphics/drawable/BitmapDrawable;
    :cond_0
    instance-of v3, p1, Landroid/graphics/drawable/BitmapDrawable;

    if-nez v3, :cond_1

    iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelHeader:Landroid/view/View;

    invoke-virtual {v3}, Landroid/view/View;->getBackground()Landroid/graphics/drawable/Drawable;

    move-result-object v3

    instance-of v3, v3, Landroid/graphics/drawable/BitmapDrawable;

    if-nez v3, :cond_1

    iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelHeader:Landroid/view/View;

    invoke-virtual {v3}, Landroid/view/View;->getBackground()Landroid/graphics/drawable/Drawable;

    move-result-object v3

    instance-of v3, v3, Landroid/graphics/drawable/TransitionDrawable;

    if-nez v3, :cond_1

    .line 1461
    :goto_0
    return-void

    .line 1454
    :cond_1
    const/4 v3, 0x0

    iget-object v4, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelHeader:Landroid/view/View;

    invoke-virtual {v4}, Landroid/view/View;->getBackground()Landroid/graphics/drawable/Drawable;

    move-result-object v4

    aput-object v4, v0, v3

    .line 1455
    aput-object p1, v0, v5

    .line 1457
    new-instance v2, Landroid/graphics/drawable/TransitionDrawable;

    invoke-direct {v2, v0}, Landroid/graphics/drawable/TransitionDrawable;-><init>([Landroid/graphics/drawable/Drawable;)V

    .line 1458
    .local v2, transitionDrawable:Landroid/graphics/drawable/TransitionDrawable;
    invoke-virtual {v2, v5}, Landroid/graphics/drawable/TransitionDrawable;->setCrossFadeEnabled(Z)V

    .line 1459
    iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelHeader:Landroid/view/View;

    invoke-virtual {v3, v2}, Landroid/view/View;->setBackgroundDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 1460
    const/16 v3, 0x3e8

    invoke-virtual {v2, v3}, Landroid/graphics/drawable/TransitionDrawable;->startTransition(I)V

    goto :goto_0
.end method
  • Ctrl+f .method private updateNotificationSimInfo
  • Lalu tambahkan di atasnya :
.method private updateCustomHeaderStatus()V
    .locals 4

    .prologue
    const/4 v0, 0x1

    const/4 v2, 0x0

    .line 1401
    iget-object v3, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;

    invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    .line 1402
    .local v1, resolver:Landroid/content/ContentResolver;
    const-string v3, "status_bar_custom_header"

    invoke-static {v1, v3, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

    move-result v3

    if-ne v3, v0, :cond_0

    .line 1405
    .local v0, customHeader:Z
    :goto_0
    iget-object v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelHeader:Landroid/view/View;

    if-nez v2, :cond_1

    .line 1438
    :goto_1
    return-void

    .end local v0           #customHeader:Z
    :cond_0
    move v0, v2

    .line 1402
    goto :goto_0

    .line 1408
    .restart local v0       #customHeader:Z
    :cond_1
    if-eqz v0, :cond_3

    .line 1409
    iget-object v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusHeaderUpdater:Ljava/lang/Runnable;

    if-nez v2, :cond_2

    .line 1410
    new-instance v2, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$52;

    invoke-direct {v2, p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$52;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)V

    iput-object v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusHeaderUpdater:Ljava/lang/Runnable;

    .line 1430
    :cond_2
    iget-object v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mHandler:Lcom/android/systemui/statusbar/BaseStatusBar$H;

    iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusHeaderUpdater:Ljava/lang/Runnable;

    invoke-virtual {v2, v3}, Lcom/android/systemui/statusbar/BaseStatusBar$H;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 1431
    iget-object v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mHandler:Lcom/android/systemui/statusbar/BaseStatusBar$H;

    iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusHeaderUpdater:Ljava/lang/Runnable;

    invoke-virtual {v2, v3}, Lcom/android/systemui/statusbar/BaseStatusBar$H;->post(Ljava/lang/Runnable;)Z

    goto :goto_1

    .line 1433
    :cond_3
    iget-object v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusHeaderUpdater:Ljava/lang/Runnable;

    if-eqz v2, :cond_4

    .line 1434
    iget-object v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mHandler:Lcom/android/systemui/statusbar/BaseStatusBar$H;

    iget-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusHeaderUpdater:Ljava/lang/Runnable;

    invoke-virtual {v2, v3}, Lcom/android/systemui/statusbar/BaseStatusBar$H;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 1436
    :cond_4
    iget-object v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusHeaderMachine:Lcom/android/systemui/omni/adi/StatusHeaderMachine;

    invoke-virtual {v2}, Lcom/android/systemui/omni/adi/StatusHeaderMachine;->getDefault()Landroid/graphics/drawable/Drawable;

    move-result-object v2

    invoke-direct {p0, v2}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->setNotificationPanelHeaderBackground(Landroid/graphics/drawable/Drawable;)V

    goto :goto_1
.end method
  • Ctrl+f iput-object v1, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelHeader:Landroid/view/View; (INGAT v1, v0 BERBEDA SETIAP ROM/DEVICE !!!)
  • Tepat di bawahnya tambahkan (SESUAIKAN VARIABLE DARI iput, iget, invoke dengan smali ente, dengan cara liat ke line atasnya, jadi SESUAIKAN) :
new-instance v1, Lcom/android/systemui/omni/adi/StatusHeaderMachine;

    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;

    invoke-direct {v1, v2}, Lcom/android/systemui/omni/adi/StatusHeaderMachine;-><init>(Landroid/content/Context;)V

    move-object/from16 v0, p0

    iput-object v1, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusHeaderMachine:Lcom/android/systemui/omni/adi/StatusHeaderMachine;

    invoke-direct/range {p0 .. p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->updateCustomHeaderStatus()V
  • Sesuaikan dengan teliti, salah satu aja ente masukin variable, di jamin FC itu SystemUI
  • Save, Recompile SystemUI
  • Decompile kembali
  • Buka Public.xml lalu buka juga smali/com/android/systemui/omni/adi/StatusHeaderMachine.smali
search di smali                    search di public.xml
  0x7f020275                       <public type="drawable" name="notifhead_christmas"
  0x7f020279                       <public type="drawable" name="tahun_baru_newyearseve"
  0x7f020274                       <public type="drawable" name="malem_night"
  0x7f020276                       <public type="drawable" name="pagi_morning"
  0x7f020277                       <public type="drawable" name="siang_afternoon"
  0x7f020278                       <public type="drawable" name="sore_evening"
  0x7f02011d                       <public type="drawable" name="notification_panel_bg"
  0x7f02011d                       <public type="drawable" name="notification_panel_bg"
  • Save, Recompile
  • Done

Settings.apk 
  • Download bahan-bahannya disini
  • Ekstrak lalu taroh di tempatnya masing-masing.
  • Buka res/xml/display_settings.xml (ga harus) lalu taroh line ini dimana aja, bebas :
<PreferenceScreen android:title="Omni Header Machine" android:key="omni_header_machine" android:fragment="com.android.settings.fiqih.rom.StatusHeaderMachine" />
  • Recompile dan decompile kembali
  • Buka public.xml dan buka juga smali/com/android/settings/fiqih/rom/StatusHeaderMachine.smali
  • Ctrl+f di smali 0x7f050054 Lalu ctrl+f di public ente <public type="xml" name="omni_header" ambil codenya lalu timpa kode di smali dengan yg di public ente
  • Save, recompile
  • Done
  • Kalo ada yg FC biasakan pake Catlog biar tau dimana errornya, bisa liat di Cara memakai CatLog 
SS :

Thanks to :
ALLAH SWT
Adi Sukahadi
No More
Bang Vicky

20 komentar

Ctrl+f iput-object v1, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNotificationPanelHeader:Landroid/view/View; (INGAT v1, v0 BERBEDA SETIAP ROM/DEVICE !!!)
Tepat di bawahnya tambahkan (SESUAIKAN VARIABLE DARI iput, iget, invoke dengan smali ente, dengan cara liat ke line atasnya, jadi SESUAIKAN)

Ane msh g ngrti gan yg ini... Mksdny v1 dll, d ubah sm yg terdekat diatasnya... Smuanya di ubah dr new instance, iput, iget dll nya? Sto cm iput n iget dwnk...

semua variable, samakan dengan di atasnya aja um

Ini knp ya om :

I: Smaling...
Exception in thread "main" brut.androlib.AndrolibException: Could not write dex to file: /storage/sdcard1/zzz/Settings_src_src/build/apk/classes.dex
at brut.androlib.src.DexFileBuilder.writeTo(DexFileBuilder.java:61)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:52)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:37)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:257)
at brut.androlib.Androlib.buildSources(Androlib.java:214)
at brut.androlib.Androlib.build(Androlib.java:205)
at brut.androlib.Androlib.build(Androlib.java:176)
at brut.apktool.Main.cmdBuild(Main.java:228)
at brut.apktool.Main.main(Main.java:79)
Caused by: java.io.IOException: No space left on device
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:305)
at brut.androlib.src.DexFileBuilder.writeTo(DexFileBuilder.java:58)
... 8 more

apktoolnya ga ngangkat om itu sepertinya :-)

Dah bisa om,setelah ane ganti versi apktools nya....thx tutornya om.....
Moga" blognya makin maju :D

.method private setPileLayers(I)V
dan
.method private updateNotificationSimInfo

ane gak nemu gan di smali ane bagian yg dua diatas

posisi ane di ROM cm10.1

wkwk siipp um, kalo share jangan lupa creditsnya hehe

waahhhha ane blm ada buat devicenya um, nanti ane bantu kalo ada hehe

Om bagus , pesen tutor costum navigation drawer dong om , buat jb 4.2 :D

Ane dah berhasil gan recompile systemui sama settings apk nya ..cuman kenapa ya um di header expanded ane ko nggak muncul gambar di header / cuman transparan aja gan??itu apa nya yg salah ya gan..

gan eror input . knapa kok gitu sih . ane copaste dengan benar kata per kata . oh iya pke spasi g bro untuk tambahkan diatasnya agar g nempel dengan kata lain

boleh minta phonestatusbar.smali nya ga bro untuk compare

udah ada um hehe, liat aja yg swipping powertogle

jangan cuma copas, perhatikan line linenya um, kan takutnya variablenya beda itu

Um udah berhasil semua tapi kenapa ga muncul gambar di expanded header padahal udah di restar sama di ceklis

../../../storage/sdcard0/SystemUI_src/smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali[897,4] Error for input '.parameter': Invalid directive
../../../storage/sdcard0/SystemUI_src/smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali[897,15] mismatched input '"x0"' expecting END_METHOD_DIRECTIVE
../../../storage/sdcard0/SystemUI_src/smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali[1041,4] Error for input '.parameter': Invalid directive
../../../storage/sdcard0/SystemUI_src/smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali[1042,4] Error for input '.parameter': Invalid directive
../../../storage/sdcard0/SystemUI_src/smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali[1041,15] mismatched input '"x0"' expecting END_METHOD_DIRECTIVE
../../../storage/sdcard0/SystemUI_src/smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali[1053,4] Error for input '.parameter': Invalid directive
../../../storage/sdcard0/SystemUI_src/smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali[1053,15] mismatched input '"x0"' expecting END_METHOD_DIRECTIVE
../../../storage/sdcard0/SystemUI_src/smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali[2584,4] Error for input '.parameter': Invalid directive
../../../storage/sdcard0/SystemUI_src/smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali[2584,15] mismatched input '"dw"' expecting END_METHOD_DIRECTIVE
../../../storage/sdcard0/SystemUI_src/smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali[3498,15] no viable alternative at input 'resolver'
../../../storage/sdcard0/SystemUI_src/smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali[3498,24] no viable alternative at input 'Landroid/content/ContentResolver;'
../../../storage/sdcard0/SystemUI_src/smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali[3508,15] no viable alternative at input 'customHeader'
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: com/android/systemui/statusbar/phone/PhoneStatusBar.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:337)
at brut.androlib.Androlib.buildSources(Androlib.java:298)
at brut.androlib.Androlib.build(Androlib.java:284)
at brut.androlib.Androlib.build(Androlib.java:258)
at brut.apktool.Main.cmdBuild(Main.java:233)
at brut.apktool.Main.main(Main.java:88)
I: Using Apktool 2.0.0-Beta7 on SystemUI_src
I: Smaling...
Suhu kalau itu gimana yaaa.. Yang XOnya sudah bisa tinggal yang dw nya suhu

.method static synthetic access$2300

aq cari kq gk ada gan???gimana solusiny

Punya ane kok gk bisa ganti ya gambar cuma kya ss nya aj

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