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

Commit 0513b9e1 authored by Justin Weir's avatar Justin Weir Committed by Android (Google) Code Review
Browse files

Merge "Remove more methods from CentralSurfaces" into tm-qpr-dev

parents 95799ff2 1735f5ed
Loading
Loading
Loading
Loading
+32 −6
Original line number Diff line number Diff line
@@ -393,6 +393,9 @@ public final class NotificationPanelViewController implements Dumpable {
    private final UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
    private int mQsTrackingPointer;
    private VelocityTracker mQsVelocityTracker;
    private TrackingStartedListener mTrackingStartedListener;
    private OpenCloseListener mOpenCloseListener;
    private GestureRecorder mGestureRecorder;
    private boolean mQsTracking;
    /** Whether the ongoing gesture might both trigger the expansion in both the view and QS. */
    private boolean mConflictingQsExpansionGesture;
@@ -1362,6 +1365,14 @@ public final class NotificationPanelViewController implements Dumpable {
        mKeyguardIndicationController.setIndicationArea(mKeyguardBottomArea);
    }

    void setOpenCloseListener(OpenCloseListener openCloseListener) {
        mOpenCloseListener = openCloseListener;
    }

    void setTrackingStartedListener(TrackingStartedListener trackingStartedListener) {
        mTrackingStartedListener = trackingStartedListener;
    }

    private void updateGestureExclusionRect() {
        Rect exclusionRect = calculateGestureExclusionRect();
        mView.setSystemGestureExclusionRects(exclusionRect.isEmpty() ? Collections.emptyList()
@@ -1936,9 +1947,9 @@ public final class NotificationPanelViewController implements Dumpable {
    }

    private void fling(float vel) {
        GestureRecorder gr = mCentralSurfaces.getGestureRecorder();
        if (gr != null) {
            gr.tag("fling " + ((vel > 0) ? "open" : "closed"), "notifications,v=" + vel);
        if (mGestureRecorder != null) {
            mGestureRecorder.tag("fling " + ((vel > 0) ? "open" : "closed"),
                    "notifications,v=" + vel);
        }
        fling(vel, true, 1.0f /* collapseSpeedUpFactor */, false);
    }
@@ -3726,7 +3737,7 @@ public final class NotificationPanelViewController implements Dumpable {
        mFalsingCollector.onTrackingStarted(!mKeyguardStateController.canDismissLockScreen());
        endClosing();
        mTracking = true;
        mCentralSurfaces.onTrackingStarted();
        mTrackingStartedListener.onTrackingStarted();
        notifyExpandingStarted();
        updatePanelExpansionAndVisibility();
        mScrimController.onTrackingStarted();
@@ -3960,7 +3971,7 @@ public final class NotificationPanelViewController implements Dumpable {
    }

    private void onClosingFinished() {
        mCentralSurfaces.onClosingFinished();
        mOpenCloseListener.onClosingFinished();
        setClosingWithAlphaFadeout(false);
        mMediaHierarchyManager.closeGuts();
    }
@@ -4519,11 +4530,13 @@ public final class NotificationPanelViewController implements Dumpable {
     */
    public void initDependencies(
            CentralSurfaces centralSurfaces,
            GestureRecorder recorder,
            Runnable hideExpandedRunnable,
            NotificationShelfController notificationShelfController) {
        // TODO(b/254859580): this can be injected.
        mCentralSurfaces = centralSurfaces;

        mGestureRecorder = recorder;
        mHideExpandedRunnable = hideExpandedRunnable;
        mNotificationStackScrollLayoutController.setShelfController(notificationShelfController);
        mNotificationShelfController = notificationShelfController;
@@ -5772,7 +5785,7 @@ public final class NotificationPanelViewController implements Dumpable {
            if (mSplitShadeEnabled && !isOnKeyguard()) {
                setQsExpandImmediate(true);
            }
            mCentralSurfaces.makeExpandedVisible(false);
            mOpenCloseListener.onOpenStarted();
        }
        if (state == STATE_CLOSED) {
            setQsExpandImmediate(false);
@@ -6255,4 +6268,17 @@ public final class NotificationPanelViewController implements Dumpable {
            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();
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -111,6 +111,9 @@ public interface ShadeController {
    /** Handle status bar touch event. */
    void onStatusBarTouch(MotionEvent event);

    /** Called when the shade finishes collapsing. */
    void onClosingFinished();

    /** Sets the listener for when the visibility of the shade changes. */
    void setVisibilityListener(ShadeVisibilityListener listener);

+23 −0
Original line number Diff line number Diff line
@@ -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
    public void instantCollapseShade() {
        mNotificationPanelViewController.instantCollapse();
@@ -329,5 +339,18 @@ public final class ShadeControllerImpl implements ShadeController {
    public void setNotificationPanelViewController(
            NotificationPanelViewController 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);
                    }
                });
    }
}
+0 −14
Original line number Diff line number Diff line
@@ -51,7 +51,6 @@ import com.android.systemui.qs.QSPanelController;
import com.android.systemui.shade.NotificationPanelViewController;
import com.android.systemui.shade.NotificationShadeWindowView;
import com.android.systemui.shade.NotificationShadeWindowViewController;
import com.android.systemui.statusbar.GestureRecorder;
import com.android.systemui.statusbar.LightRevealScrim;
import com.android.systemui.statusbar.NotificationPresenter;

@@ -286,8 +285,6 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn

    void onTouchEvent(MotionEvent event);

    GestureRecorder getGestureRecorder();

    BiometricUnlockController getBiometricUnlockController();

    void showWirelessChargingAnimation(int batteryLevel);
@@ -402,10 +399,6 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn

    LightRevealScrim getLightRevealScrim();

    void onTrackingStarted();

    void onClosingFinished();

    // TODO: Figure out way to remove these.
    NavigationBarView getNavigationBarView();

@@ -489,13 +482,6 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn

    void updateNotificationPanelTouchState();

    /**
     * TODO(b/257041702) delete this
     * @deprecated Use ShadeController#makeExpandedVisible
     */
    @Deprecated
    void makeExpandedVisible(boolean force);

    int getDisplayId();

    int getRotation();
+3 −28
Original line number Diff line number Diff line
@@ -1257,6 +1257,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {

        mNotificationPanelViewController.initDependencies(
                this,
                mGestureRec,
                mShadeController::makeExpandedInvisible,
                mNotificationShelfController);

@@ -1855,7 +1856,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
    public void onLaunchAnimationCancelled(boolean isLaunchForActivity) {
        if (mPresenter.isPresenterFullyCollapsed() && !mPresenter.isCollapsing()
                && isLaunchForActivity) {
            onClosingFinished();
            mShadeController.onClosingFinished();
        } else {
            mShadeController.collapseShade(true /* animate */);
        }
@@ -1865,7 +1866,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
    @Override
    public void onLaunchAnimationEnd(boolean launchIsFullScreen) {
        if (!mPresenter.isCollapsing()) {
            onClosingFinished();
            mShadeController.onClosingFinished();
        }
        if (launchIsFullScreen) {
            mShadeController.instantCollapseShade();
@@ -2051,11 +2052,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        }
    }

    @Override
    public GestureRecorder getGestureRecorder() {
        return mGestureRec;
    }

    @Override
    public BiometricUnlockController getBiometricUnlockController() {
        return mBiometricUnlockController;
@@ -3338,21 +3334,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        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.
    @Override
    public NavigationBarView getNavigationBarView() {
@@ -3584,12 +3565,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        mNotificationIconAreaController.setAnimationsEnabled(!disabled);
    }

    //TODO(b/257041702) delete
    @Override
    public void makeExpandedVisible(boolean force) {
        mShadeController.makeExpandedVisible(force);
    }

    final ScreenLifecycle.Observer mScreenObserver = new ScreenLifecycle.Observer() {
        @Override
        public void onScreenTurningOn(Runnable onDrawn) {
Loading