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

Commit 49a9b728 authored by Danny Baumann's avatar Danny Baumann Committed by Roman Birg
Browse files

Fix side button visibility tracking.

Previously one could e.g. get legacy menu button being visible in
certain scenarios, like this one:
- Open legacy app, e.g. CatLog
- Invoke IME
- Lock screen
- Unlock screen
- Result: Menu button visible in keyguard

Change-Id: Ia796f73ec995ea1cc34d38f8aefdbccda7be7565
parent 00016635
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -357,8 +357,16 @@ public class NavigationBarView extends LinearLayout {

    private void setButtonVisibility(NavbarEditor.ButtonInfo info, boolean visible) {
        View findView = findButton(info);
        if (findView != null) {
            findView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
        if (findView == null) {
            return;
        }
        int visibility = visible ? View.VISIBLE : View.INVISIBLE;
        if (mSlotOneVisibility != -1 && findView.getId() == R.id.one) {
            mSlotOneVisibility = visibility;
        } else if (mSlotSixVisibility != -1 && findView.getId() == R.id.six) {
            mSlotSixVisibility = visibility;
        } else {
            findView.setVisibility(visibility);
        }
    }

@@ -531,9 +539,11 @@ public class NavigationBarView extends LinearLayout {
            } else {
                if (mSlotOneVisibility != -1) {
                    one.setVisibility(mSlotOneVisibility);
                    mSlotOneVisibility = -1;
                }
                if (mSlotSixVisibility != -1) {
                    six.setVisibility(mSlotSixVisibility);
                    mSlotSixVisibility = -1;
                }
            }
        }
@@ -953,15 +963,15 @@ public class NavigationBarView extends LinearLayout {
            // restore previous views in case the cursor keys WERE showing and
            // are should now be hidden while the IME is up.
            View one = getCurrentView().findViewById(mVertical ? R.id.six : R.id.one);
            View capricaSix = getCurrentView().findViewById(mVertical ? R.id.one : R.id.six);
            View six = getCurrentView().findViewById(mVertical ? R.id.one : R.id.six);
            if (mSlotOneVisibility != -1 && one != null) {
                one.setVisibility(mSlotOneVisibility);
            }
            if (mSlotSixVisibility != -1 && capricaSix != null) {
                capricaSix.setVisibility(mSlotSixVisibility);
            }
                mSlotOneVisibility = -1;
            }
            if (mSlotSixVisibility != -1 && six != null) {
                six.setVisibility(mSlotSixVisibility);
                mSlotSixVisibility = -1;
            }

            // propogate settings
            setNavigationIconHints(mNavigationIconHints, true);