title: Get package name of default image openner
body: <p>I have a problem. When running my tests on different phones, when trying to open gallery, it is not working.</p>
  
  <p>Now, what I want to do is to get package name for the default gallery opener app, so I can use it in my code. How can I do this programmatically?</p>
  
  <p>Here is how am I using when running tests on Nexus 5.</p>
  
  <pre><code>Resources resources = InstrumentationRegistry.getTargetContext().getResources();
          Uri imageUri = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" +
                  resources.getResourcePackageName(R.drawable.ic_launcher) + '/' +
                  resources.getResourceTypeName(R.drawable.ic_launcher) + '/' +
                  resources.getResourceEntryName(R.drawable.ic_launcher));
          Intent resultData = new Intent();
          resultData.setData(imageUri);
          Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, resultData);
          intending(toPackage("com.google.android.apps.photos")).respondWith(result);
          //Click the select button
          onView(withId(R.id.register_image)).perform(click());
          threadSleep(MILISECONDS_TIMEOUT);
          onView(withText("From Gallery")).perform(click());
          threadSleep(MILISECONDS_TIMEOUT);
          Spoon.screenshot(getActivityInstance(), "picture_selected");
  </code></pre>
  
  <p>Basically, all i need to do is to get package name of the application for images.</p>