manually cherry-picked http://review.cyanogenmod.org/#/c/27186/

Change-Id: I1d9248edc09b07bd489747abf753cc18a9f92120