title: how are android security permissions checked at run-time?
body: <p>This question has been asked before at <a href="https://stackoverflow.com/questions/5734411/how-does-android-enforce-permissions">How does Android enforce permissions?</a>. While the discussions there are good, the question is still not fully answered.</p>
  
  <p>In the development environment, exceptions are thrown when the app tries to do something that requires permissions not declared in AndroidManifest.xml. So how does the run-time system implement the run-time checking?</p>
  
  <p>I guess it's most likely done in the core framework, which may or may not need support from native code. But I don't know what source code files in AOSP are relevant to this.</p>