frameworks/native: unified patch from Jellaxy original branch