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

Commit 1b3c0f82 authored by Alan Viverette's avatar Alan Viverette Committed by Android Git Automerger
Browse files

am d03ba30b: Merge "Always apply window insets to action modes" into lmp-dev

* commit 'd03ba30bac5d250cdc7d43102dd06af2f114d7a8':
  Always apply window insets to action modes
parents e3e1d90e 3540c462
Loading
Loading
Loading
Loading
+22 −19
Original line number Diff line number Diff line
@@ -2887,20 +2887,22 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                if (mActionModeView.getLayoutParams() instanceof MarginLayoutParams) {
                    MarginLayoutParams mlp = (MarginLayoutParams) mActionModeView.getLayoutParams();
                    boolean mlpChanged = false;
                    final boolean nonOverlayShown =
                            (getLocalFeatures() & (1 << FEATURE_ACTION_MODE_OVERLAY)) == 0
                            && mActionModeView.isShown();
                    if (nonOverlayShown) {
                        // set top margin to top insets, show status guard
                    if (mActionModeView.isShown()) {
                        final boolean nonOverlay = (getLocalFeatures()
                                & (1 << FEATURE_ACTION_MODE_OVERLAY)) == 0;
                        if (mlp.topMargin != insets.getSystemWindowInsetTop()) {
                            mlpChanged = true;
                            mlp.topMargin = insets.getSystemWindowInsetTop();

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