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

Commit ef05e076 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Fix issue #2448075: aapt doesn't fix up activity-alias android:targetActivity links

And related:

- The aapt tool now sets a resource configurations sdk level to match any configs
  that have been set (for example if you specify density your sdk level will be
  at least 4).
- New option to modify the targetPackage attribute of instrumentation.
- Clean up of aapt options help.
- Fix of UI type values to leave 0 for "unspecified".
- Make the UI mode config APIs public.
parent 883dbacb
Loading
Loading
Loading
Loading
+109 −0
Original line number Diff line number Diff line
@@ -42377,6 +42377,17 @@
 visibility="public"
>
</field>
<field name="CONFIG_UI_MODE"
 type="int"
 transient="false"
 volatile="false"
 value="512"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="CREATOR"
 type="android.os.Parcelable.Creator"
 transient="false"
@@ -47830,6 +47841,94 @@
 visibility="public"
>
</field>
<field name="UI_MODE_NIGHT_MASK"
 type="int"
 transient="false"
 volatile="false"
 value="48"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="UI_MODE_NIGHT_NO"
 type="int"
 transient="false"
 volatile="false"
 value="16"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="UI_MODE_NIGHT_UNDEFINED"
 type="int"
 transient="false"
 volatile="false"
 value="0"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="UI_MODE_NIGHT_YES"
 type="int"
 transient="false"
 volatile="false"
 value="32"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="UI_MODE_TYPE_CAR"
 type="int"
 transient="false"
 volatile="false"
 value="2"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="UI_MODE_TYPE_MASK"
 type="int"
 transient="false"
 volatile="false"
 value="15"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="UI_MODE_TYPE_NORMAL"
 type="int"
 transient="false"
 volatile="false"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="UI_MODE_TYPE_UNDEFINED"
 type="int"
 transient="false"
 volatile="false"
 value="0"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="fontScale"
 type="float"
 transient="false"
@@ -47950,6 +48049,16 @@
 visibility="public"
>
</field>
<field name="uiMode"
 type="int"
 transient="false"
 volatile="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="Resources"
 extends="java.lang.Object"
+0 −1
Original line number Diff line number Diff line
@@ -253,7 +253,6 @@ public class ActivityInfo extends ComponentInfo
     * Bit in {@link #configChanges} that indicates that the activity
     * can itself handle the ui mode. Set from the
     * {@link android.R.attr#configChanges} attribute.
     * @hide (UIMODE) Pending API council approval
     */
    public static final int CONFIG_UI_MODE = 0x0200;
    /**
+3 −11
Original line number Diff line number Diff line
@@ -162,20 +162,14 @@ public final class Configuration implements Parcelable, Comparable<Configuration
     */
    public int orientation;

    /** @hide (UIMODE) Pending API council approval */
    public static final int UI_MODE_TYPE_MASK = 0x0f;
    /** @hide (UIMODE) Pending API council approval */
    public static final int UI_MODE_TYPE_NORMAL = 0x00;
    /** @hide (UIMODE) Pending API council approval */
    public static final int UI_MODE_TYPE_CAR = 0x01;
    public static final int UI_MODE_TYPE_UNDEFINED = 0x00;
    public static final int UI_MODE_TYPE_NORMAL = 0x01;
    public static final int UI_MODE_TYPE_CAR = 0x02;

    /** @hide (UIMODE) Pending API council approval */
    public static final int UI_MODE_NIGHT_MASK = 0x30;
    /** @hide (UIMODE) Pending API council approval */
    public static final int UI_MODE_NIGHT_UNDEFINED = 0x00;
    /** @hide (UIMODE) Pending API council approval */
    public static final int UI_MODE_NIGHT_NO = 0x10;
    /** @hide (UIMODE) Pending API council approval */
    public static final int UI_MODE_NIGHT_YES = 0x20;

    /**
@@ -187,8 +181,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration
     * <p>The {@link #UI_MODE_NIGHT_MASK} defines whether the screen
     * is in a special mode. They may be one of
     * {@link #UI_MODE_NIGHT_NO} or {@link #UI_MODE_NIGHT_YES}.
     *
     * @hide (UIMODE) Pending API council approval
     */
    public int uiMode;

+7 −6
Original line number Diff line number Diff line
@@ -944,8 +944,9 @@ struct ResTable_config
    enum {
        // uiMode bits for the mode type.
        MASK_UI_MODE_TYPE = 0x0f,
        UI_MODE_TYPE_NORMAL = 0x00,
        UI_MODE_TYPE_CAR = 0x01,
        UI_MODE_TYPE_ANY = 0x00,
        UI_MODE_TYPE_NORMAL = 0x01,
        UI_MODE_TYPE_CAR = 0x02,

        // uiMode bits for the night switch.
        MASK_UI_MODE_NIGHT = 0x30,
@@ -1086,7 +1087,7 @@ struct ResTable_config
            }
        }

        if (screenConfig || o.screenConfig) {
        if (screenLayout || o.screenLayout) {
            if (((screenLayout^o.screenLayout) & MASK_SCREENSIZE) != 0) {
                if (!(screenLayout & MASK_SCREENSIZE)) return false;
                if (!(o.screenLayout & MASK_SCREENSIZE)) return true;
@@ -1102,7 +1103,7 @@ struct ResTable_config
            if (!o.orientation) return true;
        }

        if (screenConfig || o.screenConfig) {
        if (uiMode || o.uiMode) {
            if (((uiMode^o.uiMode) & MASK_UI_MODE_TYPE) != 0) {
                if (!(uiMode & MASK_UI_MODE_TYPE)) return false;
                if (!(o.uiMode & MASK_UI_MODE_TYPE)) return true;
@@ -1203,7 +1204,7 @@ struct ResTable_config
                }
            }

            if (screenConfig || o.screenConfig) {
            if (screenLayout || o.screenLayout) {
                if (((screenLayout^o.screenLayout) & MASK_SCREENSIZE) != 0
                        && (requested->screenLayout & MASK_SCREENSIZE)) {
                    return (screenLayout & MASK_SCREENSIZE);
@@ -1218,7 +1219,7 @@ struct ResTable_config
                return (orientation);
            }

            if (screenConfig || o.screenConfig) {
            if (uiMode || o.uiMode) {
                if (((uiMode^o.uiMode) & MASK_UI_MODE_TYPE) != 0
                        && (requested->uiMode & MASK_UI_MODE_TYPE)) {
                    return (uiMode & MASK_UI_MODE_TYPE);
+159 −16
Original line number Diff line number Diff line
@@ -4149,22 +4149,165 @@ void ResTable::print(bool inclValues) const
                    } else {
                        sprintf(density, "%d", (int)dval);
                    }
                    printf("      config %d lang=%c%c cnt=%c%c orien=%d touch=%d density=%s key=%d infl=%d nav=%d w=%d h=%d sz=%d lng=%d\n",
                           (int)configIndex,
                    printf("      config %d", (int)configIndex);
                    if (type->config.mcc != 0) {
                        printf(" mcc=%d", dtohs(type->config.mcc));
                    }
                    if (type->config.mnc != 0) {
                        printf(" mnc=%d", dtohs(type->config.mnc));
                    }
                    if (type->config.locale != 0) {
                        printf(" lang=%c%c cnt=%c%c",
                               type->config.language[0] ? type->config.language[0] : '-',
                               type->config.language[1] ? type->config.language[1] : '-',
                               type->config.country[0] ? type->config.country[0] : '-',
                           type->config.country[1] ? type->config.country[1] : '-',
                           type->config.orientation,
                           type->config.touchscreen,
                           density,
                           type->config.keyboard,
                           type->config.inputFlags,
                           type->config.navigation,
                           dtohs(type->config.screenWidth),
                           dtohs(type->config.screenHeight),
                           type->config.screenLayout&ResTable_config::MASK_SCREENSIZE,
                               type->config.country[1] ? type->config.country[1] : '-');
                    }
                    if (type->config.screenLayout != 0) {
                        printf(" sz=%d",
                                type->config.screenLayout&ResTable_config::MASK_SCREENSIZE);
                        switch (type->config.screenLayout&ResTable_config::MASK_SCREENSIZE) {
                            case ResTable_config::SCREENSIZE_SMALL:
                                printf(" (small)");
                                break;
                            case ResTable_config::SCREENSIZE_NORMAL:
                                printf(" (normal)");
                                break;
                            case ResTable_config::SCREENSIZE_LARGE:
                                printf(" (large)");
                                break;
                        }
                        printf(" lng=%d",
                                type->config.screenLayout&ResTable_config::MASK_SCREENLONG);
                        switch (type->config.screenLayout&ResTable_config::MASK_SCREENLONG) {
                            case ResTable_config::SCREENLONG_NO:
                                printf(" (notlong)");
                                break;
                            case ResTable_config::SCREENLONG_YES:
                                printf(" (long)");
                                break;
                        }
                    }
                    if (type->config.orientation != 0) {
                        printf(" orient=%d", type->config.orientation);
                        switch (type->config.orientation) {
                            case ResTable_config::ORIENTATION_PORT:
                                printf(" (port)");
                                break;
                            case ResTable_config::ORIENTATION_LAND:
                                printf(" (land)");
                                break;
                            case ResTable_config::ORIENTATION_SQUARE:
                                printf(" (square)");
                                break;
                        }
                    }
                    if (type->config.uiMode != 0) {
                        printf(" type=%d",
                                type->config.uiMode&ResTable_config::MASK_UI_MODE_TYPE);
                        switch (type->config.uiMode&ResTable_config::MASK_UI_MODE_TYPE) {
                            case ResTable_config::UI_MODE_TYPE_NORMAL:
                                printf(" (normal)");
                                break;
                            case ResTable_config::UI_MODE_TYPE_CAR:
                                printf(" (car)");
                                break;
                        }
                        printf(" night=%d",
                                type->config.uiMode&ResTable_config::MASK_UI_MODE_NIGHT);
                        switch (type->config.uiMode&ResTable_config::MASK_UI_MODE_NIGHT) {
                            case ResTable_config::UI_MODE_NIGHT_NO:
                                printf(" (no)");
                                break;
                            case ResTable_config::UI_MODE_NIGHT_YES:
                                printf(" (yes)");
                                break;
                        }
                    }
                    if (dval != 0) {
                        printf(" density=%s", density);
                    }
                    if (type->config.touchscreen != 0) {
                        printf(" touch=%d", type->config.touchscreen);
                        switch (type->config.touchscreen) {
                            case ResTable_config::TOUCHSCREEN_NOTOUCH:
                                printf(" (notouch)");
                                break;
                            case ResTable_config::TOUCHSCREEN_STYLUS:
                                printf(" (stylus)");
                                break;
                            case ResTable_config::TOUCHSCREEN_FINGER:
                                printf(" (finger)");
                                break;
                        }
                    }
                    if (type->config.inputFlags != 0) {
                        printf(" keyhid=%d", type->config.inputFlags&ResTable_config::MASK_KEYSHIDDEN);
                        switch (type->config.inputFlags&ResTable_config::MASK_KEYSHIDDEN) {
                            case ResTable_config::KEYSHIDDEN_NO:
                                printf(" (no)");
                                break;
                            case ResTable_config::KEYSHIDDEN_YES:
                                printf(" (yes)");
                                break;
                            case ResTable_config::KEYSHIDDEN_SOFT:
                                printf(" (soft)");
                                break;
                        }
                        printf(" navhid=%d", type->config.inputFlags&ResTable_config::MASK_NAVHIDDEN);
                        switch (type->config.inputFlags&ResTable_config::MASK_NAVHIDDEN) {
                            case ResTable_config::NAVHIDDEN_NO:
                                printf(" (no)");
                                break;
                            case ResTable_config::NAVHIDDEN_YES:
                                printf(" (yes)");
                                break;
                        }
                    }
                    if (type->config.keyboard != 0) {
                        printf(" kbd=%d", type->config.keyboard);
                        switch (type->config.keyboard) {
                            case ResTable_config::KEYBOARD_NOKEYS:
                                printf(" (nokeys)");
                                break;
                            case ResTable_config::KEYBOARD_QWERTY:
                                printf(" (qwerty)");
                                break;
                            case ResTable_config::KEYBOARD_12KEY:
                                printf(" (12key)");
                                break;
                        }
                    }
                    if (type->config.navigation != 0) {
                        printf(" nav=%d", type->config.navigation);
                        switch (type->config.navigation) {
                            case ResTable_config::NAVIGATION_NONAV:
                                printf(" (nonav)");
                                break;
                            case ResTable_config::NAVIGATION_DPAD:
                                printf(" (dpad)");
                                break;
                            case ResTable_config::NAVIGATION_TRACKBALL:
                                printf(" (trackball)");
                                break;
                            case ResTable_config::NAVIGATION_WHEEL:
                                printf(" (wheel)");
                                break;
                        }
                    }
                    if (type->config.screenWidth != 0) {
                        printf(" w=%d", dtohs(type->config.screenWidth));
                    }
                    if (type->config.screenHeight != 0) {
                        printf(" h=%d", dtohs(type->config.screenHeight));
                    }
                    if (type->config.sdkVersion != 0) {
                        printf(" sdk=%d", dtohs(type->config.sdkVersion));
                    }
                    if (type->config.minorVersion != 0) {
                        printf(" mver=%d", dtohs(type->config.minorVersion));
                    }
                    printf("\n");
                    size_t entryCount = dtohl(type->entryCount);
                    uint32_t entriesStart = dtohl(type->entriesStart);
                    if ((entriesStart&0x3) != 0) {
Loading