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

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

Merge changes I88154864,Ie0ea67ac into udc-qpr-dev

* changes:
  Create an empty ShadeViewController implementation
  Remove getShadeViewController call
parents f29c879c 043ceb9a
Loading
Loading
Loading
Loading
+2 −22
Original line number Diff line number Diff line
@@ -168,7 +168,6 @@ import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.NotificationShelfController;
import com.android.systemui.statusbar.PulseExpansionHandler;
import com.android.systemui.statusbar.RemoteInputController;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.VibratorHelper;
@@ -224,6 +223,8 @@ import com.android.systemui.util.Utils;
import com.android.systemui.util.time.SystemClock;
import com.android.wm.shell.animation.FlingAnimationUtils;

import kotlin.Unit;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
@@ -234,8 +235,6 @@ import java.util.function.Consumer;
import javax.inject.Inject;
import javax.inject.Provider;

import kotlin.Unit;

import kotlinx.coroutines.CoroutineDispatcher;

@SysUISingleton
@@ -440,8 +439,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    private final FalsingCollector mFalsingCollector;
    private final ShadeHeadsUpTrackerImpl mShadeHeadsUpTracker = new ShadeHeadsUpTrackerImpl();
    private final ShadeFoldAnimator mShadeFoldAnimator = new ShadeFoldAnimatorImpl();
    private final ShadeNotificationPresenterImpl mShadeNotificationPresenter =
            new ShadeNotificationPresenterImpl();

    private boolean mShowIconsWhenExpanded;
    private int mIndicationBottomPadding;
@@ -3323,23 +3320,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        ).printTableData(ipw);
    }

    private final class ShadeNotificationPresenterImpl implements ShadeNotificationPresenter{
        @Override
        public RemoteInputController.Delegate createRemoteInputDelegate() {
            return mNotificationStackScrollLayoutController.createDelegate();
        }

        @Override
        public boolean hasPulsingNotifications() {
            return mNotificationListContainer.hasPulsingNotifications();
        }
    }

    @Override
    public ShadeNotificationPresenter getShadeNotificationPresenter() {
        return mShadeNotificationPresenter;
    }

    @Override
    public void initDependencies(
            CentralSurfaces centralSurfaces,
+4 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ 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.notification.stack.NotificationStackScrollLayoutController
import com.android.systemui.statusbar.phone.CentralSurfaces
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone

@@ -63,6 +64,9 @@ interface ShadeSurface : ShadeViewController {
    /** Animates the view from its current alpha to zero then runs the runnable. */
    fun fadeOut(startDelayMs: Long, durationMs: Long, endAction: Runnable): ViewPropertyAnimator

    /** Returns the NSSL controller. */
    val notificationStackScrollLayoutController: NotificationStackScrollLayoutController

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

+1 −18
Original line number Diff line number Diff line
@@ -19,9 +19,7 @@ import android.view.MotionEvent
import android.view.ViewGroup
import android.view.ViewTreeObserver
import com.android.systemui.keyguard.shared.model.WakefulnessModel
import com.android.systemui.statusbar.RemoteInputController
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController
import com.android.systemui.statusbar.phone.HeadsUpAppearanceController
import com.android.systemui.statusbar.phone.KeyguardStatusBarView
import com.android.systemui.statusbar.phone.KeyguardStatusBarViewController
@@ -141,9 +139,6 @@ interface ShadeViewController {
    /** Returns the StatusBarState. */
    val barState: Int

    /** Returns the NSSL controller. */
    val notificationStackScrollLayoutController: NotificationStackScrollLayoutController

    /** Sets the amount of progress in the status bar launch animation. */
    fun applyLaunchAnimationProgress(linearProgress: Float)

@@ -261,9 +256,6 @@ interface ShadeViewController {
    /** Returns the ShadeFoldAnimator. */
    val shadeFoldAnimator: ShadeFoldAnimator

    /** Returns the ShadeNotificationPresenter. */
    val shadeNotificationPresenter: ShadeNotificationPresenter

    companion object {
        /**
         * Returns a multiplicative factor to use when determining the falsing threshold for touches
@@ -325,16 +317,7 @@ interface ShadeFoldAnimator {
    fun cancelFoldToAodAnimation()

    /** Returns the main view of the shade. */
    val view: ViewGroup
}

/** Handles the shade's interactions with StatusBarNotificationPresenter. */
interface ShadeNotificationPresenter {
    /** Returns a new delegate for some view controller pieces of the remote input process. */
    fun createRemoteInputDelegate(): RemoteInputController.Delegate

    /** Returns whether the screen has temporarily woken up to display notifications. */
    fun hasPulsingNotifications(): Boolean
    val view: ViewGroup?
}

/**
+111 −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.MotionEvent
import android.view.ViewGroup
import android.view.ViewTreeObserver
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.phone.HeadsUpAppearanceController
import java.util.function.Consumer
import javax.inject.Inject

/** Empty implementation of ShadeViewController for variants with no shade. */
class ShadeViewControllerEmptyImpl @Inject constructor() : ShadeViewController {
    override fun expand(animate: Boolean) {}
    override fun expandToQs() {}
    override fun expandToNotifications() {}
    override val isExpandingOrCollapsing: Boolean = false
    override val isExpanded: Boolean = false
    override val isPanelExpanded: Boolean = false
    override val isShadeFullyExpanded: Boolean = false
    override fun collapse(delayed: Boolean, speedUpFactor: Float) {}
    override fun collapse(animate: Boolean, delayed: Boolean, speedUpFactor: Float) {}
    override fun collapseWithDuration(animationDuration: Int) {}
    override fun instantCollapse() {}
    override fun animateCollapseQs(fullyCollapse: Boolean) {}
    override fun canBeCollapsed(): Boolean = false
    override val isCollapsing: Boolean = false
    override val isFullyCollapsed: Boolean = false
    override val isTracking: Boolean = false
    override val isViewEnabled: Boolean = false
    override fun setOpenCloseListener(openCloseListener: OpenCloseListener) {}
    override fun shouldHideStatusBarIconsWhenExpanded() = false
    override fun blockExpansionForCurrentTouch() {}
    override fun setTrackingStartedListener(trackingStartedListener: TrackingStartedListener) {}
    override fun disableHeader(state1: Int, state2: Int, animated: Boolean) {}
    override fun startExpandLatencyTracking() {}
    override fun startBouncerPreHideAnimation() {}
    override fun dozeTimeTick() {}
    override fun resetViews(animate: Boolean) {}
    override val barState: Int = 0
    override fun applyLaunchAnimationProgress(linearProgress: Float) {}
    override fun closeUserSwitcherIfOpen(): Boolean {
        return false
    }
    override fun onBackPressed() {}
    override fun setIsLaunchAnimationRunning(running: Boolean) {}
    override fun setAlpha(alpha: Int, animate: Boolean) {}
    override fun setAlphaChangeAnimationEndAction(r: Runnable) {}
    override fun setPulsing(pulsing: Boolean) {}
    override fun setQsScrimEnabled(qsScrimEnabled: Boolean) {}
    override fun setAmbientIndicationTop(ambientIndicationTop: Int, ambientTextVisible: Boolean) {}
    override fun updateSystemUiStateFlags() {}
    override fun updateTouchableRegion() {}
    override fun addOnGlobalLayoutListener(listener: ViewTreeObserver.OnGlobalLayoutListener) {}
    override fun removeOnGlobalLayoutListener(listener: ViewTreeObserver.OnGlobalLayoutListener) {}
    override fun postToView(action: Runnable): Boolean {
        return false
    }
    override fun transitionToExpandedShade(delay: Long) {}
    override val isUnlockHintRunning: Boolean = false

    override fun resetViewGroupFade() {}
    override fun setKeyguardTransitionProgress(keyguardAlpha: Float, keyguardTranslationY: Int) {}
    override fun setOverStretchAmount(amount: Float) {}
    override fun setKeyguardStatusBarAlpha(alpha: Float) {}
    override fun showAodUi() {}
    override fun isFullyExpanded(): Boolean {
        return false
    }
    override fun handleExternalTouch(event: MotionEvent): Boolean {
        return false
    }
    override fun startTrackingExpansionFromStatusBar() {}
    override val shadeHeadsUpTracker = ShadeHeadsUpTrackerEmptyImpl()
    override val shadeFoldAnimator = ShadeFoldAnimatorEmptyImpl()
}

class ShadeHeadsUpTrackerEmptyImpl : ShadeHeadsUpTracker {
    override fun addTrackingHeadsUpListener(listener: Consumer<ExpandableNotificationRow>) {}
    override fun removeTrackingHeadsUpListener(listener: Consumer<ExpandableNotificationRow>) {}
    override fun setHeadsUpAppearanceController(
        headsUpAppearanceController: HeadsUpAppearanceController?
    ) {}
    override val trackedHeadsUpNotification: ExpandableNotificationRow? = null
}

class ShadeFoldAnimatorEmptyImpl : ShadeFoldAnimator {
    override fun prepareFoldToAodAnimation() {}
    override fun startFoldToAodAnimation(
        startAction: Runnable,
        endAction: Runnable,
        cancelAction: Runnable,
    ) {}
    override fun cancelFoldToAodAnimation() {}
    override val view: ViewGroup? = null
}
+8 −4
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
import com.android.systemui.shade.ShadeController
import com.android.systemui.shade.ShadeLogger
import com.android.systemui.shade.ShadeViewController
import com.android.systemui.shared.animation.UnfoldMoveFromCenterAnimator
import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.unfold.SysUIUnfoldComponent
@@ -51,6 +52,7 @@ class PhoneStatusBarViewController private constructor(
    @Named(UNFOLD_STATUS_BAR) private val progressProvider: ScopedUnfoldTransitionProgressProvider?,
    private val centralSurfaces: CentralSurfaces,
    private val shadeController: ShadeController,
    private val shadeViewController: ShadeViewController,
    private val shadeLogger: ShadeLogger,
    private val moveFromCenterAnimationController: StatusBarMoveFromCenterAnimationController?,
    private val userChipViewModel: StatusBarUserChipViewModel,
@@ -165,20 +167,20 @@ class PhoneStatusBarViewController private constructor(
            if (event.action == MotionEvent.ACTION_DOWN) {
                // If the view that would receive the touch is disabled, just have status
                // bar eat the gesture.
                if (!centralSurfaces.shadeViewController.isViewEnabled) {
                if (!shadeViewController.isViewEnabled) {
                    shadeLogger.logMotionEvent(event,
                            "onTouchForwardedFromStatusBar: panel view disabled")
                    return true
                }
                if (centralSurfaces.shadeViewController.isFullyCollapsed &&
                if (shadeViewController.isFullyCollapsed &&
                        event.y < 1f) {
                    // b/235889526 Eat events on the top edge of the phone when collapsed
                    shadeLogger.logMotionEvent(event, "top edge touch ignored")
                    return true
                }
                centralSurfaces.shadeViewController.startTrackingExpansionFromStatusBar()
                shadeViewController.startTrackingExpansionFromStatusBar()
            }
            return centralSurfaces.shadeViewController.handleExternalTouch(event)
            return shadeViewController.handleExternalTouch(event)
        }
    }

@@ -222,6 +224,7 @@ class PhoneStatusBarViewController private constructor(
        private val userChipViewModel: StatusBarUserChipViewModel,
        private val centralSurfaces: CentralSurfaces,
        private val shadeController: ShadeController,
        private val shadeViewController: ShadeViewController,
        private val shadeLogger: ShadeLogger,
        private val viewUtil: ViewUtil,
        private val configurationController: ConfigurationController,
@@ -241,6 +244,7 @@ class PhoneStatusBarViewController private constructor(
                    progressProvider.getOrNull(),
                    centralSurfaces,
                    shadeController,
                    shadeViewController,
                    shadeLogger,
                    statusBarMoveFromCenterAnimationController,
                    userChipViewModel,
Loading