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

Commit 3d14fd38 authored by Peiyong Lin's avatar Peiyong Lin Committed by Automerger Merge Worker
Browse files

Merge "Remove NavigationBarOverlayController." into tm-dev am: e26bcbb8 am: 687738c3

parents f15f6f6c 687738c3
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -56,7 +56,6 @@ import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.media.dialog.MediaOutputDialogFactory;
import com.android.systemui.model.SysUiState;
import com.android.systemui.navigationbar.NavigationBarController;
import com.android.systemui.navigationbar.NavigationBarOverlayController;
import com.android.systemui.navigationbar.NavigationModeController;
import com.android.systemui.navigationbar.gestural.EdgeBackGestureHandler;
import com.android.systemui.plugins.ActivityStarter;
@@ -360,7 +359,6 @@ public class Dependency {
    @Inject Lazy<ProtoTracer> mProtoTracer;
    @Inject Lazy<MediaOutputDialogFactory> mMediaOutputDialogFactory;
    @Inject Lazy<DeviceConfigProxy> mDeviceConfigProxy;
    @Inject Lazy<NavigationBarOverlayController> mNavbarButtonsControllerLazy;
    @Inject Lazy<TelephonyListenerManager> mTelephonyListenerManager;
    @Inject Lazy<SystemStatusAnimationScheduler> mSystemStatusAnimationSchedulerLazy;
    @Inject Lazy<PrivacyDotViewController> mPrivacyDotViewControllerLazy;
@@ -580,8 +578,6 @@ public class Dependency {

        mProviders.put(MediaOutputDialogFactory.class, mMediaOutputDialogFactory::get);

        mProviders.put(NavigationBarOverlayController.class, mNavbarButtonsControllerLazy::get);

        mProviders.put(SystemStatusAnimationScheduler.class,
                mSystemStatusAnimationSchedulerLazy::get);
        mProviders.put(PrivacyDotViewController.class, mPrivacyDotViewControllerLazy::get);
+0 −6
Original line number Diff line number Diff line
@@ -200,7 +200,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
    private final NavigationBarTransitions mNavigationBarTransitions;
    private final Optional<BackAnimation> mBackAnimation;
    private final Handler mHandler;
    private final NavigationBarOverlayController mNavbarOverlayController;
    private final UiEventLogger mUiEventLogger;
    private final NavBarHelper mNavBarHelper;
    private final NotificationShadeDepthController mNotificationShadeDepthController;
@@ -504,7 +503,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
            NotificationRemoteInputManager notificationRemoteInputManager,
            NotificationShadeDepthController notificationShadeDepthController,
            @Main Handler mainHandler,
            NavigationBarOverlayController navbarOverlayController,
            UiEventLogger uiEventLogger,
            NavBarHelper navBarHelper,
            LightBarController mainLightBarController,
@@ -543,7 +541,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
        mNavigationBarTransitions = navigationBarTransitions;
        mBackAnimation = backAnimation;
        mHandler = mainHandler;
        mNavbarOverlayController = navbarOverlayController;
        mUiEventLogger = uiEventLogger;
        mNavBarHelper = navBarHelper;
        mNotificationShadeDepthController = notificationShadeDepthController;
@@ -967,9 +964,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements

    @Override
    public void onRecentsAnimationStateChanged(boolean running) {
        if (running) {
            mNavbarOverlayController.setButtonState(/* visible */false, /* force */true);
        }
        mView.getRotationButtonController().setRecentsAnimationRunning(running);
    }

+0 −87
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.navigationbar;

import android.content.Context;
import android.graphics.Rect;
import android.view.View;

import com.android.systemui.dagger.SysUISingleton;

import java.util.function.Consumer;

import javax.inject.Inject;

/** Contains logic that deals with showing buttons with navigation bar. */
@SysUISingleton
public class NavigationBarOverlayController {

    protected final Context mContext;

    @Inject
    public NavigationBarOverlayController(Context context) {
        mContext = context;
    }

    public Context getContext() {
        return mContext;
    }

    public boolean isNavigationBarOverlayEnabled() {
        return false;
    }

    /**
     * Initialize the controller with visibility change callback.
     */
    public void init(Consumer<Boolean> visibilityChangeCallback,
            Consumer<Rect> excludeBackRegionCallback) {}

    /**
     * Set whether the view can be shown.
     */
    public void setCanShow(boolean canShow) {}

    /**
     * Set the buttons visibility.
     */
    public void setButtonState(boolean visible, boolean force) {}

    /**
     * Register necessary listeners, called when NavigationBarView is attached to window.
     */
    public void registerListeners() {}

    /**
     * Unregister listeners, called when navigationBarView is detached from window.
     */
    public void unregisterListeners() {}

    /**
     * Return the current view.
     */
    public View getCurrentView() {
        return null;
    }

    /**
     * Return the visibility of the view.
     */
    public boolean isVisible() {
        return false;
    }
}
+0 −33
Original line number Diff line number Diff line
@@ -166,7 +166,6 @@ public class NavigationBarView extends FrameLayout {
    private RotationContextButton mRotationContextButton;
    private FloatingRotationButton mFloatingRotationButton;
    private RotationButtonController mRotationButtonController;
    private NavigationBarOverlayController mNavBarOverlayController;

    /**
     * Helper that is responsible for showing the right toast when a disallowed activity operation
@@ -408,12 +407,6 @@ public class NavigationBarView extends FrameLayout {
                        return isGesturalModeOnDefaultDisplay(getContext(), mNavBarMode);
                    }
                }, backgroundExecutor);

        mNavBarOverlayController = Dependency.get(NavigationBarOverlayController.class);
        if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
            mNavBarOverlayController.init(mNavbarOverlayVisibilityChangeCallback,
                    mEdgeBackGestureHandler::updateNavigationBarOverlayExcludeRegion);
        }
    }

    void setBarTransitions(NavigationBarTransitions navigationBarTransitions) {
@@ -466,17 +459,6 @@ public class NavigationBarView extends FrameLayout {

    void onTransientStateChanged(boolean isTransient, boolean isGestureOnSystemBar) {
        mEdgeBackGestureHandler.onNavBarTransientStateChanged(isTransient);

        // The visibility of the navigation bar buttons is dependent on the transient state of
        // the navigation bar.
        if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
            // Always allow the overlay if in non-gestural nav mode, otherwise, only allow showing
            // the overlay if the user is swiping directly over a system bar
            boolean allowNavBarOverlay = !QuickStepContract.isGesturalMode(mNavBarMode)
                    || isGestureOnSystemBar;
            isTransient = isTransient && allowNavBarOverlay;
            mNavBarOverlayController.setButtonState(isTransient, /* force */ false);
        }
    }

    void onBarTransition(int newMode) {
@@ -701,9 +683,6 @@ public class NavigationBarView extends FrameLayout {
        }
        mImeVisible = visible;
        mRotationButtonController.getRotationButton().setCanShowRotationButton(!mImeVisible);
        if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
            mNavBarOverlayController.setCanShow(!mImeVisible);
        }
    }

    void setDisabledFlags(int disabledFlags, SysUiState sysUiState) {
@@ -1060,11 +1039,6 @@ public class NavigationBarView extends FrameLayout {
        } else {
            updateButtonLocation(getRotateSuggestionButton(), inScreenSpace, useNearestRegion);
        }
        if (includeFloatingButtons && mNavBarOverlayController.isNavigationBarOverlayEnabled()
                && mNavBarOverlayController.isVisible()) {
            // Note: this button is floating so the nearest region doesn't apply
            updateButtonLocation(mNavBarOverlayController.getCurrentView(), inScreenSpace);
        }
        return mTmpRegion;
    }

@@ -1297,9 +1271,6 @@ public class NavigationBarView extends FrameLayout {
        if (mRotationButtonController != null) {
            mRotationButtonController.registerListeners();
        }
        if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
            mNavBarOverlayController.registerListeners();
        }

        getViewTreeObserver().addOnComputeInternalInsetsListener(mOnComputeInternalInsetsListener);
        updateNavButtonIcons();
@@ -1316,10 +1287,6 @@ public class NavigationBarView extends FrameLayout {
            mRotationButtonController.unregisterListeners();
        }

        if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
            mNavBarOverlayController.unregisterListeners();
        }

        mEdgeBackGestureHandler.onNavBarDetached();
        getViewTreeObserver().removeOnComputeInternalInsetsListener(
                mOnComputeInternalInsetsListener);
+1 −22
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
    private static final String TAG = TaskbarDelegate.class.getSimpleName();

    private final EdgeBackGestureHandler mEdgeBackGestureHandler;
    private final NavigationBarOverlayController mNavBarOverlayController;
    private final LightBarTransitionsController.Factory mLightBarTransitionsControllerFactory;
    private boolean mInitialized;
    private CommandQueue mCommandQueue;
@@ -158,16 +157,11 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
    public TaskbarDelegate(
            Context context,
            EdgeBackGestureHandler.Factory edgeBackGestureHandlerFactory,
            NavigationBarOverlayController navigationBarOverlayController,
            LightBarTransitionsController.Factory lightBarTransitionsControllerFactory
    ) {
        mLightBarTransitionsControllerFactory = lightBarTransitionsControllerFactory;
        mEdgeBackGestureHandler = edgeBackGestureHandlerFactory.create(context);
        mNavBarOverlayController = navigationBarOverlayController;
        if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
            mNavBarOverlayController.init(mNavbarOverlayVisibilityChangeCallback,
                    mEdgeBackGestureHandler::updateNavigationBarOverlayExcludeRegion);
        }

        mContext = context;
        mDisplayManager = mContext.getSystemService(DisplayManager.class);
        mPipListener = mEdgeBackGestureHandler::setPipStashExclusionBounds;
@@ -227,9 +221,6 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
                mNavigationModeController.addListener(this));
        mNavBarHelper.registerNavTaskStateUpdater(mNavbarTaskbarStateUpdater);
        mNavBarHelper.init();
        if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
            mNavBarOverlayController.registerListeners();
        }
        mEdgeBackGestureHandler.onNavBarAttached();
        // Initialize component callback
        Display display = mDisplayManager.getDisplay(displayId);
@@ -254,9 +245,6 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
        mNavigationModeController.removeListener(this);
        mNavBarHelper.removeNavTaskStateUpdater(mNavbarTaskbarStateUpdater);
        mNavBarHelper.destroy();
        if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
            mNavBarOverlayController.unregisterListeners();
        }
        mEdgeBackGestureHandler.onNavBarDetached();
        mScreenPinningNotify = null;
        if (mWindowContext != null) {
@@ -425,19 +413,10 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,

    private void onTransientStateChanged() {
        mEdgeBackGestureHandler.onNavBarTransientStateChanged(mTaskbarTransientShowing);

        // The visibility of the navigation bar buttons is dependent on the transient state of
        // the navigation bar.
        if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
            mNavBarOverlayController.setButtonState(mTaskbarTransientShowing, /* force */ false);
        }
    }

    @Override
    public void onRecentsAnimationStateChanged(boolean running) {
        if (running) {
            mNavBarOverlayController.setButtonState(/* visible */false, /* force */true);
        }
    }

    @Override
Loading