/** Updates Jitsi icon notification to reflect current global status. */ public void updateJitsiIconNotification() { String status; if (getGlobalStatus().isOnline()) { // At least one provider is online status = JitsiApplication.getResString(R.string.service_gui_ONLINE); } else { // There are no active providers so we consider to be in // the offline state status = JitsiApplication.getResString(R.string.service_gui_OFFLINE); } int notificationID = OSGiService.getGeneralNotificationId(); if (notificationID == -1) { logger.debug( "Not displaying status notification because" + " there's no global notification icon available."); return; } AndroidUtils.updateGeneralNotification( JitsiApplication.getGlobalContext(), notificationID, JitsiApplication.getResString(R.string.app_name), status, System.currentTimeMillis()); }
/** * Tracks and injects APSServiceTracker directly or as wrapped service instance using the tracker * to call the service depending on the field type. * * @param field The field to inject. * @param managedClass Used to lookup or create an instance of this class to inject into. * @param context The bundle context. */ protected void handleServiceInjections(Field field, Class managedClass, BundleContext context) { OSGiService service = field.getAnnotation(OSGiService.class); if (service != null) { String trackerKey = field.getType().getName() + service.additionalSearchCriteria(); APSServiceTracker tracker = this.trackers.get(trackerKey); if (tracker == null) { tracker = new APSServiceTracker<>( context, field.getType(), service.additionalSearchCriteria(), service.timeout()); this.trackers.put(trackerKey, tracker); } tracker.start(); List<Object> managedInstances = getManagedInstances(managedClass); for (Object managedInstance : managedInstances) { if (field.getType().equals(APSServiceTracker.class)) { injectObject(managedInstance, tracker, field); } else { injectObject(managedInstance, tracker.getWrappedService(), field); } } if (service.required() && this.supportsRequired) { Tuple4<APSServiceTracker, Class, Boolean, List<ServiceRegistration>> requiredService = new Tuple4<>( tracker, managedClass, false, (List<ServiceRegistration>) new LinkedList<ServiceRegistration>()); this.requiredServices.add(requiredService); } this.activatorLogger.info( "Injected tracked service '" + field.getType().getName() + (service.additionalSearchCriteria().length() > 0 ? " " + service.additionalSearchCriteria() : "") + "' " + "into '" + managedClass.getName() + "." + field.getName() + "' for bundle: " + context.getBundle().getSymbolicName() + " for " + managedInstances.size() + " instance(s)!"); } }