Update entrypoints after switching the runtime to non-debuggable

When detaching a debugger or stopping tracing in non-debuggable
runtimes, we switch back to non-debuggable mode. We used to switch to
non-debuggable mode after updating the entrypoints of methods. This
meant we don't use AOT code for these methods. For this to work
correctly we should
1. Update instrumentation level
2. Switch runtime if possible
3. Update entry points.

Since this order is important, we no longer expose MaybeSwitchRuntime as
a public member. Instead we pass a parameter that says if we should try
and switch the runtime to non-debuggable.

Bug: 303686344
Test: art/test.py
(cherry picked from https://android-review.googlesource.com/q/commit:6f563af0994a422d4829a295841f8c0641293afb)
Merged-In: Id655ca50964ed10072ff5bfc3e565c08ecb9987b
Change-Id: Id655ca50964ed10072ff5bfc3e565c08ecb9987b
5 files changed