Merge "Remove NavigationBarOverlayController." into tm-dev
This commit is contained in:
@@ -56,7 +56,6 @@ import com.android.systemui.keyguard.WakefulnessLifecycle;
|
|||||||
import com.android.systemui.media.dialog.MediaOutputDialogFactory;
|
import com.android.systemui.media.dialog.MediaOutputDialogFactory;
|
||||||
import com.android.systemui.model.SysUiState;
|
import com.android.systemui.model.SysUiState;
|
||||||
import com.android.systemui.navigationbar.NavigationBarController;
|
import com.android.systemui.navigationbar.NavigationBarController;
|
||||||
import com.android.systemui.navigationbar.NavigationBarOverlayController;
|
|
||||||
import com.android.systemui.navigationbar.NavigationModeController;
|
import com.android.systemui.navigationbar.NavigationModeController;
|
||||||
import com.android.systemui.navigationbar.gestural.EdgeBackGestureHandler;
|
import com.android.systemui.navigationbar.gestural.EdgeBackGestureHandler;
|
||||||
import com.android.systemui.plugins.ActivityStarter;
|
import com.android.systemui.plugins.ActivityStarter;
|
||||||
@@ -360,7 +359,6 @@ public class Dependency {
|
|||||||
@Inject Lazy<ProtoTracer> mProtoTracer;
|
@Inject Lazy<ProtoTracer> mProtoTracer;
|
||||||
@Inject Lazy<MediaOutputDialogFactory> mMediaOutputDialogFactory;
|
@Inject Lazy<MediaOutputDialogFactory> mMediaOutputDialogFactory;
|
||||||
@Inject Lazy<DeviceConfigProxy> mDeviceConfigProxy;
|
@Inject Lazy<DeviceConfigProxy> mDeviceConfigProxy;
|
||||||
@Inject Lazy<NavigationBarOverlayController> mNavbarButtonsControllerLazy;
|
|
||||||
@Inject Lazy<TelephonyListenerManager> mTelephonyListenerManager;
|
@Inject Lazy<TelephonyListenerManager> mTelephonyListenerManager;
|
||||||
@Inject Lazy<SystemStatusAnimationScheduler> mSystemStatusAnimationSchedulerLazy;
|
@Inject Lazy<SystemStatusAnimationScheduler> mSystemStatusAnimationSchedulerLazy;
|
||||||
@Inject Lazy<PrivacyDotViewController> mPrivacyDotViewControllerLazy;
|
@Inject Lazy<PrivacyDotViewController> mPrivacyDotViewControllerLazy;
|
||||||
@@ -580,8 +578,6 @@ public class Dependency {
|
|||||||
|
|
||||||
mProviders.put(MediaOutputDialogFactory.class, mMediaOutputDialogFactory::get);
|
mProviders.put(MediaOutputDialogFactory.class, mMediaOutputDialogFactory::get);
|
||||||
|
|
||||||
mProviders.put(NavigationBarOverlayController.class, mNavbarButtonsControllerLazy::get);
|
|
||||||
|
|
||||||
mProviders.put(SystemStatusAnimationScheduler.class,
|
mProviders.put(SystemStatusAnimationScheduler.class,
|
||||||
mSystemStatusAnimationSchedulerLazy::get);
|
mSystemStatusAnimationSchedulerLazy::get);
|
||||||
mProviders.put(PrivacyDotViewController.class, mPrivacyDotViewControllerLazy::get);
|
mProviders.put(PrivacyDotViewController.class, mPrivacyDotViewControllerLazy::get);
|
||||||
|
|||||||
@@ -200,7 +200,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
|
|||||||
private final NavigationBarTransitions mNavigationBarTransitions;
|
private final NavigationBarTransitions mNavigationBarTransitions;
|
||||||
private final Optional<BackAnimation> mBackAnimation;
|
private final Optional<BackAnimation> mBackAnimation;
|
||||||
private final Handler mHandler;
|
private final Handler mHandler;
|
||||||
private final NavigationBarOverlayController mNavbarOverlayController;
|
|
||||||
private final UiEventLogger mUiEventLogger;
|
private final UiEventLogger mUiEventLogger;
|
||||||
private final NavBarHelper mNavBarHelper;
|
private final NavBarHelper mNavBarHelper;
|
||||||
private final NotificationShadeDepthController mNotificationShadeDepthController;
|
private final NotificationShadeDepthController mNotificationShadeDepthController;
|
||||||
@@ -504,7 +503,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
|
|||||||
NotificationRemoteInputManager notificationRemoteInputManager,
|
NotificationRemoteInputManager notificationRemoteInputManager,
|
||||||
NotificationShadeDepthController notificationShadeDepthController,
|
NotificationShadeDepthController notificationShadeDepthController,
|
||||||
@Main Handler mainHandler,
|
@Main Handler mainHandler,
|
||||||
NavigationBarOverlayController navbarOverlayController,
|
|
||||||
UiEventLogger uiEventLogger,
|
UiEventLogger uiEventLogger,
|
||||||
NavBarHelper navBarHelper,
|
NavBarHelper navBarHelper,
|
||||||
LightBarController mainLightBarController,
|
LightBarController mainLightBarController,
|
||||||
@@ -543,7 +541,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
|
|||||||
mNavigationBarTransitions = navigationBarTransitions;
|
mNavigationBarTransitions = navigationBarTransitions;
|
||||||
mBackAnimation = backAnimation;
|
mBackAnimation = backAnimation;
|
||||||
mHandler = mainHandler;
|
mHandler = mainHandler;
|
||||||
mNavbarOverlayController = navbarOverlayController;
|
|
||||||
mUiEventLogger = uiEventLogger;
|
mUiEventLogger = uiEventLogger;
|
||||||
mNavBarHelper = navBarHelper;
|
mNavBarHelper = navBarHelper;
|
||||||
mNotificationShadeDepthController = notificationShadeDepthController;
|
mNotificationShadeDepthController = notificationShadeDepthController;
|
||||||
@@ -967,9 +964,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRecentsAnimationStateChanged(boolean running) {
|
public void onRecentsAnimationStateChanged(boolean running) {
|
||||||
if (running) {
|
|
||||||
mNavbarOverlayController.setButtonState(/* visible */false, /* force */true);
|
|
||||||
}
|
|
||||||
mView.getRotationButtonController().setRecentsAnimationRunning(running);
|
mView.getRotationButtonController().setRecentsAnimationRunning(running);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,87 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -166,7 +166,6 @@ public class NavigationBarView extends FrameLayout {
|
|||||||
private RotationContextButton mRotationContextButton;
|
private RotationContextButton mRotationContextButton;
|
||||||
private FloatingRotationButton mFloatingRotationButton;
|
private FloatingRotationButton mFloatingRotationButton;
|
||||||
private RotationButtonController mRotationButtonController;
|
private RotationButtonController mRotationButtonController;
|
||||||
private NavigationBarOverlayController mNavBarOverlayController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper that is responsible for showing the right toast when a disallowed activity operation
|
* 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);
|
return isGesturalModeOnDefaultDisplay(getContext(), mNavBarMode);
|
||||||
}
|
}
|
||||||
}, backgroundExecutor);
|
}, backgroundExecutor);
|
||||||
|
|
||||||
mNavBarOverlayController = Dependency.get(NavigationBarOverlayController.class);
|
|
||||||
if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
|
|
||||||
mNavBarOverlayController.init(mNavbarOverlayVisibilityChangeCallback,
|
|
||||||
mEdgeBackGestureHandler::updateNavigationBarOverlayExcludeRegion);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBarTransitions(NavigationBarTransitions navigationBarTransitions) {
|
void setBarTransitions(NavigationBarTransitions navigationBarTransitions) {
|
||||||
@@ -466,17 +459,6 @@ public class NavigationBarView extends FrameLayout {
|
|||||||
|
|
||||||
void onTransientStateChanged(boolean isTransient, boolean isGestureOnSystemBar) {
|
void onTransientStateChanged(boolean isTransient, boolean isGestureOnSystemBar) {
|
||||||
mEdgeBackGestureHandler.onNavBarTransientStateChanged(isTransient);
|
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) {
|
void onBarTransition(int newMode) {
|
||||||
@@ -701,9 +683,6 @@ public class NavigationBarView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
mImeVisible = visible;
|
mImeVisible = visible;
|
||||||
mRotationButtonController.getRotationButton().setCanShowRotationButton(!mImeVisible);
|
mRotationButtonController.getRotationButton().setCanShowRotationButton(!mImeVisible);
|
||||||
if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
|
|
||||||
mNavBarOverlayController.setCanShow(!mImeVisible);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDisabledFlags(int disabledFlags, SysUiState sysUiState) {
|
void setDisabledFlags(int disabledFlags, SysUiState sysUiState) {
|
||||||
@@ -1060,11 +1039,6 @@ public class NavigationBarView extends FrameLayout {
|
|||||||
} else {
|
} else {
|
||||||
updateButtonLocation(getRotateSuggestionButton(), inScreenSpace, useNearestRegion);
|
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;
|
return mTmpRegion;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1297,9 +1271,6 @@ public class NavigationBarView extends FrameLayout {
|
|||||||
if (mRotationButtonController != null) {
|
if (mRotationButtonController != null) {
|
||||||
mRotationButtonController.registerListeners();
|
mRotationButtonController.registerListeners();
|
||||||
}
|
}
|
||||||
if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
|
|
||||||
mNavBarOverlayController.registerListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
getViewTreeObserver().addOnComputeInternalInsetsListener(mOnComputeInternalInsetsListener);
|
getViewTreeObserver().addOnComputeInternalInsetsListener(mOnComputeInternalInsetsListener);
|
||||||
updateNavButtonIcons();
|
updateNavButtonIcons();
|
||||||
@@ -1316,10 +1287,6 @@ public class NavigationBarView extends FrameLayout {
|
|||||||
mRotationButtonController.unregisterListeners();
|
mRotationButtonController.unregisterListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
|
|
||||||
mNavBarOverlayController.unregisterListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
mEdgeBackGestureHandler.onNavBarDetached();
|
mEdgeBackGestureHandler.onNavBarDetached();
|
||||||
getViewTreeObserver().removeOnComputeInternalInsetsListener(
|
getViewTreeObserver().removeOnComputeInternalInsetsListener(
|
||||||
mOnComputeInternalInsetsListener);
|
mOnComputeInternalInsetsListener);
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
|
|||||||
private static final String TAG = TaskbarDelegate.class.getSimpleName();
|
private static final String TAG = TaskbarDelegate.class.getSimpleName();
|
||||||
|
|
||||||
private final EdgeBackGestureHandler mEdgeBackGestureHandler;
|
private final EdgeBackGestureHandler mEdgeBackGestureHandler;
|
||||||
private final NavigationBarOverlayController mNavBarOverlayController;
|
|
||||||
private final LightBarTransitionsController.Factory mLightBarTransitionsControllerFactory;
|
private final LightBarTransitionsController.Factory mLightBarTransitionsControllerFactory;
|
||||||
private boolean mInitialized;
|
private boolean mInitialized;
|
||||||
private CommandQueue mCommandQueue;
|
private CommandQueue mCommandQueue;
|
||||||
@@ -158,16 +157,11 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
|
|||||||
public TaskbarDelegate(
|
public TaskbarDelegate(
|
||||||
Context context,
|
Context context,
|
||||||
EdgeBackGestureHandler.Factory edgeBackGestureHandlerFactory,
|
EdgeBackGestureHandler.Factory edgeBackGestureHandlerFactory,
|
||||||
NavigationBarOverlayController navigationBarOverlayController,
|
|
||||||
LightBarTransitionsController.Factory lightBarTransitionsControllerFactory
|
LightBarTransitionsController.Factory lightBarTransitionsControllerFactory
|
||||||
) {
|
) {
|
||||||
mLightBarTransitionsControllerFactory = lightBarTransitionsControllerFactory;
|
mLightBarTransitionsControllerFactory = lightBarTransitionsControllerFactory;
|
||||||
mEdgeBackGestureHandler = edgeBackGestureHandlerFactory.create(context);
|
mEdgeBackGestureHandler = edgeBackGestureHandlerFactory.create(context);
|
||||||
mNavBarOverlayController = navigationBarOverlayController;
|
|
||||||
if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
|
|
||||||
mNavBarOverlayController.init(mNavbarOverlayVisibilityChangeCallback,
|
|
||||||
mEdgeBackGestureHandler::updateNavigationBarOverlayExcludeRegion);
|
|
||||||
}
|
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mDisplayManager = mContext.getSystemService(DisplayManager.class);
|
mDisplayManager = mContext.getSystemService(DisplayManager.class);
|
||||||
mPipListener = mEdgeBackGestureHandler::setPipStashExclusionBounds;
|
mPipListener = mEdgeBackGestureHandler::setPipStashExclusionBounds;
|
||||||
@@ -227,9 +221,6 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
|
|||||||
mNavigationModeController.addListener(this));
|
mNavigationModeController.addListener(this));
|
||||||
mNavBarHelper.registerNavTaskStateUpdater(mNavbarTaskbarStateUpdater);
|
mNavBarHelper.registerNavTaskStateUpdater(mNavbarTaskbarStateUpdater);
|
||||||
mNavBarHelper.init();
|
mNavBarHelper.init();
|
||||||
if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
|
|
||||||
mNavBarOverlayController.registerListeners();
|
|
||||||
}
|
|
||||||
mEdgeBackGestureHandler.onNavBarAttached();
|
mEdgeBackGestureHandler.onNavBarAttached();
|
||||||
// Initialize component callback
|
// Initialize component callback
|
||||||
Display display = mDisplayManager.getDisplay(displayId);
|
Display display = mDisplayManager.getDisplay(displayId);
|
||||||
@@ -254,9 +245,6 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
|
|||||||
mNavigationModeController.removeListener(this);
|
mNavigationModeController.removeListener(this);
|
||||||
mNavBarHelper.removeNavTaskStateUpdater(mNavbarTaskbarStateUpdater);
|
mNavBarHelper.removeNavTaskStateUpdater(mNavbarTaskbarStateUpdater);
|
||||||
mNavBarHelper.destroy();
|
mNavBarHelper.destroy();
|
||||||
if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
|
|
||||||
mNavBarOverlayController.unregisterListeners();
|
|
||||||
}
|
|
||||||
mEdgeBackGestureHandler.onNavBarDetached();
|
mEdgeBackGestureHandler.onNavBarDetached();
|
||||||
mScreenPinningNotify = null;
|
mScreenPinningNotify = null;
|
||||||
if (mWindowContext != null) {
|
if (mWindowContext != null) {
|
||||||
@@ -425,19 +413,10 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
|
|||||||
|
|
||||||
private void onTransientStateChanged() {
|
private void onTransientStateChanged() {
|
||||||
mEdgeBackGestureHandler.onNavBarTransientStateChanged(mTaskbarTransientShowing);
|
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
|
@Override
|
||||||
public void onRecentsAnimationStateChanged(boolean running) {
|
public void onRecentsAnimationStateChanged(boolean running) {
|
||||||
if (running) {
|
|
||||||
mNavBarOverlayController.setButtonState(/* visible */false, /* force */true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -447,7 +447,6 @@ public class NavigationBarTest extends SysuiTestCase {
|
|||||||
mock(NotificationRemoteInputManager.class),
|
mock(NotificationRemoteInputManager.class),
|
||||||
mock(NotificationShadeDepthController.class),
|
mock(NotificationShadeDepthController.class),
|
||||||
mHandler,
|
mHandler,
|
||||||
mock(NavigationBarOverlayController.class),
|
|
||||||
mUiEventLogger,
|
mUiEventLogger,
|
||||||
mNavBarHelper,
|
mNavBarHelper,
|
||||||
mLightBarController,
|
mLightBarController,
|
||||||
|
|||||||
Reference in New Issue
Block a user