Initial copy from basedroid.