Merge "Pause region sampling while blurring the shade" into sc-dev

This commit is contained in:
Lucas Dupin
2021-06-28 23:50:04 +00:00
committed by Android (Google) Code Review
8 changed files with 59 additions and 0 deletions

View File

@@ -77,6 +77,7 @@ import com.android.systemui.shared.system.TaskStackChangeListeners;
import com.android.systemui.shared.system.WindowManagerWrapper;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.phone.AutoHideController;
import com.android.systemui.statusbar.phone.ConfigurationControllerImpl;
import com.android.systemui.statusbar.phone.ShadeController;
@@ -227,6 +228,7 @@ public class DependencyProvider {
Lazy<StatusBar> statusBarLazy,
ShadeController shadeController,
NotificationRemoteInputManager notificationRemoteInputManager,
NotificationShadeDepthController notificationShadeDepthController,
SystemActions systemActions,
@Main Handler mainHandler,
UiEventLogger uiEventLogger,
@@ -253,6 +255,7 @@ public class DependencyProvider {
statusBarLazy,
shadeController,
notificationRemoteInputManager,
notificationShadeDepthController,
systemActions,
mainHandler,
uiEventLogger,

View File

@@ -136,6 +136,7 @@ import com.android.systemui.statusbar.AutoHideUiElement;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.CommandQueue.Callbacks;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.notification.stack.StackStateAnimator;
import com.android.systemui.statusbar.phone.AutoHideController;
@@ -201,6 +202,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
private final NavigationBarOverlayController mNavbarOverlayController;
private final UiEventLogger mUiEventLogger;
private final UserTracker mUserTracker;
private final NotificationShadeDepthController mNotificationShadeDepthController;
private Bundle mSavedState;
private NavigationBarView mNavigationBarView;
@@ -438,6 +440,25 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
}
};
private final NotificationShadeDepthController.DepthListener mDepthListener =
new NotificationShadeDepthController.DepthListener() {
boolean mHasBlurs;
@Override
public void onWallpaperZoomOutChanged(float zoomOut) {
}
@Override
public void onBlurRadiusChanged(int radius) {
boolean hasBlurs = radius != 0;
if (hasBlurs == mHasBlurs) {
return;
}
mHasBlurs = hasBlurs;
mNavigationBarView.setWindowHasBlurs(hasBlurs);
}
};
public NavigationBar(Context context,
WindowManager windowManager,
Lazy<AssistManager> assistManagerLazy,
@@ -457,6 +478,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
Optional<Recents> recentsOptional, Lazy<StatusBar> statusBarLazy,
ShadeController shadeController,
NotificationRemoteInputManager notificationRemoteInputManager,
NotificationShadeDepthController notificationShadeDepthController,
SystemActions systemActions,
@Main Handler mainHandler,
NavigationBarOverlayController navbarOverlayController,
@@ -487,6 +509,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
mNavbarOverlayController = navbarOverlayController;
mUiEventLogger = uiEventLogger;
mUserTracker = userTracker;
mNotificationShadeDepthController = notificationShadeDepthController;
mNavBarMode = mNavigationModeController.addListener(this);
mAccessibilityButtonModeObserver.addListener(this);
@@ -570,6 +593,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
mIsCurrentUserSetup = mDeviceProvisionedController.isCurrentUserSetup();
mDeviceProvisionedController.addCallback(mUserSetupListener);
mNotificationShadeDepthController.addListener(mDepthListener);
setAccessibilityFloatingMenuModeIfNeeded();
@@ -586,6 +610,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
mAccessibilityManagerWrapper.removeCallback(mAccessibilityListener);
mContentResolver.unregisterContentObserver(mAssistContentObserver);
mDeviceProvisionedController.removeCallback(mUserSetupListener);
mNotificationShadeDepthController.removeListener(mDepthListener);
DeviceConfig.removeOnPropertiesChangedListener(mOnPropertiesChangedListener);
}

View File

@@ -61,6 +61,7 @@ import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.CommandQueue.Callbacks;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.phone.BarTransitions.TransitionMode;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
@@ -115,6 +116,7 @@ public class NavigationBarController implements Callbacks,
private final DisplayManager mDisplayManager;
private final NavigationBarOverlayController mNavBarOverlayController;
private final TaskbarDelegate mTaskbarDelegate;
private final NotificationShadeDepthController mNotificationShadeDepthController;
private int mNavMode;
private boolean mIsTablet;
private final UserTracker mUserTracker;
@@ -149,6 +151,7 @@ public class NavigationBarController implements Callbacks,
Lazy<StatusBar> statusBarLazy,
ShadeController shadeController,
NotificationRemoteInputManager notificationRemoteInputManager,
NotificationShadeDepthController notificationShadeDepthController,
SystemActions systemActions,
@Main Handler mainHandler,
UiEventLogger uiEventLogger,
@@ -175,6 +178,7 @@ public class NavigationBarController implements Callbacks,
mStatusBarLazy = statusBarLazy;
mShadeController = shadeController;
mNotificationRemoteInputManager = notificationRemoteInputManager;
mNotificationShadeDepthController = notificationShadeDepthController;
mSystemActions = systemActions;
mUiEventLogger = uiEventLogger;
mHandler = mainHandler;
@@ -362,6 +366,7 @@ public class NavigationBarController implements Callbacks,
mStatusBarLazy,
mShadeController,
mNotificationRemoteInputManager,
mNotificationShadeDepthController,
mSystemActions,
mHandler,
mNavBarOverlayController,

View File

@@ -413,6 +413,13 @@ public class NavigationBarView extends FrameLayout implements
return super.onTouchEvent(event);
}
/**
* If we're blurring the shade window.
*/
public void setWindowHasBlurs(boolean hasBlurs) {
mRegionSamplingHelper.setWindowHasBlurs(hasBlurs);
}
void onTransientStateChanged(boolean isTransient) {
mEdgeBackGestureHandler.onNavBarTransientStateChanged(isTransient);

View File

@@ -65,6 +65,7 @@ public class RegionSamplingHelper implements View.OnAttachStateChangeListener,
private final float mLuminanceChangeThreshold;
private boolean mFirstSamplingAfterStart;
private boolean mWindowVisible;
private boolean mWindowHasBlurs;
private SurfaceControl mRegisteredStopLayer = null;
private ViewTreeObserver.OnDrawListener mUpdateOnDraw = new ViewTreeObserver.OnDrawListener() {
@Override
@@ -153,6 +154,7 @@ public class RegionSamplingHelper implements View.OnAttachStateChangeListener,
boolean isSamplingEnabled = mSamplingEnabled
&& !mSamplingRequestBounds.isEmpty()
&& mWindowVisible
&& !mWindowHasBlurs
&& (mSampledView.isAttachedToWindow() || mFirstSamplingAfterStart);
if (isSamplingEnabled) {
ViewRootImpl viewRootImpl = mSampledView.getViewRootImpl();
@@ -225,6 +227,14 @@ public class RegionSamplingHelper implements View.OnAttachStateChangeListener,
updateSamplingListener();
}
/**
* If we're blurring the shade window.
*/
public void setWindowHasBlurs(boolean hasBlurs) {
mWindowHasBlurs = hasBlurs;
updateSamplingListener();
}
public void dump(PrintWriter pw) {
pw.println("RegionSamplingHelper:");
pw.println(" sampleView isAttached: " + mSampledView.isAttachedToWindow());
@@ -238,6 +248,7 @@ public class RegionSamplingHelper implements View.OnAttachStateChangeListener,
pw.println(" mLastMedianLuma: " + mLastMedianLuma);
pw.println(" mCurrentMedianLuma: " + mCurrentMedianLuma);
pw.println(" mWindowVisible: " + mWindowVisible);
pw.println(" mWindowHasBlurs: " + mWindowHasBlurs);
pw.println(" mWaitingOnDraw: " + mWaitingOnDraw);
pw.println(" mRegisteredStopLayer: " + mRegisteredStopLayer);
pw.println(" mIsDestroyed: " + mIsDestroyed);

View File

@@ -210,6 +210,7 @@ class NotificationShadeDepthController @Inject constructor(
}
listeners.forEach {
it.onWallpaperZoomOutChanged(zoomOut)
it.onBlurRadiusChanged(blur)
}
notificationShadeWindowController.setBackgroundBlurRadius(blur)
}
@@ -513,5 +514,8 @@ class NotificationShadeDepthController @Inject constructor(
* Current wallpaper zoom out, where 0 is the closest, and 1 the farthest
*/
fun onWallpaperZoomOutChanged(zoomOut: Float)
@JvmDefault
fun onBlurRadiusChanged(blurRadius: Int) {}
}
}

View File

@@ -55,6 +55,7 @@ import com.android.systemui.recents.Recents;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper;
@@ -105,6 +106,7 @@ public class NavigationBarControllerTest extends SysuiTestCase {
() -> mock(StatusBar.class),
mock(ShadeController.class),
mock(NotificationRemoteInputManager.class),
mock(NotificationShadeDepthController.class),
mock(SystemActions.class),
Dependency.get(Dependency.MAIN_HANDLER),
mock(UiEventLogger.class),

View File

@@ -79,6 +79,7 @@ import com.android.systemui.recents.Recents;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper;
@@ -274,6 +275,7 @@ public class NavigationBarTest extends SysuiTestCase {
() -> mock(StatusBar.class),
mock(ShadeController.class),
mock(NotificationRemoteInputManager.class),
mock(NotificationShadeDepthController.class),
mock(SystemActions.class),
mHandler,
mock(NavigationBarOverlayController.class),