Presentation given at the Big Android BBQ 2012 by Jerdog of XDA-Developers. This session was a panel discussion with some of the most well-known developers in the Android world. We discussed their current projects, what excites them about Android development, what they see as the future of Android development, and maybe even some answers to questions like, "To Kang of Not to Kang?" The panel featured XDA Recognized Developers Agrabren, Supercurio, Entropy512, Decad3nce, and Chainfire.
7. Agrabren
Software Developer for NVIDIA Corporation
Developed ROMs and Kernels for the HTC EVO
4G and EVO 3D
Twitter: @agrabren
8. Decad3nce
Born in Bosnia
22-yr old student at the University of Nebraska-
Lincoln studying Computer Science &
Engineering
Open-source fanatic and Device Maintainer for
CyanogenMod
Twitter: @Decad3nce
12. Project Voodoo
Audio and Display low level mods
from Linux Kernel patches to Android apps
13. Starting from scratch: How XDA
community promotes development
Galaxy S lag: pauses during OS execution
XDA Bounty thread raises donations to
encourage development of a lagfix.
Galaxy S sound quality tuning: enthusiasts test,
donate and later buy the control app.
Galaxy S and Nexus S Super AMOLED tuning:
new kind of hack becoming quickly popular.
14. WTF is this thick French accent
I'll progress on that, it's in my TODO list.
My real name is François Simond, 30 year old.
coming from France to attend this BBQ and
meet you here.
15. R&D methodology: tests,
measurements and feedback driven
Forums members are supportive but often
emotional.
Strict testing and measurement methodology
allow to publish safe improvements instead of
half improvement half regression.
Placebo is the enemy of innovation.
16. Voodoo Lagfix
Galaxy S original filesystem introduces latency and
slow down during file writes.
Development of a reliable RFS to Ext4 and Ext4 to
RFS converter allowed Galaxy owners to enjoy
their phone.
Ext4 settings chosen for safety and speed now
re-used by most manufacturers
17. Voodoo Sound first steps
Tuning Wolfsonmicro codecs by hacking kernel
driver source, rewriting selectively some i2c
command sent to the hardware
Requirement: flashing a kernel implementing
kernel patches.
sysfs "text" interface.
Android control application
18. Voodoo Sound and LOUDER
long term strategy
Hardware-agnostic generic i2c commands
interceptor design.
Implementation:
• Minimalistic programmable Linux Kernel Module
using rootkit-like methods to rewrite hardware
commands
• Complexity deported to an Android Java/C
driver, mixer and UI communicating via ioctl with
the kernel driver
19. Voodoo color basic Simple patch:
Super AMOLED driver tuning
Samsung Super AMOLED gamma points tuning,
via the v1 gamma hack method.
Affecting the image but inherently inaccurate.
Considered as a panel rendering customization
but not yet calibration.
Now re-used in every Super AMOLED hacks
20. Voodoo Display Expert, long term
1,5 year of development and preview soon to be
released.
Goals:
• Fixing panel mis-configuration leading to
sharpening artifacts, banding and shadows
crushing/clipping
• Panel calibration for accuracy and custom color
tones.
21. Misc tools and one-shot apps,
connections with the press
A few tools, most of them Open Source under
WTFPL:
• OTA RootKeeper (now merged)
• Screen Test Patterns for display measurements
• Audio Measurements Player for audio
measurements
• Voodoo Report for bug reporting and virtual
teardowns
• CIQ detector, FreeOrNot
22. Thanks to supporters
What encouraged me to develop and share was
solely the incredible initial support from XDA
community.
What allowed me to continue development is
solely financial support from XDA enthusiasts,
later extended to Google Play through app
sales.
23. Thanks to manufacturers
Wolfsonmicro
• providing access to datasheet under NDA
• listening and integrating feedback in their new
drivers and chips.
• sharing knowledge and audio culture
Samsung Mobile Korea and USA
• helping by sending development hardware
• supporting and encouraging (albeit discreetly)
24. Q&A and meet me after the session
Pleased to meet you in person!
You can reach me on twitter as well:
http://twitter.com/supercurio
Project website: http://project-voodoo.org/
28. Why the EVO 3D?
I love 3D... That’s why I work for NVIDIA
Reasonable size, great processor
Obvious successor to the HTC EVO 4G
29. Disarmed Toaster
Bring the AOSP experience to the EVO 3D
Improved Battery Life
Better Responsiveness
Latest Versions of Android
Support for 3D Camera and Panel
30. The Future of Android...
Disarmed Toaster isn’t a ROM, it’s an idea...
(and my wife’s XBox 360 handle)
What if we could make a baseline ROM, and
“apply” the flavor we want?
CyanogenMod 10
ParanoidAndroid
Android Open Kang Project (AOKP)
Three ROMs in one package...
31. Variation is the spice of
life...
Reduce the pain of flashing:
Flashing between flavors does not require a
factory reset
Baseline framework ensures feature parity
Consistent experience for the end user
32. Working with
Developers
Different types of Developers
Kernel Developers
Kernel Hackers
ROM Developers
ROM Hackers
A Trademarked brand of Building Block
Builders
Themers
33. Working with
Developers (cont.)
Courtesy
Don’t call people stupid for asking questions
or pointing out “the obvious”
Point out what may be “obvious”, as a ROM is
large and sometimes it’s easy to overlook
things
34. Examples from
Disarmed Toaster
“Camera is rotated 90 degrees on first use, but
fixes after taking the first picture. But you
probably already knew that, sorry.”
User 1: “Video playback with [particular app]
causes the device to reboot with [this video]. I
can upload if it would help?”
OP: “Yes, please!”
User 2: “I’ve run the video he was having
trouble with, and here’s the logcat.”
35.
36. CyanogenMod on Samsung
Epic the perspective of a
Understanding CyanogenMod from
device maintainer.
A presentation by Decad3nce
Decad3nc
37. To cover:
•
• epicmtd: Fixing all the variances, nuances, and
figuring out workarounds for a specific device.
• you: How to get involved, where to find resources,
and who to ask.
• TODO: What I see as the future of
Android/CyanogenMod.
aries-common: Sharing the build
environment with similar devices and
working with maintainers outside of your
devices scope.
38. aries-common:
•
o The common device sources shared between all
the Galaxy S siblings.
o Put forth by members of TeamHacksung and
EpicCM
o Contains:
Multiple shared libraries(from camera to audio)
releasetools
Common board declarations and overlays
aries-common:
39. aries-common:
•
o commonalities:
The need for bdaddr reading
The need for bml over mtd
The need for custom releasetools
aries-common:
40. aries-common:
•
o bdaddr:
Samsung lack of following conventions leads to
some very elegant solutions
bdaddr_read in aries-common reads the custom
SAMSUNG_BDADDR_PATH
Runs on board init
aries-common:
43. aries-common:
•
o bml_over_mtd:
Collection of scripts, binaries, and update tools to
convert bml partition scheme into mtd.
Useful to mimic Nexus S like environment.
Breakdown:
• Checks for conversion
• Initiliaizes bml_over_mtd binary
• Converts to new partition layout
aries-common:
46. aries-common:
•
o releastools:
Custom releasetools allow a device vendor to
override compile time arguments for packaging.
Used along with shbootimg.mk script to create a
working boot.img(android standard)
The python scripts also set the edify scripting in
the update package.
aries-common:
48. aries-common:
•
o teamhacksung members:
atinm
Kolja Dummann
Chrayu Desai
Rafael Salas
Pawit Pornkitprasan
Andrew Dodd
Andrew Mahone
Daniel Hillenbrand
Daniel Bateman
jt1134
aries-common:
49. aries-common:
•
o Different teams of developers working on similar
devices.
o teamhacksung, freeXperia, EpicCM, etc.
o All are a component of the contributors that are
within CyanogenMod.
aries-common:
50. epicmtd:
•
o The device repo for the Samsung Epic (Sprint)
o MTD suffix is because of the partitioning changes.
o Maintained by EpicCM
Members include:
• Will Keaney
• Mike Kasick
• Shareef Ali
• Brian Beloshapka
• Wispoffates
• Donovan Bartish
• nubecoder
• nullghost
epicmtd:
51. epicmtd:
•
o The epicmtd vendor is a derivative of the aries-
common vendor.
o Much like the aries-common vendor, it contains the
necessities of:
bdaddr_read
custom releasetools
bml_over_mtd
epicmtd:
52. epicmtd:
•
o However, epicmtds implementations of these are
varied compared to aries due to hardware
differences.
o Differences:
Wimax/CDMA device
Keyboard(gpio shuffle)
Larger oneNAND
Unable to read BT MAC from /efs
Kernel driver variances
• Touchscreen driver embedded the touchkey
lights
epicmtd:
53. epicmtd:
•
o Samsung had made things difficult for us.
epicmtd:
54. epicmtd:
•
o The CDMA/Wimax/Sprint Quirks:
Utilizing the CDMA stack embedded in
SamsungRIL in Cyanogenmod.
Pppd had to be manually started to get data
connection, and modified for 100ms intervals for
the epic radio.
The Samsung CDMA "ring of death" bug.
• The phone emitted an "old fashioned ring"
whenever there was an incoming call or
someone was put on call waiting.
Emergency 911.
• In original testing, e911 was not functional.
epicmtd:
57. epicmtd:
•
o The larger OneNAND
Epic would end up utilizing Samsung OneNAND
driver for the AUDI controller.
Varies with aries siblings.
Allowed for larger /data partitions, more space
for users.
Did not need a dedicated /efs partition.
epicmtd:
59. epicmtd:
•
o Need for a custom bdaddr_read
The samsung epic didn't store bt mac address in
/efs
Could only be read from a RIL property when
stack was initialized
Fixed without having to modify BT stack in
CyanogenMod.
Read from RIL, store, check on every init.
epicmtd:
62. How to get Involved:
•
o Learn git, learn gerrit, use the cm wiki resources:
http://wiki.cyanogenmod.com/wiki/Howto:_Gerrit
http://wiki.cyanogenmod.com/wiki/Howto:_Git
o If not so advanced, take a heads up from
Cyanogen:
"Stop. Write an app or two first, learn how the system
works from a developer standpoint. Learn some Java.
Read the developer documentation. Learn how to use Git.
Then learn how to build AOSP from source. Read the
porting guides, and learn how the build system works…..
Now try to put your new found skills to work on enhancing
the platform by writing code or making theme overlays.
And share! And put that s**t on your resume. There is a
*ton* of information out there but any kind of “step-by-
step rom cooking guide” is going to be a complete fail- it’s
too broad of a subject."
63. How to get Involved:
•
o Feel free to contact any device maintainer or
general developer in CyanogenMod.
Contact via Google+, Contact via Twitter
http://wiki.cyanogenmod.com/wiki/Community_Member
s
o If you're a developer looking to contribute in a
meaningful right away, utilize
devrel@cyanogenmod.com
you:
64. How to get Involved:
•
o THANK YOUR MENTORS AND PEERS.
Thanks to Richard Ross(toastcfh)
Thanks to Warren Togami(warren)
Thanks to Will Keaney(Uberpinguin)
Thanks to Brian Beloshapka(bbelos)
Thanks to Shareef Ali(noobnl)
Thanks to Donovan Bartish(DRockstar)
Thanks to Justin Wood(nullghost)
Thanks to Troy Smith(wispoffates)
Thanks to Timothy Lusk
Thanks to Scott Warner(tortel)
Thanks to nubecoder, chris41gl, Rodderik, jt1134,
nemith, AproSamurai and on and on...
you:
70. FAAPT
•
“Fast” Android Asset Packaging Tool
•
Significantly accelerates XML compilation
•
“Build Automatically” no longer taboo
71. Patch status
•
AOKP: Merged
• CM: Merged
•
AOSP: Under review
Binaries for Linux, OS X and Windows
available on XDA - Sources available on
Gerrit
72. SuperSU
Most su problems are caused by:
• Calling su in the wrong way
•
Calling su at the wrong time
Article and sample code
(libsuperuser)
will be available online soon.
73. Common pitfalls calling
su
•
Runtime.exec() or ProcessBuilder with
parameters
• Writing a script with commands
•
Rapid successive su calls
•
Many su calls throughout the app’s lifecycle
• Hardcoded checks
•
Assuming the su binary takes parameters
74. Best way to call su
•
Create an interactive su shell
•
Write commands to su’s STDIN
• Read output from su’s STDOUT
76. Checking for su
availability
•
Do not check for Java packages
•
Locate su in PATH, or
•
Try running su and check id output
(preferred)
boolean Shell.SU.available()
77. Blocking I/O
•
su is a blocking I/O call - it might return in
milliseconds, or next week
•
Do not make blocking I/O calls from the main
thread (see strictmode)
•
Calling su on the main thread is the primary
source of crashes and freezes when apps try to
run commands as root
• libsuperuser will throw an exception when called
from the main thread in debug mode
78. Main thread ?
• All Activity-based code is run on the main thread
•
All manifest-declared BroadcastReceivers run on
the main thread. May cause deadlock even if not
running on the main thread
•
Most Service-based code is run on the main
thread. Notable exception: IntentService
81. public class MainActivity extends Activity {
private class Startup extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
// this method is executed in a background thread
// no problem calling su here
return null;
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// start background task
(new Startup()).execute();
}
}
83. public class BackgroundIntentService extends IntentService {
public static void launchService(Context context) {
if (context == null) return;
context.startService(
new Intent(context, BackgroundIntentService.class)
);
}
public BackgroundIntentService() {
super("BackgroundIntentService");
}
@Override
protected void onHandleIntent(Intent intent) {
// the code you put here will be executed in a background thread
}
}
public class BootCompleteReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
BackgroundIntentService.launchService(context);
}
}
84. CF-Auto-Root
• Automated root creator, for funsies
•
Takes a stock recovery image and produces an
automated recovery+cache image, which:
•
Installs SuperSU
•
Wipes cache
• Reinstalls stock recovery
85. Compatibility
•
Still in testing, about 30 roots already available
• Starting with Samsung devices:
•
Exynos
•
Snapdragon
•
OMAP
•
Tegra (under development)
•
Others may follow
86. Future
•
http://autoroot.chainfire.eu/
Live, but still in testing, no public
upload yet
•
How long will this work ?
•
What about the improved security
features in Android 4.1.2 and 4.2 ?
Last minute replacement No PowerPoint special effects
- No “ fapped ”
-For app-devs not familiar with FAAPT Patch not very interesting -Attributes looked up ( android:layout_width ) -Simple lookup table
Debugged / went through sources / reverse engineered many apps -Helped quite a few people fixing their app -Article code often requested. ChainsDD signed off on it too!
exec() , ProcessBuilder: su –c “command” one parameter. Quotes problem -writing script: AND executing it – space in paths! -rapid: expensive! Batch, as many commands in as little processes -many/lifecycle: expensive! Create su shell and keep it open, read/writing to stdin/stdout -hardcoded checks: su location, java package name -su parameters: it will start a shell if parameter not supported ! (see: VERSION checks)
- Works around all common pitfalls
- id is not always available, libsuperuser has workaround for that --- will not verify uid=0, but “ su ” will exist
- strictmode: network I/O on main thread crash, flash red on disk I/O
- ProgressDialog
Example only does one specific action -Add service to manifest