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

Commit 14cee9f6 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

New xlarge screen size.

Not complete, only for experimentation at this point.

This includes a reworking of how screen size configurations are matched,
so that if you are on a larger screen we can select configurations for
smaller screens if there aren't any exactly matching the current screen.

The screen size at which we switch to xlarge has been arbitrarily
chosen; the compatibility behavior has not yet been defined.

Change-Id: I1a33b3818eeb51a68fb72397568c39ab040a07f5
parent 3fd6419f
Loading
Loading
Loading
Loading
+44 −0
Original line number Original line Diff line number Diff line
@@ -46299,6 +46299,17 @@
 visibility="public"
 visibility="public"
>
>
</field>
</field>
<field name="FLAG_SUPPORTS_XLARGE_SCREENS"
 type="int"
 transient="false"
 volatile="false"
 value="524288"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FLAG_SYSTEM"
<field name="FLAG_SYSTEM"
 type="int"
 type="int"
 transient="false"
 transient="false"
@@ -51419,6 +51430,17 @@
 visibility="public"
 visibility="public"
>
>
</field>
</field>
<field name="SCREENLAYOUT_SIZE_XLARGE"
 type="int"
 transient="false"
 volatile="false"
 value="4"
 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"
@@ -116348,6 +116370,28 @@
 visibility="public"
 visibility="public"
>
>
</field>
</field>
<field name="GINGERBREAD"
 type="int"
 transient="false"
 volatile="false"
 value="10000"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="KRAKEN"
 type="int"
 transient="false"
 volatile="false"
 value="10000"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
</class>
<class name="Bundle"
<class name="Bundle"
 extends="java.lang.Object"
 extends="java.lang.Object"
+23 −14
Original line number Original line Diff line number Diff line
@@ -251,16 +251,6 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     */
     */
    public static final int FLAG_RESTORE_ANY_VERSION = 1<<17;
    public static final int FLAG_RESTORE_ANY_VERSION = 1<<17;


    /**
     * Value for {@link #flags}: this is true if the application has set
     * its android:neverEncrypt to true, false otherwise. It is used to specify
     * that this package specifically "opts-out" of a secured file system solution,
     * and will always store its data in-the-clear.
     *
     * {@hide}
     */
    public static final int FLAG_NEVER_ENCRYPT = 1<<18;

    /**
    /**
     * Value for {@link #flags}: Set to true if the application has been
     * Value for {@link #flags}: Set to true if the application has been
     * installed using the forward lock option.
     * installed using the forward lock option.
@@ -274,13 +264,31 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     */
     */
    public static final int FLAG_EXTERNAL_STORAGE = 1<<18;
    public static final int FLAG_EXTERNAL_STORAGE = 1<<18;


    /**
     * Value for {@link #flags}: true when the application's window can be
     * increased in size for extra large screens.  Corresponds to
     * {@link android.R.styleable#AndroidManifestSupportsScreens_xlargeScreens
     * android:smallScreens}.
     */
    public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 1<<19;
    
    /**
     * Value for {@link #flags}: this is true if the application has set
     * its android:neverEncrypt to true, false otherwise. It is used to specify
     * that this package specifically "opts-out" of a secured file system solution,
     * and will always store its data in-the-clear.
     *
     * {@hide}
     */
    public static final int FLAG_NEVER_ENCRYPT = 1<<30;

    /**
    /**
     * Value for {@link #flags}: Set to true if the application has been
     * Value for {@link #flags}: Set to true if the application has been
     * installed using the forward lock option.
     * installed using the forward lock option.
     *
     *
     * {@hide}
     * {@hide}
     */
     */
    public static final int FLAG_FORWARD_LOCK = 1<<20;
    public static final int FLAG_FORWARD_LOCK = 1<<29;


    /**
    /**
     * Value for {@link #flags}: Set to true if the application is
     * Value for {@link #flags}: Set to true if the application is
@@ -288,7 +296,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     *
     *
     * {@hide}
     * {@hide}
     */
     */
    public static final int FLAG_NATIVE_DEBUGGABLE = 1<<21;
    public static final int FLAG_NATIVE_DEBUGGABLE = 1<<28;


    /**
    /**
     * Flags associated with the application.  Any combination of
     * Flags associated with the application.  Any combination of
@@ -298,7 +306,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     * {@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_SUPPORTS_SMALL_SCREENS},
     * {@link #FLAG_TEST_ONLY}, {@link #FLAG_SUPPORTS_SMALL_SCREENS},
     * {@link #FLAG_SUPPORTS_NORMAL_SCREENS},
     * {@link #FLAG_SUPPORTS_NORMAL_SCREENS},
     * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_RESIZEABLE_FOR_SCREENS},
     * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_SUPPORTS_XLARGE_SCREENS},
     * {@link #FLAG_RESIZEABLE_FOR_SCREENS},
     * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}, {@link #FLAG_VM_SAFE_MODE}
     * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}, {@link #FLAG_VM_SAFE_MODE}
     */
     */
    public int flags = 0;
    public int flags = 0;
@@ -530,7 +539,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
    public void disableCompatibilityMode() {
    public void disableCompatibilityMode() {
        flags |= (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS |
        flags |= (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS |
                FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS |
                FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS |
                FLAG_SUPPORTS_SCREEN_DENSITIES);
                FLAG_SUPPORTS_SCREEN_DENSITIES | FLAG_SUPPORTS_XLARGE_SCREENS);
    }
    }
    
    
    /**
    /**
+10 −1
Original line number Original line Diff line number Diff line
@@ -791,6 +791,7 @@ public class PackageParser {
        int supportsSmallScreens = 1;
        int supportsSmallScreens = 1;
        int supportsNormalScreens = 1;
        int supportsNormalScreens = 1;
        int supportsLargeScreens = 1;
        int supportsLargeScreens = 1;
        int supportsXLargeScreens = 1;
        int resizeable = 1;
        int resizeable = 1;
        int anyDensity = 1;
        int anyDensity = 1;
        
        
@@ -998,9 +999,12 @@ public class PackageParser {
                supportsLargeScreens = sa.getInteger(
                supportsLargeScreens = sa.getInteger(
                        com.android.internal.R.styleable.AndroidManifestSupportsScreens_largeScreens,
                        com.android.internal.R.styleable.AndroidManifestSupportsScreens_largeScreens,
                        supportsLargeScreens);
                        supportsLargeScreens);
                supportsXLargeScreens = sa.getInteger(
                        com.android.internal.R.styleable.AndroidManifestSupportsScreens_xlargeScreens,
                        supportsXLargeScreens);
                resizeable = sa.getInteger(
                resizeable = sa.getInteger(
                        com.android.internal.R.styleable.AndroidManifestSupportsScreens_resizeable,
                        com.android.internal.R.styleable.AndroidManifestSupportsScreens_resizeable,
                        supportsLargeScreens);
                        resizeable);
                anyDensity = sa.getInteger(
                anyDensity = sa.getInteger(
                        com.android.internal.R.styleable.AndroidManifestSupportsScreens_anyDensity,
                        com.android.internal.R.styleable.AndroidManifestSupportsScreens_anyDensity,
                        anyDensity);
                        anyDensity);
@@ -1134,6 +1138,11 @@ public class PackageParser {
                        >= android.os.Build.VERSION_CODES.DONUT)) {
                        >= android.os.Build.VERSION_CODES.DONUT)) {
            pkg.applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS;
            pkg.applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS;
        }
        }
        if (supportsXLargeScreens < 0 || (supportsXLargeScreens > 0
                && pkg.applicationInfo.targetSdkVersion
                        >= android.os.Build.VERSION_CODES.GINGERBREAD)) {
            pkg.applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS;
        }
        if (resizeable < 0 || (resizeable > 0
        if (resizeable < 0 || (resizeable > 0
                && pkg.applicationInfo.targetSdkVersion
                && pkg.applicationInfo.targetSdkVersion
                        >= android.os.Build.VERSION_CODES.DONUT)) {
                        >= android.os.Build.VERSION_CODES.DONUT)) {
+38 −1
Original line number Original line Diff line number Diff line
@@ -99,7 +99,22 @@ public class CompatibilityInfo {
     */
     */
    private static final int CONFIGURED_LARGE_SCREENS = 16; 
    private static final int CONFIGURED_LARGE_SCREENS = 16; 


    private static final int SCALING_EXPANDABLE_MASK = SCALING_REQUIRED | EXPANDABLE | LARGE_SCREENS;
    /**
     * A flag mask to indicates that the application supports xlarge screens.
     * The flag is set to true if
     * 1) Application declares it supports xlarge screens in manifest file using <supports-screens> or
     * 2) The screen size is not xlarge
     * {@see compatibilityFlag}
     */
    private static final int XLARGE_SCREENS = 32;
    
    /**
     * A flag mask to tell if the application supports xlarge screens. This differs
     * from XLARGE_SCREENS in that the application that does not support xlarge
     * screens will be marked as supporting them if the current screen is not
     * xlarge.
     */
    private static final int CONFIGURED_XLARGE_SCREENS = 64;


    /**
    /**
     * The effective screen density we have selected for this application.
     * The effective screen density we have selected for this application.
@@ -127,6 +142,9 @@ public class CompatibilityInfo {
        if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS) != 0) {
        if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS) != 0) {
            mCompatibilityFlags |= LARGE_SCREENS | CONFIGURED_LARGE_SCREENS;
            mCompatibilityFlags |= LARGE_SCREENS | CONFIGURED_LARGE_SCREENS;
        }
        }
        if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS) != 0) {
            mCompatibilityFlags |= XLARGE_SCREENS | CONFIGURED_XLARGE_SCREENS;
        }
        if ((appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) != 0) {
        if ((appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) != 0) {
            mCompatibilityFlags |= EXPANDABLE | CONFIGURED_EXPANDABLE;
            mCompatibilityFlags |= EXPANDABLE | CONFIGURED_EXPANDABLE;
        }
        }
@@ -157,6 +175,7 @@ public class CompatibilityInfo {
        this(ApplicationInfo.FLAG_SUPPORTS_SMALL_SCREENS
        this(ApplicationInfo.FLAG_SUPPORTS_SMALL_SCREENS
                | ApplicationInfo.FLAG_SUPPORTS_NORMAL_SCREENS
                | ApplicationInfo.FLAG_SUPPORTS_NORMAL_SCREENS
                | ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS
                | ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS
                | ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS
                | ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS,
                | ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS,
                EXPANDABLE | CONFIGURED_EXPANDABLE,
                EXPANDABLE | CONFIGURED_EXPANDABLE,
                DisplayMetrics.DENSITY_DEVICE,
                DisplayMetrics.DENSITY_DEVICE,
@@ -195,6 +214,17 @@ public class CompatibilityInfo {
        }
        }
    }
    }


    /**
     * Sets large screen bit in the compatibility flag.
     */
    public void setXLargeScreens(boolean expandable) {
        if (expandable) {
            mCompatibilityFlags |= CompatibilityInfo.XLARGE_SCREENS;
        } else {
            mCompatibilityFlags &= ~CompatibilityInfo.XLARGE_SCREENS;
        }
    }

    /**
    /**
     * @return true if the application is configured to be expandable.
     * @return true if the application is configured to be expandable.
     */
     */
@@ -209,6 +239,13 @@ public class CompatibilityInfo {
        return (mCompatibilityFlags & CompatibilityInfo.CONFIGURED_LARGE_SCREENS) != 0;
        return (mCompatibilityFlags & CompatibilityInfo.CONFIGURED_LARGE_SCREENS) != 0;
    }
    }


    /**
     * @return true if the application is configured to be expandable.
     */
    public boolean isConfiguredXLargeScreens() {
        return (mCompatibilityFlags & CompatibilityInfo.CONFIGURED_XLARGE_SCREENS) != 0;
    }

    /**
    /**
     * @return true if the scaling is required
     * @return true if the scaling is required
     */
     */
+2 −1
Original line number Original line Diff line number Diff line
@@ -62,6 +62,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
    public static final int SCREENLAYOUT_SIZE_SMALL = 0x01;
    public static final int SCREENLAYOUT_SIZE_SMALL = 0x01;
    public static final int SCREENLAYOUT_SIZE_NORMAL = 0x02;
    public static final int SCREENLAYOUT_SIZE_NORMAL = 0x02;
    public static final int SCREENLAYOUT_SIZE_LARGE = 0x03;
    public static final int SCREENLAYOUT_SIZE_LARGE = 0x03;
    public static final int SCREENLAYOUT_SIZE_XLARGE = 0x04;
    
    
    public static final int SCREENLAYOUT_LONG_MASK = 0x30;
    public static final int SCREENLAYOUT_LONG_MASK = 0x30;
    public static final int SCREENLAYOUT_LONG_UNDEFINED = 0x00;
    public static final int SCREENLAYOUT_LONG_UNDEFINED = 0x00;
@@ -82,7 +83,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
     * <p>The {@link #SCREENLAYOUT_SIZE_MASK} bits define the overall size
     * <p>The {@link #SCREENLAYOUT_SIZE_MASK} bits define the overall size
     * of the screen.  They may be one of
     * of the screen.  They may be one of
     * {@link #SCREENLAYOUT_SIZE_SMALL}, {@link #SCREENLAYOUT_SIZE_NORMAL},
     * {@link #SCREENLAYOUT_SIZE_SMALL}, {@link #SCREENLAYOUT_SIZE_NORMAL},
     * or {@link #SCREENLAYOUT_SIZE_LARGE}.
     * {@link #SCREENLAYOUT_SIZE_LARGE}, or {@link #SCREENLAYOUT_SIZE_XLARGE}.
     * 
     * 
     * <p>The {@link #SCREENLAYOUT_LONG_MASK} defines whether the screen
     * <p>The {@link #SCREENLAYOUT_LONG_MASK} defines whether the screen
     * is wider/taller than normal.  They may be one of
     * is wider/taller than normal.  They may be one of
Loading