Virtual buttons allows for the buttons (Home, Back, etc) to be incorporated in the bottom of the screen.
The Input system in Android provides special features for implementing virtual soft keys.
There are three cases:
1. If the virtual soft keys are displayed graphically on the screen, as on the Galaxy Nexus, then they are implemented by the Navigation Bar component in the System UI package.
2. If the virtual soft keys are implemented as an extended touchable region that is part of the main touch screen, as on the Nexus One, then the input system uses a virtual key map file to translate X / Y touch coordinates into Linux key codes, then uses the key layout file to translate Linux key codes into Android key codes.
3. If the virtual soft keys are implemented as capacitive buttons that are separate from the main touch screen, as on the Nexus S, then the kernel device driver or firmware is responsible for translating touches into Linux key codes which the input system then translates into Android key codes using the key layout file.
This article targets for the devices which are running on Gingerbread (2.3.6) without the hardware buttons.
I Back-ported the "Virtual Soft keys / Navigation Bar from ICS (4.0.3) to Gingerbread (2.3.6) .
The animation changes of ICS have been discarded in Gingerbread and the Functionality of 'Recent Applications list ' of ICS hasn't been taken into GB.
Follow these steps to get the Virtual soft keys on Gingerbread (2.3.6).
Prerequisites :
a) AOSP Gingerbread code (2.3.6) -- Get it from here
b) AOSP ICS source code (4.0.3) -- Get it from here
Source File Changes:
All the source file changes are in '/frameworks/base' module.
Addition of source files : New source files have been added from ICS to GB.
a) NavigationBarView.java: Copy this file from ICS to GB.
ICS Location : /frameworks/base/packages/systemui/src/com/android
/systemui/statusbar/phone/
GB Location : /frameworks/base/packages/systemui/src/com/android
/systemui/statusbar/
Note : Ignore out all the animator related stuffs in this source file.
Change the package name also.
b) KeyButtonView.java: Copy this file from ICS to GB.
ICS Location : /frameworks/base/packages/systemui/src/com/android
/systemui/statusbar/policy/
GB Location : /frameworks/base/packages/systemui/src/com/android
/systemui/statusbar/
Note : Ignore out all the animator related stuffs in this source file.
Change the package name also.
Modification to source files :
a) core/java/android/view/KeyCharacterMap.java :
b) core/java/android/view/View.java
c) core/java/android/view/ViewGroup.java
d) core/java/android/view/WindowManager.java
e) include/ui/InputDispatcher.h
f) packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java
g) policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Resource File Changes :
Addition of Resource Files : New Resource files have been added from ICS to GB
a) Copy these files from /frameworks/base/packages/SystemUI
/res/drawable-hdpi to
/frameworks/base/packages/SystemUI/res/drawable
/res/layout/ to
/frameworks/base/packages/SystemUI/res/layout/
c) attrs.xml : Copy this file from /frameworks/base/packages/SystemUI/res/values/ to /frameworks/base/packages/SystemUI/res/values/
Modifications to Resource Files :
a) core/res/res/values/dimens.xml
b) packages/SystemUI/res/layout/status_bar.xml
c) packages/SystemUI/res/values/dimens.xml
d) packages/SystemUI/res/values/strings.xml
Will be updating the complete patches list of the modifications soon !!!
Happy Navigating !!
Modification to source files :
a) core/java/android/view/KeyCharacterMap.java :
b) core/java/android/view/View.java
c) core/java/android/view/ViewGroup.java
d) core/java/android/view/WindowManager.java
e) include/ui/InputDispatcher.h
f) packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java
g) policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Resource File Changes :
Addition of Resource Files : New Resource files have been added from ICS to GB
a) Copy these files from /frameworks/base/packages/SystemUI
/res/drawable-hdpi to
/frameworks/base/packages/SystemUI/res/drawable
- packages/SystemUI/res/drawable/ic_sysbar_back.png
- packages/SystemUI/res/drawable/ic_sysbar_back_land.png
- packages/SystemUI/res/drawable/ic_sysbar_highlight.png
- packages/SystemUI/res/drawable/ic_sysbar_highlight_land.png
- packages/SystemUI/res/drawable/ic_sysbar_home.png
- packages/SystemUI/res/drawable/ic_sysbar_home_land.png
- packages/SystemUI/res/drawable/ic_sysbar_lights_out_dot_large.png
- Packages/SystemUI/res/drawable/ic_sysbar_lights_out_dot_small.png
- packages/SystemUI/res/drawable/ic_sysbar_menu.png
- packages/SystemUI/res/drawable/ic_sysbar_menu_land.png
- packages/SystemUI/res/drawable/ic_sysbar_recent.png
- packages/SystemUI/res/drawable/ic_sysbar_recent_land.png
/res/layout/ to
/frameworks/base/packages/SystemUI/res/layout/
c) attrs.xml : Copy this file from /frameworks/base/packages/SystemUI/res/values/ to /frameworks/base/packages/SystemUI/res/values/
Modifications to Resource Files :
a) core/res/res/values/dimens.xml
b) packages/SystemUI/res/layout/status_bar.xml
c) packages/SystemUI/res/values/dimens.xml
d) packages/SystemUI/res/values/strings.xml
Will be updating the complete patches list of the modifications soon !!!
Happy Navigating !!