Android Emulator reports 600x1024 MDPI as XLarge?

I am currently trying to test an existing application for compatibility with the soon-released Amazon Kindle Fire tablet. It is said to install an emulator with a resolution of 600x1024 and an LCD density of 169 ( https://developer.amazon.com/help/faq.html?ref_=pe_132830_21362890#KindleFire , although they said 160 by email instead of 169 by email) and that it should report as "large" and not "xlarge" (I get this from the return and fourth email with their support team, where I complain that this does not work).

Google seems to support this as true in its testing section for multiple screen sizes when they list this resolution, and MDPI as "large" ( http://developer.android.com/guide/practices/screens_support.html# testing ). However, at any time, when I include the "layout-xlarge" folder along with "layout-large", the emulator always loads "xlarge". If I change the density of the LCD to something like 240, it will load “large” instead of “xlarge”, but this should not be correct, and I am worried that this means that it will not work on the final device. To test this, I took a sample API-10 “Multi-Res” and created a series of folders with the layouts described above, and each time it downloaded “xlarge” if it was there and it would load “large” if there was no "xlarge".

So, my question is, am I reading the documentation correctly or if my emulator somehow messed up with the fact that people at Amazon insist that they should report as "big", that if that were the case, it would would never download "xlarge" correctly?

Here is what I have in the manifest in the Multi-Res example that I modified to verify this:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android.multires" android:versionCode="1" android:versionName="1.0"> <uses-permission android:name="android.permission.INTERNET"/> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name"> <activity android:name=".MultiRes" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="4" /> <supports-screens android:anyDensity="true" android:xlargeScreens="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" /> </manifest> 
+8
android kindle-fire resolution emulation
source share
1 answer

This seems like a bug in the documentation. If we look at the actual code that is used to calculate the screen size, we will see that a screen of 600x1024 with a resolution of 160 dpi will really be considered xlarge.

Do not take my word for it. The implementation is in WindowManagerService.computeNewConfigurationLocked () (warning for slow JavaScript). Interesting bits are as follows. The screen size in pixels scales depending on the density:

  longSize = (int)(longSize/dm.density); shortSize = (int)(shortSize/dm.density); 

For the mdpi screen (160 dpi), dm.density will be 1.0. For hdpi (240 dpi) it will be 1.5. In our case, we have an mdpi screen. So, after executing this code, longSize == 1024 and shortSize == 600 . Soon after, we get the following code:

  // What size is this screen screen? if (longSize >= 800 && shortSize >= 600) { // SVGA or larger screens at medium density are the point // at which we consider it to be an extra large screen. mScreenLayout = Configuration.SCREENLAYOUT_SIZE_XLARGE; } else if ( // ... 

which with our longSize and shortSize means that mScreenLayout will be assigned to Configuration.SCREENLAYOUT_SIZE_XLARGE , in other words, the screen will be considered "xlarge". It is interesting to note that if the screen were one pixel smaller on the short side, it could only be considered "large."

So, you are reading the documentation correctly, but as far as I can see, the documentation is incorrect, and your emulator is fine.

+6
source share

All Articles