Merge "Remove more methods from CentralSurfaces" into tm-qpr-dev am: 0513b9e126

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20499566

Change-Id: Id243d23fc9bccdc3951449156d17920cf07b7a1a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Justin Weir
2022-11-30 17:30:20 +00:00
committed by Automerger Merge Worker
6 changed files with 71 additions and 48 deletions

View File

@@ -393,6 +393,9 @@ public final class NotificationPanelViewController implements Dumpable {
private final UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController; private final UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
private int mQsTrackingPointer; private int mQsTrackingPointer;
private VelocityTracker mQsVelocityTracker; private VelocityTracker mQsVelocityTracker;
private TrackingStartedListener mTrackingStartedListener;
private OpenCloseListener mOpenCloseListener;
private GestureRecorder mGestureRecorder;
private boolean mQsTracking; private boolean mQsTracking;
/** Whether the ongoing gesture might both trigger the expansion in both the view and QS. */ /** Whether the ongoing gesture might both trigger the expansion in both the view and QS. */
private boolean mConflictingQsExpansionGesture; private boolean mConflictingQsExpansionGesture;
@@ -1362,6 +1365,14 @@ public final class NotificationPanelViewController implements Dumpable {
mKeyguardIndicationController.setIndicationArea(mKeyguardBottomArea); mKeyguardIndicationController.setIndicationArea(mKeyguardBottomArea);
} }
void setOpenCloseListener(OpenCloseListener openCloseListener) {
mOpenCloseListener = openCloseListener;
}
void setTrackingStartedListener(TrackingStartedListener trackingStartedListener) {
mTrackingStartedListener = trackingStartedListener;
}
private void updateGestureExclusionRect() { private void updateGestureExclusionRect() {
Rect exclusionRect = calculateGestureExclusionRect(); Rect exclusionRect = calculateGestureExclusionRect();
mView.setSystemGestureExclusionRects(exclusionRect.isEmpty() ? Collections.emptyList() mView.setSystemGestureExclusionRects(exclusionRect.isEmpty() ? Collections.emptyList()
@@ -1936,9 +1947,9 @@ public final class NotificationPanelViewController implements Dumpable {
} }
private void fling(float vel) { private void fling(float vel) {
GestureRecorder gr = mCentralSurfaces.getGestureRecorder(); if (mGestureRecorder != null) {
if (gr != null) { mGestureRecorder.tag("fling " + ((vel > 0) ? "open" : "closed"),
gr.tag("fling " + ((vel > 0) ? "open" : "closed"), "notifications,v=" + vel); "notifications,v=" + vel);
} }
fling(vel, true, 1.0f /* collapseSpeedUpFactor */, false); fling(vel, true, 1.0f /* collapseSpeedUpFactor */, false);
} }
@@ -3726,7 +3737,7 @@ public final class NotificationPanelViewController implements Dumpable {
mFalsingCollector.onTrackingStarted(!mKeyguardStateController.canDismissLockScreen()); mFalsingCollector.onTrackingStarted(!mKeyguardStateController.canDismissLockScreen());
endClosing(); endClosing();
mTracking = true; mTracking = true;
mCentralSurfaces.onTrackingStarted(); mTrackingStartedListener.onTrackingStarted();
notifyExpandingStarted(); notifyExpandingStarted();
updatePanelExpansionAndVisibility(); updatePanelExpansionAndVisibility();
mScrimController.onTrackingStarted(); mScrimController.onTrackingStarted();
@@ -3960,7 +3971,7 @@ public final class NotificationPanelViewController implements Dumpable {
} }
private void onClosingFinished() { private void onClosingFinished() {
mCentralSurfaces.onClosingFinished(); mOpenCloseListener.onClosingFinished();
setClosingWithAlphaFadeout(false); setClosingWithAlphaFadeout(false);
mMediaHierarchyManager.closeGuts(); mMediaHierarchyManager.closeGuts();
} }
@@ -4519,11 +4530,13 @@ public final class NotificationPanelViewController implements Dumpable {
*/ */
public void initDependencies( public void initDependencies(
CentralSurfaces centralSurfaces, CentralSurfaces centralSurfaces,
GestureRecorder recorder,
Runnable hideExpandedRunnable, Runnable hideExpandedRunnable,
NotificationShelfController notificationShelfController) { NotificationShelfController notificationShelfController) {
// TODO(b/254859580): this can be injected. // TODO(b/254859580): this can be injected.
mCentralSurfaces = centralSurfaces; mCentralSurfaces = centralSurfaces;
mGestureRecorder = recorder;
mHideExpandedRunnable = hideExpandedRunnable; mHideExpandedRunnable = hideExpandedRunnable;
mNotificationStackScrollLayoutController.setShelfController(notificationShelfController); mNotificationStackScrollLayoutController.setShelfController(notificationShelfController);
mNotificationShelfController = notificationShelfController; mNotificationShelfController = notificationShelfController;
@@ -5772,7 +5785,7 @@ public final class NotificationPanelViewController implements Dumpable {
if (mSplitShadeEnabled && !isOnKeyguard()) { if (mSplitShadeEnabled && !isOnKeyguard()) {
setQsExpandImmediate(true); setQsExpandImmediate(true);
} }
mCentralSurfaces.makeExpandedVisible(false); mOpenCloseListener.onOpenStarted();
} }
if (state == STATE_CLOSED) { if (state == STATE_CLOSED) {
setQsExpandImmediate(false); setQsExpandImmediate(false);
@@ -6255,4 +6268,17 @@ public final class NotificationPanelViewController implements Dumpable {
return super.performAccessibilityAction(host, action, args); return super.performAccessibilityAction(host, action, args);
} }
} }
/** Listens for when touch tracking begins. */
interface TrackingStartedListener {
void onTrackingStarted();
}
/** Listens for when shade begins opening of finishes closing. */
interface OpenCloseListener {
/** Called when the shade finishes closing. */
void onClosingFinished();
/** Called when the shade starts opening. */
void onOpenStarted();
}
} }

View File

@@ -111,6 +111,9 @@ public interface ShadeController {
/** Handle status bar touch event. */ /** Handle status bar touch event. */
void onStatusBarTouch(MotionEvent event); void onStatusBarTouch(MotionEvent event);
/** Called when the shade finishes collapsing. */
void onClosingFinished();
/** Sets the listener for when the visibility of the shade changes. */ /** Sets the listener for when the visibility of the shade changes. */
void setVisibilityListener(ShadeVisibilityListener listener); void setVisibilityListener(ShadeVisibilityListener listener);

View File

@@ -226,6 +226,16 @@ public final class ShadeControllerImpl implements ShadeController {
} }
} }
@Override
public void onClosingFinished() {
runPostCollapseRunnables();
if (!mPresenter.isPresenterFullyCollapsed()) {
// if we set it not to be focusable when collapsing, we have to undo it when we aborted
// the closing
mNotificationShadeWindowController.setNotificationShadeFocusable(true);
}
}
@Override @Override
public void instantCollapseShade() { public void instantCollapseShade() {
mNotificationPanelViewController.instantCollapse(); mNotificationPanelViewController.instantCollapse();
@@ -329,5 +339,18 @@ public final class ShadeControllerImpl implements ShadeController {
public void setNotificationPanelViewController( public void setNotificationPanelViewController(
NotificationPanelViewController notificationPanelViewController) { NotificationPanelViewController notificationPanelViewController) {
mNotificationPanelViewController = notificationPanelViewController; mNotificationPanelViewController = notificationPanelViewController;
mNotificationPanelViewController.setTrackingStartedListener(this::runPostCollapseRunnables);
mNotificationPanelViewController.setOpenCloseListener(
new NotificationPanelViewController.OpenCloseListener() {
@Override
public void onClosingFinished() {
ShadeControllerImpl.this.onClosingFinished();
}
@Override
public void onOpenStarted() {
makeExpandedVisible(false);
}
});
} }
} }

View File

@@ -51,7 +51,6 @@ import com.android.systemui.qs.QSPanelController;
import com.android.systemui.shade.NotificationPanelViewController; import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.NotificationShadeWindowView; import com.android.systemui.shade.NotificationShadeWindowView;
import com.android.systemui.shade.NotificationShadeWindowViewController; import com.android.systemui.shade.NotificationShadeWindowViewController;
import com.android.systemui.statusbar.GestureRecorder;
import com.android.systemui.statusbar.LightRevealScrim; import com.android.systemui.statusbar.LightRevealScrim;
import com.android.systemui.statusbar.NotificationPresenter; import com.android.systemui.statusbar.NotificationPresenter;
@@ -286,8 +285,6 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn
void onTouchEvent(MotionEvent event); void onTouchEvent(MotionEvent event);
GestureRecorder getGestureRecorder();
BiometricUnlockController getBiometricUnlockController(); BiometricUnlockController getBiometricUnlockController();
void showWirelessChargingAnimation(int batteryLevel); void showWirelessChargingAnimation(int batteryLevel);
@@ -402,10 +399,6 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn
LightRevealScrim getLightRevealScrim(); LightRevealScrim getLightRevealScrim();
void onTrackingStarted();
void onClosingFinished();
// TODO: Figure out way to remove these. // TODO: Figure out way to remove these.
NavigationBarView getNavigationBarView(); NavigationBarView getNavigationBarView();
@@ -489,13 +482,6 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn
void updateNotificationPanelTouchState(); void updateNotificationPanelTouchState();
/**
* TODO(b/257041702) delete this
* @deprecated Use ShadeController#makeExpandedVisible
*/
@Deprecated
void makeExpandedVisible(boolean force);
int getDisplayId(); int getDisplayId();
int getRotation(); int getRotation();

View File

@@ -1257,6 +1257,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
mNotificationPanelViewController.initDependencies( mNotificationPanelViewController.initDependencies(
this, this,
mGestureRec,
mShadeController::makeExpandedInvisible, mShadeController::makeExpandedInvisible,
mNotificationShelfController); mNotificationShelfController);
@@ -1855,7 +1856,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
public void onLaunchAnimationCancelled(boolean isLaunchForActivity) { public void onLaunchAnimationCancelled(boolean isLaunchForActivity) {
if (mPresenter.isPresenterFullyCollapsed() && !mPresenter.isCollapsing() if (mPresenter.isPresenterFullyCollapsed() && !mPresenter.isCollapsing()
&& isLaunchForActivity) { && isLaunchForActivity) {
onClosingFinished(); mShadeController.onClosingFinished();
} else { } else {
mShadeController.collapseShade(true /* animate */); mShadeController.collapseShade(true /* animate */);
} }
@@ -1865,7 +1866,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
@Override @Override
public void onLaunchAnimationEnd(boolean launchIsFullScreen) { public void onLaunchAnimationEnd(boolean launchIsFullScreen) {
if (!mPresenter.isCollapsing()) { if (!mPresenter.isCollapsing()) {
onClosingFinished(); mShadeController.onClosingFinished();
} }
if (launchIsFullScreen) { if (launchIsFullScreen) {
mShadeController.instantCollapseShade(); mShadeController.instantCollapseShade();
@@ -2051,11 +2052,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
} }
} }
@Override
public GestureRecorder getGestureRecorder() {
return mGestureRec;
}
@Override @Override
public BiometricUnlockController getBiometricUnlockController() { public BiometricUnlockController getBiometricUnlockController() {
return mBiometricUnlockController; return mBiometricUnlockController;
@@ -3339,21 +3335,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
return mLightRevealScrim; return mLightRevealScrim;
} }
@Override
public void onTrackingStarted() {
mShadeController.runPostCollapseRunnables();
}
@Override
public void onClosingFinished() {
mShadeController.runPostCollapseRunnables();
if (!mPresenter.isPresenterFullyCollapsed()) {
// if we set it not to be focusable when collapsing, we have to undo it when we aborted
// the closing
mNotificationShadeWindowController.setNotificationShadeFocusable(true);
}
}
// TODO: Figure out way to remove these. // TODO: Figure out way to remove these.
@Override @Override
public NavigationBarView getNavigationBarView() { public NavigationBarView getNavigationBarView() {
@@ -3585,12 +3566,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
mNotificationIconAreaController.setAnimationsEnabled(!disabled); mNotificationIconAreaController.setAnimationsEnabled(!disabled);
} }
//TODO(b/257041702) delete
@Override
public void makeExpandedVisible(boolean force) {
mShadeController.makeExpandedVisible(force);
}
final ScreenLifecycle.Observer mScreenObserver = new ScreenLifecycle.Observer() { final ScreenLifecycle.Observer mScreenObserver = new ScreenLifecycle.Observer() {
@Override @Override
public void onScreenTurningOn(Runnable onDrawn) { public void onScreenTurningOn(Runnable onDrawn) {

View File

@@ -499,8 +499,18 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
mDumpManager); mDumpManager);
mNotificationPanelViewController.initDependencies( mNotificationPanelViewController.initDependencies(
mCentralSurfaces, mCentralSurfaces,
null,
() -> {}, () -> {},
mNotificationShelfController); mNotificationShelfController);
mNotificationPanelViewController.setTrackingStartedListener(() -> {});
mNotificationPanelViewController.setOpenCloseListener(
new NotificationPanelViewController.OpenCloseListener() {
@Override
public void onClosingFinished() {}
@Override
public void onOpenStarted() {}
});
mNotificationPanelViewController.setHeadsUpManager(mHeadsUpManager); mNotificationPanelViewController.setHeadsUpManager(mHeadsUpManager);
ArgumentCaptor<View.OnAttachStateChangeListener> onAttachStateChangeListenerArgumentCaptor = ArgumentCaptor<View.OnAttachStateChangeListener> onAttachStateChangeListenerArgumentCaptor =
ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class); ArgumentCaptor.forClass(View.OnAttachStateChangeListener.class);