urbanairship-core/src/main/java/com/urbanairship/automation/AutomationEngine.java
@WorkerThread
    private void restoreCompoundTriggers() {
        final List<Observable<TriggerUpdate>> eventObservables = new ArrayList<>();

        for (final @Trigger.TriggerType int type : COMPOUND_TRIGGER_TYPES) {
            Observable<TriggerUpdate> observable = createEventObservable(type).observeOn(backgroundScheduler)
                                                                              .map(new Function<JsonSerializable, TriggerUpdate>() {
                                                                                  @Override
                                                                                  public TriggerUpdate apply(JsonSerializable json) {
                                                                                      stateChangeTimeStamps.put(type, System.currentTimeMillis());
                                                                                      return new TriggerUpdate(dataManager.getActiveTriggerEntries(type), json, 1.0);
                                                                                  }
                                                                              });
            eventObservables.add(observable);
        }

        Observable<TriggerUpdate> eventStream = Observable.merge(eventObservables);
        this.stateObservableUpdates = Subject.create();

        this.compoundTriggerSubscription = Observable.merge(eventStream, stateObservableUpdates)
                                                     .subscribe(new Subscriber<TriggerUpdate>() {
                                                         @Override
                                                         public void onNext(TriggerUpdate update) {
                                                             updateTriggers(update.triggerEntries, update.json, update.value);
                                                         }
                                                     });

        backgroundHandler.post(new Runnable() {
            @Override
            public void run() {
                subscribeStateObservables(dataManager.getScheduleEntries());
            }
        });

    }
/**
     * Restores compound triggers for all schedule entries.
     */
Restores compound triggers for all schedule entries.
Restores compound triggers for all schedule entries .
@WorkerThread
    private void restoreCompoundTriggers() {
        final List<Observable<TriggerUpdate>> eventObservables = new ArrayList<>();
        for (final @Trigger.TriggerType int type : COMPOUND_TRIGGER_TYPES) {
            Observable<TriggerUpdate> observable = createEventObservable(type).observeOn(backgroundScheduler)
                                                                              .map(new Function<JsonSerializable, TriggerUpdate>() {
                                                                                  @Override
                                                                                  public TriggerUpdate apply(JsonSerializable json) {
                                                                                      stateChangeTimeStamps.put(type, System.currentTimeMillis());
                                                                                      return new TriggerUpdate(dataManager.getActiveTriggerEntries(type), json, 1.0);
                                                                                  }
                                                                              });
            eventObservables.add(observable);
        }
        Observable<TriggerUpdate> eventStream = Observable.merge(eventObservables);
        this.stateObservableUpdates = Subject.create();
        this.compoundTriggerSubscription = Observable.merge(eventStream, stateObservableUpdates)
                                                     .subscribe(new Subscriber<TriggerUpdate>() {
                                                         @Override
                                                         public void onNext(TriggerUpdate update) {
                                                             updateTriggers(update.triggerEntries, update.json, update.value);
                                                         }
                                                     });
        backgroundHandler.post(new Runnable() {
            @Override
            public void run() {
                subscribeStateObservables(dataManager.getScheduleEntries());
            }
        });
    }
@ WorkerThread private void restoreCompoundTriggers ( ) { final List < Observable < TriggerUpdate > > eventObservables = new ArrayList < > ( ) ; for ( final @ Trigger . TriggerType int type : COMPOUND_TRIGGER_TYPES ) { Observable < TriggerUpdate > observable = createEventObservable ( type ) . observeOn ( backgroundScheduler ) . map ( new Function < JsonSerializable , TriggerUpdate > ( ) { @ Override public TriggerUpdate apply ( JsonSerializable json ) { stateChangeTimeStamps . put ( type , System . currentTimeMillis ( ) ) ; return new TriggerUpdate ( dataManager . getActiveTriggerEntries ( type ) , json , 1.0 ) ; } } ) ; eventObservables . add ( observable ) ; } Observable < TriggerUpdate > eventStream = Observable . merge ( eventObservables ) ; this . stateObservableUpdates = Subject . create ( ) ; this . compoundTriggerSubscription = Observable . merge ( eventStream , stateObservableUpdates ) . subscribe ( new Subscriber < TriggerUpdate > ( ) { @ Override public void onNext ( TriggerUpdate update ) { updateTriggers ( update . triggerEntries , update . json , update . value ) ; } } ) ; backgroundHandler . post ( new Runnable ( ) { @ Override public void run ( ) { subscribeStateObservables ( dataManager . getScheduleEntries ( ) ) ; } } ) ; }
Restores compound triggers for all schedule entries.
Restores compound triggers for all schedule entries .