private static List<Experiment> initializeExperimentsWatchingAppUsage( ExperimentProviderUtil experimentProviderUtil) { List<Experiment> joined = experimentProviderUtil.getJoinedExperiments(); List<Experiment> experimentsNeedingEvent = Lists.newArrayList(); DateTime now = DateTime.now(); for (Experiment experiment2 : joined) { if (!ActionScheduleGenerator.isOver(now, experiment2.getExperimentDAO()) && ExperimentHelper.isLogActions(experiment2.getExperimentDAO())) { experimentsNeedingEvent.add(experiment2); } } return experimentsNeedingEvent; }
// Visible for testing public void deleteExperiment(Experiment experiment2) { NotificationCreator nc = NotificationCreator.create(this); nc.timeoutNotificationsForExperiment(experiment2.getExperimentDAO().getId()); createStopEvent(experiment2); experimentProviderUtil.deleteExperiment(experiment2.getId()); if (ExperimentHelper.shouldWatchProcesses(experiment2.getExperimentDAO())) { BroadcastTriggerReceiver.initPollingAndLoggingPreference(this); } new AndroidEsmSignalStore(this) .deleteAllSignalsForSurvey(experiment2.getExperimentDAO().getId()); reloadAdapter(); startService(new Intent(this, BeeperService.class)); startService(new Intent(this, ExperimentExpirationManagerService.class)); }