Builds the package cache and registers the package monitor

@param context The {@link Context} to use for monitor registration
497763
public void init(Context context) {
        if (!mNotFoundClassesMap.isEmpty()) {
            buildInstalledPackagesCache(context);
        }

        mPackageMonitor.register(context);
    }
955421
protected void postProcessApplicationContext(ConfigurableApplicationContext context) {
		if (this.beanNameGenerator != null) {
			context.getBeanFactory().registerSingleton(
					AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR,
					this.beanNameGenerator);
		}
		if (this.resourceLoader != null) {
			if (context instanceof GenericApplicationContext) {
				((GenericApplicationContext) context)
						.setResourceLoader(this.resourceLoader);
			}
			if (context instanceof DefaultResourceLoader) {
				((DefaultResourceLoader) context)
						.setClassLoader(this.resourceLoader.getClassLoader());
			}
		}
		if (this.addConversionService) {
			context.getBeanFactory().setConversionService(
					ApplicationConversionService.getSharedInstance());
		}
	}
879029
public synchronized void start(final Context context) {
        this.contextWeakReference = new WeakReference<Context>(context);
        if (isStarted()) {
            throw new IllegalStateException("Already started.");
        } else {
            executorService = Executors.newFixedThreadPool(getThreadCount(), new MinPriorityThreadFactory());
            // start the binding to the service
            runner = new Thread(this, SPICE_MANAGER_THREAD_NAME_PREFIX + spiceManagerThreadIndex++);
            runner.setPriority(Thread.MIN_PRIORITY);
            isStopped = false;
            runner.start();

            Ln.d("SpiceManager started.");
        }
    }
315734
def insert(self, context):
	
		
		
		if self.__dependency:
			self.__execute(context, "install")
		else:
			self.__execute(context, "package")
267380
public static void init(Context context) {
    String apiKey = readApiKey(context);
    init(context, apiKey);
  }
317967
protected void activate(ComponentContext context) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
            Tr.event(tc, "activate", context);
        authDataServiceRef.activate(context);
        deferrableSchedXSvcRef.activate(context);
        execSvcRef.activate(context);
        nonDeferrableSchedXSvcRef.activate(context);
        rrsXAResFactorySvcRef.activate(context);
        variableRegistrySvcRef.activate(context);
    }
625079
public static boolean isTopApplication(Context context) {
		ComponentName activity = getTopActivity(context);
		if (activity == null) {
			return false;
		}
		return activity.getPackageName().equals(context.getApplicationInfo().packageName);
	}
734933
public void start(BundleContext context) throws Exception
    {
        this.log(context, LogService.LOG_INFO, "Starting and registering the (repository) " + this.getClass().getName() + " ClassService ");
        
        bundleContext = context;

        if (context != null)
            context.registerService(ClassFinder.class.getName(), this, null);	// Should be only one of these
    }
301769
public static void register(ActivityListener activityListener, Context context) {
    ListenableActivity activity = getListenableActivity(context);
    if (activity != null) {
      Listener listener = new Listener(activityListener);
      activity.addActivityListener(listener);
    }
  }
512598
protected synchronized void activate(ComponentContext context) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(this, tc, "Activating");
        }
        bContext = context.getBundleContext();
        instance.set(this);

        sslConfigs.activate(context);
        cfwBundle.getFramework().registerFactories(this);
    }
183684
public void initialize(Context context) {
    if (!isInitialized) {
      initializePicasso(context);
      initializeData(context);
      isInitialized = true;
    }
  }
874870
public synchronized void prepare(String configureFileName, AppContextWrapper context) {
		ContainerRegistryBuilder cb;
		try {
			cb = (ContainerRegistryBuilder) context.getAttribute(ContainerRegistryBuilder.APPLICATION_CONTEXT_ATTRIBUTE_NAME);
			if (cb == null) {
				initialized(context);
				cb = (ContainerRegistryBuilder) context.getAttribute(ContainerRegistryBuilder.APPLICATION_CONTEXT_ATTRIBUTE_NAME);
			}
			ContainerDirector cd = new ContainerDirector(cb);
			cd.prepareAppRoot(configureFileName);
		} catch (Exception ex) {
			Debug.logError(ex, module);
		}
	}
53381
@SuppressWarnings("PMD.PreserveStackTrace")
    public static void checkService(@NonNull final Context context,
                                    @NonNull final ComponentName service) {
        final PackageManager packageManager = context.getPackageManager();
        try {
            packageManager.getServiceInfo(service, 0);
        } catch (PackageManager.NameNotFoundException e) {
            throw new IllegalStateException("Service " + service.getClassName()
                    + " hasn't been declared in AndroidManifest.xml");
        }
    }
589607
public void initialized(AppContextWrapper context) {
		ContainerRegistryBuilder cb = (ContainerRegistryBuilder) context.getAttribute(ContainerRegistryBuilder.APPLICATION_CONTEXT_ATTRIBUTE_NAME);
		if (cb != null)
			return;
		try {
			synchronized (context) {
				cb = containerBuilderContext.createContainerBuilder(context);
				context.setAttribute(ContainerRegistryBuilder.APPLICATION_CONTEXT_ATTRIBUTE_NAME, cb);
				Debug.logVerbose("[JdonFramework] Initialize the container OK ..");
			}
		} catch (Exception e) {
			Debug.logError("[JdonFramework] initialized error: " + e, module);
		}
	}
335060
public void compileAndRun() throws Exception {
		synchronized (this.monitor) {
			try {
				stop();
				Class<?>[] compiledSources = compile();
				monitorForChanges();
				// Run in new thread to ensure that the context classloader is setup
				this.runThread = new RunThread(compiledSources);
				this.runThread.start();
				this.runThread.join();
			}
			catch (Exception ex) {
				if (this.fileWatchThread == null) {
					throw ex;
				}
				else {
					ex.printStackTrace();
				}
			}
		}
	}
854169
public static boolean isPackageInstaller(@NotNull final Context context, final String packageName) {
        final PackageManager packageManager = context.getPackageManager();
        final String installerPackageName = packageManager.getInstallerPackageName(context.getPackageName());
        boolean isPackageInstaller = TextUtils.equals(installerPackageName, packageName);
        Logger.d("isPackageInstaller() is ", isPackageInstaller, " for ", packageName);
        return isPackageInstaller;
    }
959209
public synchronized void startup(AppContextWrapper context) {
		ContainerRegistryBuilder cb;
		try {
			cb = (ContainerRegistryBuilder) context.getAttribute(ContainerRegistryBuilder.APPLICATION_CONTEXT_ATTRIBUTE_NAME);
			if (cb == null) {
				Debug.logError("[JdonFramework] at first call prepare method");
				return;
			}
			if (cb.isKernelStartup())
				return;
			ContainerDirector cd = new ContainerDirector(cb);
			cd.startup();
		} catch (Exception ex) {
			Debug.logError(ex, module);
		}
	}