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

Search This thread

evilisto

Senior Member
Nov 26, 2010
486
2,318
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.
 
Last edited:

pdppdp

Senior Member
Feb 16, 2011
567
127
I've been looking for this quite a while because my homebutton doesn't work that good anymore.
I'm running a Samsung galaxy s with teamhacksung ICS build 17.
Is there any chance you could make a flashable zip for this because I have absolutely no clue in coding. I'm just consuming these incredible things here on xda :)
 

rashid.fairus

Senior Member
Dec 6, 2011
1,073
233
Klang
I read all post from nexus because I'm using cm9 and they have made wonderful mod for it,but no guide at all,but you're really awesome because you made a guide and was really helping me port it to my phone,thanks!!!

from the ARC
 

evilisto

Senior Member
Nov 26, 2010
486
2,318
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:
 
  • Like
Reactions: F.West98

F.West98

Senior Member
Jan 27, 2012
158
75
Zuidhorn (Groningen)
But then it isn't CM9 anymore, is it?
Can't I download only the needed files from Github? And how to make it flashable?

Ah I understand something
I can place the .jar file (compiled) into the folder 'frameworks' in my flashable zip, there is also an apk (framework-res)
I have to download the complete source code and I only have to change the file (.java), which I compile as the .jar

Correct?
(but why do I need the whole source code, I'm on Windows...)
 
Last edited:

evilisto

Senior Member
Nov 26, 2010
486
2,318
But then it isn't CM9 anymore, is it?
Can't I download only the needed files from Github? And how to make it flashable?

Ah I understand something
I can place the .jar file (compiled) into the folder 'frameworks' in my flashable zip, there is also an apk (framework-res)
I have to download the complete source code and I only have to change the file (.java), which I compile as the .jar

Correct?
(but why do I need the whole source code, I'm on Windows...)

firstly, i recommend you read this : How to compile ICS

and if you want to use this on CM9, download CM source instead of AOSP.
https://github.com/CyanogenMod

download single framework file's source code and compile that one file is impossible. so you have to download entire ics source code..

and if you want to use what you made personally, you don't have to make flashable zip. just push modified files to your system using adb or (easily) android commander.
http://androidcommander.com/
 

F.West98

Senior Member
Jan 27, 2012
158
75
Zuidhorn (Groningen)
So I have to wait 4 hours and only pick 1 file of evrything? :p
Flashable ZIP is easy for me

edit: and I have to restart my PC, save everything, check the x64-option in the BIOS, install virtualbox, download linux and install it?
Can't anyone compile for me? :S
 
Last edited:

mwalt2

Senior Member
Feb 22, 2009
2,248
1,531
Good job OP. BTW, ICS color code in hex is 33b5e5 I believe.

Sent from my Galaxy Nexus using xda premium
 

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.