[HOWTO] Add ICS 'Recent Apps' button (or other softkeys) to Status bar

Search This thread

bhu1

Senior Member
Aug 1, 2011
5,307
4,517
29
Jaipur
Can u provide the code to add search key in status bar and how to mod this in smalis in Dex folder of android.policy.jar. if that isn't possible am then any way I can only fork this on aokp source and just compile android.policy.jar ?
 

evilisto

Senior Member
Nov 26, 2010
486
2,318
Can u provide the code to add search key in status bar and how to mod this in smalis in Dex folder of android.policy.jar. if that isn't possible am then any way I can only fork this on aokp source and just compile android.policy.jar ?

sorry but as i wrote before, i don't know much about smali..

but adding other buttons is easy. because most of other buttons don't require source code change..:)
so you can easily add other button just by editing layout xml file only.

here is example : i added 'POWER' button next to 'recent apps' button to use it as replacement of screen lock widget.

Code:
    <RelativeLayout android:background="@drawable/notification_header_bg" android:paddingTop="3.0dip" android:paddingRight="3.0dip" android:paddingBottom="5.0dip" android:layout_width="fill_parent" android:layout_height="52.0dip">
        <com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Date" android:gravity="left|center" android:id="@id/date" android:paddingLeft="16.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_alignParentLeft="true" />
        <ImageView android:id="@id/settings_button" android:paddingLeft="4.0dip" android:paddingRight="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_quicksettings" android:layout_toRightOf="@id/date" android:contentDescription="@string/accessibility_settings_button" />
        <com.android.systemui.statusbar.policy.KeyButtonView android:paddingLeft="2.0dip" android:paddingRight="2.0dip" android:id="@id/recent_apps" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_recent" android:layout_toRightOf="@id/settings_button" android:contentDescription="@string/accessibility_recent" systemui:keyCode="187" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
       [COLOR="Blue"] <com.android.systemui.statusbar.policy.KeyButtonView android:paddingLeft="2.0dip" android:paddingRight="2.0dip" android:id="@id/back" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_back" android:layout_toRightOf="@id/recent_apps" android:contentDescription="@string/accessibility_back" systemui:keyCode="26" systemui:glowBackground="@drawable/ic_sysbar_highlight" />[/COLOR]
	<ImageView android:id="@id/clear_all_button" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_clear" android:layout_alignParentRight="true" android:contentDescription="@string/accessibility_clear_all" />
    </RelativeLayout>

i used 'back' button's id and drawable name because i don't use on-screen softkeys. but i think using other less useful drawable (for example, nyandroid..) is better than this..

in above example, systemui:keyCode="26" is for POWER button. if you change this to 84, this will work as SEARCH button.
 
Last edited:

rugal28

Senior Member
Sep 20, 2010
50
17
Taichung
Dear evilisto
can you help to provide search button icon??
i try photoshop ic_sysbar_search_land form aokp
but fail (it's so ugly....~"~)
 

evilisto

Senior Member
Nov 26, 2010
486
2,318
Dear evilisto
can you help to provide search button icon??
i try photoshop ic_sysbar_search_land form aokp
but fail (it's so ugly....~"~)

or you can find many good softkeys images in this thread (by atticus182) :

[SOFTKEYS] [09-03] Softkey Collection 2.0 [GSM/CDMA]

what i used in preview screenshot is "HTC One" style in above thread.


Can It works on deodexed rom of Galaxy R ...

i think so.. you can make your own follow my guide or ask your rom dev to include this mod in the rom.
 
  • Like
Reactions: raghavafitt

rugal28

Senior Member
Sep 20, 2010
50
17
Taichung
or you can find many good softkeys images in this thread (by atticus182) :

[SOFTKEYS] [09-03] Softkey Collection 2.0 [GSM/CDMA]

very thank
i ps ic_sysbar_search_land.png from phone.apk and it's look wonderful
but i have some problem
the highlight red color is my change place
when i press search button on statusbar
not appear google search, but rather voice search , soundhound other search option
maybe coz's Galaxy S without search button (i use aokp build 28)
but recent app button is work great...^^
sorry my english is very poor
i hope you understand me to express
this my code
Code:
<com.android.systemui.statusbar.policy.KeyButtonView android:paddingLeft="2.0dip" android:paddingRight="2.0dip" android:id="@id/back" android:layout_width="wrap_content" android:layout_height="[COLOR="Red"]wrap_content[/COLOR]" android:src="@drawable/[COLOR="red"]ic_sysbar_search_land[/COLOR]" android:layout_toRightOf="@id/recent_apps" android:contentDescription="@string/accessibility_back" systemui:keyCode="[COLOR="red"]84[/COLOR]" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
 

Attachments

  • ic_sysbar_search_land.png
    ic_sysbar_search_land.png
    1.7 KB · Views: 1,492
Last edited:

bhu1

Senior Member
Aug 1, 2011
5,307
4,517
29
Jaipur
very thank
i ps ic_sysbar_search_land.png from phone.apk and it's look wonderful
but i have some problem
the highlight red color is my change place
when i press search button on statusbar
not appear google search, but rather voice search , soundhound other search option
maybe coz's Galaxy S without search button (i use aokp build 28)
but recent app button is work great...^^
sorry my english is very poor
i hope you understand me to express
this my code
Code:
<com.android.systemui.statusbar.policy.KeyButtonView android:paddingLeft="2.0dip" android:paddingRight="2.0dip" android:id="@id/back" android:layout_width="wrap_content" android:layout_height="[COLOR="Red"]wrap_content[/COLOR]" android:src="@drawable/[COLOR="red"]ic_sysbar_search_land[/COLOR]" android:layout_toRightOf="@id/recent_apps" android:contentDescription="@string/accessibility_back" systemui:keyCode="[COLOR="red"]84[/COLOR]" systemui:glowBackground="@drawable/ic_sysbar_highlight" />

I tried this, I took search button from stencils provided by Google.....I am getting compiling errors from APK manager, ill try again later though.
 

guap

Senior Member
Sep 23, 2007
1,303
48
Milano
I'm having trouble adding a test power button (like your example) in my bar

I'm on HuaweyMediapad (attached SystemUI and framework dependance), decompiled SystemUI with apkmanager, modified status_bar_expanded.xml and recompiled as system app

- new apk is 450~ kb compared to 700~ of the original one
- doesn't work at all (system boot but no softkey bar anymore)

please help... I need to add volume +/- and track next/prev in my bar to integrate it in my car dashboard :D

any hint? thanks
 

Attachments

  • framework-res-hwext.apk
    296.9 KB · Views: 17
  • SystemUI.apk
    772.9 KB · Views: 22
Last edited:

Scary Guy

Senior Member
"- adding some kind of button like menu or back is meaningless.. (surely)"

Not true, because when I'm using HDMI out and mirroring I can't easily hit those buttons when my phone is in the lapdock and the screen is in front of it obstructing access to my hardware buttons. So this is very useful for anyone with that type of phone. Having the buttons hidden in the status bar is great too.
 
Last edited:

Youngunn2008

Senior Member
Aug 2, 2010
3,291
1,552
Alton, IL
sorry but as i wrote before, i don't know much about smali..

but adding other buttons is easy. because most of other buttons don't require source code change..:)
so you can easily add other button just by editing layout xml file only.

here is example : i added 'POWER' button next to 'recent apps' button to use it as replacement of screen lock widget.

Code:
    <RelativeLayout android:background="@drawable/notification_header_bg" android:paddingTop="3.0dip" android:paddingRight="3.0dip" android:paddingBottom="5.0dip" android:layout_width="fill_parent" android:layout_height="52.0dip">
        <com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Date" android:gravity="left|center" android:id="@id/date" android:paddingLeft="16.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_alignParentLeft="true" />
        <ImageView android:id="@id/settings_button" android:paddingLeft="4.0dip" android:paddingRight="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_quicksettings" android:layout_toRightOf="@id/date" android:contentDescription="@string/accessibility_settings_button" />
        <com.android.systemui.statusbar.policy.KeyButtonView android:paddingLeft="2.0dip" android:paddingRight="2.0dip" android:id="@id/recent_apps" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_recent" android:layout_toRightOf="@id/settings_button" android:contentDescription="@string/accessibility_recent" systemui:keyCode="187" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
       [COLOR="Blue"] <com.android.systemui.statusbar.policy.KeyButtonView android:paddingLeft="2.0dip" android:paddingRight="2.0dip" android:id="@id/back" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_back" android:layout_toRightOf="@id/recent_apps" android:contentDescription="@string/accessibility_back" systemui:keyCode="26" systemui:glowBackground="@drawable/ic_sysbar_highlight" />[/COLOR]
	<ImageView android:id="@id/clear_all_button" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_clear" android:layout_alignParentRight="true" android:contentDescription="@string/accessibility_clear_all" />
    </RelativeLayout>

i used 'back' button's id and drawable name because i don't use on-screen softkeys. but i think using other less useful drawable (for example, nyandroid..) is better than this..

in above example, systemui:keyCode="26" is for POWER button. if you change this to 84, this will work as SEARCH button.

i am trying to add this line of code for locking the screen to my decompiled statusbarexpanded xml, but its not wanting to show up once recompiled and pushed. i have the multitasking button working great, can you assist please? any other code i need or is it really just basically tricking the back button into working?

don't i need to put something in the phonewindowmanager.java like with the other mod, since softkeys aren't turned on by default?
 

lzyllp

Senior Member
Dec 30, 2010
601
236
fuzhou
I want home button and change code to this but sstatus bar button not work.
What wrong?

Code:
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@id/home" android:paddingLeft="4.0dip" android:paddingRight="4.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_apps" android:layout_toRightOf="@id/settings_button" android:contentDescription="@string/accessibility_home" systemui:keyCode="102" systemui:glowBackground="@drawable/ic_sysbar_highlight" />

EDIT:wrong keycode chenge it to 3 and work
 
Last edited:

Youngunn2008

Senior Member
Aug 2, 2010
3,291
1,552
Alton, IL
i am trying to add this line of code for locking the screen to my decompiled statusbarexpanded xml, but its not wanting to show up once recompiled and pushed. i have the multitasking button working great, can you assist please? any other code i need or is it really just basically tricking the back button into working?

don't i need to put something in the phonewindowmanager.java like with the other mod, since softkeys aren't turned on by default?

Never mind got it working... :cool:
 

Top Liked Posts

  • There are no posts matching your filters.
  • 23
    Preview :



    De8Aj.png


    this mod is originally posted in nexus s forum.

    [MOD] Add ICS 'Recent Apps' button to Status bar

    i added just 'recent apps' button only but you can add other buttons what you want. like this :

    4Z2W8.png



    anyway, if you want to add 'recent apps' button..

    1) fix "APP_SWITCH" keycode to call ICS Recent Apps dialog.
    - basically, same process to this mod : [HOWTO] Remap hardware button to ICS recent apps

    platform/frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

    from :
    Code:
            } else if (keyCode == KeyEvent.KEYCODE_APP_SWITCH) {
                if (down && repeatCount == 0) {
                    showOrHideRecentAppsDialog(RECENT_APPS_BEHAVIOR_SHOW_OR_DISMISS);
                }
                return -1;
            }


    to :
    Code:
            } else if (keyCode == KeyEvent.KEYCODE_APP_SWITCH) {
                if (down && repeatCount == 0 && !keyguardOn) {
                try {
                    mStatusBarService.toggleRecentApps();
                } catch (RemoteException e) {
                    Slog.e(TAG, "RemoteException when showing recent apps", e);
                }
            }
                return -1;
            }


    2) modifiy Expanded Status bar layout

    - decompile SystemUI.apk -> /res/layout/status_bar_expanded.xml
    ..or..
    - platform/frameworks/base/packages/SystemUI/res/layout/status_bar_expanded.xml


    from :

    Code:
        <RelativeLayout android:background="@drawable/notification_header_bg" android:paddingTop="3.0dip" android:paddingRight="3.0dip" android:paddingBottom="5.0dip" android:layout_width="fill_parent" android:layout_height="52.0dip">
            <com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Date" android:gravity="left|center" android:id="@id/date" android:paddingLeft="16.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_alignParentLeft="true" />
            <ImageView android:id="@id/settings_button" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_quicksettings" android:layout_toRightOf="@id/date" android:contentDescription="@string/accessibility_settings_button" />
            <ImageView android:id="@id/clear_all_button" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_clear" android:layout_alignParentRight="true" android:contentDescription="@string/accessibility_clear_all" />
        </RelativeLayout>

    to :

    Code:
        <RelativeLayout android:background="@drawable/notification_header_bg" android:paddingTop="3.0dip" android:paddingRight="3.0dip" android:paddingBottom="5.0dip" android:layout_width="fill_parent" android:layout_height="52.0dip">
            <com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Date" android:gravity="left|center" android:id="@id/date" android:paddingLeft="16.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_alignParentLeft="true" />
            <ImageView android:id="@id/settings_button" android:paddingLeft="8.0dip" android:paddingRight="4.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_quicksettings" android:layout_toRightOf="@id/date" android:contentDescription="@string/accessibility_settings_button" />
            [COLOR="Blue"]<com.android.systemui.statusbar.policy.KeyButtonView android:paddingLeft="4.0dip" android:paddingRight="4.0dip" android:id="@id/recent_apps" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_recent" android:layout_toRightOf="@id/settings_button" android:contentDescription="@string/accessibility_recent" systemui:keyCode="187" systemui:glowBackground="@drawable/ic_sysbar_highlight" />[/COLOR]
            <ImageView android:id="@id/clear_all_button" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_clear" android:layout_alignParentRight="true" android:contentDescription="@string/accessibility_clear_all" />
        </RelativeLayout>


    3) you'd better replace /res/drawable-****/ic_sysbar_recent.png with smaller one...
    mine(in above preview - for hdpi) is here : http://www.mediafire.com/?qxy9l1emmeofa4s


    -----------------------------------------------------------------------------

    and caution
    - when i tested this on stock rom, search button works only when long pressed (=voice search).
    - adding some kind of button like menu or back is meaningless.. (surely)
    - and at least on my phone(nexus s), ICS blue(#33b1e1) doesn't look same color to date and quick settings button.. (don't know why)
    - and do not use this mod with tablet ui or onscreen softkeys mod.

    - and if you cannot compile android.policy.jar for some reason, try with my files instead.
    you can find my files in these thread :
    [MOD] Search key to ICS recent apps
    [MOD] Add ICS 'Recent Apps' button to Status bar
    and be careful. you should use suitable version to your rom. so if your cm9 rom was built few weeks ago, do not try with latest version of my mod.
    3
    Can u provide the code to add search key in status bar and how to mod this in smalis in Dex folder of android.policy.jar. if that isn't possible am then any way I can only fork this on aokp source and just compile android.policy.jar ?

    sorry but as i wrote before, i don't know much about smali..

    but adding other buttons is easy. because most of other buttons don't require source code change..:)
    so you can easily add other button just by editing layout xml file only.

    here is example : i added 'POWER' button next to 'recent apps' button to use it as replacement of screen lock widget.

    Code:
        <RelativeLayout android:background="@drawable/notification_header_bg" android:paddingTop="3.0dip" android:paddingRight="3.0dip" android:paddingBottom="5.0dip" android:layout_width="fill_parent" android:layout_height="52.0dip">
            <com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Date" android:gravity="left|center" android:id="@id/date" android:paddingLeft="16.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" android:layout_alignParentLeft="true" />
            <ImageView android:id="@id/settings_button" android:paddingLeft="4.0dip" android:paddingRight="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_quicksettings" android:layout_toRightOf="@id/date" android:contentDescription="@string/accessibility_settings_button" />
            <com.android.systemui.statusbar.policy.KeyButtonView android:paddingLeft="2.0dip" android:paddingRight="2.0dip" android:id="@id/recent_apps" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_recent" android:layout_toRightOf="@id/settings_button" android:contentDescription="@string/accessibility_recent" systemui:keyCode="187" systemui:glowBackground="@drawable/ic_sysbar_highlight" />
           [COLOR="Blue"] <com.android.systemui.statusbar.policy.KeyButtonView android:paddingLeft="2.0dip" android:paddingRight="2.0dip" android:id="@id/back" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_sysbar_back" android:layout_toRightOf="@id/recent_apps" android:contentDescription="@string/accessibility_back" systemui:keyCode="26" systemui:glowBackground="@drawable/ic_sysbar_highlight" />[/COLOR]
    	<ImageView android:id="@id/clear_all_button" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/ic_notify_clear" android:layout_alignParentRight="true" android:contentDescription="@string/accessibility_clear_all" />
        </RelativeLayout>

    i used 'back' button's id and drawable name because i don't use on-screen softkeys. but i think using other less useful drawable (for example, nyandroid..) is better than this..

    in above example, systemui:keyCode="26" is for POWER button. if you change this to 84, this will work as SEARCH button.
    1
    What to do with that file?
    I don't know exactly, it's my first own mod

    apply above fix related to "APP_SWITCH" keycode and compile android.policy.jar.
    you have to download entire ics source code to compile this..

    maybe same thing can be done simply by smali editing but sorry, i don't know how..:eek:
    1
    Dear evilisto
    can you help to provide search button icon??
    i try photoshop ic_sysbar_search_land form aokp
    but fail (it's so ugly....~"~)

    or you can find many good softkeys images in this thread (by atticus182) :

    [SOFTKEYS] [09-03] Softkey Collection 2.0 [GSM/CDMA]

    what i used in preview screenshot is "HTC One" style in above thread.


    Can It works on deodexed rom of Galaxy R ...

    i think so.. you can make your own follow my guide or ask your rom dev to include this mod in the rom.