Posted by The RTOS Team on Tue, Mar 09, 2010 @ 04:37 AM
Enea announced that Scalado, a leading provider of high-performing imaging technologies, relied on the Enea Android Competence Center (www.enea.com/android) to deliver an Android-based proof of concept platform. Scalado required a complete hardware and software implementation to demonstrate that it's SpeedTags Camera Solution, which eliminates the lag between pressing the capture button and the taking of a picture, delivered a rich camera experience on Android. It was essential that the Android platform itself would not be the system bottleneck - negating the benefits of this innovative technology.
"Scalado is working to revolutionize the quality and enhance the user experience of mobile phone photography. In order to make the largest impact they need to be on emerging platforms like Android," said Per Åkerberg, president and CEO of Enea. "We are pleased that they trusted Enea to deliver a demonstration platform that is critical to their success."
Camera technology is among the most complex in a mobile phone, touching all hardware and software layers. A key part of this project was replacing a legacy image sensor on the development board with an advanced five megapixel sensor from leading supplier, Aptina, which had integrated SpeedTags technology. A team from Scalado, Aptina and Enea ensured the integration of the image sensor, firmware, application software and Android.
"It was a great challenge for Enea to complete and deliver this project in the short timeframe before Mobile World Congress," said Fadi Abbas, CMO/CSO and founder at Scalado. "Enea demonstrated unique skills by integrating the Aptina image sensor hardware and our application software with the Android platform."
"The Scalado SpeedTags Camera Solution greatly enhances the user experience of our five megapixel image sensor for mobile phones, and helps illustrate Aptina's commitment to providing an easy to use camera solution," said Venkat Puntambekar, Director of Marketing, Mobile Imaging at Aptina. "Working with Enea and Scalado to bring this new integrated offering to market on Android was a truly collaborative effort by three technology leaders in the industry."
Enea's Android Competence Center has a focus on the platform and framework level of Android. The professional services teams of Enea have deep knowledge in Android internals, system integration, file systems, device drivers, operator needs, security and tool development. Enea also offers a flexible module-based training that delivers exactly the knowledge required from a simple overview to a five day complete Android seminar.
Posted by Enea Android Team on Wed, Feb 03, 2010 @ 08:12 AM
This is a short post on the more entertaining side of Android showing a project that the Enea team in Linköping, Sweden, prepared for an expo. It is a one minute video from the demonstration.
It is two LEGO Mindstorms robots controlled by one HTC Hero Android phone. The Hero is running an Android application written by Enea Linköping that send motor commands to the LEGO brick. LEGO has been kind enough to put a Bluetooth chip in the Mindstorms NXT controller. By using the built in demonstrational Bluetooth commands the NXT brick provides there is no need for an application to be downloaded into the NXT brick.
There was however one obstacle in the limited Bluetooth support in Android OS version 1.5 (not supporting the Bluetooth serial port profile, SPP). Instead we used the wifi capabilities on the phone to send information to an Ubuntu Linux Laptop with a TCP/IP to Bluetooth tunnel (just a raw tunnel, no logic or programming). HTC has been rumored to be releasing Android OS version 2.1 (with Bluetooth) later in february and we hope to be able to put forth a new version that skip the WiFi laptop step.
Video below:
Posted by Enea Android Team on Tue, Dec 29, 2009 @ 08:39 AM
Following our other posts about booting and the system server, here are some more details of how to add a service to the system server.
It should be noted that extending the system server and other framework features is not recommended, as the code requires to be ported to future releases of the framework.
The most common reason for adding a system server would be for supporting proprietary hardware.
Design considerationsThere are a few questions to be answered before implementing a system server, such as threads needed, application interfaces, and hardware interfaces. It's no easy task specifying your server design, but considering the following will hopefully help you out:
1. How frequently will the server run? If the server is only needed occasionaly, it might very well run within the system server context, even though the most common way is give it its own thread. A typical infrequent server is the Headset observer, which will only run when a headset is connected or removed.
2. How is the hardware accessed? Standard hardware could be accessible through device file access and file observers, but the best solution is no doubt to implement a HAL library. The HAL makes it easier to port your server to other hardware, and also makes it possible to run some functionality in native threads if needed.
3. Application interfacing? It is sometimes possible to get away with using intents and implementing your server as a receiver, but for anything but the simplest requests, you will no doubt have to use aidl.
4. Extending the framework? If you want to make your new interface visible to the applications, you will have to update the api description and build your own sdk. (That is easily done with "make update-api", followed by "make sdk".) However, if you only want the your nifty features to be accessible from your own proprietary applications, you should make use of the javadoc @hide-option for your interface.
5. Is there another way? Adding your own server adds migration work for new releases of the framework. To minimise files added, it's easy to be tempted to alter existing services instead of adding your own. That is fine to do, but keep in mind that if some functionality changes, third-party applications may not work anymore. Again, if your server will only be accessed from a proprietary application and not publicly available, consider adding the code to the application instead.
Code sampleFollowing is an example of a proprietary service, that knows how to set a value. For simplicity, the code is just added to the framework. For a production implementation, the code should go into the vendor directory.
Specifying the interface.This example uses aidl, so the first step is to add an interface definition file:
frameworks/base/core/java/android/os/IEneaService.aidl
package android.os;
interface IEneaService {
/**
* {@hide}
*/
void setValue(int val);
}
The interface file will need to be added to the build system:
frameworks/base/Android.mkAdd the following around line 165 (the end of the list of SRC_FILES):
core/java/android/os/IEneaService.aidl \
Implementing the serverThe service spawns a worker thread that will do all the work, as part of the system server process. Since the service is created by the system server, it will need to be located somewhere where the system server can find it.
frameworks/base/services/java/com/android/server/EneaService.java
package com.android.server;
import android.content.Context;
import android.os.Handler;
import android.os.IEneaService;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.util.Log;
public class EneaService extends IEneaService.Stub {
private static final String TAG = "EneaService";
private EneaWorkerThread mWorker;
private EneaWorkerHandler mHandler;
private Context mContext;
public EneaService(Context context) {
super();
mContext = context;
mWorker = new EneaWorkerThread("EneaServiceWorker");
mWorker.start();
Log.i(TAG, "Spawned worker thread");
}
public void setValue(int val)
{
Log.i(TAG, "setValue " + val);
Message msg = Message.obtain();
msg.what = EneaWorkerHandler.MESSAGE_SET;
msg.arg1 = val;
mHandler.sendMessage(msg);
}
private class EneaWorkerThread extends Thread{
public EneaWorkerThread(String name) {
super(name);
}
public void run() {
Looper.prepare();
mHandler = new EneaWorkerHandler();
Looper.loop();
}
}
private class EneaWorkerHandler extends Handler {
private static final int MESSAGE_SET = 0;
@Override
public void handleMessage(Message msg) {
try {
if (msg.what == MESSAGE_SET) {
Log.i(TAG, "set message received: " + msg.arg1);
}
} catch (Exception e) {
// Log, don't crash!
Log.e(TAG, "Exception in EneaWorkerHandler.handleMessage:", e);
}
}
}
}
You may want to add to the log printouts the thread id or name just to visualise which thread the code is executing in.
All that's left to do now is to type
make to build the repository, and then start up the emulator. Using logcat, you will find the message saying that the thread has been spawned.
Test programYou probably want to test your service as well. For this you can create a "Hello World" activity using the project wizard. Place the project in the
vendor/enea directory.
In the main activity class of your test program, add the following lines to
onCreate()
IEneaService em = IEneaService.Stub.asInterface(ServiceManager.getService("EneaService"));
try {
em.setValue(7); // Any value would do, really.
} catch (Exception e) {
e.printStackTrace();
}
You will also need to import android.os.IEneaService and of course add an apropriate Android.mk to build your test program.
Start your test program and look in the log. You should now find the "set value"-messages.
Cheers
Robert
Posted by Enea Android Team on Mon, Dec 21, 2009 @ 09:58 AM
If you follow the instructions on http://source.android.com/using-eclipse you will only have a Java project and will only see the C/C++ project files as 2:nd class citizens without any indexing. I will propose a another solution that will combine the ideas from http://lorinc.blogspot.com/2006/10/how-to-mix-java-and-c-code-in-singe.html.
1. Copy the already available Java setup
|
$ cd $ cp development/ide/eclipse/.classpath . # You might need to make the copy writable (describe on android.com) $ chmod u+w .classpath |
2. From Eclipse create a new C++ project File -> New -> Other, select C/C++ -> C++ Project give it a project name and uncheck "Use default location"
and give it the path to your directory (often called the mydroid dir)
Select Project Type: "Makefile project" -> "Empty Project", let the "-- Other Toolchain" be selected and press "Finish"
3. Add in Java to the same project
Close Eclipse as you will edit a file it holds open and will overwrite otherwise Now a /.project file has been created open it in a text editor and add the following:
|
< buildCommand > < name > org.eclipse.jdt.core.javabuilder < /name > < arguments > < /arguments > < /buildCommand >
|
and
|
< nature > org.eclipse.jdt.core.javanature< /nature> |
as described here:
|
< ?xml version="1.0" encoding="UTF-8"? >
< projectdescription >
< name > android zoom2 < /name >
< comment > < /comment >
< projects >
< /projects >
< buildspec >
------------------------------- below is added
< buildCommand >
< name > org.eclipse.jdt.core.javabuilder < /name >
< arguments >
< /arguments >
< /buildCommand >
------------------------------- end of the added stuff
< buildcommand >
< name > org.eclipse.cdt.managedbuilder.core.genmakebuilder < /name >
< triggers > clean,full,incremental, < /triggers >
...
< /buildCommand >
< /buildSpec >
< natures >
< nature > org.eclipse.cdt.core.cnature < /nature >
< nature > org.eclipse.cdt.core.ccnature < /nature >
< nature > org.eclipse.cdt.managedbuilder.core.managedBuildNature < /nature >
< nature > org.eclipse.cdt.managedbuilder.core.ScannerConfigNature < /nature >
------------------------------- below is added
< nature > org.eclipse.jdt.core.javanature < /nature >
------------------------------- end of the added stuff
< /natures >
...
|
Now start eclipse again, now the Java classes are available in "Project Explorer" view and C/C++ files in "C/C++ Projects" view.
One problem remain when you build it will use "make all" and that will not work and need to be changed to "make" this can be done if you right-click on the project and select "Properties"
In the "Properties" window select "C/C++ Build" and click on the "Behaviour" tab and remove "all" from all the places where available.
I still used the java heap enlargement in eclipse.ini from the first link by changing the numbers in eclipse.ini to the numbers below:
|
-Xms128m -Xmx512m -XX:MaxPermSize=256m
|
The standard eclipse from Ubuntu 9.10 (installed from synaptic) uses this file /usr/lib/eclipse/eclipse.ini you need to be root to edit it e.g.
|
$ sudo gedit /usr/lib/eclipse/eclipse.ini |
/Zingo
Enea Whitepaper

The emergence of Android paves the way for new opportunities for the world's mobile phone manufacturers. Learn More.
Posted by Enea Android Team on Thu, Dec 03, 2009 @ 03:44 PM
Currently there is an issue with building the Android Open Source project on Ubuntu 9.10 Karmic Koala, or more specific with the Java 5 support. Java 5 was obsoleted by Sun on October 30 2009 and is not part of the Ubuntu 9.10 distribution. However there is still a need to use Java 5 for building Android since Java6 is not yet supported. There are two methods to get Java5 working on Ubuntu 9.10.
Method 1 - download and install from Sun
This method will let you install the Java5 JDK in a separate directory and add it to the path.
Download the Java5 JDK for Linux from http://java.sun.com/javase/downloads/5u21/jdk
This is a binary file that you should save to a suitable location like ~/tools
In order to make i executable chmod the file as
|
$ chmod 777 jdk-1_5_0_21-linux-i586.bin |
and run it
|
$ ./jdk-1_5_0_21-linux-i586.bin |
This will install the jdk to the current directory.
To use the JDK5 tools you need to add it first in the path before building the Android Open Source Project
|
$ export PATH=~/tools/jdk1.5.0_21/bin |
This allows you to remove the JDK5 from the path when not building Android and use the standard Java settings instead.
Method 2 - use the Ubuntu 9.04 repositories to get Java5
This method adds the Jaunty repositories and installs Java5 as the default java setting in the system. Open the sources file (/etc/apt/sources.list) for editing, as root
|
$ sudo gedit /etc/apt/sources.list |
and add:
|
deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse |
save the file and close gedit. Next sync your sources by running
and install
|
$ sudo apt-get install sun-java5-jdk |
To set the system to use Java 5 you need to update your java alternatives by running
|
$ sudo update-alternatives --config java |
Choose java-1.5.0-sun and you should be done.
Hopefully the Android Open Source Project will build with Java 6 shortly but the above solutions should get you going with platform work on Ubuntu 9.10.
Enea Whitepaper

The emergence of Android paves the way for new opportunities for the world's mobile phone manufacturers. Learn More.
Posted by Enea Android Team on Tue, Dec 01, 2009 @ 06:39 AM
Even though application development has not been the main focus of the Enea Android Competence Center we decided to give it a try in order to widen our knowledge. For a couple of weeks we have been working on an application called Train Tracker. The application is mainly aimed to be used as an internal reference. The application shows real time train traffic information from Swedish train stations, some of the main features are:
- Show all departing/arriving trains at a specific train station
- Detect and warn for delayed trains.
- Station search with auto complete text
- Follow a train route (all arrival and departure times at all stations) for a specific train
- Filter list of arrivals/departures (e.g. all departures from Lund towards Malmö)
- Save a filter as a favourite. Favourites can be selected directly from the start page.
- Set an alarm on train routes to get notified when the train is delayed.
- Global search for stations and favourites integrated in Google Quick Search Box (Requires Android platform 1.6 or later and that Train Tracker is made searchable in Settings/Search/Searchable Items)
The information presented in the application is downloaded from http://banverket.se/. Unfortunately Banverket was not willing to give us API access which is why our application is parsing HTML in order to get the information. This means that the application is likely to stop working if Banverket decides to change the layout of the webpage. Right now the application works quite well and if you want to try it out you can download TrainTracker.apk here. Keep in mind that the application language is Swedish and it can only show information from Swedish trains and train stations. Here are some screenshots from Train Tracker:

Train Tracker start activity. Search for a station or select one of your saved favourites.

Train Tracker station activity. In this view you will find all arrivals/departures of a specific station.

Train Tracker filter activity. Here you can filter the list of arrivals/departures. Select "Spara Filter" to save the filter as a favourite. Select "Använd Filter" to apply the selected criteria.

Back at the station activity. This time filtered with the selected filter criteria and one of the departures has been expanded. Tapping the "Aktivera alarm" line will schedule an alarm for train 1067. Tapping The "Tåg 1067" line will take you to the train route activity for this train.

Train Tracker train route activity. At this view we display all train stops for a specific train. At the top of the screen a train delayed notification is received.

Global search in Google Quick Search Bar. Search hits from Train Tracker shows up together with ordinary search hits. Search hits gain higher priority in the search result list as they are selected.
/Erik
Enea Whitepaper

The emergence of Android paves the way for new opportunities for the world's mobile phone manufacturers. Learn More.
Posted by Enea Android Team on Fri, Oct 16, 2009 @ 08:05 AM
This post covers a couple of examples that are available in the Android open source project that provide a good start to exploring the framework and the JNI implementations in Android. If you are working with Android Open Source Project on hardware and want to test adding new API:s to the platform without breaking the structure these examples are really good.
The reason you may want to do this is that you are creating a device with some new features that you want to be available for some specific applications shipped with the device. It is also a good exercise to run through in order to understand the frameworks used by Android. This is the preferred way to do this and to quote Dianne Hackborn on the official mailing lists (found
here):
If you are going to allow the user to keep Market on their phone, and are adding any new features, please do this the official way: include your own shared library with the features that applications use, rather than having magic hacks in the framework for them.
The example for this reside in the
vendor/samples folder in the Android open source project. There are several components in this example:
- The PlatformLibraryExample code itself which is a sample native library implementing some example platform functionality.
- A java library that interfaces the platform library through JNI and exposes the API:s to applications.
- A sample client application that uses this functionality
It is even possible to create an SDK add-on in order to have the added features easily available when developing applications. We will talk more about SDK add-ons in a later post.
To understand what is in this sample start out by reading the readme file in vendor/sample/frameworks/PlatformLibrary. This file describes the above components in more detail and will also tell you what you need to know in order to test the framework additions on a system.
If you are like us and like to try things out on the platform and work directly with some features that are not currently available in Android it is a good thing to follow these examples. It removes the need for making changes directly in the framework when exploring the possibilities of the platform.
/Mattias
Enea Whitepaper

The emergence of Android paves the way for new opportunities for the world's mobile phone manufacturers. Learn More.