adjusted to current api from afflux/android_frameworks_base@954a975ffa