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

Commit f267b14d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Cache locations of where nearest child is." into sc-dev am: 7330bd4e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13537743

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If31bd6c8cd4a821809740f89a29bca4e47e02966
parents fbbe6935 7330bd4e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -30,7 +30,8 @@
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipChildren="false"
        android:clipToPadding="false">
        android:clipToPadding="false"
        systemui:isVertical="false">

        <LinearLayout
            android:id="@+id/ends_group"
+2 −1
Original line number Diff line number Diff line
@@ -30,7 +30,8 @@
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipChildren="false"
        android:clipToPadding="false">
        android:clipToPadding="false"
        systemui:isVertical="true">

        <com.android.systemui.navigationbar.buttons.ReverseLinearLayout
            android:id="@+id/ends_group"
+2 −0
Original line number Diff line number Diff line
@@ -143,6 +143,8 @@
    <attr name="handleColor" format="color" />
    <attr name="scrimColor" format="color" />

    <attr name="isVertical" format="boolean" />

    <!-- Used display CarrierText in Keyguard or QS Footer -->
    <declare-styleable name="CarrierText">
        <attr name="allCaps" format="boolean" />
+1 −1
Original line number Diff line number Diff line
@@ -1124,7 +1124,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
        }
        // If an incoming call is ringing, HOME is totally disabled.
        // (The user is already on the InCallUI at this point,
        // and his ONLY options are to answer or reject the call.)
        // and their ONLY options are to answer or reject the call.)
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                mHomeBlockedThisTouch = false;
+19 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ import com.android.systemui.navigationbar.buttons.ContextualButton;
import com.android.systemui.navigationbar.buttons.ContextualButtonGroup;
import com.android.systemui.navigationbar.buttons.DeadZone;
import com.android.systemui.navigationbar.buttons.KeyButtonDrawable;
import com.android.systemui.navigationbar.buttons.NearestTouchFrame;
import com.android.systemui.navigationbar.buttons.RotationContextButton;
import com.android.systemui.navigationbar.gestural.EdgeBackGestureHandler;
import com.android.systemui.navigationbar.gestural.FloatingRotationButton;
@@ -97,6 +98,8 @@ import com.android.wm.shell.legacysplitscreen.LegacySplitScreen;
import com.android.wm.shell.pip.Pip;

import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;

public class NavigationBarView extends FrameLayout implements
@@ -129,6 +132,7 @@ public class NavigationBarView extends FrameLayout implements
    private final Region mTmpRegion = new Region();
    private final int[] mTmpPosition = new int[2];
    private Rect mTmpBounds = new Rect();
    private Map<View, Rect> mButtonFullTouchableRegions = new HashMap<>();

    private KeyButtonDrawable mBackIcon;
    private KeyButtonDrawable mHomeDefaultIcon;
@@ -973,9 +977,18 @@ public class NavigationBarView extends FrameLayout implements
                getButtonLocations(true /* includeFloatingRotationButton */, true /* inScreen */));
    }

    private void updateButtonTouchRegionCache() {
        FrameLayout navBarLayout = mIsVertical
                ? mNavigationInflaterView.mVertical
                : mNavigationInflaterView.mHorizontal;
        mButtonFullTouchableRegions = ((NearestTouchFrame) navBarLayout
                .findViewById(R.id.nav_buttons)).getFullTouchableChildRegions();
    }

    private Region getButtonLocations(boolean includeFloatingRotationButton,
            boolean inScreenSpace) {
        mTmpRegion.setEmpty();
        updateButtonTouchRegionCache();
        updateButtonLocation(getBackButton(), inScreenSpace);
        updateButtonLocation(getHomeButton(), inScreenSpace);
        updateButtonLocation(getRecentsButton(), inScreenSpace);
@@ -999,6 +1012,12 @@ public class NavigationBarView extends FrameLayout implements
        if (view == null || !button.isVisible()) {
            return;
        }
        // If the button is tappable from perspective of NearestTouchFrame, then we'll
        // include the regions where the tap is valid instead of just the button layout location
        if (mButtonFullTouchableRegions.containsKey(view)) {
            mTmpRegion.op(mButtonFullTouchableRegions.get(view), Op.UNION);
            return;
        }
        updateButtonLocation(view, inScreenSpace);
    }

Loading