Merge "Decouple CentralSurfaces and NPVC" into tm-qpr-dev

This commit is contained in:
Justin Weir
2022-11-16 18:03:44 +00:00
committed by Android (Google) Code Review
6 changed files with 19 additions and 49 deletions

View File

@@ -133,9 +133,9 @@ public class DozeLog implements Dumpable {
/**
* Appends fling event to the logs
*/
public void traceFling(boolean expand, boolean aboveThreshold, boolean thresholdNeeded,
public void traceFling(boolean expand, boolean aboveThreshold,
boolean screenOnFromTouch) {
mLogger.logFling(expand, aboveThreshold, thresholdNeeded, screenOnFromTouch);
mLogger.logFling(expand, aboveThreshold, screenOnFromTouch);
}
/**

View File

@@ -96,13 +96,11 @@ class DozeLogger @Inject constructor(
fun logFling(
expand: Boolean,
aboveThreshold: Boolean,
thresholdNeeded: Boolean,
screenOnFromTouch: Boolean
) {
buffer.log(TAG, DEBUG, {
bool1 = expand
bool2 = aboveThreshold
bool3 = thresholdNeeded
bool4 = screenOnFromTouch
}, {
"Fling expand=$bool1 aboveThreshold=$bool2 thresholdNeeded=$bool3 " +

View File

@@ -177,6 +177,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ExpandableView;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.notification.stack.AmbientState;
import com.android.systemui.statusbar.notification.stack.AnimationProperties;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
@@ -253,6 +254,8 @@ public final class NotificationPanelViewController implements Dumpable {
private static final int FLING_COLLAPSE = 1;
/** Fling until QS is completely hidden. */
private static final int FLING_HIDE = 2;
/** The delay to reset the hint text when the hint animation is finished running. */
private static final int HINT_RESET_DELAY_MS = 1200;
private static final long ANIMATION_DELAY_ICON_FADE_IN =
ActivityLaunchAnimator.TIMINGS.getTotalDuration()
- CollapsedStatusBarFragment.FADE_IN_DURATION
@@ -343,6 +346,7 @@ public final class NotificationPanelViewController implements Dumpable {
private final FalsingTapListener mFalsingTapListener = this::falsingAdditionalTapRequired;
private final FragmentListener mQsFragmentListener = new QsFragmentListener();
private final AccessibilityDelegate mAccessibilityDelegate = new ShadeAccessibilityDelegate();
private final NotificationGutsManager mGutsManager;
private long mDownTime;
private boolean mTouchSlopExceededBeforeDown;
@@ -701,6 +705,7 @@ public final class NotificationPanelViewController implements Dumpable {
ConversationNotificationManager conversationNotificationManager,
MediaHierarchyManager mediaHierarchyManager,
StatusBarKeyguardViewManager statusBarKeyguardViewManager,
NotificationGutsManager gutsManager,
NotificationsQSContainerController notificationsQSContainerController,
NotificationStackScrollLayoutController notificationStackScrollLayoutController,
KeyguardStatusViewComponent.Factory keyguardStatusViewComponentFactory,
@@ -754,6 +759,7 @@ public final class NotificationPanelViewController implements Dumpable {
mLockscreenGestureLogger = lockscreenGestureLogger;
mShadeExpansionStateManager = shadeExpansionStateManager;
mShadeLog = shadeLogger;
mGutsManager = gutsManager;
mView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View v) {
@@ -1766,7 +1772,7 @@ public final class NotificationPanelViewController implements Dumpable {
}
public void resetViews(boolean animate) {
mCentralSurfaces.getGutsManager().closeAndSaveGuts(true /* leavebehind */, true /* force */,
mGutsManager.closeAndSaveGuts(true /* leavebehind */, true /* force */,
true /* controls */, -1 /* x */, -1 /* y */, true /* resetMenu */);
if (animate && !isFullyCollapsed()) {
animateCloseQs(true /* animateAway */);
@@ -3711,7 +3717,6 @@ public final class NotificationPanelViewController implements Dumpable {
private void onTrackingStopped(boolean expand) {
mFalsingCollector.onTrackingStopped();
mTracking = false;
mCentralSurfaces.onTrackingStopped(expand);
updatePanelExpansionAndVisibility();
if (expand) {
mNotificationStackScrollLayoutController.setOverScrollAmount(0.0f, true /* onTop */,
@@ -3754,14 +3759,16 @@ public final class NotificationPanelViewController implements Dumpable {
@VisibleForTesting
void onUnlockHintFinished() {
mCentralSurfaces.onHintFinished();
// Delay the reset a bit so the user can read the text.
mKeyguardIndicationController.hideTransientIndicationDelayed(HINT_RESET_DELAY_MS);
mScrimController.setExpansionAffectsAlpha(true);
mNotificationStackScrollLayoutController.setUnlockHintRunning(false);
}
@VisibleForTesting
void onUnlockHintStarted() {
mCentralSurfaces.onUnlockHintStarted();
mFalsingCollector.onUnlockHintStarted();
mKeyguardIndicationController.showActionToUnlock();
mScrimController.setExpansionAffectsAlpha(false);
mNotificationStackScrollLayoutController.setUnlockHintRunning(true);
}
@@ -4787,7 +4794,6 @@ public final class NotificationPanelViewController implements Dumpable {
}
mDozeLog.traceFling(expand, mTouchAboveFalsingThreshold,
mCentralSurfaces.isFalsingThresholdNeeded(),
mCentralSurfaces.isWakeUpComingFromTouch());
// Log collapse gesture if on lock screen.
if (!expand && onKeyguard) {
@@ -4836,9 +4842,6 @@ public final class NotificationPanelViewController implements Dumpable {
*/
private boolean isFalseTouch(float x, float y,
@Classifier.InteractionType int interactionType) {
if (!mCentralSurfaces.isFalsingThresholdNeeded()) {
return false;
}
if (mFalsingManager.isClassifierEnabled()) {
return mFalsingManager.isFalseTouch(interactionType);
}

View File

@@ -54,7 +54,6 @@ import com.android.systemui.shade.NotificationShadeWindowViewController;
import com.android.systemui.statusbar.GestureRecorder;
import com.android.systemui.statusbar.LightRevealScrim;
import com.android.systemui.statusbar.NotificationPresenter;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import java.io.PrintWriter;
@@ -254,8 +253,6 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn
boolean isWakeUpComingFromTouch();
boolean isFalsingThresholdNeeded();
void onKeyguardViewManagerStatesUpdated();
ViewGroup getNotificationScrollLayout();
@@ -413,12 +410,6 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn
void onClosingFinished();
void onUnlockHintStarted();
void onHintFinished();
void onTrackingStopped(boolean expand);
// TODO: Figure out way to remove these.
NavigationBarView getNavigationBarView();
@@ -500,8 +491,6 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn
boolean isKeyguardSecure();
NotificationGutsManager getGutsManager();
void updateNotificationPanelTouchState();
void makeExpandedVisible(boolean force);

View File

@@ -281,6 +281,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
// 1020-1040 reserved for BaseStatusBar
/**
* TODO(b/249277686) delete this
* The delay to reset the hint text when the hint animation is finished running.
*/
private static final int HINT_RESET_DELAY_MS = 1200;
@@ -1802,11 +1803,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
return mWakeUpComingFromTouch;
}
@Override
public boolean isFalsingThresholdNeeded() {
return true;
}
/**
* To be called when there's a state change in StatusBarKeyguardViewManager.
*/
@@ -3411,22 +3407,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
}
}
@Override
public void onUnlockHintStarted() {
mFalsingCollector.onUnlockHintStarted();
mKeyguardIndicationController.showActionToUnlock();
}
@Override
public void onHintFinished() {
// Delay the reset a bit so the user can read the text.
mKeyguardIndicationController.hideTransientIndicationDelayed(HINT_RESET_DELAY_MS);
}
@Override
public void onTrackingStopped(boolean expand) {
}
// TODO: Figure out way to remove these.
@Override
public NavigationBarView getNavigationBarView() {
@@ -4157,11 +4137,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
// End Extra BaseStatusBarMethods.
@Override
public NotificationGutsManager getGutsManager() {
return mGutsManager;
}
boolean isTransientShown() {
return mTransientShown;
}

View File

@@ -133,6 +133,7 @@ import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
import com.android.systemui.statusbar.notification.row.ExpandableView;
import com.android.systemui.statusbar.notification.row.ExpandableView.OnHeightChangedListener;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.notification.stack.AmbientState;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.notification.stack.NotificationRoundnessManager;
@@ -198,6 +199,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
@Mock private KeyguardBottomAreaView mQsFrame;
@Mock private HeadsUpManagerPhone mHeadsUpManager;
@Mock private NotificationShelfController mNotificationShelfController;
@Mock private NotificationGutsManager mGutsManager;
@Mock private KeyguardStatusBarView mKeyguardStatusBar;
@Mock private KeyguardUserSwitcherView mUserSwitcherView;
@Mock private ViewStub mUserSwitcherStubView;
@@ -453,6 +455,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
() -> flingAnimationUtilsBuilder, mStatusBarTouchableRegionManager,
mConversationNotificationManager, mMediaHierarchyManager,
mStatusBarKeyguardViewManager,
mGutsManager,
mNotificationsQSContainerController,
mNotificationStackScrollLayoutController,
mKeyguardStatusViewComponentFactory,
@@ -754,6 +757,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
@Test
public void testOnTouchEvent_expansionResumesAfterBriefTouch() {
mFalsingManager.setIsClassifierEnabled(true);
mFalsingManager.setIsFalseTouch(false);
// Start shade collapse with swipe up
onTouchEvent(MotionEvent.obtain(0L /* downTime */,
0L /* eventTime */, MotionEvent.ACTION_DOWN, 0f /* x */, 0f /* y */,