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

Commit 18638b01 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "framework: Regional requirement for RTL"

parents 2c28df3a b2df6d41
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.content.ClipData;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
@@ -7635,7 +7636,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    @ResolvedLayoutDir
    public int getLayoutDirection() {
        final int targetSdkVersion = getContext().getApplicationInfo().targetSdkVersion;
        if (targetSdkVersion < JELLY_BEAN_MR1) {
        if (targetSdkVersion < JELLY_BEAN_MR1 && !isSystemApp()) {
            mPrivateFlags2 |= PFLAG2_LAYOUT_DIRECTION_RESOLVED;
            return LAYOUT_DIRECTION_RESOLVED_DEFAULT;
        }
@@ -14138,7 +14139,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    private boolean isRtlCompatibilityMode() {
        final int targetSdkVersion = getContext().getApplicationInfo().targetSdkVersion;
        return targetSdkVersion < JELLY_BEAN_MR1 || !hasRtlSupport();
        return (targetSdkVersion < JELLY_BEAN_MR1 && !isSystemApp()) || !hasRtlSupport();
    }
    /**
     * Return true if we are in a system app context.
     */
    private boolean isSystemApp() {
        return ((getContext().getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM) != 0);
    }
    /**
+4 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.annotation.NonNull;
import android.annotation.UiThread;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.TypedArray;
@@ -7115,8 +7116,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
            }

            final boolean hasRtlSupport = c.getApplicationInfo().hasRtlSupport();
            final boolean isSystemApp = (c.getApplicationInfo().flags &
                    ApplicationInfo.FLAG_SYSTEM) != 0;
            final int targetSdkVersion = c.getApplicationInfo().targetSdkVersion;
            if (targetSdkVersion < JELLY_BEAN_MR1 || !hasRtlSupport) {
            if ((targetSdkVersion < JELLY_BEAN_MR1 && !isSystemApp) || !hasRtlSupport) {
                mMarginFlags |= RTL_COMPATIBILITY_MODE_MASK;
            }

+4 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.widget;
import com.android.internal.R;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
@@ -281,7 +282,9 @@ public class ExpandableListView extends ListView {
     */
    private boolean isRtlCompatibilityMode() {
        final int targetSdkVersion = mContext.getApplicationInfo().targetSdkVersion;
        return targetSdkVersion < JELLY_BEAN_MR1 || !hasRtlSupport();
        final boolean isSystemApp = (mContext.getApplicationInfo().flags &
            ApplicationInfo.FLAG_SYSTEM) != 0;
        return (targetSdkVersion < JELLY_BEAN_MR1 && !isSystemApp) || !hasRtlSupport();
    }

    /**
+23 −4
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.graphics.PixelFormat;
import android.media.AudioManager;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
@@ -99,6 +100,8 @@ public class MediaController extends FrameLayout {
    private CharSequence mPlayDescription;
    private CharSequence mPauseDescription;
    private final AccessibilityManager mAccessibilityManager;
    private final boolean isLayoutRtl = TextUtils.getLayoutDirectionFromLocale(
        Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL;

    public MediaController(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -269,7 +272,11 @@ public class MediaController extends FrameLayout {

        mFfwdButton = (ImageButton) v.findViewById(com.android.internal.R.id.ffwd);
        if (mFfwdButton != null) {
            if (isLayoutRtl) {
                mFfwdButton.setOnClickListener(mRewListener);
            } else {
                mFfwdButton.setOnClickListener(mFfwdListener);
            }
            if (!mFromXml) {
                mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
            }
@@ -277,7 +284,11 @@ public class MediaController extends FrameLayout {

        mRewButton = (ImageButton) v.findViewById(com.android.internal.R.id.rew);
        if (mRewButton != null) {
            if (isLayoutRtl) {
                mRewButton.setOnClickListener(mFfwdListener);
            } else {
                mRewButton.setOnClickListener(mRewListener);
            }
            if (!mFromXml) {
                mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
            }
@@ -674,12 +685,20 @@ public class MediaController extends FrameLayout {

    private void installPrevNextListeners() {
        if (mNextButton != null) {
            if (isLayoutRtl) {
                mNextButton.setOnClickListener(mPrevListener);
            } else {
                mNextButton.setOnClickListener(mNextListener);
            }
            mNextButton.setEnabled(mNextListener != null);
        }

        if (mPrevButton != null) {
            if (isLayoutRtl) {
                mPrevButton.setOnClickListener(mNextListener);
            } else {
                mPrevButton.setOnClickListener(mPrevListener);
            }
            mPrevButton.setEnabled(mPrevListener != null);
        }
    }
+4 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import java.util.SortedSet;
import java.util.TreeSet;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.os.Build;
@@ -1243,7 +1244,9 @@ public class RelativeLayout extends ViewGroup {
                    com.android.internal.R.styleable.RelativeLayout_Layout);

            final int targetSdkVersion = c.getApplicationInfo().targetSdkVersion;
            mIsRtlCompatibilityMode = (targetSdkVersion < JELLY_BEAN_MR1 ||
            final boolean isSystemApp = (c.getApplicationInfo().flags &
                    ApplicationInfo.FLAG_SYSTEM) != 0;
            mIsRtlCompatibilityMode = ((targetSdkVersion < JELLY_BEAN_MR1 && !isSystemApp) ||
                    !c.getApplicationInfo().hasRtlSupport());

            final int[] rules = mRules;
Loading