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

Commit eb3d7d5c authored by chihtinglo's avatar chihtinglo
Browse files

Exclude input methods windows from EDT

Considering that keyboards are UI surfaces that frequently involve user
customization that does not necessarily match the users' device theme.
We would like to avoid EDT affecting the keyboard theme picker and
customization experience.

Bug: 436939588
Test: manually. Attaching video to the bug
Flag: android.view.accessibility.force_invert_color
Change-Id: Ie3475f8a2d473f3295393152ddbee5693a8a79e9
parent 42bdf1c4
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
@@ -2053,7 +2054,7 @@ public final class ViewRootImpl implements ViewParent,
                // properly configured dark theme are unaffected by force invert dark theme. For
                // self-declared light theme apps HWUI then performs its own "color area"
                // calculation to determine if the app actually renders with light colors.
                if (a.getBoolean(R.styleable.Theme_isLightTheme, false)) {
                if (!isInputWindow() && a.getBoolean(R.styleable.Theme_isLightTheme, false)) {
                    return ForceDarkType.FORCE_INVERT_COLOR_DARK;
                }
            }
@@ -2064,6 +2065,10 @@ public final class ViewRootImpl implements ViewParent,
        }
    }
    private boolean isInputWindow() {
        return mOrigWindowType == TYPE_INPUT_METHOD || mOrigWindowType == TYPE_INPUT_METHOD_DIALOG;
    }
    private boolean shouldApplyForceInvertDark() {
        if (!forceInvertColor()) {
            return false;