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

Commit fde3f83c authored by Fabrice Di Meglio's avatar Fabrice Di Meglio Committed by Android (Google) Code Review
Browse files

Merge "Fix bug #6140391 Make RTL awareness as an opt-in into the AndroidManifest"

parents 991c8733 59dfce8b
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -596,7 +596,7 @@ package android {
    field public static final int layerType = 16843604; // 0x1010354
    field public static final int layout = 16842994; // 0x10100f2
    field public static final int layoutAnimation = 16842988; // 0x10100ec
    field public static final int layoutDirection = 16843689; // 0x10103a9
    field public static final int layoutDirection = 16843690; // 0x10103aa
    field public static final int layout_above = 16843140; // 0x1010184
    field public static final int layout_alignBaseline = 16843142; // 0x1010186
    field public static final int layout_alignBottom = 16843146; // 0x101018a
@@ -618,10 +618,10 @@ package android {
    field public static final int layout_height = 16842997; // 0x10100f5
    field public static final int layout_margin = 16842998; // 0x10100f6
    field public static final int layout_marginBottom = 16843002; // 0x10100fa
    field public static final int layout_marginEnd = 16843693; // 0x10103ad
    field public static final int layout_marginEnd = 16843694; // 0x10103ae
    field public static final int layout_marginLeft = 16842999; // 0x10100f7
    field public static final int layout_marginRight = 16843001; // 0x10100f9
    field public static final int layout_marginStart = 16843692; // 0x10103ac
    field public static final int layout_marginStart = 16843693; // 0x10103ad
    field public static final int layout_marginTop = 16843000; // 0x10100f8
    field public static final int layout_row = 16843643; // 0x101037b
    field public static final int layout_rowSpan = 16843644; // 0x101037c
@@ -717,10 +717,10 @@ package android {
    field public static final int packageNames = 16843649; // 0x1010381
    field public static final int padding = 16842965; // 0x10100d5
    field public static final int paddingBottom = 16842969; // 0x10100d9
    field public static final int paddingEnd = 16843691; // 0x10103ab
    field public static final int paddingEnd = 16843692; // 0x10103ac
    field public static final int paddingLeft = 16842966; // 0x10100d6
    field public static final int paddingRight = 16842968; // 0x10100d8
    field public static final int paddingStart = 16843690; // 0x10103aa
    field public static final int paddingStart = 16843691; // 0x10103ab
    field public static final int paddingTop = 16842967; // 0x10100d7
    field public static final int panelBackground = 16842846; // 0x101005e
    field public static final int panelColorBackground = 16842849; // 0x1010061
@@ -931,6 +931,7 @@ package android {
    field public static final int summaryColumn = 16843426; // 0x10102a2
    field public static final int summaryOff = 16843248; // 0x10101f0
    field public static final int summaryOn = 16843247; // 0x10101ef
    field public static final int supportsRtl = 16843688; // 0x10103a8
    field public static final int supportsUploading = 16843419; // 0x101029b
    field public static final int switchMinWidth = 16843632; // 0x1010370
    field public static final int switchPadding = 16843633; // 0x1010371
@@ -1000,7 +1001,7 @@ package android {
    field public static final int textColorTertiary = 16843282; // 0x1010212
    field public static final int textColorTertiaryInverse = 16843283; // 0x1010213
    field public static final int textCursorDrawable = 16843618; // 0x1010362
    field public static final int textDirection = 16843688; // 0x10103a8
    field public static final int textDirection = 16843689; // 0x10103a9
    field public static final int textEditNoPasteWindowLayout = 16843541; // 0x1010315
    field public static final int textEditPasteWindowLayout = 16843540; // 0x1010314
    field public static final int textEditSideNoPasteWindowLayout = 16843615; // 0x101035f
@@ -6131,6 +6132,7 @@ package android.content.pm {
    field public static final int FLAG_STOPPED = 2097152; // 0x200000
    field public static final int FLAG_SUPPORTS_LARGE_SCREENS = 2048; // 0x800
    field public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1024; // 0x400
    field public static final int FLAG_SUPPORTS_RTL = 1073741824; // 0x40000000
    field public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 8192; // 0x2000
    field public static final int FLAG_SUPPORTS_SMALL_SCREENS = 512; // 0x200
    field public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 524288; // 0x80000
+20 −0
Original line number Diff line number Diff line
@@ -290,6 +290,17 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     */
    public static final int FLAG_STOPPED = 1<<21;

    /**
     * Value for {@link #flags}: true  when the application is willing to support
     * RTL (right to left). All activities will inherit this value.
     *
     * Set from the {@link android.R.attr#supportsRtl} attribute in the
     * activity's manifest.
     *
     * Default value is false (no support for RTL).
     */
    public static final int FLAG_SUPPORTS_RTL = 1<<22;

    /**
     * Value for {@link #flags}: Set to true if the application has been
     * installed using the forward lock option.
@@ -466,9 +477,18 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        if (uiOptions != 0) {
            pw.println(prefix + "uiOptions=0x" + Integer.toHexString(uiOptions));
        }
        pw.println(prefix + "supportsRtl=" + (hasRtlSupport() ? "true" : "false"));
        super.dumpBack(pw, prefix);
    }

    /**
     * @return true if "supportsRtl" has been set to true in the AndroidManifest
     * @hide
     */
    public boolean hasRtlSupport() {
        return (flags & FLAG_SUPPORTS_RTL) == FLAG_SUPPORTS_RTL;
    }
    
    public static class DisplayNameComparator
            implements Comparator<ApplicationInfo> {
        public DisplayNameComparator(PackageManager pm) {
+6 −0
Original line number Diff line number Diff line
@@ -1761,6 +1761,12 @@ public class PackageParser {
            ai.flags |= ApplicationInfo.FLAG_LARGE_HEAP;
        }

        if (sa.getBoolean(
                com.android.internal.R.styleable.AndroidManifestApplication_supportsRtl,
                false /* default is no RTL support*/)) {
            ai.flags |= ApplicationInfo.FLAG_SUPPORTS_RTL;
        }

        String str;
        str = sa.getNonConfigurationString(
                com.android.internal.R.styleable.AndroidManifestApplication_permission, 0);
+70 −56
Original line number Diff line number Diff line
@@ -9997,6 +9997,13 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
    public void onScreenStateChanged(int screenState) {
    }
    /**
     * Return true if the application tag in the AndroidManifest has set "supportRtl" to true
     */
    private boolean hasRtlSupport() {
        return mContext.getApplicationInfo().hasRtlSupport();
    }
    /**
     * Resolve and cache the layout direction. LTR is set initially. This is implicitly supposing
     * that the parent directionality can and will be resolved before its children.
@@ -10006,6 +10013,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
        // Clear any previous layout direction resolution
        mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED_MASK;
        if (hasRtlSupport()) {
            // Set resolved depending on layout direction
            switch (getLayoutDirection()) {
                case LAYOUT_DIRECTION_INHERIT:
@@ -10031,6 +10039,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
                default:
                    // Nothing to do, LTR by default
            }
        }
        // Set to resolved
        mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED;
@@ -14809,6 +14818,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
        // Reset any previous text direction resolution
        mPrivateFlags2 &= ~(TEXT_DIRECTION_RESOLVED | TEXT_DIRECTION_RESOLVED_MASK);
        if (hasRtlSupport()) {
            // Set resolved text direction flag depending on text direction flag
            final int textDirection = getTextDirection();
            switch(textDirection) {
@@ -14848,6 +14858,10 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
                    // Default resolved direction is "first strong" heuristic
                    mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED_DEFAULT;
            }
        } else {
            // Default resolved direction is "first strong" heuristic
            mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED_DEFAULT;
        }
        // Set to resolved
        mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED;
+3 −0
Original line number Diff line number Diff line
@@ -843,6 +843,9 @@
             @hide -->
        <attr name="cantSaveState" format="boolean" />
        <attr name="uiOptions" />
        <!-- Declare that your application will be able to deal with RTL (right to left) layouts.
             If set to  false (default value), your application will not care about RTL layouts. -->
        <attr name="supportsRtl" format="boolean" />
    </declare-styleable>
    
    <!-- The <code>permission</code> tag declares a security permission that can be
Loading