Select a piece of code, and press Ctrl+C copy them to clipboard from Android Studio.
It is very strange, OneNote will keep the highlight, but lost all spaces when you press Ctrl+V to paste the code to OneNote.
You can using the Gem's Paste Rich Text feature to keep the spaces in code in OneNote.
After copy the code from Android Studio, in OneNote, click Gem for OneNote -> "Edit" tab -> "Paste Rich Text" feature. Gem will paste your code to OneNote, it can keep the highlight and spaces.