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

Commit 4458c200 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android Git Automerger
Browse files

am 672d323b: Merge "Developer option to force RTL layout" into klp-dev

* commit '672d323b':
  Developer option to force RTL layout
parents 0a2ad75d 672d323b
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -786,10 +786,14 @@ public final class Configuration implements Parcelable, Comparable<Configuration
            // 2 most significant bits in screenLayout).
            setLayoutDirection(locale);
        }
        if (delta.screenLayout != 0 && screenLayout != delta.screenLayout) {
            changed |= ActivityInfo.CONFIG_LAYOUT_DIRECTION;
            setLayoutDirection(locale);
        }
        if (delta.userSetLocale && (!userSetLocale || ((changed & ActivityInfo.CONFIG_LOCALE) != 0)))
        {
            userSetLocale = true;
            changed |= ActivityInfo.CONFIG_LOCALE;
            userSetLocale = true;
        }
        if (delta.touchscreen != TOUCHSCREEN_UNDEFINED
                && touchscreen != delta.touchscreen) {
@@ -933,6 +937,9 @@ public final class Configuration implements Parcelable, Comparable<Configuration
            changed |= ActivityInfo.CONFIG_LOCALE;
            changed |= ActivityInfo.CONFIG_LAYOUT_DIRECTION;
        }
        if (delta.screenLayout != 0 && screenLayout != delta.screenLayout) {
            changed |= ActivityInfo.CONFIG_LAYOUT_DIRECTION;
        }
        if (delta.touchscreen != TOUCHSCREEN_UNDEFINED
                && touchscreen != delta.touchscreen) {
            changed |= ActivityInfo.CONFIG_TOUCHSCREEN;
+6 −0
Original line number Diff line number Diff line
@@ -5661,6 +5661,12 @@ public final class Settings {
         */
        public static final String SELINUX_STATUS = "selinux_status";

        /**
         * Developer setting to force RTL layout.
         * @hide
         */
        public static final String DEVELOPMENT_FORCE_RTL = "debug.force_rtl";

        /**
         * Settings to backup. This is here so that it's in the same place as the settings
         * keys and easy to update.
+6 −2
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ package android.text;
import android.content.res.Resources;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemProperties;
import android.provider.Settings;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.AlignmentSpan;
import android.text.style.BackgroundColorSpan;
@@ -1743,8 +1745,10 @@ public class TextUtils {
                return View.LAYOUT_DIRECTION_RTL;
            }
        }

        return View.LAYOUT_DIRECTION_LTR;
        // If forcing into RTL layout mode, return RTL as default, else LTR
        return SystemProperties.getBoolean(Settings.Global.DEVELOPMENT_FORCE_RTL, false)
                ? View.LAYOUT_DIRECTION_RTL
                : View.LAYOUT_DIRECTION_LTR;
    }

    /**
+8 −0
Original line number Diff line number Diff line
@@ -8453,9 +8453,17 @@ public final class ActivityManagerService extends ActivityManagerNative
            resolver, Settings.Global.WAIT_FOR_DEBUGGER, 0) != 0;
        boolean alwaysFinishActivities = Settings.Global.getInt(
            resolver, Settings.Global.ALWAYS_FINISH_ACTIVITIES, 0) != 0;
        boolean forceRtl = Settings.Global.getInt(
                resolver, Settings.Global.DEVELOPMENT_FORCE_RTL, 0) != 0;
        // Transfer any global setting for forcing RTL layout, into a System Property
        SystemProperties.set(Settings.Global.DEVELOPMENT_FORCE_RTL, forceRtl ? "1":"0");
        Configuration configuration = new Configuration();
        Settings.System.getConfiguration(resolver, configuration);
        if (forceRtl) {
            // This will take care of setting the correct layout direction flags
            configuration.setLayoutDirection(configuration.locale);
        }
        synchronized (this) {
            mDebugApp = mOrigDebugApp = debugApp;