title: two service with the same intent filter
body: <p>I have two applications installed on my device,each with a service component in it and these two service has the same intent filter declaration,like this:</p>
  
  <pre><code>&lt;intent-filter&gt;
  &lt;action android:name="com.example.intent.action.SHOW"/&gt;
  &lt;/intent-filter&gt;
  </code></pre>
  
  <p>And I start the service in this way:  <br/></p>
  
  <pre><code>Intent intent = new Intent();
  intent.setAction("com.example.intent.action.SHOW");
  startService(intent);
  </code></pre>
  
  <p>I found that one of these two services started,but I am not sure how this happened.As we know,if we write two activities with the same intent filter declaration,a dialog will be poped up and let the user chooses a activity to complete the action.What got me confused is that how Android chooses the service to be started in these who has the same intent filters,what's the strategy of making this decision?</p>
  
  <p>Thanks in advance!</p>
  
  <p>update:<br/>
  Yury is right, here is code snippet from frameworks/base/services/java/com/android/server/pm/PackageMangerService.java on ICS:</p>
  
  <pre><code>public ResolveInfo resolveService(Intent intent, String resolvedType,
      int flags) {
  List&lt;ResolveInfo&gt; query = queryIntentServices(intent, resolvedType,
          flags);
  if (query != null) {
      if (query.size() &gt;= 1) {
          // If there is more than one service with the same priority,
          // just arbitrarily pick the first one.
          return query.get(0);
      }
  }
  return null;
  }
  </code></pre>
  
  <p>As we can see,if there are more than one service match the requested intent, Android will arbitrarily pick one to start. But, which service will be actually started is unexpected.</p>