Testing tools and AI - ideas what to try with some tool examples
Droidcon uk2012 androvm
1. AndroVM
DROIDCON LONDON An
alterna-ve
25-26th October to
Android
SDK
Daniel FAGES : emulator
à
dan@androvm.org
2. Agenda
Android
Open
Source
Project
Presenta-on
Architecture
Building/Tes-ng
Contribu-on
AndroVM
project
Presenta-on
Usage
Architecture
We
need
your
help
!
3. Android Open Source Project
Ini-a-ve
from
the
Open
Handset
Alliance,
leaded
by
Google,
to
create
an
open
mobile
pla6orm
for
telcos,
OEMs
and
developers.
Open
Source
project….but
strong
dependency
to
Google
Ten
major
releases
(1.0,
1.1,
CupCake,
Donut,
Eclair,
Froyo,
Gingerbread,
Honeycomb,
ICS,
JB)
since
September
2008
more
than
450M
devices
and
>1.3M
ac-va-ons
a
day
!
5. Jelly Bean – Devices support
The
last
release
of
AOSP
(Jelly
Bean/4.1)
supports
:
• Nexus
S
(GSM,
CDMA/WiMAX)
• Galaxy
Nexus
(GSM/HSDPA+,
CDMA/LTE)
• Nexus
7
• Motorola
Xoom
(WiFi
only,
CDMA/LTE)
• PandaBoard
(development
board)
But,
even
for
those,
-‐>
Some
components
are
only
available
in
binary
form
-‐>
Some
other
are
even
not
publicly
available
6. AOSP – Source code interests
“ROM
Cooking”
on
smartphones
and
tablets
(ex
:
CyanogenMod
project
–
more
than
1M
devices)
Use
of
Android
on
new
pla[orms,
different
from
smartphones
and
tablets
Applica-on
debugging
and
op-miza-on
Source
code
security
analysis
7. AOSP JB - Building
Sources
• Informaon
Source
:
h]p://source.android.com
• OS
Pre-‐requisite
:
h]p://source.android.com/source/inializing.html
• Download
:
h]p://source.android.com/source/downloading.html
Building
system
:
4GB
RAM
minimum
(16GB
be]er),
25GB
free
storage
minimum
(90GB
to
build
all
‘targets’)
different
from
smartphones
and
tablets
Setup
/
repo
tool
:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
8. AOSP JB - Building
Source
code
download
:
$ mkdir android-4.1.2
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.1.2
$ repo sync
Target
selecon
and
building:
$ source build/envsetup.sh
$ lunch (select
target)
$ make –jX (where
X
is
the
number
of
parallel
compilaon
processes)
-‐>
A
complete
build
can
take
from
20
minutes
to
8
hours
depending
on
the
building
system
configuraon…
(JBQ’s
host
:
Dual
Xeon
E5620
Quad-‐
core,
24GB
RAM
à30
minutes
to
build
ICS
for
the
Galaxy
Nexus).
Last
step
:
ROM
install
on
device,
or
execuon
using
the
emulator
or
a
virtual
machine.
9. AOSP – Sources code
Structure
bionic/
:
«
libc
»
replacement
bootable/
:
reference
bootloader
build/
:
AOSP
build
scripts
cts/
:
«
Compability
Test
Suite
»
dalvik/
:
Dalvik
virtual
machine
development/
:
Development
tools
device/
:
Device
specific
files
docs/
:
source.android.com
source
files
external/
:
External
projects
used
by
AOSP
frameworks/
:
System
services,
android.*
JAVA
classes,
…
hardware/
:
Hardware
support
libraries
libcore/
:
«
Apache
Harmony
»
project
ndk/
:
Nave
Development
Kit
packages/
:
Basic
Android
applicaons
and
services
prebuilt/
prebuits/:
Precompiled
binaries
sdk/
:
Sorware
Development
Kit
system/
:
System
components
10. AOSP – CDD & CTS
CDD
=
Compa-bility
Defini-on
Document
• Android
devices
specificaons
(one
CDD
for
each
Android
version),
• A
required
condion
(but
not
enough…)
to
get
access
to
the
Google
Market/
Play
is
that
the
device
respect
the
Android
version
CDD.
• Pre-‐requisites
can
drama-cally
change
from
one
version
to
an
other
CTS
=
Compa-bility
Test
Suite
• Tesng
tools
used
to
(partly)
check
the
conformity
of
a
device
(and
its
Android
ROM)
towards
the
target
CDD.
h]p://source.android.com/compability/cts-‐intro.html
11. AOSP – Contribution
Everybody
can
contribute
code
to
Android,
but…
• Every
contribuon
is
subject
to
Google’s
valida-on
ü Code
quality
:
Android
«
code
style
guidelines
»
ü Funconal
code
ü Strategic/Polic
?
• Same
funcon/piece
of
code
may
be
developed
at
same
me
by
Google…
• Tool
based
on
Gerrit
• Service
unavailable
during
>6
months
in
2011…
h]p://source.android.com/source/submit-‐patches.html
h]ps://android-‐review.googlesource.com
12. AndroVM - Introduction
Buildroid
Objec-ves
:
§ Provide
funconal
and
robust
Android
Virtual
images
§ Environment
:
unl
now
mainly
focused
on
VirtualBox,
but
images
are
running
well
on
VMWare
(minus
some
funcons)
13. AndroVM - AOSP Porting
to VirtualBox
?
Genesis
Beginning
with
ICS,
AOSP
includes
a
«
VirtualBox
target
»
but
many
funcons
were
missing.
-‐>
That’s
how
come
the
idea
to
work
on
VirtualBox
support
in
AOSP…
Func-ons
developed
§ Mouse
§ WiFi
emula-on
§ Ethernet
§ OpenGL
ES
2.0
Hardware
§ AndroVM
configura-on
tool
§ RTC
(Real-‐Time
Clock)
§ Power
Management
§ Audio
§ File
sharing
with
the
host
§ USB
14. AndroVM – ARM support
Now,
AndroVM
and
android-‐x86
images
can
run
na-ve
ARM
code
à Got
a
phone,
Reverse-‐engineered
the
“houdini”
libraries
implemenng
“ARM
translaon”,
Integrated
them
in
AndroVM
and
it
worked
h]p://androvm.org/blog/ex-‐buildroid/2012/06/11/running-‐arm-‐apps/
h]p://androvm.org/blog/ex-‐buildroid/2012/06/18/using-‐arm-‐emulaon-‐on-‐other-‐
android-‐x86-‐distribuons/
15. AndroVM – Why ?
>
200
000
VM
downloads
in
6
months
Useful
for
?
Developers
replacing
the
SDK
emulator
People
wanng
to
run
Android
applicaons
on
their
x86
systems
People
wanng
to
make
a
Demo
OEM/Manufacturers
wanng
to
provide
development/demo
pla6orm
Why
?
§ Performance
§ OpenGL
issues
§ User-‐friendly
17. AndroVM – More to come
We’re
currently
working
on
:
§ An
AndroVM
management
tool
:
create/modify
VM,
start/stop
them,
automacally
connect
adb,
...
§ Sensors
emula-on
:
either
manual
or
using
input
data
from
USB-‐connected
Android
device
What
could
be
next
:
§ Mul-‐touch
emulaon
§ Bluetooth
emulaon
§ NFC
emulaon
18. AndroVM – Need your Help !
From
“pure
technical
interest”
-‐>
Android
to
usage…
developers,
§ Do
you
feel
the
need
of
an
alternave
to
the
Android
SDK
emulator
?
please
help
§ Are
you
able
to
use
HAXM
and
Hardware
OpenGL
or
is
it
impossible
to
use
in
your
us
make
your
environment
?
life
easier
J
§ What
funcons
would
you
need
the
most
?
Bluetooth
?
NFC
?
WiFi-‐Direct
?...
§ Are
you
able
to
test
your
apps
with
variable
network
quality/reliability
?
Do
you
feel
the
need
for
it
?
à
dan@androvm.org
19. AOSP – Links
AOSP
building
instruc-ons:
h]p://source.android.com
Android
Google
groups:
h]p://groups.google.com/group/android-‐building
h]p://groups.google.com/group/android-‐porng
h]p://groups.google.com/group/android-‐pla6orm
h]p://groups.google.com/group/android-‐kernel
xda-‐developers
forum
:
h]p://forum.xda-‐developers.com/forumdisplay.php?f=564
Cyanogenmod
forum
:
h]p://forum.cyanogenmod.com
android-‐x86
project
:
h]p://www.android-‐x86.org
AndroVM
project
:
h]p://www.androvm.org/