title: How to get the name of the process which is streaming media over mediaserver process in Android?
body: <p>I couldn't find detailed information on the Internet.</p>
  
  <p>But as far as I know, <code>mediaserver</code> process which is located in <code>/system/bin/mediaserver</code> controls the media transactions in Android.</p>
  
  <p>For example while streaming video on <code>youtube</code> application, this media server seems to be opening port to the remote server and downloading the content as it seems in </p>
  
  <pre><code>cat /proc/net/tcp
  </code></pre>
  
  <p>The linux UID of mediaserver app is 1013, which is an internal Android UID.</p>
  
  <p>For a new socket connection, I'm getting the application UID by checking the open ports </p>
  
  <p>But for this mediaserver process case, I get the UID 1013 as mediaserver has opened the port. </p>
  
  <p>The problem is when I call <code>getRunningAppProcesses</code>, this mediaserver app is not listed in the list.</p>
  
  <p>To be more specific, <code>getRunningAppProcesses()</code> returns only the package names in the output of <code>ps</code> command, not showing e.g. <code>/system/bin/mediaserver</code> or <code>/system/bin/keystore</code> etc.</p>
  
  <p>So I'd need to know which application's caused mediaserver to open a new port to the remote service. How to obtain the original application name or pid in this case? I couldn't figure out if this could actually be done or a restriction of Android. </p>