Stuff I Learned at Droidcon NYC

Nick Santos
8 min readAug 31, 2015

--

A couple months ago I started working on the Medium Android app. I never worked with Android apps before. I signed up for the Android conference Droidcon NYC to learn more.

Medium has a pretty generous policy for skipping work to go to conferences. But you have to do a conference report.

Droidcon NYC was at 18th St and 6th Ave, about a mile walk from the Medium NY office. Next door, there was another conference at the same time, the Indie Beauty Expo.

I had no idea there were startups to disrupt beauty. I am glad this exists.

Here are some of the the talks I went to:

Tyrone Nicholas on Fresco, Facebook’s image loading library

I was relieved to hear that even Facebook has problems loading images. We’ve been struggling with it on our team and I was feeling stupid. Tyrone’s talk was as much about images as a technical primer on Android memory management dark corners (JDK heap vs NDK heap vs ashmem). They use clever tricks to pin shared memory and process images off the UI thread. They even got progressive jpegs working!

Kevin Grant and Zack Sultan on animation best practices

Because these guys were from Tumblr, I thought this was going to be all GIFs, like this poodle GIF in their intro.

Then it wasn’t! They gave this humanities professorial lecture on principles of animation. Windsor McKay and Walt Disney had to develop a vocabulary for motion in the early 20th century, they pointed out. App developers today need to do the same. An animation can communicate information about context and direction that would otherwise be hard to communicate on a small screen. I’m going to skip over all the principles they outlined here. They had a great shout out to The Illusion of Life on Disney’s animation theories which is now in my Goodreads queue.

Jake Wharton on Retrofit 2, Square’s HTTP client library

Medium Android team are big fans of Retrofit. Jake previewed some of the features in Retrofit 2, like pluggable converters and adapters (so you can choose Observables or ListenableFutures or any async idiom you want). Literally everything in this talk was something we wanted. This was deeply satisfying.

Udi Cohen on Performance Tools

I hate reading performance blogs. They’re often some idiom trivia champ lecturing “use (x > y ? y : x) instead of Math.min(x, y) because I profiled it in my isolated microbenchmark and it’s 2x faster.” Your intern reads this and writes a script to auto-replace all the Math.min in your repo then is surprised that the app isn’t drastically faster?

But this talk was great!

Udi emphasized the importance of measuring and debugging perf problems. He led a tour through the most useful tooling: systrace, traceview, allocation tracker, heap dumps, and Eclipse MAT (to query heapdumps). He stepped through some examples to demonstrate how to use these tools. For example, an animation was janky, so he used the hierarchy viewer to look at time spent in the measure, layout, and draw phases, and visualized overdraw layers where the GPU was doing redundant work.

Industry Press Panel

Pro tip: if you hate someone and want to see them squirm, sign them up for a panel discussion.

There was a panel discussion for Android industry journalists. Even in the best of circumstances, panels are hard to do. In this one, the stage was set up for a traditional lecture-and-powerpoint-slides. The moderator stood at the podium, her back to the panelists on couches behind her, twisting to and fro to talk to them. Aggggh.

Haley Rose Smith on accessibility

I didn’t even know that mobile accessibility was a thing — can blind people use touch screens? This talk set me straight. Random stuff I learned:

  • You can expand the touch target to bigger than the visual button size! For example, this “X” button in Slack looks tiny but now has a big touch target.
Our #techops slack channel

I used to fumble with this button all the time.

  • Color blindness is surprisingly common among white men (1 in 12?), way higher than among women. An industry that loves white men so much ought to do a better job with color contrasts. (Clarification: This is Haley’s joke but I laughed.)
  • Strong contrasts make your app easy to use in the screen glare of sunlight. Go design your apps in a park instead of a dim office!
  • Android accessibility settings and developer options have lots of buttons for learning more. When I got home, I spent 20 minutes playing with TalkBack. I’m pretty sure it’s some sort of awesome puzzle/maze game.

Danielle Emma Vass on publishing libraries

Danielle gave a newbie’s guide to publishing an android library, introducing some common services like Maven Central and JCenter and Bintray. And she wrote this up as two Medium posts that she linked in her talk so I don’t need to summarize it! (“How To Start Making Your Own Android Library” and “How to Publish Your Android Studio Library to JCenter.”) Thanks!

Roman Nurik, Nick Butcher, and Chris Banes on new UI APIs

The Google Developer guys introduced some of the new features, tools, and libraries to look forward to in the SDK. I was most excited about:

  • A floating selection toolbar for editing!
  • Layout XML that accepts arguments!
  • Data binding!
  • Chrome custom tabs! (A nice compromise between webview and open-in-chrome)
  • Auto generation of svgs -> images for devices that don’t support drawables!!

Much of this has compat library support, so will fallback gracefully on older devices.

Lisa Wray on Typography

Lisa did a deep dive into how Android renders text. She showed how to hook into each level of the text rendering stack, from the most basic paragraph styles to custom fonts to direct control over the drawing surface with TextPaint and Canvas.

Her best example was close to my heart: highlights. @lightningboltz and I spent hours discussing how highlight colors fit the line height on Medium.

The image on the left shows the “bad” highlight background running together on Android. The image on the right shows the “good” highlight background leaving some space between lines on mobile web. Screenshots from The Evolution of Magazine Covers.

Lisa showed how Genius figured out how to get the spacing right on Android. They use the FontMetrics API to figure out the vertical text bounds of each line, and draw the background manually to exactly the height they wanted. Genius!

Jake Ouellette on Gradle

The main takeaway of this talk is that you can become an expert on Gradle. But reading other people’s Gradle code is a terrible way to learn it.

You can learn imperative languages this way (like Java). But if you try to do this with Gradle, you’ll be hopelessly confused. It’s a rich and dynamic language, but syntactically mimics a declarative static language like Maven or Ant XML.

Jake showed many examples of bugs caused by basic misunderstandings of the scoping rules, or how declarative code can have subtle timing issues or side-effects.

He recommended The Gradle User Guide for being well-written and comprehensive.

He also recommended an amazing looking engineering game called Poly Bridge, but I didn’t follow his explanation of how this tied into Gradle.

Michael Bailey on Threads

A good foundational talk on how threads work on Android. Michael reminded me that I need to read Java Concurrency in Practice by Brian Goetz, which people have been recommending me for years.

The huge news for me in this talk is that there’s a StrictMode ThreadPolicy API that helps you protect yourself from stupidly blocking the UI thread on network and disk access!!! I can’t type enough exclamation points to express my excitement.

Diversity Panel

I give this panel so much credit for trying to radically shake up the panel format. The ground rules:

  1. They would only discuss how to fix diversity, not whether it was a problem.
  2. The panelists each shared what approaches they were trying.
  3. The panelists then became a support group: audience members would share their diversity problems, and ask the panel for help solving them.

There were a lot of great ideas. Tech talk workshops to encourage more diverse speakers at conferences. Mentoring and outreach. More media coverage, like dedicated journals and more stock photos of underrepresented engineers.

One woman asked what she should have done about a misogynistic boss. The panelists told her to talk to HR. Then Corey Latislaw grabbed the mic to point out that all the men onstage were telling her to talk to HR, and the women onstage were being quiet about it. Everyone squirmed but in a good way.

One of the panelists wore a “#000000 { lives: matter; }” t-shirt that amused me.

Audrey Troutt on Metaprogramming

Audrey presented an overview of the different metaprogramming options: both compile-time (annotation processors, bytecode editors) and runtime (reflection). She introduced the major bytecode tools (ASM, DexMaker, Javaassist, AspectJ). Her main point was that java sucks, and can’t do all the cool swizzling and category-ing that ObjC can do. 😛

Throughout this conference, I’ve been taking handwritten notes on my little black notebook. I felt so proud of myself.

My notebook

During Audrey’s talk, I looked over at the notebooks of other engineers in my row, and OMG…

…I felt so ashamed.

Godfrey Nolan on security and his book Bulletproof Android

Godfrey’s basic thesis is that you should never trust the client. Don’t store passwords. Don’t store secret API keys. They can be pulled off the phone. He showed how easy it is to decompile dex and class files to Java source with the original variable names. Many apps have a “Security.java” or “Crypt.java” with all the secrets!

That basic thesis is important. Then he fell into this pattern that was like nails on a chalkboard to me: (1) X is broken, so (2) implement your own X. For example,

  1. Root CA certs have been compromised, thus SSL is broken, so
  2. Add an extra asymmetric encryption protocol

That feels suspect? OK — security is broken. Will it make security better if every J Rando engineer is adding her own extra encryption, many of whom will screw up?

I don’t know. I assume that all security advice is bad advice unless we have some evidence otherwise. I wish Godfrey had spent more time justifying his advice, or would resignedly admit “This is broken and we don’t have a great fix.”

Thanks to all the speakers!

I wrote much of this post on Android. Obviously? Dogfooding the Android post editor helped me to find a lot of bugs that I’ll be fixing this week.👌

Update (2015/9/7): Videos of some of the talks have been posted here.

--

--

Nick Santos

Software Engineer. Trying new things @tilt_dev. Formerly @Medium, @Google. Yay Brooklyn.