Merge "Optimize attaching process for starting activity" into main