title: AppWidgetProvider takes resources from wrong package (Lollipop only)
body: <p>I have an app widget that shows an image.</p>
  
  <pre><code>Uri uri = Uri.parse("android.resource://" + packageName + "/" + resId);
  rv = new RemoteViews(defaultPackageName, widgetLayout);
  rv.setImageViewUri(R.id.image, uri);
  </code></pre>
  
  <p>Images are stored in different packages under <code>drawable</code> directory, i am getting its resource id like so:</p>
  
  <pre><code>Resources r = getPackageManager().getResourcesForApplication(otherPackage);
  int resId = r.getIdentifier("image_1", "drawable", otherPackage);
  </code></pre>
  
  <p>Everything works correctly until the <code>image_1</code> is an xml bitmap, that has an <code>android:src</code> tag:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;bitmap xmlns:android="http://schemas.android.com/apk/res/android"
          android:src="@drawable/pat1"
          android:tileMode="repeat"/&gt;
  </code></pre>
  
  <p>After a long research, what i found out and what i have tried:</p>
  
  <ol>
  <li><p>The problem occurs only in lollipop (5.0, 5.1 etc...), and only in AppWidgetProvider (it works correctly if i use this resource inside activity).</p></li>
  <li><p>It is neither working with other methods like:</p>
  
  <pre><code>rv.setImageViewBitmap(R.id.image, BitmapFactory.decodeResource(r, resId));
  </code></pre></li>
  <li><p>It is getting the right resource id of <code>@drawable/pat1</code>, but taking the drawable with the same res id from default package. (I have checked that in <code>R.java</code> in both packages) If there is no resource with that id, it just puts nothing inside <code>R.id.image</code>, and the widgets appears to be blank.</p></li>
  <li><p>I have tried to hardcode the package name in <code>image_1.xml</code> like so:</p>
  
  <pre><code>android:src="@com.other.package.name:drawable/pat1"
  </code></pre>
  
  <p>wasn't helpful.</p></li>
  <li><p>The problem occurs on a real devices with different roms and launchers, as well as on an emulator.</p></li>
  </ol>
  
  <p>I hope i was clear, and hope someone faced similar problem and can share a solution or suggest more workarounds.</p>