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

Commit 24b5f2cf authored by Alan Viverette's avatar Alan Viverette
Browse files

Always apply window insets to action modes

BUG: 17567245
Change-Id: I3c37d228e3a9d3060a4fd1a86abf2ffbf91802e8
parent 547f97ac
Loading
Loading
Loading
Loading
+22 −19
Original line number Original line Diff line number Diff line
@@ -2887,20 +2887,22 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                if (mActionModeView.getLayoutParams() instanceof MarginLayoutParams) {
                if (mActionModeView.getLayoutParams() instanceof MarginLayoutParams) {
                    MarginLayoutParams mlp = (MarginLayoutParams) mActionModeView.getLayoutParams();
                    MarginLayoutParams mlp = (MarginLayoutParams) mActionModeView.getLayoutParams();
                    boolean mlpChanged = false;
                    boolean mlpChanged = false;
                    final boolean nonOverlayShown =
                    if (mActionModeView.isShown()) {
                            (getLocalFeatures() & (1 << FEATURE_ACTION_MODE_OVERLAY)) == 0
                        final boolean nonOverlay = (getLocalFeatures()
                            && mActionModeView.isShown();
                                & (1 << FEATURE_ACTION_MODE_OVERLAY)) == 0;
                    if (nonOverlayShown) {
                        // set top margin to top insets, show status guard
                        if (mlp.topMargin != insets.getSystemWindowInsetTop()) {
                        if (mlp.topMargin != insets.getSystemWindowInsetTop()) {
                            mlpChanged = true;
                            mlpChanged = true;
                            mlp.topMargin = insets.getSystemWindowInsetTop();
                            mlp.topMargin = insets.getSystemWindowInsetTop();

                            // Only show status guard for non-overlay modes.
                            if (nonOverlay) {
                                if (mStatusGuard == null) {
                                if (mStatusGuard == null) {
                                    mStatusGuard = new View(mContext);
                                    mStatusGuard = new View(mContext);
                                    mStatusGuard.setBackgroundColor(mContext.getResources()
                                    mStatusGuard.setBackgroundColor(mContext.getResources()
                                            .getColor(R.color.input_method_navigation_guard));
                                            .getColor(R.color.input_method_navigation_guard));
                                    addView(mStatusGuard, indexOfChild(mStatusColorView),
                                    addView(mStatusGuard, indexOfChild(mStatusColorView),
                                        new LayoutParams(LayoutParams.MATCH_PARENT, mlp.topMargin,
                                            new LayoutParams(LayoutParams.MATCH_PARENT,
                                                    mlp.topMargin,
                                                    Gravity.START | Gravity.TOP));
                                                    Gravity.START | Gravity.TOP));
                                } else {
                                } else {
                                    LayoutParams lp = (LayoutParams) mStatusGuard.getLayoutParams();
                                    LayoutParams lp = (LayoutParams) mStatusGuard.getLayoutParams();
@@ -2910,9 +2912,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                                    }
                                    }
                                }
                                }
                            }
                            }
                        }
                        insets = insets.consumeSystemWindowInsets(
                        insets = insets.consumeSystemWindowInsets(
                                false, true /* top */, false, false);
                                false, nonOverlay /* top */, false, false);
                        showStatusGuard = true;
                        showStatusGuard = nonOverlay;
                    } else {
                    } else {
                        // reset top margin
                        // reset top margin
                        if (mlp.topMargin != 0) {
                        if (mlp.topMargin != 0) {