merge libadb improvements from upstream