title: Which part of Android is in charge of picking a correct resource profile?
body: <p>I have a weird problem.</p>
  
  <p>Before you come to an idea to lash out on me, I am working on a custom Jelly Bean. Therefore the "usual nice approaches" might not work here, and dirty workarounds have to be made.</p>
  
  <p>I have an APK which contains the following in assets:</p>
  
  <pre><code>layout
  layout-mdpi
  layout-land
  layout-large-mdpi
  layout-large-land-mdpi
  layout-large-hdpi
  layout-large-xhdpi
  </code></pre>
  
  <p>And some other metrics code returned this:</p>
  
  <pre><code>D/AppDemo( 2091): measured width: 1920 PE width: 1920 scaleFactor = 1.0
  D/AppDemo( 2091): [ANDROID] measured width: 1920 measured height: 1080
  D/AppDemo( 2091): [ANDROID] scale for resources: 2.0 xdpi: 320.0 ydpi: 320.0
  D/AppDemo( 2091): [ANDROID] screen density: xhdpi
  D/AppDemo( 2091): [ANDROID] screen size: large
  D/AppDemo( 2091): [ANDROID] using layout: layout-mdpi
  </code></pre>
  
  <p>So, looking at the metrics, why isn't <code>layout-large-xhdpi</code> being loaded?</p>
  
  <p>Please, tell me where I can look this up. I really need to find a way to force the Layout/Resource/<code>AssetManager</code> to load a specific layout.</p>
  
  <p>I am aware the most popular comment on this issue is "you do not need / why do you have <code>layout-xhdpi</code>, you should have <code>drawable-xhdpi</code> and <code>layout-large</code>" but, bear with me.</p>
  
  <p>I would very appreciate even small hints as to where to look at, and what to look for. So far, <code>AssetManager</code> seems like the place to start digging/logging.</p>
  
  <p>When I omit <code>layout-mdpi</code>, the application crashes on me, with missing resources. The bug seems to be that even though the code returns <code>xhdpi</code>, it assumes <code>mdpi</code> somewhere else. I need to find this, and fix it so my apps look as nice as they did on ICS :)</p>
  
  <p>I am figuring out which layout is loaded in a simple manner - all root layouts have a <code>android:tag</code> element, and when I <code>setContentView(R.layout.main_layout)</code> I grab the tag on the root element and know which folder got loaded. Apart from the visual feedback, this will eventually have to match with my device configuration.</p>
  
  <p>Thanks in advance.</p>