@@ -6676,9 +6676,6 @@ private int reduceConfigLayout(int curLayout, int rotation, float density,
66766676 int h = mPolicy .getNonDecorDisplayHeight (dw , dh , rotation );
66776677
66786678 // Compute the screen layout size class for this rotation.
6679- int screenLayoutSize ;
6680- boolean screenLayoutLong ;
6681- boolean screenLayoutCompatNeeded ;
66826679 int longSize = w ;
66836680 int shortSize = h ;
66846681 if (longSize < shortSize ) {
@@ -6688,64 +6685,7 @@ private int reduceConfigLayout(int curLayout, int rotation, float density,
66886685 }
66896686 longSize = (int )(longSize /density );
66906687 shortSize = (int )(shortSize /density );
6691-
6692- // These semi-magic numbers define our compatibility modes for
6693- // applications with different screens. These are guarantees to
6694- // app developers about the space they can expect for a particular
6695- // configuration. DO NOT CHANGE!
6696- if (longSize < 470 ) {
6697- // This is shorter than an HVGA normal density screen (which
6698- // is 480 pixels on its long side).
6699- screenLayoutSize = Configuration .SCREENLAYOUT_SIZE_SMALL ;
6700- screenLayoutLong = false ;
6701- screenLayoutCompatNeeded = false ;
6702- } else {
6703- // What size is this screen screen?
6704- if (longSize >= 960 && shortSize >= 720 ) {
6705- // 1.5xVGA or larger screens at medium density are the point
6706- // at which we consider it to be an extra large screen.
6707- screenLayoutSize = Configuration .SCREENLAYOUT_SIZE_XLARGE ;
6708- } else if (longSize >= 640 && shortSize >= 480 ) {
6709- // VGA or larger screens at medium density are the point
6710- // at which we consider it to be a large screen.
6711- screenLayoutSize = Configuration .SCREENLAYOUT_SIZE_LARGE ;
6712- } else {
6713- screenLayoutSize = Configuration .SCREENLAYOUT_SIZE_NORMAL ;
6714- }
6715-
6716- // If this screen is wider than normal HVGA, or taller
6717- // than FWVGA, then for old apps we want to run in size
6718- // compatibility mode.
6719- if (shortSize > 321 || longSize > 570 ) {
6720- screenLayoutCompatNeeded = true ;
6721- } else {
6722- screenLayoutCompatNeeded = false ;
6723- }
6724-
6725- // Is this a long screen?
6726- if (((longSize *3 )/5 ) >= (shortSize -1 )) {
6727- // Anything wider than WVGA (5:3) is considering to be long.
6728- screenLayoutLong = true ;
6729- } else {
6730- screenLayoutLong = false ;
6731- }
6732- }
6733-
6734- // Now reduce the last screenLayout to not be better than what we
6735- // have found.
6736- if (!screenLayoutLong ) {
6737- curLayout = (curLayout &~Configuration .SCREENLAYOUT_LONG_MASK )
6738- | Configuration .SCREENLAYOUT_LONG_NO ;
6739- }
6740- if (screenLayoutCompatNeeded ) {
6741- curLayout |= Configuration .SCREENLAYOUT_COMPAT_NEEDED ;
6742- }
6743- int curSize = curLayout &Configuration .SCREENLAYOUT_SIZE_MASK ;
6744- if (screenLayoutSize < curSize ) {
6745- curLayout = (curLayout &~Configuration .SCREENLAYOUT_SIZE_MASK )
6746- | screenLayoutSize ;
6747- }
6748- return curLayout ;
6688+ return Configuration .reduceScreenLayout (curLayout , longSize , shortSize );
67496689 }
67506690
67516691 private void computeSizeRangesAndScreenLayout (DisplayInfo displayInfo , boolean rotated ,
@@ -6772,15 +6712,13 @@ private void computeSizeRangesAndScreenLayout(DisplayInfo displayInfo, boolean r
67726712 adjustDisplaySizeRanges (displayInfo , Surface .ROTATION_90 , unrotDh , unrotDw );
67736713 adjustDisplaySizeRanges (displayInfo , Surface .ROTATION_180 , unrotDw , unrotDh );
67746714 adjustDisplaySizeRanges (displayInfo , Surface .ROTATION_270 , unrotDh , unrotDw );
6775- int sl = Configuration .SCREENLAYOUT_SIZE_XLARGE
6776- | Configuration .SCREENLAYOUT_LONG_YES ;
6715+ int sl = Configuration .resetScreenLayout (outConfig .screenLayout );
67776716 sl = reduceConfigLayout (sl , Surface .ROTATION_0 , density , unrotDw , unrotDh );
67786717 sl = reduceConfigLayout (sl , Surface .ROTATION_90 , density , unrotDh , unrotDw );
67796718 sl = reduceConfigLayout (sl , Surface .ROTATION_180 , density , unrotDw , unrotDh );
67806719 sl = reduceConfigLayout (sl , Surface .ROTATION_270 , density , unrotDh , unrotDw );
67816720 outConfig .smallestScreenWidthDp = (int )(displayInfo .smallestNominalAppWidth / density );
6782- outConfig .screenLayout =
6783- sl |(outConfig .screenLayout &Configuration .SCREENLAYOUT_LAYOUTDIR_MASK );
6721+ outConfig .screenLayout = sl ;
67846722 }
67856723
67866724 private int reduceCompatConfigWidthSize (int curSize , int rotation , DisplayMetrics dm ,
0 commit comments