title: WorkManager with network contraints not running on android 9 emulator
body: <p>WorkManager enqueued a network restricted work, only enqueued without running on android 9 emulator</p>
  
  <pre><code>8532-8549 D/WM-PackageManagerHelper: androidx.work.impl.background.systemalarm.RescheduleReceiver enabled
  8532-8549 D/WM-SystemJobScheduler: Scheduling work ID cdded304-5021-4e94-a13c-2e0746d54a58 Job ID 0
  8532-8549 D/WM-GreedyScheduler: Starting tracking for [cdded304-5021-4e94-a13c-2e0746d54a58]
  8532-8549 D/WM-ConstraintTracker: NetworkStateTracker: initial state = [ Connected=true Validated=false Metered=false NotRoaming=true ]
  8532-8549 D/WM-NetworkStateTracker: Registering network callback
  8532-8549 D/WM-GreedyScheduler: Constraints not met: Cancelling work ID cdded304-5021-4e94-a13c-2e0746d54a58
  8532-8549 D/WM-PackageManagerHelper: androidx.work.impl.background.systemalarm.RescheduleReceiver enabled
  8532-8549 D/WM-SystemJobScheduler: Scheduling work ID fde1a327-10dc-4356-8145-b1f624f99d48 Job ID 1
  8532-8549 D/WM-GreedyScheduler: Starting tracking for [fde1a327-10dc-4356-8145-b1f624f99d48]
  8532-8549 D/WM-GreedyScheduler: Constraints not met: Cancelling work ID cdded304-5021-4e94-a13c-2e0746d54a58
  8532-8549 D/WM-GreedyScheduler: Constraints not met: Cancelling work ID fde1a327-10dc-4356-8145-b1f624f99d48
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>fun enqueueUniqueWork() {
      WorkManager.getInstance().enqueueUniqueWork(
          App.ANONYMOUS_LOGIN,
          ExistingWorkPolicy.KEEP,
          OneTimeWorkRequestBuilder&lt;AnonymousLoginWork&gt;()
              .setConstraints(
                  Constraints.Builder()
                      .setRequiredNetworkType(NetworkType.CONNECTED)
                      .build()
              )
              .build()
      )
  }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I found that ConnectivityManager.activeNetwork doesn't has NetworkCapabilities.NET_CAPABILITY_VALIDATED capability when app running on android pie emulator, so the network constraint not met.<br>
  <a href="https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/NetworkConnectedController.java#49" rel="nofollow noreferrer">https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/work/workmanager/src/main/java/androidx/work/impl/constraints/controllers/NetworkConnectedController.java#49</a><br>
  <a href="https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/NetworkStateTracker.java#118" rel="nofollow noreferrer">https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/work/workmanager/src/main/java/androidx/work/impl/constraints/trackers/NetworkStateTracker.java#118</a><br>
  From the source code, we can see the network constraint changed to <strong>isConnected</strong> &amp;&amp; <strong>isValidated</strong>, which means, current active network must has 
  NetworkCapabilities.NET_CAPABILITY_VALIDATED capability.</p>
  
  <p>The question is: <strong>How to config this on emulator?</strong></p>