[GUIDE][GB] Status bar and notification panel color changer | owner pic mod

Search This thread

brijeshep

Senior Member
Aug 26, 2012
726
2,418
►KERALA◄
9droid.blogspot.com
Great Guide! Tested and found working! :D


Step 9
-------
Open smali/com/b16h22/statusbar/ProfilePicture$2.smali

Find
Code:

const v2, 0x7f02012e

replace it with id of drawable "ic_qs_default_user"
I can't find the text in ProfilePicture$2.smali - file. But It's found in ProfilePicture$1.smali

And this project done successfully. I'll implement this feature on my new project AceJB ROM.
:eek:
 

professor_proton

Senior Member
May 13, 2013
407
85
27
Gurgaon
Re: :p

y ask if u can save time by trying it urself ;)
Sent from my S500 using xda app-developers app
nah does'nt work :(
my statusbar FC'd :confused:
did a log said something like error inflating view line #5 (that's the line I edited ):p
gonna try it again soon
i have to get it working I'm kinda tired of decompiling SystemUI every time i want to change colour of notification panel
Edit : Using Xposed now don't need to do its anymore :highfive::victory:
 

vERax_92

Senior Member
May 26, 2012
85
7
Hi sir!

Where i need to place the "smali" folder???, in /res??

And the ids of this two lines...

<public type="id" name="status_bar" id="0x7f090028" />
<public type="id" name="view" id="0x7f090029" />


...may be different from mine??

PD: I cant find "<public type="id" name="view" id="0x7f090029" />" in my public.xml
 

2ndhand17

Senior Member
Aug 13, 2013
66
11
Kweng Kweng Kwa City

Attachments

  • SystemUI1.apk
    448.2 KB · Views: 6
  • statusbarlogo.png
    statusbarlogo.png
    422 bytes · Views: 426

Top Liked Posts

  • There are no posts matching your filters.
  • 96
    Long story short. I decided to port some of my mods to a stock status bar .I tried to make the process relatively easy. So it shouldn't be too much of a problem trying.

    Status bar and notification panel color changer


    Step 1

    Decompile your systemui.apk. Extract the attached zip file. Copy the contents into the smali folder.

    Step 2

    Open res/layout/status_bar.xml.
    Find the first line

    Code:
    <com.android.systemui.statusbar.StatusBarView android:orientation="vertical" android:background="#ff000000" android:focusable="true" android:descendantFocusability="afterDescendants"

    Change it to

    Code:
    <com.android.systemui.statusbar.StatusBarView android:orientation="vertical" android:background="#00000000" android:focusable="true" android:descendantFocusability="afterDescendants"

    We just changed the background color to transparent in the above step

    After the first line paste this

    Code:
        <com.b16h22.statusbar.StatusBar android:id="@id/status_bar" android:layout_width="fill_parent" android:layout_height="fill_parent" />

    Now save this file

    Step 3

    Open res/layout/status_bar_tracking.xml

    Find this code just below first line

    Code:
        <View android:background="#ff8e979f" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0" />

    Change it to this

    Code:
        <com.b16h22.statusbar.Pulldown android:id="@id/view" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0" />

    Now save this file

    Step 4

    Open res/values/ids.xml and add these at the end

    Code:
        <item type="id" name="status_bar">false</item>
        <item type="id" name="view">false</item>

    Save the file and compile systemui.apk.

    Step 5


    Now decompile the systemui again

    Open public.xml and find these

    Code:
        <public type="id" name="status_bar" id="[COLOR="DeepSkyBlue"]0x7f090028[/COLOR]" />
        <public type="id" name="view" id="[COLOR="Red"]0x7f090029[/COLOR]" />


    Open smali/com/b16h22/statusbar/StatusBar.smali

    Find

    Code:
        const v2, [COLOR="DeepSkyBlue"]0x7f090026[/COLOR]

    Change it to the id in blue in public.xml


    Code:
        const v2, [COLOR="DeepSkyBlue"]0x7f090028[/COLOR]


    Now open smali/com/b16h22/statusbar/Pulldown.smali

    Find

    Code:
        const v2, [COLOR="Red"]0x7f090027[/COLOR]

    Change it to the id in red in public.xml


    Code:
        const v2, [COLOR="Red"]0x7f090029[/COLOR]


    Now re-compile systemui again and push it to phone. Use StatusBarMods.apk from the attachment to change the color.


    Status bar owner picture

    This mod is a little complicated.But if you follow the steps well enough,it's going to be fairly easy.Think twice before asking a doubt.

    We are adding owner picture functionality to status bar like android 4.2 and integrate the photo picker to the settings.apk. So let's start with integrating photo picker to settings.I wrote a few classes for this.Extract the "Owner_mod_files_settings.zip" and get the smali files and resource files from it.

    Step 1

    Get these files from the extracted zip

    Code:
    res/layout/profile_info.xml
    res/drawable/done.xml
    res/drawable/pick_profile_picture.xml
    res/drawable-ldpi/done_normal.png
    res/drawable-ldpi/done_pressed.png
    res/drawable-ldpi/ic_qs_default_user.png
    res/drawable-ldpi/ic_settings_owner.png
    res/drawable-ldpi/pick_profile_normal.png
    res/drawable-ldpi/pick_profile_pressed.png

    Decompile settings.apk and put the above files in respective folders

    Step 2

    Get these smali files from the extracted zip and place it in the smali/ folder of decompiled apk

    Code:
    smali/com/b16h22/Profile.smali
    smali/com/b16h22/Profile$1.smali
    smali/com/b16h22/Profile$2.smali

    Step 3

    Now open the ids.xml and add these ids in it

    Code:
        <item type="id" name="image">false</item>
        <item type="id" name="owner">false</item>
        <item type="id" name="linear_layout">false</item>
        <item type="id" name="profile_pic">false</item>
        <item type="id" name="layout1">false</item>
        <item type="id" name="change_picture_text">false</item>
        <item type="id" name="photo_picker">false</item>
        <item type="id" name="linear_layout1">false</item>
        <item type="id" name="layout2">false</item>
        <item type="id" name="name_field">false</item>
        <item type="id" name="name_edit">false</item>


    Open strings.xml and add these strings

    Code:
        <string name="change_pic">Change profile picture</string>
        <string name="profile_pic">SET PROFILE PICTURE</string>
        <string name="profile_name">CHANGE PROFILE NAME</string>


    Step 4

    Now recompile the apk and decompile it again. Now open the public.xml and find these ids.These may not be the same in your apk. It may differ.I have color coded them to make it easier to distinguish in the upcoming steps

    Code:
        <public type="layout" name="profile_info" id="[COLOR="Blue"]0x7f03005a[/COLOR]" />
        <public type="drawable" name="ic_qs_default_user" id="[COLOR="Indigo"]0x7f0200b2[/COLOR]" />
        <public type="id" name="image" id="[COLOR="Magenta"]0x7f0b011b[/COLOR]" />
        <public type="id" name="owner" id="[COLOR="Orange"]0x7f0b011c[/COLOR]" />
        <public type="id" name="photo_picker" id="[COLOR="DarkOrchid"]0x7f0b0121[/COLOR]" />
        <public type="id" name="name_field" id="[COLOR="YellowGreen"]0x7f0b0124[/COLOR]" />
        <public type="id" name="name_edit" id="[COLOR="SeaGreen"]0x7f0b0125[/COLOR]" />

    Now open smali/com/b16h22/Profile.smali and find the method

    Code:
    .method protected onCreate(Landroid/os/Bundle;)V

    And replace the ids in it with the ones from public.xml


    Code:
    .method protected onCreate(Landroid/os/Bundle;)V
        .locals 4
        .parameter "savedInstanceState"
    
        .prologue
        .line 27
        invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V
    
        .line 28
        const v2, [COLOR="blue"]0x7f03005a[/COLOR] # profile_info
    
        invoke-virtual {p0, v2}, Lcom/b16h22/Profile;->setContentView(I)V
    
        .line 30
        const v2, [COLOR="DarkOrchid"]0x7f0b0121[/COLOR] #photo_picker
    
        invoke-virtual {p0, v2}, Lcom/b16h22/Profile;->findViewById(I)Landroid/view/View;
    
        move-result-object v0
    
        check-cast v0, Landroid/widget/ImageView;
    
        .line 31
        .local v0, photo:Landroid/widget/ImageView;
        const v2, [COLOR="Orange"]0x7f0b011c[/COLOR] # owner
    
        invoke-virtual {p0, v2}, Lcom/b16h22/Profile;->findViewById(I)Landroid/view/View;
    
        move-result-object v2
    
        check-cast v2, Landroid/widget/TextView;
    
        iput-object v2, p0, Lcom/b16h22/Profile;->owner:Landroid/widget/TextView;
    
        .line 32
        const v2, [COLOR="YellowGreen"]0x7f0b0124[/COLOR] # name_field
    
        invoke-virtual {p0, v2}, Lcom/b16h22/Profile;->findViewById(I)Landroid/view/View;
    
        move-result-object v2
    
        check-cast v2, Landroid/widget/EditText;
    
        iput-object v2, p0, Lcom/b16h22/Profile;->name:Landroid/widget/EditText;
    
        .line 33
        const v2, [COLOR="SeaGreen"]0x7f0b0125[/COLOR] # name_edit
    
        invoke-virtual {p0, v2}, Lcom/b16h22/Profile;->findViewById(I)Landroid/view/View;
    
        move-result-object v2
    
        check-cast v2, Landroid/widget/ImageView;
    
        iput-object v2, p0, Lcom/b16h22/Profile;->done:Landroid/widget/ImageView;
    
        .line 34
        const v2, [COLOR="Magenta"]0x7f0b011b[/COLOR] # image
    
        invoke-virtual {p0, v2}, Lcom/b16h22/Profile;->findViewById(I)Landroid/view/View;
    
        move-result-object v2
    
        check-cast v2, Landroid/widget/ImageView;
    
        iput-object v2, p0, Lcom/b16h22/Profile;->imageView:Landroid/widget/ImageView;
    
        .line 37
        const-string v2, "EvoPrefsFile"
    
        const/4 v3, 0x0
    
        invoke-virtual {p0, v2, v3}, Lcom/b16h22/Profile;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;
    
        move-result-object v1
    
        .line 38
        .local v1, sharedPreferences:Landroid/content/SharedPreferences;
        const-string v2, "profileName"
    
        const-string v3, "null"
    
        invoke-interface {v1, v2, v3}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    
        move-result-object v2
    
        iput-object v2, p0, Lcom/b16h22/Profile;->profName:Ljava/lang/String;
    
        .line 39
        iget-object v2, p0, Lcom/b16h22/Profile;->profName:Ljava/lang/String;
    
        const-string v3, "null"
    
        if-ne v2, v3, :cond_0
    
        .line 40
        iget-object v2, p0, Lcom/b16h22/Profile;->owner:Landroid/widget/TextView;
    
        const-string v3, "Owner"
    
        invoke-virtual {v2, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V
    
        .line 46
        :goto_0
        const-string v2, "profilePic"
    
        const-string v3, "null"
    
        invoke-interface {v1, v2, v3}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    
        move-result-object v2
    
        iput-object v2, p0, Lcom/b16h22/Profile;->imageUri:Ljava/lang/String;
    
        .line 47
        iget-object v2, p0, Lcom/b16h22/Profile;->imageUri:Ljava/lang/String;
    
        const-string v3, "null"
    
        if-ne v2, v3, :cond_1
    
        .line 48
        iget-object v2, p0, Lcom/b16h22/Profile;->imageView:Landroid/widget/ImageView;
    
        const v3, [COLOR="Indigo"]0x7f0200b2[/COLOR] #ic_qs_default_user
    
        invoke-virtual {v2, v3}, Landroid/widget/ImageView;->setImageResource(I)V
    
        .line 53
        :goto_1
        new-instance v2, Lcom/b16h22/Profile$1;
    
        invoke-direct {v2, p0}, Lcom/b16h22/Profile$1;-><init>(Lcom/b16h22/Profile;)V
    
        invoke-virtual {v0, v2}, Landroid/widget/ImageView;->setOnClickListener(Landroid/view/View$OnClickListener;)V
    
        .line 64
        iget-object v2, p0, Lcom/b16h22/Profile;->done:Landroid/widget/ImageView;
    
        new-instance v3, Lcom/b16h22/Profile$2;
    
        invoke-direct {v3, p0}, Lcom/b16h22/Profile$2;-><init>(Lcom/b16h22/Profile;)V
    
        invoke-virtual {v2, v3}, Landroid/widget/ImageView;->setOnClickListener(Landroid/view/View$OnClickListener;)V
    
        .line 80
        return-void
    
        .line 42
        :cond_0
        iget-object v2, p0, Lcom/b16h22/Profile;->owner:Landroid/widget/TextView;
    
        iget-object v3, p0, Lcom/b16h22/Profile;->profName:Ljava/lang/String;
    
        invoke-virtual {v2, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V
    
        .line 43
        iget-object v2, p0, Lcom/b16h22/Profile;->name:Landroid/widget/EditText;
    
        iget-object v3, p0, Lcom/b16h22/Profile;->profName:Ljava/lang/String;
    
        invoke-virtual {v2, v3}, Landroid/widget/EditText;->setText(Ljava/lang/CharSequence;)V
    
        goto :goto_0
    
        .line 50
        :cond_1
        iget-object v2, p0, Lcom/b16h22/Profile;->imageView:Landroid/widget/ImageView;
    
        iget-object v3, p0, Lcom/b16h22/Profile;->imageUri:Ljava/lang/String;
    
        invoke-static {v3}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;
    
        move-result-object v3
    
        invoke-virtual {v2, v3}, Landroid/widget/ImageView;->setImageURI(Landroid/net/Uri;)V
    
        goto :goto_1
    .end method


    Step 5

    Now open the res/xml/settings.xml

    and add this iconpreferencescreen.You can add it anywhere you want.I'm assuming you have basic knowledge about preference xmls.

    Code:
        <com.android.settings.IconPreferenceScreen android:title="Owner Profile" settings:icon="@drawable/ic_settings_owner">
            <intent android:targetPackage="com.android.settings" android:action="android.intent.action.MAIN" android:targetClass="com.b16h22.Profile" />
        </com.android.settings.IconPreferenceScreen>

    EDIT:I forgot to write the step to assign new activity to the android manifest. Thanks to 3r41nl33n for remembering me

    Open AndroidManifest.xml and add this

    Code:
            <activity android:label="@string/change_pic" android:name="com.b16h22.Profile">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                </intent-filter>
            </activity>

    Now save files and compile the settings.apk and push it to system.You have to resign the apk and other system apks or disable signature verification. Now you will have somethng like this

    pksm.png



    Now we can move on to modifying the systemui.apk.Decompile systemui.apk

    Step 6

    Open status_bar_expanded.xml and paste this where you want to put the owner image.

    Code:
            <LinearLayout  android:layout_width="106.66699dip" android:layout_height="106.66699dip">
                <com.b16h22.statusbar.ProfilePicture android:id="@id/profile" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginLeft="1.0px" android:layout_marginTop="1.0px" android:layout_marginRight="1.0px" android:layout_marginBottom="1.0px" android:scaleType="centerCrop" />
                <com.b16h22.statusbar.ProfileName android:textStyle="normal" android:textColor="#ffffffff" android:gravity="center" android:layout_gravity="center_vertical" android:id="@id/profile_name" android:background="#cc000000" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="1.0px" android:layout_marginRight="1.0px" android:layout_marginBottom="1.0px" android:layout_alignParentBottom="true" />
            </LinearLayout >

    Now extract the "Owner_mod_files_systemui.zip" and put the smali folder in the systemui smali folder and the pngs in the drawable-ldpi folder.


    Step 7
    Open ids.xml and add these

    Code:
        <item type="id" name="profile">false</item>
        <item type="id" name="profile_name">false</item>

    Recompile the apk and decompile it again

    Step 8
    Open public.xml and note these ids

    Code:
        <public type="id" name="profile" id="0x7f09003a" />
        <public type="id" name="profile_name" id="0x7f09003b" />
        <public type="drawable" name="ic_qs_default_user" id="0x7f02012e" />

    Step 9
    Open smali/com/b16h22/statusbar/ProfilePicture.smali and find this

    Code:
        .line 21
        const v4, 0x7f09003a

    replace the id with the id of "profile"

    find

    Code:
        const v5, 0x7f02012e

    replace it with the id of drawable "ic_qs_default_user"

    Open smali/com/b16h22/statusbar/ProfilePicture$2.smali

    Find

    Code:
    const v2, 0x7f02012e

    replace it with id of drawable "ic_qs_default_user"

    Open smali/com/b16h22/statusbar/ProfileName.smali

    find

    Code:
        .line 19
        const v2, 0x7f09003b

    replace it with the id of "profile_name"

    Now recompile the apk and push to system. You should be able to change picture from the settings. Think twice before askin anything. Please point out the faults in the guide if there is any.

    DOWNLOADS
    owner_mod_files_systemui.zip

    owner_mod_files_settings.zip

    Anyone can use this mods but give credits where its due and keep the spirit of open source. Kanging is bad mmkay
    6
    Long story short. I decided to port some of my mods to a stock status bar .I tried to make the process relatively easy. So it shouldn't be too much of a problem trying.


    You are doing a very good job mate. Educating users how to modify and add tweaks for ROMS will prevent them from kanging your work and maybe they will come up with a different tweak with your guide. Keep it up. I always admire your work and thank you for believing in the spirit of open source ;)
    4
    Thread updated with new guide
    4
    awesome dude, I tried :fingers-crossed:
    2
    I m getting this error when recompiling back systemui

    Check your status_bar.xml for error.One of the lines is not well formed.

    Sent from my GT-S5360