title: StrictMode: How to disable "Untagged socket detected" in Android for targetSdk >= 28
body: <p>I'm trying to disable one of Android StrictMode checks - detection of untagged sockets.</p>
  
  <p>I have several reasons to do this:</p>
  
  <ul>
  <li><p>Some libraries used in our app e.g. Crashlytics / Picasso e.t.c.
  are using OkHttp internally and StrictMode detects untagged socket 
  problem in OkHttp code (I don't have access to code of third party libraries to fix this problem there)</p></li>
  <li><p>I need to clear my logs from strict mode untagged socket errors which I can't fix to remove noise for other StrictMode problem detection</p></li>
  </ul>
  
  <p>To enable VmPolicy We use <a href="https://developer.android.com/reference/android/os/StrictMode.VmPolicy.Builder#detectAll()" rel="noreferrer">VmPolicy.Builder.detectAll()</a> method</p>
  
  <p>By looking in sources of StrictMode I've found method VmPolicy.Builder.permitUntaggedSockets but it annotated as <code>@hidden</code> and can't be used on API = 28</p>
  
  <p>The only <a href="https://stackoverflow.com/a/53195069/2285038">solution</a> to this problem I've found is to copy <code>detectAll()</code> method body to my code and remove call to <code>detectUntaggedSockets()</code> but it seems to me error prone and weakly maintainable.</p>
  
  <p>May be some one can suggest better solution to described problem?</p>
  
  <p>Any information about "Why <code>permitUntaggedSockets()</code> became hidden in API 28" are really appreciated.</p>
  
  <p><a href="https://stackoverflow.com/questions/53195068/crashlytics-with-strictmode-enabled-detect-all-gives-untagged-socket-detected">Crashlytics: Details about StrictMode problem</a></p>
  
  <p><a href="https://github.com/square/okhttp/issues/3537" rel="noreferrer">OkHttp: Bug report about Untagged socket problem</a></p>