public android.app.Application makeApplication(bool forceDefaultAppClass, android.app.Instrumentation instrumentation) { if (mApplication != null) { return(mApplication); } android.app.Application app = null; string appClass = mApplicationInfo.className; if (forceDefaultAppClass || (appClass == null)) { appClass = "android.app.Application"; } try { java.lang.ClassLoader cl = getClassLoader(); android.app.ContextImpl appContext = new android.app.ContextImpl(); appContext.init(this, null, mActivityThread); app = mActivityThread.mInstrumentation.newApplication(cl, appClass, appContext); appContext.setOuterContext(app); } catch (System.Exception e) { if (!mActivityThread.mInstrumentation.onException(app, e)) { throw new java.lang.RuntimeException("Unable to instantiate application " + appClass + ": " + e.ToString(), e); } } mActivityThread.mAllApplications.add(app); mApplication = app; if (instrumentation != null) { try { instrumentation.callApplicationOnCreate(app); } catch (System.Exception e) { if (!instrumentation.onException(app, e)) { throw new java.lang.RuntimeException("Unable to create application " + app.GetType ().FullName + ": " + e.ToString(), e); } } } return(app); }
internal void attach(android.content.Context context, android.app.ActivityThread aThread, android.app.Instrumentation instr, android.os.IBinder token, int ident, android.app.Application application, android.content.Intent intent, android.content.pm.ActivityInfo info, java.lang.CharSequence title, android.app.Activity parent, string id, android.app.Activity .NonConfigurationInstances lastNonConfigurationInstances, android.content.res.Configuration config) { attachBaseContext(context); mFragments.attachActivity(this); mWindow = [email protected](this); mWindow.setCallback(this); mWindow.getLayoutInflater().setPrivateFactory(this); if (info.softInputMode != android.view.WindowManagerClass.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED) { mWindow.setSoftInputMode(info.softInputMode); } if (info.uiOptions != 0) { mWindow.setUiOptions(info.uiOptions); } mUiThread = java.lang.Thread.currentThread(); mMainThread = aThread; mInstrumentation = instr; mToken = token; mIdent = ident; mApplication = application; mIntent = intent; mComponent = intent.getComponent(); mActivityInfo = info; mTitle = title; mParent = parent; mEmbeddedID = id; mLastNonConfigurationInstances = lastNonConfigurationInstances; mWindow.setWindowManager(null, mToken, mComponent.flattenToString(), (info.flags & android.content.pm.ActivityInfo.FLAG_HARDWARE_ACCELERATED) != 0); if (mParent != null) { mWindow.setContainer(mParent.getWindow()); } mWindowManager = mWindow.getWindowManager(); mCurrentConfig = config; }
internal ReceiverDispatcher(android.content.BroadcastReceiver receiver, android.content.Context context, android.os.Handler activityThread, android.app.Instrumentation instrumentation , bool registered) { throw new System.NotImplementedException(); }
// system crashed, nothing we can do //Slog.i(TAG, "Receiver registrations: " + mReceivers); // system crashed, nothing we can do //Slog.i(TAG, "Service registrations: " + mServices); public android.content.IIntentReceiver getReceiverDispatcher(android.content.BroadcastReceiver r, android.content.Context context, android.os.Handler handler, android.app.Instrumentation instrumentation, bool registered) { lock (mReceivers) { android.app.LoadedApk.ReceiverDispatcher rd = null; java.util.HashMap <android.content.BroadcastReceiver, android.app.LoadedApk.ReceiverDispatcher > map = null; if (registered) { map = mReceivers.get(context); if (map != null) { rd = map.get(r); } } if (rd == null) { rd = new android.app.LoadedApk.ReceiverDispatcher(r, context, handler, instrumentation , registered); if (registered) { if (map == null) { map = new java.util.HashMap <android.content.BroadcastReceiver, android.app.LoadedApk .ReceiverDispatcher>(); mReceivers.put(context, map); } map.put(r, rd); } } else { rd.validate(context, handler); } rd.mForgotten = false; return(rd.getIIntentReceiver()); } }