internal android.app.LoadedApk getPackageInfo(android.content.pm.ApplicationInfo aInfo, android.content.res.CompatibilityInfo compatInfo, java.lang.ClassLoader baseLoader , bool securityViolation, bool includeCode) { lock (mPackages) { [email protected]<android.app.LoadedApk> @ref; if (includeCode) { @ref = mPackages.get(aInfo.packageName); } else { @ref = mResourcePackages.get(aInfo.packageName); } android.app.LoadedApk packageInfo = @ref != null ? @ref.get() : null; if (packageInfo == null || (packageInfo.mResources != null && !packageInfo.mResources .getAssets().isUpToDate())) { packageInfo = new android.app.LoadedApk(this, aInfo, compatInfo, this, baseLoader , securityViolation, includeCode && (aInfo.flags & android.content.pm.ApplicationInfo .FLAG_HAS_CODE) != 0); if (includeCode) { mPackages.put(aInfo.packageName, new [email protected]<android.app.LoadedApk >(packageInfo)); } else { mResourcePackages.put(aInfo.packageName, new [email protected]<android.app.LoadedApk >(packageInfo)); } } return packageInfo; } }
internal android.app.ContextImpl getSystemContext() { lock (this) { if (mSystemContext == null) { android.app.ContextImpl context = android.app.ContextImpl.createSystemContext(this ); android.app.LoadedApk info = new android.app.LoadedApk(this, "android", context, null, android.content.res.CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO); context.init(info, null, this); context.getResources().updateConfiguration(getConfiguration(), getDisplayMetricsLocked (android.content.res.CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO, false)); mSystemContext = context; } } //Slog.i(TAG, "Created system resources " + context.getResources() // + ": " + context.getResources().getConfiguration()); return mSystemContext; }
// ------------------ Internal API ------------------ /// <hide></hide> internal void attach(android.content.Context context) { attachBaseContext(context); mLoadedApk = android.app.ContextImpl.getImpl(context).mPackageInfo; }
internal void init(android.content.res.Resources resources, android.app.ActivityThread mainThread) { mPackageInfo = null; mBasePackageName = null; mResources = resources; mMainThread = mainThread; mContentResolver = new android.app.ContextImpl.ApplicationContentResolver(this, mainThread ); }
internal void init(android.app.LoadedApk packageInfo, android.os.IBinder activityToken , android.app.ActivityThread mainThread, android.content.res.Resources container , string basePackageName) { mPackageInfo = packageInfo; mBasePackageName = basePackageName != null ? basePackageName : packageInfo.mPackageName; mResources = mPackageInfo.getResources(mainThread); if (mResources != null && container != null && container.getCompatibilityInfo().applicationScale != mResources.getCompatibilityInfo().applicationScale) { mResources = mainThread.getTopLevelResources(mPackageInfo.getResDir(), container. getCompatibilityInfo()); } mMainThread = mainThread; mContentResolver = new android.app.ContextImpl.ApplicationContentResolver(this, mainThread ); setActivityToken(activityToken); }
/// <summary>Create a new ApplicationContext from an existing one.</summary> /// <remarks> /// Create a new ApplicationContext from an existing one. The new one /// works and operates the same as the one it is copying. /// </remarks> /// <param name="context">Existing application context.</param> internal ContextImpl(android.app.ContextImpl context) { mPackageInfo = context.mPackageInfo; mBasePackageName = context.mBasePackageName; mResources = context.mResources; mMainThread = context.mMainThread; mContentResolver = context.mContentResolver; mOuterContext = this; }