Create AppComponentFactory.instantiateClassLoader API

Adds a hook to AppComponentFactory to allow control over the
instantiation of the main app class loader. LoadedApk creates
the default class loader and uses it to load the base APK. If
AppComponentFactory is declared in the manifest, its new method
instantiateClassLoader is called and its result becomes the
class loader used by LoadedApk to instantiate other classes
declared in the manifest. By default this is simply the class
loader created by LoadedApk.

Second method provides AppComponentFactory with a copy of
ApplicationInfo. The factory otherwise cannot locate any of the
app's resources, including its APK or the data folder.

Bug: 111342996
Test: atest CtsClassLoaderFactoryPathClassLoaderTestCases
Test: atest CtsClassLoaderFactoryInMemoryDexClassLoaderTestCases
Merged-In: Id21d9afaf00b9cb64a107bc9893b952407cff0b5
Change-Id: Id21d9afaf00b9cb64a107bc9893b952407cff0b5
(cherry picked from commit fd6dcc21d9ee8ee5d1cad71a8d705cf0d42980a7)
3 files changed