cloned from android/platform_frameworks_native