1) Download the java version from this link
2) $chmod a+x jdk-6u33-linux-x64.bin
3) ./jdk-6u33-linux-x64.bin
This will extract with whole folder contents.
4) place the extracted folder into /usr/bin/
5) edit the bashrc file. add the below line.
$sudo gedit .bashrc
$export PATH=$PATH:/usr/bin/jdk1.6.0_33/bin
How to check about the Java installation.
Open terminal, and execute these commands
1) $java -version
2) $which java
In this post, i am going to explain the mechanism to enable the multi-touch support for Android applications.
Introducing multi-touch
Multi-touch is simply an extension of the regular touch-screen user interface, using two or more fingers instead of one. We’ve used single-finger gestures before, although we didn’t call it that.
Three common touch gestures .
a) Tap
b) Drag
c) Pinch-Zoom
With pinch zoom, you place two fingers on the screen and squeeze them together to make the item you’re viewing smaller, or pull them apart to make it bigger. Before Android 2.0 you had to use a clunky zoom control with icons that you pressed to zoom in and out . But thanks to its new multi-touch support, you can now pinch to zoom on Android too! As long as the application supports it, of course.
Enable the multi-touch for Android Applications
By default, all the android applications won't be enabled for the multi-touch functionality. You need to explicitly mention this feature in your AndroidManifest.xml file of the application.
The applications like 'Browser', 'Maps' and 'Gallery' will usually require this feature.
a) Include the below lines in your application manifest file
b) Copy the respective multitouch.xml file onto /system/etc/permissions folder. This is an important step when we know that from the hardware side the multi touch is already supported.
By Default, All Android applications can be installed in internal memory or external memory (SDCARD).
If you specify android:installLocation="preferExternal" in your AndroidManifest.xml file, then the application will be installed on external storage.
If you declare "preferExternal", you request that your application be installed on the external storage, but the system does not guarantee that your application will be installed on the external storage.
If the external storage is full, the system will install it on the internal storage. The user can also move your application between the two locations.
The kernel has to support the installations of the applications on the external memory.
Without the kernel support the application installation will end up in the error message " INSTALL_FAILED_CONTAINER_ERROR "
Enable these configurations in linux kernel and build the kernel
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.
From ICS onwards, Android supports the (1) case along with (2) and (3) case. The introduction of virtual buttons does not necessarily spell the end to hardware buttons, as such devices with buttons will simply not display the digital buttons.
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
b) navigation_bar.xml: Copy this file from /frameworks/base/packages/SystemUI
/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 !!!
In this post i will be discussing the general concepts of Wi-Fi and Wi-Fi in Android
The contents have been categorised into these sections.
Definition
Modes of operation
Working concepts
WI-FI in Android
Porting WI-FI drivers to Android
FAQ's on WI-FI on Android
References
Definition :
WI-FI is a mechanism that allows electronic devices to exchange data wirelessly over a computer network. WI-FI stands for Wireless Fidelity. WI-FI is based on the IEEE 802.11 family of standards and is primarily a Local Area networking (LAN) technology designed to provide in-building broadband coverage.
Modes of Operation :
WI-FI can operate in two different modes
a) Station Mode
b) Access Point mode
Station mode is the default operating mode for a WI-FI adapter. In this mode the adapter operates as a client that connects to a Wi-Fi access point (usually a wi-fi enabled router). This mode is used when you use a wi-fi adapter to connect to a wireless network
In Access Point mode, the adapter will act as an access point enabling other wi-fi adapters to connect to it. So in other words you can use the adapter to create your own wireless network. This can be handy is you want to share a wired Internet connection with other wireless devices and you don't have dedicated access point for example
Working Concepts:
There are three most important items which makes wi-fi working in your laptop or desktop. These are
Radio Signals
Wi-FI Card
Hotspots which create Wi-Fi network
Radio Signals :
Radio signals are the
keys which make WiFi networking possible. These radio signals
transmitted from Wi-Fi antennas are picked up by WiFi receivers such as
computers and cell phones that are equipped with WiFi cards. Whenever a
computer receives any of the signals within the range of a WiFi network
which is usually 300-500 feet for antennas, the WiFi card will read the
signals and thus create an internet connection between the user and the
network without the use of a card.
Wi-Fi Cards :
You can think WiFI card as being an invisible card that connects
your computer to the antenna for a direct connection to the internet.
Wi-Fi Hotspots:
A Wi-Fi hotspot is created
by installing an access point to an internet connection, The access
point transmits a wireless signal over a short distance. Typically
covering around 300 feet. When a Wi-Fi enabled device, such as a Pocket
PC encounters a hotspot, the device can then connect to that network
wirelessly
Wi-Fi in Android
Android uses modified wpa_supplicant daemon for wifi support. On gingerbread versions wpa_supplicant_6 version has used and on ICS versions wpa_supplicant_8 version has been used.
The daemon is controlled through a socket by hardware/libhardware_legacy/wifi/wifi.c (WiFiHW) that gets controlled from Android UI through android.net.wifi pcakage from frameworks/base/wifi/java/android/net/wifi and it's corresponding JNI implementation in frameworks/base/core/jni/android_net_wifi_wifi.cpp. Higher level network management is done in frameworks/base/core/java/android/net.
Contents
0. Understand how Android WiFi works.
1. Enable building of wpa_supplicant in your BoardConfig.mk
2. (Optional) Enable debug for wpa_supplicant.
3. Provide a proper wpa_supplicant.conf for your device
4. Have the correct paths and permissions created from init.rc
5. Make sure your wpa_supplicant and dhcpcd (optional) are starting from
init.rc
6. Provide your driver either as a module or built in kernel and proper kernel
support for it and modify Android source code accordingly.
7. Provide a firmware if your module needs it.
8. Make your driver work with Android custom wpa_supplicant commands and
SIOCSIWPRIV ioctl
Now onto details.
0. Understand how Android WiFi works.
Android uses a modified wpa_supplicant ( external/wpa_supplicant )
daemon for wifi support which is controlled through a socket by
hardware/libhardware_legacy/wifi/wifi.c (WiFiHW) that gets controlled from
Android UI through android.net.wifi package from frameworks/base/wifi/java/android/net/wifi/
and it's corresponding jni implementation in
frameworks/base/core/jni/android_net_wifi_Wifi.cpp Higher level network
management is done in frameworks/base/core/java/android/net
1. Enable building of wpa_supplicant in your BoardConfig.mk
This is by simply adding: BOARD_WPA_SUPPLICANT_DRIVER := WEXT to your
BoardConfig.mk . This will set WPA_BUILD_SUPPLICANT to true in
external/wpa_supplicant/Android.mk enabling building of driver_wext.c
If you have a custom wpa_supplicant driver (like madwifi or my custom android
private commands emulation - see last paragraph) you can replace WEXT with
AWEXT or your driver name (MADWIFI, PRISM etc).
2. (Optional) Enable debug for wpa_supplicant.
By default wpa_supplicant is set to MSG_INFO that doesn't tell much.
To enable more messages:
2.1 modify common.c and set wpa_debug_level = MSG_DEBUG
2.2 modify common.h and change #define wpa_printf from if ((level) >=
MSG_INFO) to if ((level) >= MSG_DEBUG)
3. Provide a proper wpa_supplicant.conf for your device
Providing a wpa_supplicant.conf it's important because the control socket for
android is specified in this file (ctrl_interface= ). This file should be
copied by your AndroidBoard.mk to $(TARGET_OUT_ETC)/wifi (usually
/system/etc/wifi/wpa_supplicant.conf ). This location will be used on
wpa_supplicant service from init.rc.
There are two different ways in which wpa_supplicant can be configured, one is
to use a "private" socket in android namespace, created by
socket_local_client_connect() function in wpa_ctrl.c and another is by using a
standard unix socket.
Depending on your driver you might also want to add:
ap_scan=1
If you have AP association problems with should change to ap_scan=0 to let the
driver do the association instead of wpa_supplicant.
If you want to let wpa_supplicant connect to non-WPA or open wireless networks
(by default it skips these kind) add:
network={
key_mgmt=NONE
}
4. Have the correct permissions and paths created from init.rc
Incorrect permissions will result in wpa_supplicant not being able to
create/open the control socket and libhardware_legacy/wifi/wifi.c won't
connect.
Since Google modified wpa_supplicant to run as wifi user/group the
directory structure and file ownership should belong to wifi user/group (see
os_program_init() function in wpa_supplicant/os_unix.c ).
Otherwise errors like:
E/WifiHW ( ): Unable to open connection to supplicant on
"/data/system/wpa_supplicant/wlan0": No such file or directory will
appear.
Also wpa_supplicant.conf should belong to wifi user/group because
wpa_supplicant will want to modify this file. If your system has /system as
read-only use a location like /data/misc/wifi/wpa_supplicant.conf and modify
wpa_supplicant service in init.rc with new location.
Make sure the paths are correctly created in init.rc:
Do not add these if you use Android private socket because it will make
wpa_supplicant non-functional, because hardware/libhardware_legacy/wifi/wifi.c
check for existence of the /data/system/wpa_supplicant folder and will pass a
wrong interface name to wpa_ctrl_open() function.
5. Make sure your wpa_supplicant and dhcpcd are starting from init.rc
For wpa_supplicant the init.rc startup like should be depending on which path
you chosen: - Android private socket:
service wpa_supplicant /system/bin/wpa_supplicant -dd -Dwext -iwlan0 -c
/system/etc/wifi/wpa_supplicant.conf
socket wpa_wlan0 dgram 660 wifi wifi
group system wifi inet
disabled
oneshot
- Unix standard socket:
service wpa_supplicant /system/bin/wpa_supplicant -dd -Dwext -iwlan0 -c
/system/etc/wifi/wpa_supplicant.conf
group system wifi inet
disabled
oneshot
If your wifi driver creates a wifi interface with other name than wlan0 you
will have to modify the above line accordingly.
You also should have dhcpcd starting from init.rc
service dhcpcd /system/bin/dhcpcd wlan0
group system dhcp
disabled
oneshot
Newer AOSP versions after Gingerbread use dhcpcd_wlan0 as service name.
6. Provide your driver either as a module or built in kernel and proper
kernel support for it.
First make sure that CONFIG_PACKET and
CONFIG_NET_RADIO (wireless extensions) are enabled in your kernel.
The driver can be built as module (default android way) or built in kernel (if
you want to rely in kernel auto probing to support multiple driver eg. USB
wifi) but will require source code modifications (see below). - As kernel module:
Define in your BoardConfig.mk :
1. WIFI_DRIVER_MODULE_PATH := path to the module to be loaded
You need to specify module name in that
path too, usually should look something like /system/lib/modules/wlan.ko
2. WIFI_DRIVER_MODULE_NAME:= the name of the network
interface that the driver creates, for example wlan0
3. WIFI_DRIVER_MODULE_ARG:= any arguments that you want to pass to
the driver on insmod, for example nohwcrypt
Make sure you copy your kernel module when building android to the
correct location. - As built in kernel:
- First init.rc needs to be modified to inform
hardware/libhardware_legacy/wifi/wifi.c about the name of the interface, that
the driver is already loaded and set the status of wpa_supplicant to
running:
Do NOT add setprop init.svc.wpa_supplicant "running" as I
previously mentioned as it will prevent wpa_supplicant from starting from init.
- Secondly hardware/libhardware_legacy/wifi/wifi.c need to be modified so
the functions insmod() and rmmod() return 0 (simply add return 0; as the first
line in functions since they are not needed when driver is built in kernel) and
return before checking for /proc/modules in check_driver_loaded()
function.
You might encounter problems with WifiHW module not being able to connect to
wpa_supplicant socket even with the correct permisions. Try to turn off / turn
on Wifi from the GUI.
7. Provide a firmware if your driver needs it
If your driver needs a firmware you will have to copy this firmware file to
/etc/firmware on your android build. Android doesn't use a standard hotplug
binary (although there is an implementation available on android-x86 system/code/toolbox/hotplug.c
) instead the init process takes care of firmware events and loads the firmware
file from /etc/firmware (see: system/core/init/devices.c handle_firmware_event()
function).
Firmware file name is defined by the driver and might also contain a folder
like: RTL8192SU/rtl8192sfw.bin, entire file path should be available in
/etc/firmware
8. Make your driver work with Android custom wpa_supplicant commands and
SIOCSIWPRIV ioctl.
Android uses SIOCSIWPRIV ioctl to send commands to modify driver
behaviour and receive information like signal strength, mac address of the AP,
link speed etc. This ioctl is usually not implemented in any known wireless drivers
except bcm4329 which is in google msm
kernel branch .
The errors from not having this ioctl implemented will look like:
E/wpa_supplicant( ): wpa_driver_priv_driver_cmd failed
wpa_driver_priv_driver_cmd RSSI len = 4096
E/wpa_supplicant( ): wpa_driver_priv_driver_cmd failed
D/wpa_supplicant( ): wpa_driver_priv_driver_cmd LINKSPEED len = 4096
E/wpa_supplicant( ): wpa_driver_priv_driver_cmd failed
I/wpa_supplicant( ): CTRL-EVENT-DRIVER-STATE HANGED
After 4, WEXT_NUMBER_SEQUENTIAL_ERRORS errors, android will abort using the
device.
To quickly test your wifi from interface you can disable error checking in
external/wpa_supplicant/driver_wext.c by simply making ret = 0; in
wpa_driver_priv_driver_cmd() function after the SIOCSIWPRIV ioctl call. This
will make all access points in android UI appear without signal or MAC address.
To proper implement the ioctl you will need to modify your kernel driver to
reply to SIOCSIWPRIV ioctl with RSSI (signal strength) and MACADDR commands
being the most important.
A better way is to add a custom driver_xxx.c to google external/wpa_supplicant/
implementing wpa_driver_priv_driver_cmd() function that will take care of RSSI,
MACADDR and others, through calls to SIOCGIWSTATS, SIOCGIFHWADDR ioctls, with
the rest of the functions being called from driver_wext.c.
Below is a link to a patch for wpa_supplicant that I did for mini-box.com picoPC Android
build. It creates a new driver awext which "emulates" android driver
commands using wireless extensions ioctls.
How to use the new driver:
1. In your BoardConfig.mk define: BOARD_WPA_SUPPLICANT_DRIVER := AWEXT
2. Change init.rc wpa_supplicant service command line by replacind -Dwext with –Dawext
AWEXT driver patch download: android_wext_emulation_driver_awext.patch
For Gingerbread patches see the post above.
FAQ's on Wi-Fi on Android
a) I am getting an error "Failed to start supplicant!". How to resolve this issue?
The wpa_supplicant needs to run as a service. It looks like the service entry hasn't been added to init.rc file. Add the below entries to init.rc file.
service wpa_supplicant /system/bin/wpa_supplicant -Dwext -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf class main socket wpa_wlan0 dgram 0660 wifi wifi disabled oneshot
b) Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0": No such file or directory
The socket entry and permissions needs to be added in init.rc file
Add the below entries to init.rc file
mkdir /system/etc/wifi 0770 wifi wifi chmod 0770 /system/etc/wifi chmod 0660 /system/etc/wifi/wpa_supplicant.conf chown wifi wifi /system/etc/wifi/wpa_supplicant.conf # wpa_supplicant control socket for android wifi.c (android private socket) mkdir /data/misc/wifi 0770 wifi wifi mkdir /data/misc/wifi/sockets 0770 wifi wifi chmod 0770 /data/misc/wifi chmod 0660 /data/misc/wifi/wpa_supplicant.conf chown wifi wifi /data/misc/wifi chown wifi wifi /data/misc/wifi/wpa_supplicant.conf
c)ADDRCONF(NETDEV_UP): wlan0: link is not ready
The wpa_supplicant service is already will be running . But, it's failing to scan the networks. At this point of time, you will receive an warning message like this.
Android uses SIOCSIWPRIV ioctl to send commands to modify driver behaviour and receive information like signal strength, mac address of the AP, link speed etc. This ioctl is usually not implemented. A quick workaround was to emulate this ioctl functionality in WPA_supplicant itself. Here is the corresponding patch Added emulation of Android private ioctls for generic WiFi drivers.
Check this link for the Patch.
d)Wi-Fi is able to scan other networks, but when i tried to connect to other networks, it's getting failed.
The DHCPCD service needs to be started as well. The Dynamic Host Configuration Protocol (DHCP) is a network configuration protocol for hosts on Internet Protocol (IP) networks. This service will provide the dynamic IP.
start the dhcp service from init.rc file
service dhcpcd /system/bin/dhcpcd wlan0 group system dhcp disabled oneshot