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

Commit a2546208 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Shows the correct home icon when quickstep is enabled on startup" into pi-dev

parents 97d579d1 d0a73e7a
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -665,7 +665,7 @@ public class NavigationBarFragment extends Fragment implements Callbacks {
    }
    }


    private void notifyNavigationBarScreenOn() {
    private void notifyNavigationBarScreenOn() {
        mNavigationBarView.notifyScreenOn();
        mNavigationBarView.updateNavButtonIcons();
    }
    }


    private void prepareNavigationBarView() {
    private void prepareNavigationBarView() {
@@ -813,7 +813,7 @@ public class NavigationBarFragment extends Fragment implements Callbacks {
                if ((time - mLastLockToAppLongPress) < LOCK_TO_APP_GESTURE_TOLERENCE) {
                if ((time - mLastLockToAppLongPress) < LOCK_TO_APP_GESTURE_TOLERENCE) {
                    activityManager.stopSystemLockTaskMode();
                    activityManager.stopSystemLockTaskMode();
                    // When exiting refresh disabled flags.
                    // When exiting refresh disabled flags.
                    mNavigationBarView.setDisabledFlags(mDisabledFlags1, true);
                    mNavigationBarView.updateNavButtonIcons();
                    return true;
                    return true;
                } else if (v.getId() == btnId1) {
                } else if (v.getId() == btnId1) {
                    ButtonDispatcher button = btnId2 == R.id.recent_apps
                    ButtonDispatcher button = btnId2 == R.id.recent_apps
@@ -835,7 +835,7 @@ public class NavigationBarFragment extends Fragment implements Callbacks {
                    // should stop lock task.
                    // should stop lock task.
                    activityManager.stopSystemLockTaskMode();
                    activityManager.stopSystemLockTaskMode();
                    // When exiting refresh disabled flags.
                    // When exiting refresh disabled flags.
                    mNavigationBarView.setDisabledFlags(mDisabledFlags1, true);
                    mNavigationBarView.updateNavButtonIcons();
                    return true;
                    return true;
                } else if (v.getId() == btnId2) {
                } else if (v.getId() == btnId2) {
                    return btnId2 == R.id.recent_apps
                    return btnId2 == R.id.recent_apps
+40 −42
Original line number Original line Diff line number Diff line
@@ -244,7 +244,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav


        mConfiguration = new Configuration();
        mConfiguration = new Configuration();
        mConfiguration.updateFrom(context.getResources().getConfiguration());
        mConfiguration.updateFrom(context.getResources().getConfiguration());
        updateIcons(context, Configuration.EMPTY, mConfiguration);
        reloadNavIcons();


        mBarTransitions = new NavigationBarTransitions(this);
        mBarTransitions = new NavigationBarTransitions(this);


@@ -291,7 +291,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav


    public void onConnectionChanged(boolean isConnected) {
    public void onConnectionChanged(boolean isConnected) {
        updateSlippery();
        updateSlippery();
        setDisabledFlags(mDisabledFlags, true);
        updateNavButtonIcons();
        setUpSwipeUpOnboarding(isConnected);
        setUpSwipeUpOnboarding(isConnected);
    }
    }


@@ -403,6 +403,10 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
                R.drawable.ic_sysbar_home_carmode, R.drawable.ic_sysbar_home_carmode);
                R.drawable.ic_sysbar_home_carmode, R.drawable.ic_sysbar_home_carmode);
    }
    }


    private void reloadNavIcons() {
        updateIcons(mContext, Configuration.EMPTY, mConfiguration);
    }

    private void updateIcons(Context ctx, Configuration oldConfig, Configuration newConfig) {
    private void updateIcons(Context ctx, Configuration oldConfig, Configuration newConfig) {
        if (oldConfig.orientation != newConfig.orientation
        if (oldConfig.orientation != newConfig.orientation
                || oldConfig.densityDpi != newConfig.densityDpi) {
                || oldConfig.densityDpi != newConfig.densityDpi) {
@@ -482,20 +486,11 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav


    @Override
    @Override
    public void setLayoutDirection(int layoutDirection) {
    public void setLayoutDirection(int layoutDirection) {
        // Reload all the icons
        reloadNavIcons();
        updateIcons(getContext(), Configuration.EMPTY, mConfiguration);


        super.setLayoutDirection(layoutDirection);
        super.setLayoutDirection(layoutDirection);
    }
    }


    public void notifyScreenOn() {
        setDisabledFlags(mDisabledFlags, true);
    }

    public void setNavigationIconHints(int hints) {
        setNavigationIconHints(hints, false);
    }

    private KeyButtonDrawable getBackIconWithAlt(boolean carMode, boolean landscape) {
    private KeyButtonDrawable getBackIconWithAlt(boolean carMode, boolean landscape) {
        return landscape
        return landscape
                ? carMode ? mBackAltLandCarModeIcon : mBackAltLandIcon
                ? carMode ? mBackAltLandCarModeIcon : mBackAltLandIcon
@@ -508,8 +503,8 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
                : carMode ? mBackCarModeIcon : mBackIcon;
                : carMode ? mBackCarModeIcon : mBackIcon;
    }
    }


    public void setNavigationIconHints(int hints, boolean force) {
    public void setNavigationIconHints(int hints) {
        if (!force && hints == mNavigationIconHints) return;
        if (hints == mNavigationIconHints) return;
        final boolean backAlt = (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0;
        final boolean backAlt = (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0;
        if ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0 && !backAlt) {
        if ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0 && !backAlt) {
            mTransitionListener.onBackAltCleared();
            mTransitionListener.onBackAltCleared();
@@ -519,16 +514,32 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
                "Navigation icon hints = " + hints,
                "Navigation icon hints = " + hints,
                500).show();
                500).show();
        }
        }

        mNavigationIconHints = hints;
        mNavigationIconHints = hints;
        updateNavButtonIcons();
    }

    public void setDisabledFlags(int disabledFlags) {
        if (mDisabledFlags == disabledFlags) return;

        final boolean overviewEnabledBefore = isOverviewEnabled();
        mDisabledFlags = disabledFlags;


        // Update icons if overview was just enabled to ensure the correct icons are present
        if (!overviewEnabledBefore && isOverviewEnabled()) {
            reloadNavIcons();
        }

        updateNavButtonIcons();
    }

    public void updateNavButtonIcons() {
        // We have to replace or restore the back and home button icons when exiting or entering
        // We have to replace or restore the back and home button icons when exiting or entering
        // carmode, respectively. Recents are not available in CarMode in nav bar so change
        // carmode, respectively. Recents are not available in CarMode in nav bar so change
        // to recent icon is not required.
        // to recent icon is not required.
        KeyButtonDrawable backIcon = (backAlt)
        KeyButtonDrawable backIcon
                = ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0)
                        ? getBackIconWithAlt(mUseCarModeUi, mVertical)
                        ? getBackIconWithAlt(mUseCarModeUi, mVertical)
                        : getBackIcon(mUseCarModeUi, mVertical);
                        : getBackIcon(mUseCarModeUi, mVertical);

        getBackButton().setImageDrawable(backIcon);
        getBackButton().setImageDrawable(backIcon);


        updateRecentsIcon();
        updateRecentsIcon();
@@ -543,7 +554,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
        final boolean showImeButton =
        final boolean showImeButton =
                !mShowAccessibilityButton &&
                !mShowAccessibilityButton &&
                        !mShowRotateButton &&
                        !mShowRotateButton &&
                ((hints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0);
                        ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0);
        getImeSwitchButton().setVisibility(showImeButton ? View.VISIBLE : View.INVISIBLE);
        getImeSwitchButton().setVisibility(showImeButton ? View.VISIBLE : View.INVISIBLE);
        getImeSwitchButton().setImageDrawable(mImeIcon);
        getImeSwitchButton().setImageDrawable(mImeIcon);


@@ -558,26 +569,14 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
        setAccessibilityButtonState(mShowAccessibilityButton, mLongClickableAccessibilityButton);
        setAccessibilityButtonState(mShowAccessibilityButton, mLongClickableAccessibilityButton);
        getAccessibilityButton().setImageDrawable(mAccessibilityIcon);
        getAccessibilityButton().setImageDrawable(mAccessibilityIcon);


        setDisabledFlags(mDisabledFlags, true);

        mBarTransitions.reapplyDarkIntensity();
        mBarTransitions.reapplyDarkIntensity();
    }

    public void setDisabledFlags(int disabledFlags) {
        setDisabledFlags(disabledFlags, false);
    }

    public void setDisabledFlags(int disabledFlags, boolean force) {
        if (!force && mDisabledFlags == disabledFlags) return;

        mDisabledFlags = disabledFlags;


        boolean disableHome = ((disabledFlags & View.STATUS_BAR_DISABLE_HOME) != 0);
        boolean disableHome = ((mDisabledFlags & View.STATUS_BAR_DISABLE_HOME) != 0);


        // Always disable recents when alternate car mode UI is active.
        // Always disable recents when alternate car mode UI is active.
        boolean disableRecent = mUseCarModeUi || !isOverviewEnabled();
        boolean disableRecent = mUseCarModeUi || !isOverviewEnabled();


        boolean disableBack = ((disabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0)
        boolean disableBack = ((mDisabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0)
                && ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) == 0);
                && ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) == 0);


        // When screen pinning, don't hide back and home when connected service or back and
        // When screen pinning, don't hide back and home when connected service or back and
@@ -670,7 +669,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav


    public void updateStates() {
    public void updateStates() {
        updateSlippery();
        updateSlippery();
        setDisabledFlags(mDisabledFlags, true);
        updateNavButtonIcons();
    }
    }


    private void updateSlippery() {
    private void updateSlippery() {
@@ -773,7 +772,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
        }
        }


        // Hide/restore other button visibility, if necessary
        // Hide/restore other button visibility, if necessary
        setNavigationIconHints(mNavigationIconHints, true);
        updateNavButtonIcons();
    }
    }


    public boolean isRotateButtonVisible() { return mShowRotateButton; }
    public boolean isRotateButtonVisible() { return mShowRotateButton; }
@@ -802,8 +801,8 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
    public void onOverviewProxyConnectionChanged(boolean isConnected) {
    public void onOverviewProxyConnectionChanged(boolean isConnected) {
        updateStates();
        updateStates();
        setUpSwipeUpOnboarding(isQuickStepSwipeUpEnabled());
        setUpSwipeUpOnboarding(isQuickStepSwipeUpEnabled());
        updateIcons(getContext(), Configuration.EMPTY, mConfiguration);
        reloadNavIcons();
        setNavigationIconHints(mNavigationIconHints, true);
        updateNavButtonIcons();
    }
    }


    @Override
    @Override
@@ -879,7 +878,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav


        // force the low profile & disabled states into compliance
        // force the low profile & disabled states into compliance
        mBarTransitions.init();
        mBarTransitions.init();
        setDisabledFlags(mDisabledFlags, true /* force */);
        setMenuVisibility(mShowMenu, true /* force */);
        setMenuVisibility(mShowMenu, true /* force */);


        if (DEBUG) {
        if (DEBUG) {
@@ -892,7 +890,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
            resolveLayoutDirection();
            resolveLayoutDirection();
        }
        }
        updateTaskSwitchHelper();
        updateTaskSwitchHelper();
        setNavigationIconHints(mNavigationIconHints, true);
        updateNavButtonIcons();


        getHomeButton().setVertical(mVertical);
        getHomeButton().setVertical(mVertical);
    }
    }
@@ -937,7 +935,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
        if (uiCarModeChanged || mConfiguration.densityDpi != newConfig.densityDpi
        if (uiCarModeChanged || mConfiguration.densityDpi != newConfig.densityDpi
                || mConfiguration.getLayoutDirection() != newConfig.getLayoutDirection()) {
                || mConfiguration.getLayoutDirection() != newConfig.getLayoutDirection()) {
            // If car mode or density changes, we need to reset the icons.
            // If car mode or density changes, we need to reset the icons.
            setNavigationIconHints(mNavigationIconHints, true);
            updateNavButtonIcons();
        }
        }
        mConfiguration.updateFrom(newConfig);
        mConfiguration.updateFrom(newConfig);
    }
    }