title: Inconsistent behavior with LiveData in Nougat+ and lower API Levels
body: <p>According to the <a href="https://developer.android.com/topic/libraries/architecture/livedata.html/" rel="nofollow noreferrer" title="documentation">documentation</a>, </p>
  
  <blockquote>
    <p>LiveData considers an observer, which is represented by the Observer class, to be in an active state if its lifecycle is in the STARTED or RESUMED state. LiveData only notifies active observers about updates. Inactive observers registered to watch LiveData objects aren't notified about changes.</p>
  </blockquote>
  
  <p>This seems not to be true entirely.</p>
  
  <p>Using Android Arch Lifecycle version: <strong>1.0.0</strong></p>
  
  <p>I start to notice that there is a strange behavior with LiveData and the trigger mechanism of android.arch.lifecycle.Observer's onChanged in Android 7 versus pre-Android 7.</p>
  
  <p>A simple example is as follows:</p>
  
  <p>Fragment A has ViewModel A. Fragment A observes a LiveData from ViewModel A, called 'observableName' (String). When ViewModel performs an operation and calls observableName.value = "something else", while Fragment A is still active (state is STARTED), all is good and the text changes accordingly, in both Android 6 and 7+.</p>
  
  <p>Here is the inconsistency:</p>
  
  <p>In <strong>Android 7</strong>, if ViewModel A sets observableName.value, while Fragment A's state becomes PAUSED (i.e. launching another Activity), Fragment A's observer onChanged() is <strong>STILL</strong> called, so the text does change and when Fragment A resumes, the text changes.</p>
  
  <p>However, in <strong>Android 6</strong>, if ViewModel A sets observableName.value, while Fragment A's state is PAUSED, Fragment A's observer onChanged() does <strong>NOT</strong> get called, so the text does not change when Fragment A resumes.</p>
  
  <p>It seems that the behavior in Android 6 is correct, except the fact that when the Fragment becomes active again (resumes), onChange does not get called still. Am I misunderstanding here that there seem to be two bugs (Android 7 observer called while LifecycleOwner is inactive AND Android 6 observer not called when LifecycleOwner resumes active state) ?</p>
  
  <p><em>Note: this can happen when ViewModel A performs an operation asynchronously (i.e. fetching results from an API and updates LiveData's value afterwards, while the LifecycleOwner transitions into inactive state.</em></p>
  
  <p>Anyone encountering similar behavior? </p>
  
  <p>UPDATE 1: after some debugging, I see that in the class <code>LifecycleRegistry</code>, <code>ObserverWithState#dispatchEvent</code> method gets called multiple times when the state of the LifecycleOwner (Fragment A) changes. The problem seems to be that in Android 7, <code>dispatchEvent()</code> never receives <code>Event = ON_STOP</code>, where as in Android 6, it does, even though <code>onStop()</code> of Fragment A never gets called in both Android 6 and 7. This might cause the <code>onChange()</code> in Fragment A to no longer receive events after it being paused in Android 6.</p>
  
  <p>This can easily be checked by calling <code>LiveData#hasActiveObservers</code> which returns <code>true</code> in Android 7 and <code>false</code> in Android 6, before setting LiveData value while Fragment A is paused.</p>