[Android General] Abdullaharis:
Hello Guys in this tutorial i will show you how to add Header Images with settings.

for this you need deodexed SystemUI.apk and Settings.apk

1.Decompile SystemUI.apk and Settings.apk

2.Download settingsheader.zip from attachment. extract and copy to your decompiled Settings.

3.Download systemuiheader.zip from attachment. extract and copy to your decompiled SystemUI

4.Open Settings\res\xml\notification_drawer_settings.xml and add the below code.

<com.android.settings.cyanogenmod.SystemSettingSwitchPreference android:title="@string/status_bar_custom_header_title" android:key="status_bar_custom_header" android:summary="@string/status_bar_custom_header_summary" android:defaultValue="false" />

5.Open Settings\res\values\strings.xml and add below code

<string name="status_bar_custom_header_title">Custom header image</string>
<string name="status_bar_custom_header_summary">Enable notification panel header image</string>

6.Open SystemUI\res\layout\status_bar_expanded_header.xml and find below code

xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res-auto">

add this on below

<ImageView android:layout_gravity="center" android:id="@id/background_image" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scaleType="centerCrop" android:adjustViewBounds="true" />

7.Open SystemUI\res\values\ids.xml add the below code

<item type="id" name="background_image">false</item>

8.Now Recompile and compile SystemUI.apk

9.Open SystemUI\smali\com\android\systemui\statusbar\phone\PhoneStatusbar.smali and find below code

# instance fields

below add this.

.field private mStatusBarHeaderMachine:Lcom/android/systemui/gk/StatusBarHeaderMachine;

find below method

.method protected makeStatusBarView()V

in the same method find below line

invoke-direct/range {p0 .. p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->startGlyphRasterizeHack()V

add the following texts on below

.line 1309
new-instance v3, Lcom/android/systemui/gk/StatusBarHeaderMachine;

move-object/from16 v0, p0

iget-object v4, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mContext:Landroid/content/Context;

invoke-direct {v3, v4}, Lcom/android/systemui/gk/StatusBarHeaderMachine;-><init>(Landroid/content/Context;)V

move-object/from16 v0, p0

iput-object v3, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarHeaderMachine:Lcom/android/systemui/gk/StatusBarHeaderMachine;

.line 1310
move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarHeaderMachine:Lcom/android/systemui/gk/StatusBarHeaderMachine;

move-object/from16 v0, p0

iget-object v4, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mHeader:Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;

invoke-virtual {v3, v4}, Lcom/android/systemui/gk/StatusBarHeaderMachine;->addObserver(Lcom/android/systemui/gk/StatusBarHeaderMachine$IStatusBarHeaderMachineObserver;)V

.line 1311
move-object/from16 v0, p0

iget-object v3, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarHeaderMachine:Lcom/android/systemui/gk/StatusBarHeaderMachine;

invoke-virtual {v3}, Lcom/android/systemui/gk/StatusBarHeaderMachine;->updateEnablement()V

10.Open SystemUI\smali\com\android\systemui\statusbar\phone\StatusBarHeaderView.smali and find the below code

.implements Lcom/android/systemui/statusbar/policy/WeatherController$Callback;

below add this

.implements Lcom/android/systemui/gk/StatusBarHeaderMachine$IStatusBarHeaderMachineObserver;

find

# instance fields

below add this

.field private mBackgroundImage:Landroid/widget/ImageView;

find

.field private mCollapsedHeight:I

below add this

.field private mCurrentBackground:Landroid/graphics/drawable/Drawable;

find

.field private mExpandedHeight:I

below add this

.field private mLastHeight:F

find below method

.method static synthetic access$900(Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;)Landroid/widget/Switch;

below this method add a new method

.method static synthetic access$100001(Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;Landroid/graphics/drawable/Drawable;Z)V
.locals 0
.param p0, "x0" # Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;
.param p1, "x1" # Landroid/graphics/drawable/Drawable;
.param p2, "x2" # Z

.prologue
.line 71
invoke-direct {p0, p1, p2}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->doUpdateStatusBarCustomHeader(Landroid/graphics/drawable/Drawable;Z)V

return-void
.end method

.method static synthetic access$100002(Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;)Landroid/widget/ImageView;
.locals 1
.param p0, "x0" # Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;

.prologue
.line 71
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;

return-object v0
.end method

.method static synthetic access$100003(Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;Landroid/graphics/drawable/Drawable;)Landroid/graphics/drawable/Drawable;
.locals 0
.param p0, "x0" # Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;
.param p1, "x1" # Landroid/graphics/drawable/Drawable;

.prologue
.line 71
iput-object p1, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCurrentBackground:Landroid/graphics/drawable/Drawable;

return-object p1
.end method

.method private doUpdateStatusBarCustomHeader(Landroid/graphics/drawable/Drawable;Z)V
.locals 2
.param p1, "next" # Landroid/graphics/drawable/Drawable;
.param p2, "force" # Z

.prologue
.line 1033
if-eqz p1, :cond_1

.line 1034
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCurrentBackground:Landroid/graphics/drawable/Drawable;

if-eq p1, v0, :cond_0

.line 1035
const-string v0, "StatusBarHeaderView"

const-string v1, "Updating status bar header background"

invoke-static {v0, v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

.line 1036
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;

const/4 v1, 0x0

invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setVisibility(I)V

.line 1037
invoke-direct {p0, p1, p2}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->setNotificationPanelHeaderBackground(Landroid/graphics/drawable/Drawable;Z)V

.line 1038
iput-object p1, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCurrentBackground:Landroid/graphics/drawable/Drawable;

.line 1044
:cond_0
:goto_0
return-void

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

iput-object v0, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCurrentBackground:Landroid/graphics/drawable/Drawable;

.line 1042
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;

const/16 v1, 0x8

invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setVisibility(I)V

goto :goto_0
.end method

.method private setNotificationPanelHeaderBackground(Landroid/graphics/drawable/Drawable;Z)V
.locals 5
.param p1, "dw" # Landroid/graphics/drawable/Drawable;
.param p2, "force" # Z

.prologue
const/4 v4, 0x1

.line 1047
iget-object v2, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;

invoke-virtual {v2}, Landroid/widget/ImageView;->getDrawable()Landroid/graphics/drawable/Drawable;

move-result-object v2

if-eqz v2, :cond_0

if-nez p2, :cond_0

.line 1048
const/4 v2, 0x2

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

.line 1049
.local v0, "arrayDrawable":[Landroid/graphics/drawable/Drawable;
const/4 v2, 0x0

iget-object v3, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;

invoke-virtual {v3}, Landroid/widget/ImageView;->getDrawable()Landroid/graphics/drawable/Drawable;

move-result-object v3

aput-object v3, v0, v2

.line 1050
aput-object p1, v0, v4

.line 1052
new-instance v1, Landroid/graphics/drawable/TransitionDrawable;

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

.line 1053
.local v1, "transitionDrawable":Landroid/graphics/drawable/TransitionDrawable;
invoke-virtual {v1, v4}, Landroid/graphics/drawable/TransitionDrawable;->setCrossFadeEnabled(Z)V

.line 1054
iget-object v2, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;

invoke-virtual {v2, v1}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

.line 1055
const/16 v2, 0x3e8

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

.line 1059
.end local v0 # "arrayDrawable":[Landroid/graphics/drawable/Drawable;
.end local v1 # "transitionDrawable":Landroid/graphics/drawable/TransitionDrawable;
:goto_0
return-void

.line 1057
:cond_0
iget-object v2, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;

invoke-virtual {v2, p1}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

goto :goto_0
.end method

find

# virtual method

below add a new method

.method public disableHeader()V
.locals 1

.prologue
.line 1072
new-instance v0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView$98;

invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView$98;-><init>(Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;)V

invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->post(Ljava/lang/Runnable;)Z

.line 1078
return-void
.end method

.method public updateHeader(Landroid/graphics/drawable/Drawable;Z)V
.locals 1
.param p1, "headerImage" # Landroid/graphics/drawable/Drawable;
.param p2, "force" # Z

.prologue
.line 1063
new-instance v0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView$97;

invoke-direct {v0, p0, p1, p2}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView$97;-><init>(Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;Landroid/graphics/drawable/Drawable;Z)V

invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->post(Ljava/lang/Runnable;)Z

.line 1068
return-void
.end method

find the following method

.method protected onFinishInflate()V

in the same method find the below line

iput-object v0, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mDateExpanded:Landroid/widget/TextView;

below add this

.line 31
const v0, 0x7f0f017a

invoke-virtual {p0, v0}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->findViewById(I)Landroid/view/View;

move-result-object v0

check-cast v0, Landroid/widget/ImageView;

iput-object v0, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mBackgroundImage:Landroid/widget/ImageView;

find

.method public setExpansion(F)V

replace the whole method with below code

.method public setExpansion(F)V
.locals 5
.param p1, "t" # F

.prologue
.line 584
iget-boolean v2, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mExpanded:Z

if-nez v2, :cond_0

.line 585
const/4 p1, 0x0

.line 587
:cond_0
iput p1, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCurrentT:F

.line 588
iget v2, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCollapsedHeight:I

int-to-float v2, v2

iget v3, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mExpandedHeight:I

iget v4, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCollapsedHeight:I

sub-int/2addr v3, v4

int-to-float v3, v3

mul-float/2addr v3, p1

add-float v0, v2, v3

.line 589
.local v0, "height":F
iget v2, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mLastHeight:F

cmpl-float v2, v0, v2

if-eqz v2, :cond_3

.line 590
iget v2, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCollapsedHeight:I

int-to-float v2, v2

cmpg-float v2, v0, v2

if-gez v2, :cond_1

.line 591
iget v2, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mCollapsedHeight:I

int-to-float v0, v2

.line 593
:cond_1
iget v2, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mExpandedHeight:I

int-to-float v2, v2

cmpl-float v2, v0, v2

if-lez v2, :cond_2

.line 594
iget v2, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mExpandedHeight:I

int-to-float v0, v2

.line 596
:cond_2
move v1, v0

.line 597
.local v1, "heightFinal":F
invoke-direct {p0, v1}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->setClipping(F)V

.line 599
new-instance v2, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView$96;

invoke-direct {v2, p0, v1}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView$96;-><init>(Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;F)V

invoke-virtual {p0, v2}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->post(Ljava/lang/Runnable;)Z

.line 607
invoke-direct {p0, p1}, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->updateLayoutValues(F)V

.line 608
iput v1, p0, Lcom/android/systemui/statusbar/phone/StatusBarHeaderView;->mLastHeight:F

.line 610
.end local v1 # "heightFinal":F
:cond_3
return-void
.end method

11.Open SystemUI\smali\com\android\systemui\gk\StatusBarHeaderProvider.smali and replace the following ids

find

0x7f0201f0

replace with below id

<public type="drawable" name="notifhead_christmas"

find

0x7f0201f2

replace with below id

<public type="drawable" name="notifhead_newyearseve"

find

0x7f0201f3

replace with below id

<public type="drawable" name="notifhead_night"

find

0x7f0201f5

replace with below id

<public type="drawable" name="notifhead_sunrise"

find

0x7f0201f1

replace with below id

<public type="drawable" name="notifhead_morning"

find

0x7f0201f4

replace with below id

<public type="drawable" name="notifhead_noon"

find

0x7f0201ef

replace with below id

<public type="drawable" name="notifhead_afternoon"

find

0x7f0201f6

replace with below id

<public type="drawable" name="notifhead_sunset"

12.Now compile SystemUI and Settings and move to your device

Credit:-

KachalkinGeorg (The GK)