From 59a97141c8ad3e3d9d3d5c4db1f59d4c9847177c Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Tue, 9 Apr 2019 17:18:31 +0100 Subject: [PATCH] Update AppComponentFactory.instantiateClassLoader docs Clarify the intended use and properties of the default class loader. Bug: 128524313 Test: n/a Change-Id: Iae82554f9294d5248b98f1fa72fc1a47993e86fd --- core/java/android/app/AppComponentFactory.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/core/java/android/app/AppComponentFactory.java b/core/java/android/app/AppComponentFactory.java index 2cec7f0fc323..5b02817b7bfb 100644 --- a/core/java/android/app/AppComponentFactory.java +++ b/core/java/android/app/AppComponentFactory.java @@ -35,11 +35,22 @@ import android.content.pm.ApplicationInfo; public class AppComponentFactory { /** - * Allows application to override the creation of the default class loader. - * This can be used to perform things such as dependency injection or setting up - * a custom class loader hierarchy. + * Selects the class loader which will be used by the platform to instantiate app components. + *

+ * The default implementation of this method returns the {@code cl} parameter unchanged. + * Applications can override this method to set up a custom class loader or a custom class + * loader hierarchy and return it to the platform. + *

+ * The method is a hook invoked before any application components are instantiated or the + * application Context is initialized. It is intended to allow the application's classes to + * be loaded from a different source than the base/split APK(s). + *

+ * The default class loader {@code cl} is created by the platform and used to load the + * application's base or split APK(s). Its parent is typically the boot class loader, unless + * running under instrumentation. Its classname is configurable using the + * {@link android.R.attr#classLoader} manifest attribute. * - * @param cl The default classloader instantiated by platform. + * @param cl The default class loader created by the platform. * @param aInfo Information about the application being loaded. */ public @NonNull ClassLoader instantiateClassLoader(@NonNull ClassLoader cl, -- 2.11.0