pjproject su android: uno scontro su più livelli
DESCRIPTION
Bachelor's degree thesisTRANSCRIPT
![Page 1: Pjproject su Android: uno scontro su più livelli](https://reader033.vdocument.in/reader033/viewer/2022051514/54b777894a7959db2c8b4901/html5/thumbnails/1.jpg)
Pjproject su AndroidUno scontro su più livelli
Giacomo Bergami
Alma Mater Studiorum - Università di Bologna
November 13th, 2012
Giacomo Bergami (Univ. Bologna) Pjproject su Android November 13th , 2012 1 / 9
![Page 2: Pjproject su Android: uno scontro su più livelli](https://reader033.vdocument.in/reader033/viewer/2022051514/54b777894a7959db2c8b4901/html5/thumbnails/2.jpg)
Table of Contents
1 Main Goals and SubproblemsMain GoalsSubproblems
2 Android ArchitectureOverviewService InteractionAudio Management
3 Outcomes
Giacomo Bergami (Univ. Bologna) Pjproject su Android November 13th , 2012 2 / 9
![Page 3: Pjproject su Android: uno scontro su più livelli](https://reader033.vdocument.in/reader033/viewer/2022051514/54b777894a7959db2c8b4901/html5/thumbnails/3.jpg)
Main Goals
Can a pjsip-based VoIP application (pjsua) run on Android?The question “seems legitimate”, as pjsua is a non-standardJava-Android application. It’s a C-native app.
¦ Can I crosscompile a GNU/Linux application to Android?¦ Does a native application directly interact with the Kernel?¦ How does Android know that I want to gain access to the microphone?¦ How can I dodge Android’s controls?
Giacomo Bergami (Univ. Bologna) Pjproject su Android November 13th , 2012 3 / 9
![Page 4: Pjproject su Android: uno scontro su più livelli](https://reader033.vdocument.in/reader033/viewer/2022051514/54b777894a7959db2c8b4901/html5/thumbnails/4.jpg)
Subproblems
¦ Android SDK EmulatorCommunication betweenemulators.Audio hardware emulation isnot provided.
¦ Olivetti Olitab (Medion Life Tab)No factory imageNo sourcecode supportNon standard “rooting”procedure (nvflash)⇒ Samsung Galaxy Nexus.
Giacomo Bergami (Univ. Bologna) Pjproject su Android November 13th , 2012 4 / 9
![Page 5: Pjproject su Android: uno scontro su più livelli](https://reader033.vdocument.in/reader033/viewer/2022051514/54b777894a7959db2c8b4901/html5/thumbnails/5.jpg)
Android Architecture
Some terminology
¦ Rooting
¦ Upsyscall
¦ Java/Java with JNI/Native Application.
¦ Kernel Android/AOSP source/Android Middleware
Giacomo Bergami (Univ. Bologna) Pjproject su Android November 13th , 2012 5 / 9
![Page 6: Pjproject su Android: uno scontro su più livelli](https://reader033.vdocument.in/reader033/viewer/2022051514/54b777894a7959db2c8b4901/html5/thumbnails/6.jpg)
Overview
Hardware
/dev/binder
Android Kernel
PermissionController
DVM
JNI+libsmedia_server+ services
Pjproject (pjsip)
Native Apps (pjsua)
Android AudioLibraries
PermissionChecker
Data obtainer
HW audio libs
1
2
3
4
5
An
dro
idA
rch
itec
ture
Ove
rvie
w(K
ern
el+
AO
SP)
GN
U/L
inu
x
Win
dow
s
Modifications1 Redefinition of entry-point_start inside Android NDK.
2 Resizing “Conference” Buffer forprevious overflow.
3 Removal of the access limit toaudio sampling to a client only.
Code Analysis4 Analysis on the IPC Buffer for
sampled audio.
5 Client/Service Interaction.
Giacomo Bergami (Univ. Bologna) Pjproject su Android November 13th , 2012 6 / 9
![Page 7: Pjproject su Android: uno scontro su più livelli](https://reader033.vdocument.in/reader033/viewer/2022051514/54b777894a7959db2c8b4901/html5/thumbnails/7.jpg)
Service Interaction
libhardware_legacy
AudioPolicyService
AudioFlinger
media_server app_process
ZygoteInit SystemServer PermissionController
SystemServer BinderJNI
AndroidRuntime (DVM)
Kernellibbinder
/dev/binder
Native Apps
Java App+Framework
JNI/Native
::istantiate()
::onTransact()
publish()
start/join-ThreadPool()
runtime->start()startVm()startReg()
Call JavaZygoteInit.main()
fork()SystemServer.main()
init1()
start/join-ThreadPool()
ServerThread.run()
::transact()
executeTransact()
Giacomo Bergami (Univ. Bologna) Pjproject su Android November 13th , 2012 7 / 9
![Page 8: Pjproject su Android: uno scontro su più livelli](https://reader033.vdocument.in/reader033/viewer/2022051514/54b777894a7959db2c8b4901/html5/thumbnails/8.jpg)
Service Interaction
libhardware_legacy
AudioPolicyService
AudioFlinger
media_server app_process
ZygoteInit SystemServer PermissionController
SystemServer BinderJNI
AndroidRuntime (DVM)
Kernellibbinder
/dev/binder
Native Apps
Java App+Framework
JNI/Native
::istantiate()
::onTransact()
publish()
start/join-ThreadPool()
runtime->start()startVm()startReg()
Call JavaZygoteInit.main()
fork()SystemServer.main()
init1()
start/join-ThreadPool()
ServerThread.run()
::transact()
executeTransact()
Giacomo Bergami (Univ. Bologna) Pjproject su Android November 13th , 2012 7 / 9
![Page 9: Pjproject su Android: uno scontro su più livelli](https://reader033.vdocument.in/reader033/viewer/2022051514/54b777894a7959db2c8b4901/html5/thumbnails/9.jpg)
Audio Management
AudioPolicyService AudioFlinger AudioRecord
Wilhelm
libhardware_legacy
AudioPolicyManagerBase
ClientThread RecordHandle
RecordThread libnbaio
libbinder & /dev/binder
Realize
set()
getInput()
getInput() openInput()
openRecord()
checkPermission()
Start
run()
getActiveInput()
recordingAllowed()
Giacomo Bergami (Univ. Bologna) Pjproject su Android November 13th , 2012 8 / 9
![Page 10: Pjproject su Android: uno scontro su più livelli](https://reader033.vdocument.in/reader033/viewer/2022051514/54b777894a7959db2c8b4901/html5/thumbnails/10.jpg)
Audio Management
AudioPolicyService AudioFlinger AudioRecord
Wilhelm
libhardware_legacy
AudioPolicyManagerBase
ClientThread RecordHandle
RecordThread libnbaio
libbinder & /dev/binder
Realize
set()
getInput()
getInput() openInput()
openRecord()
checkPermission()
Start
run()
getActiveInput()
recordingAllowed()
Giacomo Bergami (Univ. Bologna) Pjproject su Android November 13th , 2012 8 / 9
![Page 11: Pjproject su Android: uno scontro su più livelli](https://reader033.vdocument.in/reader033/viewer/2022051514/54b777894a7959db2c8b4901/html5/thumbnails/11.jpg)
Outcomes
As a final result, porting has been successful:
¦ Multi Android-host testing (Galaxy Nexus + Olivetti Olipad + WLAN)
¦ VoIP calls through SIP and Pjproject/pjsip
Outcomes:
Modify wilhelm and extend AOSP with a service as a mediator.
Avoiding rooting and upsyscalls with libraries modification.
Relation between Java Applications services’ and IPCThreadState.
Giacomo Bergami (Univ. Bologna) Pjproject su Android November 13th , 2012 9 / 9