[Android Software Development] evilisto:
Preview :

[YOUTUBE]JrjosaYLj_w[/YOUTUBE]

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 :

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 :

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

to :

} 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 :

<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 :

<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.