Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72eb0aca authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 5483 into donut

* changes:
  Expand support for different screen sizes.
parents 156411df 723738cf
Loading
Loading
Loading
Loading
+120 −33
Original line number Original line Diff line number Diff line
@@ -3452,39 +3452,6 @@
 visibility="public"
 visibility="public"
>
>
</field>
</field>
<field name="donut_resource_pad26"
 type="int"
 transient="false"
 volatile="false"
 value="16843398"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="donut_resource_pad27"
 type="int"
 transient="false"
 volatile="false"
 value="16843397"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="donut_resource_pad28"
 type="int"
 transient="false"
 volatile="false"
 value="16843396"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="donut_resource_pad3"
<field name="donut_resource_pad3"
 type="int"
 type="int"
 transient="false"
 transient="false"
@@ -5311,6 +5278,17 @@
 visibility="public"
 visibility="public"
>
>
</field>
</field>
<field name="largeScreens"
 type="int"
 transient="false"
 volatile="false"
 value="16843398"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="launchMode"
<field name="launchMode"
 type="int"
 type="int"
 transient="false"
 transient="false"
@@ -6191,6 +6169,17 @@
 visibility="public"
 visibility="public"
>
>
</field>
</field>
<field name="normalScreens"
 type="int"
 transient="false"
 volatile="false"
 value="16843397"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="numColumns"
<field name="numColumns"
 type="int"
 type="int"
 transient="false"
 transient="false"
@@ -7577,6 +7566,17 @@
 visibility="public"
 visibility="public"
>
>
</field>
</field>
<field name="smallScreens"
 type="int"
 transient="false"
 volatile="false"
 value="16843396"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="smoothScrollbar"
<field name="smoothScrollbar"
 type="int"
 type="int"
 transient="false"
 transient="false"
@@ -34821,6 +34821,17 @@
 visibility="public"
 visibility="public"
>
>
</field>
</field>
<field name="CONFIG_SCREEN_LAYOUT"
 type="int"
 transient="false"
 volatile="false"
 value="256"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="CONFIG_TOUCHSCREEN"
<field name="CONFIG_TOUCHSCREEN"
 type="int"
 type="int"
 transient="false"
 transient="false"
@@ -35286,6 +35297,28 @@
>
>
</field>
</field>
<field name="FLAG_SUPPORTS_LARGE_SCREENS"
<field name="FLAG_SUPPORTS_LARGE_SCREENS"
 type="int"
 transient="false"
 volatile="false"
 value="2048"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FLAG_SUPPORTS_NORMAL_SCREENS"
 type="int"
 transient="false"
 volatile="false"
 value="1024"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FLAG_SUPPORTS_SMALL_SCREENS"
 type="int"
 type="int"
 transient="false"
 transient="false"
 volatile="false"
 volatile="false"
@@ -39488,6 +39521,50 @@
 visibility="public"
 visibility="public"
>
>
</field>
</field>
<field name="SCREENLAYOUT_LARGE"
 type="int"
 transient="false"
 volatile="false"
 value="3"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="SCREENLAYOUT_NORMAL"
 type="int"
 transient="false"
 volatile="false"
 value="2"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="SCREENLAYOUT_SMALL"
 type="int"
 transient="false"
 volatile="false"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="SCREENLAYOUT_UNDEFINED"
 type="int"
 transient="false"
 volatile="false"
 value="0"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TOUCHSCREEN_FINGER"
<field name="TOUCHSCREEN_FINGER"
 type="int"
 type="int"
 transient="false"
 transient="false"
@@ -39622,6 +39699,16 @@
 visibility="public"
 visibility="public"
>
>
</field>
</field>
<field name="screenLayout"
 type="int"
 transient="false"
 volatile="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="touchscreen"
<field name="touchscreen"
 type="int"
 type="int"
 transient="false"
 transient="false"
+8 −2
Original line number Original line Diff line number Diff line
@@ -233,6 +233,12 @@ public class ActivityInfo extends ComponentInfo
     * {@link android.R.attr#configChanges} attribute.
     * {@link android.R.attr#configChanges} attribute.
     */
     */
    public static final int CONFIG_ORIENTATION = 0x0080;
    public static final int CONFIG_ORIENTATION = 0x0080;
    /**
     * Bit in {@link #configChanges} that indicates that the activity
     * can itself handle changes to the screen layout.  Set from the
     * {@link android.R.attr#configChanges} attribute.
     */
    public static final int CONFIG_SCREEN_LAYOUT = 0x0100;
    /**
    /**
     * Bit in {@link #configChanges} that indicates that the activity
     * Bit in {@link #configChanges} that indicates that the activity
     * can itself handle changes to the font scaling factor.  Set from the
     * can itself handle changes to the font scaling factor.  Set from the
@@ -248,8 +254,8 @@ public class ActivityInfo extends ComponentInfo
     * Contains any combination of {@link #CONFIG_FONT_SCALE},
     * Contains any combination of {@link #CONFIG_FONT_SCALE},
     * {@link #CONFIG_MCC}, {@link #CONFIG_MNC},
     * {@link #CONFIG_MCC}, {@link #CONFIG_MNC},
     * {@link #CONFIG_LOCALE}, {@link #CONFIG_TOUCHSCREEN},
     * {@link #CONFIG_LOCALE}, {@link #CONFIG_TOUCHSCREEN},
     * {@link #CONFIG_KEYBOARD}, {@link #CONFIG_NAVIGATION}, and
     * {@link #CONFIG_KEYBOARD}, {@link #CONFIG_NAVIGATION},
     * {@link #CONFIG_ORIENTATION}.  Set from the
     * {@link #CONFIG_ORIENTATION}, and {@link #CONFIG_SCREEN_LAYOUT}.  Set from the
     * {@link android.R.attr#configChanges} attribute.
     * {@link android.R.attr#configChanges} attribute.
     */
     */
    public int configChanges;
    public int configChanges;
+24 −5
Original line number Original line Diff line number Diff line
@@ -138,10 +138,27 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {


    /**
    /**
     * Value for {@link #flags}: true when the application's window can be
     * Value for {@link #flags}: true when the application's window can be
     * expanded over default window size in target density (320x480 for
     * reduced in size for smaller screens.  Corresponds to
     * 1.0 density, 480x720 for 1.5 density etc)
     * {@link android.R.styleable#AndroidManifestSupportsScreens_smallScreens
     * android:smallScreens}.
     */
     */
    public static final int FLAG_SUPPORTS_LARGE_SCREENS = 1<<9;
    public static final int FLAG_SUPPORTS_SMALL_SCREENS = 1<<9;
    
    /**
     * Value for {@link #flags}: true when the application's window can be
     * displayed on normal screens.  Corresponds to
     * {@link android.R.styleable#AndroidManifestSupportsScreens_normalScreens
     * android:normalScreens}.
     */
    public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1<<10; 
    
    /**
     * Value for {@link #flags}: true when the application's window can be
     * increased in size for larger screens.  Corresponds to
     * {@link android.R.styleable#AndroidManifestSupportsScreens_largeScreens
     * android:smallScreens}.
     */
    public static final int FLAG_SUPPORTS_LARGE_SCREENS = 1<<11;
    
    
    /**
    /**
     * Value for {@link #flags}: this is false if the application has set
     * Value for {@link #flags}: this is false if the application has set
@@ -149,7 +166,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     * 
     * 
     * {@hide}
     * {@hide}
     */
     */
    public static final int FLAG_ALLOW_BACKUP = 1<<10;
    public static final int FLAG_ALLOW_BACKUP = 1<<12;
    
    
    /**
    /**
     * Indicates that the application supports any densities;
     * Indicates that the application supports any densities;
@@ -164,7 +181,9 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     * {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and
     * {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and
     * {@link #FLAG_ALLOW_TASK_REPARENTING}
     * {@link #FLAG_ALLOW_TASK_REPARENTING}
     * {@link #FLAG_ALLOW_CLEAR_USER_DATA}, {@link #FLAG_UPDATED_SYSTEM_APP},
     * {@link #FLAG_ALLOW_CLEAR_USER_DATA}, {@link #FLAG_UPDATED_SYSTEM_APP},
     * {@link #FLAG_TEST_ONLY}.
     * {@link #FLAG_TEST_ONLY}, {@link #FLAG_SUPPORTS_SMALL_SCREENS},
     * {@link #FLAG_SUPPORTS_NORMAL_SCREENS},
     * {@link #FLAG_SUPPORTS_LARGE_SCREENS}.
     */
     */
    public int flags = 0;
    public int flags = 0;
    
    
+37 −3
Original line number Original line Diff line number Diff line
@@ -668,6 +668,11 @@ public class PackageParser {
        }
        }
        sa.recycle();
        sa.recycle();


        // Resource boolean are -1, so 1 means we don't know the value.
        int supportsSmallScreens = 1;
        int supportsNormalScreens = 1;
        int supportsLargeScreens = 1;
        
        int outerDepth = parser.getDepth();
        int outerDepth = parser.getDepth();
        while ((type=parser.next()) != parser.END_DOCUMENT
        while ((type=parser.next()) != parser.END_DOCUMENT
               && (type != parser.END_TAG || parser.getDepth() > outerDepth)) {
               && (type != parser.END_TAG || parser.getDepth() > outerDepth)) {
@@ -876,8 +881,24 @@ public class PackageParser {


                XmlUtils.skipCurrentTag(parser);
                XmlUtils.skipCurrentTag(parser);


            } else if (tagName.equals("expandable")) {
            } else if (tagName.equals("supports-screens")) {
                pkg.applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS;
                sa = res.obtainAttributes(attrs,
                        com.android.internal.R.styleable.AndroidManifestSupportsScreens);

                // This is a trick to get a boolean and still able to detect
                // if a value was actually set.
                supportsSmallScreens = sa.getInteger(
                        com.android.internal.R.styleable.AndroidManifestSupportsScreens_smallScreens,
                        supportsSmallScreens);
                supportsNormalScreens = sa.getInteger(
                        com.android.internal.R.styleable.AndroidManifestSupportsScreens_normalScreens,
                        supportsNormalScreens);
                supportsLargeScreens = sa.getInteger(
                        com.android.internal.R.styleable.AndroidManifestSupportsScreens_largeScreens,
                        supportsLargeScreens);

                sa.recycle();
                
                XmlUtils.skipCurrentTag(parser);
                XmlUtils.skipCurrentTag(parser);
            } else {
            } else {
                Log.w(TAG, "Bad element under <manifest>: "
                Log.w(TAG, "Bad element under <manifest>: "
@@ -910,7 +931,20 @@ public class PackageParser {
            pkg.usesLibraryFiles = new String[pkg.usesLibraries.size()];
            pkg.usesLibraryFiles = new String[pkg.usesLibraries.size()];
            pkg.usesLibraries.toArray(pkg.usesLibraryFiles);
            pkg.usesLibraries.toArray(pkg.usesLibraryFiles);
        }
        }
        // TODO: enable all density & expandable if target sdk is higher than donut 
        
        if (supportsSmallScreens < 0 || (supportsSmallScreens > 0
                && pkg.applicationInfo.targetSdkVersion
                        >= android.os.Build.VERSION_CODES.CUR_DEVELOPMENT)) {
            pkg.applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_SMALL_SCREENS;
        }
        if (supportsNormalScreens != 0) {
            pkg.applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_NORMAL_SCREENS;
        }
        if (supportsLargeScreens < 0 || (supportsLargeScreens > 0
                && pkg.applicationInfo.targetSdkVersion
                        >= android.os.Build.VERSION_CODES.CUR_DEVELOPMENT)) {
            pkg.applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS;
        }
        
        
        int size = pkg.supportsDensityList.size();
        int size = pkg.supportsDensityList.size();
        if (size > 0) {
        if (size > 0) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -601,7 +601,7 @@ public final class AssetManager {
    public native final void setConfiguration(int mcc, int mnc, String locale,
    public native final void setConfiguration(int mcc, int mnc, String locale,
            int orientation, int touchscreen, int density, int keyboard,
            int orientation, int touchscreen, int density, int keyboard,
            int keyboardHidden, int navigation, int screenWidth, int screenHeight,
            int keyboardHidden, int navigation, int screenWidth, int screenHeight,
            int majorVersion);
            int screenLayout, int majorVersion);


    /**
    /**
     * Retrieve the resource identifier for the given resource name.
     * Retrieve the resource identifier for the given resource name.
Loading