Profile

Cover photo
Michael Evans
Works at LivingSocial
Attended University of Maryland, College Park
Lives in Washington, DC
1,179 followers|1,099,269 views
AboutPostsPhotosYouTubeReviews

Stream

Michael Evans

Shared publicly  - 
 
 
Indulge your need for speed—safely. This #MapsHack turns your neighborhood into a racetrack. goo.gl/tDquA8
83 comments on original post
6
1
Steve Rodrigue (LEKO)'s profile photo
Add a comment...

Michael Evans

Development Patterns  - 
 
So yesterday I learned about a new support annotation (@Keep), and was going to write about it - but I realized after talking to a few people, not everyone knew about the support annotations at all! So read about @Keep and some others here:

http://www.michaelevans.org/blog/2015/07/14/improving-your-code-with-android-support-annotations/

  #androiddev  
21
4
Gabor Orosz's profile photoAnkur Nigam's profile photoAnnyce Davis's profile photoPablo Antonio Fuente's profile photo
2 comments
 
+Christophe Beyls​ couldn't write about them all! So I picked some commonly used ones and the new one that inspired the article. 
Add a comment...

Michael Evans

Shared publicly  - 
 
 
One of the big complaints about Chrome currently is that it's a battery hog, especially on Mac where Safari seems to do better.

The team has been working on addressing this; here are some cases that have recently been improved on trunk:

http://crbug.com/460102

Before: Renderers for background tabs had the same priority as for foreground tabs.
Now: Renderers for background tabs get a lower priority, reducing idle wakeups on various perf test, in some cases by significant amounts (e.g. 50% on one test).

http://crbug.com/485371

Before: On a Google search results page, using Safari's user agent to get the same content that Safari would, Chrome incurs ~390 wakes over 30s and 0.3% CPU usage vs. Safari’s 120 wakes over 30s and 0.1% CPU usage.
Now: 66% reduction in both timer firings and CPU use. Chrome is now incurring ~120 wakes over 30s and 0.1% CPU use, on par with Safari.

http://crbug.com/489936

Before: On capitalone.com, Chromium incurs ~1010 wakeups over 30s vs. Safari's ~490 wakes.
Now: ~30% reduction in timer firings. Chrome is now incurring ~721 wakeups over 30s.

http://crbug.com/493350

Before: On amazon.com, Chromium incurs 768 wakups over 30s and consumes ~0.7% CPU vs. Safari's 312 wakes over 30s and ~0.1% CPU.
Now: ~59% reduction in timer firings and ~70% reduction in CPU use. Chrome is now incurring ~316 wakeups over 30s, and 0.2% CPU use, on par with Safari at 312 wakes, and 0.1% CPU use.

The Chrome team has no intention of sitting idly by (pun intended) when our users are suffering.  You should expect us to continually improve in this area.
81 comments on original post
3
Add a comment...

Michael Evans

Development Patterns  - 
11
5
Zhelyazko Atanasov's profile photoEduardo Andrade's profile photo조남두's profile photoBernardo Pina's profile photo
 
That would be great for an in app notification.
Add a comment...

Michael Evans

Shared publicly  - 
 
Looks like the IO schedule is up! 

https://events.google.com/io2015/schedule
Google I/O 2015 brings together developers for an immersive, two-day experience focused on exploring the next generation of technology, mobile and beyond. Join us online or in person May 28-29, 2015. #io15
5
Add a comment...

Michael Evans

General Android Collectible Talk  - 
 
Which are the chase figures from series 5? I can't seem to find a list anywhere.
1
Daniel Herrera Marmolejo's profile photoJoe Ragusa's profile photoMichael Evans's profile photoBrady Kroupa's profile photo
4 comments
 
I usually refer to this site for pics and chase figures...
http://www.allvinyls.com/android5.php
Add a comment...

Michael Evans

Shared publicly  - 
2
1
Josh Wilson's profile photoShauna Mork's profile photoMichael Brown's profile photo
2 comments
 
Well said.
Add a comment...
In his circles
1,120 people
Have him in circles
1,179 people
Ina Yosun Chang's profile photo
Sanket Kudtarkar's profile photo
Rob Davis's profile photo
Beautiful Mexico's profile photo
Mike “mobileradikal” Corbett's profile photo
Benjamin Lee's profile photo
Arash Soheili's profile photo
Jane Dough's profile photo
Niño Piamonte's profile photo

Michael Evans

Shared publicly  - 
 
Matthias Käppler originally shared:
 
My verdict for unit testing on Android: it's 2015, and it's still somewhat broken.

Perhaps not as broken as it used to be, but still broken in some really fundamental ways.

We've been using Robolectric 1 for a very long time in the SoundCloud app and built up a substantial test suite (cloc counts about 73K lines of test code), but building something that mission critical on legacy software is of course a ticking time bomb.

After all the recent fuss about improvements in Android unit testing, I spent quite some time evaluating the different approaches to select the one that would offer us the greatest benefit with the least amount of friction (side note: it's 2015--why does unit testing require time to make it work? It should be as straight forward as drinking a cup of coffee.) I have to say I left disappointed; some things are broken by design, others are just broken. Brief summary:

Variation 1: Running unit tests on a connected device
The obvious benefit here is one of confidence: you are instrumenting your code against an actual system image, with the same VM that will actually run your code in production. It's the real deal. In the past, this approach wasn't exactly a great solution for numerous reasons (poor emulator performance, impossible to use mocking libraries, no JUnit 4 support to name the biggest ones.)
This has gotten better: we have a JUnit 4 runner now [0], we have DexMaker (a bytecode backend for Dalvik) [1], and we have Genymotion, but one of the major problems still exists: the platform JAR is full of final classes and methods, so you either have to write your tests to take that into account, or move your code as far away from the platform as possible; which is likely a good idea anyway [2], but induces the cost of introducing abstractions that might purely exist for testability.

Variation 2a: Running unit tests on the JVM (not using Robolectric)
With the arrival of "experimental unit testing support" (now not experimental anymore), we can now run tests from src/test/java using ordinary test runners. Since it's an ordinary Java unit test, you can use ordinary test setups and libraries, too. Rejoice! However, this approach still has several drawbacks.
Although a Gradle task has been introduced that strips the platform JAR of all finals and method bodies, as soon as your test subject is somehow entangled with the platform, like when using Intents or Bundles, your test will likely fail, since all these classes are stubbed out. Since Intent or Bundle are foundational platform types, they typically don't appear as collaborators in constructors, so you either have to come up with awkward indirections ("intent providers") or, again, move your code as far away from the platform as possible (again, see [2]) You will also likely end up wiring a lot of mocks in your tests, making your tests hard to read and understand (after all, that's one reason why Robolectric was initially created)
A final annoyance: why on Earth am I not able to see both unit tests and acceptance tests at the same time? Due to some idiosyncratic behavior in either AS or Gradle's Android plugin, only one Gradle source set containing tests can be active at once, as chosen by the "test artifact" setting in your build flavors. So unit tests are piggy backed on a system that it wasn't really built for, and it means that any refactorings you apply to one source set will not apply to the other source set, which is just asking for trouble. I hope this is only temporary and will get addressed with future versions of the AS (I assume it's a shortcoming of AS.)

Variation 2b: Running unit tests on the JVM (using Robolectric)
After we tried so hard to move away from Robolectric 1, we closed the circle by opting for... Robolectric 3. At SoundCloud we decided it was the most preferable solution of the three. It comes with all the benefits of running a normal JUnit test, but doesn't penalize you for writing tests for classes that use things like Bundles directly. Unfortunately (--or fortunately?), the higher you go up in the layers, the more difficult it is (still) to unit test something, which is probably a signal that even with a powerful tool like Robolectric, you should test code that is close to the UI sparingly (if at all), and focus on testing presentation /logic/, business rules, and anything beneath. For instance, Robolectric hasn't quite figured out timing yet, so things like animations steered by a presenter might fail. [3] Overall it's a huge step forward from the initial release though, and comes nicely modularized. By combining test rules and base classes for your tests, you can also keep much of the setup boiler plate out of your actual test cases, so that you don't couple yourself too much to any RL specifics.

[0] http://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html
[1] https://github.com/crittercism/dexmaker
[2] https://blog.8thlight.com/uncle-bob/2014/05/11/FrameworkBound.html
[3] https://github.com/robolectric/robolectric/issues/1879
2
Add a comment...

Michael Evans

Shared publicly  - 
 
So yesterday I learned about a new support annotation (@Keep), and was going to write about it - but I realized after talking to a few people, not everyone knew about the support annotations at all! So read about @Keep and some others here:

http://www.michaelevans.org/blog/2015/07/14/improving-your-code-with-android-support-annotations/

#androiddev  
10
Antoine Merle's profile photo
 
@WorkerThread and @UIThread are also very useful! 
Add a comment...

Michael Evans

Shared publicly  - 
24
2
Adam Young's profile photoWeihuan Lee's profile photoDerek Ross's profile photoAlejandro Rodriguez Mann's profile photo
7 comments
 
L,,,,zj o ip


P
E))o0tu
Add a comment...

Michael Evans

Shared publicly  - 
 
 
Did you know Resources.getDrawable(int) is deprecated in API 22?

Since we added support for drawable theming in API 21, the most reliable way to obtain drawables is now Context.getDrawable(int) or ContextCompat.getDrawable(Context, int) if you're using the support library. You can also use Resources.getDrawable(int, Theme) to obtain a drawable for a specific theme or pass null to explicitly obtain an un-themed drawable.

If you do use the deprecated getDrawable() method to obtain a drawable resource with theme attributes, you will get a partially-styled drawable and a logcat warning. So if your drawables show up flat white or flat black where you're expecting some other color, check logcat and check your lint warnings.
10 comments on original post
1
Add a comment...
People
In his circles
1,120 people
Have him in circles
1,179 people
Ina Yosun Chang's profile photo
Sanket Kudtarkar's profile photo
Rob Davis's profile photo
Beautiful Mexico's profile photo
Mike “mobileradikal” Corbett's profile photo
Benjamin Lee's profile photo
Arash Soheili's profile photo
Jane Dough's profile photo
Niño Piamonte's profile photo
Work
Occupation
Software Engineer
Employment
  • LivingSocial
    Software Engineer, 2013 - present
  • The Washington Post
    Software Engineer, 2011 - 2013
  • Financial Industry Regulatory Authority
    2008 - 2011
Places
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
Currently
Washington, DC
Previously
College Park, MD - Rockville, MD
Links
Other profiles
Contributor to
Story
Bragging rights
Winner of the Project Glass hackathon / Can cook minute rice in 58 seconds.
Education
  • University of Maryland, College Park
    Computer Science, 2006 - 2010
Basic Information
Gender
Male
Birthday
September 28
Apps with Google+ Sign-in
  • Easter Egg Hunt
  • Swing Copters
Most beautiful ballpark that I've ever been to. Make sure to grab a shake from Shake Shack, and some nachos from Hard Times, and you're set for a beautiful afternoon watching the Nats action.
Appeal: ExcellentFacilities: ExcellentService: Excellent
Public - 2 years ago
reviewed 2 years ago
1 review
Map
Map
Map