Move executeAppFunctionInternal off binder thread

so that the threading model is more clear. ExecuteAppFunction is running in the binder thread and ExecuteAppFunctionInternal is not.

Also, only close a session when we have finished using it.

And improve the latency of onUserUnlocked. Now it only takes 14ms

Flag: android.app.appfunctions.flags.enable_app_function_manager
Bug: 360864791
Fixes: 368153367
Test: atest CtsAppFunctionTestCases

Change-Id: Iabd87cab440fd0459acda30ece1ddd9ef576d6af
6 files changed