Loading api/current.txt +0 −6 Original line number Diff line number Diff line Loading @@ -4214,12 +4214,6 @@ package android.app { public class Application extends android.content.ContextWrapper implements android.content.ComponentCallbacks2 { ctor public Application(); method public android.app.Activity instantiateActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public android.app.backup.BackupAgent instantiateBackupAgent(java.lang.ClassLoader, java.lang.String); method public android.app.Instrumentation instantiateInstrumentation(java.lang.ClassLoader, java.lang.String); method public android.content.ContentProvider instantiateProvider(java.lang.ClassLoader, java.lang.String); method public android.content.BroadcastReceiver instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public android.app.Service instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public void onConfigurationChanged(android.content.res.Configuration); method public void onCreate(); method public void onLowMemory(); api/system-current.txt +0 −6 Original line number Diff line number Diff line Loading @@ -4378,12 +4378,6 @@ package android.app { public class Application extends android.content.ContextWrapper implements android.content.ComponentCallbacks2 { ctor public Application(); method public android.app.Activity instantiateActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public android.app.backup.BackupAgent instantiateBackupAgent(java.lang.ClassLoader, java.lang.String); method public android.app.Instrumentation instantiateInstrumentation(java.lang.ClassLoader, java.lang.String); method public android.content.ContentProvider instantiateProvider(java.lang.ClassLoader, java.lang.String); method public android.content.BroadcastReceiver instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public android.app.Service instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public void onConfigurationChanged(android.content.res.Configuration); method public void onCreate(); method public void onLowMemory(); api/test-current.txt +0 −6 Original line number Diff line number Diff line Loading @@ -4227,12 +4227,6 @@ package android.app { public class Application extends android.content.ContextWrapper implements android.content.ComponentCallbacks2 { ctor public Application(); method public android.app.Activity instantiateActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public android.app.backup.BackupAgent instantiateBackupAgent(java.lang.ClassLoader, java.lang.String); method public android.app.Instrumentation instantiateInstrumentation(java.lang.ClassLoader, java.lang.String); method public android.content.ContentProvider instantiateProvider(java.lang.ClassLoader, java.lang.String); method public android.content.BroadcastReceiver instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public android.app.Service instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public void onConfigurationChanged(android.content.res.Configuration); method public void onCreate(); method public void onLowMemory(); core/java/android/app/ActivityThread.java +11 −64 Original line number Diff line number Diff line Loading @@ -2666,14 +2666,8 @@ public final class ActivityThread { Activity activity = null; try { java.lang.ClassLoader cl = appContext.getClassLoader(); if (appContext.getApplicationContext() instanceof Application) { activity = ((Application) appContext.getApplicationContext()) .instantiateActivity(cl, component.getClassName(), r.intent); } if (activity == null) { activity = mInstrumentation.newActivity( cl, component.getClassName(), r.intent); } StrictMode.incrementExpectedActivityCount(activity.getClass()); r.intent.setExtrasClassLoader(cl); r.intent.prepareToEnterProcess(); Loading Loading @@ -3169,8 +3163,7 @@ public final class ActivityThread { data.intent.setExtrasClassLoader(cl); data.intent.prepareToEnterProcess(); data.setExtrasClassLoader(cl); receiver = instantiate(cl, component, data.intent, app, Application::instantiateReceiver); receiver = (BroadcastReceiver)cl.loadClass(component).newInstance(); } catch (Exception e) { if (DEBUG_BROADCAST) Slog.i(TAG, "Finishing failed broadcast to " + data.intent.getComponent()); Loading Loading @@ -3258,13 +3251,12 @@ public final class ActivityThread { } else { try { if (DEBUG_BACKUP) Slog.v(TAG, "Initializing agent class " + classname); ContextImpl context = ContextImpl.createAppContext(this, packageInfo); java.lang.ClassLoader cl = packageInfo.getClassLoader(); agent = instantiate(cl, classname, context, Application::instantiateBackupAgent); agent = (BackupAgent) cl.loadClass(classname).newInstance(); // set up the agent's context ContextImpl context = ContextImpl.createAppContext(this, packageInfo); context.setOuterContext(agent); agent.attach(context); Loading Loading @@ -3324,12 +3316,9 @@ public final class ActivityThread { LoadedApk packageInfo = getPackageInfoNoCheck( data.info.applicationInfo, data.compatInfo); Service service = null; Application app = null; try { app = packageInfo.makeApplication(false, mInstrumentation); java.lang.ClassLoader cl = packageInfo.getClassLoader(); service = instantiate(cl, data.info.name, data.intent, app, Application::instantiateService); service = (Service) cl.loadClass(data.info.name).newInstance(); } catch (Exception e) { if (!mInstrumentation.onException(service, e)) { throw new RuntimeException( Loading @@ -3344,6 +3333,7 @@ public final class ActivityThread { ContextImpl context = ContextImpl.createAppContext(this, packageInfo); context.setOuterContext(service); Application app = packageInfo.makeApplication(false, mInstrumentation); service.attach(context, this, data.info.name, data.token, app, ActivityManager.getService()); service.onCreate(); Loading Loading @@ -5682,8 +5672,8 @@ public final class ActivityThread { try { final ClassLoader cl = instrContext.getClassLoader(); mInstrumentation = instantiate(cl, data.instrumentationName.getClassName(), instrContext, Application::instantiateInstrumentation); mInstrumentation = (Instrumentation) cl.loadClass(data.instrumentationName.getClassName()).newInstance(); } catch (Exception e) { throw new RuntimeException( "Unable to instantiate instrumentation " Loading Loading @@ -6234,8 +6224,8 @@ public final class ActivityThread { try { final java.lang.ClassLoader cl = c.getClassLoader(); localProvider = instantiate(cl, info.name, context, Application::instantiateProvider); localProvider = (ContentProvider)cl. loadClass(info.name).newInstance(); provider = localProvider.getIContentProvider(); if (provider == null) { Slog.e(TAG, "Failed to instantiate class " + Loading Loading @@ -6434,49 +6424,6 @@ public final class ActivityThread { } } private <T> T instantiate(ClassLoader cl, String className, Context c, Instantiator<T> instantiator) throws ClassNotFoundException, IllegalAccessException, InstantiationException { Application app = getApp(c); if (app != null) { T a = instantiator.instantiate(app, cl, className); if (a != null) return a; } return (T) cl.loadClass(className).newInstance(); } private <T> T instantiate(ClassLoader cl, String className, Intent intent, Context c, IntentInstantiator<T> instantiator) throws ClassNotFoundException, IllegalAccessException, InstantiationException { Application app = getApp(c); if (app != null) { T a = instantiator.instantiate(app, cl, className, intent); if (a != null) return a; } return (T) cl.loadClass(className).newInstance(); } private Application getApp(Context c) { // We need this shortcut to avoid actually calling getApplicationContext() on an Application // because the Application may not return itself for getApplicationContext() because the // API doesn't enforce it. if (c instanceof Application) return (Application) c; if (c.getApplicationContext() instanceof Application) { return (Application) c.getApplicationContext(); } return null; } private interface Instantiator<T> { T instantiate(Application app, ClassLoader cl, String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException; } private interface IntentInstantiator<T> { T instantiate(Application app, ClassLoader cl, String className, Intent intent) throws ClassNotFoundException, IllegalAccessException, InstantiationException; } private static class EventLoggingReporter implements EventLogger.Reporter { @Override public void report (int code, Object... list) { Loading core/java/android/app/Application.java +2 −74 Original line number Diff line number Diff line Loading @@ -16,20 +16,17 @@ package android.app; import java.util.ArrayList; import android.annotation.CallSuper; import android.app.backup.BackupAgent; import android.content.BroadcastReceiver; import android.content.ComponentCallbacks; import android.content.ComponentCallbacks2; import android.content.ContentProvider; import android.content.Context; import android.content.ContextWrapper; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import java.util.ArrayList; /** * Base class for maintaining global application state. You can provide your own * implementation by creating a subclass and specifying the fully-qualified name Loading Loading @@ -292,73 +289,4 @@ public class Application extends ContextWrapper implements ComponentCallbacks2 { } } } /** * Allows application to override the creation of activities. This can be used to * perform things such as dependency injection or class loader changes to these * classes. Return null to use the default creation flow. * @param cl The default classloader to use for instantiation. * @param className The class to be instantiated. * @param intent Intent creating the class. */ public Activity instantiateActivity(ClassLoader cl, String className, Intent intent) { return null; } /** * Allows application to override the creation of receivers. This can be used to * perform things such as dependency injection or class loader changes to these * classes. Return null to use the default creation flow. * @param cl The default classloader to use for instantiation. * @param className The class to be instantiated. * @param intent Intent creating the class. */ public BroadcastReceiver instantiateReceiver(ClassLoader cl, String className, Intent intent) { return null; } /** * Allows application to override the creation of services. This can be used to * perform things such as dependency injection or class loader changes to these * classes. Return null to use the default creation flow. * @param cl The default classloader to use for instantiation. * @param className The class to be instantiated. * @param intent Intent creating the class. */ public Service instantiateService(ClassLoader cl, String className, Intent intent) { return null; } /** * Allows application to override the creation of providers. This can be used to * perform things such as dependency injection or class loader changes to these * classes. Return null to use the default creation flow. * @param cl The default classloader to use for instantiation. * @param className The class to be instantiated. */ public ContentProvider instantiateProvider(ClassLoader cl, String className) { return null; } /** * Allows application to override the creation of backup agents. This can be used to * perform things such as dependency injection or class loader changes to these * classes. Return null to use the default creation flow. * @param cl The default classloader to use for instantiation. * @param className The class to be instantiated. */ public BackupAgent instantiateBackupAgent(ClassLoader cl, String className) { return null; } /** * Allows application to override the creation of instrumentation. This can be used to * perform things such as dependency injection or class loader changes to these * classes. Return null to use the default creation flow. * @param cl The default classloader to use for instantiation. * @param className The class to be instantiated. */ public Instrumentation instantiateInstrumentation(ClassLoader cl, String className) { return null; } } No newline at end of file Loading
api/current.txt +0 −6 Original line number Diff line number Diff line Loading @@ -4214,12 +4214,6 @@ package android.app { public class Application extends android.content.ContextWrapper implements android.content.ComponentCallbacks2 { ctor public Application(); method public android.app.Activity instantiateActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public android.app.backup.BackupAgent instantiateBackupAgent(java.lang.ClassLoader, java.lang.String); method public android.app.Instrumentation instantiateInstrumentation(java.lang.ClassLoader, java.lang.String); method public android.content.ContentProvider instantiateProvider(java.lang.ClassLoader, java.lang.String); method public android.content.BroadcastReceiver instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public android.app.Service instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public void onConfigurationChanged(android.content.res.Configuration); method public void onCreate(); method public void onLowMemory();
api/system-current.txt +0 −6 Original line number Diff line number Diff line Loading @@ -4378,12 +4378,6 @@ package android.app { public class Application extends android.content.ContextWrapper implements android.content.ComponentCallbacks2 { ctor public Application(); method public android.app.Activity instantiateActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public android.app.backup.BackupAgent instantiateBackupAgent(java.lang.ClassLoader, java.lang.String); method public android.app.Instrumentation instantiateInstrumentation(java.lang.ClassLoader, java.lang.String); method public android.content.ContentProvider instantiateProvider(java.lang.ClassLoader, java.lang.String); method public android.content.BroadcastReceiver instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public android.app.Service instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public void onConfigurationChanged(android.content.res.Configuration); method public void onCreate(); method public void onLowMemory();
api/test-current.txt +0 −6 Original line number Diff line number Diff line Loading @@ -4227,12 +4227,6 @@ package android.app { public class Application extends android.content.ContextWrapper implements android.content.ComponentCallbacks2 { ctor public Application(); method public android.app.Activity instantiateActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public android.app.backup.BackupAgent instantiateBackupAgent(java.lang.ClassLoader, java.lang.String); method public android.app.Instrumentation instantiateInstrumentation(java.lang.ClassLoader, java.lang.String); method public android.content.ContentProvider instantiateProvider(java.lang.ClassLoader, java.lang.String); method public android.content.BroadcastReceiver instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public android.app.Service instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent); method public void onConfigurationChanged(android.content.res.Configuration); method public void onCreate(); method public void onLowMemory();
core/java/android/app/ActivityThread.java +11 −64 Original line number Diff line number Diff line Loading @@ -2666,14 +2666,8 @@ public final class ActivityThread { Activity activity = null; try { java.lang.ClassLoader cl = appContext.getClassLoader(); if (appContext.getApplicationContext() instanceof Application) { activity = ((Application) appContext.getApplicationContext()) .instantiateActivity(cl, component.getClassName(), r.intent); } if (activity == null) { activity = mInstrumentation.newActivity( cl, component.getClassName(), r.intent); } StrictMode.incrementExpectedActivityCount(activity.getClass()); r.intent.setExtrasClassLoader(cl); r.intent.prepareToEnterProcess(); Loading Loading @@ -3169,8 +3163,7 @@ public final class ActivityThread { data.intent.setExtrasClassLoader(cl); data.intent.prepareToEnterProcess(); data.setExtrasClassLoader(cl); receiver = instantiate(cl, component, data.intent, app, Application::instantiateReceiver); receiver = (BroadcastReceiver)cl.loadClass(component).newInstance(); } catch (Exception e) { if (DEBUG_BROADCAST) Slog.i(TAG, "Finishing failed broadcast to " + data.intent.getComponent()); Loading Loading @@ -3258,13 +3251,12 @@ public final class ActivityThread { } else { try { if (DEBUG_BACKUP) Slog.v(TAG, "Initializing agent class " + classname); ContextImpl context = ContextImpl.createAppContext(this, packageInfo); java.lang.ClassLoader cl = packageInfo.getClassLoader(); agent = instantiate(cl, classname, context, Application::instantiateBackupAgent); agent = (BackupAgent) cl.loadClass(classname).newInstance(); // set up the agent's context ContextImpl context = ContextImpl.createAppContext(this, packageInfo); context.setOuterContext(agent); agent.attach(context); Loading Loading @@ -3324,12 +3316,9 @@ public final class ActivityThread { LoadedApk packageInfo = getPackageInfoNoCheck( data.info.applicationInfo, data.compatInfo); Service service = null; Application app = null; try { app = packageInfo.makeApplication(false, mInstrumentation); java.lang.ClassLoader cl = packageInfo.getClassLoader(); service = instantiate(cl, data.info.name, data.intent, app, Application::instantiateService); service = (Service) cl.loadClass(data.info.name).newInstance(); } catch (Exception e) { if (!mInstrumentation.onException(service, e)) { throw new RuntimeException( Loading @@ -3344,6 +3333,7 @@ public final class ActivityThread { ContextImpl context = ContextImpl.createAppContext(this, packageInfo); context.setOuterContext(service); Application app = packageInfo.makeApplication(false, mInstrumentation); service.attach(context, this, data.info.name, data.token, app, ActivityManager.getService()); service.onCreate(); Loading Loading @@ -5682,8 +5672,8 @@ public final class ActivityThread { try { final ClassLoader cl = instrContext.getClassLoader(); mInstrumentation = instantiate(cl, data.instrumentationName.getClassName(), instrContext, Application::instantiateInstrumentation); mInstrumentation = (Instrumentation) cl.loadClass(data.instrumentationName.getClassName()).newInstance(); } catch (Exception e) { throw new RuntimeException( "Unable to instantiate instrumentation " Loading Loading @@ -6234,8 +6224,8 @@ public final class ActivityThread { try { final java.lang.ClassLoader cl = c.getClassLoader(); localProvider = instantiate(cl, info.name, context, Application::instantiateProvider); localProvider = (ContentProvider)cl. loadClass(info.name).newInstance(); provider = localProvider.getIContentProvider(); if (provider == null) { Slog.e(TAG, "Failed to instantiate class " + Loading Loading @@ -6434,49 +6424,6 @@ public final class ActivityThread { } } private <T> T instantiate(ClassLoader cl, String className, Context c, Instantiator<T> instantiator) throws ClassNotFoundException, IllegalAccessException, InstantiationException { Application app = getApp(c); if (app != null) { T a = instantiator.instantiate(app, cl, className); if (a != null) return a; } return (T) cl.loadClass(className).newInstance(); } private <T> T instantiate(ClassLoader cl, String className, Intent intent, Context c, IntentInstantiator<T> instantiator) throws ClassNotFoundException, IllegalAccessException, InstantiationException { Application app = getApp(c); if (app != null) { T a = instantiator.instantiate(app, cl, className, intent); if (a != null) return a; } return (T) cl.loadClass(className).newInstance(); } private Application getApp(Context c) { // We need this shortcut to avoid actually calling getApplicationContext() on an Application // because the Application may not return itself for getApplicationContext() because the // API doesn't enforce it. if (c instanceof Application) return (Application) c; if (c.getApplicationContext() instanceof Application) { return (Application) c.getApplicationContext(); } return null; } private interface Instantiator<T> { T instantiate(Application app, ClassLoader cl, String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException; } private interface IntentInstantiator<T> { T instantiate(Application app, ClassLoader cl, String className, Intent intent) throws ClassNotFoundException, IllegalAccessException, InstantiationException; } private static class EventLoggingReporter implements EventLogger.Reporter { @Override public void report (int code, Object... list) { Loading
core/java/android/app/Application.java +2 −74 Original line number Diff line number Diff line Loading @@ -16,20 +16,17 @@ package android.app; import java.util.ArrayList; import android.annotation.CallSuper; import android.app.backup.BackupAgent; import android.content.BroadcastReceiver; import android.content.ComponentCallbacks; import android.content.ComponentCallbacks2; import android.content.ContentProvider; import android.content.Context; import android.content.ContextWrapper; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import java.util.ArrayList; /** * Base class for maintaining global application state. You can provide your own * implementation by creating a subclass and specifying the fully-qualified name Loading Loading @@ -292,73 +289,4 @@ public class Application extends ContextWrapper implements ComponentCallbacks2 { } } } /** * Allows application to override the creation of activities. This can be used to * perform things such as dependency injection or class loader changes to these * classes. Return null to use the default creation flow. * @param cl The default classloader to use for instantiation. * @param className The class to be instantiated. * @param intent Intent creating the class. */ public Activity instantiateActivity(ClassLoader cl, String className, Intent intent) { return null; } /** * Allows application to override the creation of receivers. This can be used to * perform things such as dependency injection or class loader changes to these * classes. Return null to use the default creation flow. * @param cl The default classloader to use for instantiation. * @param className The class to be instantiated. * @param intent Intent creating the class. */ public BroadcastReceiver instantiateReceiver(ClassLoader cl, String className, Intent intent) { return null; } /** * Allows application to override the creation of services. This can be used to * perform things such as dependency injection or class loader changes to these * classes. Return null to use the default creation flow. * @param cl The default classloader to use for instantiation. * @param className The class to be instantiated. * @param intent Intent creating the class. */ public Service instantiateService(ClassLoader cl, String className, Intent intent) { return null; } /** * Allows application to override the creation of providers. This can be used to * perform things such as dependency injection or class loader changes to these * classes. Return null to use the default creation flow. * @param cl The default classloader to use for instantiation. * @param className The class to be instantiated. */ public ContentProvider instantiateProvider(ClassLoader cl, String className) { return null; } /** * Allows application to override the creation of backup agents. This can be used to * perform things such as dependency injection or class loader changes to these * classes. Return null to use the default creation flow. * @param cl The default classloader to use for instantiation. * @param className The class to be instantiated. */ public BackupAgent instantiateBackupAgent(ClassLoader cl, String className) { return null; } /** * Allows application to override the creation of instrumentation. This can be used to * perform things such as dependency injection or class loader changes to these * classes. Return null to use the default creation flow. * @param cl The default classloader to use for instantiation. * @param className The class to be instantiated. */ public Instrumentation instantiateInstrumentation(ClassLoader cl, String className) { return null; } } No newline at end of file