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

Commit e8fb649d authored by Johannes Gallmann's avatar Johannes Gallmann
Browse files

Ensure that EdgeBackGestureHandler receives all configuration updates

Bug: 332635834
Flag: NONE
Test: atest NavBarHelperTest
Test: Manual, i.e. verifying that back gesture is working correctly after configuration changes (rotation/folding etc.)
Change-Id: I85f1ab77b0b2201396b14bce366604258ee71bec
parent ef54218e
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import static com.android.systemui.statusbar.phone.BarTransitions.MODE_TRANSPARE

import android.content.ContentResolver;
import android.content.Context;
import android.content.res.Configuration;
import android.database.ContentObserver;
import android.inputmethodservice.InputMethodService;
import android.net.Uri;
@@ -74,6 +75,7 @@ import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.BarTransitions.TransitionMode;
import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardStateController;

import dagger.Lazy;
@@ -101,7 +103,7 @@ public final class NavBarHelper implements
        AccessibilityButtonModeObserver.ModeChangedListener,
        AccessibilityButtonTargetsObserver.TargetsChangedListener,
        OverviewProxyService.OverviewProxyListener, NavigationModeController.ModeChangedListener,
        Dumpable, CommandQueue.Callbacks {
        Dumpable, CommandQueue.Callbacks, ConfigurationController.ConfigurationListener {
    private static final String TAG = NavBarHelper.class.getSimpleName();

    private final Handler mHandler = new Handler(Looper.getMainLooper());
@@ -189,6 +191,7 @@ public final class NavBarHelper implements
            UserTracker userTracker,
            DisplayTracker displayTracker,
            NotificationShadeWindowController notificationShadeWindowController,
            ConfigurationController configurationController,
            DumpManager dumpManager,
            CommandQueue commandQueue,
            @Main Executor mainExecutor) {
@@ -215,6 +218,7 @@ public final class NavBarHelper implements

        mNavBarMode = navigationModeController.addListener(this);
        mCommandQueue.addCallback(this);
        configurationController.addCallback(this);
        overviewProxyService.addCallback(this);
        dumpManager.registerDumpable(this);
    }
@@ -359,6 +363,11 @@ public final class NavBarHelper implements
        updateA11yState();
    }

    @Override
    public void onConfigChanged(Configuration newConfig) {
        mEdgeBackGestureHandler.onConfigurationChanged(newConfig);
    }

    /**
     * Updates the current accessibility button state. The accessibility button state is only
     * used for {@link Secure#ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR} and
+0 −5
Original line number Diff line number Diff line
@@ -878,11 +878,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
            refreshLayout(ld);
        }
        repositionNavigationBar(rotation);
        // NOTE(b/260220098): In some cases, the recreated nav bar will already have the right
        // configuration, which means that NavBarView will not receive a configuration change to
        // propagate to EdgeBackGestureHandler (which is injected into this and NBV). As such, we
        // should also force-update the gesture handler to ensure it updates to the right bounds
        mEdgeBackGestureHandler.onConfigurationChanged(newConfig);
        if (canShowSecondaryHandle()) {
            if (rotation != mCurrentRotation) {
                mCurrentRotation = rotation;
+1 −4
Original line number Diff line number Diff line
@@ -162,14 +162,11 @@ public class NavigationBarControllerImpl implements
        mIsLargeScreen = isLargeScreen(mContext);
        boolean willApplyConfig = mConfigChanges.applyNewConfig(mContext.getResources());
        boolean largeScreenChanged = mIsLargeScreen != isOldConfigLargeScreen;
        // TODO(b/243765256): Disable this logging once b/243765256 is fixed.
        // TODO(b/332635834): Disable this logging once b/332635834 is fixed.
        Log.i(DEBUG_MISSING_GESTURE_TAG, "NavbarController: newConfig=" + newConfig
                + " mTaskbarDelegate initialized=" + mTaskbarDelegate.isInitialized()
                + " willApplyConfigToNavbars=" + willApplyConfig
                + " navBarCount=" + mNavigationBars.size());
        if (mTaskbarDelegate.isInitialized()) {
            mTaskbarDelegate.onConfigurationChanged(newConfig);
        }
        // If we folded/unfolded while in 3 button, show navbar in folded state, hide in unfolded
        if (largeScreenChanged && updateNavbarForTaskbar()) {
            return;
+0 −1
Original line number Diff line number Diff line
@@ -1031,7 +1031,6 @@ public class NavigationBarView extends FrameLayout {
        updateIcons(mTmpLastConfiguration);
        updateRecentsIcon();
        updateCurrentRotation();
        mEdgeBackGestureHandler.onConfigurationChanged(mConfiguration);
        if (uiCarModeChanged || mTmpLastConfiguration.densityDpi != mConfiguration.densityDpi
                || mTmpLastConfiguration.getLayoutDirection() != mConfiguration.getLayoutDirection()) {
            // If car mode or density changes, we need to reset the icons.
+0 −8
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ import static com.android.systemui.statusbar.phone.BarTransitions.TransitionMode
import android.app.StatusBarManager;
import android.app.StatusBarManager.WindowVisibleState;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.hardware.display.DisplayManager;
import android.inputmethodservice.InputMethodService;
@@ -72,7 +71,6 @@ import com.android.systemui.shared.system.TaskStackChangeListeners;
import com.android.systemui.statusbar.AutoHideUiElement;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.phone.AutoHideController;
import com.android.systemui.statusbar.phone.BarTransitions;
import com.android.systemui.statusbar.phone.LightBarController;
import com.android.systemui.statusbar.phone.LightBarTransitionsController;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
@@ -250,8 +248,6 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
            mLightBarController.setNavigationBar(mLightBarTransitionsController);
            mPipOptional.ifPresent(this::addPipExclusionBoundsChangeListener);
            mEdgeBackGestureHandler.setBackAnimation(mBackAnimation);
            mEdgeBackGestureHandler.onConfigurationChanged(
                    mContext.getResources().getConfiguration());
            mTaskStackChangeListeners.registerTaskStackListener(mTaskStackListener);
            mInitialized = true;
        } finally {
@@ -495,10 +491,6 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
        return mBehavior != BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;
    }

    public void onConfigurationChanged(Configuration configuration) {
        mEdgeBackGestureHandler.onConfigurationChanged(configuration);
    }

    @Override
    public void setNavigationBarLumaSamplingEnabled(int displayId, boolean enable) {
        mOverviewProxyService.onNavigationBarLumaSamplingEnabled(displayId, enable);
Loading