Merge "Add adapt_scan APIs and some helping functions" into nextgenv2