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

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

Merge "Create an interface for NPVC" into udc-dev

parents 46f1d1b8 32c83d9b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ public class DebugDrawable extends Drawable {
        drawDebugInfo(canvas, (int) mLockIconViewController.getTop(), Color.GRAY,
                "mLockIconViewController.getTop()");

        if (mNotificationPanelViewController.getKeyguardShowing()) {
        if (mNotificationPanelViewController.isKeyguardShowing()) {
            // Notifications have the space between those two lines.
            drawDebugInfo(canvas,
                    mNotificationStackScrollLayoutController.getTop()
+274 −280

File changed.

Preview size limit exceeded, changes collapsed.

+14 −5
Original line number Diff line number Diff line
@@ -766,7 +766,7 @@ public class QuickSettingsController {
    /** TODO(b/269742565) Remove this logging */
    private void checkCorrectSplitShadeState(float height) {
        if (mSplitShadeEnabled && height == 0
                && mPanelViewControllerLazy.get().isShadeFullyOpen()) {
                && mPanelViewControllerLazy.get().isShadeFullyExpanded()) {
            Log.wtfStack(TAG, "qsExpansion set to 0 while split shade is expanding or open");
        }
    }
@@ -989,13 +989,22 @@ public class QuickSettingsController {

        // TODO (b/265193930): remove dependency on NPVC
        float shadeExpandedFraction = mBarState == KEYGUARD
                ? mPanelViewControllerLazy.get().getLockscreenShadeDragProgress()
                ? getLockscreenShadeDragProgress()
                : mShadeExpandedFraction;
        mShadeHeaderController.setShadeExpandedFraction(shadeExpandedFraction);
        mShadeHeaderController.setQsExpandedFraction(qsExpansionFraction);
        mShadeHeaderController.setQsVisible(mVisible);
    }

    float getLockscreenShadeDragProgress() {
        // mTransitioningToFullShadeProgress > 0 means we're doing regular lockscreen to shade
        // transition. If that's not the case we should follow QS expansion fraction for when
        // user is pulling from the same top to go directly to expanded QS
        return getTransitioningToFullShadeProgress() > 0
                ? mLockscreenShadeTransitionController.getQSDragProgress()
                : computeExpansionFraction();
    }

    /** */
    public void updateExpansionEnabledAmbient() {
        final float scrollRangeToTop = mAmbientState.getTopPadding() - mQuickQsHeaderHeight;
@@ -1522,7 +1531,7 @@ public class QuickSettingsController {
        if (scrollY > 0 && !mFullyExpanded) {
            // TODO (b/265193930): remove dependency on NPVC
            // If we are scrolling QS, we should be fully expanded.
            mPanelViewControllerLazy.get().expandWithQs();
            mPanelViewControllerLazy.get().expandToQs();
        }
    }

@@ -1727,7 +1736,7 @@ public class QuickSettingsController {
                    return true;
                }
                // TODO (b/265193930): remove dependency on NPVC
                if (mPanelViewControllerLazy.get().getKeyguardShowing()
                if (mPanelViewControllerLazy.get().isKeyguardShowing()
                        && shouldQuickSettingsIntercept(mInitialTouchX, mInitialTouchY, 0)) {
                    // Dragging down on the lockscreen statusbar should prohibit other interactions
                    // immediately, otherwise we'll wait on the touchslop. This is to allow
@@ -1791,7 +1800,7 @@ public class QuickSettingsController {
                    return true;
                } else {
                    mShadeLog.logQsTrackingNotStarted(mInitialTouchY, y, h, touchSlop,
                            getExpanded(), mPanelViewControllerLazy.get().getKeyguardShowing(),
                            getExpanded(), mPanelViewControllerLazy.get().isKeyguardShowing(),
                            isExpansionEnabled());
                }
                break;
+7 −7
Original line number Diff line number Diff line
@@ -35,12 +35,12 @@ import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.window.StatusBarWindowController;

import dagger.Lazy;

import java.util.ArrayList;

import javax.inject.Inject;

import dagger.Lazy;

/** An implementation of {@link ShadeController}. */
@SysUISingleton
public final class ShadeControllerImpl implements ShadeController {
@@ -132,13 +132,13 @@ public final class ShadeControllerImpl implements ShadeController {
                    "animateCollapse(): mExpandedVisible=" + mExpandedVisible + "flags=" + flags);
        }
        if (getNotificationShadeWindowView() != null
                && mNotificationPanelViewController.canPanelBeCollapsed()
                && mNotificationPanelViewController.canBeCollapsed()
                && (flags & CommandQueue.FLAG_EXCLUDE_NOTIFICATION_PANEL) == 0) {
            // release focus immediately to kick off focus change transition
            mNotificationShadeWindowController.setNotificationShadeFocusable(false);

            mNotificationShadeWindowViewController.cancelExpandHelper();
            mNotificationPanelViewController.collapsePanel(true, delayed, speedUpFactor);
            mNotificationPanelViewController.collapse(true, delayed, speedUpFactor);
        }
    }

@@ -155,7 +155,7 @@ public final class ShadeControllerImpl implements ShadeController {

    @Override
    public boolean isShadeFullyOpen() {
        return mNotificationPanelViewController.isShadeFullyOpen();
        return mNotificationPanelViewController.isShadeFullyExpanded();
    }

    @Override
@@ -268,7 +268,7 @@ public final class ShadeControllerImpl implements ShadeController {
        }

        // Ensure the panel is fully collapsed (just in case; bug 6765842, 7260868)
        mNotificationPanelViewController.collapsePanel(false, false, 1.0f);
        mNotificationPanelViewController.collapse(false, false, 1.0f);

        mExpandedVisible = false;
        notifyVisibilityChanged(false);
@@ -290,7 +290,7 @@ public final class ShadeControllerImpl implements ShadeController {
        notifyExpandedVisibleChanged(false);
        mCommandQueue.recomputeDisableFlags(
                mDisplayId,
                mNotificationPanelViewController.hideStatusBarIconsWhenExpanded() /* animate */);
                mNotificationPanelViewController.shouldHideStatusBarIconsWhenExpanded());

        // Trimming will happen later if Keyguard is showing - doing it here might cause a jank in
        // the bouncer appear animation.
+140 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.shade

import android.view.ViewPropertyAnimator
import com.android.systemui.statusbar.GestureRecorder
import com.android.systemui.statusbar.NotificationShelfController
import com.android.systemui.statusbar.phone.CentralSurfaces
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone

/**
 * Allows CentralSurfacesImpl to interact with the shade. Only CentralSurfacesImpl should reference
 * this class. If any method in this class is needed outside of CentralSurfacesImpl, it must be
 * pulled up into ShadeViewController.
 */
interface ShadeSurface : ShadeViewController {
    /** Initialize objects instead of injecting to avoid circular dependencies. */
    fun initDependencies(
        centralSurfaces: CentralSurfaces,
        recorder: GestureRecorder,
        hideExpandedRunnable: Runnable,
        notificationShelfController: NotificationShelfController,
        headsUpManager: HeadsUpManagerPhone
    )

    /**
     * Animate QS collapse by flinging it. If QS is expanded, it will collapse into QQS and stop. If
     * in split shade, it will collapse the whole shade.
     *
     * @param fullyCollapse Do not stop when QS becomes QQS. Fling until QS isn't visible anymore.
     */
    fun animateCollapseQs(fullyCollapse: Boolean)

    /** Returns whether the shade can be collapsed. */
    fun canBeCollapsed(): Boolean

    /** Cancels any pending collapses. */
    fun cancelPendingCollapse()

    /** Cancels the views current animation. */
    fun cancelAnimation()

    /**
     * Close the keyguard user switcher if it is open and capable of closing.
     *
     * Has no effect if user switcher isn't supported, if the user switcher is already closed, or if
     * the user switcher uses "simple" mode. The simple user switcher cannot be closed.
     *
     * @return true if the keyguard user switcher was open, and is now closed
     */
    fun closeUserSwitcherIfOpen(): Boolean

    /** Input focus transfer is about to happen. */
    fun startWaitingForExpandGesture()

    /**
     * Called when this view is no longer waiting for input focus transfer.
     *
     * There are two scenarios behind this function call. First, input focus transfer has
     * successfully happened and this view already received synthetic DOWN event.
     * (mExpectingSynthesizedDown == false). Do nothing.
     *
     * Second, before input focus transfer finished, user may have lifted finger in previous window
     * and this window never received synthetic DOWN event. (mExpectingSynthesizedDown == true). In
     * this case, we use the velocity to trigger fling event.
     *
     * @param velocity unit is in px / millis
     */
    fun stopWaitingForExpandGesture(cancel: Boolean, velocity: Float)

    /** Animates the view from its current alpha to zero then runs the runnable. */
    fun fadeOut(startDelayMs: Long, durationMs: Long, endAction: Runnable): ViewPropertyAnimator

    /** Set whether the bouncer is showing. */
    fun setBouncerShowing(bouncerShowing: Boolean)

    /**
     * Sets whether the shade can handle touches and/or animate, canceling any touch handling or
     * animations in progress.
     */
    fun setTouchAndAnimationDisabled(disabled: Boolean)

    /**
     * Sets the dozing state.
     *
     * @param dozing `true` when dozing.
     * @param animate if transition should be animated.
     */
    fun setDozing(dozing: Boolean, animate: Boolean)

    /** @see view.setImportantForAccessibility */
    fun setImportantForAccessibility(mode: Int)

    /** Sets Qs ScrimEnabled and updates QS state. */
    fun setQsScrimEnabled(qsScrimEnabled: Boolean)

    /** Sets the view's X translation to zero. */
    fun resetTranslation()

    /** Sets the view's alpha to max. */
    fun resetAlpha()

    /** @see ViewGroupFadeHelper.reset */
    fun resetViewGroupFade()

    /** Called when Back gesture has been committed (i.e. a back event has definitely occurred) */
    fun onBackPressed()

    /** Sets progress of the predictive back animation. */
    fun onBackProgressed(progressFraction: Float)

    /** @see com.android.systemui.keyguard.ScreenLifecycle.Observer.onScreenTurningOn */
    fun onScreenTurningOn()

    /**
     * Called when the device's theme changes.
     *
     * TODO(b/274655539) delete?
     */
    fun onThemeChanged()

    /** Updates the shade expansion and [NotificationPanelView] visibility if necessary. */
    fun updateExpansionAndVisibility()

    /** Updates all field values drawn from Resources. */
    fun updateResources()
}
Loading